52 lines · plain
1! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s2 3! Check insertion of runtime checks in host side only4 5module section_test6 7contains8 9 subroutine foo(a)10 real, device, dimension(:,:) :: a11 end subroutine12 13 subroutine test_host()14 real, device, allocatable, dimension(:,:) :: a15 allocate(a(10,10))16 call foo(a(1:10,1:10:2))17 end subroutine18 19! CHECK-LABEL: func.func @_QMsection_testPtest_host()20! CHECK: fir.call @_FortranACUFDescriptorCheckSection21! CHECK: fir.call @_QMsection_testPfoo22 23 attributes(device) subroutine zoo(a)24 real, device, dimension(:,:) :: a25 end subroutine26 27 attributes(global) subroutine test_device()28 real, device, allocatable, dimension(:,:) :: a29 allocate(a(10,10))30 call zoo(a(1:10,1:10:2))31 end subroutine32 33! CHECK-LABEL: func.func @_QMsection_testPtest_device()34! CHECK-NOT: fir.call @_FortranACUFDescriptorCheckSection35! CHECK: fir.call @_QMsection_testPzoo36 37 subroutine ignore(a)38 real, device, dimension(:,:) :: a39 !dir$ ignore_tkr(c) a40 end subroutine41 42 subroutine test_host2()43 real, device, allocatable, dimension(:,:) :: a44 allocate(a(10,10))45 call ignore(a(1:10,1:10:2))46 end subroutine47 48! CHECK-LABEL: func.func @_QMsection_testPtest_host2()49! CHECK-NOT: fir.call @_FortranACUFDescriptorCheckSection50! CHECK: fir.call @_QMsection_testPignore51end module52