tree-vect-stmts.c (vectorizable_shift): Add missed test on vect_induction_def.
authorYuri Rumyantsev <ysrumyan@gmail.com>
Tue, 11 Aug 2015 13:52:17 +0000 (13:52 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Tue, 11 Aug 2015 13:52:17 +0000 (13:52 +0000)
gcc/

* tree-vect-stmts.c (vectorizable_shift): Add missed test on
vect_induction_def.

gcc/testsuite:

* gcc.target/i386/avx2-vect-shift.c: New test.

From-SVN: r226781

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx2-vect-shift.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index 099d2c1b6897fcaa145a7dce9aa42eef162c103c..7e311106e4a35b60722aab7e6343d9350276ef69 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-11  Yuri Rumyantsev  <ysrumyan@gmail.com>
+
+       * tree-vect-stmts.c (vectorizable_shift): Add missed test on
+       vect_induction_def.
+
 2015-08-11  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR c/66098
index 7a35aadd828bbd85b5b790356b721cd53e9a6cc1..93cacfb9bf2aa7d15f91f7cdf4666f7f51ae9314 100644 (file)
@@ -1,3 +1,7 @@
+2015-08-11  Yuri Rumyantsev  <ysrumyan@gmail.com>
+
+       * gcc.target/i386/avx2-vect-shift.c: New test.
+
 2015-08-11  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR c/66098
diff --git a/gcc/testsuite/gcc.target/i386/avx2-vect-shift.c b/gcc/testsuite/gcc.target/i386/avx2-vect-shift.c
new file mode 100644 (file)
index 0000000..c82e370
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target avx2 } */
+/* { dg-options "-mavx2 -O3 -fdump-tree-vect-details" } */
+
+#define N 32
+typedef unsigned int u32;
+u32 a[N];
+
+void foo()
+{
+  int i;
+  for (i=0; i<N;i++)
+    a[i] = 1 << i;
+}
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 33a7e0c499b4887dbbbe86f890173b5660aac461..2ddd4343a2a922c0790937220ab26b14fec5af75 100644 (file)
@@ -4461,7 +4461,9 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
   /* Determine whether the shift amount is a vector, or scalar.  If the
      shift/rotate amount is a vector, use the vector/vector shift optabs.  */
 
-  if (dt[1] == vect_internal_def && !slp_node)
+  if ((dt[1] == vect_internal_def
+       || dt[1] == vect_induction_def)
+      && !slp_node)
     scalar_shift_arg = false;
   else if (dt[1] == vect_constant_def
           || dt[1] == vect_external_def