Improve atomic store implementation on hppa-linux.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / kernels-private-vars-loop-worker-6.c
blob4f17566f8f9717f2c1d9806bace5d86bbb874f97
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. Aggregate worker variable. */
12 typedef struct
14 int x, y;
15 } vec2;
17 int
18 main (int argc, char* argv[])
20 int i, arr[32 * 32 * 32];
21 vec2 pt;
23 for (i = 0; i < 32 * 32 * 32; i++)
24 arr[i] = i;
26 #pragma acc kernels copy(arr)
27 /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
29 int j;
31 #pragma acc loop gang(num:32)
32 /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
33 for (i = 0; i < 32; i++)
35 #pragma acc loop worker(num:32) private(pt)
36 /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
37 /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
38 /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
39 for (j = 0; j < 32; j++)
41 int k;
43 pt.x = i ^ j * 3;
44 pt.y = i | j * 5;
46 #pragma acc loop vector(length:32)
47 /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
48 for (k = 0; k < 32; k++)
49 arr[i * 1024 + j * 32 + k] += pt.x * k;
51 #pragma acc loop vector(length:32)
52 /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
53 for (k = 0; k < 32; k++)
54 arr[i * 1024 + j * 32 + k] += pt.y * k;
59 for (i = 0; i < 32; i++)
60 for (int j = 0; j < 32; j++)
61 for (int k = 0; k < 32; k++)
63 int idx = i * 1024 + j * 32 + k;
64 assert (arr[idx] == idx + (i ^ j * 3) * k + (i | j * 5) * k);
67 return 0;