aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorcesar <cesar@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-29 17:37:55 +0000
committercesar <cesar@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-29 17:37:55 +0000
commit0af8d1f3e0b58622700b2ca8a96781c5edbc6bf3 (patch)
tree04489cb511f8907bb5f09d00c44165047e467a3c /libgomp
parent5ae6e48ab6a9792f07477572d361307513b7adaf (diff)
gcc/c-family/
PR middle-end/70626 * c-common.h (c_oacc_split_loop_clauses): Add boolean argument. * c-omp.c (c_oacc_split_loop_clauses): Use it to duplicate reduction clauses in acc parallel loops. gcc/c/ PR middle-end/70626 * c-parser.c (c_parser_oacc_loop): Don't augment mask with OACC_LOOP_CLAUSE_MASK. (c_parser_oacc_kernels_parallel): Update call to c_oacc_split_loop_clauses. gcc/cp/ PR middle-end/70626 * parser.c (cp_parser_oacc_loop): Don't augment mask with OACC_LOOP_CLAUSE_MASK. (cp_parser_oacc_kernels_parallel): Update call to c_oacc_split_loop_clauses. gcc/fortran/ PR middle-end/70626 * trans-openmp.c (gfc_trans_oacc_combined_directive): Duplicate the reduction clause in both parallel and loop directives. gcc/testsuite/ PR middle-end/70626 * c-c++-common/goacc/combined-reduction.c: New test. * gfortran.dg/goacc/reduction-2.f95: Add check for kernels reductions. libgomp/ PR middle-end/70626 * testsuite/libgomp.oacc-c++/template-reduction.C: Adjust test. * testsuite/libgomp.oacc-c-c++-common/combined-reduction.c: New test. * testsuite/libgomp.oacc-fortran/combined-reduction.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@235650 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog7
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/template-reduction.C8
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/combined-reduction.c23
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/combined-reduction.f9019
4 files changed, 53 insertions, 4 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 0db2667a508..082d6b80574 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,10 @@
+2016-04-29 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR middle-end/70626
+ * testsuite/libgomp.oacc-c++/template-reduction.C: Adjust test.
+ * testsuite/libgomp.oacc-c-c++-common/combined-reduction.c: New test.
+ * testsuite/libgomp.oacc-fortran/combined-reduction.f90: New test.
+
2016-04-27 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/libgomp/testsuite/libgomp.oacc-c++/template-reduction.C b/libgomp/testsuite/libgomp.oacc-c++/template-reduction.C
index fb5924c9b51..6c85fba7a92 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/template-reduction.C
+++ b/libgomp/testsuite/libgomp.oacc-c++/template-reduction.C
@@ -7,7 +7,7 @@ sum (T array[])
{
T s = 0;
-#pragma acc parallel loop num_gangs (10) gang reduction (+:s) copy (s, array[0:n])
+#pragma acc parallel loop num_gangs (10) gang reduction (+:s) copy (array[0:n])
for (int i = 0; i < n; i++)
s += array[i];
@@ -25,7 +25,7 @@ sum ()
for (int i = 0; i < n; i++)
array[i] = i+1;
-#pragma acc parallel loop num_gangs (10) gang reduction (+:s) copy (s)
+#pragma acc parallel loop num_gangs (10) gang reduction (+:s)
for (int i = 0; i < n; i++)
s += array[i];
@@ -43,7 +43,7 @@ async_sum (T array[])
for (int i = 0; i < n; i++)
array[i] = i+1;
-#pragma acc parallel loop num_gangs (10) gang reduction (+:s) present (array[0:n]) copy (s) async wait (1)
+#pragma acc parallel loop num_gangs (10) gang reduction (+:s) present (array[0:n]) async wait (1)
for (int i = 0; i < n; i++)
s += array[i];
@@ -59,7 +59,7 @@ async_sum (int c)
{
T s = 0;
-#pragma acc parallel loop num_gangs (10) gang reduction (+:s) copy(s) firstprivate (c) async wait (1)
+#pragma acc parallel loop num_gangs (10) gang reduction (+:s) firstprivate (c) async wait (1)
for (int i = 0; i < n; i++)
s += i+c;
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/combined-reduction.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/combined-reduction.c
new file mode 100644
index 00000000000..b5ce4ed7b3d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/combined-reduction.c
@@ -0,0 +1,23 @@
+/* Test a combined acc parallel loop reduction. */
+
+/* { dg-do run } */
+
+#include <assert.h>
+
+int
+main ()
+{
+ int i, v1 = 0, v2 = 0, n = 100;
+
+#pragma acc parallel loop reduction(+:v1, v2)
+ for (i = 0; i < n; i++)
+ {
+ v1++;
+ v2++;
+ }
+
+ assert (v1 == n);
+ assert (v2 == n);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/combined-reduction.f90 b/libgomp/testsuite/libgomp.oacc-fortran/combined-reduction.f90
new file mode 100644
index 00000000000..d3a61b57f13
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/combined-reduction.f90
@@ -0,0 +1,19 @@
+! Test a combined acc parallel loop reduction.
+
+! { dg-do run }
+
+program test
+ implicit none
+ integer i, n, var
+
+ n = 100
+ var = 0
+
+ !$acc parallel loop reduction(+:var)
+ do i = 1, 100
+ var = var + 1
+ end do
+ !$acc end parallel loop
+
+ if (var .ne. n) call abort
+end program test