]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
[openacc] Add __builtin_goacc_parlevel_{id,size}
[thirdparty/gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / loop-red-w-1.c
index 19021d9d062331327879582d24b992e355fa3776..6bbd04fffeaa99e2d8319a3a225d2e0f4115cd98 100644 (file)
@@ -1,8 +1,6 @@
-/* This code uses nvptx inline assembly guarded with acc_on_device, which is
-   not optimized away at -O0, and then confuses the target assembler.
-   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
-
 #include <stdio.h>
+#include <openacc.h>
+#include <gomp-constants.h>
 
 #define N (32*32*32+17)
 int main ()
@@ -18,13 +16,13 @@ int main ()
       {
        int val = ix;
        
-       if (__builtin_acc_on_device (5))
+       if (acc_on_device (acc_device_not_host))
          {
-           int g = 0, w = 0, v = 0;
+           int g, w, v;
 
-           __asm__ volatile ("mov.u32 %0,%%ctaid.x;" : "=r" (g));
-           __asm__ volatile ("mov.u32 %0,%%tid.y;" : "=r" (w));
-           __asm__ volatile ("mov.u32 %0,%%tid.x;" : "=r" (v));
+           g = __builtin_goacc_parlevel_id (GOMP_DIM_GANG);
+           w = __builtin_goacc_parlevel_id (GOMP_DIM_WORKER);
+           v = __builtin_goacc_parlevel_id (GOMP_DIM_VECTOR);
            val = (g << 16) | (w << 8) | v;
            ondev = 1;
          }