Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / Intrinsics / exponent.f90
blobe4db238c6d5a2b74d5467767f6ed53ad45f9d278
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! EXPONENT
4 ! CHECK-LABEL: exponent_test
5 subroutine exponent_test
7 integer :: i1, i2, i3, i4
8 ! CHECK: %[[i0:.*]] = fir.alloca i32 {bindc_name = "i1", uniq_name = "_QFexponent_testEi1"}
9 ! CHECK: %[[i1:.*]] = fir.alloca i32 {bindc_name = "i2", uniq_name = "_QFexponent_testEi2"}
10 ! CHECK: %[[i2:.*]] = fir.alloca i32 {bindc_name = "i3", uniq_name = "_QFexponent_testEi3"}
11 ! CHECK: %[[i3:.*]] = fir.alloca i32 {bindc_name = "i4", uniq_name = "_QFexponent_testEi4"}
13 real(kind = 4) :: x1
14 real(kind = 8) :: x2
15 real(kind = 10) :: x3
16 real(kind = 16) :: x4
17 ! CHECK: %[[x0:.*]] = fir.alloca f32 {bindc_name = "x1", uniq_name = "_QFexponent_testEx1"}
18 ! CHECK: %[[x1:.*]] = fir.alloca f64 {bindc_name = "x2", uniq_name = "_QFexponent_testEx2"}
19 ! CHECK: %[[x2:.*]] = fir.alloca f80 {bindc_name = "x3", uniq_name = "_QFexponent_testEx3"}
20 ! CHECK: %[[x3:.*]] = fir.alloca f128 {bindc_name = "x4", uniq_name = "_QFexponent_testEx4"}
22 i1 = exponent(x1)
23 ! CHECK: %[[temp0:.*]] = fir.load %[[x0:.*]] : !fir.ref<f32>
24 ! CHECK: %[[result0:.*]] = fir.call @_FortranAExponent4_4(%[[temp0:.*]]) {{.*}}: (f32) -> i32
25 ! CHECK: fir.store %[[result0:.*]] to %[[i0:.*]] : !fir.ref<i32>
27 i2 = exponent(x2)
28 ! CHECK: %[[temp1:.*]] = fir.load %[[x1:.*]] : !fir.ref<f64>
29 ! CHECK: %[[result1:.*]] = fir.call @_FortranAExponent8_4(%[[temp1:.*]]) {{.*}}: (f64) -> i32
30 ! CHECK: fir.store %[[result1:.*]] to %[[i1:.*]] : !fir.ref<i32>
32 i3 = exponent(x3)
33 ! CHECK: %[[temp2:.*]] = fir.load %[[x2:.*]] : !fir.ref<f80>
34 ! CHECK: %[[result2:.*]] = fir.call @_FortranAExponent10_4(%[[temp2:.*]]) {{.*}}: (f80) -> i32
35 ! CHECK: fir.store %[[result2:.*]] to %[[i2:.*]] : !fir.ref<i32>
37 i4 = exponent(x4)
38 ! CHECK: %[[temp3:.*]] = fir.load %[[x3:.*]] : !fir.ref<f128>
39 ! CHECK: %[[result3:.*]] = fir.call @_FortranAExponent16_4(%[[temp3:.*]]) {{.*}}: (f128) -> i32
40 ! CHECK: fir.store %[[result3:.*]] to %[[i3:.*]] : !fir.ref<i32>
41 end subroutine exponent_test