target-supports.exp (check_effective_target_offload_nvptx): New.
authorNathan Sidwell <nathan@codesourcery.com>
Fri, 13 Nov 2015 21:48:23 +0000 (21:48 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Fri, 13 Nov 2015 21:48:23 +0000 (21:48 +0000)
* lib/target-supports.exp (check_effective_target_offload_nvptx): New.
* gcc.dg/goacc/nvptx-merged-loop.c: New.

From-SVN: r230353

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/goacc/nvptx-merged-loop.c [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp

index e01d0c6fc171af4cdfab442ac2c7af2d0beb35e9..68cf4e946fe0cb727584cf8b5f46165b94d719a6 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-13  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * lib/target-supports.exp (check_effective_target_offload_nvptx): New.
+       * gcc.dg/goacc/nvptx-merged-loop.c: New.
+
 2015-11-13  Steven G. Kargl  <kargl@gccc.gnu.org>
 
        PR fortran/68319
diff --git a/gcc/testsuite/gcc.dg/goacc/nvptx-merged-loop.c b/gcc/testsuite/gcc.dg/goacc/nvptx-merged-loop.c
new file mode 100644 (file)
index 0000000..3ff537c
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-do link } */
+/* { dg-require-effective-target offload_nvptx } */
+/* { dg-options "-fopenacc -O2 -foffload=-fdump-rtl-mach\\ -dumpbase\\ nvptx-merged-loop.c\\ -Wa,--no-verify" } */
+
+#define N (32*32*32+17)
+void __attribute__ ((noinline)) Foo (int *ary)
+{
+  int ix;
+
+#pragma acc parallel num_workers(32) vector_length(32) copyout(ary[0:N])
+  {
+    /* Loop partitioning should be merged.  */
+#pragma acc loop worker vector
+    for (unsigned ix = 0; ix < N; ix++)
+      {
+       ary[ix] = ix;
+      }
+  }
+}
+
+int main ()
+{
+  int ary[N];
+
+  Foo (ary);
+
+  return 0;
+}   
+
+/* { dg-final { scan-rtl-dump "Merging loop .* into " "mach" } } */
index 75d506829221e3d02d454631c4bd2acd1a8cedf2..328d483226edb2d449aa28f75657cb0f0aafaca5 100644 (file)
@@ -6716,3 +6716,11 @@ proc check_effective_target_vect_max_reduc { } {
     }
     return 0
 }
+
+# Return 1 if there is an nvptx offload compiler.
+
+proc check_effective_target_offload_nvptx { } {
+    return [check_no_compiler_messages offload_nvptx object {
+       int main () {return 0;}
+    } "-foffload=nvptx-none" ]
+}