sched1: debug/model: dump predecessor list and BB num [NFC]
[gcc.git] / libgomp / testsuite / libgomp.c / target-34.c
blob66d9f54202bea3047020e2d42853bd404a56850c
1 extern void abort (void);
3 int
4 main ()
6 int a = 1, b = 2, c = 4, d[7];
7 #pragma omp parallel
9 #pragma omp single
11 #pragma omp taskgroup
13 #pragma omp target enter data nowait map (to: a, b, c) depend(out: d[0])
14 #pragma omp target nowait map (alloc: a, b) depend(in: d[0]) depend(out: d[1])
16 #pragma omp atomic update
17 a |= 4;
18 #pragma omp atomic update
19 b |= 8;
21 #pragma omp target nowait map (alloc: a, c) depend(in: d[0]) depend(out: d[2])
23 #pragma omp atomic update
24 a |= 16;
25 #pragma omp atomic update
26 c |= 32;
28 #pragma omp target exit data nowait map (from: a, b, c) depend(in: d[1], d[2])
30 if (a != 21 || b != 10 || c != 36)
31 abort ();
32 #pragma omp target map (tofrom: a, b) nowait
34 a &= ~16;
35 b &= ~2;
37 #pragma omp target map (tofrom: c) nowait
39 c |= 8;
41 } /* Implicit barrier here. */
42 #pragma omp single
44 if (a != 5 || b != 8 || c != 44)
45 abort ();
46 #pragma omp target map (tofrom: a, b) nowait
48 a |= 32;
49 b |= 4;
51 #pragma omp target map (tofrom: c) nowait
52 c &= ~4;
53 #pragma omp taskwait
54 if (a != 37 || b != 12 || c != 40)
55 abort ();
56 #pragma omp target nowait map (tofrom: a, b) depend(out: d[3])
58 #pragma omp atomic update
59 a = a + 9;
60 b -= 8;
62 #pragma omp target nowait map (tofrom: a, c) depend(out: d[4])
64 #pragma omp atomic update
65 a = a + 4;
66 c >>= 1;
68 #pragma omp task if (0) depend (in: d[3], d[4]) shared (a, b, c)
69 if (a != 50 || b != 4 || c != 20)
70 abort ();
71 #pragma omp task shared (a)
72 a += 50;
73 #pragma omp target nowait map (tofrom: b)
74 b++;
75 #pragma omp target map (tofrom: c) nowait
76 c--;
77 #pragma omp taskwait
78 if (a != 100 || b != 5 || c != 19)
79 abort ();
80 #pragma omp target map (tofrom: a) nowait depend(out: d[5])
81 a++;
82 #pragma omp target map (tofrom: b) nowait depend(out: d[6])
83 b++;
84 #pragma omp target map (tofrom: a, b) depend(in: d[5], d[6])
86 if (a != 101 || b != 6)
87 a = -9;
88 else
90 a = 24;
91 b = 38;
94 if (a != 24 || b != 38)
95 abort ();
96 } /* Implicit barrier here. */
97 #pragma omp master
99 #pragma omp target nowait map (tofrom: a, b)
101 a *= 2;
102 b++;
104 #pragma omp target map (tofrom: c) nowait
105 c--;
107 #pragma omp barrier
108 if (a != 48 || b != 39 || c != 18)
109 abort ();
111 return 0;