| 1 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 2 |
|
| 3 |
/* The following definitions are in omp_lib, which cannot be included |
| 4 |
gcc/testsuite/g++.dg/gomp/append-args-1.C in gcc/testsuite/ */ |
| 5 |
|
| 6 |
#if __cplusplus >= 201103L |
| 7 |
# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__ |
| 8 |
#else |
| 9 |
# define __GOMP_UINTPTR_T_ENUM |
| 10 |
#endif |
| 11 |
|
| 12 |
typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM |
| 13 |
{ |
| 14 |
omp_interop_none = 0, |
| 15 |
__omp_interop_t_max__ = __UINTPTR_MAX__ |
| 16 |
} omp_interop_t; |
| 17 |
|
| 18 |
|
| 19 |
template<typename T, typename T2, typename T3> |
| 20 |
void repl2(T, T2, T3, T3); |
| 21 |
#pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \ |
| 22 |
append_args(interop(target, targetsync, prefer_type(1)), \ |
| 23 |
interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) |
| 24 |
template<typename T, typename T2> |
| 25 |
void base2(T x, T2 y); |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
template<typename T, typename T2> |
| 30 |
void repl3(T, T2, T2, T2, ...); |
| 31 |
#pragma omp declare variant(repl3) match(construct={dispatch}) \ |
| 32 |
append_args( interop(target, prefer_type("cuda", "hsa")), \ |
| 33 |
interop(targetsync), \ |
| 34 |
interop(target, prefer_type({attr("ompx_nop")})) ) |
| 35 |
template<typename T> |
| 36 |
void base3(T, ...); |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
float |
| 42 |
test (int *a, int *b) |
| 43 |
{ |
| 44 |
omp_interop_t obj1, obj2; |
| 45 |
float x, y; |
| 46 |
|
| 47 |
#pragma omp dispatch interop ( obj1 ) |
| 48 |
base2<int *, int *> (b, a); |
| 49 |
|
| 50 |
#pragma omp dispatch nocontext(1) |
| 51 |
base3<int*>(a, 1, 2, "abc"); |
| 52 |
|
| 53 |
#pragma omp dispatch |
| 54 |
base3<int*>(a, 1, 2, "abc"); |
| 55 |
|
| 56 |
return x; |
| 57 |
} |
| 58 |
|
| 59 |
/* { dg-final { scan-tree-dump-times "base3<int\\*> \\(a, 1, 2, \"abc\"\\);" 1 "gimple" } } */ |
| 60 |
|
| 61 |
/* { dg-final { scan-tree-dump-times "unsigned.* \\* interopobjs.\[0-9\]+\\\[1\\\];" 1 "gimple" } } */ |
| 62 |
/* { dg-final { scan-tree-dump-times "unsigned.* \\* interopobjs.\[0-9\]+\\\[3\\\];" 1 "gimple" } } */ |
| 63 |
/* { dg-final { scan-tree-dump-times "int tgt_tgtsync.\[0-9\]+\\\[1\\\];" 1 "gimple" } } */ |
| 64 |
/* { dg-final { scan-tree-dump-times "int tgt_tgtsync.\[0-9\]+\\\[3\\\];" 1 "gimple" } } */ |
| 65 |
/* { dg-final { scan-tree-dump-times "const char \\* pref_type.\[0-9\]+\\\[1\\\];" 1 "gimple" } } */ |
| 66 |
/* { dg-final { scan-tree-dump-times "const char \\* pref_type.\[0-9\]+\\\[3\\\];" 1 "gimple" } } */ |
| 67 |
|
| 68 |
/* { dg-final { scan-tree-dump-times "interopobjs.\[0-9\]+\\\[0\\\] = &interop\\.\[0-9\]+;" 2 "gimple" } } */ |
| 69 |
/* { dg-final { scan-tree-dump-times "interopobjs.\[0-9\]+\\\[1\\\] = &interop\\.\[0-9\]+;" 1 "gimple" } } */ |
| 70 |
/* { dg-final { scan-tree-dump-times "interopobjs.\[0-9\]+\\\[2\\\] = &interop\\.\[0-9\]+;" 1 "gimple" } } */ |
| 71 |
/* { dg-final { scan-tree-dump-times "tgt_tgtsync.\[0-9\]+\\\[0\\\] = 1;" 2 "gimple" } } */ |
| 72 |
/* { dg-final { scan-tree-dump-times "tgt_tgtsync.\[0-9\]+\\\[1\\\] = 2;" 1 "gimple" } } */ |
| 73 |
/* { dg-final { scan-tree-dump-times "tgt_tgtsync.\[0-9\]+\\\[2\\\] = 1;" 1 "gimple" } } */ |
| 74 |
/* { dg-final { scan-tree-dump-times "pref_type.\[0-9\]+\\\[0\\\] = \"\\\\x80\\\\x03\\\\x80ompx_nop\\\\x00\\\\x00\\\\x80\\\\x02\\\\x80\\\\x00\\\\x80\\\\x80ompx_all\\\\x00\\\\x00\";" 1 "gimple" } } */ |
| 75 |
/* { dg-final { scan-tree-dump-times "pref_type.\[0-9\]+\\\[0\\\] = \"\\\\x80\\\\x01\\\\x80\\\\x00\\\\x80\\\\x07\\\\x80\\\\x00\";" 1 "gimple" } } */ |
| 76 |
/* { dg-final { scan-tree-dump-times "pref_type.\[0-9\]+\\\[1\\\] = 0B;" 1 "gimple" } } */ |
| 77 |
/* { dg-final { scan-tree-dump-times "pref_type.\[0-9\]+\\\[2\\\] = \"\\\\x80\\\\x80ompx_nop\\\\x00\\\\x00\";" 1 "gimple" } } */ |
| 78 |
|
| 79 |
|
| 80 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_interop_int \\(obj1, -5, 0B\\);" 1 "gimple" } } */ |
| 81 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_default_device \\(\\);" 1 "gimple" } } */ |
| 82 |
/* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(D\.\[0-9\]+\\);" 2 "gimple" } } */ |
| 83 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(a, D\.\[0-9\]+\\);" 1 "gimple" } } */ |
| 84 |
|
| 85 |
/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(D\.\[0-9\]+, 1, &interopobjs\.\[0-9\], &tgt_tgtsync\.\[0-9\]+, &pref_type.2, 0, 0B, 0, 0B, 0, 0B\\);" 1 "gimple" } } */ |
| 86 |
/* { dg-final { scan-tree-dump-times "repl2<int\\*, int\\*, omp_interop_t> \\(b, D\.\[0-9\]+, obj1, interop\.\[0-9\]+\\);" 1 "gimple" } } */ |
| 87 |
/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 1, &interopobjs\.\[0-9\]+, 0, 0B\\);" 1 "gimple" } } */ |
| 88 |
|
| 89 |
|
| 90 |
/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(-5, 0, 0B, 0B, 0B, 0, 0B, 3, &interopobjs\.\[0-9\]+, 0, 0B\\);" 1 "gimple" } } */ |
| 91 |
/* { dg-final { scan-tree-dump-times "repl3<int\\*, omp_interop_t> \\(a, interop\.\[0-9\]+, interop\.\[0-9\]+, interop\.\[0-9\]+, 1, 2, \"abc\"\\);" 1 "gimple" } } */ |
| 92 |
/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(-5, 3, &interopobjs\.\[0-9\]+, &tgt_tgtsync\.\[0-9\]+, &pref_type\.\[0-9\]+, 0, 0B, 0, 0B, 0, 0B\\);" 1 "gimple" } } */ |