]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/50396 (SSE division by zero generates incorrect code with...
authorRichard Guenther <rguenther@suse.de>
Fri, 23 Dec 2011 09:16:08 +0000 (09:16 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 23 Dec 2011 09:16:08 +0000 (09:16 +0000)
2011-12-23  Richard Guenther  <rguenther@suse.de>

PR rtl-optimization/50396
* simplify-rtx.c (simplify_binary_operation_1): Properly
guard code that only works for integers.

* gcc.dg/torture/pr50396.c: New testcase.

From-SVN: r182654

gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr50396.c [new file with mode: 0644]

index 02d2aa5916ada476f5bfac6cf52acd99a1166304..bb71f57f66bad1fa236db92c1e4417199394a06c 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-23  Richard Guenther  <rguenther@suse.de>
+
+       PR rtl-optimization/50396
+       * simplify-rtx.c (simplify_binary_operation_1): Properly
+       guard code that only works for integers.
+
 2011-12-22  Doug Kwan  <dougkwan@google.com>
 
        Backport from mainline
index ed4019622017614f58df65b669699e6e6042f2b5..42b1be60b153617bd20fdfb44b57bfa0fff89b94 100644 (file)
@@ -2777,7 +2777,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
                }
            }
        }
-      else
+      else if (SCALAR_INT_MODE_P (mode))
        {
          /* 0/x is 0 (or x&0 if x has side-effects).  */
          if (trueop0 == CONST0_RTX (mode)
index 24bdfd04928833d64ee0d5bccaa0d8bdce3097be..c923c3f10b935d3a7d5213c6a1f56bfb47852bb1 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-23  Richard Guenther  <rguenther@suse.de>
+
+       PR rtl-optimization/50396
+       * gcc.dg/torture/pr50396.c: New testcase.
+
 2011-12-22  Doug Kwan  <dougkwan@google.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/torture/pr50396.c b/gcc/testsuite/gcc.dg/torture/pr50396.c
new file mode 100644 (file)
index 0000000..8e5d008
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+extern void abort (void);
+typedef float vf128 __attribute__((vector_size(16)));
+typedef float vf64 __attribute__((vector_size(8)));
+int main()
+{
+#if !__FINITE_MATH_ONLY__
+#if __FLT_HAS_QUIET_NAN__
+  vf128 v = (vf128){ 0.f, 0.f, 0.f, 0.f };
+  vf64 u = (vf64){ 0.f, 0.f };
+  v = v / (vf128){ 0.f, 0.f, 0.f, 0.f };
+  if (v[0] == v[0])
+    abort ();
+  u = u / (vf64){ 0.f, 0.f };
+  if (u[0] == u[0])
+    abort ();
+#endif
+#endif
+  return 0;
+}