1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 124
7 #define OFF 4
8
9 /* Check handling of accesses for which the "initial condition" -
10 the expression that represents the first location accessed - is
11 more involved than just an ssa_name. */
12
13 int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17};
14 int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17};
15
16 __attribute__ ((noinline))
main1(int * pib)17 int main1 (int *pib)
18 {
19 int i;
20 int ia[N+OFF];
21 for (i = OFF; i < N+OFF; i++)
22 {
23 ib[i] = ib[i%8]*(i/8);
24 ic[i] = ic[i%8]*(i/8);
25 asm volatile ("" ::: "memory");
26 }
27
28 for (i = OFF; i < N; i++)
29 {
30 ia[i] = pib[i - OFF];
31 }
32
33
34 /* check results: */
35 for (i = OFF; i < N; i++)
36 {
37 if (ia[i] != pib[i - OFF])
38 abort ();
39 }
40
41 for (i = 0; i < N; i++)
42 {
43 ia[i] = pib[i - OFF];
44 }
45
46
47 /* check results: */
48 for (i = 0; i < N; i++)
49 {
50 if (ia[i] != pib[i - OFF])
51 abort ();
52 }
53
54 for (i = OFF; i < N; i++)
55 {
56 ia[i] = ic[i - OFF];
57 }
58
59
60 /* check results: */
61 for (i = OFF; i < N; i++)
62 {
63 if (ia[i] != ic[i - OFF])
64 abort ();
65 }
66
67 return 0;
68 }
69
main(void)70 int main (void)
71 {
72 check_vect ();
73
74 main1 (&ib[OFF]);
75 return 0;
76 }
77
78
79 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
80