sched1: debug/model: dump predecessor list and BB num [NFC]
[gcc.git] / libgomp / testsuite / libgomp.c / loop-25.c
blob052da71be0f29a5b0c14c633d08d7d740c0216cf
1 /* { dg-do run } */
2 /* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
5 int x, i, j;
6 volatile int a, b, c, d, e, f, g, h;
7 int k[11][101];
8 extern void abort (void);
10 int
11 main ()
13 int niters, err = 0;
14 for (i = 1; i <= 10; i++)
15 for (j = 1; j <= 10 * i; j++)
17 k[i][j] = 1;
18 asm volatile ("" : : : "memory");
20 a = 1; b = 11; c = 1; d = 0; e = 1; f = 10; g = 1; h = 1;
21 niters = 0; i = -100; j = -100; x = -100;
22 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
23 for (i = 1; i <= 10; i++)
24 for (j = 1; j <= 10 * i; j++)
26 err |= (i < 1);
27 err |= (i > 10);
28 err |= (j < 1);
29 err |= (j > 10 * i);
30 err |= (k[i][j] != 1);
31 k[i][j]++;
32 x = i * 1024 + (j & 1023);
33 niters++;
35 if (i != 11 || j != 101 || x != 10340 || niters != 550 || err)
36 abort ();
37 niters = 0; i = -100; j = -100; x = -100;
38 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
39 for (i = a; i < b; i += c)
40 for (j = d * i + e; j < g + i * f; j += h)
42 err |= (i < 1);
43 err |= (i > 10);
44 err |= (j < 1);
45 err |= (j > 10 * i);
46 err |= (k[i][j] != 2);
47 k[i][j]++;
48 x = i * 1024 + (j & 1023);
49 niters++;
51 if (i != 11 || j != 101 || x != 10340 || niters != 550 || err)
52 abort ();
53 for (i = 1; i <= 10; i++)
54 for (j = 1; j <= 10 * i; j++)
55 if (k[i][j] == 3)
56 k[i][j] = 0;
57 else
58 abort ();
59 for (i = 0; i < 11; i++)
60 for (j = 0; j < 101; j++)
61 if (k[i][j] != 0)
62 abort ();
63 for (i = 0; i < 10; i++)
64 for (j = 0; j < 10 * i; j++)
66 k[i][j] = 1;
67 asm volatile ("" : : : "memory");
69 a = 0; b = 10; c = 1; d = 0; e = 0; f = 10; g = 0; h = 1;
70 niters = 0; i = -100; j = -100; x = -100;
71 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
72 for (i = 0; i < 10; i++)
73 for (j = 0; j < 10 * i; j++)
75 err |= (i < 0);
76 err |= (i >= 10);
77 err |= (j < 0);
78 err |= (j >= 10 * i);
79 err |= (k[i][j] != 1);
80 k[i][j]++;
81 x = i * 1024 + (j & 1023);
82 niters++;
84 if (i != 10 || j != 90 || x != 9305 || niters != 450 || err)
85 abort ();
86 niters = 0; i = -100; j = -100; x = -100;
87 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
88 for (i = a; i < b; i += c)
89 for (j = d * i + e; j < g + i * f; j += h)
91 err |= (i < 0);
92 err |= (i >= 10);
93 err |= (j < 0);
94 err |= (j >= 10 * i);
95 err |= (k[i][j] != 2);
96 k[i][j]++;
97 x = i * 1024 + (j & 1023);
98 niters++;
100 if (i != 10 || j != 90 || x != 9305 || niters != 450 || err)
101 abort ();
102 for (i = 0; i < 10; i++)
103 for (j = 0; j < 10 * i; j++)
104 if (k[i][j] == 3)
105 k[i][j] = 0;
106 else
107 abort ();
108 for (i = 0; i < 11; i++)
109 for (j = 0; j < 101; j++)
110 if (k[i][j] != 0)
111 abort ();
112 for (i = 4; i < 10; i++)
113 for (j = -9 + 2 * i; j < i; j++)
115 k[i][j + 1] = 1;
116 asm volatile ("" : : : "memory");
118 a = 4; b = 10; c = 1; d = 2; e = -9; f = 1; g = 0; h = 1;
119 niters = 0; i = -100; j = -100; x = -100;
120 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
121 for (i = 4; i < 10; i++)
122 for (j = -9 + 2 * i; j < i; j++)
124 err |= (i < 4);
125 err |= (i >= 10);
126 err |= (j < -9 + 2 * i);
127 err |= (j >= i);
128 err |= (k[i][j + 1] != 1);
129 k[i][j + 1]++;
130 x = i * 1024 + (j & 1023);
131 niters++;
133 if (/*i != 10 || j != 9 || */x != 8199 || niters != 15 || err)
134 abort ();
135 niters = 0; i = -100; j = -100; x = -100;
136 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
137 for (i = a; i < b; i += c)
138 for (j = d * i + e; j < g + i * f; j += h)
140 err |= (i < 4);
141 err |= (i >= 10);
142 err |= (j < -9 + 2 * i);
143 err |= (j >= i);
144 err |= (k[i][j + 1] != 2);
145 k[i][j + 1]++;
146 x = i * 1024 + (j & 1023);
147 niters++;
149 if (/*i != 10 || j != 9 || */x != 8199 || niters != 15 || err)
150 abort ();
151 for (i = 4; i < 10; i++)
152 for (j = -9 + 2 * i; j < i; j++)
153 if (k[i][j + 1] == 3)
154 k[i][j + 1] = 0;
155 else
156 abort ();
157 for (i = 0; i < 11; i++)
158 for (j = 0; j < 101; j++)
159 if (k[i][j] != 0)
160 abort ();
161 for (i = 1; i < 10; i += 2)
162 for (j = 1; j < i + 1; j++)
164 k[i][j] = 1;
165 asm volatile ("" : : : "memory");
167 a = 1; b = 10; c = 2; d = 0; e = 1; f = 1; g = 1; h = 1;
168 niters = 0; i = -100; j = -100; x = -100;
169 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
170 for (i = 1; i < 10; i += 2)
171 for (j = 1; j < i + 1; j++)
173 err |= (i < 1);
174 err |= (i >= 10);
175 err |= (j < 1);
176 err |= (j >= i + 1);
177 err |= (k[i][j] != 1);
178 k[i][j]++;
179 x = i * 1024 + (j & 1023);
180 niters++;
182 if (i != 11 || j != 10 || x != 9225 || niters != 25 || err)
183 abort ();
184 niters = 0; i = -100; j = -100; x = -100;
185 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
186 for (i = a; i < b; i += c)
187 for (j = d * i + e; j < g + i * f; j += h)
189 err |= (i < 1);
190 err |= (i >= 10);
191 err |= (j < 1);
192 err |= (j >= i + 1);
193 err |= (k[i][j] != 2);
194 k[i][j]++;
195 x = i * 1024 + (j & 1023);
196 niters++;
198 if (i != 11 || j != 10 || x != 9225 || niters != 25 || err)
199 abort ();
200 for (i = 1; i < 10; i += 2)
201 for (j = 1; j < i + 1; j++)
202 if (k[i][j] == 3)
203 k[i][j] = 0;
204 else
205 abort ();
206 for (i = 0; i < 11; i++)
207 for (j = 0; j < 101; j++)
208 if (k[i][j] != 0)
209 abort ();
210 for (j = -11; j >= -41; j -= 15)
212 k[0][-j] = 1;
213 asm volatile ("" : : : "memory");
215 a = 4; b = 8; c = 12; d = -8; e = -9; f = -3; g = 6; h = 15;
216 niters = 0; i = -100; j = -100; x = -100;
217 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
218 for (i = 4; i < 8; i += 12)
219 for (j = -8 * i - 9; j < i * -3 + 6; j += 15)
221 err |= (i != 4);
222 err |= (j < -41);
223 err |= (j > -11);
224 err |= (k[0][-j] != 1);
225 k[0][-j]++;
226 x = i * 1024 + (j & 1023);
227 niters++;
229 if (i != 16 || j != 4 || x != 5109 || niters != 3 || err)
230 abort ();
231 niters = 0; i = -100; j = -100; x = -100;
232 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
233 for (i = a; i < b; i += c)
234 for (j = d * i + e; j < g + i * f; j += h)
236 err |= (i != 4);
237 err |= (j < -41);
238 err |= (j > -11);
239 err |= (k[0][-j] != 2);
240 k[0][-j]++;
241 x = i * 1024 + (j & 1023);
242 niters++;
244 if (i != 16 || j != 4 || x != 5109 || niters != 3 || err)
245 abort ();
246 for (j = -11; j >= -41; j -= 15)
247 if (k[0][-j] == 3)
248 k[0][-j] = 0;
249 else
250 abort ();
251 for (j = -11; j >= -41; j--)
252 if (k[0][-j] != 0)
253 abort ();
254 for (j = -34; j <= -7; j++)
256 k[0][-j] = 1;
257 asm volatile ("" : : : "memory");
259 a = -13; b = 7; c = 12; d = 3; e = 5; f = 0; g = -6; h = 1;
260 niters = 0; i = -100; j = -100; x = -100;
261 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
262 for (i = -13; i < 7; i += 12)
263 for (j = 3 * i + 5; j < -6; j++)
265 err |= (i != -13);
266 err |= (j < -34);
267 err |= (j > -7);
268 err |= (k[0][-j] != 1);
269 k[0][-j]++;
270 x = i * 1024 + (j & 1023);
271 niters++;
273 if (/*i != 11 || j != 2 || */x != -12295 || niters != 28 || err)
274 abort ();
275 niters = 0; i = -100; j = -100; x = -100;
276 #pragma omp parallel for simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
277 for (i = a; i < b; i += c)
278 for (j = d * i + e; j < g + i * f; j += h)
280 err |= (i != -13);
281 err |= (j < -34);
282 err |= (j > -7);
283 err |= (k[0][-j] != 2);
284 k[0][-j]++;
285 x = i * 1024 + (j & 1023);
286 niters++;
288 if (/*i != 11 || j != 2 || */x != -12295 || niters != 28 || err)
289 abort ();
290 for (j = -34; j <= -7; j++)
291 if (k[0][-j] == 3)
292 k[0][-j] = 0;
293 else
294 abort ();
295 return 0;