@@ -459,85 +459,65 @@ func.func @slice_dyn(%arg0: tensor<?xf32>) -> (tensor<?xf32>) {
459459// CHECK-LABEL: @pad_float
460460// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]:
461461func.func @pad_float (%arg0 : tensor <1 x2 xf32 >) -> (tensor <4 x9 xf32 >) {
462- %0 = arith.constant dense <[[1 , 2 ], [3 , 4 ]]> : tensor <2 x2 xi32 >
463- // TODO: Output contains multiple "arith.constant 1 : index".
464- // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
465- // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
466- // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index
467- // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index
462+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 xi32 >
468463 // CHECK-DAG: [[CST:%.+]] = arith.constant 0.000000e+00 : f32
469- // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
464+ // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, %{{.*}}] high{{\[}}%{{.*}}, %{{.*}}] {
470465 // CHECK: tensor.yield [[CST]]
471466 // CHECK: } : tensor<1x2xf32> to tensor<4x9xf32>
472- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <2 x 2 x i32 >) -> (tensor <4 x9 xf32 >)
467+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <4 x i32 >) -> (tensor <4 x9 xf32 >)
473468 return %1 : tensor <4 x9 xf32 >
474469}
475470
476471func.func @pad_int (%arg0 : tensor <1 x2 xi32 >) -> (tensor <4 x9 xi32 >) {
477- %0 = arith.constant dense <[[ 1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
472+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
478473 // CHECK: [[CST:%.+]] = arith.constant 0 : i32
479474 // CHECK: tensor.pad
480475 // CHECK: tensor.yield [[CST]]
481- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xi32 >, tensor <2 x 2 x i32 >) -> (tensor <4 x9 xi32 >)
476+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xi32 >, tensor <4 x i32 >) -> (tensor <4 x9 xi32 >)
482477 return %1 : tensor <4 x9 xi32 >
483478}
484479
485480func.func @pad_quant (%arg0 : tensor <1 x2 xi32 >) -> (tensor <4 x9 xi32 >) {
486- %0 = arith.constant dense <[[ 1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
481+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
487482 // CHECK: [[CST:%.+]] = arith.constant 42 : i32
488483 // CHECK: tensor.pad
489484 // CHECK: tensor.yield [[CST]]
490- %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 >)
485+ %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 >)
491486 return %1 : tensor <4 x9 xi32 >
492487}
493488
494489// -----
495490
496491func.func @pad_float_explicit (%arg0 : tensor <1 x2 xf32 >) -> (tensor <4 x9 xf32 >) {
497- %0 = arith.constant dense <[[1 , 2 ], [3 , 4 ]]> : tensor <2 x2 xi32 >
498- // TODO: Output contains multiple "arith.constant 1 : index".
499- // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
500- // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
501- // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index
502- // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index
492+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 xi32 >
503493 // CHECK-DAG: [[CST:%.+]] = arith.constant 4.200000e+01 : f32
504- // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
494+ // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, %{{.*}}] high{{\[}}%{{.*}}, %{{.*}}] {
505495 // CHECK: tensor.yield [[CST]]
506496 // CHECK: } : tensor<1x2xf32> to tensor<4x9xf32>
507497 %1 = arith.constant dense <42.0 > : tensor <f32 >
508- %2 = " tosa.pad" (%arg0 , %0 , %1 ) : (tensor <1 x2 xf32 >, tensor <2 x 2 x i32 >, tensor <f32 >) -> (tensor <4 x9 xf32 >)
498+ %2 = " tosa.pad" (%arg0 , %0 , %1 ) : (tensor <1 x2 xf32 >, tensor <4 x i32 >, tensor <f32 >) -> (tensor <4 x9 xf32 >)
509499 return %2 : tensor <4 x9 xf32 >
510500}
511501
512502// -----
513503
514504func.func @pad_dyn_input (%arg0 : tensor <?x2 xf32 >) -> (tensor <?x9 xf32 >) {
515- %0 = arith.constant dense <[[1 , 2 ], [3 , 4 ]]> : tensor <2 x2 xi32 >
516- // TODO: Output contains multiple "arith.constant 1 : index".
517- // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
518- // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
519- // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index
520- // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index
505+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 xi32 >
521506 // CHECK-DAG: [[CST:%.+]] = arith.constant 0.000000e+00 : f32
522- // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
507+ // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, %{{.*}}] high{{\[}}%{{.*}}, %{{.*}}] {
523508 // CHECK: tensor.yield [[CST]]
524509 // CHECK: } : tensor<?x2xf32> to tensor<?x9xf32>
525- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <?x2 xf32 >, tensor <2 x 2 x i32 >) -> (tensor <?x9 xf32 >)
510+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <?x2 xf32 >, tensor <4 x i32 >) -> (tensor <?x9 xf32 >)
526511 return %1 : tensor <?x9 xf32 >
527512}
528513
529514func.func @pad_dyn_padding (%arg0 : tensor <1 x2 xf32 >) -> (tensor <?x9 xf32 >) {
530- %0 = arith.constant dense <[[-1 , 2 ], [3 , 4 ]]> : tensor <2 x2 xi32 >
531- // TODO: Output contains multiple "arith.constant 1 : index".
532- // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
533- // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
534- // CHECK-DAG: [[INDEX3:%.+]] = arith.constant 3 : index
535- // CHECK-DAG: [[INDEX4:%.+]] = arith.constant 4 : index
515+ %0 = arith.constant dense <[-1 , 2 , 3 , 4 ]> : tensor <4 xi32 >
536516 // CHECK-DAG: [[CST:%.+]] = arith.constant 0.000000e+00 : f32
537- // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
517+ // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, %{{.*}}] high{{\[}}%{{.*}}, %{{.*}}] {
538518 // CHECK: tensor.yield [[CST]]
539519 // CHECK: } : tensor<1x2xf32> to tensor<?x9xf32>
540- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <2 x 2 x i32 >) -> (tensor <?x9 xf32 >)
520+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <4 x i32 >) -> (tensor <?x9 xf32 >)
541521 return %1 : tensor <?x9 xf32 >
542522}
543523
0 commit comments