Improve atomic store implementation on hppa-linux.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / kernels-private-vars-loop-vector-1.c
blob696da0f204facbc77b93786708c886cac863717c
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 vector-private variables declared on loop directive. */
11 int
12 main (int argc, char* argv[])
14 int x, i, arr[32 * 32 * 32];
16 for (i = 0; i < 32 * 32 * 32; i++)
17 arr[i] = i;
19 #pragma acc kernels copy(arr)
20 /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
22 int j;
24 #pragma acc loop gang(num:32)
25 /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
26 for (i = 0; i < 32; i++)
28 #pragma acc loop worker(num:32)
29 /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
30 /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
31 for (j = 0; j < 32; j++)
33 int k;
35 #pragma acc loop vector(length:32) private(x)
36 /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
37 /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
38 for (k = 0; k < 32; k++)
40 x = i ^ j * 3;
41 arr[i * 1024 + j * 32 + k] += x * k;
44 #pragma acc loop vector(length:32) private(x)
45 /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
46 /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
47 for (k = 0; k < 32; k++)
49 x = i | j * 5;
50 arr[i * 1024 + j * 32 + k] += x * k;
56 for (i = 0; i < 32; i++)
57 for (int j = 0; j < 32; j++)
58 for (int k = 0; k < 32; k++)
60 int idx = i * 1024 + j * 32 + k;
61 assert (arr[idx] == idx + (i ^ j * 3) * k + (i | j * 5) * k);
64 return 0;