summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/slp-36.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/vect/slp-36.c')
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-36.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/slp-36.c b/gcc/testsuite/gcc.dg/vect/slp-36.c
new file mode 100644
index 000000000..8480c4a05
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-36.c
@@ -0,0 +1,76 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
+
+#define N 32
+
+/* All the loops are vectorizable on platforms with vector shift argument. */
+
+void
+test_1 (void)
+{
+ static unsigned int bm[N];
+ static unsigned int cm[N];
+ int j;
+
+ /* Vectorizable on platforms with scalar shift argument. */
+ for (j = 0; j < N/2; j++)
+ {
+ bm[2*j] <<= 8;
+ bm[2*j+1] <<= 8;
+ }
+
+ /* Not vectorizable on platforms with scalar shift argument. */
+ for (j = 0; j < N/2; j++)
+ {
+ cm[2*j] <<= 8;
+ cm[2*j+1] <<= 7;
+ }
+}
+
+void
+test_2 (int a, int b)
+{
+ static unsigned int bm[N];
+ static unsigned int cm[N];
+ int j;
+
+ /* Vectorizable on platforms with scalar shift argument. */
+ for (j = 0; j < N/2; j++)
+ {
+ bm[2*j] <<= a;
+ bm[2*j+1] <<= a;
+ }
+
+ /* Not vectorizable on platforms with scalar shift argument. */
+ for (j = 0; j < N/2; j++)
+ {
+ cm[2*j] <<= a;
+ cm[2*j+1] <<= b;
+ }
+}
+
+void
+test_3 (void)
+{
+ static unsigned int bm[N];
+ int am[N];
+ int j;
+
+ /* Not vectorizable on platforms with scalar shift argument. */
+ for (j = 0; j < N/2; j++)
+ {
+ bm[2*j] <<= am[j];
+ bm[2*j+1] <<= am[j];
+ }
+
+ /* Not vectorizable on platforms with scalar shift argument. */
+ for (j = 0; j < N/2; j++)
+ {
+ bm[2*j] <<= am[2*j];
+ bm[2*j+1] <<= am[2*j+1];
+ }
+
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */