| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 3 |
|
| 4 |
/* Test that interop objects are implicitly created/destroyed when a dispatch |
| 5 |
construct doesn't provide enough of them to satisfy the declare variant |
| 6 |
append_args clause. */ |
| 7 |
|
| 8 |
/* The following definitions are in omp_lib, which cannot be included |
| 9 |
in gcc/testsuite/ */ |
| 10 |
|
| 11 |
#if __cplusplus >= 201103L |
| 12 |
# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__ |
| 13 |
#else |
| 14 |
# define __GOMP_UINTPTR_T_ENUM |
| 15 |
#endif |
| 16 |
|
| 17 |
typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM |
| 18 |
{ |
| 19 |
omp_interop_none = 0, |
| 20 |
__omp_interop_t_max__ = __UINTPTR_MAX__ |
| 21 |
} omp_interop_t; |
| 22 |
|
| 23 |
float repl1(omp_interop_t, omp_interop_t, omp_interop_t); |
| 24 |
|
| 25 |
#pragma omp declare variant(repl1) match(construct={dispatch}) append_args(interop(target), interop(targetsync), interop (target)) |
| 26 |
float base1(void); |
| 27 |
|
| 28 |
float |
| 29 |
test (int *a, int *b) |
| 30 |
{ |
| 31 |
omp_interop_t obj1; |
| 32 |
float x; |
| 33 |
|
| 34 |
/* repl1 takes 3 interop arguments, one will come from the dispatch |
| 35 |
construct and the other 2 will be consed up. */ |
| 36 |
#pragma omp dispatch interop ( obj1 ) |
| 37 |
x = base1 (); |
| 38 |
|
| 39 |
return x; |
| 40 |
} |
| 41 |
|
| 42 |
/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 2, &interopobjs\.\[0-9\]+, &tgt_tgtsync\.\[0-9\]+," "gimple" } } */ |
| 43 |
/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 2, &interopobjs\.\[0-9\]+," "gimple" } } */ |
| 44 |
/* { dg-final { scan-tree-dump "repl1 \\(obj1, interop\.\[0-9\]+, interop\.\[0-9\]+\\)" "gimple" } } */ |