@@ -565,6 +565,33 @@ func.func @mul_zero_broadcast(%arg0: tensor<2x3xf32>) -> (tensor<2x3xf32>, tenso
565
565
566
566
// -----
567
567
568
+ // CHECK-LABEL: @mul_zero_dynamic_nofold
569
+ // CHECK-SAME: %[[ARG0:.*]]: tensor<?x17xf32>) -> tensor<?x17xf32> {
570
+ // CHECK: %[[ZERO:.*]] = "tosa.const"() <{values = dense<0.000000e+00> : tensor<1x1xf32>}> : () -> tensor<1x1xf32>
571
+ // CHECK: %[[SHIFT:.*]] = "tosa.const"() <{values = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8>
572
+ // CHECK: %[[MUL:.*]] = tosa.mul %[[ARG0]], %[[ZERO]], %[[SHIFT]] : (tensor<?x17xf32>, tensor<1x1xf32>, tensor<1xi8>) -> tensor<?x17xf32>
573
+ // CHECK: return %[[MUL]]
574
+ func.func @mul_zero_dynamic_nofold (%arg0: tensor <?x17 xf32 >) -> tensor <?x17 xf32 > {
575
+ %0 = " tosa.const" () <{values = dense <0.000000e+00 > : tensor <1 x1 xf32 >}> : () -> tensor <1 x1 xf32 >
576
+ %1 = " tosa.const" () <{values = dense <0 > : tensor <1 xi8 >}> : () -> tensor <1 xi8 >
577
+ %2 = tosa.mul %arg0 , %0 , %1 : (tensor <?x17 xf32 >, tensor <1 x1 xf32 >, tensor <1 xi8 >) -> tensor <?x17 xf32 >
578
+ return %2 : tensor <?x17 xf32 >
579
+ }
580
+
581
+ // -----
582
+
583
+ // CHECK-LABEL: @mul_one_dynamic_fold
584
+ // CHECK-SAME: %[[ARG0:.*]]: tensor<?x17xf32>) -> tensor<?x17xf32> {
585
+ // CHECK: return %[[ARG0]]
586
+ func.func @mul_one_dynamic_fold (%arg0: tensor <?x17 xf32 >) -> tensor <?x17 xf32 > {
587
+ %0 = " tosa.const" () <{values = dense <1.000000e+00 > : tensor <1 x1 xf32 >}> : () -> tensor <1 x1 xf32 >
588
+ %1 = " tosa.const" () <{values = dense <0 > : tensor <1 xi8 >}> : () -> tensor <1 xi8 >
589
+ %2 = tosa.mul %arg0 , %0 , %1 : (tensor <?x17 xf32 >, tensor <1 x1 xf32 >, tensor <1 xi8 >) -> tensor <?x17 xf32 >
590
+ return %2 : tensor <?x17 xf32 >
591
+ }
592
+
593
+ // -----
594
+
568
595
// CHECK-LABEL: @select_same_value
569
596
func.func @select_same_value (%arg0: tensor <2 x3 xi1 >, %arg1: tensor <2 x3 xi32 >) -> tensor <2 x3 xi32 > {
570
597
%0 = tosa.select %arg0 , %arg1 , %arg1 : (tensor <2 x3 xi1 >, tensor <2 x3 xi32 >, tensor <2 x3 xi32 >) -> tensor <2 x3 xi32 >
0 commit comments