re PR rtl-optimization/33148 (ICE in trunc_int_for_mode, at explow.c:56 during combine)
authorJakub Jelinek <jakub@redhat.com>
Tue, 28 Aug 2007 09:47:32 +0000 (11:47 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 28 Aug 2007 09:47:32 +0000 (11:47 +0200)
PR rtl-optimization/33148
* simplify-rtx.c (simplify_unary_operation_1): Only optimize
(neg (lt X 0)) if X has scalar int mode.

* gcc.c-torture/compile/20070827-1.c: New test.

From-SVN: r127855

gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20070827-1.c [new file with mode: 0644]

index 9f7fe58f98dcc249fa36ab1cef8f5e3b42c0a941..d3a9f3ec08570ec997428eac953b710ba8fcd6fc 100644 (file)
@@ -1,5 +1,9 @@
 2007-08-28  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/33148
+       * simplify-rtx.c (simplify_unary_operation_1): Only optimize
+       (neg (lt X 0)) if X has scalar int mode.
+
        PR debug/32914
        * dwarf2out.c (rtl_for_decl_init): If vector decl has CONSTRUCTOR
        initializer, use build_vector_from_ctor if possible to create
index 40337a5a197ebd6eca71deb71a7eb2a432e758e9..97c4d9318050e5e0e9464397379748e89de76356 100644 (file)
@@ -583,7 +583,8 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
       /* (neg (lt x 0)) is (ashiftrt X C) if STORE_FLAG_VALUE is 1.  */
       /* (neg (lt x 0)) is (lshiftrt X C) if STORE_FLAG_VALUE is -1.  */
       if (GET_CODE (op) == LT
-         && XEXP (op, 1) == const0_rtx)
+         && XEXP (op, 1) == const0_rtx
+         && SCALAR_INT_MODE_P (GET_MODE (XEXP (op, 0))))
        {
          enum machine_mode inner = GET_MODE (XEXP (op, 0));
          int isize = GET_MODE_BITSIZE (inner);
index 49b1b9f3be720f66e272c16f0f53661b03047cdf..d4964737575907e3baefae5121f2f84b47d308bb 100644 (file)
@@ -1,5 +1,8 @@
 2007-08-28  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/33148
+       * gcc.c-torture/compile/20070827-1.c: New test.
+
        PR debug/32914
        * d++.dg/debug/const3.C: New test.
        * d++.dg/debug/const4.C: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20070827-1.c b/gcc/testsuite/gcc.c-torture/compile/20070827-1.c
new file mode 100644 (file)
index 0000000..5dd0099
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR rtl-optimization/33148 */
+
+int
+foo (unsigned int *p, int *q, unsigned int w, unsigned int b)
+{
+  unsigned int i;
+  int mask;
+
+  if (q[0] < q[1])
+    mask = 0xff;
+  else
+    mask = 0;
+
+  for (i = 0; 8 * i < w; i++)
+    {
+      b ^= mask;
+      *p++ = b;
+    }
+  return 0;
+}