--- /dev/null
+/* Test cases of nested 'reduction' clauses expected to compile cleanly. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-1-kernels.f90'. */
+
+void acc_kernels (void)
+{
+ int i, j, k, sum, diff;
+
+ /* FIXME: These tests are not meaningful yet because reductions in
+ kernels regions are not supported yet. */
+ #pragma acc kernels
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+ }
+}
--- /dev/null
+/* Test cases of nested 'reduction' clauses expected to compile cleanly. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-1-parallel.f90'. */
+
+void acc_parallel (void)
+{
+ int i, j, k, sum, diff;
+
+ #pragma acc parallel
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but using a combined parallel loop construct. */
+
+void acc_parallel_loop (void)
+{
+ int i, j, k, l, sum, diff;
+
+ #pragma acc parallel loop
+ for (int h = 0; h < 10; ++h)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff) // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but now the outermost reduction clause is on
+ the parallel region, not the outermost loop. */
+
+void acc_parallel_reduction (void)
+{
+ int i, j, k, sum, diff;
+
+ #pragma acc parallel reduction(+:sum)
+ {
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ for (i = 0; i < 10; i++)
+ #pragma acc loop
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but using a combined parallel loop construct, and
+ the outermost reduction clause is on that one, not the outermost loop. */
+void acc_parallel_loop_reduction (void)
+{
+ int i, j, k, sum, diff;
+
+ #pragma acc parallel loop reduction(+:sum)
+ for (int h = 0; h < 10; ++h)
+ {
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ for (i = 0; i < 10; i++)
+ #pragma acc loop
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff) // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff) // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "insufficient partitioning available to parallelize loop" }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
--- /dev/null
+/* Test cases of nested 'reduction' clauses expected to compile cleanly. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-1-routine.f90'. */
+
+#pragma acc routine gang
+void acc_routine (void)
+{
+ int i, j, k, sum, diff;
+
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
--- /dev/null
+/* Test erroneous cases of nested 'reduction' clauses. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-2-kernels.f90'. */
+
+void acc_kernels (void)
+{
+ int i, j, k, sum, diff;
+
+ /* FIXME: No diagnostics are produced for these loops because reductions
+ in kernels regions are not supported yet. */
+ #pragma acc kernels
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:diff)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+ }
+}
--- /dev/null
+/* Test erroneous cases of nested 'reduction' clauses. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-2-parallel.f90'. */
+
+void acc_parallel (void)
+{
+ int i, j, k, l, sum, diff;
+
+ #pragma acc parallel
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but using a combined parallel loop construct. */
+
+void acc_parallel_loop (void)
+{
+ int i, j, k, l, sum, diff;
+
+ #pragma acc parallel loop
+ for (int h = 0; h < 10; ++h)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but now the outermost reduction clause is on
+ the parallel region, not the outermost loop. */
+void acc_parallel_reduction (void)
+{
+ int i, j, k, l, sum, diff;
+
+ #pragma acc parallel reduction(+:sum)
+ {
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." })
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but using a combined parallel loop construct, and
+ the outermost reduction clause is on that one, not the outermost loop. */
+void acc_parallel_loop_reduction (void)
+{
+ int i, j, k, l, sum, diff;
+
+ #pragma acc parallel loop reduction(+:sum)
+ for (int h = 0; h < 10; ++h)
+ {
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." })
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
--- /dev/null
+/* Test erroneous cases of nested 'reduction' clauses. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-2-routine.f90'. */
+
+#pragma acc routine gang
+void acc_routine (void)
+{
+ int i, j, k, l, sum, diff;
+
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." })
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+++ /dev/null
-/* Test erroneous cases of nested reduction loops. */
-
-void acc_parallel (void)
-{
- int i, j, k, l, sum, diff;
-
- #pragma acc parallel
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-/* The same tests as above, but using a combined parallel loop construct. */
-
-void acc_parallel_loop (void)
-{
- int i, j, k, l, sum, diff;
-
- #pragma acc parallel loop
- for (int h = 0; h < 10; ++h)
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-/* The same tests as above, but now the outermost reduction clause is on
- the parallel region, not the outermost loop. */
-void acc_parallel_reduction (void)
-{
- int i, j, k, l, sum, diff;
-
- #pragma acc parallel reduction(+:sum)
- {
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." })
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-/* The same tests as above, but using a combined parallel loop construct, and
- the outermost reduction clause is on that one, not the outermost loop. */
-void acc_parallel_loop_reduction (void)
-{
- int i, j, k, l, sum, diff;
-
- #pragma acc parallel loop reduction(+:sum)
- for (int h = 0; h < 10; ++h)
- {
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." })
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-/* The same tests as above, but inside a routine construct. */
-#pragma acc routine gang
-void acc_routine (void)
-{
- int i, j, k, l, sum, diff;
-
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." })
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-void acc_kernels (void)
-{
- int i, j, k, sum, diff;
-
- /* FIXME: No diagnostics are produced for these loops because reductions
- in kernels regions are not supported yet. */
- #pragma acc kernels
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:diff)
- for (j = 0; j < 10; j++)
- #pragma acc loop
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
- }
-}
+++ /dev/null
-/* Test cases of nested reduction loops that should compile cleanly. */
-
-void acc_parallel (void)
-{
- int i, j, k, sum, diff;
-
- #pragma acc parallel
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop collapse(2) reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-/* The same tests as above, but using a combined parallel loop construct. */
-
-void acc_parallel_loop (void)
-{
- int i, j, k, l, sum, diff;
-
- #pragma acc parallel loop
- for (int h = 0; h < 10; ++h)
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop collapse(2) reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff) // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-/* The same tests as above, but now the outermost reduction clause is on
- the parallel region, not the outermost loop. */
-
-void acc_parallel_reduction (void)
-{
- int i, j, k, sum, diff;
-
- #pragma acc parallel reduction(+:sum)
- {
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- for (i = 0; i < 10; i++)
- #pragma acc loop
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-/* The same tests as above, but using a combined parallel loop construct, and
- the outermost reduction clause is on that one, not the outermost loop. */
-void acc_parallel_loop_reduction (void)
-{
- int i, j, k, sum, diff;
-
- #pragma acc parallel loop reduction(+:sum)
- for (int h = 0; h < 10; ++h)
- {
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- for (i = 0; i < 10; i++)
- #pragma acc loop
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff) // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff) // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop // { dg-warning "insufficient partitioning available to parallelize loop" }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-/* The same tests as above, but inside a routine construct. */
-#pragma acc routine gang
-void acc_routine (void)
-{
- int i, j, k, sum, diff;
-
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop collapse(2) reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-void acc_kernels (void)
-{
- int i, j, k, sum, diff;
-
- /* FIXME: These tests are not meaningful yet because reductions in
- kernels regions are not supported yet. */
- #pragma acc kernels
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
- }
-}
--- /dev/null
+! Test cases of nested 'reduction' clauses expected to compile cleanly.
+
+! See also 'c-c++-common/goacc/nested-reductions-1-kernels.c'.
+
+subroutine acc_kernels ()
+ implicit none (type, external)
+ integer :: i, j, k, sum, diff
+
+ ! FIXME: These tests are not meaningful yet because reductions in
+ ! kernels regions are not supported yet.
+ !$acc kernels
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc end kernels
+end subroutine acc_kernels
--- /dev/null
+! Test cases of nested 'reduction' clauses expected to compile cleanly.
+
+! See also 'c-c++-common/goacc/nested-reductions-1-parallel.c'.
+
+subroutine acc_parallel ()
+ implicit none (type, external)
+ integer :: i, j, k, sum, diff
+
+ !$acc parallel
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop collapse(2) reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff)
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ !$acc end parallel
+end subroutine acc_parallel
+
+! The same tests as above, but using a combined parallel loop construct.
+
+subroutine acc_parallel_loop ()
+ implicit none (type, external)
+ integer :: h, i, j, k, l, sum, diff
+
+ !$acc parallel loop
+ do h = 1, 10
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop collapse(2) reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff) ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ end do
+end subroutine acc_parallel_loop
+
+! The same tests as above, but now the outermost reduction clause is on
+! the parallel region, not the outermost loop. */
+
+subroutine acc_parallel_reduction ()
+ implicit none (type, external)
+ integer :: i, j, k, sum, diff
+
+ !$acc parallel reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ do i = 1, 10
+ !$acc loop
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff)
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff)
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ !$acc end parallel
+end subroutine acc_parallel_reduction
+
+! The same tests as above, but using a combined parallel loop construct, and
+! the outermost reduction clause is on that one, not the outermost loop. */
+subroutine acc_parallel_loop_reduction ()
+ implicit none (type, external)
+ integer :: h, i, j, k, sum, diff
+
+ !$acc parallel loop reduction(+:sum)
+ do h = 1, 10
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ do i = 1, 10
+ !$acc loop
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff) ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff) ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "insufficient partitioning available to parallelize loop" }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ end do
+end subroutine acc_parallel_loop_reduction
--- /dev/null
+! Test cases of nested 'reduction' clauses expected to compile cleanly.
+
+! See also 'c-c++-common/goacc/nested-reductions-1-routine.c'.
+
+subroutine acc_routine ()
+ implicit none (type, external)
+ !$acc routine gang
+
+ integer :: i, j, k, sum, diff
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop collapse(2) reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff)
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+end subroutine acc_routine
--- /dev/null
+! Test erroneous cases of nested 'reduction' clauses.
+
+! See also 'c-c++-common/goacc/nested-reductions-2-kernels.c'.
+
+subroutine acc_kernels ()
+ integer :: i, j, k, sum, diff
+
+ ! FIXME: No diagnostics are produced for these loops because reductions
+ ! in kernels regions are not supported yet.
+ !$acc kernels
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:diff)
+ do j = 1, 10
+ !$acc loop
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ !$acc end kernels
+end subroutine acc_kernels
--- /dev/null
+! Test erroneous cases of nested 'reduction' clauses.
+
+! See also 'c-c++-common/goacc/nested-reductions-2-parallel.c'.
+
+subroutine acc_parallel ()
+ implicit none (type, external)
+ integer :: i, j, k, l, sum, diff
+
+ !$acc parallel
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(-:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ !$acc end parallel
+end subroutine acc_parallel
+
+! The same tests as above, but using a combined parallel loop construct.
+
+subroutine acc_parallel_loop ()
+ implicit none (type, external)
+ integer :: h, i, j, k, l, sum, diff
+
+ !$acc parallel loop
+ do h = 1, 10
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(-:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ end do
+end subroutine acc_parallel_loop
+
+! The same tests as above, but now the outermost reduction clause is on
+! the parallel region, not the outermost loop.
+
+subroutine acc_parallel_reduction ()
+ implicit none (type, external)
+ integer :: i, j, k, l, sum, diff
+
+ !$acc parallel reduction(+:sum)
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(-:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ !$acc end parallel
+end subroutine acc_parallel_reduction
+
+! The same tests as above, but using a combined parallel loop construct, and
+! the outermost reduction clause is on that one, not the outermost loop. */
+subroutine acc_parallel_loop_reduction ()
+ implicit none (type, external)
+ integer :: h, i, j, k, l, sum, diff
+
+ !$acc parallel loop reduction(+:sum)
+ do h = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(-:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ end do
+end subroutine acc_parallel_loop_reduction
--- /dev/null
+! Test erroneous cases of nested 'reduction' clauses.
+
+! See also 'c-c++-common/goacc/nested-reductions-2-routine.c'.
+
+subroutine acc_routine ()
+ implicit none (type, external)
+ !$acc routine gang
+ integer :: i, j, k, l, sum, diff
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(-:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+end subroutine acc_routine
+++ /dev/null
-! Test erroneous cases of nested reduction loops.
-
-subroutine acc_parallel ()
- implicit none (type, external)
- integer :: i, j, k, l, sum, diff
-
- !$acc parallel
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(-:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
- !$acc end parallel
-end subroutine acc_parallel
-
-! The same tests as above, but using a combined parallel loop construct.
-
-subroutine acc_parallel_loop ()
- implicit none (type, external)
- integer :: h, i, j, k, l, sum, diff
-
- !$acc parallel loop
- do h = 1, 10
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(-:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
- end do
-end subroutine acc_parallel_loop
-
-! The same tests as above, but now the outermost reduction clause is on
-! the parallel region, not the outermost loop.
-
-subroutine acc_parallel_reduction ()
- implicit none (type, external)
- integer :: i, j, k, l, sum, diff
-
- !$acc parallel reduction(+:sum)
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(-:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
- !$acc end parallel
-end subroutine acc_parallel_reduction
-
-! The same tests as above, but using a combined parallel loop construct, and
-! the outermost reduction clause is on that one, not the outermost loop. */
-subroutine acc_parallel_loop_reduction ()
- implicit none (type, external)
- integer :: h, i, j, k, l, sum, diff
-
- !$acc parallel loop reduction(+:sum)
- do h = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(-:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do i = 1, 10
- !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
- end do
-end subroutine acc_parallel_loop_reduction
-
-! The same tests as above, but inside a routine construct.
-subroutine acc_routine ()
- implicit none (type, external)
- !$acc routine gang
- integer :: i, j, k, l, sum, diff
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(-:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
-end subroutine acc_routine
-
-subroutine acc_kernels ()
- integer :: i, j, k, sum, diff
-
- ! FIXME: No diagnostics are produced for these loops because reductions
- ! in kernels regions are not supported yet.
- !$acc kernels
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:diff)
- do j = 1, 10
- !$acc loop
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
- !$acc end kernels
-end subroutine acc_kernels
+++ /dev/null
-! Test cases of nested reduction loops that should compile cleanly.
-
-subroutine acc_parallel ()
- implicit none (type, external)
- integer :: i, j, k, sum, diff
-
- !$acc parallel
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop collapse(2) reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop collapse(2) reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(-:diff)
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
- !$acc end parallel
-end subroutine acc_parallel
-
-! The same tests as above, but using a combined parallel loop construct.
-
-subroutine acc_parallel_loop ()
- implicit none (type, external)
- integer :: h, i, j, k, l, sum, diff
-
- !$acc parallel loop
- do h = 1, 10
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop collapse(2) reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop collapse(2) reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(-:diff) ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
- end do
-end subroutine acc_parallel_loop
-
-! The same tests as above, but now the outermost reduction clause is on
-! the parallel region, not the outermost loop. */
-
-subroutine acc_parallel_reduction ()
- implicit none (type, external)
- integer :: i, j, k, sum, diff
-
- !$acc parallel reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- do i = 1, 10
- !$acc loop
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- do i = 1, 10
- do j = 1, 10
- !$acc loop
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(-:diff)
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(-:diff)
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
- !$acc end parallel
-end subroutine acc_parallel_reduction
-
-! The same tests as above, but using a combined parallel loop construct, and
-! the outermost reduction clause is on that one, not the outermost loop. */
-subroutine acc_parallel_loop_reduction ()
- implicit none (type, external)
- integer :: h, i, j, k, sum, diff
-
- !$acc parallel loop reduction(+:sum)
- do h = 1, 10
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- do i = 1, 10
- !$acc loop
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- do i = 1, 10
- do j = 1, 10
- !$acc loop
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(-:diff) ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(-:diff) ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop ! { dg-warning "insufficient partitioning available to parallelize loop" }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
- end do
-end subroutine acc_parallel_loop_reduction
-
-! The same tests as above, but inside a routine construct.
-subroutine acc_routine ()
- implicit none (type, external)
- !$acc routine gang
-
- integer :: i, j, k, sum, diff
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop collapse(2) reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop collapse(2) reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(-:diff)
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
-end subroutine acc_routine
-
-subroutine acc_kernels ()
- implicit none (type, external)
- integer :: i, j, k, sum, diff
-
- ! FIXME: These tests are not meaningful yet because reductions in
- ! kernels regions are not supported yet.
- !$acc kernels
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc end kernels
-end subroutine acc_kernels