| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 3 |
#ifdef __cplusplus |
| 4 |
extern "C" |
| 5 |
#else |
| 6 |
extern |
| 7 |
#endif |
| 8 |
void abort (void); |
| 9 |
|
| 10 |
int |
| 11 |
main (void) |
| 12 |
{ |
| 13 |
#define N 5 |
| 14 |
int array[N][N]; |
| 15 |
|
| 16 |
for (int i = 0; i < N; i++) |
| 17 |
{ |
| 18 |
#pragma omp target enter data map(alloc: array[i:1][0:N]) |
| 19 |
|
| 20 |
#pragma omp target |
| 21 |
for (int j = 0; j < N; j++) |
| 22 |
array[i][j] = i * 10 + j; |
| 23 |
|
| 24 |
#pragma omp target exit data map(from: array[i:1][0:N]) |
| 25 |
} |
| 26 |
|
| 27 |
for (int i = 0; i < N; i++) |
| 28 |
for (int j = 0; j < N; j++) |
| 29 |
if (array[i][j] != i + j) |
| 30 |
abort (); |
| 31 |
|
| 32 |
return 0; |
| 33 |
} |
| 34 |
|
| 35 |
/* { dg-final { scan-tree-dump {#pragma omp target enter data map\(alloc:array\[[^]]+\]\[0\] \[len: [0-9]+\]\)} "gimple" } } */ |
| 36 |
|
| 37 |
/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(i\) map\(tofrom:array \[len: [0-9]+\] \[runtime_implicit\]\)} "gimple" } } */ |
| 38 |
|
| 39 |
/* { dg-final { scan-tree-dump {#pragma omp target exit data map\(from:array\[[^]]+\]\[0\] \[len: [0-9]+\]\)} "gimple" } } */ |