]> gcc.gnu.org Git - gcc.git/commitdiff
sh.c (expand_cbranchdi4): Use a scratch register if needed when original operands...
authorKaz Kojima <kkojima@gcc.gnu.org>
Wed, 1 Jun 2011 22:36:08 +0000 (22:36 +0000)
committerKaz Kojima <kkojima@gcc.gnu.org>
Wed, 1 Jun 2011 22:36:08 +0000 (22:36 +0000)
* 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: r174550

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

index 6483324ca94c687dfde2ca3e59239c8330b5e629..9b9fc4179dbb020781794b062c912a10985cb23c 100644 (file)
@@ -1,3 +1,9 @@
+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-01  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/49250
index fb204c648e9277d7a8664e735cdd29dcc780d4e7..c5fbd569602c323810536a0428a37437543436cd 100644 (file)
@@ -2199,6 +2199,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 37a1dc64bf611e8f11d08af0b7d880158ec13c1d..a611a29f406ac620a3f8be07d6bcca034910f9e8 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-01  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       PR target/49238
+       * gcc.c-torture/compile/pr49238.c: New.
+
 2011-06-01  Sofiane Naci  <sofiane.naci@arm.com>
 
        * gcc.target/arm/g2.c: Skip test in -mthumb.
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 ();
+}
This page took 0.119717 seconds and 5 git commands to generate.