sh.c (expand_cbranchdi4): Set msw_skip when the high part of the second operand is 0.
authorKaz Kojima <kkojima@gcc.gnu.org>
Mon, 30 May 2011 22:56:32 +0000 (22:56 +0000)
committerKaz Kojima <kkojima@gcc.gnu.org>
Mon, 30 May 2011 22:56:32 +0000 (22:56 +0000)
* config/sh/sh.c (expand_cbranchdi4): Set msw_skip when the high
part of the second operand is 0.
* gcc.c-torture/execute/pr49186.c: New.

From-SVN: r174456

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

index 20a3938ceaad50061008de76961d31995ace498a..0e9738198f34600cbc1ffb529e0f3634a571e4f3 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-30  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       PR target/49186
+       * config/sh/sh.c (expand_cbranchdi4): Set msw_skip when the high
+       part of the second operand is 0.
+
 2011-05-30  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md (*movxf_internal): Penalize FYx*r->o alternative
index 94c8ba4fb0ac8ab44e29670e3fa886df7cddf794..fb204c648e9277d7a8664e735cdd29dcc780d4e7 100644 (file)
@@ -2143,7 +2143,10 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison)
          else if (op2h != CONST0_RTX (SImode))
            msw_taken = LTU;
          else
-           break;
+           {
+             msw_skip = swap_condition (LTU);
+             break;
+           }
          msw_skip = swap_condition (msw_taken);
        }
       break;
index d8b0ef5446d90cd70097cd98ad888647586f5bb2..d9bfc9140112d14a93087ce4e13f3b9d1f4d19d4 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-30  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       PR target/49186
+       * gcc.c-torture/execute/pr49186.c: New.
+
 2011-05-30  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/49168
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49186.c b/gcc/testsuite/gcc.c-torture/execute/pr49186.c
new file mode 100644 (file)
index 0000000..743815b
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR target/49186 */
+extern void abort (void);
+
+int
+main ()
+{
+  int x;
+  unsigned long long uv = 0x1000000001ULL;
+
+  x = (uv < 0x80) ? 1 : ((uv < 0x800) ? 2 : 3);
+  if (x != 3)
+    abort ();
+
+  return 0;
+}