diff options
author | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-26 19:42:31 +0000 |
---|---|---|
committer | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-26 19:42:31 +0000 |
commit | bb7032879cbc9348a3f099c0c9a0c419c28de76d (patch) | |
tree | 0d163e1de5fc6350c6dab5b79a0e80159fad844a | |
parent | 9b71efb93dc5ab518d44e9afa6ca5ba055f68584 (diff) | |
download | gcc-bb7032879cbc9348a3f099c0c9a0c419c28de76d.tar.gz |
[hsa,testsuite] Introduce offload_device_shared_as effective target
2016-02-26 Keith McDaniel <k.allen.mcdaniel@gmail.com>
Martin Jambor <mjambor@suse.cz>
* testsuite/lib/libgomp.exp
(check_effective_target_offload_device_shared_as): New proc.
* testsuite/libgomp.c++/declare_target-1.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233757 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libgomp/ChangeLog | 7 | ||||
-rw-r--r-- | libgomp/testsuite/lib/libgomp.exp | 13 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/declare_target-1.C | 38 |
3 files changed, 58 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 3cf28601f0d..e96f1495fc2 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,10 @@ +2016-02-26 Keith McDaniel <k.allen.mcdaniel@gmail.com> + Martin Jambor <mjambor@suse.cz> + + * testsuite/lib/libgomp.exp + (check_effective_target_offload_device_shared_as): New proc. + * testsuite/libgomp.c++/declare_target-1.C: New test. + 2016-02-25 Ilya Verbin <ilya.verbin@intel.com> PR driver/68463 diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index a4c9d834e46..154a4476954 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -343,6 +343,19 @@ proc check_effective_target_offload_device_nonshared_as { } { } } ] } + +# Return 1 if offload device is available and it has shared address space. +proc check_effective_target_offload_device_shared_as { } { + return [check_runtime_nocache offload_device_shared_as { + int main () + { + int x = 10; + #pragma omp target map(to: x) + x++; + return x == 10; + } + } ] +} # Return 1 if at least one nvidia board is present. diff --git a/libgomp/testsuite/libgomp.c++/declare_target-1.C b/libgomp/testsuite/libgomp.c++/declare_target-1.C new file mode 100644 index 00000000000..4394bb1405d --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/declare_target-1.C @@ -0,0 +1,38 @@ +// { dg-do run } +// { dg-require-effective-target offload_device_shared_as } + +#include <stdlib.h> + +struct typeX +{ + int a; +}; + +class typeY +{ +public: + int foo () { return a^0x01; } + int a; +}; + +#pragma omp declare target +struct typeX varX; +class typeY varY; +#pragma omp end declare target + +int main () +{ + varX.a = 0; + varY.a = 0; + + #pragma omp target + { + varX.a = 100; + varY.a = 100; + } + + if (varX.a != 100 || varY.a != 100) + abort (); + + return 0; +} |