@@ -869,6 +869,27 @@ func.func @tripleAddAddOvf2(%arg0: index) -> index {
869869 return %add2 : index
870870}
871871
872+
873+ // CHECK-LABEL: @foldSubXX_tensor
874+ // CHECK: %[[c0:.+]] = arith.constant dense<0> : tensor<10xi32>
875+ // CHECK: %[[sub:.+]] = arith.subi
876+ // CHECK: return %[[c0]], %[[sub]]
877+ func.func @foldSubXX_tensor (%static : tensor <10 xi32 >, %dyn : tensor <?x?xi32 >) -> (tensor <10 xi32 >, tensor <?x?xi32 >) {
878+ %static_sub = arith.subi %static , %static : tensor <10 xi32 >
879+ %dyn_sub = arith.subi %dyn , %dyn : tensor <?x?xi32 >
880+ return %static_sub , %dyn_sub : tensor <10 xi32 >, tensor <?x?xi32 >
881+ }
882+
883+ // CHECK-LABEL: @foldSubXX_vector
884+ // CHECK-DAG: %[[c0:.+]] = arith.constant dense<0> : vector<8xi32>
885+ // CHECK-DAG: %[[c0_scalable:.+]] = arith.constant dense<0> : vector<[4]xi32>
886+ // CHECK: return %[[c0]], %[[c0_scalable]]
887+ func.func @foldSubXX_vector (%static : vector <8 xi32 >, %dyn : vector <[4 ]xi32 >) -> (vector <8 xi32 >, vector <[4 ]xi32 >) {
888+ %static_sub = arith.subi %static , %static : vector <8 xi32 >
889+ %dyn_sub = arith.subi %dyn , %dyn : vector <[4 ]xi32 >
890+ return %static_sub , %dyn_sub : vector <8 xi32 >, vector <[4 ]xi32 >
891+ }
892+
872893// CHECK-LABEL: @tripleAddSub0
873894// CHECK: %[[cres:.+]] = arith.constant 59 : index
874895// CHECK: %[[add:.+]] = arith.subi %[[cres]], %arg0 : index
0 commit comments