re PR tree-optimization/78675 (ICE: verify_gimple failed (error: integral result...
authorJakub Jelinek <jakub@redhat.com>
Tue, 6 Dec 2016 09:21:13 +0000 (10:21 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 6 Dec 2016 09:21:13 +0000 (10:21 +0100)
2016-12-06  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/78675
* tree-vect-loop.c (vectorizable_live_operation): For
VECTOR_BOOLEAN_TYPE_P vectype use integral type with bitsize precision
instead of TREE_TYPE (vectype) for the BIT_FIELD_REF.

* gcc.c-torture/execute/pr78675.c: New test.
* gcc.target/i386/pr78675-1.c: New test.
* gcc.target/i386/pr78675-2.c: New test.

From-SVN: r243283

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr78675.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr78675-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr78675-2.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index 38e86cfd707e7cb1c465fc6b5518fbd212b71f8c..4e70e2705b090dcb8b0119b2177d0c851b9bf64e 100644 (file)
@@ -1,3 +1,10 @@
+2016-12-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/78675
+       * tree-vect-loop.c (vectorizable_live_operation): For
+       VECTOR_BOOLEAN_TYPE_P vectype use integral type with bitsize precision
+       instead of TREE_TYPE (vectype) for the BIT_FIELD_REF.
+
 2016-12-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR middle-end/78642
index 3b0a8fae0794bae94952a501db292974d7916e46..35f10fe0563e5c93e84e9c145e069c278c744af7 100644 (file)
@@ -1,3 +1,10 @@
+2016-12-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/78675
+       * gcc.c-torture/execute/pr78675.c: New test.
+       * gcc.target/i386/pr78675-1.c: New test.
+       * gcc.target/i386/pr78675-2.c: New test.
+
 2016-12-05  Andrew Senkevich  <andrew.senkevich@intel.com>
 
        * gcc.target/i386/avx512bw-kandd-1.c: New.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr78675.c b/gcc/testsuite/gcc.c-torture/execute/pr78675.c
new file mode 100644 (file)
index 0000000..7cef342
--- /dev/null
@@ -0,0 +1,38 @@
+/* PR tree-optimization/78675 */
+
+long int a;
+
+__attribute__((noinline, noclone)) long int
+foo (long int x)
+{
+  long int b;
+  while (a < 1)
+    {
+      b = a && x;
+      ++a;
+    }
+  return b;
+}
+
+int
+main ()
+{
+  if (foo (0) != 0)
+    __builtin_abort ();
+  a = 0;
+  if (foo (1) != 0)
+    __builtin_abort ();
+  a = 0;
+  if (foo (25) != 0)
+    __builtin_abort ();
+  a = -64;
+  if (foo (0) != 0)
+    __builtin_abort ();
+  a = -64;
+  if (foo (1) != 0)
+    __builtin_abort ();
+  a = -64;
+  if (foo (25) != 0)
+    __builtin_abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr78675-1.c b/gcc/testsuite/gcc.target/i386/pr78675-1.c
new file mode 100644 (file)
index 0000000..68435b6
--- /dev/null
@@ -0,0 +1,5 @@
+/* PR tree-optimization/78675 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512f" } */
+
+#include "../../gcc.c-torture/execute/pr78675.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr78675-2.c b/gcc/testsuite/gcc.target/i386/pr78675-2.c
new file mode 100644 (file)
index 0000000..8f5ef87
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mavx512f" } */
+/* { dg-require-effective-target avx512f } */
+
+#include "avx512f-check.h"
+
+#define main do_main
+
+#include "../../gcc.c-torture/execute/pr78675.c"
+
+static void
+avx512f_test (void)
+{
+  do_main ();
+}
index 4150b0d9ee25cc04d674660c90d9d4c9d318f70a..6e8b89c3cd348935667c2241e62f198bc08089c9 100644 (file)
@@ -6601,8 +6601,10 @@ vectorizable_live_operation (gimple *stmt,
   /* Create a new vectorized stmt for the uses of STMT and insert outside the
      loop.  */
   gimple_seq stmts = NULL;
-  tree new_tree = build3 (BIT_FIELD_REF, TREE_TYPE (vectype), vec_lhs, bitsize,
-                         bitstart);
+  tree bftype = TREE_TYPE (vectype);
+  if (VECTOR_BOOLEAN_TYPE_P (vectype))
+    bftype = build_nonstandard_integer_type (tree_to_uhwi (bitsize), 1);
+  tree new_tree = build3 (BIT_FIELD_REF, bftype, vec_lhs, bitsize, bitstart);
   new_tree = force_gimple_operand (fold_convert (lhs_type, new_tree), &stmts,
                                   true, NULL_TREE);
   if (stmts)