aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-109.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/vect/vect-109.c')
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-109.c77
1 files changed, 55 insertions, 22 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-109.c b/gcc/testsuite/gcc.dg/vect/vect-109.c
index ba6b2cee3d6..e861a772d5b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-109.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-109.c
@@ -3,42 +3,75 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 16
+#define N 32
-int
-main1 ()
+short sa[N];
+short sc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
+short sb[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
+int ia[N];
+int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+
+int main1 (int n)
+{
+ int i;
+
+ /* Multiple types with different sizes, used in idependent
+ copmutations. Vectorizable. */
+ for (i = 0; i < n; i++)
+ {
+ sa[i+2] = sb[i] + sc[i];
+ ia[i+1] = ib[i] + ic[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < n; i++)
+ {
+ if (sa[i+2] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main2 (int n)
{
int i;
- short sc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- short sa[N];
- int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
- int ia[N];
-
- /* Two types with different nunits in vector. */
- for (i = 0; i < N; i++)
+
+ /* Multiple types with different sizes, used in idependent
+ copmutations. Vectorizable. */
+ for (i = 0; i < n; i++)
{
- ia[i] = ib[i] + ic[i];
+ ia[i+1] = ib[i] + ic[i];
sa[i] = sb[i] + sc[i];
}
- /* Check results. */
- for (i = 0; i < N; i++)
+ /* check results: */
+ for (i = 0; i < n; i++)
{
- if (ia[i] != ib[i] + ic[i] || sa[i] != sb[i] + sc[i])
- abort();
+ if (sa[i] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
+ abort ();
}
- return 0;
+ return 0;
}
-
+
+
int main (void)
-{
+{
check_vect ();
- return main1 ();
+
+ main1 (N-2);
+ main2 (N-1);
+
+ return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 2 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */