diff options
Diffstat (limited to 'libgomp/testsuite/libgomp.c-c++-common/depend-mutexinout-2.c')
-rw-r--r-- | libgomp/testsuite/libgomp.c-c++-common/depend-mutexinout-2.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c-c++-common/depend-mutexinout-2.c b/libgomp/testsuite/libgomp.c-c++-common/depend-mutexinout-2.c new file mode 100644 index 0000000..ed92063 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/depend-mutexinout-2.c @@ -0,0 +1,59 @@ +int +main () +{ + int a, b, c = 0; + #pragma omp parallel num_threads(2) + { + #pragma omp barrier + #pragma omp single + { + #pragma omp task depend(out: a) + { + int i; + a = 0; + for (i = 0; i < 524288; ++i) + { + asm volatile ("" : "+g" (a)); + a++; + } + } + #pragma omp task depend(out: b) + { + int i; + b = 0; + for (i = 0; i < 64; ++i) + { + asm volatile ("" : "+g" (b)); + b++; + } + } + #pragma omp task depend(in: a) depend(mutexinoutset: c) + { + int i; + int d = c; + for (i = 0; i < 524288 + 64 - a; ++i) + { + asm volatile ("" : "+g" (d) : "g" (&a) : "memory"); + d++; + } + asm volatile ("" : "+g" (d), "+g" (c)); + c = d; + } + #pragma omp task depend(in: b) depend(mutexinoutset: c) + { + int i; + int d = c; + for (i = 0; i < 524288 + 64 - b; ++i) + { + asm volatile ("" : "+g" (d) : "g" (&b) : "memory"); + d++; + } + asm volatile ("" : "+g" (d), "+g" (c)); + c = d; + } + } + } + if (c != 524288 + 64) + __builtin_abort (); + return 0; +} |