summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-28 20:03:22 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-28 20:03:22 +0000
commitf37fec306ff514e4e709822f2cca415fb23a077f (patch)
treeff20c002d1ff5e6b391d7f6b4bb30cc5446ac971 /gcc/optabs.c
parent4dd7c283b095c8595c2d4458629c3b4df0d5d3e9 (diff)
downloadgcc-f37fec306ff514e4e709822f2cca415fb23a077f.tar.gz
gcc/
* target-insns.def (atomic_test_and_set): New targetm instruction pattern. * optabs.c (maybe_emit_atomic_test_and_set): Use it instead of HAVE_*/gen_* interface. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226325 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index c527d8c049b..a6ca706a170 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7258,35 +7258,30 @@ maybe_emit_compare_and_swap_exchange_loop (rtx target, rtx mem, rtx val)
using the atomic_test_and_set instruction pattern. A boolean value
is returned from the operation, using TARGET if possible. */
-#ifndef HAVE_atomic_test_and_set
-#define HAVE_atomic_test_and_set 0
-#define CODE_FOR_atomic_test_and_set CODE_FOR_nothing
-#endif
-
static rtx
maybe_emit_atomic_test_and_set (rtx target, rtx mem, enum memmodel model)
{
machine_mode pat_bool_mode;
struct expand_operand ops[3];
- if (!HAVE_atomic_test_and_set)
+ if (!targetm.have_atomic_test_and_set ())
return NULL_RTX;
/* While we always get QImode from __atomic_test_and_set, we get
other memory modes from __sync_lock_test_and_set. Note that we
use no endian adjustment here. This matches the 4.6 behavior
in the Sparc backend. */
- gcc_checking_assert
- (insn_data[CODE_FOR_atomic_test_and_set].operand[1].mode == QImode);
+ enum insn_code icode = targetm.code_for_atomic_test_and_set;
+ gcc_checking_assert (insn_data[icode].operand[1].mode == QImode);
if (GET_MODE (mem) != QImode)
mem = adjust_address_nv (mem, QImode, 0);
- pat_bool_mode = insn_data[CODE_FOR_atomic_test_and_set].operand[0].mode;
+ pat_bool_mode = insn_data[icode].operand[0].mode;
create_output_operand (&ops[0], target, pat_bool_mode);
create_fixed_operand (&ops[1], mem);
create_integer_operand (&ops[2], model);
- if (maybe_expand_insn (CODE_FOR_atomic_test_and_set, 3, ops))
+ if (maybe_expand_insn (icode, 3, ops))
return ops[0].value;
return NULL_RTX;
}