gcc/
authorienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Aug 2015 13:52:17 +0000 (13:52 +0000)
committerienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Aug 2015 13:52:17 +0000 (13:52 +0000)
* tree-vect-stmts.c (vectorizable_shift): Add missed test on
vect_induction_def.

gcc/testsuite:

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226781 138bc75d-0d04-0410-961f-82ee72b054a4

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 099d2c1..7e31110 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 7a35aad..93cacfb 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 33a7e0c..2ddd434 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