Improve atomic store implementation on hppa-linux.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / kernels-private-vars-local-worker-3.c
blob8b4cde87ce9f70220d5efc374648a7fba9151220
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 in a local scope, 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];
22 for (i = 0; i < 32 * 32 * 32; i++)
23 arr[i] = i;
25 #pragma acc kernels copy(arr)
26 /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
28 int j;
30 #pragma acc loop gang(num:32)
31 /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
32 for (i = 0; i < 32; i++)
34 #pragma acc loop worker(num:32)
35 /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
36 /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
37 /* { dg-note {variable 'pt' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
38 for (j = 0; j < 32; j++)
40 int k;
41 vec2 pt;
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;