brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 528563a Raw
61 lines · plain
1!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 %s -o - | FileCheck %s --check-prefixes ALL,HOST2!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 -fopenmp-is-device %s -o - | FileCheck %s --check-prefixes ALL3 4program main5    use, intrinsic ::  iso_c_binding6    implicit none7    interface8    subroutine any_interface()  bind(c,name="any_interface")9        use, intrinsic :: iso_c_binding10        implicit none11    !$omp declare target enter(any_interface) device_type(any)12    end subroutine any_interface13 14    subroutine host_interface()  bind(c,name="host_interface")15      use, intrinsic :: iso_c_binding16      implicit none17   !$omp declare target enter(host_interface) device_type(host)18    end subroutine host_interface19 20    subroutine device_interface()  bind(c,name="device_interface")21        use, intrinsic :: iso_c_binding22        implicit none23    !$omp declare target enter(device_interface) device_type(nohost)24    end subroutine device_interface25 26    subroutine called_from_target_interface(f1, f2) bind(c,name="called_from_target_interface")27        use, intrinsic :: iso_c_binding28        implicit none29        type(c_funptr),value :: f130        type(c_funptr),value :: f231    end subroutine called_from_target_interface32 33    subroutine called_from_host_interface(f1) bind(c,name="called_from_host_interface")34      use, intrinsic :: iso_c_binding35      implicit none36      type(c_funptr),value :: f137    end subroutine called_from_host_interface38 39    subroutine unused_unemitted_interface()  bind(c,name="unused_unemitted_interface")40      use, intrinsic :: iso_c_binding41      implicit none42    !$omp declare target enter(unused_unemitted_interface) device_type(nohost)43    end subroutine unused_unemitted_interface44 45    end interface46 47    CALL called_from_host_interface(c_funloc(host_interface))48!$omp target49    CALL called_from_target_interface(c_funloc(any_interface), c_funloc(device_interface))50!$omp end target51 end program main52 53!HOST-LABEL: func.func {{.*}} @host_interface()54!HOST-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter), automap = false>{{.*}}55!ALL-LABEL: func.func {{.*}} @called_from_target_interface(!fir.ref<i64>, !fir.ref<i64>)56!ALL-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), automap = false>{{.*}}57!ALL-LABEL: func.func {{.*}} @any_interface()58!ALL-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter), automap = false>{{.*}}59!ALL-LABEL: func.func {{.*}} @device_interface()60!ALL-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter), automap = false>{{.*}}61