| 1 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 2 |
|
| 3 |
/* Check that append_args is not applied if there the outermost function |
| 4 |
in '#pragma omp dispatch' is not variant substituted. */ |
| 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 |
int v1(int, omp_interop_t); |
| 19 |
#pragma omp declare variant(v1) match(construct={dispatch}) append_args(interop(target)) |
| 20 |
int b1(int); |
| 21 |
|
| 22 |
int v2(int); |
| 23 |
int v2a(int); |
| 24 |
#pragma omp declare variant(v2) match(construct={dispatch},user={condition(1)}) |
| 25 |
#pragma omp declare variant(v2a) match(user={condition(1)}) |
| 26 |
int b2(int); |
| 27 |
|
| 28 |
|
| 29 |
int test (int x1, int x2, int y1, int y2, int z1, int z2, int num1, int num2, int num3) |
| 30 |
{ |
| 31 |
|
| 32 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_default_device \\(\\);" 3 "gimple" } } */ |
| 33 |
/* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(D\.\[0-9\]+\\);" 3 "gimple" } } */ |
| 34 |
|
| 35 |
#pragma omp dispatch |
| 36 |
x1 = v1 (b2 (x1), omp_interop_none); |
| 37 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = v2 \\(x1\\);" 1 "gimple" } } */ |
| 38 |
/* { dg-final { scan-tree-dump-times "x1 = v1 \\(D\.\[0-9\]+, 0\\);" 1 "gimple" } } */ |
| 39 |
|
| 40 |
#pragma omp dispatch device(num1) |
| 41 |
x2 = v1 (b2 (x2), omp_interop_none); |
| 42 |
/* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(num1\\);" 1 "gimple" } } */ |
| 43 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = v2 \\(x2\\);" 1 "gimple" } } */ |
| 44 |
/* { dg-final { scan-tree-dump-times "x2 = v1 \\(D\.\[0-9\]+, 0\\);" 1 "gimple" } } */ |
| 45 |
|
| 46 |
|
| 47 |
#pragma omp dispatch nocontext(1) |
| 48 |
y1 = v1 (b2 (y1), omp_interop_none); |
| 49 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = v2a \\(y1\\);" 1 "gimple" } } */ |
| 50 |
/* { dg-final { scan-tree-dump-times "y1 = v1 \\(D\.\[0-9\]+, 0\\);" 1 "gimple" } } */ |
| 51 |
|
| 52 |
#pragma omp dispatch nocontext(1) device(num2) |
| 53 |
y2 = v1 (b2 (y2), omp_interop_none); |
| 54 |
/* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(num2\\);" 1 "gimple" } } */ |
| 55 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = v2a \\(y2\\);" 1 "gimple" } } */ |
| 56 |
/* { dg-final { scan-tree-dump-times "y2 = v1 \\(D\.\[0-9\]+, 0\\);" 1 "gimple" } } */ |
| 57 |
|
| 58 |
|
| 59 |
#pragma omp dispatch novariants(1) |
| 60 |
z1 = v1 (b2 (z1), omp_interop_none); |
| 61 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = v2 \\(z1\\);" 1 "gimple" } } */ |
| 62 |
/* { dg-final { scan-tree-dump-times "z1 = v1 \\(D\.\[0-9\]+, 0\\);" 1 "gimple" } } */ |
| 63 |
|
| 64 |
#pragma omp dispatch novariants(1) device(num3) |
| 65 |
z2 = v1 (b2 (z2), omp_interop_none); |
| 66 |
/* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(num3\\);" 1 "gimple" } } */ |
| 67 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = v2 \\(z2\\);" 1 "gimple" } } */ |
| 68 |
/* { dg-final { scan-tree-dump-times "z2 = v1 \\(D\.\[0-9\]+, 0\\);" 1 "gimple" } } */ |
| 69 |
|
| 70 |
return x1 + x2 + y1 + y2 + z1 + z2; |
| 71 |
} |