re PR tree-optimization/70317 (folding x<=x to true for large vectors, ignoring nans)
authorMarc Glisse <marc.glisse@inria.fr>
Mon, 21 Mar 2016 21:03:44 +0000 (22:03 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 21 Mar 2016 21:03:44 +0000 (22:03 +0100)
PR tree-optimization/70317
* match.pd (cmp @0 @0): Pass @0 instead of TYPE_MODE (TREE_TYPE (@0))
to HONOR_NANS.

* gcc.dg/pr70317.c: New test.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r234382

gcc/ChangeLog
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr70317.c [new file with mode: 0644]

index 67b5df424b331b824ce6ade57142c565b4e23d0a..ed26c14f50239dc2df7c45ef4bc831104d978cb3 100644 (file)
@@ -1,3 +1,10 @@
+2016-03-21  Marc Glisse  <marc.glisse@inria.fr>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/70317
+       * match.pd (cmp @0 @0): Pass @0 instead of TYPE_MODE (TREE_TYPE (@0))
+       to HONOR_NANS.
+
 2016-03-21  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/70327
index 7245ff4bb2fa1df7099ddff35ef1d7a5c0eaea46..ddb4b8a788591c8cb9abebd6ce7aeaa0fc27ac52 100644 (file)
@@ -1866,7 +1866,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (simplify
   (cmp @0 @0)
   (if (! FLOAT_TYPE_P (TREE_TYPE (@0))
-       || ! HONOR_NANS (TYPE_MODE (TREE_TYPE (@0))))
+       || ! HONOR_NANS (@0))
    { constant_boolean_node (true, type); }
    (if (cmp != EQ_EXPR)
     (eq @0 @0)))))
@@ -1875,7 +1875,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (cmp @0 @0)
   (if (cmp != NE_EXPR
        || ! FLOAT_TYPE_P (TREE_TYPE (@0))
-       || ! HONOR_NANS (TYPE_MODE (TREE_TYPE (@0))))
+       || ! HONOR_NANS (@0))
    { constant_boolean_node (false, type); })))
 (for cmp (unle unge uneq)
  (simplify
index d91d999df76f0e0b882545f2edb389d3fb472318..6e0ab0bc12492e1c69e1437dffab36db025ac6bb 100644 (file)
@@ -1,3 +1,9 @@
+2016-03-21  Marc Glisse  <marc.glisse@inria.fr>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/70317
+       * gcc.dg/pr70317.c: New test.
+
 2016-03-21  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/70327
diff --git a/gcc/testsuite/gcc.dg/pr70317.c b/gcc/testsuite/gcc.dg/pr70317.c
new file mode 100644 (file)
index 0000000..8f0864b
--- /dev/null
@@ -0,0 +1,26 @@
+/* PR tree-optimization/70317 */
+/* { dg-do compile } */
+/* { dg-skip-if "No NaN support" { spu*-*-* vax*-*-* pdp11*-*-* } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+typedef double V __attribute__((vector_size (256)));
+typedef __typeof ((V) {} < (V) {}) T;
+T a, b;
+
+__attribute__((noinline, noclone, optimize ("finite-math-only"))) void
+foo (V *x)
+{
+  V z = *x;
+  a = z <= z;
+}
+
+/* { dg-final { scan-tree-dump "a\[^\n\r]*= . -1, -1," "optimized" } } */
+
+__attribute__((noinline, noclone, optimize ("no-finite-math-only"))) void
+bar (V *x)
+{
+  V z = *x;
+  b = z <= z;
+}
+
+/* { dg-final { scan-tree-dump-not "b\[^\n\r]*= . -1, -1," "optimized" } } */