mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 05:20:34 +00:00
x86_64: fix @bitCast when the operand dies
This commit is contained in:
parent
79bdd2bd63
commit
47405b1a1c
@ -10154,18 +10154,22 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void {
|
||||
const dst_rc = regClassForType(dst_ty);
|
||||
const src_rc = regClassForType(src_ty);
|
||||
const src_mcv = try self.resolveInst(ty_op.operand);
|
||||
if (dst_rc.supersetOf(src_rc) and self.reuseOperand(inst, ty_op.operand, 0, src_mcv))
|
||||
break :result src_mcv;
|
||||
|
||||
const src_lock = if (src_mcv.getReg()) |reg| self.register_manager.lockReg(reg) else null;
|
||||
defer if (src_lock) |lock| self.register_manager.unlockReg(lock);
|
||||
|
||||
const dst_mcv = try self.allocRegOrMem(inst, true);
|
||||
try self.genCopy(
|
||||
if (!dst_mcv.isMemory() or src_mcv.isMemory()) dst_ty else src_ty,
|
||||
dst_mcv,
|
||||
src_mcv,
|
||||
);
|
||||
const dst_mcv = if (dst_rc.supersetOf(src_rc) and
|
||||
self.reuseOperand(inst, ty_op.operand, 0, src_mcv))
|
||||
src_mcv
|
||||
else dst: {
|
||||
const dst_mcv = try self.allocRegOrMem(inst, true);
|
||||
try self.genCopy(
|
||||
if (!dst_mcv.isMemory() or src_mcv.isMemory()) dst_ty else src_ty,
|
||||
dst_mcv,
|
||||
src_mcv,
|
||||
);
|
||||
break :dst dst_mcv;
|
||||
};
|
||||
|
||||
const dst_signedness =
|
||||
if (dst_ty.isAbiInt()) dst_ty.intInfo(self.target.*).signedness else .unsigned;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user