aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorCesar Philippidis <cesar@codesourcery.com>2016-04-29 10:42:04 -0700
committerCesar Philippidis <cesar@gcc.gnu.org>2016-04-29 10:42:04 -0700
commite7ff0319f3736617c70742d8233d73faad523aa3 (patch)
treee916d372dc0f2cd85d00c0e3d0572f145a5da73c /libgomp
parente49aacaf3083a99dc266209ed91183e91b11ffad (diff)
downloadgcc-e7ff0319f3736617c70742d8233d73faad523aa3.zip
gcc-e7ff0319f3736617c70742d8233d73faad523aa3.tar.gz
gcc-e7ff0319f3736617c70742d8233d73faad523aa3.tar.bz2
re PR middle-end/70626 (bogus results in 'acc parallel loop' reductions)
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. From-SVN: r235651
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 9dfc7f3..351c239 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-21 Alexander Monakov <amonakov@ispras.ru>
* plugin/plugin-nvptx.c (map_fini): Make cuMemFreeHost error
diff --git a/libgomp/testsuite/libgomp.oacc-c++/template-reduction.C b/libgomp/testsuite/libgomp.oacc-c++/template-reduction.C
index fb5924c..6c85fba 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 0000000..b5ce4ed
--- /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 0000000..d3a61b5
--- /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