sched1: debug/model: dump predecessor list and BB num [NFC]
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / loop-red-g-1.c
blob0c8402703e7a04364041ba3834f55002100e0232
1 /* { dg-additional-options "-fopt-info-note-omp" }
2 { dg-additional-options "--param=openacc-privatization=noisy" }
3 { dg-additional-options "-foffload=-fopt-info-note-omp" }
4 { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
5 for testing/documenting aspects of that functionality. */
7 #include <stdio.h>
8 #include <openacc.h>
9 #include <gomp-constants.h>
11 #define N (32*32*32+17)
12 int main ()
14 int ix;
15 int ondev = 0;
16 int t = 0, h = 0;
18 #pragma acc parallel num_gangs(32) copy(ondev)
19 /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
21 #pragma acc loop gang reduction (+:t)
22 /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
23 /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
24 /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
25 /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
26 /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */
27 for (unsigned ix = 0; ix < N; ix++)
29 int val = ix;
31 if (acc_on_device (acc_device_not_host))
33 int g, w, v;
35 g = __builtin_goacc_parlevel_id (GOMP_DIM_GANG);
36 w = __builtin_goacc_parlevel_id (GOMP_DIM_WORKER);
37 v = __builtin_goacc_parlevel_id (GOMP_DIM_VECTOR);
38 val = (g << 16) | (w << 8) | v;
39 ondev = 1;
41 t += val;
45 for (ix = 0; ix < N; ix++)
47 int val = ix;
48 if(ondev)
50 int g = ix / ((N + 31) / 32);
51 int w = 0;
52 int v = 0;
54 val = (g << 16) | (w << 8) | v;
56 h += val;
58 if (t != h)
60 printf ("t=%x expected %x\n", t, h);
61 return 1;
64 return 0;