]> 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)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 21 Jun 2022 13:11:14 +0000 (14:11 +0100)
libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-for-index-reuse-1.c: New
test.

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

index 9da1249de1bbf5cb62660a48afb149023fdedfa7..4575fbe6c53d75757588c85f3a3edb4de5e5e5c6 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-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 (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;
+}