diff options
Diffstat (limited to 'libgomp')
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 |