tree-vect-patterns.c (search_type_for_mask): Handle comparison of booleans.
authorIlya Enkovich <enkovich.gnu@gmail.com>
Fri, 4 Mar 2016 13:49:54 +0000 (13:49 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Fri, 4 Mar 2016 13:49:54 +0000 (13:49 +0000)
gcc/

* tree-vect-patterns.c (search_type_for_mask): Handle
comparison of booleans.

gcc/testsuite/

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

From-SVN: r233966

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

index 828f608..551044c 100644 (file)
@@ -1,3 +1,9 @@
+2016-03-04  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       * tree-vect-patterns.c (search_type_for_mask): Handle
+       comparison of booleans.
+
+
 2016-03-04  Jakub Jelinek  <jakub@redhat.com>
 
        * doc/extend.texi (__builtin_alloca, __builtin_alloca_with_align):
index 7a05cd3..5faeb86 100644 (file)
@@ -1,3 +1,7 @@
+2016-03-04  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       * gcc.dg/pr70026.c: New test.
+
 2016-03-04  Marek Polacek  <polacek@redhat.com>
 
        PR c/69798
diff --git a/gcc/testsuite/gcc.dg/pr70026.c b/gcc/testsuite/gcc.dg/pr70026.c
new file mode 100644 (file)
index 0000000..32f59e2
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+unsigned int a[64], b[64], c[64], d[64], e[64];
+
+void
+foo ()
+{
+  int i;
+  for (i = 0; i < 64; i++)
+    {
+      d[i] = a[i];
+      e[i] = ((b[i] < e[i]) != !c[i]) && !a[i];
+    }
+}
index 4b3065e..0ee5bbe 100644 (file)
@@ -3220,6 +3220,15 @@ search_type_for_mask (tree var, vec_info *vinfo)
        {
          tree comp_vectype, mask_type;
 
+         if (TREE_CODE (TREE_TYPE (rhs1)) == BOOLEAN_TYPE)
+           {
+             res = search_type_for_mask (rhs1, vinfo);
+             res2 = search_type_for_mask (gimple_assign_rhs2 (def_stmt), vinfo);
+             if (!res || (res2 && TYPE_PRECISION (res) > TYPE_PRECISION (res2)))
+               res = res2;
+             break;
+           }
+
          comp_vectype = get_vectype_for_scalar_type (TREE_TYPE (rhs1));
          if (comp_vectype == NULL_TREE)
            return NULL_TREE;