Adjust formatting of acc_get_property tests
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / kernels-private-vars-local-worker-1.c
1 #include <assert.h>
2
3 /* Test of worker-private variables declared in a local scope, broadcasting
4 to vector-partitioned mode. Back-to-back worker loops. */
5
6 int
7 main (int argc, char* argv[])
8 {
9 int i, arr[32 * 32 * 32];
10
11 for (i = 0; i < 32 * 32 * 32; i++)
12 arr[i] = i;
13
14 #pragma acc kernels copy(arr)
15 {
16 int j;
17
18 #pragma acc loop gang(num:32)
19 for (i = 0; i < 32; i++)
20 {
21 #pragma acc loop worker(num:32)
22 for (j = 0; j < 32; j++)
23 {
24 int k;
25 int x = i ^ j * 3;
26
27 #pragma acc loop vector(length:32)
28 for (k = 0; k < 32; k++)
29 arr[i * 1024 + j * 32 + k] += x * k;
30 }
31
32 #pragma acc loop worker(num:32)
33 for (j = 0; j < 32; j++)
34 {
35 int k;
36 int x = i | j * 5;
37
38 #pragma acc loop vector(length:32)
39 for (k = 0; k < 32; k++)
40 arr[i * 1024 + j * 32 + k] += x * k;
41 }
42 }
43 }
44
45 for (i = 0; i < 32; i++)
46 for (int j = 0; j < 32; j++)
47 for (int k = 0; k < 32; k++)
48 {
49 int idx = i * 1024 + j * 32 + k;
50 assert (arr[idx] == idx + (i ^ j * 3) * k + (i | j * 5) * k);
51 }
52
53 return 0;
54 }