Commit 0c6cb8d8c8
Changed files (2)
lib
std
math
big
src
arch
x86_64
lib/std/math/big/int_test.zig
@@ -1443,9 +1443,6 @@ test "big.int divFloor #11166" {
}
test "big.int gcd #10932" {
- // TODO https://github.com/ziglang/zig/issues/17998
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
var a = try Managed.init(testing.allocator);
defer a.deinit();
src/arch/x86_64/CodeGen.zig
@@ -3235,6 +3235,7 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {
var callee_buf: ["__udiv?i3".len]u8 = undefined;
const signed_div_floor_state: struct {
frame_index: FrameIndex,
+ state: State,
reloc: Mir.Inst.Index,
} = if (signed and tag == .div_floor) state: {
const frame_index = try self.allocFrameIndex(FrameAlloc.initType(Type.usize, mod));
@@ -3295,9 +3296,10 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {
tmp_reg,
mat_rhs_mcv.register_pair[1],
);
+ const state = try self.saveState();
const reloc = try self.asmJccReloc(.ns, undefined);
- break :state .{ .frame_index = frame_index, .reloc = reloc };
+ break :state .{ .frame_index = frame_index, .state = state, .reloc = reloc };
} else undefined;
const call_mcv = try self.genCall(
.{ .lib = .{
@@ -3328,6 +3330,12 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {
.base = .{ .frame = signed_div_floor_state.frame_index },
.mod = .{ .rm = .{ .size = .byte } },
});
+ try self.restoreState(signed_div_floor_state.state, &.{}, .{
+ .emit_instructions = true,
+ .update_tracking = true,
+ .resurrect = true,
+ .close_scope = true,
+ });
try self.performReloc(signed_div_floor_state.reloc);
const dst_mcv = try self.genCall(
.{ .lib = .{