re PR tree-optimization/70252 (ICE in vect_get_vec_def_for_stmt_copy with -O3 -march...
authorIlya Enkovich <enkovich.gnu@gmail.com>
Fri, 18 Mar 2016 09:36:32 +0000 (09:36 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Fri, 18 Mar 2016 09:36:32 +0000 (09:36 +0000)
gcc/

PR tree-optimization/70252
* tree-vect-stmts.c (supportable_widening_operation): Check resulting
boolean vector has a proper number of elements.
(supportable_narrowing_operation): Likewise.

gcc/testsuite/

PR tree-optimization/70252
* gcc.dg/pr70252.c: New test.

From-SVN: r234323

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

index 10c3a07317ba53d69f1bd639a99e2e4e1281e4ed..11a2a2d07dd0d499fbaf9af7298c829763d67025 100644 (file)
@@ -1,3 +1,10 @@
+2016-03-18  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR tree-optimization/70252
+       * tree-vect-stmts.c (supportable_widening_operation): Check resulting
+       boolean vector has a proper number of elements.
+       (supportable_narrowing_operation): Likewise.
+
 2016-03-18  Tom de Vries  <tom@codesourcery.com>
 
        PR ipa/70269
index 4cd8a81d19ed0fa3fb9788eb6758cd44fc5d1f75..27ef47515d4f9ebe09218a7035956c0a936de2c0 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-18  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR tree-optimization/70252
+       * gcc.dg/pr70252.c: New test.
+
 2016-03-18  Tom de Vries  <tom@codesourcery.com>
 
        * gcc.dg/pr70161-2.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr70252.c b/gcc/testsuite/gcc.dg/pr70252.c
new file mode 100644 (file)
index 0000000..209e691
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-additional-options "-march=skylake-avx512" { target { i?86-*-* x86_64-*-* } } } */
+
+extern unsigned char a [150];
+extern unsigned char b [150];
+extern unsigned char c [150];
+extern unsigned char d [150];
+extern unsigned char e [150];
+
+void foo () {
+  for (int i = 92; i <= 141; i += 2) {
+    int tmp = (d [i] && b [i]) <= (a [i] > c [i]);
+    e [i] = tmp >> b [i];
+  }
+}
index 06b1ab742c401ab4385b9b8c1a6b018bed3fd6ed..d12c06281962cc5e597211102ef3963dece36970 100644 (file)
@@ -8940,7 +8940,12 @@ supportable_widening_operation (enum tree_code code, gimple *stmt,
 
   if (insn_data[icode1].operand[0].mode == TYPE_MODE (wide_vectype)
       && insn_data[icode2].operand[0].mode == TYPE_MODE (wide_vectype))
-    return true;
+      /* For scalar masks we may have different boolean
+        vector types having the same QImode.  Thus we
+        add additional check for elements number.  */
+    return (!VECTOR_BOOLEAN_TYPE_P (vectype)
+           || (TYPE_VECTOR_SUBPARTS (vectype) / 2
+               == TYPE_VECTOR_SUBPARTS (wide_vectype)));
 
   /* Check if it's a multi-step conversion that can be done using intermediate
      types.  */
@@ -8991,7 +8996,9 @@ supportable_widening_operation (enum tree_code code, gimple *stmt,
 
       if (insn_data[icode1].operand[0].mode == TYPE_MODE (wide_vectype)
          && insn_data[icode2].operand[0].mode == TYPE_MODE (wide_vectype))
-       return true;
+       return (!VECTOR_BOOLEAN_TYPE_P (vectype)
+               || (TYPE_VECTOR_SUBPARTS (intermediate_type) / 2
+                   == TYPE_VECTOR_SUBPARTS (wide_vectype)));
 
       prev_type = intermediate_type;
       prev_mode = intermediate_mode;
@@ -9075,7 +9082,12 @@ supportable_narrowing_operation (enum tree_code code,
   *code1 = c1;
 
   if (insn_data[icode1].operand[0].mode == TYPE_MODE (narrow_vectype))
-    return true;
+    /* For scalar masks we may have different boolean
+       vector types having the same QImode.  Thus we
+       add additional check for elements number.  */
+    return (!VECTOR_BOOLEAN_TYPE_P (vectype)
+           || (TYPE_VECTOR_SUBPARTS (vectype) * 2
+               == TYPE_VECTOR_SUBPARTS (narrow_vectype)));
 
   /* Check if it's a multi-step conversion that can be done using intermediate
      types.  */
@@ -9140,7 +9152,9 @@ supportable_narrowing_operation (enum tree_code code,
       (*multi_step_cvt)++;
 
       if (insn_data[icode1].operand[0].mode == TYPE_MODE (narrow_vectype))
-       return true;
+       return (!VECTOR_BOOLEAN_TYPE_P (vectype)
+               || (TYPE_VECTOR_SUBPARTS (intermediate_type) * 2
+                   == TYPE_VECTOR_SUBPARTS (narrow_vectype)));
 
       prev_mode = intermediate_mode;
       prev_type = intermediate_type;