1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s --check-prefixes="CHECK,FAST"
2 ! RUN: bbc --math-runtime=precise -emit-fir %s -o - | FileCheck %s --check-prefixes="PRECISE"
3 ! RUN: bbc --disable-mlir-complex -emit-fir %s -o - | FileCheck %s --check-prefixes="PRECISE"
4 ! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s --check-prefixes="CHECK,FAST"
5 ! RUN: %flang_fc1 -emit-fir -mllvm --math-runtime=precise %s -o - | FileCheck %s --check-prefixes="PRECISE"
6 ! RUN: %flang_fc1 -emit-fir -mllvm --disable-mlir-complex %s -o - | FileCheck %s --check-prefixes="PRECISE"
8 ! Test power operation lowering
10 ! CHECK-LABEL: pow_r4_i4
11 subroutine pow_r4_i4(x
, y
, z
)
15 ! CHECK: math.fpowi {{.*}} : f32, i32
18 ! CHECK-LABEL: pow_r4_r4
19 subroutine pow_r4_r4(x
, y
, z
)
22 ! CHECK: math.powf %{{.*}}, %{{.*}} : f32
25 ! CHECK-LABEL: pow_r4_i8
26 subroutine pow_r4_i8(x
, y
, z
)
30 ! CHECK: math.fpowi {{.*}} : f32, i64
33 ! CHECK-LABEL: pow_r8_i4
34 subroutine pow_r8_i4(x
, y
, z
)
38 ! CHECK: math.fpowi {{.*}} : f64, i32
41 ! CHECK-LABEL: pow_r8_i8
42 subroutine pow_r8_i8(x
, y
, z
)
46 ! CHECK: math.fpowi {{.*}} : f64, i64
49 ! CHECK-LABEL: pow_r8_r8
50 subroutine pow_r8_r8(x
, y
, z
)
53 ! CHECK: math.powf %{{.*}}, %{{.*}} : f64
56 ! CHECK-LABEL: pow_r4_r8
57 subroutine pow_r4_r8(x
, y
, z
)
61 ! CHECK: %{{.*}} = fir.convert %{{.*}} : (f32) -> f64
62 ! CHECK: math.powf %{{.*}}, %{{.*}} : f64
65 ! CHECK-LABEL: pow_i1_i1
66 subroutine pow_i1_i1(x
, y
, z
)
69 ! CHECK: math.ipowi %{{.*}}, %{{.*}} : i8
72 ! CHECK-LABEL: pow_i2_i2
73 subroutine pow_i2_i2(x
, y
, z
)
76 ! CHECK: math.ipowi %{{.*}}, %{{.*}} : i16
79 ! CHECK-LABEL: pow_i4_i4
80 subroutine pow_i4_i4(x
, y
, z
)
83 ! CHECK: math.ipowi %{{.*}}, %{{.*}} : i32
86 ! CHECK-LABEL: pow_i8_i8
87 subroutine pow_i8_i8(x
, y
, z
)
90 ! CHECK: math.ipowi %{{.*}}, %{{.*}} : i64
93 ! CHECK-LABEL: pow_c4_i4
94 subroutine pow_c4_i4(x
, y
, z
)
98 ! CHECK: call @_FortranAcpowi
101 ! CHECK-LABEL: pow_c4_i8
102 subroutine pow_c4_i8(x
, y
, z
)
106 ! CHECK: call @_FortranAcpowk
109 ! CHECK-LABEL: pow_c8_i4
110 subroutine pow_c8_i4(x
, y
, z
)
114 ! CHECK: call @_FortranAzpowi
117 ! CHECK-LABEL: pow_c8_i8
118 subroutine pow_c8_i8(x
, y
, z
)
122 ! CHECK: call @_FortranAzpowk
125 ! CHECK-LABEL: pow_c4_c4
126 subroutine pow_c4_c4(x
, y
, z
)
129 ! FAST: complex.pow %{{.*}}, %{{.*}} : complex<f32>
130 ! PRECISE: call @cpowf
133 ! CHECK-LABEL: pow_c8_c8
134 subroutine pow_c8_c8(x
, y
, z
)
135 complex(8) :: x
, y
, z
137 ! FAST: complex.pow %{{.*}}, %{{.*}} : complex<f64>
138 ! PRECISE: call @cpow