diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-11-08 13:51:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-08 13:51:59 -0700 |
| commit | be14fe1fa18ec2ac0ead232a4e6035656e3f67dc (patch) | |
| tree | 00d86aaae505d8e8606a8ac8622e31c039d71f67 | |
| parent | a70d8d29d5895a8b44a86e8f065ee3ee59c9bfe8 (diff) | |
| parent | e387d30b26c62c38c7dd3c92657bfed33b993135 (diff) | |
| download | zig-be14fe1fa18ec2ac0ead232a4e6035656e3f67dc.tar.gz zig-be14fe1fa18ec2ac0ead232a4e6035656e3f67dc.zip | |
Merge pull request #17930 from jacobly0/x86_64
x86_64: pass more tests with an x86_64 backend compiled compiler
| -rw-r--r-- | src/arch/x86_64/CodeGen.zig | 22 | ||||
| -rw-r--r-- | src/link/MachO/uuid.zig | 2 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 16a4b4a7f4..95eb16c267 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -4877,11 +4877,14 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { switch (opt_mcv) { else => unreachable, - .register => |opt_reg| try self.asmRegisterImmediate( - .{ ._s, .bt }, - opt_reg, - Immediate.u(@as(u6, @intCast(pl_abi_size * 8))), - ), + .register => |opt_reg| { + try self.truncateRegister(pl_ty, opt_reg); + try self.asmRegisterImmediate( + .{ ._s, .bt }, + opt_reg, + Immediate.u(@as(u6, @intCast(pl_abi_size * 8))), + ); + }, .load_frame => |frame_addr| try self.asmMemoryImmediate( .{ ._, .mov }, @@ -7430,16 +7433,20 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air: }; defer if (dst_lock) |lock| self.register_manager.unlockReg(lock); + const abi_size: u16 = @intCast(src_ty.abiSize(mod)); switch (tag) { .not => { - const limb_abi_size: u16 = @intCast(@min(src_ty.abiSize(mod), 8)); + const limb_abi_size: u16 = @min(abi_size, 8); const int_info = if (src_ty.ip_index == .bool_type) std.builtin.Type.Int{ .signedness = .unsigned, .bits = 1 } else src_ty.intInfo(mod); var byte_off: i32 = 0; while (byte_off * 8 < int_info.bits) : (byte_off += limb_abi_size) { - const limb_bits: u16 = @intCast(@min(int_info.bits - byte_off * 8, limb_abi_size * 8)); + const limb_bits: u16 = @intCast(@min(switch (int_info.signedness) { + .signed => abi_size * 8, + .unsigned => int_info.bits, + } - byte_off * 8, limb_abi_size * 8)); const limb_ty = try mod.intType(int_info.signedness, limb_bits); const limb_mcv = switch (byte_off) { 0 => dst_mcv, @@ -7454,7 +7461,6 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air: }, .neg => { try self.genUnOpMir(.{ ._, .neg }, src_ty, dst_mcv); - const abi_size: u16 = @intCast(src_ty.abiSize(mod)); const bit_size = src_ty.intInfo(mod).bits; if (abi_size * 8 > bit_size) { if (dst_mcv.isRegister()) { diff --git a/src/link/MachO/uuid.zig b/src/link/MachO/uuid.zig index bfd602d62a..e62e3216f0 100644 --- a/src/link/MachO/uuid.zig +++ b/src/link/MachO/uuid.zig @@ -5,7 +5,7 @@ /// TODO LLD also hashes the output filename to disambiguate between same builds with different /// output files. Should we also do that? pub fn calcUuid(comp: *const Compilation, file: fs.File, file_size: u64, out: *[Md5.digest_length]u8) !void { - const num_chunks = comp.thread_pool.threads.len * 0x10; + const num_chunks = @max(comp.thread_pool.threads.len, 1) * 0x10; const chunk_size = @divTrunc(file_size, num_chunks); const actual_num_chunks = if (@rem(file_size, num_chunks) > 0) num_chunks + 1 else num_chunks; |
