]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add kernels for-index reuse testcase.
authorJulian Brown <julian@codesourcery.com>
Thu, 16 May 2019 12:47:16 +0000 (05:47 -0700)
committerThomas Schwinge <thomas@codesourcery.com>
Tue, 3 Mar 2020 11:17:44 +0000 (12:17 +0100)
libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-for-index-reuse-1.c: New
test.

(cherry picked from openacc-gcc-9-branch commit
3f86b73b7706bdf066b1af71dfc5d8eb461eaa05)

libgomp/ChangeLog.omp
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-for-index-reuse-1.c [new file with mode: 0644]

index ef5579bd38287f85954d961069153dfe8e0636a4..225b4b5d4541483bfa61ead4673ecaa5ab57c892 100644 (file)
@@ -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-05-16  Julian Brown  <julian@codesourcery.com>
 
        * target.c (gomp_map_vars_async): Initialise KEY and OFFSET fields in
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 (file)
index 0000000..dafe412
--- /dev/null
@@ -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;
+}