re PR tree-optimization/85934 (ICE: verify_gimple failed (error: type mismatch in...
authorRichard Biener <rguenther@suse.de>
Mon, 28 May 2018 10:28:38 +0000 (10:28 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 28 May 2018 10:28:38 +0000 (10:28 +0000)
2018-05-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/85934
* tree-vect-generic.c (expand_vector_operations_1): Hoist
vector boolean check before scalar optimization.

* gcc.target/i386/pr85934.c: New testcase.

From-SVN: r260847

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr85934.c [new file with mode: 0644]
gcc/tree-vect-generic.c

index b9c30ae02e7cee896e3d6ad2044ea80b41358231..e3766bcf4d9782eee76de75dd0442036476cc8f6 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/85934
+       * gcc.target/i386/pr85934.c: New testcase.
+
 2018-05-28  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/renaming12.adb, gnat.dg/renaming12.ads: New testcase.
diff --git a/gcc/testsuite/gcc.target/i386/pr85934.c b/gcc/testsuite/gcc.target/i386/pr85934.c
new file mode 100644 (file)
index 0000000..ac10cfb
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-loop-vectorize -mavx512vbmi" } */
+
+int uf;
+
+int
+l7 (int wk, int sv)
+{
+  while (sv < 1)
+    {
+      int me;
+
+      for (me = 0; me < 64; ++me)
+       wk += !!((unsigned char) sv) && (!!uf == !!me);
+
+      ++sv;
+    }
+
+  return wk;
+}
index 3dcbdeba9592c0be2de5d15ac25d81fba49aa5b4..2ade60b339887948c5a62847246c64a3aa18b7b2 100644 (file)
@@ -1612,6 +1612,12 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
   if (!VECTOR_TYPE_P (type)
       || !VECTOR_TYPE_P (TREE_TYPE (rhs1)))
     return;
+  /* A scalar operation pretending to be a vector one.  */
+  if (VECTOR_BOOLEAN_TYPE_P (type)
+      && !VECTOR_MODE_P (TYPE_MODE (type))
+      && TYPE_MODE (type) != BLKmode)
+    return;
 
   /* If the vector operation is operating on all same vector elements
      implement it with a scalar operation and a splat if the target
@@ -1638,12 +1644,6 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
          return;
        }
     }
-  /* A scalar operation pretending to be a vector one.  */
-  if (VECTOR_BOOLEAN_TYPE_P (type)
-      && !VECTOR_MODE_P (TYPE_MODE (type))
-      && TYPE_MODE (type) != BLKmode)
-    return;
 
   if (CONVERT_EXPR_CODE_P (code)
       || code == FLOAT_EXPR