@@ -222,10 +222,11 @@ func.func @roundf_func(%a: f32) -> f32 {
222
222
// CHECK-SAME: ([[ARG0:%.+]]: f64, [[ARG1:%.+]]: f64)
223
223
func.func @powf_func (%a: f64 , %b: f64 ) ->f64 {
224
224
// CHECK-DAG: [[CST0:%.+]] = arith.constant 0.000000e+00
225
+ // CHECK-DAG: [[CST1:%.+]] = arith.constant 1.0
225
226
// CHECK-DAG: [[TWO:%.+]] = arith.constant 2.000000e+00
226
227
// CHECK-DAG: [[NEGONE:%.+]] = arith.constant -1.000000e+00
227
228
// CHECK-DAG: [[SQR:%.+]] = arith.mulf [[ARG0]], [[ARG0]]
228
- // CHECK-DAG: [[HALF:%.+]] = arith.divf [[ARG1]], [[TWO]]
229
+ // CHECK-DAG: [[HALF:%.+]] = arith.divf [[ARG1]], [[TWO]]
229
230
// CHECK-DAG: [[LOG:%.+]] = math.log [[SQR]]
230
231
// CHECK-DAG: [[MULT:%.+]] = arith.mulf [[HALF]], [[LOG]]
231
232
// CHECK-DAG: [[EXPR:%.+]] = math.exp [[MULT]]
@@ -234,8 +235,10 @@ func.func @powf_func(%a: f64, %b: f64) ->f64 {
234
235
// CHECK-DAG: [[CMPNEG:%.+]] = arith.cmpf olt, [[ARG0]]
235
236
// CHECK-DAG: [[CMPZERO:%.+]] = arith.cmpf one, [[REMF]]
236
237
// CHECK-DAG: [[AND:%.+]] = arith.andi [[CMPZERO]], [[CMPNEG]]
238
+ // CHECK-DAG: [[CMPZERO:%.+]] = arith.cmpf oeq, [[ARG1]], [[CST0]]
237
239
// CHECK-DAG: [[SEL:%.+]] = arith.select [[AND]], [[NEGEXPR]], [[EXPR]]
238
- // CHECK: return [[SEL]]
240
+ // CHECK-DAG: [[SEL1:%.+]] = arith.select [[CMPZERO]], [[CST1]], [[SEL]]
241
+ // CHECK: return [[SEL1]]
239
242
%ret = math.powf %a , %b : f64
240
243
return %ret : f64
241
244
}
@@ -516,7 +519,7 @@ func.func @roundeven16(%arg: f16) -> f16 {
516
519
517
520
// CHECK-LABEL: func.func @math_fpowi_neg_odd_power
518
521
func.func @math_fpowi_neg_odd_power (%0 : tensor <8 xf32 >) -> tensor <8 xf32 > {
519
- %1 = arith.constant dense <-3 > : tensor <8 xi64 >
522
+ %1 = arith.constant dense <-3 > : tensor <8 xi64 >
520
523
%2 = math.fpowi %0 , %1 : tensor <8 xf32 >, tensor <8 xi64 >
521
524
return %2 : tensor <8 xf32 >
522
525
}
@@ -539,7 +542,7 @@ func.func @math_fpowi_neg_odd_power(%0 : tensor<8xf32>) -> tensor<8xf32> {
539
542
540
543
// CHECK-LABEL: func.func @math_fpowi_neg_even_power
541
544
func.func @math_fpowi_neg_even_power (%0 : tensor <8 xf32 >) -> tensor <8 xf32 > {
542
- %1 = arith.constant dense <-4 > : tensor <8 xi64 >
545
+ %1 = arith.constant dense <-4 > : tensor <8 xi64 >
543
546
%2 = math.fpowi %0 , %1 : tensor <8 xf32 >, tensor <8 xi64 >
544
547
return %2 : tensor <8 xf32 >
545
548
}
@@ -562,7 +565,7 @@ func.func @math_fpowi_neg_even_power(%0 : tensor<8xf32>) -> tensor<8xf32> {
562
565
563
566
// CHECK-LABEL: func.func @math_fpowi_pos_odd_power
564
567
func.func @math_fpowi_pos_odd_power (%0 : tensor <8 xf32 >) -> tensor <8 xf32 > {
565
- %1 = arith.constant dense <5 > : tensor <8 xi64 >
568
+ %1 = arith.constant dense <5 > : tensor <8 xi64 >
566
569
%2 = math.fpowi %0 , %1 : tensor <8 xf32 >, tensor <8 xi64 >
567
570
return %2 : tensor <8 xf32 >
568
571
}
@@ -576,7 +579,7 @@ func.func @math_fpowi_pos_odd_power(%0 : tensor<8xf32>) -> tensor<8xf32> {
576
579
577
580
// CHECK-LABEL: func.func @math_fpowi_pos_even_power
578
581
func.func @math_fpowi_pos_even_power (%0 : tensor <8 xf32 >) -> tensor <8 xf32 > {
579
- %1 = arith.constant dense <4 > : tensor <8 xi64 >
582
+ %1 = arith.constant dense <4 > : tensor <8 xi64 >
580
583
%2 = math.fpowi %0 , %1 : tensor <8 xf32 >, tensor <8 xi64 >
581
584
return %2 : tensor <8 xf32 >
582
585
}
@@ -617,9 +620,10 @@ func.func @math_fpowi_to_powf_tensor(%0 : tensor<8xf32>, %1: tensor<8xi32>) -> t
617
620
return %2 : tensor <8 xf32 >
618
621
}
619
622
// CHECK-SAME: (%[[ARG0:.*]]: tensor<8xf32>, %[[ARG1:.*]]: tensor<8xi32>) -> tensor<8xf32> {
620
- // CHECK: %[[CSTNEG1:.*]] = arith.constant dense<-1.000000e+00> : tensor<8xf32>
621
- // CHECK: %[[CST2:.*]] = arith.constant dense<2.000000e+00> : tensor<8xf32>
622
- // CHECK: %[[CST0:.*]] = arith.constant dense<0.000000e+00> : tensor<8xf32>
623
+ // CHECK-DAG: %[[CSTNEG1:.*]] = arith.constant dense<-1.000000e+00> : tensor<8xf32>
624
+ // CHECK-DAG: %[[CST2:.*]] = arith.constant dense<2.000000e+00> : tensor<8xf32>
625
+ // CHECK-DAG: %[[CST0:.*]] = arith.constant dense<0.000000e+00> : tensor<8xf32>
626
+ // CHECK-DAG: %[[CST1:.+]] = arith.constant dense<1.000000e+00> : tensor<8xf32>
623
627
// CHECK: %[[TOFP:.*]] = arith.sitofp %[[ARG1]] : tensor<8xi32> to tensor<8xf32>
624
628
// CHECK: %[[SQ:.*]] = arith.mulf %[[ARG0]], %[[ARG0]] : tensor<8xf32>
625
629
// CHECK: %[[DIV:.*]] = arith.divf %[[TOFP]], %[[CST2]] : tensor<8xf32>
@@ -631,8 +635,10 @@ func.func @math_fpowi_to_powf_tensor(%0 : tensor<8xf32>, %1: tensor<8xi32>) -> t
631
635
// CHECK: %[[CMPF:.*]] = arith.cmpf olt, %[[ARG0]], %[[CST0]] : tensor<8xf32>
632
636
// CHECK: %[[CMPF1:.*]] = arith.cmpf one, %[[REM]], %[[CST0]] : tensor<8xf32>
633
637
// CHECK: %[[AND:.*]] = arith.andi %[[CMPF1]], %[[CMPF]] : tensor<8xi1>
638
+ // CHECK: %[[CMPZERO:.*]] = arith.cmpf oeq, %[[TOFP]], %[[CST0]]
634
639
// CHECK: %[[SEL:.*]] = arith.select %[[AND]], %[[MUL1]], %[[EXP]] : tensor<8xi1>, tensor<8xf32>
635
- // CHECK: return %[[SEL]] : tensor<8xf32>
640
+ // CHECK: %[[SEL1:.+]] = arith.select %[[CMPZERO]], %[[CST1]], %[[SEL]]
641
+ // CHECK: return %[[SEL1]] : tensor<8xf32>
636
642
637
643
// -----
638
644
@@ -642,9 +648,10 @@ func.func @math_fpowi_to_powf_scalar(%0 : f32, %1: i64) -> f32 {
642
648
return %2 : f32
643
649
}
644
650
// CHECK-SAME: (%[[ARG0:.*]]: f32, %[[ARG1:.*]]: i64) -> f32 {
645
- // CHECK: %[[CSTNEG1:.*]] = arith.constant -1.000000e+00 : f32
646
- // CHECK: %[[CST2:.*]] = arith.constant 2.000000e+00 : f32
647
- // CHECK: %[[CST0:.*]] = arith.constant 0.000000e+00 : f32
651
+ // CHECK-DAG: %[[CSTNEG1:.*]] = arith.constant -1.000000e+00 : f32
652
+ // CHECK-DAG: %[[CST2:.*]] = arith.constant 2.000000e+00 : f32
653
+ // CHECK-DAG: %[[CST0:.*]] = arith.constant 0.000000e+00 : f32
654
+ // CHECK-DAG: %[[CST1:.+]] = arith.constant 1.000000e+00 : f32
648
655
// CHECK: %[[TOFP:.*]] = arith.sitofp %[[ARG1]] : i64 to f32
649
656
// CHECK: %[[SQ:.*]] = arith.mulf %[[ARG0]], %[[ARG0]] : f32
650
657
// CHECK: %[[DIV:.*]] = arith.divf %[[TOFP]], %[[CST2]] : f32
@@ -656,8 +663,10 @@ func.func @math_fpowi_to_powf_scalar(%0 : f32, %1: i64) -> f32 {
656
663
// CHECK: %[[CMPF:.*]] = arith.cmpf olt, %[[ARG0]], %[[CST0]] : f32
657
664
// CHECK: %[[CMPF1:.*]] = arith.cmpf one, %[[REM]], %[[CST0]] : f32
658
665
// CHECK: %[[AND:.*]] = arith.andi %[[CMPF1]], %[[CMPF]] : i1
666
+ // CHECK: %[[CMPZERO:.*]] = arith.cmpf oeq, %[[TOFP]], %[[CST0]]
659
667
// CHECK: %[[SEL:.*]] = arith.select %[[AND]], %[[MUL1]], %[[EXP]] : f32
660
- // CHECK: return %[[SEL]] : f32
668
+ // CHECK: %[[SEL1:.+]] = arith.select %[[CMPZERO]], %[[CST1]], %[[SEL]]
669
+ // CHECK: return %[[SEL1]] : f32
661
670
662
671
// -----
663
672
0 commit comments