]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/
authorienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Jan 2016 12:37:01 +0000 (12:37 +0000)
committerienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Jan 2016 12:37:01 +0000 (12:37 +0000)
PR tree-optimization/69328
* tree-vect-stmts.c (vect_is_simple_cond): Check compared
vectors have same number of elements.
(vectorizable_condition): Fix masked version recognition.

gcc/testsuite/

PR tree-optimization/69328
* gcc.dg/pr69328.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232608 138bc75d-0d04-0410-961f-82ee72b054a4

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

index d67503867856bf9a9e33fefc01cdef99e113512a..1fb002a9fb2696dde9e1ad4d90caacac6b640acc 100644 (file)
@@ -1,3 +1,11 @@
+2016-01-20  Ilya Enkovich  <enkovich.gnu@gmail.com>
+           Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69328
+       * tree-vect-stmts.c (vect_is_simple_cond): Check compared
+       vectors have same number of elements.
+       (vectorizable_condition): Fix masked version recognition.
+
 2016-01-20  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/69345
index 46b9e4e9a1a6bc46ae6fb7ab4187bb9e9b541fd2..14ef8126a3d55feb68bd289f72f8b387c9336eff 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-20  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR tree-optimization/69328
+       * gcc.dg/pr69328.c: New test.
+
 2016-01-20  Jeff Law  <law@redhat.com>
 
        PR target/25114
diff --git a/gcc/testsuite/gcc.dg/pr69328.c b/gcc/testsuite/gcc.dg/pr69328.c
new file mode 100644 (file)
index 0000000..a495596
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int a, b;
+void fn1() {
+  int c;
+  char *d;
+  for (; a; ++a) {
+    int e, f;
+    e = d[a];
+    if (!e && f || !f && e)
+      ++c;
+  }
+  if (c)
+    b = .499;
+}
index 6be3c97d4592e21396817aa8bafa9f2b2a4f77fc..1d2246d1f9195a2ea8dc3ae8b402e7fd7e2d0985 100644 (file)
@@ -7445,6 +7445,10 @@ vect_is_simple_cond (tree cond, vec_info *vinfo, tree *comp_vectype)
           && TREE_CODE (rhs) != FIXED_CST)
     return false;
 
+  if (vectype1 && vectype2
+      && TYPE_VECTOR_SUBPARTS (vectype1) != TYPE_VECTOR_SUBPARTS (vectype2))
+    return false;
+
   *comp_vectype = vectype1 ? vectype1 : vectype2;
   return true;
 }
@@ -7548,13 +7552,9 @@ vectorizable_condition (gimple *stmt, gimple_stmt_iterator *gsi,
   if (!vect_is_simple_use (else_clause, stmt_info->vinfo, &def_stmt, &dt))
     return false;
 
-  if (VECTOR_BOOLEAN_TYPE_P (comp_vectype))
-    {
-      vec_cmp_type = comp_vectype;
-      masked = true;
-    }
-  else
-    vec_cmp_type = build_same_sized_truth_vector_type (comp_vectype);
+  masked = !COMPARISON_CLASS_P (cond_expr);
+  vec_cmp_type = build_same_sized_truth_vector_type (comp_vectype);
+
   if (vec_cmp_type == NULL_TREE)
     return false;