| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
#include <stdlib.h> |
| 4 |
|
| 5 |
#define N 1024 |
| 6 |
|
| 7 |
unsigned int a[N]; |
| 8 |
unsigned int b[N]; |
| 9 |
unsigned int c[N]; |
| 10 |
unsigned int n = N; |
| 11 |
|
| 12 |
int |
| 13 |
main (void) |
| 14 |
{ |
| 15 |
for (unsigned int i = 0; i < n; ++i) |
| 16 |
{ |
| 17 |
a[i] = i % 3; |
| 18 |
b[i] = i % 5; |
| 19 |
} |
| 20 |
|
| 21 |
unsigned int res = 1; |
| 22 |
unsigned long long res2 = 1; |
| 23 |
#pragma acc parallel vector_length (128) copyin (a,b) reduction (+:res, res2) copy (res, res2) |
| 24 |
{ |
| 25 |
#pragma acc loop vector reduction (+:res, res2) |
| 26 |
for (unsigned int i = 0; i < n; i++) |
| 27 |
{ |
| 28 |
res += ((a[i] + b[i]) % 2); |
| 29 |
res2 += ((a[i] + b[i]) % 2); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
if (res != 478) |
| 34 |
abort (); |
| 35 |
if (res2 != 478) |
| 36 |
abort (); |
| 37 |
|
| 38 |
return 0; |
| 39 |
} |