]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/49238 ([SH] ICE in extract_insn, at recog.c:2113)
authorKaz Kojima <kkojima@gcc.gnu.org>
Wed, 8 Jun 2011 04:10:26 +0000 (04:10 +0000)
committerKaz Kojima <kkojima@gcc.gnu.org>
Wed, 8 Jun 2011 04:10:26 +0000 (04:10 +0000)
PR target/49238
* config/sh/sh.c (expand_cbranchdi4): Use a scratch register if
needed when original operands are used for msw_skip comparison.
* gcc.c-torture/compile/pr49238.c: New.

From-SVN: r174794

gcc/ChangeLog
gcc/config/sh/sh.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr49238.c [new file with mode: 0644]

index 6493443e2c90f7a0b44abddbd9035071c4466872..a6047dab36568ab90840a23de7f18e53d6354892 100644 (file)
@@ -1,3 +1,12 @@
+2011-06-08  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       Backport from mainline
+       2011-06-01  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       PR target/49238
+       * config/sh/sh.c (expand_cbranchdi4): Use a scratch register if
+       needed when original operands are used for msw_skip comparison.
+
 2011-06-05  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/sparc/sparc.c (output_return): Fix thinko in the output of an
index 5ee090c192f24a3ac02015e3f47d05202da55134..31a8ad645af72f0d7956e2e26b13e535860d8ea7 100644 (file)
@@ -2001,6 +2001,13 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison)
        {
          operands[1] = op1h;
          operands[2] = op2h;
+         if (reload_completed
+             && ! arith_reg_or_0_operand (op2h, SImode)
+             && (true_regnum (op1h) || (comparison != EQ && comparison != NE)))
+           {
+             emit_move_insn (scratch, operands[2]);
+             operands[2] = scratch;
+           }
        }
 
       operands[3] = skip_label = gen_label_rtx ();
index f0a88d93b8cc1801f032493f8e57913258e2e95d..78cce68b97e529784ad6c809121b1d37170344cd 100644 (file)
@@ -1,3 +1,11 @@
+2011-06-08  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       Backport from mainline
+       2011-06-01  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       PR target/49238
+       * gcc.c-torture/compile/pr49238.c: New.
+
 2011-06-05  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49238.c b/gcc/testsuite/gcc.c-torture/compile/pr49238.c
new file mode 100644 (file)
index 0000000..fd8443a
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR target/49238 */
+extern int bar (void);
+
+void
+foo (unsigned long long a, int b)
+{
+  int i;
+
+  if (b)
+    for (a = -12; a >= 10; a = bar ())
+      break;
+  else
+    return;
+
+  for (i = 0; i < 10; i += 10)
+    if ((i == bar ()) | (bar () >= a))
+      bar ();
+}