aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/workshare-reduction-52.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/gomp/workshare-reduction-52.c')
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-52.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-52.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-52.c
new file mode 100644
index 0000000..be51f97
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-52.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_start \[^\n\r]*, (?:2147483649|-2147483647), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_start " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_static_next " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } } */
+
+int j;
+void bar (int *);
+
+void
+foo (int a, int b, int c)
+{
+ int i;
+ #pragma omp parallel
+ #pragma omp for ordered reduction (task, *: j)
+ for (i = a; i < b; i += c)
+ {
+ bar (&j);
+ #pragma omp ordered
+ j++;
+ }
+}