summaryrefslogtreecommitdiff
path: root/gcc/config/alpha/sync.md
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-20 04:54:11 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-20 04:54:11 +0000
commit87121034113f8b3bb96db325d3260d806f4e103a (patch)
tree4acdd6c4898d643fa0b840941a2d12315366ec66 /gcc/config/alpha/sync.md
parent039f212de27c41c806d96f52be4b534138dbfc10 (diff)
downloadgcc-87121034113f8b3bb96db325d3260d806f4e103a.tar.gz
* builtins.c (expand_builtin_sync_operation): Revert last change.
* optabs.c (expand_bool_compare_and_swap): Compare vs old value, not vs new value. (expand_compare_and_swap_loop): Likewise. (expand_sync_operation): Remove fallback from NAND to AND; invert memory operand when expanding from cmpxchg. (expand_sync_fetch_operation): Likewise. * doc/extend.texi (Atomic Builtins): Fix docs for nand and compare-and-swap. * config/alpha/alpha.c (alpha_split_atomic_op): Invert memory operand when implementing NAND. Fix double-add for AFTER. * config/alpha/sync.md (sync_nand<I48MODE>): Invert memory operand. (sync_old_nand<I48MODE>, sync_new_nand<I48MODE>): Likewise. (sync_compare_and_swap<I48MODE>): Fix compare vs zero. Return old memory value. (sync_lock_test_and_set<I48MODE>): Remove extra label and last memory barrier. * config/i386/sync.md (sync_compare_and_swap<IMODE>): Fix pattern to return old memory value. (sync_compare_and_swap_cc<IMODE>): Likewise. * config/ia64/ia64.c (ia64_dependencies_evaluation_hook): Early return pre-reload. Don't consider output or anti dependencies. * config/ia64/sync.md (IMODE): New. (modesuffix): Add QI and HI. (memory_barrier): Simplify expansion. (sync_compare_and_swap<IMODE>): Use IMODE, not I48MODE. (cmpxchg_acq_<IMODE>): Likewise. (sync_lock_test_and_set<IMODE>): Likewise. (sync_lock_release<IMODE>): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98436 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/alpha/sync.md')
-rw-r--r--gcc/config/alpha/sync.md35
1 files changed, 14 insertions, 21 deletions
diff --git a/gcc/config/alpha/sync.md b/gcc/config/alpha/sync.md
index 755a3f3e2e9..937a17a8e4f 100644
--- a/gcc/config/alpha/sync.md
+++ b/gcc/config/alpha/sync.md
@@ -94,10 +94,8 @@
(define_insn_and_split "sync_nand<mode>"
[(set (match_operand:I48MODE 0 "memory_operand" "+m")
(unspec_volatile:I48MODE
- [(and:I48MODE
- (not:I48MODE
- (match_operand:I48MODE 1 "reg_or_8bit_operand" "rI"))
- (match_dup 0))]
+ [(and:I48MODE (not:I48MODE (match_dup 0))
+ (match_operand:I48MODE 1 "register_operand" "r"))]
UNSPECV_ATOMIC))
(clobber (match_scratch:I48MODE 2 "=&r"))]
""
@@ -136,10 +134,8 @@
(match_operand:I48MODE 1 "memory_operand" "+m"))
(set (match_dup 1)
(unspec_volatile:I48MODE
- [(and:I48MODE
- (not:I48MODE
- (match_operand:I48MODE 2 "reg_or_8bit_operand" "rI"))
- (match_dup 1))]
+ [(and:I48MODE (not:I48MODE (match_dup 1))
+ (match_operand:I48MODE 2 "register_operand" "r"))]
UNSPECV_ATOMIC))
(clobber (match_scratch:I48MODE 3 "=&r"))]
""
@@ -177,12 +173,11 @@
(define_insn_and_split "sync_new_nand<mode>"
[(set (match_operand:I48MODE 0 "register_operand" "=&r")
(and:I48MODE
- (not:I48MODE
- (match_operand:I48MODE 2 "reg_or_8bit_operand" "rI"))
- (match_operand:I48MODE 1 "memory_operand" "+m")))
+ (not:I48MODE (match_operand:I48MODE 1 "memory_operand" "+m"))
+ (match_operand:I48MODE 2 "reg_or_8bit_operand" "rI")))
(set (match_dup 1)
(unspec_volatile:I48MODE
- [(and:I48MODE (not:I48MODE (match_dup 2)) (match_dup 1))]
+ [(and:I48MODE (not:I48MODE (match_dup 1)) (match_dup 2))]
UNSPECV_ATOMIC))
(clobber (match_scratch:I48MODE 3 "=&r"))]
""
@@ -246,9 +241,11 @@
emit_insn (gen_load_locked_<mode> (retval, mem));
x = gen_lowpart (DImode, retval);
- x = gen_rtx_EQ (DImode, x, oldval);
- if (oldval != const0_rtx)
+ if (oldval == const0_rtx)
+ x = gen_rtx_NE (DImode, x, const0_rtx);
+ else
{
+ x = gen_rtx_EQ (DImode, x, oldval);
emit_insn (gen_rtx_SET (VOIDmode, cond, x));
x = gen_rtx_EQ (DImode, cond, const0_rtx);
}
@@ -257,8 +254,7 @@
REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_BR_PROB, very_unlikely, NULL_RTX);
emit_move_insn (scratch, newval);
- emit_move_insn (retval, newval);
-
+
emit_insn (gen_store_conditional_<mode> (cond, mem, scratch));
x = gen_rtx_EQ (DImode, cond, const0_rtx);
@@ -266,8 +262,8 @@
x = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, x));
REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_BR_PROB, very_unlikely, NULL_RTX);
- emit_label (XEXP (label2, 0));
emit_insn (gen_memory_barrier ());
+ emit_label (XEXP (label2, 0));
DONE;
}
[(set_attr "type" "multi")])
@@ -286,7 +282,7 @@
[(const_int 0)]
{
rtx retval, mem, val, scratch;
- rtx cond, label1, label2, x;
+ rtx cond, label1, x;
rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1);
retval = operands[0];
@@ -298,7 +294,6 @@
emit_insn (gen_memory_barrier ());
label1 = gen_rtx_LABEL_REF (DImode, gen_label_rtx ());
- label2 = gen_rtx_LABEL_REF (DImode, gen_label_rtx ());
emit_label (XEXP (label1, 0));
emit_insn (gen_load_locked_<mode> (retval, mem));
@@ -312,8 +307,6 @@
x = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, x));
REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_BR_PROB, very_unlikely, NULL_RTX);
- emit_label (XEXP (label2, 0));
- emit_insn (gen_memory_barrier ());
DONE;
}
[(set_attr "type" "multi")])