@@ -7,16 +7,27 @@ function use_dsecnds(refTime) result(elapsed)
77 elapsed = dsecnds(refTime)
88end function
99
10- ! Verify filename and line operands are passed into runtime call
10+ ! The argument is lowered with hlfir.declare, which returns two results.
11+ ! Capture it here to check that the correct SSA value (%...#0)
12+ ! is passed to the runtime call later
13+ ! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[arg0]] dummy_scope
14+
15+ ! The file name and source line are also lowered and passed as runtime arguments
16+ ! Capture the constant line number and convert the file name to i8*.
1117! CHECK: %[[STRADDR:.*]] = fir.address_of(
1218! CHECK: %[[LINE:.*]] = arith.constant {{.*}} : i32
1319! CHECK: %[[FNAME8:.*]] = fir.convert %[[STRADDR]] : (!fir.ref<!fir.char<1,{{.*}}>>) -> !fir.ref<i8>
1420
15- ! Call the runtime DSECNDS with (refTime, file, line)
16- ! CHECK: %[[CALL:.*]] = fir.call @_FortranADsecnds(%{{.*}}, %{{.*}}, %{{.*}}) {{.*}} : (!fir.ref<f64>, !fir.ref<i8>, i32) -> f64
21+ ! Verify the runtime call is made with:
22+ ! - the declared refTime value (%[[DECL]]#0)
23+ ! - the converted filename
24+ ! - the source line constant
25+ ! CHECK: %[[CALL:.*]] = fir.call @_FortranADsecnds(%[[DECL]]#0, %[[FNAME8]], %[[LINE]]) {{.*}} : (!fir.ref<f64>, !fir.ref<i8>, i32) -> f64
1726
18- ! Guard: no illegal ref conversion
27+ ! Ensure there is no illegal conversion of a value result into a reference
1928! CHECK-NOT: fir.convert {{.*}} : (f64) -> !fir.ref<f64>
2029
21- ! Function returns f64
30+ ! Confirm the function result is returned as a plain f64
2231! CHECK: return {{.*}} : f64
32+
33+
0 commit comments