This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[m32c] use temp for shift intermediate
- From: DJ Delorie <dj at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 13 Nov 2006 21:30:15 -0500
- Subject: [m32c] use temp for shift intermediate
Applied to trunk and 4.2.
2006-11-13 DJ Delorie <dj@redhat.com>
* config/m32c/m32c.c (m32c_prepare_shift): Use a separate
temporary for intermediates.
Index: config/m32c/m32c.c
===================================================================
--- config/m32c/m32c.c (revision 118797)
+++ config/m32c/m32c.c (working copy)
@@ -3423,7 +3423,7 @@ m32c_prepare_shift (rtx * operands, int
undefined to skip one of the comparisons. */
rtx count;
- rtx label, lref, insn;
+ rtx label, lref, insn, tempvar;
emit_move_insn (operands[0], operands[1]);
@@ -3432,13 +3432,15 @@ m32c_prepare_shift (rtx * operands, int
lref = gen_rtx_LABEL_REF (VOIDmode, label);
LABEL_NUSES (label) ++;
+ tempvar = gen_reg_rtx (mode);
+
if (shift_code == ASHIFT)
{
/* This is a left shift. We only need check positive counts. */
emit_jump_insn (gen_cbranchqi4 (gen_rtx_LE (VOIDmode, 0, 0),
count, GEN_INT (16), label));
- emit_insn (func (operands[0], operands[0], GEN_INT (8)));
- emit_insn (func (operands[0], operands[0], GEN_INT (8)));
+ emit_insn (func (tempvar, operands[0], GEN_INT (8)));
+ emit_insn (func (operands[0], tempvar, GEN_INT (8)));
insn = emit_insn (gen_addqi3 (count, count, GEN_INT (-16)));
emit_label_after (label, insn);
}
@@ -3447,8 +3449,8 @@ m32c_prepare_shift (rtx * operands, int
/* This is a right shift. We only need check negative counts. */
emit_jump_insn (gen_cbranchqi4 (gen_rtx_GE (VOIDmode, 0, 0),
count, GEN_INT (-16), label));
- emit_insn (func (operands[0], operands[0], GEN_INT (-8)));
- emit_insn (func (operands[0], operands[0], GEN_INT (-8)));
+ emit_insn (func (tempvar, operands[0], GEN_INT (-8)));
+ emit_insn (func (operands[0], tempvar, GEN_INT (-8)));
insn = emit_insn (gen_addqi3 (count, count, GEN_INT (16)));
emit_label_after (label, insn);
}