Add compile command to each testcase
[gcc-vect-testsuite.git] / vect-109.c
blob1f2f53ed9ebac042a019ae33e9cdbde3f1d5a02e
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-add-options quad_vectors } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 32
9 short sa[N];
10 short sc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
11 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
12 short sb[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
13 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
14 int ia[N];
15 int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
16 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
17 int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
18 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
20 __attribute__ ((noinline))
21 int main1 (int n)
23 int i;
25 /* Multiple types with different sizes, used in idependent
26 copmutations. Vectorizable. */
27 for (i = 0; i < n; i++)
29 sa[i+2] = sb[i] + sc[i];
30 ia[i+1] = ib[i] + ic[i];
33 /* check results: */
34 for (i = 0; i < n; i++)
36 if (sa[i+2] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
37 abort ();
40 return 0;
43 int main2 (int n)
45 int i;
47 /* Multiple types with different sizes, used in idependent
48 copmutations. Vectorizable. */
49 for (i = 0; i < n; i++)
51 ia[i+1] = ib[i] + ic[i];
52 sa[i] = sb[i] + sc[i];
55 /* check results: */
56 for (i = 0; i < n; i++)
58 if (sa[i] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
59 abort ();
62 return 0;
66 int main (void)
68 check_vect ();
70 main1 (N-2);
71 main2 (N-1);
73 return 0;
76 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_element_align } } } */
77 /* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 2 "vect" { xfail vect_element_align } } } */
78 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align } } } */
79 /* { dg-final { cleanup-tree-dump "vect" } } */