Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90

raw
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 module m
9 use iso_c_binding, only: c_intptr_t
10 integer, parameter :: omp_interop_kind = c_intptr_t
11 contains
12 subroutine g(x,y,z)
13 integer(omp_interop_kind) :: x, y, z
14 value :: y
15 end
16 subroutine f()
17 !$omp declare variant(f: g) append_args(interop(target), interop(prefer_type("cuda","hip"), targetsync), interop(target,targetsync,prefer_type({attr("ompx_foo")}))) match(construct={dispatch})
18 end
19 end
20
21 use m
22 !$omp dispatch device(99)
23 call f()
24 end
25
26 ! { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(99, 3, &interopobjs\.\[0-9\]+, &tgt_tgtsync\.\[0-9\]+, &pref_type\.\[0-9\]+, " "gimple" } }
27 ! { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(99, 0, 0B, 0B, 0B, 0, 0B, 3, &interopobjs\.\[0-9\]+," "gimple" } }
28 ! { dg-final { scan-tree-dump "g \\(&interop\.\[0-9\]+, interop\.\[0-9\]+, &interop\.\[0-9\]+\\)" "gimple" } }