Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/adjust-args-4.f90

raw
1 ! { dg-do compile }
2 ! { dg-additional-options "-fdump-tree-gimple" }
3
4 module main
5 use iso_c_binding, only: c_ptr
6 implicit none
7
8 type :: struct
9 integer :: a
10 real :: b
11 end type
12
13 interface
14 integer function f(a, b, c)
15 import c_ptr
16 integer, intent(in) :: a
17 type(c_ptr), intent(inout) :: b
18 type(c_ptr), intent(out) :: c
19 end function
20 integer function f0(a, b, c)
21 import c_ptr
22 integer, intent(in) :: a
23 type(c_ptr), intent(inout) :: b
24 type(c_ptr), intent(out) :: c
25 !$omp declare variant (f) match (construct={dispatch}) &
26 !$omp& adjust_args (nothing: a) adjust_args (need_device_ptr: b, c)
27 end function
28 integer function f1(a, b, c)
29 import c_ptr
30 integer, intent(in) :: a
31 type(c_ptr), intent(inout) :: b
32 type(c_ptr), intent(out) :: c
33 !$omp declare variant (f) match (construct={dispatch}) &
34 !$omp& adjust_args (nothing: a) adjust_args (need_device_ptr: b) adjust_args (need_device_ptr: c)
35 end function
36 end interface
37
38 contains
39 subroutine test
40 integer :: a
41 type(c_ptr) :: b
42 type(c_ptr) :: c(2)
43 type(struct) :: s
44
45 s%a = f0 (a, b, c)
46 !$omp dispatch
47 s%a = f0 (a, b, c)
48
49 s%b = f1 (a, b, c)
50 !$omp dispatch
51 s%b = f1 (a, b, c)
52
53 end subroutine
54 end module
55
56 ! { dg-final { scan-tree-dump-times "__builtin_omp_get_default_device \\(\\);" 2 "gimple" } }
57 ! { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(c, D\.\[0-9]+\\);" 2 "gimple" } }
58 ! { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(b\.\[0-9]+, D\.\[0-9]+\\);" 2 "gimple" } }