Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / Intrinsics / set_exponent.f90
blobc22c935a76482542b3e28fb6b6184cef235a6a2f
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
2 ! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
4 ! SET_EXPONENT
5 ! CHECK-LABEL: set_exponent_test
6 subroutine set_exponent_test
8 real(kind = 4) :: x1 = 178.1378e-4
9 real(kind = 8) :: x2 = 178.1378e-4
10 real(kind = 10) :: x3 = 178.1378e-4
11 real(kind = 16) :: x4 = 178.1378e-4
12 integer :: i = 17
13 ! CHECK: %[[addri:.*]] = fir.address_of(@_QFset_exponent_testEi) : !fir.ref<i32>
14 ! CHECK: %[[addrx1:.*]] = fir.address_of(@_QFset_exponent_testEx1) : !fir.ref<f32>
15 ! CHECK: %[[addrx2:.*]] = fir.address_of(@_QFset_exponent_testEx2) : !fir.ref<f64>
16 ! CHECK: %[[addrx3:.*]] = fir.address_of(@_QFset_exponent_testEx3) : !fir.ref<f80>
17 ! CHECK: %[[addrx4:.*]] = fir.address_of(@_QFset_exponent_testEx4) : !fir.ref<f128>
19 x1 = set_exponent(x1, i)
20 ! CHECK: %[[x1:.*]] = fir.load %[[addrx1:.*]] : !fir.ref<f32>
21 ! CHECK: %[[i1:.*]] = fir.load %[[addri:.*]] : !fir.ref<i32>
22 ! CHECK: %[[i64v1:.*]] = fir.convert %[[i1:.*]] : (i32) -> i64
23 ! CHECK: %[[result1:.*]] = fir.call @_FortranASetExponent4(%[[x1:.*]], %[[i64v1:.*]]) {{.*}}: (f32, i64) -> f32
24 ! CHECK: fir.store %[[result1:.*]] to %[[addrx1:.*]] : !fir.ref<f32>
26 x2 = set_exponent(x2, i)
27 ! CHECK: %[[x2:.*]] = fir.load %[[addrx2:.*]] : !fir.ref<f64>
28 ! CHECK: %[[i2:.*]] = fir.load %[[addri:.*]] : !fir.ref<i32>
29 ! CHECK: %[[i64v2:.*]] = fir.convert %[[i2:.*]] : (i32) -> i64
30 ! CHECK: %[[result2:.*]] = fir.call @_FortranASetExponent8(%[[x2:.*]], %[[i64v2:.*]]) {{.*}}: (f64, i64) -> f64
31 ! CHECK: fir.store %[[result2:.*]] to %[[addrx2:.*]] : !fir.ref<f64>
33 x3 = set_exponent(x3, i)
34 ! CHECK: %[[x3:.*]] = fir.load %[[addrx3:.*]] : !fir.ref<f80>
35 ! CHECK: %[[i3:.*]] = fir.load %[[addri:.*]] : !fir.ref<i32>
36 ! CHECK: %[[i64v3:.*]] = fir.convert %[[i3:.*]] : (i32) -> i64
37 ! CHECK: %[[result3:.*]] = fir.call @_FortranASetExponent10(%[[x3:.*]], %[[i64v3:.*]]) {{.*}}: (f80, i64) -> f80
38 ! CHECK: fir.store %[[result3:.*]] to %[[addrx3:.*]] : !fir.ref<f80>
40 x4 = set_exponent(x4, i)
41 ! CHECK: %[[x4:.*]] = fir.load %[[addrx4:.*]] : !fir.ref<f128>
42 ! CHECK: %[[i4:.*]] = fir.load %[[addri:.*]] : !fir.ref<i32>
43 ! CHECK: %[[i64v4:.*]] = fir.convert %18 : (i32) -> i64
44 ! CHECK: %[[result4:.*]] = fir.call @_FortranASetExponent16(%[[x4:.*]], %[[i64v4:.*]]) {{.*}}: (f128, i64) -> f128
45 ! CHECK: fir.store %[[result4:.*]] to %[[addrx4:.*]] : !fir.ref<f128>
46 end subroutine set_exponent_test