libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | int |
| 4 | main(void) |
| 5 | { |
| 6 | #define I 5 |
| 7 | #define N 32 |
| 8 | #define A 8 |
| 9 | |
| 10 | int a = A; |
| 11 | int s = I; |
| 12 | |
| 13 | #pragma acc parallel vector_length(N) copy(s) |
| 14 | { |
| 15 | int i; |
| 16 | #pragma acc loop reduction(+:s) |
| 17 | for (i = 0; i < N; ++i) |
| 18 | s += a; |
| 19 | } |
| 20 | |
| 21 | if (s != I + N * A) |
| 22 | __builtin_abort(); |
| 23 | |
| 24 | return 0; |
| 25 | } |