38 lines · plain
1!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 %s -o - | FileCheck %s2!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 -fopenmp-is-device %s -o - | FileCheck %s3 4program main5 use, intrinsic :: iso_c_binding6 implicit none7 interface8 subroutine myinit(priv, orig) bind(c,name="myinit")9 use, intrinsic :: iso_c_binding10 implicit none11 integer::priv, orig12 end subroutine myinit13 14 function mycombine(lhs, rhs) bind(c,name="mycombine")15 use, intrinsic :: iso_c_binding16 implicit none17 integer::lhs, rhs, mycombine18 end function mycombine19 end interface20 !$omp declare reduction(myreduction:integer:omp_out = mycombine(omp_out, omp_in)) initializer(myinit(omp_priv, omp_orig))21 22 integer :: i, s, a(10)23 !$omp target24 s = 025 !$omp do reduction(myreduction:s)26 do i = 1, 1027 s = mycombine(s, a(i))28 enddo29 !$omp end do30 !$omp end target31 end program main32 33!CHECK: func.func {{.*}} @myinit(!fir.ref<i32>, !fir.ref<i32>)34!CHECK-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), automap = false>{{.*}}35!CHECK-LABEL: func.func {{.*}} @mycombine(!fir.ref<i32>, !fir.ref<i32>)36!CHECK-SAME: {{.*}}, omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), automap = false>{{.*}}37 38