xref: /llvm-project/flang/test/Semantics/cuf15.cuf (revision e8eb52d167eb2bf972b3cfa67ff1028b86cd209d)
1! RUN: bbc -emit-hlfir -fcuda -gpu=managed %s -o - | FileCheck %s
2
3module matching
4  interface host_and_device
5    module procedure sub_host
6    module procedure sub_device
7  end interface
8
9  interface all
10    module procedure sub_host
11    module procedure sub_device
12    module procedure sub_managed
13    module procedure sub_unified
14  end interface
15
16  interface all_without_managed
17    module procedure sub_host
18    module procedure sub_device
19    module procedure sub_unified
20  end interface
21
22contains
23  subroutine sub_host(a)
24    integer :: a(:)
25  end
26
27  subroutine sub_device(a)
28    integer, device :: a(:)
29  end
30
31  subroutine sub_managed(a)
32    integer, managed :: a(:)
33  end
34
35  subroutine sub_unified(a)
36    integer, unified :: a(:)
37  end
38end module
39
40program m
41  use matching
42
43  integer, allocatable :: actual_host(:)
44
45  allocate(actual_host(10))
46
47  call host_and_device(actual_host)     ! Should resolve to sub_device
48  call all(actual_host)                 ! Should resolved to unified
49  call all_without_managed(actual_host) ! Should resolved to managed
50end
51
52! CHECK: fir.call @_QMmatchingPsub_device
53! CHECK: fir.call @_QMmatchingPsub_managed
54! CHECK: fir.call @_QMmatchingPsub_unified
55
56