| 1 |
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s |
| 2 |
|
| 3 |
! CHECK-LABEL: func @_QPaint_test( |
| 4 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<f32>{{.*}}, %[[VAL_1:.*]]: !fir.ref<f32>{{.*}}) { |
| 5 |
subroutine aint_test(a, b) |
| 6 |
! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_0]] : !fir.ref<f32> |
| 7 |
! CHECK: %[[VAL_3:.*]] = fir.call @llvm.trunc.f32(%[[VAL_2]]) {{.*}}: (f32) -> f32 |
| 8 |
! CHECK: fir.store %[[VAL_3]] to %[[VAL_1]] : !fir.ref<f32> |
| 9 |
! CHECK: return |
| 10 |
real :: a, b |
| 11 |
b = aint(a) |
| 12 |
end subroutine |
| 13 |
|
| 14 |
! CHECK-LABEL: func.func @_QPaint_test_real8( |
| 15 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<f64> {fir.bindc_name = "a"}, |
| 16 |
! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<f64> {fir.bindc_name = "b"}) { |
| 17 |
! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_0]] : !fir.ref<f64> |
| 18 |
! CHECK: %[[VAL_3:.*]] = fir.call @llvm.trunc.f64(%[[VAL_2]]) {{.*}}: (f64) -> f64 |
| 19 |
! CHECK: fir.store %[[VAL_3]] to %[[VAL_1]] : !fir.ref<f64> |
| 20 |
! CHECK: return |
| 21 |
! CHECK: } |
| 22 |
|
| 23 |
subroutine aint_test_real8(a, b) |
| 24 |
real(8) :: a, b |
| 25 |
b = aint(a) |
| 26 |
end subroutine |
| 27 |
|
| 28 |
! CHECK-LABEL: func.func @_QPaint_test_real10( |
| 29 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<f80> {fir.bindc_name = "a"}, |
| 30 |
! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<f80> {fir.bindc_name = "b"}) { |
| 31 |
! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_0]] : !fir.ref<f80> |
| 32 |
! CHECK: %[[VAL_3:.*]] = fir.call @llvm.trunc.f80(%[[VAL_2]]) {{.*}}: (f80) -> f80 |
| 33 |
! CHECK: fir.store %[[VAL_3]] to %[[VAL_1]] : !fir.ref<f80> |
| 34 |
! CHECK: return |
| 35 |
! CHECK: } |
| 36 |
|
| 37 |
subroutine aint_test_real10(a, b) |
| 38 |
real(10) :: a, b |
| 39 |
b = aint(a) |
| 40 |
end subroutine |
| 41 |
|
| 42 |
! TODO: wait until fp128 is supported well in llvm.trunc |
| 43 |
!subroutine aint_test_real16(a, b) |
| 44 |
! real(16) :: a, b |
| 45 |
! b = aint(a) |
| 46 |
!end subroutine |