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" } */
4
5 /* Intended to be larger than any VF. */
6 #define GAP 128
7 #define N (GAP * 3)
8
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; };
13
14 void
f1(struct s * a,struct s * b)15 f1 (struct s *a, struct s *b)
16 {
17 for (int i = 0; i < N; ++i)
18 a->x[i] += b->x[i];
19 }
20
21 void
f2(struct s * a,struct s * b)22 f2 (struct s *a, struct s *b)
23 {
24 for (int i = 0; i < N; ++i)
25 a[1].x[i] += b[2].x[i];
26 }
27
28 void
f3(struct s * a,struct s * b)29 f3 (struct s *a, struct s *b)
30 {
31 for (int i = 0; i < N; ++i)
32 a[1].x[i] += b[i].x[i];
33 }
34
35 void
f4(struct s * a,struct s * b)36 f4 (struct s *a, struct s *b)
37 {
38 for (int i = 0; i < N; ++i)
39 a[i].x[i] += b[i].x[i];
40 }
41
42 void
f5(struct s * a,struct s * b)43 f5 (struct s *a, struct s *b)
44 {
45 for (int i = 0; i < N; ++i)
46 a->x[i] += b->x[i + 1];
47 }
48
49 void
f6(struct s * a,struct s * b)50 f6 (struct s *a, struct s *b)
51 {
52 for (int i = 0; i < N; ++i)
53 a[1].x[i] += b[2].x[i + 1];
54 }
55
56 void
f7(struct s * a,struct s * b)57 f7 (struct s *a, struct s *b)
58 {
59 for (int i = 0; i < N; ++i)
60 a[1].x[i] += b[i].x[i + 1];
61 }
62
63 void
f8(struct s * a,struct s * b)64 f8 (struct s *a, struct s *b)
65 {
66 for (int i = 0; i < N; ++i)
67 a[i].x[i] += b[i].x[i + 1];
68 }
69
70 void
f9(struct s * a,struct t * b)71 f9 (struct s *a, struct t *b)
72 {
73 for (int i = 0; i < N; ++i)
74 a->x[i] += b->x[1].x[i];
75 }
76
77 void
f10(struct s * a,struct t * b)78 f10 (struct s *a, struct t *b)
79 {
80 for (int i = 0; i < N; ++i)
81 a->x[i] += b->x[i].x[i];
82 }
83
84 void
f11(struct u * a,struct u * b)85 f11 (struct u *a, struct u *b)
86 {
87 for (int i = 0; i < N; ++i)
88 a->x[i] += b->x[i] + b[i].y;
89 }
90
91 void
f12(struct s * a,struct s * b)92 f12 (struct s *a, struct s *b)
93 {
94 for (int i = 0; i < GAP; ++i)
95 a->x[i + GAP] += b->x[i];
96 }
97
98 void
f13(struct s * a,struct s * b)99 f13 (struct s *a, struct s *b)
100 {
101 for (int i = 0; i < GAP * 2; ++i)
102 a->x[i + GAP] += b->x[i];
103 }
104
105 void
f14(struct v * a,struct s * b)106 f14 (struct v *a, struct s *b)
107 {
108 for (int i = 0; i < N; ++i)
109 a->s.x[i] = b->x[i];
110 }
111
112 void
f15(struct s * a,struct s * b)113 f15 (struct s *a, struct s *b)
114 {
115 #pragma omp simd safelen(N)
116 for (int i = 0; i < N; ++i)
117 a->x[i + 1] += b->x[i];
118 }
119
120 /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 15 "vect" } } */
121