brintos

brintos / llvm-project-archived public Read only

0
0
Text · 872 B · 5f7dcb0 Raw
24 lines · plain
1! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s2 3! CHECK-LABEL: func.func @_QPuse_secnds(4! CHECK-SAME: %arg0: !fir.ref<f32>5function use_secnds(refTime) result(elapsed)6  real :: refTime, elapsed7  elapsed = secnds(refTime)8end function9 10! File/line operands (don’t match the actual path/number)11! CHECK: %[[STRADDR:.*]] = fir.address_of(12! CHECK: %[[LINE:.*]] = arith.constant {{.*}} : i3213! CHECK: %[[FNAME8:.*]] = fir.convert %[[STRADDR]] : (!fir.ref<!fir.char<1,{{.*}}>>) -> !fir.ref<i8>14 15! Important: pass refTime by address and return a value f3216! CHECK: %[[CALL:.*]] = fir.call @{{.*}}Secnds(%arg0, %[[FNAME8]], %[[LINE]]) {{.*}} : (!fir.ref<f32>, !fir.ref<i8>, i32) -> f3217 18! Guard against illegal value ->ref conversion of result19! CHECK-NOT: fir.convert {{.*}} : (f32) -> !fir.ref<f32>20 21! Function returns an f32 value22! CHECK: return {{.*}} : f3223 24