22
33module {
44 func.func @pow_c4_i4(%arg0: complex<f32>, %arg1: i32) -> complex<f32> {
5- %c0 = arith.constant 0.0 : f32
6- %0 = fir.convert %arg1 : (i32) -> f32
7- %1 = complex.create %0, %c0 : complex<f32>
8- %2 = complex.pow %arg0, %1 : complex<f32>
9- return %2 : complex<f32>
5+ %0 = complex.powi %arg0, %arg1 : complex<f32>, i32
6+ return %0 : complex<f32>
7+ }
8+
9+ func.func @pow_c4_i4_fast(%arg0: complex<f32>, %arg1: i32) -> complex<f32> {
10+ %0 = complex.powi %arg0, %arg1 fastmath<fast> : complex<f32>, i32
11+ return %0 : complex<f32>
1012 }
1113
1214 func.func @pow_c4_i8(%arg0: complex<f32>, %arg1: i64) -> complex<f32> {
13- %c0 = arith.constant 0.0 : f32
14- %0 = fir.convert %arg1 : (i64) -> f32
15- %1 = complex.create %0, %c0 : complex<f32>
16- %2 = complex.pow %arg0, %1 : complex<f32>
17- return %2 : complex<f32>
15+ %0 = complex.powi %arg0, %arg1 : complex<f32>, i64
16+ return %0 : complex<f32>
1817 }
1918
2019 func.func @pow_c8_i4(%arg0: complex<f64>, %arg1: i32) -> complex<f64> {
21- %c0 = arith.constant 0.0 : f64
22- %0 = fir.convert %arg1 : (i32) -> f64
23- %1 = complex.create %0, %c0 : complex<f64>
24- %2 = complex.pow %arg0, %1 : complex<f64>
25- return %2 : complex<f64>
20+ %0 = complex.powi %arg0, %arg1 : complex<f64>, i32
21+ return %0 : complex<f64>
2622 }
2723
2824 func.func @pow_c8_i8(%arg0: complex<f64>, %arg1: i64) -> complex<f64> {
29- %c0 = arith.constant 0.0 : f64
30- %0 = fir.convert %arg1 : (i64) -> f64
31- %1 = complex.create %0, %c0 : complex<f64>
32- %2 = complex.pow %arg0, %1 : complex<f64>
33- return %2 : complex<f64>
25+ %0 = complex.powi %arg0, %arg1 : complex<f64>, i64
26+ return %0 : complex<f64>
3427 }
3528
3629 func.func @pow_c16_i4(%arg0: complex<f128>, %arg1: i32) -> complex<f128> {
37- %c0 = arith.constant 0.0 : f128
38- %0 = fir.convert %arg1 : (i32) -> f128
39- %1 = complex.create %0, %c0 : complex<f128>
40- %2 = complex.pow %arg0, %1 : complex<f128>
41- return %2 : complex<f128>
30+ %0 = complex.powi %arg0, %arg1 : complex<f128>, i32
31+ return %0 : complex<f128>
4232 }
4333
4434 func.func @pow_c16_i8(%arg0: complex<f128>, %arg1: i64) -> complex<f128> {
45- %c0 = arith.constant 0.0 : f128
46- %0 = fir.convert %arg1 : (i64) -> f128
47- %1 = complex.create %0, %c0 : complex<f128>
48- %2 = complex.pow %arg0, %1 : complex<f128>
49- return %2 : complex<f128>
35+ %0 = complex.powi %arg0, %arg1 : complex<f128>, i64
36+ return %0 : complex<f128>
5037 }
5138
5239 func.func @pow_c4_fast(%arg0: complex<f32>, %arg1: f32) -> complex<f32> {
@@ -74,26 +61,37 @@ module {
7461// CHECK-LABEL: func.func @pow_c4_i4(
7562// CHECK: fir.call @_FortranAcpowi(%{{.*}}, %{{.*}}) : (complex<f32>, i32) -> complex<f32>
7663// CHECK-NOT: complex.pow
64+ // CHECK-NOT: complex.powi
65+
66+ // CHECK-LABEL: func.func @pow_c4_i4_fast(
67+ // CHECK: fir.call @_FortranAcpowi(%{{.*}}, %{{.*}}) fastmath<fast> : (complex<f32>, i32) -> complex<f32>
68+ // CHECK-NOT: complex.pow
69+ // CHECK-NOT: complex.powi
7770
7871// CHECK-LABEL: func.func @pow_c4_i8(
7972// CHECK: fir.call @_FortranAcpowk(%{{.*}}, %{{.*}}) : (complex<f32>, i64) -> complex<f32>
8073// CHECK-NOT: complex.pow
74+ // CHECK-NOT: complex.powi
8175
8276// CHECK-LABEL: func.func @pow_c8_i4(
8377// CHECK: fir.call @_FortranAzpowi(%{{.*}}, %{{.*}}) : (complex<f64>, i32) -> complex<f64>
8478// CHECK-NOT: complex.pow
79+ // CHECK-NOT: complex.powi
8580
8681// CHECK-LABEL: func.func @pow_c8_i8(
8782// CHECK: fir.call @_FortranAzpowk(%{{.*}}, %{{.*}}) : (complex<f64>, i64) -> complex<f64>
8883// CHECK-NOT: complex.pow
84+ // CHECK-NOT: complex.powi
8985
9086// CHECK-LABEL: func.func @pow_c16_i4(
9187// CHECK: fir.call @_FortranAcqpowi(%{{.*}}, %{{.*}}) : (complex<f128>, i32) -> complex<f128>
9288// CHECK-NOT: complex.pow
89+ // CHECK-NOT: complex.powi
9390
9491// CHECK-LABEL: func.func @pow_c16_i8(
9592// CHECK: fir.call @_FortranAcqpowk(%{{.*}}, %{{.*}}) : (complex<f128>, i64) -> complex<f128>
9693// CHECK-NOT: complex.pow
94+ // CHECK-NOT: complex.powi
9795
9896// CHECK-LABEL: func.func @pow_c4_fast(
9997// CHECK: %[[EXP:.*]] = complex.create %{{.*}}, %{{.*}} : complex<f32>
@@ -108,4 +106,4 @@ module {
108106// CHECK-LABEL: func.func @pow_c16_complex(
109107// CHECK: %[[EXP:.*]] = complex.create %{{.*}}, %{{.*}} : complex<f128>
110108// CHECK: fir.call @_FortranACPowF128(%{{.*}}, %[[EXP]]) : (complex<f128>, complex<f128>) -> complex<f128>
111- // CHECK-NOT: complex.pow
109+ // CHECK-NOT: complex.pow
0 commit comments