5 extern "C" void abort ();
7 #define LLONG_MAX __LONG_LONG_MAX__
8 #define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
9 #define INT_MAX __INT_MAX__
14 set (int loopidx, int idx)
17 arr[loopidx * 5 + idx]++;
20 #define check(var, val, loopidx, idx) \
21 if (var == (val)) set (loopidx, idx); else
22 #define test(loopidx, count) \
23 for (idx = 0; idx < 5; idx++) \
24 if (arr[loopidx * 5 + idx] != idx < count) \
27 arr[loopidx * 5 + idx] = 0
34 #pragma omp parallel reduction(+:e)
38 #pragma omp for schedule(dynamic,1) nowait
39 for (i = LLONG_MAX - 30001; i <= LLONG_MAX - 10001; i += 10000)
41 check (i, LLONG_MAX - 30001, 0, 0)
42 check (i, LLONG_MAX - 20001, 0, 1)
43 check (i, LLONG_MAX - 10001, 0, 2)
46 #pragma omp for schedule(dynamic,1) nowait
47 for (i = -LLONG_MAX + 30000; i >= -LLONG_MAX + 10000; i -= 10000)
49 check (i, -LLONG_MAX + 30000, 1, 0)
50 check (i, -LLONG_MAX + 20000, 1, 1)
51 check (i, -LLONG_MAX + 10000, 1, 2)
54 #pragma omp for schedule(dynamic,1) nowait
55 for (j = 20; j <= LLONG_MAX - 70; j += LLONG_MAX + 50ULL)
60 #pragma omp for schedule(dynamic,1) nowait
61 for (j = ULLONG_MAX - 3; j >= LLONG_MAX + 70ULL; j -= LLONG_MAX + 50ULL)
63 check (j, ULLONG_MAX - 3, 3, 0)
66 #pragma omp for schedule(dynamic,1) nowait
67 for (j = LLONG_MAX - 20000ULL; j <= LLONG_MAX + 10000ULL; j += 10000ULL)
69 check (j, LLONG_MAX - 20000ULL, 4, 0)
70 check (j, LLONG_MAX - 10000ULL, 4, 1)
71 check (j, LLONG_MAX, 4, 2)
72 check (j, LLONG_MAX + 10000ULL, 4, 3)
75 #pragma omp for schedule(dynamic,1) nowait
76 for (i = -3LL * INT_MAX - 20000LL; i <= INT_MAX + 10000LL; i += INT_MAX + 200LL)
78 check (i, -3LL * INT_MAX - 20000LL, 5, 0)
79 check (i, -2LL * INT_MAX - 20000LL + 200LL, 5, 1)
80 check (i, -INT_MAX - 20000LL + 400LL, 5, 2)
81 check (i, -20000LL + 600LL, 5, 3)
82 check (i, INT_MAX - 20000LL + 800LL, 5, 4)
102 #pragma omp parallel reduction(+:e)
105 unsigned long long j;
106 #pragma omp for schedule(guided,1) nowait
107 for (i = LLONG_MAX - 30001; i <= LLONG_MAX - 10001; i += 10000)
109 check (i, LLONG_MAX - 30001, 0, 0)
110 check (i, LLONG_MAX - 20001, 0, 1)
111 check (i, LLONG_MAX - 10001, 0, 2)
114 #pragma omp for schedule(guided,1) nowait
115 for (i = -LLONG_MAX + 30000; i >= -LLONG_MAX + 10000; i -= 10000)
117 check (i, -LLONG_MAX + 30000, 1, 0)
118 check (i, -LLONG_MAX + 20000, 1, 1)
119 check (i, -LLONG_MAX + 10000, 1, 2)
122 #pragma omp for schedule(guided,1) nowait
123 for (j = 20; j <= LLONG_MAX - 70; j += LLONG_MAX + 50ULL)
128 #pragma omp for schedule(guided,1) nowait
129 for (j = ULLONG_MAX - 3; j >= LLONG_MAX + 70ULL; j -= LLONG_MAX + 50ULL)
131 check (j, ULLONG_MAX - 3, 3, 0)
134 #pragma omp for schedule(guided,1) nowait
135 for (j = LLONG_MAX - 20000ULL; j <= LLONG_MAX + 10000ULL; j += 10000ULL)
137 check (j, LLONG_MAX - 20000ULL, 4, 0)
138 check (j, LLONG_MAX - 10000ULL, 4, 1)
139 check (j, LLONG_MAX, 4, 2)
140 check (j, LLONG_MAX + 10000ULL, 4, 3)
143 #pragma omp for schedule(guided,1) nowait
144 for (i = -3LL * INT_MAX - 20000LL; i <= INT_MAX + 10000LL; i += INT_MAX + 200LL)
146 check (i, -3LL * INT_MAX - 20000LL, 5, 0)
147 check (i, -2LL * INT_MAX - 20000LL + 200LL, 5, 1)
148 check (i, -INT_MAX - 20000LL + 400LL, 5, 2)
149 check (i, -20000LL + 600LL, 5, 3)
150 check (i, INT_MAX - 20000LL + 800LL, 5, 4)
170 #pragma omp parallel reduction(+:e)
173 unsigned long long j;
174 #pragma omp for schedule(static) nowait
175 for (i = LLONG_MAX - 30001; i <= LLONG_MAX - 10001; i += 10000)
177 check (i, LLONG_MAX - 30001, 0, 0)
178 check (i, LLONG_MAX - 20001, 0, 1)
179 check (i, LLONG_MAX - 10001, 0, 2)
182 #pragma omp for schedule(static) nowait
183 for (i = -LLONG_MAX + 30000; i >= -LLONG_MAX + 10000; i -= 10000)
185 check (i, -LLONG_MAX + 30000, 1, 0)
186 check (i, -LLONG_MAX + 20000, 1, 1)
187 check (i, -LLONG_MAX + 10000, 1, 2)
190 #pragma omp for schedule(static) nowait
191 for (j = 20; j <= LLONG_MAX - 70; j += LLONG_MAX + 50ULL)
196 #pragma omp for schedule(static) nowait
197 for (j = ULLONG_MAX - 3; j >= LLONG_MAX + 70ULL; j -= LLONG_MAX + 50ULL)
199 check (j, ULLONG_MAX - 3, 3, 0)
202 #pragma omp for schedule(static) nowait
203 for (j = LLONG_MAX - 20000ULL; j <= LLONG_MAX + 10000ULL; j += 10000ULL)
205 check (j, LLONG_MAX - 20000ULL, 4, 0)
206 check (j, LLONG_MAX - 10000ULL, 4, 1)
207 check (j, LLONG_MAX, 4, 2)
208 check (j, LLONG_MAX + 10000ULL, 4, 3)
211 #pragma omp for schedule(static) nowait
212 for (i = -3LL * INT_MAX - 20000LL; i <= INT_MAX + 10000LL; i += INT_MAX + 200LL)
214 check (i, -3LL * INT_MAX - 20000LL, 5, 0)
215 check (i, -2LL * INT_MAX - 20000LL + 200LL, 5, 1)
216 check (i, -INT_MAX - 20000LL + 400LL, 5, 2)
217 check (i, -20000LL + 600LL, 5, 3)
218 check (i, INT_MAX - 20000LL + 800LL, 5, 4)
238 #pragma omp parallel reduction(+:e)
241 unsigned long long j;
242 #pragma omp for schedule(static,1) nowait
243 for (i = LLONG_MAX - 30001; i <= LLONG_MAX - 10001; i += 10000)
245 check (i, LLONG_MAX - 30001, 0, 0)
246 check (i, LLONG_MAX - 20001, 0, 1)
247 check (i, LLONG_MAX - 10001, 0, 2)
250 #pragma omp for schedule(static,1) nowait
251 for (i = -LLONG_MAX + 30000; i >= -LLONG_MAX + 10000; i -= 10000)
253 check (i, -LLONG_MAX + 30000, 1, 0)
254 check (i, -LLONG_MAX + 20000, 1, 1)
255 check (i, -LLONG_MAX + 10000, 1, 2)
258 #pragma omp for schedule(static,1) nowait
259 for (j = 20; j <= LLONG_MAX - 70; j += LLONG_MAX + 50ULL)
264 #pragma omp for schedule(static,1) nowait
265 for (j = ULLONG_MAX - 3; j >= LLONG_MAX + 70ULL; j -= LLONG_MAX + 50ULL)
267 check (j, ULLONG_MAX - 3, 3, 0)
270 #pragma omp for schedule(static,1) nowait
271 for (j = LLONG_MAX - 20000ULL; j <= LLONG_MAX + 10000ULL; j += 10000ULL)
273 check (j, LLONG_MAX - 20000ULL, 4, 0)
274 check (j, LLONG_MAX - 10000ULL, 4, 1)
275 check (j, LLONG_MAX, 4, 2)
276 check (j, LLONG_MAX + 10000ULL, 4, 3)
279 #pragma omp for schedule(static,1) nowait
280 for (i = -3LL * INT_MAX - 20000LL; i <= INT_MAX + 10000LL; i += INT_MAX + 200LL)
282 check (i, -3LL * INT_MAX - 20000LL, 5, 0)
283 check (i, -2LL * INT_MAX - 20000LL + 200LL, 5, 1)
284 check (i, -INT_MAX - 20000LL + 400LL, 5, 2)
285 check (i, -20000LL + 600LL, 5, 3)
286 check (i, INT_MAX - 20000LL + 800LL, 5, 4)
306 #pragma omp parallel reduction(+:e)
309 unsigned long long j;
310 #pragma omp for schedule(runtime) nowait
311 for (i = LLONG_MAX - 30001; i <= LLONG_MAX - 10001; i += 10000)
313 check (i, LLONG_MAX - 30001, 0, 0)
314 check (i, LLONG_MAX - 20001, 0, 1)
315 check (i, LLONG_MAX - 10001, 0, 2)
318 #pragma omp for schedule(runtime) nowait
319 for (i = -LLONG_MAX + 30000; i >= -LLONG_MAX + 10000; i -= 10000)
321 check (i, -LLONG_MAX + 30000, 1, 0)
322 check (i, -LLONG_MAX + 20000, 1, 1)
323 check (i, -LLONG_MAX + 10000, 1, 2)
326 #pragma omp for schedule(runtime) nowait
327 for (j = 20; j <= LLONG_MAX - 70; j += LLONG_MAX + 50ULL)
332 #pragma omp for schedule(runtime) nowait
333 for (j = ULLONG_MAX - 3; j >= LLONG_MAX + 70ULL; j -= LLONG_MAX + 50ULL)
335 check (j, ULLONG_MAX - 3, 3, 0)
338 #pragma omp for schedule(runtime) nowait
339 for (j = LLONG_MAX - 20000ULL; j <= LLONG_MAX + 10000ULL; j += 10000ULL)
341 check (j, LLONG_MAX - 20000ULL, 4, 0)
342 check (j, LLONG_MAX - 10000ULL, 4, 1)
343 check (j, LLONG_MAX, 4, 2)
344 check (j, LLONG_MAX + 10000ULL, 4, 3)
347 #pragma omp for schedule(runtime) nowait
348 for (i = -3LL * INT_MAX - 20000LL; i <= INT_MAX + 10000LL; i += INT_MAX + 200LL)
350 check (i, -3LL * INT_MAX - 20000LL, 5, 0)
351 check (i, -2LL * INT_MAX - 20000LL + 200LL, 5, 1)
352 check (i, -INT_MAX - 20000LL + 400LL, 5, 2)
353 check (i, -20000LL + 600LL, 5, 3)
354 check (i, INT_MAX - 20000LL + 800LL, 5, 4)
372 if (2 * sizeof (int) != sizeof (long long))
378 omp_set_schedule (omp_sched_static, 0);
380 omp_set_schedule (omp_sched_static, 3);
382 omp_set_schedule (omp_sched_dynamic, 5);
384 omp_set_schedule (omp_sched_guided, 2);