authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-02-16 15:24:04+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-02-16 15:24:04+01:00
logd3edf298d18ff89bb0e0a3bfcee84a9fb63b1c6b
tree86e79cce8ab05f6cb84cf62272cb7f77d3409a91
parent1b7ec44924ede3816438f9de4b4b5bc3b7705711

x64: fix signed truncate


1 files changed, 1 insertions(+), 2 deletions(-)

src/arch/x86_64/CodeGen.zig+1-2
...@@ -966,7 +966,7 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {...@@ -966,7 +966,7 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
966 const reg: Register = blk: {966 const reg: Register = blk: {
967 if (operand.isRegister()) {967 if (operand.isRegister()) {
968 if (self.reuseOperand(inst, ty_op.operand, 0, operand)) {968 if (self.reuseOperand(inst, ty_op.operand, 0, operand)) {
969 break :blk operand.register;969 break :blk operand.register.to64();
970 }970 }
971 }971 }
972 const mcv = try self.copyToNewRegister(inst, src_ty, operand);972 const mcv = try self.copyToNewRegister(inst, src_ty, operand);
...@@ -2300,7 +2300,6 @@ fn genBinMathOp(self: *Self, inst: Air.Inst.Index, op_lhs: Air.Inst.Ref, op_rhs:...@@ -2300,7 +2300,6 @@ fn genBinMathOp(self: *Self, inst: Air.Inst.Index, op_lhs: Air.Inst.Ref, op_rhs:
2300 const mcvs = try self.mcvsForBinMathOp(inst, op_lhs, op_rhs);2300 const mcvs = try self.mcvsForBinMathOp(inst, op_lhs, op_rhs);
2301 const dst_mcv = mcvs.dst;2301 const dst_mcv = mcvs.dst;
2302 const src_mcv = mcvs.src;2302 const src_mcv = mcvs.src;
2303 log.warn("dst_mcv = {}, src_mcv = {}", .{ dst_mcv, src_mcv });
2304 const tag = self.air.instructions.items(.tag)[inst];2303 const tag = self.air.instructions.items(.tag)[inst];
2305 switch (tag) {2304 switch (tag) {
2306 .add, .addwrap => try self.genBinMathOpMir(.add, dst_ty, dst_mcv, src_mcv),2305 .add, .addwrap => try self.genBinMathOpMir(.add, dst_ty, dst_mcv, src_mcv),