Adjust formatting of acc_get_property tests
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / par-loop-comb-reduction-2.c
1 #include <assert.h>
2
3 /* Test of reduction on both parallel and loop directives (workers and vectors
4 in gang-partitioned mode, int type with XOR). */
5
6 int
7 main (int argc, char *argv[])
8 {
9 int i, j, arr[32768], res = 0, hres = 0;
10
11 for (i = 0; i < 32768; i++)
12 arr[i] = i;
13
14 #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \
15 reduction(^:res)
16 {
17 #pragma acc loop gang /* { dg-warning "nested loop in reduction needs reduction clause for 'res'" "TODO" } */
18 for (j = 0; j < 32; j++)
19 {
20 #pragma acc loop worker vector reduction(^:res)
21 for (i = 0; i < 1024; i++)
22 res ^= 3 * arr[j * 1024 + i];
23
24 #pragma acc loop worker vector reduction(^:res)
25 for (i = 0; i < 1024; i++)
26 res ^= arr[j * 1024 + (1023 - i)];
27 }
28 }
29
30 for (j = 0; j < 32; j++)
31 for (i = 0; i < 1024; i++)
32 {
33 hres ^= 3 * arr[j * 1024 + i];
34 hres ^= arr[j * 1024 + (1023 - i)];
35 }
36
37 assert (res == hres);
38
39 return 0;
40 }