| 1 |
/* The following definitions are in omp_lib, which cannot be included |
| 2 |
in gcc/testsuite/ */ |
| 3 |
|
| 4 |
#if __cplusplus >= 201103L |
| 5 |
# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__ |
| 6 |
#else |
| 7 |
# define __GOMP_UINTPTR_T_ENUM |
| 8 |
#endif |
| 9 |
|
| 10 |
typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM |
| 11 |
{ |
| 12 |
omp_interop_none = 0, |
| 13 |
__omp_interop_t_max__ = __UINTPTR_MAX__ |
| 14 |
} omp_interop_t; |
| 15 |
|
| 16 |
float repl0(short, short); |
| 17 |
#pragma omp declare variant(repl0) match(construct={dispatch}) append_args(interop(target), interop(targetsync)) |
| 18 |
float base0(); |
| 19 |
/* { dg-error "argument 1 of 'repl0' must be of 'omp_interop_t'" "" { target c } .-3 } */ |
| 20 |
/* { dg-error "argument 1 of 'float repl0\\(short int, short int\\)' must be of 'omp_interop_t'" "" { target c++ } .-4 } */ |
| 21 |
/* { dg-note "'append_args' specified here" "" { target *-*-* } .-4 } */ |
| 22 |
|
| 23 |
float repl1(omp_interop_t, omp_interop_t); |
| 24 |
#pragma omp declare variant(repl1) match(construct={dispatch}) append_args(interop(target), interop(targetsync)) |
| 25 |
float base1(); |
| 26 |
|
| 27 |
void repl2(int *, int *, omp_interop_t, omp_interop_t); |
| 28 |
#pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \ |
| 29 |
append_args(interop(target, targetsync, prefer_type(1)), \ |
| 30 |
interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) |
| 31 |
void base2(int *x, int *y); |
| 32 |
|
| 33 |
void repl3(int, omp_interop_t, ...); |
| 34 |
#pragma omp declare variant(repl3) match(construct={dispatch}) \ |
| 35 |
append_args(interop(target, prefer_type("cuda", "hsa"))) |
| 36 |
void base3(int, ...); |
| 37 |
/* { dg-note "'declare variant' candidate 'repl3' declared here" "" { target c } .-2 } */ |
| 38 |
/* { dg-note "'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)' declared here" "" { target c++ } .-3 } */ |
| 39 |
|
| 40 |
float repl4(short, short, omp_interop_t, short); |
| 41 |
#pragma omp declare variant(repl4) match(construct={dispatch}) append_args(interop(target)) append_args(interop(targetsync)) /* { dg-error "too many 'append_args' clauses" } */ |
| 42 |
float base4(short, short); |
| 43 |
/* { dg-error "variant 'repl4' and base 'base4' have incompatible types" "" { target c } .-2 } */ |
| 44 |
/* { dg-error "too few arguments to function 'float repl4\\(short int, short int, omp_interop_t, short int\\)'" "" { target c++ } .-3 } */ |
| 45 |
/* { dg-note "declared here" "" { target c++ } .-5 } */ |
| 46 |
|
| 47 |
|
| 48 |
float repl5(short, short, omp_interop_t, short); |
| 49 |
#pragma omp declare variant(repl5) match(construct={dispatch}) append_args(interop(target),interop(targetsync)) |
| 50 |
float base5(short, short); |
| 51 |
/* { dg-error "argument 4 of 'repl5' must be of 'omp_interop_t'" "" { target c } .-3 } */ |
| 52 |
/* { dg-error "argument 4 of 'float repl5\\(short int, short int, omp_interop_t, short int\\)' must be of 'omp_interop_t'" "" { target c++ } .-4 } */ |
| 53 |
/* { dg-note "'append_args' specified here" "" { target *-*-* } .-4 } */ |
| 54 |
|
| 55 |
|
| 56 |
float repl6(short, short, omp_interop_t, short); |
| 57 |
#pragma omp declare variant(repl6) match(construct={dispatch}) append_args(interop(target)) |
| 58 |
float base6(short, short); |
| 59 |
/* { dg-error "variant 'repl6' and base 'base6' have incompatible types" "" { target c } .-2 } */ |
| 60 |
/* { dg-error "too few arguments to function 'float repl6\\(short int, short int, omp_interop_t, short int\\)'" "" { target c++ } .-3 } */ |
| 61 |
/* { dg-note "declared here" "" { target c++ } .-5 } */ |
| 62 |
|
| 63 |
|
| 64 |
float |
| 65 |
test (int *a, int *b) |
| 66 |
{ |
| 67 |
omp_interop_t obj1, obj2; |
| 68 |
float x; |
| 69 |
|
| 70 |
#pragma omp dispatch interop ( obj1 ) |
| 71 |
x = base1 (); |
| 72 |
|
| 73 |
#pragma omp dispatch interop ( obj1 ) |
| 74 |
base2 (a, b); |
| 75 |
|
| 76 |
#pragma omp dispatch |
| 77 |
base3 (5, 1, 2, 3); |
| 78 |
|
| 79 |
#pragma omp dispatch interop (obj2) |
| 80 |
base3 (5, 1, 2, 3); |
| 81 |
|
| 82 |
#pragma omp dispatch interop (obj2, obj1) /* { dg-error "the 'device' clause must be present if the 'interop' clause has more than one list item" } */ |
| 83 |
base3 (5, 1, 2, 3); |
| 84 |
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'repl3'" "" { target c } .-2 } */ |
| 85 |
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)'" "" { target c++ } .-3 } */ |
| 86 |
|
| 87 |
return x; |
| 88 |
} |