@@ -484,85 +484,65 @@ func.func @slice_dyn(%arg0: tensor<?xf32>) -> (tensor<?xf32>) {
484484// CHECK-LABEL: @pad_float
485485// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]:
486486func.func @pad_float (%arg0 : tensor <1 x2 xf32 >) -> (tensor <4 x9 xf32 >) {
487- %0 = arith.constant dense <[[1 , 2 ], [3 , 4 ]]> : tensor <2 x2 xi32 >
488- // TODO: Output contains multiple "arith.constant 1 : index".
489- // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
490- // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
491- // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index
492- // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index
487+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 xi32 >
493488 // CHECK-DAG: [[CST:%.+]] = arith.constant 0.000000e+00 : f32
494- // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
489+ // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, %{{.*}}] high{{\[}}%{{.*}}, %{{.*}}] {
495490 // CHECK: tensor.yield [[CST]]
496491 // CHECK: } : tensor<1x2xf32> to tensor<4x9xf32>
497- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <2 x 2 x i32 >) -> (tensor <4 x9 xf32 >)
492+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <4 x i32 >) -> (tensor <4 x9 xf32 >)
498493 return %1 : tensor <4 x9 xf32 >
499494}
500495
501496func.func @pad_int (%arg0 : tensor <1 x2 xi32 >) -> (tensor <4 x9 xi32 >) {
502- %0 = arith.constant dense <[[ 1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
497+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
503498 // CHECK: [[CST:%.+]] = arith.constant 0 : i32
504499 // CHECK: tensor.pad
505500 // CHECK: tensor.yield [[CST]]
506- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xi32 >, tensor <2 x 2 x i32 >) -> (tensor <4 x9 xi32 >)
501+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xi32 >, tensor <4 x i32 >) -> (tensor <4 x9 xi32 >)
507502 return %1 : tensor <4 x9 xi32 >
508503}
509504
510505func.func @pad_quant (%arg0 : tensor <1 x2 xi32 >) -> (tensor <4 x9 xi32 >) {
511- %0 = arith.constant dense <[[ 1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
506+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
512507 // CHECK: [[CST:%.+]] = arith.constant 42 : i32
513508 // CHECK: tensor.pad
514509 // CHECK: tensor.yield [[CST]]
515- %1 = " tosa.pad" (%arg0 , %0 ) {quantization_info = #tosa.pad_quant <input_zp = 42 >} : (tensor <1 x2 xi32 >, tensor <2 x 2 x i32 >) -> (tensor <4 x9 xi32 >)
510+ %1 = " tosa.pad" (%arg0 , %0 ) {quantization_info = #tosa.pad_quant <input_zp = 42 >} : (tensor <1 x2 xi32 >, tensor <4 x i32 >) -> (tensor <4 x9 xi32 >)
516511 return %1 : tensor <4 x9 xi32 >
517512}
518513
519514// -----
520515
521516func.func @pad_float_explicit (%arg0 : tensor <1 x2 xf32 >) -> (tensor <4 x9 xf32 >) {
522- %0 = arith.constant dense <[[1 , 2 ], [3 , 4 ]]> : tensor <2 x2 xi32 >
523- // TODO: Output contains multiple "arith.constant 1 : index".
524- // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
525- // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
526- // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index
527- // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index
517+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 xi32 >
528518 // CHECK-DAG: [[CST:%.+]] = arith.constant 4.200000e+01 : f32
529- // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
519+ // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, %{{.*}}] high{{\[}}%{{.*}}, %{{.*}}] {
530520 // CHECK: tensor.yield [[CST]]
531521 // CHECK: } : tensor<1x2xf32> to tensor<4x9xf32>
532522 %1 = arith.constant dense <42.0 > : tensor <f32 >
533- %2 = " tosa.pad" (%arg0 , %0 , %1 ) : (tensor <1 x2 xf32 >, tensor <2 x 2 x i32 >, tensor <f32 >) -> (tensor <4 x9 xf32 >)
523+ %2 = " tosa.pad" (%arg0 , %0 , %1 ) : (tensor <1 x2 xf32 >, tensor <4 x i32 >, tensor <f32 >) -> (tensor <4 x9 xf32 >)
534524 return %2 : tensor <4 x9 xf32 >
535525}
536526
537527// -----
538528
539529func.func @pad_dyn_input (%arg0 : tensor <?x2 xf32 >) -> (tensor <?x9 xf32 >) {
540- %0 = arith.constant dense <[[1 , 2 ], [3 , 4 ]]> : tensor <2 x2 xi32 >
541- // TODO: Output contains multiple "arith.constant 1 : index".
542- // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
543- // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
544- // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index
545- // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index
530+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 xi32 >
546531 // CHECK-DAG: [[CST:%.+]] = arith.constant 0.000000e+00 : f32
547- // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
532+ // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, %{{.*}}] high{{\[}}%{{.*}}, %{{.*}}] {
548533 // CHECK: tensor.yield [[CST]]
549534 // CHECK: } : tensor<?x2xf32> to tensor<?x9xf32>
550- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <?x2 xf32 >, tensor <2 x 2 x i32 >) -> (tensor <?x9 xf32 >)
535+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <?x2 xf32 >, tensor <4 x i32 >) -> (tensor <?x9 xf32 >)
551536 return %1 : tensor <?x9 xf32 >
552537}
553538
554539func.func @pad_dyn_padding (%arg0 : tensor <1 x2 xf32 >) -> (tensor <?x9 xf32 >) {
555- %0 = arith.constant dense <[[1 , 2 ], [3 , 4 ]]> : tensor <2 x2 xi32 >
556- // TODO: Output contains multiple "arith.constant 1 : index".
557- // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
558- // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
559- // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index
560- // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index
540+ %0 = arith.constant dense <[-1 , 2 , 3 , 4 ]> : tensor <4 xi32 >
561541 // CHECK-DAG: [[CST:%.+]] = arith.constant 0.000000e+00 : f32
562- // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
542+ // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, %{{.*}}] high{{\[}}%{{.*}}, %{{.*}}] {
563543 // CHECK: tensor.yield [[CST]]
564544 // CHECK: } : tensor<1x2xf32> to tensor<?x9xf32>
565- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <2 x 2 x i32 >) -> (tensor <?x9 xf32 >)
545+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <4 x i32 >) -> (tensor <?x9 xf32 >)
566546 return %1 : tensor <?x9 xf32 >
567547}
568548
0 commit comments