123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- /* PR libgomp/29947 */
- /* { dg-do run } */
- extern void abort (void);
- int cnt;
- void
- test1 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel reduction (+:e,c)
- {
- #pragma omp for schedule (dynamic)
- for (i = j1; i <= k1; ++i)
- {
- if (i < j2 || i > k2)
- ++e;
- ++c;
- }
- #pragma omp atomic
- ++cnt;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test2 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel reduction (+:e,c)
- {
- #pragma omp for schedule (dynamic)
- for (i = k1; i >= j1; --i)
- {
- if (i < j2 || i > k2)
- ++e;
- ++c;
- }
- #pragma omp atomic
- ++cnt;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test3 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel reduction (+:e,c)
- {
- #pragma omp for schedule (guided)
- for (i = j1; i <= k1; ++i)
- {
- if (i < j2 || i > k2)
- ++e;
- ++c;
- }
- #pragma omp atomic
- ++cnt;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test4 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel reduction (+:e,c)
- {
- #pragma omp for schedule (guided)
- for (i = k1; i >= j1; --i)
- {
- if (i < j2 || i > k2)
- ++e;
- ++c;
- }
- #pragma omp atomic
- ++cnt;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test5 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel reduction (+:e,c)
- {
- #pragma omp for schedule (dynamic) ordered
- for (i = j1; i <= k1; ++i)
- {
- if (i < j2 || i > k2)
- ++e;
- #pragma omp ordered
- ++c;
- }
- #pragma omp atomic
- ++cnt;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test6 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel reduction (+:e,c)
- {
- #pragma omp for schedule (dynamic) ordered
- for (i = k1; i >= j1; --i)
- {
- if (i < j2 || i > k2)
- ++e;
- #pragma omp ordered
- ++c;
- }
- #pragma omp atomic
- ++cnt;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test7 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel reduction (+:e,c)
- {
- #pragma omp for schedule (guided) ordered
- for (i = j1; i <= k1; ++i)
- {
- if (i < j2 || i > k2)
- ++e;
- #pragma omp ordered
- ++c;
- }
- #pragma omp atomic
- ++cnt;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test8 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel reduction (+:e,c)
- {
- #pragma omp for schedule (guided) ordered
- for (i = k1; i >= j1; --i)
- {
- if (i < j2 || i > k2)
- ++e;
- #pragma omp ordered
- ++c;
- }
- #pragma omp atomic
- ++cnt;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test9 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel for reduction (+:e,c) schedule (dynamic)
- for (i = j1; i <= k1; ++i)
- {
- if (i < j2 || i > k2)
- ++e;
- ++c;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test10 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel for reduction (+:e,c) schedule (dynamic)
- for (i = k1; i >= j1; --i)
- {
- if (i < j2 || i > k2)
- ++e;
- ++c;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test11 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel for reduction (+:e,c) schedule (guided)
- for (i = j1; i <= k1; ++i)
- {
- if (i < j2 || i > k2)
- ++e;
- ++c;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test12 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel for reduction (+:e,c) schedule (guided)
- for (i = k1; i >= j1; --i)
- {
- if (i < j2 || i > k2)
- ++e;
- ++c;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test13 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel for reduction (+:e,c) schedule (dynamic) ordered
- for (i = j1; i <= k1; ++i)
- {
- if (i < j2 || i > k2)
- ++e;
- #pragma omp ordered
- ++c;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test14 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel for reduction (+:e,c) schedule (dynamic) ordered
- for (i = k1; i >= j1; --i)
- {
- if (i < j2 || i > k2)
- ++e;
- #pragma omp ordered
- ++c;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test15 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel for reduction (+:e,c) schedule (guided) ordered
- for (i = j1; i <= k1; ++i)
- {
- if (i < j2 || i > k2)
- ++e;
- #pragma omp ordered
- ++c;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- void
- test16 (long j1, long k1, long j2, long k2)
- {
- long i, e = 0, c = 0;
- #pragma omp parallel for reduction (+:e,c) schedule (guided) ordered
- for (i = k1; i >= j1; --i)
- {
- if (i < j2 || i > k2)
- ++e;
- #pragma omp ordered
- ++c;
- }
- if (e || (c != j2 > k2 ? 0 : k2 - j2 + 1))
- abort ();
- }
- int
- __attribute__((noinline))
- test (long j1, long k1, long j2, long k2)
- {
- test1 (j1, k1, j2, k2);
- test2 (j1, k1, j2, k2);
- test3 (j1, k1, j2, k2);
- test4 (j1, k1, j2, k2);
- test5 (j1, k1, j2, k2);
- test6 (j1, k1, j2, k2);
- test7 (j1, k1, j2, k2);
- test8 (j1, k1, j2, k2);
- test9 (j1, k1, j2, k2);
- test10 (j1, k1, j2, k2);
- test11 (j1, k1, j2, k2);
- test12 (j1, k1, j2, k2);
- test13 (j1, k1, j2, k2);
- test14 (j1, k1, j2, k2);
- test15 (j1, k1, j2, k2);
- test16 (j1, k1, j2, k2);
- return cnt;
- }
- int
- main (void)
- {
- test (1, 5, 1, 5);
- test (5, 5, 5, 5);
- test (5, 4, 5, 4);
- test (5, 1, 5, 1);
- return 0;
- }
|