brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · cdac719 Raw
34 lines · plain
1! Test lowering of intrinsic module procedures to HLFIR. This2! test is not meant to test every intrinsic module procedure,3! it only tests that the HFLIR procedure reference lowering4! infrastructure properly detects and dispatches intrinsic module5! procedure calls.6! RUN: bbc -emit-hlfir -o - %s | FileCheck %s7 8subroutine foo(cptr, x)9  use iso_c_binding, only : c_ptr, c_loc10  type(c_ptr) :: cptr11  integer, target :: x12  cptr = c_loc(x)13end subroutine14! CHECK-LABEL: func.func @_QPfoo(15! CHECK:         %[[VAL_3:.*]]:2 = hlfir.declare {{.*}}Ecptr"16! CHECK:         %[[VAL_3:.*]]:2 = hlfir.declare {{.*}}Ex"17! CHECK:         %[[VAL_4:.*]] = fir.embox %[[VAL_3]]#0 : (!fir.ref<i32>) -> !fir.box<i32>18! CHECK:         %[[VAL_5:.*]] = fir.alloca !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>19! CHECK:         %[[VAL_7:.*]] = fir.coordinate_of %[[VAL_5]], __address : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) -> !fir.ref<i64>20! CHECK:         %[[VAL_8:.*]] = fir.box_addr %[[VAL_4]] : (!fir.box<i32>) -> !fir.ref<i32>21! CHECK:         %[[VAL_9:.*]] = fir.convert %[[VAL_8]] : (!fir.ref<i32>) -> i6422! CHECK:         fir.store %[[VAL_9]] to %[[VAL_7]] : !fir.ref<i64>23 24subroutine test_renaming(p)25  use iso_c_binding, only: c_associated_alias => c_associated, c_ptr26  type(c_ptr) p27  print *, c_associated_alias(p)28end subroutine29 30! CHECK-LABEL: func.func @_QPtest_renaming31! CHECK:  %[[C_PTR_TARG:.*]] = fir.load %{{.*}} : !fir.ref<i64>32! CHECK:  %[[NULL:.*]] = arith.constant 0 : i6433! CHECK:  arith.cmpi ne, %[[C_PTR_TARG]], %[[NULL]] : i6434