RISC-V: testsuite: fix old-style function definition error [NFC]
[official-gcc.git] / libgomp / testsuite / libgomp.c / loop-18.c
blob5963a4a493141e9f99c2638fccaa0368e3b1fe5f
1 /* { dg-do run } */
3 extern void abort (void);
5 int x, i, j;
6 volatile int a, b, c, d, e, f, g, h;
7 int k[11][101];
9 int
10 main ()
12 int niters;
13 for (i = 1; i <= 10; i++)
14 for (j = 1; j <= 10 * i; j++)
15 k[i][j] = 1;
16 a = 1; b = 11; c = 1; d = 0; e = 1; f = 10; g = 1; h = 1;
17 niters = 0; i = -100; j = -100; x = -100;
18 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
19 for (i = 1; i <= 10; i++)
20 for (j = 1; j <= 10 * i; j++)
22 if (i < 1 || i > 10 || j < 1 || j > 10 * i || k[i][j] != 1)
23 abort ();
24 k[i][j]++;
25 x = i * 1024 + (j & 1023);
26 niters++;
28 if (i != 11 || j != 101 || x != 10340 || niters != 550)
29 abort ();
30 niters = 0; i = -100; j = -100; x = -100;
31 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
32 for (i = a; i < b; i += c)
33 for (j = d * i + e; j < g + i * f; j += h)
35 if (i < 1 || i > 10 || j < 1 || j > 10 * i || k[i][j] != 2)
36 abort ();
37 k[i][j]++;
38 x = i * 1024 + (j & 1023);
39 niters++;
41 if (i != 11 || j != 101 || x != 10340 || niters != 550)
42 abort ();
43 for (i = 1; i <= 10; i++)
44 for (j = 1; j <= 10 * i; j++)
45 if (k[i][j] == 3)
46 k[i][j] = 0;
47 else
48 abort ();
49 for (i = 0; i < 11; i++)
50 for (j = 0; j < 101; j++)
51 if (k[i][j] != 0)
52 abort ();
53 for (i = 0; i < 10; i++)
54 for (j = 0; j < 10 * i; j++)
55 k[i][j] = 1;
56 a = 0; b = 10; c = 1; d = 0; e = 0; f = 10; g = 0; h = 1;
57 niters = 0; i = -100; j = -100; x = -100;
58 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
59 for (i = 0; i < 10; i++)
60 for (j = 0; j < 10 * i; j++)
62 if (i < 0 || i >= 10 || j < 0 || j >= 10 * i || k[i][j] != 1)
63 abort ();
64 k[i][j]++;
65 x = i * 1024 + (j & 1023);
66 niters++;
68 if (i != 10 || j != 90 || x != 9305 || niters != 450)
69 abort ();
70 niters = 0; i = -100; j = -100; x = -100;
71 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
72 for (i = a; i < b; i += c)
73 for (j = d * i + e; j < g + i * f; j += h)
75 if (i < 0 || i >= 10 || j < 0 || j >= 10 * i || k[i][j] != 2)
76 abort ();
77 k[i][j]++;
78 x = i * 1024 + (j & 1023);
79 niters++;
81 if (i != 10 || j != 90 || x != 9305 || niters != 450)
82 abort ();
83 for (i = 0; i < 10; i++)
84 for (j = 0; j < 10 * i; j++)
85 if (k[i][j] == 3)
86 k[i][j] = 0;
87 else
88 abort ();
89 for (i = 0; i < 11; i++)
90 for (j = 0; j < 101; j++)
91 if (k[i][j] != 0)
92 abort ();
93 for (i = 4; i < 10; i++)
94 for (j = -9 + 2 * i; j < i; j++)
95 k[i][j + 1] = 1;
96 a = 4; b = 10; c = 1; d = 2; e = -9; f = 1; g = 0; h = 1;
97 niters = 0; i = -100; j = -100; x = -100;
98 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
99 for (i = 4; i < 10; i++)
100 for (j = -9 + 2 * i; j < i; j++)
102 if (i < 4 || i >= 10 || j < -9 + 2 * i || j >= i || k[i][j + 1] != 1)
103 abort ();
104 k[i][j + 1]++;
105 x = i * 1024 + (j & 1023);
106 niters++;
108 if (/*i != 10 || j != 9 || */x != 8199 || niters != 15)
109 abort ();
110 niters = 0; i = -100; j = -100; x = -100;
111 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
112 for (i = a; i < b; i += c)
113 for (j = d * i + e; j < g + i * f; j += h)
115 if (i < 4 || i >= 10 || j < -9 + 2 * i || j >= i || k[i][j + 1] != 2)
116 abort ();
117 k[i][j + 1]++;
118 x = i * 1024 + (j & 1023);
119 niters++;
121 if (/*i != 10 || j != 9 || */x != 8199 || niters != 15)
122 abort ();
123 for (i = 4; i < 10; i++)
124 for (j = -9 + 2 * i; j < i; j++)
125 if (k[i][j + 1] == 3)
126 k[i][j + 1] = 0;
127 else
128 abort ();
129 for (i = 0; i < 11; i++)
130 for (j = 0; j < 101; j++)
131 if (k[i][j] != 0)
132 abort ();
133 for (i = 1; i < 10; i += 2)
134 for (j = 1; j < i + 1; j++)
135 k[i][j] = 1;
136 a = 1; b = 10; c = 2; d = 0; e = 1; f = 1; g = 1; h = 1;
137 niters = 0; i = -100; j = -100; x = -100;
138 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
139 for (i = 1; i < 10; i += 2)
140 for (j = 1; j < i + 1; j++)
142 if (i < 1 || i >= 10 || j < 1 || j >= i + 1 || k[i][j] != 1)
143 abort ();
144 k[i][j]++;
145 x = i * 1024 + (j & 1023);
146 niters++;
148 if (i != 11 || j != 10 || x != 9225 || niters != 25)
149 abort ();
150 niters = 0; i = -100; j = -100; x = -100;
151 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
152 for (i = a; i < b; i += c)
153 for (j = d * i + e; j < g + i * f; j += h)
155 if (i < 1 || i >= 10 || j < 1 || j >= i + 1 || k[i][j] != 2)
156 abort ();
157 k[i][j]++;
158 x = i * 1024 + (j & 1023);
159 niters++;
161 if (i != 11 || j != 10 || x != 9225 || niters != 25)
162 abort ();
163 for (i = 1; i < 10; i += 2)
164 for (j = 1; j < i + 1; j++)
165 if (k[i][j] == 3)
166 k[i][j] = 0;
167 else
168 abort ();
169 for (i = 0; i < 11; i++)
170 for (j = 0; j < 101; j++)
171 if (k[i][j] != 0)
172 abort ();
173 for (j = -11; j >= -41; j -= 15)
174 k[0][-j] = 1;
175 a = 4; b = 8; c = 12; d = -8; e = -9; f = -3; g = 6; h = 15;
176 niters = 0; i = -100; j = -100; x = -100;
177 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
178 for (i = 4; i < 8; i += 12)
179 for (j = -8 * i - 9; j < i * -3 + 6; j += 15)
181 if (i != 4 || j < -41 || j > -11 || k[0][-j] != 1)
182 abort ();
183 k[0][-j]++;
184 x = i * 1024 + (j & 1023);
185 niters++;
187 if (i != 16 || j != 4 || x != 5109 || niters != 3)
188 abort ();
189 niters = 0; i = -100; j = -100; x = -100;
190 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
191 for (i = a; i < b; i += c)
192 for (j = d * i + e; j < g + i * f; j += h)
194 if (i != 4 || j < -41 || j > -11 || k[0][-j] != 2)
195 abort ();
196 k[0][-j]++;
197 x = i * 1024 + (j & 1023);
198 niters++;
200 if (i != 16 || j != 4 || x != 5109 || niters != 3)
201 abort ();
202 for (j = -11; j >= -41; j -= 15)
203 if (k[0][-j] == 3)
204 k[0][-j] = 0;
205 else
206 abort ();
207 for (j = -11; j >= -41; j--)
208 if (k[0][-j] != 0)
209 abort ();
210 for (j = -34; j <= -7; j++)
211 k[0][-j] = 1;
212 a = -13; b = 7; c = 12; d = 3; e = 5; f = 0; g = -6; h = 1;
213 niters = 0; i = -100; j = -100; x = -100;
214 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
215 for (i = -13; i < 7; i += 12)
216 for (j = 3 * i + 5; j < -6; j++)
218 if (i != -13 || j < -34 || j > -7 || k[0][-j] != 1)
219 abort ();
220 k[0][-j]++;
221 x = i * 1024 + (j & 1023);
222 niters++;
224 if (/*i != 11 || j != 2 || */x != -12295 || niters != 28)
225 abort ();
226 niters = 0; i = -100; j = -100; x = -100;
227 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
228 for (i = a; i < b; i += c)
229 for (j = d * i + e; j < g + i * f; j += h)
231 if (i != -13 || j < -34 || j > -7 || k[0][-j] != 2)
232 abort ();
233 k[0][-j]++;
234 x = i * 1024 + (j & 1023);
235 niters++;
237 if (/*i != 11 || j != 2 || */x != -12295 || niters != 28)
238 abort ();
239 for (j = -34; j <= -7; j++)
240 if (k[0][-j] == 3)
241 k[0][-j] = 0;
242 else
243 abort ();
244 return 0;