authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-11-08 13:51:59-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-11-08 13:51:59-07:00
logbe14fe1fa18ec2ac0ead232a4e6035656e3f67dc
tree00d86aaae505d8e8606a8ac8622e31c039d71f67
parenta70d8d29d5895a8b44a86e8f065ee3ee59c9bfe8
parente387d30b26c62c38c7dd3c92657bfed33b993135
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #17930 from jacobly0/x86_64

x86_64: pass more tests with an x86_64 backend compiled compiler

2 files changed, 15 insertions(+), 9 deletions(-)

src/arch/x86_64/CodeGen.zig+14-8
...@@ -4877,11 +4877,14 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void {...@@ -4877,11 +4877,14 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void {
4877 switch (opt_mcv) {4877 switch (opt_mcv) {
4878 else => unreachable,4878 else => unreachable,
48794879
4880 .register => |opt_reg| try self.asmRegisterImmediate(4880 .register => |opt_reg| {
4881 .{ ._s, .bt },4881 try self.truncateRegister(pl_ty, opt_reg);
4882 opt_reg,4882 try self.asmRegisterImmediate(
4883 Immediate.u(@as(u6, @intCast(pl_abi_size * 8))),4883 .{ ._s, .bt },
4884 ),4884 opt_reg,
4885 Immediate.u(@as(u6, @intCast(pl_abi_size * 8))),
4886 );
4887 },
48854888
4886 .load_frame => |frame_addr| try self.asmMemoryImmediate(4889 .load_frame => |frame_addr| try self.asmMemoryImmediate(
4887 .{ ._, .mov },4890 .{ ._, .mov },
...@@ -7430,16 +7433,20 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air:...@@ -7430,16 +7433,20 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air:
7430 };7433 };
7431 defer if (dst_lock) |lock| self.register_manager.unlockReg(lock);7434 defer if (dst_lock) |lock| self.register_manager.unlockReg(lock);
74327435
7436 const abi_size: u16 = @intCast(src_ty.abiSize(mod));
7433 switch (tag) {7437 switch (tag) {
7434 .not => {7438 .not => {
7435 const limb_abi_size: u16 = @intCast(@min(src_ty.abiSize(mod), 8));7439 const limb_abi_size: u16 = @min(abi_size, 8);
7436 const int_info = if (src_ty.ip_index == .bool_type)7440 const int_info = if (src_ty.ip_index == .bool_type)
7437 std.builtin.Type.Int{ .signedness = .unsigned, .bits = 1 }7441 std.builtin.Type.Int{ .signedness = .unsigned, .bits = 1 }
7438 else7442 else
7439 src_ty.intInfo(mod);7443 src_ty.intInfo(mod);
7440 var byte_off: i32 = 0;7444 var byte_off: i32 = 0;
7441 while (byte_off * 8 < int_info.bits) : (byte_off += limb_abi_size) {7445 while (byte_off * 8 < int_info.bits) : (byte_off += limb_abi_size) {
7442 const limb_bits: u16 = @intCast(@min(int_info.bits - byte_off * 8, limb_abi_size * 8));7446 const limb_bits: u16 = @intCast(@min(switch (int_info.signedness) {
7447 .signed => abi_size * 8,
7448 .unsigned => int_info.bits,
7449 } - byte_off * 8, limb_abi_size * 8));
7443 const limb_ty = try mod.intType(int_info.signedness, limb_bits);7450 const limb_ty = try mod.intType(int_info.signedness, limb_bits);
7444 const limb_mcv = switch (byte_off) {7451 const limb_mcv = switch (byte_off) {
7445 0 => dst_mcv,7452 0 => dst_mcv,
...@@ -7454,7 +7461,6 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air:...@@ -7454,7 +7461,6 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air:
7454 },7461 },
7455 .neg => {7462 .neg => {
7456 try self.genUnOpMir(.{ ._, .neg }, src_ty, dst_mcv);7463 try self.genUnOpMir(.{ ._, .neg }, src_ty, dst_mcv);
7457 const abi_size: u16 = @intCast(src_ty.abiSize(mod));
7458 const bit_size = src_ty.intInfo(mod).bits;7464 const bit_size = src_ty.intInfo(mod).bits;
7459 if (abi_size * 8 > bit_size) {7465 if (abi_size * 8 > bit_size) {
7460 if (dst_mcv.isRegister()) {7466 if (dst_mcv.isRegister()) {
src/link/MachO/uuid.zig+1-1
...@@ -5,7 +5,7 @@...@@ -5,7 +5,7 @@
5/// TODO LLD also hashes the output filename to disambiguate between same builds with different5/// TODO LLD also hashes the output filename to disambiguate between same builds with different
6/// output files. Should we also do that?6/// output files. Should we also do that?
7pub fn calcUuid(comp: *const Compilation, file: fs.File, file_size: u64, out: *[Md5.digest_length]u8) !void {7pub fn calcUuid(comp: *const Compilation, file: fs.File, file_size: u64, out: *[Md5.digest_length]u8) !void {
8 const num_chunks = comp.thread_pool.threads.len * 0x10;8 const num_chunks = @max(comp.thread_pool.threads.len, 1) * 0x10;
9 const chunk_size = @divTrunc(file_size, num_chunks);9 const chunk_size = @divTrunc(file_size, num_chunks);
10 const actual_num_chunks = if (@rem(file_size, num_chunks) > 0) num_chunks + 1 else num_chunks;10 const actual_num_chunks = if (@rem(file_size, num_chunks) > 0) num_chunks + 1 else num_chunks;
1111