diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-12 13:51:13 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-12 13:51:13 +0000 |
commit | 3cf4960ab366331d770ffe255e8876c8afac213f (patch) | |
tree | 86db058605686d31d1e68578774a9ac54758d69e /libgomp/testsuite | |
parent | 0ebb8b23951bf341974f9c5925c031e5c3eb176b (diff) | |
download | gcc-3cf4960ab366331d770ffe255e8876c8afac213f.tar.gz |
gcc/
* gimplify.c (oacc_default_clause): New.
(omp_notice_variable): Call it.
gcc/testsuite/
* c-c++-common/goacc/data-default-1.c: New.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/default-1.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230256 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/testsuite')
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-c-c++-common/default-1.c | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/default-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/default-1.c new file mode 100644 index 00000000000..1ac0b9587b9 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/default-1.c @@ -0,0 +1,87 @@ +/* { dg-do run } */ + +#include <openacc.h> + +int test_parallel () +{ + int ok = 1; + int val = 2; + int ary[32]; + int ondev = 0; + + for (int i = 0; i < 32; i++) + ary[i] = ~0; + + /* val defaults to firstprivate, ary defaults to copy. */ +#pragma acc parallel num_gangs (32) copy (ok) copy(ondev) + { + ondev = acc_on_device (acc_device_not_host); +#pragma acc loop gang(static:1) + for (unsigned i = 0; i < 32; i++) + { + if (val != 2) + ok = 0; + val += i; + ary[i] = val; + } + } + + if (ondev) + { + if (!ok) + return 1; + if (val != 2) + return 1; + + for (int i = 0; i < 32; i++) + if (ary[i] != 2 + i) + return 1; + } + + return 0; +} + +int test_kernels () +{ + int val = 2; + int ary[32]; + int ondev = 0; + + for (int i = 0; i < 32; i++) + ary[i] = ~0; + + /* val defaults to copy, ary defaults to copy. */ +#pragma acc kernels copy(ondev) + { + ondev = acc_on_device (acc_device_not_host); +#pragma acc loop + for (unsigned i = 0; i < 32; i++) + { + ary[i] = val; + val++; + } + } + + if (ondev) + { + if (val != 2 + 32) + return 1; + + for (int i = 0; i < 32; i++) + if (ary[i] != 2 + i) + return 1; + } + + return 0; +} + +int main () +{ + if (test_parallel ()) + return 1; + + if (test_kernels ()) + return 1; + + return 0; +} |