This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch committed] Fix bootstrap failure on SH


Hi,

The attached patch is to fix the current bootstrap failure on
sh4-unknown-linux-gnu:

../../trunk/gcc/tree-ssa-loop-prefetch.c:1529: error: unrecognizable insn:
(insn 5390 5389 5391 79 ../../trunk/gcc/tree-ssa-loop-prefetch.c:650
 (set (reg:SI 147 t)
      (gtu:SI (reg:SI 0 r0)
              (const_int 1 [0x1]))) -1 (nil))
../../trunk/gcc/tree-ssa-loop-prefetch.c:1529: internal compiler error: in extract_insn, at recog.c:2078

The problem is that SH has the instruction like cmp/eq #1,r0
but doesn't have cmp/gt #1,r0.  The SH ISA is asymmetric
in this regard.
The patch fixes the bootstrap failure and the regtest result
is a usual one.  Applied.

Regards,
	kaz
--
2009-05-18  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh.c (expand_cbranchdi4): Use a scratch register
	for the none zero constant operand except for EQ and NE
	comprisons even when the first operand is R0.

--- ORIG/trunk/gcc/config/sh/sh.c	2009-05-14 10:07:12.000000000 +0900
+++ trunk/gcc/config/sh/sh.c	2009-05-17 21:55:48.000000000 +0900
@@ -1632,7 +1632,8 @@ expand_cbranchdi4 (rtx *operands, enum r
   operands[2] = op2h;
   operands[4] = NULL_RTX;
   if (reload_completed
-      && ! arith_reg_or_0_operand (op2h, SImode) && true_regnum (op1h)
+      && ! arith_reg_or_0_operand (op2h, SImode)
+      && (true_regnum (op1h) || (comparison != EQ && comparison != NE))
       && (msw_taken != LAST_AND_UNUSED_RTX_CODE
 	  || msw_skip != LAST_AND_UNUSED_RTX_CODE))
     {
@@ -1662,8 +1663,12 @@ expand_cbranchdi4 (rtx *operands, enum r
   if (lsw_taken != LAST_AND_UNUSED_RTX_CODE)
     {
       if (reload_completed
-	  && ! arith_reg_or_0_operand (op2l, SImode) && true_regnum (op1l))
-	operands[4] = scratch;
+	  && ! arith_reg_or_0_operand (op2l, SImode)
+	  && (true_regnum (op1l) || (lsw_taken != EQ && lsw_taken != NE)))
+	{
+	  emit_move_insn (scratch, operands[2]);
+	  operands[2] = scratch;
+	}
       expand_cbranchsi4 (operands, lsw_taken, lsw_taken_prob);
     }
   if (msw_skip != LAST_AND_UNUSED_RTX_CODE)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]