Daily bump.
[official-gcc.git] / libgomp / testsuite / libgomp.c / target-32.c
blob233877b702ba6903ba640c3b2ca9e9fb425d3b2b
1 #include <stdlib.h>
2 #include <unistd.h>
4 int main ()
6 int a = 0, b = 0, c = 0, d[7];
8 #pragma omp parallel
9 #pragma omp single
11 #pragma omp task depend(out: d[0])
12 a = 2;
14 #pragma omp target enter data nowait map(to: a,b,c) depend(in: d[0]) depend(out: d[1])
16 #pragma omp target nowait map(alloc: a) depend(in: d[1]) depend(out: d[2])
17 a++;
19 #pragma omp target nowait map(alloc: b) depend(in: d[2]) depend(out: d[3])
21 usleep (1000);
22 #pragma omp atomic update
23 b |= 4;
26 #pragma omp target nowait map(alloc: b) depend(in: d[2]) depend(out: d[4])
28 usleep (5000);
29 #pragma omp atomic update
30 b |= 1;
33 #pragma omp target nowait map(alloc: c) depend(in: d[3], d[4]) depend(out: d[5])
35 usleep (5000);
36 #pragma omp atomic update
37 c |= 8;
40 #pragma omp target nowait map(alloc: c) depend(in: d[3], d[4]) depend(out: d[6])
42 usleep (1000);
43 #pragma omp atomic update
44 c |= 2;
47 #pragma omp target exit data map(always,from: a,b,c) depend(in: d[5], d[6])
50 if (a != 3 || b != 5 || c != 10)
51 abort ();
53 return 0;