aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog61
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-10.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-11.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-12.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-13.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-14.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-15.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-16.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-17.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-18.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-19.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-2.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-20.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-21.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-22.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-23.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-24.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-25.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-26.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-27.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-28.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-29.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-3.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-30.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-31.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-32.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-33.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-34.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-35.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-36.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-37.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-38.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-39.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-4.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-40.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-41.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-42.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-43.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-44.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-45.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-46.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-47.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-48.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-49.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-5.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-50.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-51.c26
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-52.c26
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-53.c26
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-54.c26
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-55.c27
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-56.c27
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-57.c27
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-58.c27
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-6.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-7.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-8.c23
-rw-r--r--gcc/testsuite/gcc.dg/gomp/workshare-reduction-9.c23
59 files changed, 1423 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aed3a1f..8fa0c47 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,64 @@
+2018-11-09 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/gomp/workshare-reduction-1.c: New test.
+ * gcc.dg/gomp/workshare-reduction-2.c: New test.
+ * gcc.dg/gomp/workshare-reduction-3.c: New test.
+ * gcc.dg/gomp/workshare-reduction-4.c: New test.
+ * gcc.dg/gomp/workshare-reduction-5.c: New test.
+ * gcc.dg/gomp/workshare-reduction-6.c: New test.
+ * gcc.dg/gomp/workshare-reduction-7.c: New test.
+ * gcc.dg/gomp/workshare-reduction-8.c: New test.
+ * gcc.dg/gomp/workshare-reduction-9.c: New test.
+ * gcc.dg/gomp/workshare-reduction-10.c: New test.
+ * gcc.dg/gomp/workshare-reduction-11.c: New test.
+ * gcc.dg/gomp/workshare-reduction-12.c: New test.
+ * gcc.dg/gomp/workshare-reduction-13.c: New test.
+ * gcc.dg/gomp/workshare-reduction-14.c: New test.
+ * gcc.dg/gomp/workshare-reduction-15.c: New test.
+ * gcc.dg/gomp/workshare-reduction-16.c: New test.
+ * gcc.dg/gomp/workshare-reduction-17.c: New test.
+ * gcc.dg/gomp/workshare-reduction-18.c: New test.
+ * gcc.dg/gomp/workshare-reduction-19.c: New test.
+ * gcc.dg/gomp/workshare-reduction-20.c: New test.
+ * gcc.dg/gomp/workshare-reduction-21.c: New test.
+ * gcc.dg/gomp/workshare-reduction-22.c: New test.
+ * gcc.dg/gomp/workshare-reduction-23.c: New test.
+ * gcc.dg/gomp/workshare-reduction-24.c: New test.
+ * gcc.dg/gomp/workshare-reduction-25.c: New test.
+ * gcc.dg/gomp/workshare-reduction-26.c: New test.
+ * gcc.dg/gomp/workshare-reduction-27.c: New test.
+ * gcc.dg/gomp/workshare-reduction-28.c: New test.
+ * gcc.dg/gomp/workshare-reduction-29.c: New test.
+ * gcc.dg/gomp/workshare-reduction-30.c: New test.
+ * gcc.dg/gomp/workshare-reduction-31.c: New test.
+ * gcc.dg/gomp/workshare-reduction-32.c: New test.
+ * gcc.dg/gomp/workshare-reduction-33.c: New test.
+ * gcc.dg/gomp/workshare-reduction-34.c: New test.
+ * gcc.dg/gomp/workshare-reduction-35.c: New test.
+ * gcc.dg/gomp/workshare-reduction-36.c: New test.
+ * gcc.dg/gomp/workshare-reduction-37.c: New test.
+ * gcc.dg/gomp/workshare-reduction-38.c: New test.
+ * gcc.dg/gomp/workshare-reduction-39.c: New test.
+ * gcc.dg/gomp/workshare-reduction-40.c: New test.
+ * gcc.dg/gomp/workshare-reduction-41.c: New test.
+ * gcc.dg/gomp/workshare-reduction-42.c: New test.
+ * gcc.dg/gomp/workshare-reduction-43.c: New test.
+ * gcc.dg/gomp/workshare-reduction-44.c: New test.
+ * gcc.dg/gomp/workshare-reduction-45.c: New test.
+ * gcc.dg/gomp/workshare-reduction-46.c: New test.
+ * gcc.dg/gomp/workshare-reduction-47.c: New test.
+ * gcc.dg/gomp/workshare-reduction-48.c: New test.
+ * gcc.dg/gomp/workshare-reduction-49.c: New test.
+ * gcc.dg/gomp/workshare-reduction-50.c: New test.
+ * gcc.dg/gomp/workshare-reduction-51.c: New test.
+ * gcc.dg/gomp/workshare-reduction-52.c: New test.
+ * gcc.dg/gomp/workshare-reduction-53.c: New test.
+ * gcc.dg/gomp/workshare-reduction-54.c: New test.
+ * gcc.dg/gomp/workshare-reduction-55.c: New test.
+ * gcc.dg/gomp/workshare-reduction-56.c: New test.
+ * gcc.dg/gomp/workshare-reduction-57.c: New test.
+ * gcc.dg/gomp/workshare-reduction-58.c: New test.
+
2018-11-09 Stafford Horne <shorne@gmail.com>
Richard Henderson <rth@twiddle.net>
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-1.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-1.c
new file mode 100644
index 0000000..1edd137
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 0, 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_maybe_nonmonotonic_runtime_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 reduction (task, *: j) schedule (runtime)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-10.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-10.c
new file mode 100644
index 0000000..bb2bfc1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-10.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j) schedule (nonmonotonic: static, 2)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-11.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-11.c
new file mode 100644
index 0000000..8c3707a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-11.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_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 reduction (task, *: j) schedule (dynamic)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-12.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-12.c
new file mode 100644
index 0000000..e6a2560
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-12.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_dynamic_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 reduction (task, *: j) schedule (monotonic: dynamic)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-13.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-13.c
new file mode 100644
index 0000000..367a9d9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-13.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_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 reduction (task, *: j) schedule (nonmonotonic: dynamic)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-14.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-14.c
new file mode 100644
index 0000000..d4099d6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-14.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_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 reduction (task, *: j) schedule (dynamic, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-15.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-15.c
new file mode 100644
index 0000000..bdb0da6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-15.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483650|-2147483646), 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_dynamic_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 reduction (task, *: j) schedule (monotonic: dynamic, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-16.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-16.c
new file mode 100644
index 0000000..8de7006
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-16.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_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 reduction (task, *: j) schedule (nonmonotonic: dynamic, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-17.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-17.c
new file mode 100644
index 0000000..afa2024
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-17.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_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 reduction (task, *: j) schedule (guided)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-18.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-18.c
new file mode 100644
index 0000000..f63203f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-18.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_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 reduction (task, *: j) schedule (monotonic: guided)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-19.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-19.c
new file mode 100644
index 0000000..7d46422
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-19.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_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 reduction (task, *: j) schedule (nonmonotonic: guided)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-2.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-2.c
new file mode 100644
index 0000000..3a450a4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-2.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_runtime_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 reduction (task, *: j) schedule (monotonic: runtime)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-20.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-20.c
new file mode 100644
index 0000000..c948dbd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-20.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_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 reduction (task, *: j) schedule (guided, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-21.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-21.c
new file mode 100644
index 0000000..869b442
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-21.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483651|-2147483645), 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_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 reduction (task, *: j) schedule (monotonic: guided, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-22.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-22.c
new file mode 100644
index 0000000..9e627b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-22.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_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 reduction (task, *: j) schedule (nonmonotonic: guided, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-23.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-23.c
new file mode 100644
index 0000000..2ef4932
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-23.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j) schedule (auto)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-24.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-24.c
new file mode 100644
index 0000000..d32231d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-24.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j) schedule (monotonic: auto)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-25.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-25.c
new file mode 100644
index 0000000..891c04a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-25.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j) schedule (nonmonotonic: auto)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-26.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-26.c
new file mode 100644
index 0000000..f05b43d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-26.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 0, 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_maybe_nonmonotonic_runtime_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (runtime)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-27.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-27.c
new file mode 100644
index 0000000..0485a05
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-27.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_runtime_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (monotonic: runtime)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-28.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-28.c
new file mode 100644
index 0000000..025d350
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-28.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 4, 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_runtime_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (nonmonotonic: runtime)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-29.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-29.c
new file mode 100644
index 0000000..ff5f485
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-29.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-3.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-3.c
new file mode 100644
index 0000000..3cb4766
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-3.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 4, 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_runtime_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 reduction (task, *: j) schedule (nonmonotonic: runtime)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-30.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-30.c
new file mode 100644
index 0000000..7390fa7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-30.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (static)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-31.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-31.c
new file mode 100644
index 0000000..d00d9e9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-31.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (monotonic: static)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-32.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-32.c
new file mode 100644
index 0000000..5e210f8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-32.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (nonmonotonic: static)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-33.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-33.c
new file mode 100644
index 0000000..d39467e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-33.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (static, 2)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-34.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-34.c
new file mode 100644
index 0000000..f961887
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-34.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (monotonic: static, 2)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-35.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-35.c
new file mode 100644
index 0000000..4686e89
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-35.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (nonmonotonic: static, 2)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-36.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-36.c
new file mode 100644
index 0000000..9742d53
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-36.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 2, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_dynamic_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (dynamic)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-37.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-37.c
new file mode 100644
index 0000000..3164f5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-37.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_dynamic_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (monotonic: dynamic)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-38.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-38.c
new file mode 100644
index 0000000..3567748
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-38.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 2, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_dynamic_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (nonmonotonic: dynamic)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-39.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-39.c
new file mode 100644
index 0000000..b5996e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-39.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 2, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_dynamic_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (dynamic, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-4.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-4.c
new file mode 100644
index 0000000..6002cd5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-4.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-40.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-40.c
new file mode 100644
index 0000000..1f4e91c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-40.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483650|-2147483646), 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_dynamic_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (monotonic: dynamic, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-41.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-41.c
new file mode 100644
index 0000000..7739a85
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-41.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 2, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_dynamic_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (nonmonotonic: dynamic, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-42.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-42.c
new file mode 100644
index 0000000..06bf1a4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-42.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 3, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_guided_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (guided)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-43.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-43.c
new file mode 100644
index 0000000..b70ef90
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-43.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_guided_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (monotonic: guided)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-44.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-44.c
new file mode 100644
index 0000000..b4c2cbb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-44.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 3, 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_guided_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (nonmonotonic: guided)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-45.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-45.c
new file mode 100644
index 0000000..863eae6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-45.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 3, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_guided_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (guided, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-46.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-46.c
new file mode 100644
index 0000000..a7b808f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-46.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, (?:2147483651|-2147483645), 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_guided_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (monotonic: guided, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-47.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-47.c
new file mode 100644
index 0000000..042de73
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-47.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_start \[^\n\r]*, 3, 3, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_nonmonotonic_guided_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (nonmonotonic: guided, 3)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-48.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-48.c
new file mode 100644
index 0000000..bde978c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-48.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (auto)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-49.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-49.c
new file mode 100644
index 0000000..19e0926
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-49.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (monotonic: auto)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-5.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-5.c
new file mode 100644
index 0000000..351e25d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-5.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j) schedule (static)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-50.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-50.c
new file mode 100644
index 0000000..0b97336
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-50.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for reduction (task, *: j) schedule (nonmonotonic: auto)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-51.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-51.c
new file mode 100644
index 0000000..821da5d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-51.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]*, (?:2147483648|-2147483648), 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_runtime_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) schedule (runtime)
+ for (i = a; i < b; i += c)
+ {
+ bar (&j);
+ #pragma omp ordered
+ j++;
+ }
+}
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++;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-53.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-53.c
new file mode 100644
index 0000000..48baf6c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-53.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]*, (?:2147483650|-2147483646), 4, " 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_dynamic_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) schedule (dynamic, 4)
+ for (i = a; i < b; i += c)
+ {
+ bar (&j);
+ #pragma omp ordered
+ j++;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-54.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-54.c
new file mode 100644
index 0000000..a39248d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-54.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_ordered_start \[^\n\r]*, (?:2147483651|-2147483645), 6, " 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_ull_ordered_guided_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for ordered reduction (task, *: j) schedule (guided, 6)
+ for (i = a; i < b; i += c)
+ {
+ bar (&j);
+ #pragma omp ordered
+ j++;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-55.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-55.c
new file mode 100644
index 0000000..6b9a7ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-55.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_wait " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_runtime_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(1) reduction (task, *: j) schedule (runtime)
+ for (i = a; i < b; i += c)
+ {
+ bar (&j);
+ #pragma omp ordered depend(sink: i - 1)
+ j++;
+ #pragma omp ordered depend(source)
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-56.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-56.c
new file mode 100644
index 0000000..955c6d4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-56.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_doacross_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_doacross_ull_post " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_ull_wait " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for ordered(1) reduction (task, *: j)
+ for (i = a; i < b; i += c)
+ {
+ bar (&j);
+ #pragma omp ordered depend(sink: i - 1)
+ j++;
+ #pragma omp ordered depend(source)
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-57.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-57.c
new file mode 100644
index 0000000..9019886
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-57.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_doacross_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_ull_post " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_ull_wait " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ull_dynamic_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" } } */
+
+unsigned long long int j;
+void bar (unsigned long long int *);
+
+void
+foo (unsigned long long int a, unsigned long long int b, unsigned long long int c)
+{
+ unsigned long long int i;
+ #pragma omp parallel
+ #pragma omp for ordered(1) reduction (task, *: j) schedule (dynamic)
+ for (i = a; i < b; i += c)
+ {
+ bar (&j);
+ #pragma omp ordered depend(sink: i - 1)
+ j++;
+ #pragma omp ordered depend(source)
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-58.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-58.c
new file mode 100644
index 0000000..7907aba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-58.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_wait " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_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(1) reduction (task, *: j) schedule (guided)
+ for (i = a; i < b; i += c)
+ {
+ bar (&j);
+ #pragma omp ordered depend(sink: i - 1)
+ j++;
+ #pragma omp ordered depend(source)
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-6.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-6.c
new file mode 100644
index 0000000..63cde17
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-6.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j) schedule (monotonic: static)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-7.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-7.c
new file mode 100644
index 0000000..430dcd5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-7.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j) schedule (nonmonotonic: static)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-8.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-8.c
new file mode 100644
index 0000000..b4cc0df
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-8.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j) schedule (static, 2)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/workshare-reduction-9.c b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-9.c
new file mode 100644
index 0000000..91da2c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/workshare-reduction-9.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "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 reduction (task, *: j) schedule (monotonic: static, 2)
+ for (i = a; i < b; i += c)
+ {
+ j++;
+ bar (&j);
+ }
+}