diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2023-06-24 23:01:08 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2023-06-25 19:14:03 -0400 |
| commit | 054536f3430ecc96cb3520e82b07b2bee3337585 (patch) | |
| tree | f967ef1bfe980f3921a712a2757c55e379817194 | |
| parent | 614c8077027767063f399d3dbb5d478deebf37c3 (diff) | |
| download | zig-054536f3430ecc96cb3520e82b07b2bee3337585.tar.gz zig-054536f3430ecc96cb3520e82b07b2bee3337585.zip | |
x86_64: fix unimplemented type crashes
| -rw-r--r-- | src/arch/x86_64/CodeGen.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 6fd136684a..1b8a9fbd7f 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -4565,7 +4565,9 @@ fn airPopcount(self: *Self, inst: Air.Inst.Index) !void { const ty_op = self.air.instructions.items(.data)[inst].ty_op; const result: MCValue = result: { const src_ty = self.typeOf(ty_op.operand); - const src_abi_size = @as(u32, @intCast(src_ty.abiSize(mod))); + const src_abi_size: u32 = @intCast(src_ty.abiSize(mod)); + if (src_ty.zigTypeTag(mod) == .Vector or src_abi_size > 8) + return self.fail("TODO implement airPopcount for {}", .{src_ty.fmt(mod)}); const src_mcv = try self.resolveInst(ty_op.operand); if (self.hasFeature(.popcnt)) { @@ -4674,8 +4676,13 @@ fn airPopcount(self: *Self, inst: Air.Inst.Index) !void { } fn byteSwap(self: *Self, inst: Air.Inst.Index, src_ty: Type, src_mcv: MCValue, mem_ok: bool) !MCValue { + const mod = self.bin_file.options.module.?; const ty_op = self.air.instructions.items(.data)[inst].ty_op; + if (src_ty.zigTypeTag(mod) == .Vector or src_ty.abiSize(mod) > 8) return self.fail( + "TODO implement byteSwap for {}", + .{src_ty.fmt(mod)}, + ); const src_bits = self.regBitSize(src_ty); const src_lock = switch (src_mcv) { .register => |reg| self.register_manager.lockRegAssumeUnused(reg), |
