Improve atomic store implementation on hppa-linux.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / kernels-private-vars-loop-worker-3.c
blob8de551635ea9482048d2b7401171bf3ddb34f9d3
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 <assert.h>
9 /* Test of worker-private variables declared on a loop directive, broadcasting
10 to vector-partitioned mode. Back-to-back worker loops. */
12 int
13 main (int argc, char* argv[])
15 int x = 5, i, arr[32 * 32 * 32];
17 for (i = 0; i < 32 * 32 * 32; i++)
18 arr[i] = i;
20 #pragma acc kernels copy(arr)
21 /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
23 int j;
25 #pragma acc loop gang(num:32)
26 /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
27 for (i = 0; i < 32; i++)
29 #pragma acc loop worker(num:32) private(x)
30 /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
31 /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
32 /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
33 for (j = 0; j < 32; j++)
35 int k;
36 x = i ^ j * 3;
38 #pragma acc loop vector(length:32)
39 /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
40 for (k = 0; k < 32; k++)
41 arr[i * 1024 + j * 32 + k] += x * k;
44 #pragma acc loop worker(num:32) private(x)
45 /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
46 /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
47 /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
48 for (j = 0; j < 32; j++)
50 int k;
51 x = i | j * 5;
53 #pragma acc loop vector(length:32)
54 /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
55 for (k = 0; k < 32; k++)
56 arr[i * 1024 + j * 32 + k] += x * k;
61 for (i = 0; i < 32; i++)
62 for (int j = 0; j < 32; j++)
63 for (int k = 0; k < 32; k++)
65 int idx = i * 1024 + j * 32 + k;
66 assert (arr[idx] == idx + (i ^ j * 3) * k + (i | j * 5) * k);
69 return 0;