| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 3 |
|
| 4 |
/* Ensure that adjust_args is only applied when variant substitution happens. */ |
| 5 |
|
| 6 |
extern int flag; |
| 7 |
|
| 8 |
void h(int *); |
| 9 |
void f(int *); |
| 10 |
#pragma omp declare variant(f) match(construct={dispatch}, user={condition(flag)}) adjust_args(need_device_ptr : x) |
| 11 |
void g(int *x); |
| 12 |
|
| 13 |
void foo(int *y) |
| 14 |
{ |
| 15 |
#pragma omp dispatch |
| 16 |
h(y); /* no substitution */ |
| 17 |
#pragma omp dispatch |
| 18 |
f(y); /* no substitution */ |
| 19 |
#pragma omp dispatch |
| 20 |
g(y); /* conditional with substitution for f */ |
| 21 |
} |
| 22 |
|
| 23 |
/* { dg-final { scan-tree-dump-times "h \\(y\\);" 1 "gimple" } } */ |
| 24 |
/* { dg-final { scan-tree-dump-times "f \\(y\\);" 1 "gimple" } } */ |
| 25 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(y, D\.\[0-9]+\\);" 1 "gimple" } } */ |
| 26 |
/* { dg-final { scan-tree-dump-times "f \\(D\.\[0-9]+\\);" 1 "gimple" } } */ |
| 27 |
/* { dg-final { scan-tree-dump-times "g \\(y\\);" 1 "gimple" } } */ |