File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1303,7 +1303,8 @@ OpFoldResult CastOp::fold(FoldAdaptor adaptor) {
13031303
13041304 if (trunc) {
13051305 intVal = intVal.trunc (bitwidth);
1306- } else if (unsignIn) {
1306+ } else if (unsignIn || inETy.getIntOrFloatBitWidth () == 1 ) {
1307+ // Casting from i1 to iX will treat it as unsigned.
13071308 intVal = intVal.zext (bitwidth);
13081309 } else {
13091310 intVal = intVal.sext (bitwidth);
Original file line number Diff line number Diff line change @@ -598,7 +598,7 @@ func.func @cast_int_to_int_sign() -> tensor<i32> {
598598// CHECK: func.func @cast_i1_true_to_i32
599599func.func @cast_i1_true_to_i32 () -> tensor <i32 > {
600600 %splat = " tosa.const" () {values = dense <true > : tensor <i1 >} : () -> tensor <i1 >
601- // CHECK: %[[SPLAT:.+]] = "tosa.const"() <{values = dense<- 1> : tensor<i32>}
601+ // CHECK: %[[SPLAT:.+]] = "tosa.const"() <{values = dense<1> : tensor<i32>}
602602 %cast = tosa.cast %splat : (tensor <i1 >) -> tensor <i32 >
603603 // CHECK: return %[[SPLAT]]
604604 return %cast : tensor <i32 >
You can’t perform that action at this time.
0 commit comments