Debian Codegraph @

gcc/testsuite/g++.dg/gomp/dispatch-7.C

raw
1 // { dg-do compile { target c++11 } }
2
3
4 template<typename T>
5 T templ_var_fn(T x);
6
7
8 template<typename T> [[omp::directive (declare variant(templ_var_fn) match(construct={dispatch}) adjust_args(need_device_ptr: x))]]
9 T templ_base_fn(T x);
10
11 template<typename T, typename TB>
12 void f(int *y, TB x)
13 {
14 [[omp::directive (dispatch nocontext (x))]]
15 y = templ_base_fn<T> (y);
16 [[omp::directive (dispatch novariants (x))]]
17 y = templ_base_fn<T> (y);
18 }
19
20 void bar()
21 {
22 int a;
23 bool b = true;
24 f<int*,bool> (&a, b);
25 }
26
27
28 void variant_fn(int *x, int *y, int *z);
29
30 [[omp::directive (declare variant(variant_fn) match(construct={dispatch}) adjust_args(need_device_ptr: x,y) adjust_args(nothing: z))]]
31 void bar(int *x, int *y, int *z);
32
33 void sub(int *x, int *y, int *z)
34 {
35 [[omp::directive (dispatch is_device_ptr(y))]]
36 bar(x, y, z);
37 [[omp::directive (dispatch device(0))]]
38 bar(x, y, z);
39 [[omp::directive (dispatch nocontext(1) novariants(1))]]
40 bar(x, y, z);
41 [[omp::directive (dispatch depend(inout: x) nowait)]]
42 bar(x, y, z);
43 }