| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-fdump-tree-original" } */ |
| 3 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 4 |
|
| 5 |
#define N 100 |
| 6 |
|
| 7 |
void |
| 8 |
bar (int a[], int run_parallel, int run_guided) |
| 9 |
{ |
| 10 |
#pragma omp metadirective \ |
| 11 |
when (user={condition(run_parallel)}: parallel) |
| 12 |
{ |
| 13 |
int i; |
| 14 |
#pragma omp metadirective \ |
| 15 |
when (construct={parallel}, user={condition(run_guided)}: \ |
| 16 |
for schedule(guided)) \ |
| 17 |
when (construct={parallel}: for schedule(static)) |
| 18 |
for (i = 0; i < N; i++) |
| 19 |
a[i] = i; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
/* The outer metadirective should be resolved at parse time. */ |
| 24 |
/* The inner metadirective should be resolved during Gimplificiation. */ |
| 25 |
|
| 26 |
/* { dg-final { scan-tree-dump-times "#pragma omp metadirective" 2 "original" } } */ |
| 27 |
/* { dg-final { scan-tree-dump-times "#pragma omp parallel" 1 "original" } } */ |
| 28 |
/* { dg-final { scan-tree-dump-times "#pragma omp for" 4 "original" } } */ |
| 29 |
/* { dg-final { scan-tree-dump-times "when \\(construct = .parallel" 4 "original" } } */ |
| 30 |
/* { dg-final { scan-tree-dump-times "otherwise:" 2 "original" } } */ |
| 31 |
|
| 32 |
/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */ |