| ... | @@ -3776,6 +3776,9 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3776,6 +3776,9 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 3776 | .Vector => return self.fail("TODO implement add/sub with overflow for Vector type", .{}), | 3776 | .Vector => return self.fail("TODO implement add/sub with overflow for Vector type", .{}), |
| 3777 | .Int => { | 3777 | .Int => { |
| 3778 | try self.spillEflagsIfOccupied(); | 3778 | try self.spillEflagsIfOccupied(); |
| | 3779 | try self.spillRegisters(&.{ .rcx, .rdi, .rsi }); |
| | 3780 | const reg_locks = self.register_manager.lockRegsAssumeUnused(3, .{ .rcx, .rdi, .rsi }); |
| | 3781 | defer for (reg_locks) |lock| self.register_manager.unlockReg(lock); |
| 3779 | | 3782 | |
| 3780 | const partial_mcv = try self.genBinOp(null, switch (tag) { | 3783 | const partial_mcv = try self.genBinOp(null, switch (tag) { |
| 3781 | .add_with_overflow => .add, | 3784 | .add_with_overflow => .add, |
| ... | @@ -3839,8 +3842,10 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3839,8 +3842,10 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 3839 | .Vector => return self.fail("TODO implement shl with overflow for Vector type", .{}), | 3842 | .Vector => return self.fail("TODO implement shl with overflow for Vector type", .{}), |
| 3840 | .Int => { | 3843 | .Int => { |
| 3841 | try self.spillEflagsIfOccupied(); | 3844 | try self.spillEflagsIfOccupied(); |
| | 3845 | try self.spillRegisters(&.{ .rcx, .rdi, .rsi }); |
| | 3846 | const reg_locks = self.register_manager.lockRegsAssumeUnused(3, .{ .rcx, .rdi, .rsi }); |
| | 3847 | defer for (reg_locks) |lock| self.register_manager.unlockReg(lock); |
| 3842 | | 3848 | |
| 3843 | try self.register_manager.getReg(.rcx, null); | | |
| 3844 | const lhs = try self.resolveInst(bin_op.lhs); | 3849 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3845 | const rhs = try self.resolveInst(bin_op.rhs); | 3850 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3846 | | 3851 | |
| ... | @@ -4296,8 +4301,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4296,8 +4301,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 4296 | }; | 4301 | }; |
| 4297 | | 4302 | |
| 4298 | try self.spillEflagsIfOccupied(); | 4303 | try self.spillEflagsIfOccupied(); |
| 4299 | try self.spillRegisters(&.{ .rax, .rcx, .rdx }); | 4304 | try self.spillRegisters(&.{ .rax, .rcx, .rdx, .rdi, .rsi }); |
| 4300 | const reg_locks = self.register_manager.lockRegsAssumeUnused(3, .{ .rax, .rcx, .rdx }); | 4305 | const reg_locks = self.register_manager.lockRegsAssumeUnused(5, .{ .rax, .rcx, .rdx, .rdi, .rsi }); |
| 4301 | defer for (reg_locks) |lock| self.register_manager.unlockReg(lock); | 4306 | defer for (reg_locks) |lock| self.register_manager.unlockReg(lock); |
| 4302 | | 4307 | |
| 4303 | const cc: Condition = switch (dst_info.signedness) { | 4308 | const cc: Condition = switch (dst_info.signedness) { |
| ... | @@ -8273,8 +8278,8 @@ fn genShiftBinOp( | ... | @@ -8273,8 +8278,8 @@ fn genShiftBinOp( |
| 8273 | assert(rhs_ty.abiSize(mod) == 1); | 8278 | assert(rhs_ty.abiSize(mod) == 1); |
| 8274 | | 8279 | |
| 8275 | try self.register_manager.getReg(.rcx, null); | 8280 | try self.register_manager.getReg(.rcx, null); |
| 8276 | const rcx_lock = self.register_manager.lockRegAssumeUnused(.rcx); | 8281 | const rcx_lock = self.register_manager.lockReg(.rcx); |
| 8277 | defer self.register_manager.unlockReg(rcx_lock); | 8282 | defer if (rcx_lock) |lock| self.register_manager.unlockReg(lock); |
| 8278 | | 8283 | |
| 8279 | const lhs_lock = switch (lhs_mcv) { | 8284 | const lhs_lock = switch (lhs_mcv) { |
| 8280 | .register => |reg| self.register_manager.lockReg(reg), | 8285 | .register => |reg| self.register_manager.lockReg(reg), |