public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-12] Add kernels for-index reuse testcase.
@ 2022-06-29 14:35 Kwok Yeung
  0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2022-06-29 14:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:47aa908ff9362bcc43f0560cedace9a42421a8bf

commit 47aa908ff9362bcc43f0560cedace9a42421a8bf
Author: Julian Brown <julian@codesourcery.com>
Date:   Thu May 16 05:47:16 2019 -0700

    Add kernels for-index reuse testcase.
    
            libgomp/
            * testsuite/libgomp.oacc-c-c++-common/kernels-for-index-reuse-1.c: New
            test.

Diff:
---
 libgomp/ChangeLog.omp                              |  5 +++
 .../kernels-for-index-reuse-1.c                    | 36 ++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 9da1249de1b..4575fbe6c53 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,8 @@
+2019-05-16  Julian Brown  <julian@codesourcery.com>
+
+	* testsuite/libgomp.oacc-c-c++-common/kernels-for-index-reuse-1.c: New
+	test.
+
 2019-01-09  Julian Brown  <julian@codesourcery.com>
 
 	* libgomp.texi: Update mentions of OpenACC version to 2.6.  Update
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-for-index-reuse-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-for-index-reuse-1.c
new file mode 100644
index 00000000000..dafe41298d7
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-for-index-reuse-1.c
@@ -0,0 +1,36 @@
+/* { dg-xfail-run-if "unhandled case" { *-*-* } } */
+
+/* Test reuse of loop index variables in kernels region.  */
+
+#include <assert.h>
+
+#define SIZE 16384
+
+int
+main (int argc, char* argv[])
+{
+  float arr[SIZE], arr_o[SIZE];
+  int i, o;
+
+  for (i = 0; i < SIZE; i++)
+    arr[i] = i;
+
+  i = 15;
+  #pragma acc kernels
+  {
+    i *= 30;
+    o = i;
+
+    #pragma acc loop independent
+    for (i = 0; i < SIZE; i++)
+      arr_o[i] = arr[i] * 2;
+  }
+
+  assert (i == SIZE);
+  assert (o == 450);
+
+  for (i = 0; i < SIZE; i++)
+    assert (arr_o[i] == arr[i] * 2);
+
+  return 0;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-29 14:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 14:35 [gcc/devel/omp/gcc-12] Add kernels for-index reuse testcase Kwok Yeung

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).