From 4c1fd0845eabe44ffba3cce6d79aef941829396d Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 26 Jan 2012 14:07:44 -0800 Subject: [PATCH] m68k: Convert to atomic_test_and_set. * config/m68k/m68k.c (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): New. * config/m68k/sync.md (atomic_test_and_set): Rename from sync_test_and_setqi and adjust the operands. (atomic_test_and_set_1): Rename from sync_test_and_setqi_1 and unconditionally enable. From-SVN: r183585 --- gcc/ChangeLog | 8 ++++++++ gcc/config/m68k/m68k.c | 4 ++++ gcc/config/m68k/sync.md | 18 ++++++++---------- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 32a21d28e80..d849d96d6c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2012-01-27 Richard Henderson + + * config/m68k/m68k.c (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): New. + * config/m68k/sync.md (atomic_test_and_set): Rename from + sync_test_and_setqi and adjust the operands. + (atomic_test_and_set_1): Rename from sync_test_and_setqi_1 + and unconditionally enable. + 2012-01-27 Richard Henderson * config/sparc/sparc.c (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): New. diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index e0edd5b9880..d3ed82b81ea 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -303,6 +303,10 @@ static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED; #undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA #define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA m68k_output_addr_const_extra +/* The value stored by TAS. */ +#undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL +#define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL 128 + static const struct attribute_spec m68k_attribute_table[] = { /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler, diff --git a/gcc/config/m68k/sync.md b/gcc/config/m68k/sync.md index a40a5bfe557..5d5002a9c81 100644 --- a/gcc/config/m68k/sync.md +++ b/gcc/config/m68k/sync.md @@ -56,25 +56,23 @@ ;; Elide the seq if operands[0] is dead. "cas %1,%4,%2\;seq %0") -(define_expand "sync_test_and_setqi" - [(match_operand:QI 0 "register_operand" "") - (match_operand:QI 1 "memory_operand" "") - (match_operand:QI 2 "general_operand" "")] - "!TARGET_CAS" +(define_expand "atomic_test_and_set" + [(match_operand:QI 0 "register_operand" "") ;; bool success output + (match_operand:QI 1 "memory_operand" "") ;; memory + (match_operand:SI 2 "const_int_operand" "")] ;; model + "" { - if (operands[2] != const1_rtx) - FAIL; - emit_insn (gen_sync_test_and_setqi_1 (operands[0], operands[1])); + emit_insn (gen_atomic_test_and_set_1 (operands[0], operands[1])); emit_insn (gen_negqi2 (operands[0], operands[0])); DONE; }) -(define_insn "sync_test_and_setqi_1" +(define_insn "atomic_test_and_set_1" [(set (match_operand:QI 0 "register_operand" "=d") (unspec_volatile:QI [(match_operand:QI 1 "memory_operand" "+m")] UNSPECV_TAS_1)) (set (match_dup 1) (unspec_volatile:QI [(match_dup 1)] UNSPECV_TAS_2))] - "!TARGET_CAS" + "" "tas %1\;sne %0")