aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2019-12-09 12:40:08 +0100
committerThomas Schwinge <tschwinge@gcc.gnu.org>2019-12-09 12:40:08 +0100
commit1e1fb715cda5ddbc208b32ac0d3fe9e1e4a4f8f9 (patch)
tree5a66d2b261d16c401c5142d721155cdb76ae0068
parentb5859e400219c891b81e0788e7e58422706e4a49 (diff)
downloadgcc-1e1fb715cda5ddbc208b32ac0d3fe9e1e4a4f8f9.zip
gcc-1e1fb715cda5ddbc208b32ac0d3fe9e1e4a4f8f9.tar.gz
gcc-1e1fb715cda5ddbc208b32ac0d3fe9e1e4a4f8f9.tar.bz2
Add 'libgomp.oacc-c-c++-common/host_data-6.c'
libgomp/ * testsuite/libgomp.oacc-c-c++-common/host_data-6.c: New file. From-SVN: r279119
-rw-r--r--libgomp/ChangeLog2
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-6.c47
2 files changed, 49 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index c5541bc..6ef2f24 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,7 @@
2019-12-09 Thomas Schwinge <thomas@codesourcery.com>
+ * testsuite/libgomp.oacc-c-c++-common/host_data-6.c: New file.
+
* target.c (gomp_exit_data): Use 'gomp_remove_var'.
2019-12-09 Tobias Burnus <tobias@codesourcery.com>
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-6.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-6.c
new file mode 100644
index 0000000..1cda442
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-6.c
@@ -0,0 +1,47 @@
+/* Call 'acc_memcpy_from_device' inside '#pragma acc host_data'. */
+
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <openacc.h>
+
+int
+main ()
+{
+ const int SIZE = 318;
+ const int c0 = 22;
+ const int c1 = 112;
+
+ char *h = (char *) malloc (SIZE);
+
+ memset (h, c0, SIZE);
+
+#pragma acc data create (h[0:SIZE - 44])
+ {
+#pragma acc update device (h[0:SIZE - 44])
+
+ memset (h, c1, 67);
+
+ void *d = h;
+#pragma acc host_data use_device (d)
+ {
+ acc_memcpy_from_device (h, d, 12);
+ }
+ }
+
+ for (int i = 0; i < SIZE; ++i)
+ {
+ if (i < 12)
+ assert (h[i] == c0);
+ else if (i < 67)
+ assert (h[i] == c1);
+ else
+ assert (h[i] == c0);
+ }
+
+ free (h);
+
+ return 0;
+}