authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-03-08 19:20:59+03:30
committergravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-03-17 20:19:08+03:30
log2fc409a32f18b0c62e3918f0b832ed9e4c8d142d
treee860ca01ea4e012ae135171521039f52cc5b505f
parent2a4e06bcb30f71e83b14026bcbade6aac3aece84

spirv: don't hardcode test error type alignment


3 files changed, 7 insertions(+), 1 deletions(-)

src/codegen/spirv.zig+2-1
......@@ -2821,6 +2821,7 @@ const NavGen = struct {
28212821 /// TODO is to also write out the error as a function call parameter, and to somehow fetch
28222822 /// the name of an error in the text executor.
28232823 fn generateTestEntryPoint(self: *NavGen, name: []const u8, spv_test_decl_index: SpvModule.Decl.Index) !void {
2824 const zcu = self.pt.zcu;
28242825 const target = self.spv.target;
28252826
28262827 const anyerror_ty_id = try self.resolveType(Type.anyerror, .direct);
......@@ -2950,7 +2951,7 @@ const NavGen = struct {
29502951 .pointer = p_error_id,
29512952 .object = error_id,
29522953 .memory_access = .{
2953 .Aligned = .{ .literal_integer = @sizeOf(u16) },
2954 .Aligned = .{ .literal_integer = @intCast(Type.abiAlignment(.anyerror, zcu).toByteUnits().?) },
29542955 },
29552956 });
29562957 try section.emit(self.spv.gpa, .OpReturn, {});
test/behavior.zig+2
......@@ -140,6 +140,8 @@ test {
140140
141141// This bug only repros in the root file
142142test "deference @embedFile() of a file full of zero bytes" {
143 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
144
143145 const contents = @embedFile("behavior/zero.bin").*;
144146 try @import("std").testing.expect(contents.len == 456);
145147 for (contents) |byte| try @import("std").testing.expect(byte == 0);
test/behavior/floatop.zig+3
......@@ -133,6 +133,7 @@ test "cmp f16" {
133133}
134134
135135test "cmp f32" {
136 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
136137 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
137138 if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234
138139 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
......@@ -142,6 +143,7 @@ test "cmp f32" {
142143}
143144
144145test "cmp f64" {
146 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
145147 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
146148 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
147149 if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234
......@@ -245,6 +247,7 @@ test "vector cmp f16" {
245247}
246248
247249test "vector cmp f32" {
250 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
248251 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
249252 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
250253 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;