Handle data dependence relations with different bases
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-alias-check-3.c
blob10b4c3d2c2abb8045178e936dd1e4d038ea0c89c
1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_int } */
3 /* { dg-additional-options "--param vect-max-version-for-alias-checks=0 -fopenmp-simd" } */
5 /* Intended to be larger than any VF. */
6 #define GAP 128
7 #define N (GAP * 3)
9 struct s { int x[N + 1]; };
10 struct t { struct s x[N + 1]; };
11 struct u { int x[N + 1]; int y; };
12 struct v { struct s s; };
14 void
15 f1 (struct s *a, struct s *b)
17 for (int i = 0; i < N; ++i)
18 a->x[i] += b->x[i];
21 void
22 f2 (struct s *a, struct s *b)
24 for (int i = 0; i < N; ++i)
25 a[1].x[i] += b[2].x[i];
28 void
29 f3 (struct s *a, struct s *b)
31 for (int i = 0; i < N; ++i)
32 a[1].x[i] += b[i].x[i];
35 void
36 f4 (struct s *a, struct s *b)
38 for (int i = 0; i < N; ++i)
39 a[i].x[i] += b[i].x[i];
42 void
43 f5 (struct s *a, struct s *b)
45 for (int i = 0; i < N; ++i)
46 a->x[i] += b->x[i + 1];
49 void
50 f6 (struct s *a, struct s *b)
52 for (int i = 0; i < N; ++i)
53 a[1].x[i] += b[2].x[i + 1];
56 void
57 f7 (struct s *a, struct s *b)
59 for (int i = 0; i < N; ++i)
60 a[1].x[i] += b[i].x[i + 1];
63 void
64 f8 (struct s *a, struct s *b)
66 for (int i = 0; i < N; ++i)
67 a[i].x[i] += b[i].x[i + 1];
70 void
71 f9 (struct s *a, struct t *b)
73 for (int i = 0; i < N; ++i)
74 a->x[i] += b->x[1].x[i];
77 void
78 f10 (struct s *a, struct t *b)
80 for (int i = 0; i < N; ++i)
81 a->x[i] += b->x[i].x[i];
84 void
85 f11 (struct u *a, struct u *b)
87 for (int i = 0; i < N; ++i)
88 a->x[i] += b->x[i] + b[i].y;
91 void
92 f12 (struct s *a, struct s *b)
94 for (int i = 0; i < GAP; ++i)
95 a->x[i + GAP] += b->x[i];
98 void
99 f13 (struct s *a, struct s *b)
101 for (int i = 0; i < GAP * 2; ++i)
102 a->x[i + GAP] += b->x[i];
105 void
106 f14 (struct v *a, struct s *b)
108 for (int i = 0; i < N; ++i)
109 a->s.x[i] = b->x[i];
112 void
113 f15 (struct s *a, struct s *b)
115 #pragma omp simd safelen(N)
116 for (int i = 0; i < N; ++i)
117 a->x[i + 1] += b->x[i];
120 /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 15 "vect" } } */