aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2015-11-12 13:51:13 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2015-11-12 13:51:13 +0000
commitfffeedeb5aefd79d90fd9a2b331fe095965ffbd2 (patch)
tree86db058605686d31d1e68578774a9ac54758d69e /libgomp
parent8339a33e54150c0d643593c9358aa35f4c3ffd5e (diff)
downloadgcc-fffeedeb5aefd79d90fd9a2b331fe095965ffbd2.zip
gcc-fffeedeb5aefd79d90fd9a2b331fe095965ffbd2.tar.gz
gcc-fffeedeb5aefd79d90fd9a2b331fe095965ffbd2.tar.bz2
gimplify.c (oacc_default_clause): New.
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. Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> From-SVN: r230256
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog4
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/default-1.c87
2 files changed, 91 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 406c572..b4f708e 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,7 @@
+2015-11-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * testsuite/libgomp.oacc-c-c++-common/default-1.c: New.
+
2015-11-1 Nathan Sidwell <nathan@codesourcery.com>
* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: New.
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 0000000..1ac0b95
--- /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;
+}