public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: "gcc-patches@gnu.org" <gcc-patches@gnu.org>
Subject: [gomp4, committed] Add goacc/kernels-acc-on-device.c
Date: Sat, 10 Oct 2015 10:49:00 -0000	[thread overview]
Message-ID: <5618ED1D.60906@mentor.com> (raw)

[-- 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


             reply	other threads:[~2015-10-10 10:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-10 10:49 Tom de Vries [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5618ED1D.60906@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).