]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/69820 (Test miscompiled with -O3 option)
authorJakub Jelinek <jakub@redhat.com>
Tue, 16 Feb 2016 15:16:48 +0000 (16:16 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 16 Feb 2016 15:16:48 +0000 (16:16 +0100)
PR tree-optimization/69820
* tree-vect-patterns.c (type_conversion_p): Return false if
*orig_type is unsigned single precision or boolean.
(vect_recog_dot_prod_pattern, vect_recog_widen_mult_pattern):
Formatting fix.

* gcc.dg/vect/pr69820.c: New test.

Co-Authored-By: Richard Biener <rguenther@suse.de>
From-SVN: r233457

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr69820.c [new file with mode: 0644]
gcc/tree-vect-patterns.c

index 5eb87544b6809aefb7e8682436d03fe60c1a27a5..0fcc1ee73ee34ff36548247b267fbc27e57fa576 100644 (file)
@@ -1,3 +1,12 @@
+2016-02-16  Jakub Jelinek  <jakub@redhat.com>
+           Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69820
+       * tree-vect-patterns.c (type_conversion_p): Return false if
+       *orig_type is unsigned single precision or boolean.
+       (vect_recog_dot_prod_pattern, vect_recog_widen_mult_pattern):
+       Formatting fix.
+
 2016-02-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/69764
index d05cdd11059edc9823e67232fde08caa16157a6e..242ed9717e33cf29feb691706bcef2e6265310c0 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/69820
+       * gcc.dg/vect/pr69820.c: New test.
+
 2016-02-16  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/69776
diff --git a/gcc/testsuite/gcc.dg/vect/pr69820.c b/gcc/testsuite/gcc.dg/vect/pr69820.c
new file mode 100644 (file)
index 0000000..be24e4f
--- /dev/null
@@ -0,0 +1,35 @@
+/* PR tree-optimization/69820 */
+
+#include "tree-vect.h"
+
+unsigned int a[100];
+long long int b[100];
+unsigned short c[100];
+
+__attribute__((noinline, noclone)) void
+foo (void)
+{
+  int i;
+  for (i = 0; i < 100; ++i)
+    b[i] = a[i] * (c[i] * (_Bool) c[i]);
+}
+
+int
+main ()
+{
+  int i;
+  if (__SIZEOF_INT__ * __CHAR_BIT__ != 32)
+    return 0;
+  check_vect ();
+  for (i = 0; i < 100; ++i)
+    {
+      a[i] = 3489456818U;
+      b[i] = 0x1eadbeefbeefdeadLL;
+      c[i] = 38364;
+    }
+  foo ();
+  for (i = 0; i < 100; ++i)
+    if (b[i] != 0xed446af8U)
+      __builtin_abort ();
+  return 0;
+}
index 712b34c39c3db3adbf25208cb926ec5663929296..95ce38d5f0423d61b002cfb4c5b187acd5ac0c7a 100644 (file)
@@ -171,6 +171,13 @@ type_conversion_p (tree name, gimple *use_stmt, bool check_sign,
   if (!*def_stmt)
     return false;
 
+  if (dt == vect_internal_def)
+    {
+      stmt_vec_info def_vinfo = vinfo_for_stmt (*def_stmt);
+      if (STMT_VINFO_IN_PATTERN_P (def_vinfo))
+       return false;
+    }
+
   if (!is_gimple_assign (*def_stmt))
     return false;
 
@@ -334,8 +341,8 @@ vect_recog_dot_prod_pattern (vec<gimple *> *stmts, tree *type_in,
       stmt = last_stmt;
 
       if (type_conversion_p (oprnd0, stmt, true, &half_type, &def_stmt,
-                               &promotion)
-         && promotion)
+                            &promotion)
+         && promotion)
         {
           stmt = def_stmt;
           oprnd0 = gimple_assign_rhs1 (stmt);
@@ -395,13 +402,13 @@ vect_recog_dot_prod_pattern (vec<gimple *> *stmts, tree *type_in,
           || !types_compatible_p (TREE_TYPE (oprnd1), prod_type))
         return NULL;
       if (!type_conversion_p (oprnd0, stmt, true, &half_type0, &def_stmt,
-                                &promotion)
-          || !promotion)
+                             &promotion)
+         || !promotion)
         return NULL;
       oprnd00 = gimple_assign_rhs1 (def_stmt);
       if (!type_conversion_p (oprnd1, stmt, true, &half_type1, &def_stmt,
-                                &promotion)
-          || !promotion)
+                             &promotion)
+         || !promotion)
         return NULL;
       oprnd01 = gimple_assign_rhs1 (def_stmt);
       if (!types_compatible_p (half_type0, half_type1))
@@ -891,10 +898,10 @@ vect_recog_widen_mult_pattern (vec<gimple *> *stmts,
          oprnd = &oprnd1;
        }
 
-        tree old_oprnd = gimple_assign_rhs1 (def_stmt);
-       tree new_oprnd = make_ssa_name (half_type0);
-       new_stmt = gimple_build_assign (new_oprnd, NOP_EXPR, old_oprnd);
-        *oprnd = new_oprnd;
+      tree old_oprnd = gimple_assign_rhs1 (def_stmt);
+      tree new_oprnd = make_ssa_name (half_type0);
+      new_stmt = gimple_build_assign (new_oprnd, NOP_EXPR, old_oprnd);
+      *oprnd = new_oprnd;
     }
 
   /* Handle unsigned case.  Look for