Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / Intrinsics / scale.f90
blob6f6324ec8822da234f5aed038b9a01e4760b28f3
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! CHECK-LABEL: scale_test1
4 subroutine scale_test1(x, i)
5 real :: x, res
6 ! CHECK: %[[res:.*]] = fir.alloca f32 {bindc_name = "res", uniq_name = "_QFscale_test1Eres"}
7 ! CHECK: %[[x:.*]] = fir.load %arg0 : !fir.ref<f32>
8 integer :: i
9 ! CHECK: %[[i0:.*]] = fir.load %arg1 : !fir.ref<i32>
10 res = scale(x, i)
11 ! CHECK: %[[i1:.*]] = fir.convert %[[i0]] : (i32) -> i64
12 ! CHECK: %[[tmp:.*]] = fir.call @_FortranAScale4(%[[x]], %[[i1]]) {{.*}}: (f32, i64) -> f32
13 ! CHECK: fir.store %[[tmp]] to %[[res]] : !fir.ref<f32>
14 end subroutine scale_test1
16 ! CHECK-LABEL: scale_test2
17 subroutine scale_test2(x, i)
18 real(kind=8) :: x, res
19 ! CHECK: %[[res:.*]] = fir.alloca f64 {bindc_name = "res", uniq_name = "_QFscale_test2Eres"}
20 ! CHECK: %[[x:.*]] = fir.load %arg0 : !fir.ref<f64>
21 integer :: i
22 ! CHECK: %[[i0:.*]] = fir.load %arg1 : !fir.ref<i32>
23 res = scale(x, i)
24 ! CHECK: %[[i1:.*]] = fir.convert %[[i0]] : (i32) -> i64
25 ! CHECK: %[[tmp:.*]] = fir.call @_FortranAScale8(%[[x]], %[[i1]]) {{.*}}: (f64, i64) -> f64
26 ! CHECK: fir.store %[[tmp]] to %[[res]] : !fir.ref<f64>
27 end subroutine scale_test2
29 ! CHECK-LABEL: scale_test3
30 subroutine scale_test3(x, i)
31 real(kind=10) :: x, res
32 ! CHECK: %[[res:.*]] = fir.alloca f80 {bindc_name = "res", uniq_name = "_QFscale_test3Eres"}
33 ! CHECK: %[[x:.*]] = fir.load %arg0 : !fir.ref<f80>
34 integer :: i
35 ! CHECK: %[[i0:.*]] = fir.load %arg1 : !fir.ref<i32>
36 res = scale(x, i)
37 ! CHECK: %[[i1:.*]] = fir.convert %[[i0]] : (i32) -> i64
38 ! CHECK: %[[tmp:.*]] = fir.call @_FortranAScale10(%[[x]], %[[i1]]) {{.*}}: (f80, i64) -> f80
39 ! CHECK: fir.store %[[tmp]] to %[[res]] : !fir.ref<f80>
40 end subroutine scale_test3
42 ! CHECK-LABEL: scale_test4
43 subroutine scale_test4(x, i)
44 real(kind=16) :: x, res
45 ! CHECK: %[[res:.*]] = fir.alloca f128 {bindc_name = "res", uniq_name = "_QFscale_test4Eres"}
46 ! CHECK: %[[x:.*]] = fir.load %arg0 : !fir.ref<f128>
47 integer :: i
48 ! CHECK: %[[i0:.*]] = fir.load %arg1 : !fir.ref<i32>
49 res = scale(x, i)
50 ! CHECK: %[[i1:.*]] = fir.convert %[[i0]] : (i32) -> i64
51 ! CHECK: %[[tmp:.*]] = fir.call @_FortranAScale16(%[[x]], %[[i1]]) {{.*}}: (f128, i64) -> f128
52 ! CHECK: fir.store %[[tmp]] to %[[res]] : !fir.ref<f128>
53 end subroutine scale_test4