Commit be565ad7 by Jakub Jelinek Committed by Jakub Jelinek

ia64.c (ia64_expand_op_and_fetch): Fix comment.

	* config/ia64/ia64.c (ia64_expand_op_and_fetch): Fix comment.
	(ia64_expand_compare_and_swap): Use always DImode ar.ccv,
	zero extend old to it.
	* config/ia64/ia64.md (cmpxchg_acq_si): Remove mode from ccv
	operand.

	* gcc.dg/ia64-sync-3.c: New test.

From-SVN: r64895
parent f729e559
2003-03-26 Jakub Jelinek <jakub@redhat.com>
* config/ia64/ia64.c (ia64_expand_op_and_fetch): Fix comment.
(ia64_expand_compare_and_swap): Use always DImode ar.ccv,
zero extend old to it.
* config/ia64/ia64.md (cmpxchg_acq_si): Remove mode from ccv
operand.
2003-03-26 Eric Botcazou <ebotcazou@libertysurf.fr> 2003-03-26 Eric Botcazou <ebotcazou@libertysurf.fr>
PR target/7784 PR target/7784
......
...@@ -8047,7 +8047,7 @@ ia64_expand_fetch_and_op (binoptab, mode, arglist, target) ...@@ -8047,7 +8047,7 @@ ia64_expand_fetch_and_op (binoptab, mode, arglist, target)
do { do {
old = tmp; old = tmp;
ar.ccv = tmp; ar.ccv = tmp;
ret = tmp + value; ret = tmp <op> value;
cmpxchgsz.acq tmp = [ptr], ret cmpxchgsz.acq tmp = [ptr], ret
} while (tmp != old) } while (tmp != old)
*/ */
...@@ -8150,8 +8150,15 @@ ia64_expand_compare_and_swap (mode, boolp, arglist, target) ...@@ -8150,8 +8150,15 @@ ia64_expand_compare_and_swap (mode, boolp, arglist, target)
else else
tmp = gen_reg_rtx (mode); tmp = gen_reg_rtx (mode);
ccv = gen_rtx_REG (mode, AR_CCV_REGNUM); ccv = gen_rtx_REG (DImode, AR_CCV_REGNUM);
emit_move_insn (ccv, old); if (mode == DImode)
emit_move_insn (ccv, old);
else
{
rtx ccvtmp = gen_reg_rtx (DImode);
emit_insn (gen_zero_extendsidi2 (ccvtmp, old));
emit_move_insn (ccv, ccvtmp);
}
emit_insn (gen_mf ()); emit_insn (gen_mf ());
if (mode == SImode) if (mode == SImode)
insn = gen_cmpxchg_acq_si (tmp, mem, new, ccv); insn = gen_cmpxchg_acq_si (tmp, mem, new, ccv);
......
...@@ -5428,7 +5428,7 @@ ...@@ -5428,7 +5428,7 @@
(set (match_operand:SI 1 "not_postinc_memory_operand" "+S") (set (match_operand:SI 1 "not_postinc_memory_operand" "+S")
(unspec:SI [(match_dup 1) (unspec:SI [(match_dup 1)
(match_operand:SI 2 "gr_register_operand" "r") (match_operand:SI 2 "gr_register_operand" "r")
(match_operand:SI 3 "ar_ccv_reg_operand" "")] (match_operand 3 "ar_ccv_reg_operand" "")]
UNSPEC_CMPXCHG_ACQ))] UNSPEC_CMPXCHG_ACQ))]
"" ""
"cmpxchg4.acq %0 = %1, %2, %3" "cmpxchg4.acq %0 = %1, %2, %3"
......
2003-03-26 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/ia64-sync-3.c: New test.
2003-03-26 Alan Modra <amodra@bigpond.net.au> 2003-03-26 Alan Modra <amodra@bigpond.net.au>
* gcc.dg/loop-2.c: Replace "inline" with "__inline__". * gcc.dg/loop-2.c: Replace "inline" with "__inline__".
......
/* { dg-do run { target ia64-*-* } } */
/* { dg-options } */
/* Test basic functionality of the intrinsics. */
#include <ia64intrin.h>
static int AI[4];
static int init_si[4] = { -30,-30,-50,-50 };
static int test_si[4] = { -115,-115,25,25 };
static void
do_si (void)
{
if (__sync_val_compare_and_swap(AI+0, -30, -115) != -30)
abort ();
if (__sync_val_compare_and_swap(AI+0, -30, -115) != -115)
abort ();
if (__sync_bool_compare_and_swap(AI+1, -30, -115) != 1)
abort ();
if (__sync_bool_compare_and_swap(AI+1, -30, -115) != 0)
abort ();
if (__sync_val_compare_and_swap(AI+2, AI[2], 25) != -50)
abort ();
if (__sync_val_compare_and_swap(AI+2, AI[2], 25) != 25)
abort ();
if (__sync_bool_compare_and_swap(AI+3, AI[3], 25) != 1)
abort ();
if (__sync_bool_compare_and_swap(AI+3, AI[3], 25) != 1)
abort ();
}
static long AL[4];
static long init_di[4] = { -30,-30,-50,-50 };
static long test_di[4] = { -115,-115,25,25 };
static void
do_di (void)
{
if (__sync_val_compare_and_swap(AL+0, -30, -115) != -30)
abort ();
if (__sync_val_compare_and_swap(AL+0, -30, -115) != -115)
abort ();
if (__sync_bool_compare_and_swap(AL+1, -30, -115) != 1)
abort ();
if (__sync_bool_compare_and_swap(AL+1, -30, -115) != 0)
abort ();
if (__sync_val_compare_and_swap(AL+2, AL[2], 25) != -50)
abort ();
if (__sync_val_compare_and_swap(AL+2, AL[2], 25) != 25)
abort ();
if (__sync_bool_compare_and_swap(AL+3, AL[3], 25) != 1)
abort ();
if (__sync_bool_compare_and_swap(AL+3, AL[3], 25) != 1)
abort ();
}
int main()
{
memcpy(AI, init_si, sizeof(init_si));
memcpy(AL, init_di, sizeof(init_di));
do_si ();
do_di ();
if (memcmp (AI, test_si, sizeof(test_si)))
abort ();
if (memcmp (AL, test_di, sizeof(test_di)))
abort ();
return 0;
}
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