summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-neg-store-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/vect/vect-neg-store-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-neg-store-1.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-neg-store-1.c b/gcc/testsuite/gcc.dg/vect/vect-neg-store-1.c
new file mode 100644
index 00000000000..178f0a1ec9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-neg-store-1.c
@@ -0,0 +1,39 @@
+/* { dg-require-effective-target vect_int } */
+#include <stdlib.h>
+
+__attribute__((noinline, noclone))
+void test1(short x[128])
+{
+ int i;
+ for (i=127; i>=0; i--) {
+ x[i] = 1234;
+ }
+}
+
+int main (void)
+{
+ short x[128 + 32];
+ int i;
+
+ for (i = 0; i < 16; i ++)
+ {
+ asm ("");
+ x[i] = x[i + 144] = 5678;
+ }
+
+ test1 (x + 16);
+
+ for (i = 0; i < 128; i++)
+ if (x[i + 16] != 1234)
+ abort ();
+
+ for (i = 0; i < 16; i++)
+ if (x[i] != 5678
+ || x[i + 144] != 5678)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */