Handle symbol visibility/locality for PIE/PIC
[official-gcc.git] / gcc / testsuite / c-c++-common / goacc / reduction-2.c
blob1f95138ff0bb2c7ab5c0cc67f2746cd6baed5c90
1 /* float reductions. */
3 #define vl 32
5 int
6 main(void)
8 const int n = 1000;
9 int i;
10 float result, array[n];
11 int lresult;
13 /* '+' reductions. */
14 #pragma acc parallel vector_length (vl)
15 #pragma acc loop reduction (+:result)
16 for (i = 0; i < n; i++)
17 result += array[i];
19 /* '*' reductions. */
20 #pragma acc parallel vector_length (vl)
21 #pragma acc loop reduction (*:result)
22 for (i = 0; i < n; i++)
23 result *= array[i];
25 // /* 'max' reductions. */
26 // #pragma acc parallel vector_length (vl)
27 // #pragma acc loop reduction (+:result)
28 // for (i = 0; i < n; i++)
29 // result = result > array[i] ? result : array[i];
30 //
31 // /* 'min' reductions. */
32 // #pragma acc parallel vector_length (vl)
33 // #pragma acc loop reduction (+:result)
34 // for (i = 0; i < n; i++)
35 // result = result < array[i] ? result : array[i];
37 /* '&&' reductions. */
38 #pragma acc parallel vector_length (vl)
39 #pragma acc loop reduction (&&:lresult)
40 for (i = 0; i < n; i++)
41 lresult = lresult && (result > array[i]);
43 /* '||' reductions. */
44 #pragma acc parallel vector_length (vl)
45 #pragma acc loop reduction (||:lresult)
46 for (i = 0; i < n; i++)
47 lresult = lresult || (result > array[i]);
49 return 0;