Commit a0274e3e by Jakub Jelinek Committed by Richard Henderson

backport: builtins.def: Move all DEF_SYNC_BUILTIN to ...

        Merge from gomp-branch.
        * builtins.def: Move all DEF_SYNC_BUILTIN to ...
        * sync-builtins.def: ... new file.
        (BUILT_IN_FETCH_AND_ADD_16,
        BUILT_IN_FETCH_AND_SUB_16, BUILT_IN_FETCH_AND_OR_16,
        BUILT_IN_FETCH_AND_AND_16, BUILT_IN_FETCH_AND_XOR_16,
        BUILT_IN_FETCH_AND_NAND_16, BUILT_IN_ADD_AND_FETCH_16,
        BUILT_IN_SUB_AND_FETCH_16, BUILT_IN_OR_AND_FETCH_16,
        BUILT_IN_AND_AND_FETCH_16, BUILT_IN_XOR_AND_FETCH_16,
        BUILT_IN_NAND_AND_FETCH_16, BUILT_IN_BOOL_COMPARE_AND_SWAP_16,
        BUILT_IN_VAL_COMPARE_AND_SWAP_16, BUILT_IN_LOCK_TEST_AND_SET_16,
        BUILT_IN_LOCK_RELEASE_16): New builtins.
        * builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16,
        BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
        * builtins.c (expand_builtin): Handle sync BUILT_IN_*_16 builtins.
        * c-common.c (enum c_builtin_type): Move to top-level from
        c_common_nodes_and_builtins enum builtin_type.
        (builtin_types): Move from c_common_nodes_and_builtins.
        (def_fn_type): New.
        (c_common_nodes_and_builtins): Use it.
        (def_builtin_1): Check for error_mark_node.
        (sync_resolve_size): Handle also 128 bit sync builtins.
        * Makefile.in (BUILTINS_DEF): New.  Use it instead of builtins.def.

        * config/i386/i386.h (x86_cmpxchg8b, x86_cmpxchg16b): New decls.
        (TARGET_CMPXCHG8B, TARGET_CMPXCHG16B): Define.
        * config/i386/i386.c (x86_cmpxchg8b, x86_cmpxchg16b): New variables.
        * config/i386/sync.md (CASMODE, DCASMODE): New mode macros.
        (doublemodesuffix, DCASHMODE): New mode attrs.
        (sync_compare_and_swap<mode>): Change into expand, use CASMODE
        instead of IMODE, if mode is wider than a word, expand into
        sync_double_compare_and_swap*.
        (*sync_compare_and_swap<mode>): New insn.
        (sync_double_compare_and_swap<mode>): Likewise.
        (*sync_double_compare_and_swapdi_pic): Likewise.
        (sync_compare_and_swap_cc<mode>): Use CASMODE instead of IMODE, if
        mode is wider than a word, expand into
        sync_double_compare_and_swap_cc*.
        (sync_double_compare_and_swap_cc<mode>): New insn.
        (*sync_double_compare_and_swap_ccdi_pic): Likewise.

From-SVN: r108997
parent c52243fe
2005-12-22 Jakub Jelinek <jakub@redhat.com>
Richard Henderson <rth@redhat.com>
Merge from gomp-branch.
* builtins.def: Move all DEF_SYNC_BUILTIN to ...
* sync-builtins.def: ... new file.
(BUILT_IN_FETCH_AND_ADD_16,
BUILT_IN_FETCH_AND_SUB_16, BUILT_IN_FETCH_AND_OR_16,
BUILT_IN_FETCH_AND_AND_16, BUILT_IN_FETCH_AND_XOR_16,
BUILT_IN_FETCH_AND_NAND_16, BUILT_IN_ADD_AND_FETCH_16,
BUILT_IN_SUB_AND_FETCH_16, BUILT_IN_OR_AND_FETCH_16,
BUILT_IN_AND_AND_FETCH_16, BUILT_IN_XOR_AND_FETCH_16,
BUILT_IN_NAND_AND_FETCH_16, BUILT_IN_BOOL_COMPARE_AND_SWAP_16,
BUILT_IN_VAL_COMPARE_AND_SWAP_16, BUILT_IN_LOCK_TEST_AND_SET_16,
BUILT_IN_LOCK_RELEASE_16): New builtins.
* builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16,
BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
* builtins.c (expand_builtin): Handle sync BUILT_IN_*_16 builtins.
* c-common.c (enum c_builtin_type): Move to top-level from
c_common_nodes_and_builtins enum builtin_type.
(builtin_types): Move from c_common_nodes_and_builtins.
(def_fn_type): New.
(c_common_nodes_and_builtins): Use it.
(def_builtin_1): Check for error_mark_node.
(sync_resolve_size): Handle also 128 bit sync builtins.
* Makefile.in (BUILTINS_DEF): New. Use it instead of builtins.def.
* config/i386/i386.h (x86_cmpxchg8b, x86_cmpxchg16b): New decls.
(TARGET_CMPXCHG8B, TARGET_CMPXCHG16B): Define.
* config/i386/i386.c (x86_cmpxchg8b, x86_cmpxchg16b): New variables.
* config/i386/sync.md (CASMODE, DCASMODE): New mode macros.
(doublemodesuffix, DCASHMODE): New mode attrs.
(sync_compare_and_swap<mode>): Change into expand, use CASMODE
instead of IMODE, if mode is wider than a word, expand into
sync_double_compare_and_swap*.
(*sync_compare_and_swap<mode>): New insn.
(sync_double_compare_and_swap<mode>): Likewise.
(*sync_double_compare_and_swapdi_pic): Likewise.
(sync_compare_and_swap_cc<mode>): Use CASMODE instead of IMODE, if
mode is wider than a word, expand into
sync_double_compare_and_swap_cc*.
(sync_double_compare_and_swap_cc<mode>): New insn.
(*sync_double_compare_and_swap_ccdi_pic): Likewise.
2005-12-22 Richard Henderson <rth@redhat.com>
* config/i386/mmintrin.h (_mm_add_si64): Only define for SSE2.
......@@ -186,8 +230,8 @@
Strip away all type conversions after simplifying the
condition.
* tree-cfgcleanup.c (merge_phi_nodes): Allow merging in some
cases the forwarder block dominates the destination.
* tree-cfgcleanup.c (merge_phi_nodes): Allow merging in some
cases the forwarder block dominates the destination.
2005-12-19 DJ Delorie <dj@redhat.com>
......@@ -257,7 +301,7 @@
2005-12-17 Kenneth Zadeck <zadeck@naturalbridge.com>
* flow.c (update_life_info, count_or_remove_death_notes): Fixed
* flow.c (update_life_info, count_or_remove_death_notes): Fixed
latent bug that could happen if update_life_info was called with a
blocks parameter and the call to cleanup_cfg actually deleted one
of those blocks.
......@@ -1027,10 +1071,10 @@
2005-12-15 Paolo Bonzini <bonzini@gnu.org>
* combine.c: Remove force_to_mode's fourth parameter.
(force_to_mode): Do not handle REG.
(canon_reg_for_combine): New.
(make_field_assignment): Use it where the removed argument was non-NULL.
* combine.c: Remove force_to_mode's fourth parameter.
(force_to_mode): Do not handle REG.
(canon_reg_for_combine): New.
(make_field_assignment): Use it where the removed argument was non-NULL.
2005-12-15 Alan Modra <amodra@bigpond.net.au>
......@@ -1206,8 +1250,8 @@
Back out this change:
2005-03-07 Kazu Hirata <kazu@cs.umass.edu>
* recog.c (verify_changes): Make it static.
* recog.h: Remove the corresponding prototype.
* recog.c (verify_changes): Make it static.
* recog.h: Remove the corresponding prototype.
2005-12-13 J"orn Rennecke <joern.rennecke@st.com>
......@@ -1504,7 +1548,7 @@
call_used_regs can't be used to save reg in another reg.
2005-12-08 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Christophe Jaillet <christophe.jaillet@wanadoo.fr>
* ipa-type-escape.c (analyze_variable): Use gcc_assert instead of
abort.
......@@ -1544,7 +1588,7 @@
* tree.h (DECL_EXTERNAL): Clarify documentation.
2005-12-08 Andreas Krebbel <krebbel1@de.ibm.com>
Jakub Jelinek <jakub@redhat.com>
Jakub Jelinek <jakub@redhat.com>
PR target/25268
* config/s390/s390.c (s390_decompose_shift_count): Remove BITS
......@@ -2340,11 +2384,11 @@
2005-12-05 Paolo Bonzini <bonzini@gnu.org>
* config/rs6000/predicates.md (logical_const_operand): Split
out of logical_operand.
(logical_operand): Use it.
* config/rs6000/rs6000.md (cmp -> xor peephole2): Use
logical_const_operand.
* config/rs6000/predicates.md (logical_const_operand): Split
out of logical_operand.
(logical_operand): Use it.
* config/rs6000/rs6000.md (cmp -> xor peephole2): Use
logical_const_operand.
2005-12-05 Jan Beulich <jbeulich@novell.com>
......@@ -2715,7 +2759,7 @@
2005-12-01 Ben Elliston <bje@au.ibm.com>
* mklibgcc.in: Parameterise the script to build soft float
* mklibgcc.in: Parameterise the script to build soft float
functions by iterating over each type, rather than cloning the
code for each type.
......@@ -2756,7 +2800,7 @@
(tree_expr_nonnegative_p): Likewise.
2005-11-30 Dale Johannesen <dalej@apple.com>
Andrew Pinski <pinskia@physics.uc.edu>
Andrew Pinski <pinskia@physics.uc.edu>
* combine.c (find_split_point): Sign extend bitmask
when changing bitfield assignment to IOR of AND.
......
......@@ -736,7 +736,8 @@ RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
input.h real.h statistics.h
RTL_H = $(RTL_BASE_H) genrtl.h
PARAMS_H = params.h params.def
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h builtins.def \
BUILTINS_DEF = builtins.def sync-builtins.def
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
input.h statistics.h vec.h treestruct.def
BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h $(PARTITION_H) \
hard-reg-set.h cfghooks.h $(OBSTACK_H)
......@@ -1592,7 +1593,7 @@ c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(DIAGNOSTIC_H) gt-c-common.h langhooks.h $(VARRAY_H) $(RTL_H) \
$(TARGET_H) $(C_TREE_H) tree-iterator.h langhooks.h tree-mudflap.h \
intl.h opts.h real.h $(CPPLIB_H) tree-inline.h $(HASHTAB_H) \
builtins.def
$(BUILTINS_DEF)
c-pretty-print.o : c-pretty-print.c $(C_PRETTY_PRINT_H) \
$(C_TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) real.h \
......@@ -2147,7 +2148,7 @@ builtins.o : builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(EXPR_H) $(OPTABS_H) insn-config.h $(RECOG_H) output.h typeclass.h \
hard-reg-set.h toplev.h hard-reg-set.h except.h $(TM_P_H) $(PREDICT_H) \
libfuncs.h real.h langhooks.h $(BASIC_BLOCK_H) tree-mudflap.h \
builtins.def $(MACHMODE_H)
$(BUILTINS_DEF) $(MACHMODE_H)
calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \
libfuncs.h $(REGS_H) toplev.h output.h function.h $(TIMEVAR_H) $(TM_P_H) \
......
......@@ -112,6 +112,7 @@ DEF_PRIMITIVE_TYPE (BT_I1, builtin_type_for_size (BITS_PER_UNIT*1, 1))
DEF_PRIMITIVE_TYPE (BT_I2, builtin_type_for_size (BITS_PER_UNIT*2, 1))
DEF_PRIMITIVE_TYPE (BT_I4, builtin_type_for_size (BITS_PER_UNIT*4, 1))
DEF_PRIMITIVE_TYPE (BT_I8, builtin_type_for_size (BITS_PER_UNIT*8, 1))
DEF_PRIMITIVE_TYPE (BT_I16, builtin_type_for_size (BITS_PER_UNIT*16, 1))
DEF_POINTER_TYPE (BT_PTR_CONST_STRING, BT_CONST_STRING)
......@@ -279,6 +280,7 @@ DEF_FUNCTION_TYPE_2 (BT_FN_I1_VPTR_I1, BT_I1, BT_VOLATILE_PTR, BT_I1)
DEF_FUNCTION_TYPE_2 (BT_FN_I2_VPTR_I2, BT_I2, BT_VOLATILE_PTR, BT_I2)
DEF_FUNCTION_TYPE_2 (BT_FN_I4_VPTR_I4, BT_I4, BT_VOLATILE_PTR, BT_I4)
DEF_FUNCTION_TYPE_2 (BT_FN_I8_VPTR_I8, BT_I8, BT_VOLATILE_PTR, BT_I8)
DEF_FUNCTION_TYPE_2 (BT_FN_I16_VPTR_I16, BT_I16, BT_VOLATILE_PTR, BT_I16)
DEF_FUNCTION_TYPE_3 (BT_FN_STRING_STRING_CONST_STRING_SIZE,
BT_STRING, BT_STRING, BT_CONST_STRING, BT_SIZE)
......@@ -333,10 +335,14 @@ DEF_FUNCTION_TYPE_3 (BT_FN_BOOL_VPTR_I4_I4, BT_BOOL, BT_VOLATILE_PTR,
BT_I4, BT_I4)
DEF_FUNCTION_TYPE_3 (BT_FN_BOOL_VPTR_I8_I8, BT_BOOL, BT_VOLATILE_PTR,
BT_I8, BT_I8)
DEF_FUNCTION_TYPE_3 (BT_FN_BOOL_VPTR_I16_I16, BT_BOOL, BT_VOLATILE_PTR,
BT_I16, BT_I16)
DEF_FUNCTION_TYPE_3 (BT_FN_I1_VPTR_I1_I1, BT_I1, BT_VOLATILE_PTR, BT_I1, BT_I1)
DEF_FUNCTION_TYPE_3 (BT_FN_I2_VPTR_I2_I2, BT_I2, BT_VOLATILE_PTR, BT_I2, BT_I2)
DEF_FUNCTION_TYPE_3 (BT_FN_I4_VPTR_I4_I4, BT_I4, BT_VOLATILE_PTR, BT_I4, BT_I4)
DEF_FUNCTION_TYPE_3 (BT_FN_I8_VPTR_I8_I8, BT_I8, BT_VOLATILE_PTR, BT_I8, BT_I8)
DEF_FUNCTION_TYPE_3 (BT_FN_I16_VPTR_I16_I16, BT_I16, BT_VOLATILE_PTR,
BT_I16, BT_I16)
DEF_FUNCTION_TYPE_4 (BT_FN_SIZE_CONST_PTR_SIZE_SIZE_FILEPTR,
BT_SIZE, BT_CONST_PTR, BT_SIZE, BT_SIZE, BT_FILEPTR)
......
......@@ -6073,6 +6073,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_FETCH_AND_ADD_2:
case BUILT_IN_FETCH_AND_ADD_4:
case BUILT_IN_FETCH_AND_ADD_8:
case BUILT_IN_FETCH_AND_ADD_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_FETCH_AND_ADD_1);
target = expand_builtin_sync_operation (mode, arglist, PLUS,
false, target, ignore);
......@@ -6084,6 +6085,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_FETCH_AND_SUB_2:
case BUILT_IN_FETCH_AND_SUB_4:
case BUILT_IN_FETCH_AND_SUB_8:
case BUILT_IN_FETCH_AND_SUB_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_FETCH_AND_SUB_1);
target = expand_builtin_sync_operation (mode, arglist, MINUS,
false, target, ignore);
......@@ -6095,6 +6097,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_FETCH_AND_OR_2:
case BUILT_IN_FETCH_AND_OR_4:
case BUILT_IN_FETCH_AND_OR_8:
case BUILT_IN_FETCH_AND_OR_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_FETCH_AND_OR_1);
target = expand_builtin_sync_operation (mode, arglist, IOR,
false, target, ignore);
......@@ -6106,6 +6109,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_FETCH_AND_AND_2:
case BUILT_IN_FETCH_AND_AND_4:
case BUILT_IN_FETCH_AND_AND_8:
case BUILT_IN_FETCH_AND_AND_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_FETCH_AND_AND_1);
target = expand_builtin_sync_operation (mode, arglist, AND,
false, target, ignore);
......@@ -6117,6 +6121,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_FETCH_AND_XOR_2:
case BUILT_IN_FETCH_AND_XOR_4:
case BUILT_IN_FETCH_AND_XOR_8:
case BUILT_IN_FETCH_AND_XOR_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_FETCH_AND_XOR_1);
target = expand_builtin_sync_operation (mode, arglist, XOR,
false, target, ignore);
......@@ -6128,6 +6133,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_FETCH_AND_NAND_2:
case BUILT_IN_FETCH_AND_NAND_4:
case BUILT_IN_FETCH_AND_NAND_8:
case BUILT_IN_FETCH_AND_NAND_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_FETCH_AND_NAND_1);
target = expand_builtin_sync_operation (mode, arglist, NOT,
false, target, ignore);
......@@ -6139,6 +6145,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_ADD_AND_FETCH_2:
case BUILT_IN_ADD_AND_FETCH_4:
case BUILT_IN_ADD_AND_FETCH_8:
case BUILT_IN_ADD_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_ADD_AND_FETCH_1);
target = expand_builtin_sync_operation (mode, arglist, PLUS,
true, target, ignore);
......@@ -6150,6 +6157,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SUB_AND_FETCH_2:
case BUILT_IN_SUB_AND_FETCH_4:
case BUILT_IN_SUB_AND_FETCH_8:
case BUILT_IN_SUB_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SUB_AND_FETCH_1);
target = expand_builtin_sync_operation (mode, arglist, MINUS,
true, target, ignore);
......@@ -6161,6 +6169,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_OR_AND_FETCH_2:
case BUILT_IN_OR_AND_FETCH_4:
case BUILT_IN_OR_AND_FETCH_8:
case BUILT_IN_OR_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_OR_AND_FETCH_1);
target = expand_builtin_sync_operation (mode, arglist, IOR,
true, target, ignore);
......@@ -6172,6 +6181,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_AND_AND_FETCH_2:
case BUILT_IN_AND_AND_FETCH_4:
case BUILT_IN_AND_AND_FETCH_8:
case BUILT_IN_AND_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_AND_AND_FETCH_1);
target = expand_builtin_sync_operation (mode, arglist, AND,
true, target, ignore);
......@@ -6183,6 +6193,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_XOR_AND_FETCH_2:
case BUILT_IN_XOR_AND_FETCH_4:
case BUILT_IN_XOR_AND_FETCH_8:
case BUILT_IN_XOR_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_XOR_AND_FETCH_1);
target = expand_builtin_sync_operation (mode, arglist, XOR,
true, target, ignore);
......@@ -6194,6 +6205,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_NAND_AND_FETCH_2:
case BUILT_IN_NAND_AND_FETCH_4:
case BUILT_IN_NAND_AND_FETCH_8:
case BUILT_IN_NAND_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_NAND_AND_FETCH_1);
target = expand_builtin_sync_operation (mode, arglist, NOT,
true, target, ignore);
......@@ -6205,6 +6217,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_BOOL_COMPARE_AND_SWAP_2:
case BUILT_IN_BOOL_COMPARE_AND_SWAP_4:
case BUILT_IN_BOOL_COMPARE_AND_SWAP_8:
case BUILT_IN_BOOL_COMPARE_AND_SWAP_16:
if (mode == VOIDmode)
mode = TYPE_MODE (boolean_type_node);
if (!target || !register_operand (target, mode))
......@@ -6220,6 +6233,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_VAL_COMPARE_AND_SWAP_2:
case BUILT_IN_VAL_COMPARE_AND_SWAP_4:
case BUILT_IN_VAL_COMPARE_AND_SWAP_8:
case BUILT_IN_VAL_COMPARE_AND_SWAP_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_VAL_COMPARE_AND_SWAP_1);
target = expand_builtin_compare_and_swap (mode, arglist, false, target);
if (target)
......@@ -6230,6 +6244,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_LOCK_TEST_AND_SET_2:
case BUILT_IN_LOCK_TEST_AND_SET_4:
case BUILT_IN_LOCK_TEST_AND_SET_8:
case BUILT_IN_LOCK_TEST_AND_SET_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_LOCK_TEST_AND_SET_1);
target = expand_builtin_lock_test_and_set (mode, arglist, target);
if (target)
......@@ -6240,6 +6255,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_LOCK_RELEASE_2:
case BUILT_IN_LOCK_RELEASE_4:
case BUILT_IN_LOCK_RELEASE_8:
case BUILT_IN_LOCK_RELEASE_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_LOCK_RELEASE_1);
expand_builtin_lock_release (mode, arglist);
return const0_rtx;
......
......@@ -709,195 +709,5 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_VPRINTF_CHK, "__vprintf_chk", BT_FN_INT_INT_CON
DEF_BUILTIN_STUB (BUILT_IN_PROFILE_FUNC_ENTER, "profile_func_enter")
DEF_BUILTIN_STUB (BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit")
/* Synchronization Primitives. The "_N" version is the one that the user
is supposed to be using. It's overloaded, and is resolved to one of the
"_1" through "_8" versions, plus some extra casts. */
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_N, "__sync_fetch_and_add",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_1, "__sync_fetch_and_add_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_2, "__sync_fetch_and_add_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_4, "__sync_fetch_and_add_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_8, "__sync_fetch_and_add_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_N, "__sync_fetch_and_sub",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_1, "__sync_fetch_and_sub_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_2, "__sync_fetch_and_sub_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_4, "__sync_fetch_and_sub_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_8, "__sync_fetch_and_sub_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_N, "__sync_fetch_and_or",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_1, "__sync_fetch_and_or_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_2, "__sync_fetch_and_or_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_4, "__sync_fetch_and_or_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_8, "__sync_fetch_and_or_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_N, "__sync_fetch_and_and",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_1, "__sync_fetch_and_and_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_2, "__sync_fetch_and_and_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_4, "__sync_fetch_and_and_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_8, "__sync_fetch_and_and_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_N, "__sync_fetch_and_xor",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_1, "__sync_fetch_and_xor_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_2, "__sync_fetch_and_xor_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_4, "__sync_fetch_and_xor_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_8, "__sync_fetch_and_xor_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_N, "__sync_fetch_and_nand",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_1, "__sync_fetch_and_nand_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_2, "__sync_fetch_and_nand_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_4, "__sync_fetch_and_nand_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_8, "__sync_fetch_and_nand_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_N, "__sync_add_and_fetch",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_1, "__sync_add_and_fetch_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_2, "__sync_add_and_fetch_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_4, "__sync_add_and_fetch_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_8, "__sync_add_and_fetch_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_N, "__sync_sub_and_fetch",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_1, "__sync_sub_and_fetch_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_2, "__sync_sub_and_fetch_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_4, "__sync_sub_and_fetch_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_8, "__sync_sub_and_fetch_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_N, "__sync_or_and_fetch",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_1, "__sync_or_and_fetch_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_2, "__sync_or_and_fetch_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_4, "__sync_or_and_fetch_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_8, "__sync_or_and_fetch_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_N, "__sync_and_and_fetch",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_1, "__sync_and_and_fetch_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_2, "__sync_and_and_fetch_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_4, "__sync_and_and_fetch_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_8, "__sync_and_and_fetch_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_N, "__sync_xor_and_fetch",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_1, "__sync_xor_and_fetch_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_2, "__sync_xor_and_fetch_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_4, "__sync_xor_and_fetch_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_8, "__sync_xor_and_fetch_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_N, "__sync_nand_and_fetch",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_1, "__sync_nand_and_fetch_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_2, "__sync_nand_and_fetch_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_4, "__sync_nand_and_fetch_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_8, "__sync_nand_and_fetch_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_N,
"__sync_bool_compare_and_swap",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_1,
"__sync_bool_compare_and_swap_1",
BT_FN_BOOL_VPTR_I1_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_2,
"__sync_bool_compare_and_swap_2",
BT_FN_BOOL_VPTR_I2_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_4,
"__sync_bool_compare_and_swap_4",
BT_FN_BOOL_VPTR_I4_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_8,
"__sync_bool_compare_and_swap_8",
BT_FN_BOOL_VPTR_I8_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_N,
"__sync_val_compare_and_swap",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_1,
"__sync_val_compare_and_swap_1",
BT_FN_I1_VPTR_I1_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_2,
"__sync_val_compare_and_swap_2",
BT_FN_I2_VPTR_I2_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_4,
"__sync_val_compare_and_swap_4",
BT_FN_I4_VPTR_I4_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_8,
"__sync_val_compare_and_swap_8",
BT_FN_I8_VPTR_I8_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_N, "__sync_lock_test_and_set",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_1, "__sync_lock_test_and_set_1",
BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_2, "__sync_lock_test_and_set_2",
BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_4, "__sync_lock_test_and_set_4",
BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_8, "__sync_lock_test_and_set_8",
BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_N, "__sync_lock_release",
BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_1, "__sync_lock_release_1",
BT_FN_VOID_VPTR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_2, "__sync_lock_release_2",
BT_FN_VOID_VPTR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_4, "__sync_lock_release_4",
BT_FN_VOID_VPTR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_8, "__sync_lock_release_8",
BT_FN_VOID_VPTR, ATTR_NOTHROW_LIST)
DEF_SYNC_BUILTIN (BUILT_IN_SYNCHRONIZE, "__sync_synchronize",
BT_FN_VOID, ATTR_NOTHROW_LIST)
/* Synchronization Primitives. */
#include "sync-builtins.def"
......@@ -586,6 +586,10 @@ const int x86_schedule = m_PPRO | m_ATHLON_K8 | m_K6 | m_PENT;
const int x86_use_bt = m_ATHLON_K8;
/* Compare and exchange was added for 80486. */
const int x86_cmpxchg = ~m_386;
/* Compare and exchange 8 bytes was added for pentium. */
const int x86_cmpxchg8b = ~(m_386 | m_486);
/* Compare and exchange 16 bytes was added for nocona. */
const int x86_cmpxchg16b = m_NOCONA;
/* Exchange and add was added for 80486. */
const int x86_xadd = ~m_386;
......
......@@ -162,7 +162,7 @@ extern const int x86_sse_typeless_stores, x86_sse_load0_by_pxor;
extern const int x86_use_ffreep;
extern const int x86_inter_unit_moves, x86_schedule;
extern const int x86_use_bt;
extern const int x86_cmpxchg, x86_xadd;
extern const int x86_cmpxchg, x86_cmpxchg8b, x86_cmpxchg16b, x86_xadd;
extern int x86_prefetch_sse;
#define TARGET_USE_LEAVE (x86_use_leave & TUNEMASK)
......@@ -229,6 +229,8 @@ extern int x86_prefetch_sse;
#define TARGET_SUN_TLS (ix86_tls_dialect == TLS_DIALECT_SUN)
#define TARGET_CMPXCHG (x86_cmpxchg & (1 << ix86_arch))
#define TARGET_CMPXCHG8B (x86_cmpxchg8b & (1 << ix86_arch))
#define TARGET_CMPXCHG16B (x86_cmpxchg16b & (1 << ix86_arch))
#define TARGET_XADD (x86_xadd & (1 << ix86_arch))
#ifndef TARGET_64BIT_DEFAULT
......
......@@ -24,13 +24,54 @@
(define_mode_attr modeconstraint [(QI "q") (HI "r") (SI "r") (DI "r")])
(define_mode_attr immconstraint [(QI "i") (HI "i") (SI "i") (DI "e")])
(define_mode_macro CASMODE [QI HI SI (DI "TARGET_64BIT || TARGET_CMPXCHG8B")
(TI "TARGET_64BIT && TARGET_CMPXCHG16B")])
(define_mode_macro DCASMODE
[(DI "!TARGET_64BIT && TARGET_CMPXCHG8B && !flag_pic")
(TI "TARGET_64BIT && TARGET_CMPXCHG16B")])
(define_mode_attr doublemodesuffix [(DI "8") (TI "16")])
(define_mode_attr DCASHMODE [(DI "SI") (TI "DI")])
;; ??? It would be possible to use cmpxchg8b on pentium for DImode
;; changes. It's complicated because the insn uses ecx:ebx as the
;; new value; note that the registers are reversed from the order
;; that they'd be in with (reg:DI 2 ecx). Similarly for TImode
;; data in 64-bit mode.
(define_insn "sync_compare_and_swap<mode>"
(define_expand "sync_compare_and_swap<mode>"
[(parallel
[(set (match_operand:CASMODE 0 "register_operand" "")
(match_operand:CASMODE 1 "memory_operand" ""))
(set (match_dup 1)
(unspec_volatile:CASMODE
[(match_dup 1)
(match_operand:CASMODE 2 "register_operand" "")
(match_operand:CASMODE 3 "register_operand" "")]
UNSPECV_CMPXCHG_1))
(clobber (reg:CC FLAGS_REG))])]
"TARGET_CMPXCHG"
{
if ((<MODE>mode == DImode && !TARGET_64BIT) || <MODE>mode == TImode)
{
enum machine_mode hmode = <MODE>mode == DImode ? SImode : DImode;
rtx low = simplify_gen_subreg (hmode, operands[3], <MODE>mode, 0);
rtx high = simplify_gen_subreg (hmode, operands[3], <MODE>mode,
GET_MODE_SIZE (hmode));
low = force_reg (hmode, low);
high = force_reg (hmode, high);
if (<MODE>mode == DImode)
emit_insn (gen_sync_double_compare_and_swapdi
(operands[0], operands[1], operands[2], low, high));
else if (<MODE>mode == TImode)
emit_insn (gen_sync_double_compare_and_swapti
(operands[0], operands[1], operands[2], low, high));
else
gcc_unreachable ();
DONE;
}
})
(define_insn "*sync_compare_and_swap<mode>"
[(set (match_operand:IMODE 0 "register_operand" "=a")
(match_operand:IMODE 1 "memory_operand" "+m"))
(set (match_dup 1)
......@@ -43,19 +84,47 @@
"TARGET_CMPXCHG"
"lock\;cmpxchg{<modesuffix>}\t{%3, %1|%1, %3}")
(define_insn "sync_double_compare_and_swap<mode>"
[(set (match_operand:DCASMODE 0 "register_operand" "=A")
(match_operand:DCASMODE 1 "memory_operand" "+m"))
(set (match_dup 1)
(unspec_volatile:DCASMODE
[(match_dup 1)
(match_operand:DCASMODE 2 "register_operand" "A")
(match_operand:<DCASHMODE> 3 "register_operand" "b")
(match_operand:<DCASHMODE> 4 "register_operand" "c")]
UNSPECV_CMPXCHG_1))
(clobber (reg:CC FLAGS_REG))]
""
"lock\;cmpxchg<doublemodesuffix>b\t%1")
(define_insn "*sync_double_compare_and_swapdi_pic"
[(set (match_operand:DI 0 "register_operand" "=A")
(match_operand:DI 1 "memory_operand" "+m"))
(set (match_dup 1)
(unspec_volatile:DI
[(match_dup 1)
(match_operand:DI 2 "register_operand" "A")
(match_operand:SI 3 "register_operand" "r")
(match_operand:SI 4 "register_operand" "c")]
UNSPECV_CMPXCHG_1))
(clobber (reg:CC FLAGS_REG))]
"!TARGET_64BIT && TARGET_CMPXCHG8B && flag_pic"
"xchg{l}\t%%ebx, %3\;lock\;cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3")
(define_expand "sync_compare_and_swap_cc<mode>"
[(parallel
[(set (match_operand:IMODE 0 "register_operand" "")
(match_operand:IMODE 1 "memory_operand" ""))
[(set (match_operand:CASMODE 0 "register_operand" "")
(match_operand:CASMODE 1 "memory_operand" ""))
(set (match_dup 1)
(unspec_volatile:IMODE
(unspec_volatile:CASMODE
[(match_dup 1)
(match_operand:IMODE 2 "register_operand" "")
(match_operand:IMODE 3 "register_operand" "")]
(match_operand:CASMODE 2 "register_operand" "")
(match_operand:CASMODE 3 "register_operand" "")]
UNSPECV_CMPXCHG_1))
(set (match_dup 4)
(compare:CCZ
(unspec_volatile:IMODE
(unspec_volatile:CASMODE
[(match_dup 1) (match_dup 2) (match_dup 3)] UNSPECV_CMPXCHG_2)
(match_dup 2)))])]
"TARGET_CMPXCHG"
......@@ -64,6 +133,24 @@
ix86_compare_op0 = operands[3];
ix86_compare_op1 = NULL;
ix86_compare_emitted = operands[4];
if ((<MODE>mode == DImode && !TARGET_64BIT) || <MODE>mode == TImode)
{
enum machine_mode hmode = <MODE>mode == DImode ? SImode : DImode;
rtx low = simplify_gen_subreg (hmode, operands[3], <MODE>mode, 0);
rtx high = simplify_gen_subreg (hmode, operands[3], <MODE>mode,
GET_MODE_SIZE (hmode));
low = force_reg (hmode, low);
high = force_reg (hmode, high);
if (<MODE>mode == DImode)
emit_insn (gen_sync_double_compare_and_swap_ccdi
(operands[0], operands[1], operands[2], low, high));
else if (<MODE>mode == TImode)
emit_insn (gen_sync_double_compare_and_swap_ccti
(operands[0], operands[1], operands[2], low, high));
else
gcc_unreachable ();
DONE;
}
})
(define_insn "*sync_compare_and_swap_cc<mode>"
......@@ -83,6 +170,44 @@
"TARGET_CMPXCHG"
"lock\;cmpxchg{<modesuffix>}\t{%3, %1|%1, %3}")
(define_insn "sync_double_compare_and_swap_cc<mode>"
[(set (match_operand:DCASMODE 0 "register_operand" "=A")
(match_operand:DCASMODE 1 "memory_operand" "+m"))
(set (match_dup 1)
(unspec_volatile:DCASMODE
[(match_dup 1)
(match_operand:DCASMODE 2 "register_operand" "A")
(match_operand:<DCASHMODE> 3 "register_operand" "b")
(match_operand:<DCASHMODE> 4 "register_operand" "c")]
UNSPECV_CMPXCHG_1))
(set (reg:CCZ FLAGS_REG)
(compare:CCZ
(unspec_volatile:DCASMODE
[(match_dup 1) (match_dup 2) (match_dup 3) (match_dup 4)]
UNSPECV_CMPXCHG_2)
(match_dup 2)))]
""
"lock\;cmpxchg<doublemodesuffix>b\t%1")
(define_insn "*sync_double_compare_and_swap_ccdi_pic"
[(set (match_operand:DI 0 "register_operand" "=A")
(match_operand:DI 1 "memory_operand" "+m"))
(set (match_dup 1)
(unspec_volatile:DI
[(match_dup 1)
(match_operand:DI 2 "register_operand" "A")
(match_operand:SI 3 "register_operand" "r")
(match_operand:SI 4 "register_operand" "c")]
UNSPECV_CMPXCHG_1))
(set (reg:CCZ FLAGS_REG)
(compare:CCZ
(unspec_volatile:DI
[(match_dup 1) (match_dup 2) (match_dup 3) (match_dup 4)]
UNSPECV_CMPXCHG_2)
(match_dup 2)))]
"!TARGET_64BIT && TARGET_CMPXCHG8B && flag_pic"
"xchg{l}\t%%ebx, %3\;lock\;cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3")
(define_insn "sync_old_add<mode>"
[(set (match_operand:IMODE 0 "register_operand" "=<modeconstraint>")
(unspec_volatile:IMODE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment