| 1 |
/* { dg-additional-options "-foffload-options=nvptx-none=-latomic" { target { offload_target_nvptx } } } */ |
| 2 |
|
| 3 |
#include <stdlib.h> |
| 4 |
|
| 5 |
struct s |
| 6 |
{ |
| 7 |
int i; |
| 8 |
}; |
| 9 |
|
| 10 |
#pragma omp declare reduction(+: struct s: omp_out.i += omp_in.i) |
| 11 |
|
| 12 |
int |
| 13 |
main (void) |
| 14 |
{ |
| 15 |
const int N0 = 32768; |
| 16 |
|
| 17 |
struct s counter_N0 = { 0 }; |
| 18 |
#pragma omp target |
| 19 |
#pragma omp for simd reduction(+: counter_N0) |
| 20 |
for (int i0 = 0 ; i0 < N0 ; i0++ ) |
| 21 |
counter_N0.i += 1; |
| 22 |
|
| 23 |
if (counter_N0.i != N0) |
| 24 |
abort (); |
| 25 |
|
| 26 |
return 0; |
| 27 |
} |