public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4, committed] Add goacc/kernels-acc-on-device.c
@ 2015-10-10 10:49 Tom de Vries
  2015-10-12 10:49 ` Thomas Schwinge
  0 siblings, 1 reply; 5+ messages in thread
From: Tom de Vries @ 2015-10-10 10:49 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]

Hi,

this patch adds a new kernels region test-case.

Committed to gomp-4_0-branch as trivial.

Thanks,
- Tom

[-- Attachment #2: 0001-Add-goacc-kernels-acc-on-device.c.patch --]
[-- Type: text/x-patch, Size: 1203 bytes --]

Add goacc/kernels-acc-on-device.c

2015-10-10  Tom de Vries  <tom@codesourcery.com>

	* c-c++-common/goacc/kernels-acc-on-device.c: New test.
---
 .../c-c++-common/goacc/kernels-acc-on-device.c     | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c

diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c b/gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c
new file mode 100644
index 0000000..e9e93c7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c
@@ -0,0 +1,39 @@
+/* { dg-additional-options "-O2" } */
+
+#include <openacc.h>
+
+#define N 32
+
+void
+foo (float *a, float *b)
+{
+  float exp;
+  int i;
+  int n;
+
+#pragma acc kernels copyin(a[0:N]) copyout(b[0:N])
+  {
+    int ii;
+
+    for (ii = 0; ii < N; ii++)
+      {
+	if (acc_on_device (acc_device_host))
+	  b[ii] = a[ii] + 1;
+	else
+	  b[ii] = a[ii];
+      }
+  }
+
+#pragma acc kernels copyin(a[0:N]) copyout(b[0:N])
+  {
+    int ii;
+
+    for (ii = 0; ii < N; ii++)
+      {
+	if (acc_on_device (acc_device_host))
+	  b[ii] = a[ii] + 2;
+	else
+	  b[ii] = a[ii];
+      }
+  }
+}
-- 
1.9.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-30  8:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-10 10:49 [gomp4, committed] Add goacc/kernels-acc-on-device.c Tom de Vries
2015-10-12 10:49 ` Thomas Schwinge
2015-10-12 12:53   ` Tom de Vries
2015-10-13 15:50     ` Tom de Vries
2015-10-30  8:32       ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).