From 1a6e773639bd667b1536c12e3ea442d733b84456 Mon Sep 17 00:00:00 2001 From: vries Date: Wed, 4 Oct 2017 08:39:09 +0000 Subject: [PATCH] Fix openacc float reduction testcases 2017-10-04 Tom de Vries * testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c (main): Reduce sum of arr elements. Assert that hres is exactly representable in 32-bit floating point. * testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c (main): Reduce sum of arr elements. Assert that hres and hmres are exactly representable in 32-bit floating point. * testsuite/libgomp.oacc-c-c++-common/reduction-7.c (gwv_np_4): Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253398 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog | 10 ++++++++++ .../libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c | 3 ++- .../libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c | 5 ++++- libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-7.c | 5 ++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index c3471e8934d..6441453334d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,13 @@ +2017-10-04 Tom de Vries + + * testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c + (main): Reduce sum of arr elements. Assert that hres is exactly + representable in 32-bit floating point. + * testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c + (main): Reduce sum of arr elements. Assert that hres and hmres are + exactly representable in 32-bit floating point. + * testsuite/libgomp.oacc-c-c++-common/reduction-7.c (gwv_np_4): Same. + 2017-09-28 Tom de Vries * testsuite/libgomp.c++/for-12.C: Remove superfluous -fopenmp option diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c index 8d85fedc867..6369d7fbb33 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c @@ -11,7 +11,7 @@ main (int argc, char *argv[]) float res = 0, hres = 0; for (i = 0; i < 32768; i++) - arr[i] = i; + arr[i] = i % (32768 / 64); #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \ reduction(+:res) copy(res) @@ -36,6 +36,7 @@ main (int argc, char *argv[]) hres += arr[j * 1024 + (1023 - i)]; } + assert (hres <= 16777216); assert (res == hres); return 0; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c index 1904b4aa1e4..140c3226327 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c @@ -11,7 +11,7 @@ main (int argc, char *argv[]) float res = 0, mres = 0, hres = 0, hmres = 0; for (i = 0; i < 32768; i++) - arr[i] = i; + arr[i] = i % (32768 / 64); #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \ reduction(+:res) reduction(max:mres) copy(res, mres) @@ -48,7 +48,10 @@ main (int argc, char *argv[]) hmres = arr[j * 1024 + (1023 - i)]; } + assert (hres <= 16777216); assert (res == hres); + + assert (hmres <= 16777216); assert (mres == hmres); return 0; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-7.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-7.c index cc3cd07301a..c4940b8ad9d 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-7.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-7.c @@ -183,7 +183,7 @@ void gwv_np_4() float res = 0, mres = 0, hres = 0, hmres = 0; for (i = 0; i < 32768; i++) - arr[i] = i; + arr[i] = i % (32768 / 64); #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) { @@ -219,7 +219,10 @@ void gwv_np_4() hmres = arr[j * 1024 + (1023 - i)]; } + assert (hres <= 16777216); assert (res == hres); + + assert (hmres <= 16777216); assert (mres == hmres); } -- 2.11.4.GIT