aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Rumyantsev <ysrumyan@gmail.com>2015-10-08 14:28:53 +0000
committerIlya Enkovich <ienkovich@gcc.gnu.org>2015-10-08 14:28:53 +0000
commit25a2c75d49ab2bebbae48b3640c999c43c8375bf (patch)
tree63c88a1f671439526f14aa51e539f23c73d25c8c
parenta5220d61fa4aaff695962c0b96733997fab202b2 (diff)
downloadgcc-25a2c75d49ab2bebbae48b3640c999c43c8375bf.zip
gcc-25a2c75d49ab2bebbae48b3640c999c43c8375bf.tar.gz
gcc-25a2c75d49ab2bebbae48b3640c999c43c8375bf.tar.bz2
tree-vect-loop.c (vect_analyze_loop_operations): Skip virtual phi in the tail of outer-loop.
gcc/ * tree-vect-loop.c (vect_analyze_loop_operations): Skip virtual phi in the tail of outer-loop. gcc/testsuite/ * gcc.dg/vect/vect-outer-simd-3.c: New test. From-SVN: r228601
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-simd-3.c78
-rw-r--r--gcc/tree-vect-loop.c2
4 files changed, 89 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b872a4d..7ae4f39 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-08 Yuri Rumyantsev <ysrumyan@gmail.com>
+
+ * tree-vect-loop.c (vect_analyze_loop_operations): Skip virtual phi
+ in the tail of outer-loop.
+
2015-10-08 David Edelsohn <dje.gcc@gmail.com>
* config/rs6000/rs6000.c (rs6000_xcoff_debug_unwind_info): Always
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ef2faab..638751e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2015-10-08 Yuri Rumyantsev <ysrumyan@gmail.com>
+ * gcc.dg/vect/vect-outer-simd-3.c: New test.
+
+2015-10-08 Yuri Rumyantsev <ysrumyan@gmail.com>
+
* gcc.dg/loop-unswitch-2.c: New test.
* gcc.dg/loop-unswitch-3.c: Likewise.
* gcc.dg/loop-unswitch-4.c: Likewise.
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-simd-3.c b/gcc/testsuite/gcc.dg/vect/vect-outer-simd-3.c
new file mode 100644
index 0000000..59e54db
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-simd-3.c
@@ -0,0 +1,78 @@
+/* { dg-require-effective-target vect_simd_clones } */
+/* { dg-additional-options "-O3 -fopenmp-simd -ffast-math" } */
+#include <stdlib.h>
+#include "tree-vect.h"
+#define N 64
+
+float *px, *py;
+float *tx, *ty;
+float *x1, *z1, *t1, *t2;
+int bound[N];
+
+static void inline bar(const float cx, float cy,
+ float *vx, float *vy, int n)
+{
+ int j;
+ for (j = 0; j < n; ++j)
+ {
+ const float dx = cx - px[j];
+ const float dy = cy - py[j];
+ *vx -= dx * tx[j];
+ *vy -= dy * ty[j];
+ }
+}
+
+__attribute__((noinline, noclone)) void foo1 ()
+{
+ int i;
+ int n = bound[63];
+#pragma omp simd
+ for (i=0; i<N; i++)
+ bar(px[i], py[i], x1+i, z1+i, n);
+}
+
+__attribute__((noinline, noclone)) void foo2 ()
+{
+ volatile int i;
+ int n = bound[63];
+ for (i=0; i<N; i++)
+ bar(px[i], py[i], x1+i, z1+i, n);
+}
+
+
+int main()
+{
+ float *X = (float*)malloc(N * 8 * sizeof (float));
+ int i;
+ /* check_vect (); */
+ px = &X[0];
+ py = &X[N * 1];
+ tx = &X[N * 2];
+ ty = &X[N * 3];
+ x1 = &X[N * 4];
+ z1 = &X[N * 5];
+ t1 = &X[N * 6];
+ t2 = &X[N * 7];
+
+ for (i=0; i<N; i++)
+ {
+ px[i] = (float) (i+2);
+ tx[i] = (float) (i+1);
+ py[i] = (float) (i+4);
+ ty[i] = (float) (i+3);
+ x1[i] = z1[i] = 1.0f;
+ bound[i] = i + 1;
+ }
+ foo1 (); /* vector variant. */
+ for (i=0; i<N;i++)
+ {
+ t1[i] = x1[i]; x1[i] = 1.0f;
+ t2[i] = z1[i]; z1[i] = 1.0f;
+ }
+ foo2 (); /* scalar variant. */
+ for (i=0; i<N; i++)
+ if (x1[i] != t1[i] || z1[i] != t2[i])
+ abort ();
+ return 0;
+}
+/* { dg-final { scan-tree-dump "OUTER LOOP VECTORIZED" "vect" } } */
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 26b7f8c..8ab1cdf 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -1463,6 +1463,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
dump_printf (MSG_NOTE, "\n");
}
+ if (virtual_operand_p (gimple_phi_result (phi)))
+ continue;
/* Inner-loop loop-closed exit phi in outer-loop vectorization
(i.e., a phi in the tail of the outer-loop). */