sched1: debug/model: dump predecessor list and BB num [NFC]
[gcc.git] / libgomp / testsuite / libgomp.c / loop-7.c
blobfc97f4a2907d0eb5e8ca7bab1e4b85100def14d1
1 /* { dg-do run } */
3 #include <omp.h>
5 extern void abort (void);
7 #define LLONG_MAX __LONG_LONG_MAX__
8 #define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
9 #define INT_MAX __INT_MAX__
11 int v;
13 int
14 test1 (void)
16 int e = 0, cnt = 0;
17 long long i;
18 unsigned long long j;
19 char buf[6], *p;
21 #pragma omp for schedule(dynamic,1) collapse(2) nowait
22 for (i = LLONG_MAX - 30001; i <= LLONG_MAX - 10001; i += 10000)
23 for (j = 20; j <= LLONG_MAX - 70; j += LLONG_MAX + 50ULL)
24 if ((i != LLONG_MAX - 30001
25 && i != LLONG_MAX - 20001
26 && i != LLONG_MAX - 10001)
27 || j != 20)
28 e = 1;
29 else
30 cnt++;
31 if (e || cnt != 3)
32 abort ();
33 else
34 cnt = 0;
36 #pragma omp for schedule(guided,1) collapse(2) nowait
37 for (i = -LLONG_MAX + 30000; i >= -LLONG_MAX + 10000; i -= 10000)
38 for (j = ULLONG_MAX - 3; j >= LLONG_MAX + 70ULL; j -= LLONG_MAX + 50ULL)
39 if ((i != -LLONG_MAX + 30000
40 && i != -LLONG_MAX + 20000
41 && i != -LLONG_MAX + 10000)
42 || j != ULLONG_MAX - 3)
43 e = 1;
44 else
45 cnt++;
46 if (e || cnt != 3)
47 abort ();
48 else
49 cnt = 0;
51 #pragma omp for schedule(static,1) collapse(2) nowait
52 for (i = LLONG_MAX - 30001; i <= LLONG_MAX - 10001; i += 10000)
53 for (j = 20; j <= LLONG_MAX - 70 + v; j += LLONG_MAX + 50ULL)
54 if ((i != LLONG_MAX - 30001
55 && i != LLONG_MAX - 20001
56 && i != LLONG_MAX - 10001)
57 || j != 20)
58 e = 1;
59 else
60 cnt++;
61 if (e || cnt != 3)
62 abort ();
63 else
64 cnt = 0;
66 #pragma omp for schedule(static) collapse(2) nowait
67 for (i = -LLONG_MAX + 30000 + v; i >= -LLONG_MAX + 10000; i -= 10000)
68 for (j = ULLONG_MAX - 3; j >= LLONG_MAX + 70ULL; j -= LLONG_MAX + 50ULL)
69 if ((i != -LLONG_MAX + 30000
70 && i != -LLONG_MAX + 20000
71 && i != -LLONG_MAX + 10000)
72 || j != ULLONG_MAX - 3)
73 e = 1;
74 else
75 cnt++;
76 if (e || cnt != 3)
77 abort ();
78 else
79 cnt = 0;
81 #pragma omp for schedule(runtime) collapse(2) nowait
82 for (i = 10; i < 30; i++)
83 for (p = buf; p <= buf + 4; p += 2)
84 if (i < 10 || i >= 30 || (p != buf && p != buf + 2 && p != buf + 4))
85 e = 1;
86 else
87 cnt++;
88 if (e || cnt != 60)
89 abort ();
90 else
91 cnt = 0;
93 return 0;
96 int
97 main (void)
99 if (2 * sizeof (int) != sizeof (long long))
100 return 0;
101 asm volatile ("" : "+r" (v));
102 omp_set_schedule (omp_sched_dynamic, 1);
103 test1 ();
104 return 0;