| 1 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 2 |
|
| 3 |
/* PR fortran/118321. */ |
| 4 |
|
| 5 |
/* Check that adjust_args applies to the right argument, |
| 6 |
if C++ inserts a 'this' pointer. */ |
| 7 |
|
| 8 |
struct t1 { |
| 9 |
void f1(int *x, int *y, int *z); |
| 10 |
#pragma omp declare variant(f1) match(construct={dispatch}) \ |
| 11 |
adjust_args(need_device_ptr : y) |
| 12 |
void g1(int *x, int *y, int *z); |
| 13 |
}; |
| 14 |
|
| 15 |
struct t2 { |
| 16 |
void f2(int *x, int *y, int *z); |
| 17 |
#pragma omp declare variant(f2) match(construct={dispatch}) \ |
| 18 |
adjust_args(need_device_ptr : x, y, z) |
| 19 |
void g2(int *x, int *y, int *z); |
| 20 |
}; |
| 21 |
|
| 22 |
struct t3 { |
| 23 |
void f3(int *x, int *y, int *z); |
| 24 |
#pragma omp declare variant(f3) match(construct={dispatch}) \ |
| 25 |
adjust_args(nothing : x, y, z) |
| 26 |
void g3(int *x, int *y, int *z); |
| 27 |
}; |
| 28 |
|
| 29 |
|
| 30 |
void test(int *a1, int *b1, int *c1, |
| 31 |
int *a2, int *b2, int *c2, |
| 32 |
int *a3, int *b3, int *c3) |
| 33 |
{ |
| 34 |
struct t1 s1; |
| 35 |
struct t2 s2; |
| 36 |
struct t3 s3; |
| 37 |
|
| 38 |
#pragma omp dispatch |
| 39 |
s1.g1 (a1, b1, c1); |
| 40 |
#pragma omp dispatch |
| 41 |
s2.g2 (a2, b2, c2); |
| 42 |
#pragma omp dispatch |
| 43 |
s3.g3 (a3, b3, c3); |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
/* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_default_device \\(\\);" 2 "gimple" } } */ |
| 48 |
|
| 49 |
/* { dg-final { scan-tree-dump-times "__builtin_omp_get_mapped_ptr" 4 "gimple" } } */ |
| 50 |
|
| 51 |
/* { dg-final { scan-tree-dump "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(b1, D\.\[0-9\]+\\);" "gimple" } } */ |
| 52 |
/* { dg-final { scan-tree-dump "t1::f1 \\(&s1, a1, D\.\[0-9\]+, c1\\);" "gimple" } } */ |
| 53 |
|
| 54 |
|
| 55 |
/* { dg-final { scan-tree-dump "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(c2, D\.\[0-9\]+\\);" "gimple" } } */ |
| 56 |
/* { dg-final { scan-tree-dump "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(b2, D\.\[0-9\]+\\);" "gimple" } } */ |
| 57 |
/* { dg-final { scan-tree-dump "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(a2, D\.\[0-9\]+\\);" "gimple" } } */ |
| 58 |
/* { dg-final { scan-tree-dump "t2::f2 \\(&s2, D\.\[0-9\]+, D\.\[0-9\]+, D\.\[0-9\]+\\);" "gimple" } } */ |
| 59 |
|
| 60 |
/* { dg-final { scan-tree-dump "t3::f3 \\(&s3, a3, b3, c3\\);" "gimple" } } */ |