| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
#include <assert.h> |
| 4 |
|
| 5 |
#define DO_PRAGMA(x) _Pragma (#x) |
| 6 |
|
| 7 |
#define test(idx,type,ngangs) \ |
| 8 |
void \ |
| 9 |
test_##idx () \ |
| 10 |
{ \ |
| 11 |
int b[100]; \ |
| 12 |
\ |
| 13 |
for (unsigned int i = 0; i < 100; i++) \ |
| 14 |
b[i] = 0; \ |
| 15 |
\ |
| 16 |
DO_PRAGMA(acc parallel num_gangs (ngangs) copy (b)) \ |
| 17 |
{ \ |
| 18 |
_Pragma("acc loop gang") \ |
| 19 |
for (type j = 0; j < 5; j++) \ |
| 20 |
{ \ |
| 21 |
_Pragma("acc loop vector") \ |
| 22 |
for (unsigned int i = 0; i < 20; i++) \ |
| 23 |
b[j * 20 + i] = -2; \ |
| 24 |
} \ |
| 25 |
} \ |
| 26 |
\ |
| 27 |
for (unsigned int i = 0; i < 100; i++) \ |
| 28 |
assert (b[i] == -2); \ |
| 29 |
} |
| 30 |
|
| 31 |
test (0, signed char, 256) |
| 32 |
test (1, unsigned char, 256) |
| 33 |
test (2, signed short, 65535) |
| 34 |
test (3, unsigned short, 65535) |
| 35 |
|
| 36 |
int |
| 37 |
main () |
| 38 |
{ |
| 39 |
test_0 (); |
| 40 |
test_1 (); |
| 41 |
test_2 (); |
| 42 |
test_3 (); |
| 43 |
|
| 44 |
return 0; |
| 45 |
} |