| 1 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 2 |
|
| 3 |
#if __cplusplus >= 201103L |
| 4 |
# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__ |
| 5 |
#else |
| 6 |
# define __GOMP_UINTPTR_T_ENUM |
| 7 |
#endif |
| 8 |
|
| 9 |
typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM |
| 10 |
{ |
| 11 |
omp_interop_none = 0, |
| 12 |
__omp_interop_t_max__ = __UINTPTR_MAX__ |
| 13 |
} omp_interop_t; |
| 14 |
|
| 15 |
void f1(...) { } |
| 16 |
#pragma omp declare variant(f1) match(construct={dispatch}) |
| 17 |
void g1(...) { } |
| 18 |
|
| 19 |
|
| 20 |
void f2(...) { } |
| 21 |
/* { dg-error "argument 1 of 'f2' must be of 'omp_interop_t'" "" { target c } .-1 } */ |
| 22 |
/* { dg-error "argument 1 of 'void f2\\(\\.\\.\\.\\)' must be of 'omp_interop_t'" "" { target c++ } .-2 } */ |
| 23 |
#pragma omp declare variant(f2) append_args(interop(target), interop(target, prefer_type("cuda"))) \ |
| 24 |
match(construct={dispatch}) |
| 25 |
void g2(...) { } |
| 26 |
/* { dg-note "'append_args' specified here" "" { target *-*-* } .-3 } */ |
| 27 |
|
| 28 |
|
| 29 |
void f3(omp_interop_t, omp_interop_t, ...) { } |
| 30 |
#pragma omp declare variant(f3) append_args(interop(target), interop(target, prefer_type("cuda"))) \ |
| 31 |
match(construct={dispatch}) |
| 32 |
void g3(...) { } |
| 33 |
|
| 34 |
|
| 35 |
void foo (int *a, char *cp, int d) { |
| 36 |
omp_interop_t obj1 = omp_interop_none; |
| 37 |
omp_interop_t obj2 = omp_interop_none; |
| 38 |
#pragma omp dispatch interop(obj1, obj2) device(22) |
| 39 |
g3(1, a, cp, d); |
| 40 |
} |
| 41 |
|
| 42 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_default_device \\(\\);" 1 "gimple" } } */ |
| 43 |
|
| 44 |
/* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(22\\);" 1 "gimple" } } */ |
| 45 |
/* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(D\.\[0-9\]+\\);" 1 "gimple" } } */ |
| 46 |
|
| 47 |
/* { dg-final { scan-tree-dump-times "f3 \\(obj1, obj2, 1, a, cp, d\\);" 1 "gimple" } } */ |