Commit 5634cf72 by Zack Weinberg Committed by Zack Weinberg

ia64.md (cmpxchg_acq_si): Mark operand 3 as DImode.

	* config/ia64/ia64.md (cmpxchg_acq_si): Mark operand 3 as DImode.
	* config/ia64/ia64.c (ia64_expand_fetch_and_op,
	ia64_expand_op_and_fetch): Make sure the REG for ar.ccv is
	DImode.   Use convert_move to load ar.ccv.
	(ia64_expand_compare_and_swap): Likewise.
	If expand_expr doesn't put 'old' and 'new' in the proper
	modes, run them through convert_to_mode.

From-SVN: r72770
parent 25f93e18
2003-10-21 Zack Weinberg <zack@codesourcery.com>
* config/ia64/ia64.md (cmpxchg_acq_si): Mark operand 3 as DImode.
* config/ia64/ia64.c (ia64_expand_fetch_and_op,
ia64_expand_op_and_fetch): Make sure the REG for ar.ccv is
DImode. Use convert_move to load ar.ccv.
(ia64_expand_compare_and_swap): Likewise.
If expand_expr doesn't put 'old' and 'new' in the proper
modes, run them through convert_to_mode.
2003-10-21 Eric Christopher <echristo@redhat.com> 2003-10-21 Eric Christopher <echristo@redhat.com>
* config/frv/frv.c (frv_adjust_field_align): Check DECL_ARTIFICIAL * config/frv/frv.c (frv_adjust_field_align): Check DECL_ARTIFICIAL
......
...@@ -7885,13 +7885,14 @@ ia64_expand_fetch_and_op (optab binoptab, enum machine_mode mode, ...@@ -7885,13 +7885,14 @@ ia64_expand_fetch_and_op (optab binoptab, enum machine_mode mode,
} }
tmp = gen_reg_rtx (mode); tmp = gen_reg_rtx (mode);
ccv = gen_rtx_REG (mode, AR_CCV_REGNUM); /* ar.ccv must always be loaded with a zero-extended DImode value. */
ccv = gen_rtx_REG (DImode, AR_CCV_REGNUM);
emit_move_insn (tmp, mem); emit_move_insn (tmp, mem);
label = gen_label_rtx (); label = gen_label_rtx ();
emit_label (label); emit_label (label);
emit_move_insn (ret, tmp); emit_move_insn (ret, tmp);
emit_move_insn (ccv, tmp); convert_move (ccv, tmp, /*unsignedp=*/1);
/* Perform the specific operation. Special case NAND by noticing /* Perform the specific operation. Special case NAND by noticing
one_cmpl_optab instead. */ one_cmpl_optab instead. */
...@@ -7951,14 +7952,15 @@ ia64_expand_op_and_fetch (optab binoptab, enum machine_mode mode, ...@@ -7951,14 +7952,15 @@ ia64_expand_op_and_fetch (optab binoptab, enum machine_mode mode,
emit_insn (gen_mf ()); emit_insn (gen_mf ());
tmp = gen_reg_rtx (mode); tmp = gen_reg_rtx (mode);
old = gen_reg_rtx (mode); old = gen_reg_rtx (mode);
ccv = gen_rtx_REG (mode, AR_CCV_REGNUM); /* ar.ccv must always be loaded with a zero-extended DImode value. */
ccv = gen_rtx_REG (DImode, AR_CCV_REGNUM);
emit_move_insn (tmp, mem); emit_move_insn (tmp, mem);
label = gen_label_rtx (); label = gen_label_rtx ();
emit_label (label); emit_label (label);
emit_move_insn (old, tmp); emit_move_insn (old, tmp);
emit_move_insn (ccv, tmp); convert_move (ccv, tmp, /*unsignedp=*/1);
/* Perform the specific operation. Special case NAND by noticing /* Perform the specific operation. Special case NAND by noticing
one_cmpl_optab instead. */ one_cmpl_optab instead. */
...@@ -8007,6 +8009,11 @@ ia64_expand_compare_and_swap (enum machine_mode rmode, enum machine_mode mode, ...@@ -8007,6 +8009,11 @@ ia64_expand_compare_and_swap (enum machine_mode rmode, enum machine_mode mode,
mem = gen_rtx_MEM (mode, force_reg (ptr_mode, mem)); mem = gen_rtx_MEM (mode, force_reg (ptr_mode, mem));
MEM_VOLATILE_P (mem) = 1; MEM_VOLATILE_P (mem) = 1;
if (GET_MODE (old) != mode)
old = convert_to_mode (mode, old, /*unsignedp=*/1);
if (GET_MODE (new) != mode)
new = convert_to_mode (mode, new, /*unsignedp=*/1);
if (! register_operand (old, mode)) if (! register_operand (old, mode))
old = copy_to_mode_reg (mode, old); old = copy_to_mode_reg (mode, old);
if (! register_operand (new, mode)) if (! register_operand (new, mode))
...@@ -8018,14 +8025,7 @@ ia64_expand_compare_and_swap (enum machine_mode rmode, enum machine_mode mode, ...@@ -8018,14 +8025,7 @@ ia64_expand_compare_and_swap (enum machine_mode rmode, enum machine_mode mode,
tmp = gen_reg_rtx (mode); tmp = gen_reg_rtx (mode);
ccv = gen_rtx_REG (DImode, AR_CCV_REGNUM); ccv = gen_rtx_REG (DImode, AR_CCV_REGNUM);
if (mode == DImode) convert_move (ccv, old, /*unsignedp=*/1);
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);
......
...@@ -5388,7 +5388,7 @@ ...@@ -5388,7 +5388,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 3 "ar_ccv_reg_operand" "")] (match_operand:DI 3 "ar_ccv_reg_operand" "")]
UNSPEC_CMPXCHG_ACQ))] UNSPEC_CMPXCHG_ACQ))]
"" ""
"cmpxchg4.acq %0 = %1, %2, %3" "cmpxchg4.acq %0 = %1, %2, %3"
......
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