@@ -511,3 +511,60 @@ func.func @roundeven16(%arg: f16) -> f16 {
511
511
// CHECK: %[[COPYSIGN:.*]] = math.copysign %[[RESULT]], %[[VAL_0]] : f16
512
512
513
513
// CHECK: return %[[COPYSIGN]] : f16
514
+
515
+ // -----
516
+
517
+ // CHECK-LABEL: func.func @math_fpowi_neg_odd_power
518
+ func.func @math_fpowi_neg_odd_power (%0 : tensor <8 xf32 >) -> tensor <8 xf32 > {
519
+ %1 = arith.constant dense <-3 > : tensor <8 xi64 >
520
+ %2 = math.fpowi %0 , %1 : tensor <8 xf32 >, tensor <8 xi64 >
521
+ return %2 : tensor <8 xf32 >
522
+ }
523
+ // CHECK-SAME: (%[[ARG0:.*]]: tensor<8xf32>) -> tensor<8xf32> {
524
+ // CHECK: %[[CST1:.*]] = arith.constant dense<1.000000e+00> : tensor<8xf32>
525
+ // CHECK: %[[SQ:.*]] = arith.mulf %[[ARG0]], %[[ARG0]] : tensor<8xf32>
526
+ // CHECK: %[[CUBE:.*]] = arith.mulf %[[SQ]], %[[ARG0]] : tensor<8xf32>
527
+ // CHECK: %[[INV:.*]] = arith.divf %[[CST1]], %[[CUBE]] : tensor<8xf32>
528
+ // CHECK: return %[[INV]] : tensor<8xf32>
529
+
530
+ // -----
531
+
532
+ // CHECK-LABEL: func.func @math_fpowi_neg_even_power
533
+ func.func @math_fpowi_neg_even_power (%0 : tensor <8 xf32 >) -> tensor <8 xf32 > {
534
+ %1 = arith.constant dense <-4 > : tensor <8 xi64 >
535
+ %2 = math.fpowi %0 , %1 : tensor <8 xf32 >, tensor <8 xi64 >
536
+ return %2 : tensor <8 xf32 >
537
+ }
538
+ // CHECK-SAME: (%[[ARG0:.*]]: tensor<8xf32>) -> tensor<8xf32> {
539
+ // CHECK: %[[CST1:.*]] = arith.constant dense<1.000000e+00> : tensor<8xf32>
540
+ // CHECK: %[[SQ:.*]] = arith.mulf %[[ARG0]], %[[ARG0]] : tensor<8xf32>
541
+ // CHECK: %[[PW4:.*]] = arith.mulf %[[SQ]], %[[SQ]] : tensor<8xf32>
542
+ // CHECK: %[[INV:.*]] = arith.divf %[[CST1]], %[[PW4]] : tensor<8xf32>
543
+ // CHECK: return %[[INV]] : tensor<8xf32>
544
+
545
+ // -----
546
+
547
+ // CHECK-LABEL: func.func @math_fpowi_pos_odd_power
548
+ func.func @math_fpowi_pos_odd_power (%0 : tensor <8 xf32 >) -> tensor <8 xf32 > {
549
+ %1 = arith.constant dense <5 > : tensor <8 xi64 >
550
+ %2 = math.fpowi %0 , %1 : tensor <8 xf32 >, tensor <8 xi64 >
551
+ return %2 : tensor <8 xf32 >
552
+ }
553
+ // CHECK-SAME: (%[[ARG0:.*]]: tensor<8xf32>) -> tensor<8xf32> {
554
+ // CHECK: %[[SQ:.*]] = arith.mulf %[[ARG0]], %[[ARG0]] : tensor<8xf32>
555
+ // CHECK: %[[PW4:.*]] = arith.mulf %[[SQ]], %[[SQ]] : tensor<8xf32>
556
+ // CHECK: %[[PW5:.*]] = arith.mulf %[[PW4]], %[[ARG0]] : tensor<8xf32>
557
+ // CHECK: return %[[PW5]] : tensor<8xf32>
558
+
559
+ // -----
560
+
561
+ // CHECK-LABEL: func.func @math_fpowi_pos_even_power
562
+ func.func @math_fpowi_pos_even_power (%0 : tensor <8 xf32 >) -> tensor <8 xf32 > {
563
+ %1 = arith.constant dense <4 > : tensor <8 xi64 >
564
+ %2 = math.fpowi %0 , %1 : tensor <8 xf32 >, tensor <8 xi64 >
565
+ return %2 : tensor <8 xf32 >
566
+ }
567
+ // CHECK-SAME: (%[[ARG0:.*]]: tensor<8xf32>) -> tensor<8xf32> {
568
+ // CHECK: %[[SQ:.*]] = arith.mulf %[[ARG0]], %[[ARG0]] : tensor<8xf32>
569
+ // CHECK: %[[PW4:.*]] = arith.mulf %[[SQ]], %[[SQ]] : tensor<8xf32>
570
+ // CHECK: return %[[PW4]] : tensor<8xf32>
0 commit comments