| ... | @@ -4353,9 +4353,21 @@ fn intcast(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro | ... | @@ -4353,9 +4353,21 @@ fn intcast(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro |
| 4353 | if (op_bits > 32 and op_bits <= 64 and wanted_bits == 32) { | 4353 | if (op_bits > 32 and op_bits <= 64 and wanted_bits == 32) { |
| 4354 | try func.emitWValue(operand); | 4354 | try func.emitWValue(operand); |
| 4355 | try func.addTag(.i32_wrap_i64); | 4355 | try func.addTag(.i32_wrap_i64); |
| | 4356 | if (given.isSignedInt(mod) and wanted_bitsize < 32) |
| | 4357 | return func.wrapOperand(.{ .stack = {} }, wanted) |
| | 4358 | else |
| | 4359 | return WValue{ .stack = {} }; |
| 4356 | } else if (op_bits == 32 and wanted_bits > 32 and wanted_bits <= 64) { | 4360 | } else if (op_bits == 32 and wanted_bits > 32 and wanted_bits <= 64) { |
| 4357 | try func.emitWValue(operand); | 4361 | const operand32 = if (given_bitsize < 32 and wanted.isSignedInt(mod)) |
| | 4362 | try func.signExtendInt(operand, given) |
| | 4363 | else |
| | 4364 | operand; |
| | 4365 | try func.emitWValue(operand32); |
| 4358 | try func.addTag(if (wanted.isSignedInt(mod)) .i64_extend_i32_s else .i64_extend_i32_u); | 4366 | try func.addTag(if (wanted.isSignedInt(mod)) .i64_extend_i32_s else .i64_extend_i32_u); |
| | 4367 | if (given.isSignedInt(mod) and wanted_bitsize < 64) |
| | 4368 | return func.wrapOperand(.{ .stack = {} }, wanted) |
| | 4369 | else |
| | 4370 | return WValue{ .stack = {} }; |
| 4359 | } else if (wanted_bits == 128) { | 4371 | } else if (wanted_bits == 128) { |
| 4360 | // for 128bit integers we store the integer in the virtual stack, rather than a local | 4372 | // for 128bit integers we store the integer in the virtual stack, rather than a local |
| 4361 | const stack_ptr = try func.allocStack(wanted); | 4373 | const stack_ptr = try func.allocStack(wanted); |
| ... | @@ -4381,8 +4393,6 @@ fn intcast(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro | ... | @@ -4381,8 +4393,6 @@ fn intcast(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro |
| 4381 | } | 4393 | } |
| 4382 | return stack_ptr; | 4394 | return stack_ptr; |
| 4383 | } else return func.load(operand, wanted, 0); | 4395 | } else return func.load(operand, wanted, 0); |
| 4384 | | | |
| 4385 | return WValue{ .stack = {} }; | | |
| 4386 | } | 4396 | } |
| 4387 | | 4397 | |
| 4388 | fn airIsNull(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode, op_kind: enum { value, ptr }) InnerError!void { | 4398 | fn airIsNull(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode, op_kind: enum { value, ptr }) InnerError!void { |