aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-04-14 04:47:33 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2023-04-16 17:05:34 -0400
commitc03771e1738dae25eccf7726dcc952ad5936ca15 (patch)
tree66cb46d5aaf42d2b45d37424f85caacfc70dff05 /src
parent08055f2942abe873283ec46f2656ecb932f915b3 (diff)
downloadzig-c03771e1738dae25eccf7726dcc952ad5936ca15.tar.gz
zig-c03771e1738dae25eccf7726dcc952ad5936ca15.zip
x86_64: fix overflow of extended multiply
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86_64/CodeGen.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig
index 196dc330fb..ef6b5e246b 100644
--- a/src/arch/x86_64/CodeGen.zig
+++ b/src/arch/x86_64/CodeGen.zig
@@ -2089,12 +2089,14 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
else => {},
}
+ // For now, this is the only supported multiply that doesn't fit in a register.
+ assert(dst_info.bits == 128 and src_pl.data == 64);
const dst_abi_size = @intCast(i32, dst_ty.abiSize(self.target.*));
const dst_mcv = try self.allocRegOrMem(inst, false);
try self.genSetStack(
Type.u1,
dst_mcv.stack_offset - dst_abi_size,
- .{ .eflags = cc },
+ .{ .immediate = 0 }, // 64x64 -> 128 never overflows
.{},
);
try self.genSetStack(dst_ty, dst_mcv.stack_offset, partial_mcv, .{});