authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2026-06-17 01:54:10+03:30
committergravatar for alichraghi@noreply.codeberg.orgAli Cheraghi <alichraghi@noreply.codeberg.org> 2026-06-18 13:38:58+02:00
log65e74dfbda3e50ba09a2b59061ccb90a7dd68e9f
tree60faead2672c05bc933745300d323086937e7346
parent508cbec69455d82c0e9bb5ae47f064ab33460469

@extern: add flat decoration


24 files changed, 133 insertions(+), 19 deletions(-)

lib/std/lang.zig+2-1
...@@ -1173,11 +1173,12 @@ pub const ExternOptions = struct {...@@ -1173,11 +1173,12 @@ pub const ExternOptions = struct {
11731173
1174 pub const Decoration = union(enum) {1174 pub const Decoration = union(enum) {
1175 location: u32,1175 location: u32,
1176 flat: u32,
1176 descriptor: Descriptor,1177 descriptor: Descriptor,
11771178
1178 pub const Descriptor = struct {1179 pub const Descriptor = struct {
1179 binding: u32,
1180 set: u32,1180 set: u32,
1181 binding: u32,
1181 };1182 };
1182 };1183 };
11831184
src/InternPool.zig+4-4
...@@ -5406,16 +5406,15 @@ pub const Tag = enum(u8) {...@@ -5406,16 +5406,15 @@ pub const Tag = enum(u8) {
5406 _: u23 = 0,5406 _: u23 = 0,
54075407
5408 pub const Source = enum(u1) { builtin, syntax };5408 pub const Source = enum(u1) { builtin, syntax };
5409 pub const DecorationType = enum(u2) { none, location, descriptor };5409 pub const DecorationType = enum(u2) { none, location, descriptor, flat };
5410 };5410 };
54115411
5412 pub fn decoration(self: Extern) ?std.lang.ExternOptions.Decoration {5412 pub fn decoration(self: Extern) ?std.lang.ExternOptions.Decoration {
5413 return switch (self.flags.decoration_type) {5413 return switch (self.flags.decoration_type) {
5414 .none => null,5414 .none => null,
5415 .location => std.lang.ExternOptions.Decoration{5415 .location => std.lang.ExternOptions.Decoration{ .location = self.location_or_descriptor_set },
5416 .location = self.location_or_descriptor_set,
5417 },
5418 .descriptor => std.lang.ExternOptions.Decoration{ .descriptor = .{ .set = self.location_or_descriptor_set, .binding = self.descriptor_binding } },5416 .descriptor => std.lang.ExternOptions.Decoration{ .descriptor = .{ .set = self.location_or_descriptor_set, .binding = self.descriptor_binding } },
5417 .flat => std.lang.ExternOptions.Decoration{ .flat = self.location_or_descriptor_set },
5419 };5418 };
5420 }5419 }
5421 };5420 };
...@@ -9199,6 +9198,7 @@ pub fn getExtern(...@@ -9199,6 +9198,7 @@ pub fn getExtern(
9199 }) catch unreachable; // capacity asserted above9198 }) catch unreachable; // capacity asserted above
9200 const decoration_type, const location_or_descriptor_set, const descriptor_binding = if (key.decoration) |decoration| switch (decoration) {9199 const decoration_type, const location_or_descriptor_set, const descriptor_binding = if (key.decoration) |decoration| switch (decoration) {
9201 .location => |location| .{ Tag.Extern.Flags.DecorationType.location, location, undefined },9200 .location => |location| .{ Tag.Extern.Flags.DecorationType.location, location, undefined },
9201 .flat => |location| .{ Tag.Extern.Flags.DecorationType.flat, location, undefined },
9202 .descriptor => |descriptor| .{ Tag.Extern.Flags.DecorationType.descriptor, descriptor.set, descriptor.binding },9202 .descriptor => |descriptor| .{ Tag.Extern.Flags.DecorationType.descriptor, descriptor.set, descriptor.binding },
9203 } else .{ Tag.Extern.Flags.DecorationType.none, undefined, undefined };9203 } else .{ Tag.Extern.Flags.DecorationType.none, undefined, undefined };
9204 const extra_index = addExtraAssumeCapacity(extra, Tag.Extern{9204 const extra_index = addExtraAssumeCapacity(extra, Tag.Extern{
src/Sema.zig+7
...@@ -25021,6 +25021,13 @@ fn zirBuiltinExtern(...@@ -25021,6 +25021,13 @@ fn zirBuiltinExtern(
25021 .pcrel => if (options.visibility == .default) return sema.fail(block, options_src, "cannot require a pc-relative relocation to a symbol with default visibility", .{}),25021 .pcrel => if (options.visibility == .default) return sema.fail(block, options_src, "cannot require a pc-relative relocation to a symbol with default visibility", .{}),
25022 }25022 }
2502325023
25024 if (options.decoration) |decoration| switch (decoration) {
25025 .flat => if (ptr_info.flags.address_space != .input) {
25026 return sema.fail(block, options_src, "'flat' decoration requires 'input' address space", .{});
25027 },
25028 .location, .descriptor => {},
25029 };
25030
25024 // TODO: error for threadlocal functions, non-const functions, etc25031 // TODO: error for threadlocal functions, non-const functions, etc
2502525032
25026 const extern_val = try pt.getExtern(.{25033 const extern_val = try pt.getExtern(.{
src/codegen/spirv/Assembler.zig+9
...@@ -393,6 +393,15 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue {...@@ -393,6 +393,15 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue {
393 const actual_word_count = section.instructions.items.len - first_word;393 const actual_word_count = section.instructions.items.len - first_word;
394 section.instructions.items[first_word] |= @as(u32, @as(u16, @intCast(actual_word_count))) << 16 | @intFromEnum(ass.inst.opcode);394 section.instructions.items[first_word] |= @as(u32, @as(u16, @intCast(actual_word_count))) << 16 | @intFromEnum(ass.inst.opcode);
395395
396 switch (ass.inst.opcode) {
397 .OpKill,
398 .OpReturn,
399 .OpReturnValue,
400 .OpUnreachable,
401 => ass.cg.block_terminated = true,
402 else => {},
403 }
404
396 if (maybe_result_id) |result| return .{ .value = result };405 if (maybe_result_id) |result| return .{ .value = result };
397 return null;406 return null;
398}407}
src/codegen/spirv/CodeGen.zig+30-10
...@@ -118,6 +118,10 @@ block_stack: std.ArrayList(*Block) = .empty,...@@ -118,6 +118,10 @@ block_stack: std.ArrayList(*Block) = .empty,
118block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, Id) = .empty,118block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, Id) = .empty,
119base_line: u32,119base_line: u32,
120block_label: Id = .none,120block_label: Id = .none,
121/// Whether the current block has been terminated by a terminator
122/// instruction (e.g. OpKill from inline assembly). When true, no further
123/// branch instructions should be emitted for the current block.
124block_terminated: bool = false,
121next_arg_index: u32 = 0,125next_arg_index: u32 = 0,
122args: std.ArrayList(Id) = .empty,126args: std.ArrayList(Id) = .empty,
123virtual_allocas: std.AutoHashMapUnmanaged(Id, ?Id) = .empty,127virtual_allocas: std.AutoHashMapUnmanaged(Id, ?Id) = .empty,
...@@ -428,10 +432,13 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {...@@ -428,10 +432,13 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
428 if (ty.zigTypeTag(zcu) == .@"struct" and storage_class != .physical_storage_buffer) {432 if (ty.zigTypeTag(zcu) == .@"struct" and storage_class != .physical_storage_buffer) {
429 try cg.module.decorate(ty_id, .block);433 try cg.module.decorate(ty_id, .block);
430 }434 }
431 try cg.module.decorate(ptr_ty_id, .{435
432 .array_stride = .{ .array_stride = @intCast(ty.abiSize(zcu)) },436 if (ty.hasRuntimeBits(zcu)) {
433 });437 try cg.module.decorate(ptr_ty_id, .{
434 try cg.decorateLayout(ty, ty_id);438 .array_stride = .{ .array_stride = @intCast(ty.abiSize(zcu)) },
439 });
440 try cg.decorateLayout(ty, ty_id);
441 }
435 },442 },
436 else => {},443 else => {},
437 }444 }
...@@ -445,6 +452,10 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {...@@ -445,6 +452,10 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
445 .location = .{ .location = location },452 .location = .{ .location = location },
446 });453 });
447 },454 },
455 .flat => |location| {
456 try cg.module.decorate(result_id, .{ .location = .{ .location = location } });
457 try cg.module.decorate(result_id, .flat);
458 },
448 .descriptor => |descriptor| {459 .descriptor => |descriptor| {
449 if (storage_class != .storage_buffer and storage_class != .uniform and storage_class != .uniform_constant) {460 if (storage_class != .storage_buffer and storage_class != .uniform and storage_class != .uniform_constant) {
450 return cg.fail("storage class must be one of (storage_buffer, uniform, uniform_constant) but is {s}", .{@tagName(storage_class)});461 return cg.fail("storage class must be one of (storage_buffer, uniform, uniform_constant) but is {s}", .{@tagName(storage_class)});
...@@ -770,6 +781,7 @@ fn addFunctionDep(cg: *CodeGen, decl_index: Module.Decl.Index, storage_class: St...@@ -770,6 +781,7 @@ fn addFunctionDep(cg: *CodeGen, decl_index: Module.Decl.Index, storage_class: St
770fn beginSpvBlock(cg: *CodeGen, label: Id) !void {781fn beginSpvBlock(cg: *CodeGen, label: Id) !void {
771 try cg.body.emit(cg.module.gpa, .OpLabel, .{ .id_result = label });782 try cg.body.emit(cg.module.gpa, .OpLabel, .{ .id_result = label });
772 cg.block_label = label;783 cg.block_label = label;
784 cg.block_terminated = false;
773}785}
774786
775/// Return the amount of bits in the largest supported integer type. This is either 32 (always supported), or 64 (if787/// Return the amount of bits in the largest supported integer type. This is either 32 (always supported), or 64 (if
...@@ -2038,10 +2050,12 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id {...@@ -2038,10 +2050,12 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id {
2038 const elem_ty: Type = .fromInterned(spirv_type.ty);2050 const elem_ty: Type = .fromInterned(spirv_type.ty);
2039 const elem_ty_id = try cg.resolveType(elem_ty, .indirect);2051 const elem_ty_id = try cg.resolveType(elem_ty, .indirect);
2040 const result_id = try cg.module.runtimeArrayType(ip_index, elem_ty_id);2052 const result_id = try cg.module.runtimeArrayType(ip_index, elem_ty_id);
2041 try cg.module.decorate(2053
2042 result_id,2054 if (elem_ty.hasRuntimeBits(zcu)) {
2043 .{ .array_stride = .{ .array_stride = @intCast(elem_ty.abiSize(zcu)) } },2055 try cg.module.decorate(result_id, .{ .array_stride = .{
2044 );2056 .array_stride = @intCast(elem_ty.abiSize(zcu)),
2057 } });
2058 }
2045 return result_id;2059 return result_id;
2046 },2060 },
2047 }2061 }
...@@ -6564,6 +6578,8 @@ fn structuredNextBlock(cg: *CodeGen, incoming: []const Block.Incoming) !Id {...@@ -6564,6 +6578,8 @@ fn structuredNextBlock(cg: *CodeGen, incoming: []const Block.Incoming) !Id {
6564/// terminating a body, there should be no instructions after it.6578/// terminating a body, there should be no instructions after it.
6565/// This function should only be called with structured control flow generation.6579/// This function should only be called with structured control flow generation.
6566fn structuredBreak(cg: *CodeGen, target_block: Id) !void {6580fn structuredBreak(cg: *CodeGen, target_block: Id) !void {
6581 if (cg.block_terminated) return;
6582
6567 const gpa = cg.module.gpa;6583 const gpa = cg.module.gpa;
6568 const sblock = cg.block_stack.getLast().?;6584 const sblock = cg.block_stack.getLast().?;
6569 const merge_block = switch (sblock.*) {6585 const merge_block = switch (sblock.*) {
...@@ -6833,7 +6849,9 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {...@@ -6833,7 +6849,9 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
6833 .next_block = then_next,6849 .next_block = then_next,
6834 };6850 };
68356851
6836 try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label });6852 if (!cg.block_terminated) {
6853 try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label });
6854 }
68376855
6838 try cg.beginSpvBlock(else_label);6856 try cg.beginSpvBlock(else_label);
6839 const else_next = try cg.genStructuredBody(.selection, else_body);6857 const else_next = try cg.genStructuredBody(.selection, else_body);
...@@ -6842,7 +6860,9 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {...@@ -6842,7 +6860,9 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
6842 .next_block = else_next,6860 .next_block = else_next,
6843 };6861 };
68446862
6845 try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label });6863 if (!cg.block_terminated) {
6864 try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label });
6865 }
68466866
6847 try cg.beginSpvBlock(merge_label);6867 try cg.beginSpvBlock(merge_label);
6848 const next_block = try cg.structuredNextBlock(&.{ then_incoming, else_incoming });6868 const next_block = try cg.structuredNextBlock(&.{ then_incoming, else_incoming });
test/behavior/basic.zig+4
...@@ -302,6 +302,8 @@ test "compile time global reinterpret" {...@@ -302,6 +302,8 @@ test "compile time global reinterpret" {
302}302}
303303
304test "cast undefined" {304test "cast undefined" {
305 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
306
305 const array: [100]u8 = undefined;307 const array: [100]u8 = undefined;
306 const slice = @as([]const u8, &array);308 const slice = @as([]const u8, &array);
307 testCastUndefined(slice);309 testCastUndefined(slice);
...@@ -372,6 +374,7 @@ test "call function pointer in struct" {...@@ -372,6 +374,7 @@ test "call function pointer in struct" {
372 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO374 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
373 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;375 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
374 try expect(mem.eql(u8, f3(true), "a"));376 try expect(mem.eql(u8, f3(true), "a"));
377 try expect(mem.eql(u8, f3(false), "b"));
375}378}
376379
377fn f3(x: bool) []const u8 {380fn f3(x: bool) []const u8 {
...@@ -412,6 +415,7 @@ test "call result of if else expression" {...@@ -412,6 +415,7 @@ test "call result of if else expression" {
412 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;415 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
413416
414 try expect(mem.eql(u8, f2(true), "a"));417 try expect(mem.eql(u8, f2(true), "a"));
418 try expect(mem.eql(u8, f2(false), "b"));
415}419}
416fn f2(x: bool) []const u8 {420fn f2(x: bool) []const u8 {
417 return (if (x) &fA else &fB)();421 return (if (x) &fA else &fB)();
test/behavior/bitcast.zig+3
...@@ -35,6 +35,8 @@ test "@bitCast iX -> uX exotic integers" {...@@ -35,6 +35,8 @@ test "@bitCast iX -> uX exotic integers" {
35 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;35 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
36 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;36 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
37 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO37 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
38 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
39
38 const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 };40 const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 };
3941
40 inline for (bit_values) |bits| {42 inline for (bit_values) |bits| {
...@@ -77,6 +79,7 @@ test "bitcast uX to bytes" {...@@ -77,6 +79,7 @@ test "bitcast uX to bytes" {
77 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;79 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
78 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO80 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
79 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;81 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
82 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
8083
81 const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 };84 const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 };
82 inline for (bit_values) |bits| {85 inline for (bit_values) |bits| {
test/behavior/cast.zig+13
...@@ -103,6 +103,10 @@ test "comptime_int @floatFromInt" {...@@ -103,6 +103,10 @@ test "comptime_int @floatFromInt" {
103}103}
104104
105test "@floatFromInt" {105test "@floatFromInt" {
106 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
107 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
108 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
109
106 const S = struct {110 const S = struct {
107 fn doTheTest() !void {111 fn doTheTest() !void {
108 try testIntToFloat(-2);112 try testIntToFloat(-2);
...@@ -128,9 +132,13 @@ fn testIntFromFloat(comptime F: type, f: F, comptime I: type, i: I) !void {...@@ -128,9 +132,13 @@ fn testIntFromFloat(comptime F: type, f: F, comptime I: type, i: I) !void {
128132
129test "@intFromFloat > 128 bits" {133test "@intFromFloat > 128 bits" {
130 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;134 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
135 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
131 if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;136 if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
137 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
132138
139 try testIntFromFloat(f16, 1024, u140, 1024);
133 try testIntFromFloat(f16, -1024, i140, -1024);140 try testIntFromFloat(f16, -1024, i140, -1024);
141
134 try testIntFromFloat(f32, 1 << 24, u140, 1 << 24);142 try testIntFromFloat(f32, 1 << 24, u140, 1 << 24);
135 try testIntFromFloat(f32, -1 << 24, i140, -1 << 24);143 try testIntFromFloat(f32, -1 << 24, i140, -1 << 24);
136144
...@@ -152,10 +160,13 @@ test "@floatFromInt > 128 bits" {...@@ -152,10 +160,13 @@ test "@floatFromInt > 128 bits" {
152 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;160 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
153 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;161 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
154 if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;162 if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
163 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
155164
156 try testFloatFromInt(u140, 1024, f16, 1024);165 try testFloatFromInt(u140, 1024, f16, 1024);
166 try testFloatFromInt(i140, -1024, f16, -1024);
157167
158 try testFloatFromInt(u140, 1 << 24, f32, 1 << 24);168 try testFloatFromInt(u140, 1 << 24, f32, 1 << 24);
169 try testFloatFromInt(i140, -1 << 24, f32, -1 << 24);
159170
160 try testFloatFromInt(u200, 1 << 53, f64, 1 << 53);171 try testFloatFromInt(u200, 1 << 53, f64, 1 << 53);
161 try testFloatFromInt(i200, -1 << 53, f64, -1 << 53);172 try testFloatFromInt(i200, -1 << 53, f64, -1 << 53);
...@@ -416,9 +427,11 @@ test "implicit cast from *[N]T to [*c]T" {...@@ -416,9 +427,11 @@ test "implicit cast from *[N]T to [*c]T" {
416 var y: [*c]u16 = &x;427 var y: [*c]u16 = &x;
417428
418 try expect(std.mem.eql(u16, x[0..4], y[0..4]));429 try expect(std.mem.eql(u16, x[0..4], y[0..4]));
430 x[0] = 8;
419 y[3] = 6;431 y[3] = 6;
420 try expect(std.mem.eql(u16, x[0..4], y[0..4]));432 try expect(std.mem.eql(u16, x[0..4], y[0..4]));
421}433}
434
422test "*usize to *void" {435test "*usize to *void" {
423 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;436 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
424437
test/behavior/cast_int.zig+4
...@@ -8,6 +8,8 @@ const minInt = std.math.minInt;...@@ -8,6 +8,8 @@ const minInt = std.math.minInt;
8test "@intCast i32 to u7" {8test "@intCast i32 to u7" {
9 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO9 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO10 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
11 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
12
11 var x: u128 = maxInt(u128);13 var x: u128 = maxInt(u128);
12 var y: i32 = 120;14 var y: i32 = 120;
13 _ = .{ &x, &y };15 _ = .{ &x, &y };
...@@ -143,6 +145,7 @@ test "@intCast <= 64 bits" {...@@ -143,6 +145,7 @@ test "@intCast <= 64 bits" {
143 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;145 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
144 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;146 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
145 try testIntCast(i32, minInt(i32), i64, minInt(i32));147 try testIntCast(i32, minInt(i32), i64, minInt(i32));
148 try testIntCast(i32, maxInt(i32), i64, maxInt(i32));
146 try testIntCast(u32, maxInt(u32), u64, maxInt(u32));149 try testIntCast(u32, maxInt(u32), u64, maxInt(u32));
147 try testIntCast(u32, maxInt(i32), i64, maxInt(i32));150 try testIntCast(u32, maxInt(i32), i64, maxInt(i32));
148 try testIntCast(u32, maxInt(u32), i64, maxInt(u32));151 try testIntCast(u32, maxInt(u32), i64, maxInt(u32));
...@@ -169,6 +172,7 @@ test "@intCast > 128 bits" {...@@ -169,6 +172,7 @@ test "@intCast > 128 bits" {
169 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;172 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
170173
171 try testIntCast(u8, 123, u140, 123);174 try testIntCast(u8, 123, u140, 123);
175 try testIntCast(u64, 1 << 63, u140, 1 << 63);
172 try testIntCast(u127, maxInt(u127), u140, maxInt(u127));176 try testIntCast(u127, maxInt(u127), u140, maxInt(u127));
173 try testIntCast(i8, -42, i140, -42);177 try testIntCast(i8, -42, i140, -42);
174 try testIntCast(i64, minInt(i64), i140, minInt(i64));178 try testIntCast(i64, minInt(i64), i140, minInt(i64));
test/behavior/enum.zig+6
...@@ -932,6 +932,7 @@ test "constant enum initialization with differing sizes" {...@@ -932,6 +932,7 @@ test "constant enum initialization with differing sizes" {
932 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;932 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
933 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;933 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
934 try test3_1(test3_foo);934 try test3_1(test3_foo);
935 try test3_2(test3_bar);
935}936}
936const Test3Foo = union(enum) {937const Test3Foo = union(enum) {
937 One: void,938 One: void,
...@@ -972,7 +973,9 @@ test "@tagName" {...@@ -972,7 +973,9 @@ test "@tagName" {
972 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;973 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
973 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO974 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
974 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;975 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
976 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
975977
978 try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three"));
976 comptime assert(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three"));979 comptime assert(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three"));
977}980}
978981
...@@ -987,7 +990,9 @@ test "@tagName non-exhaustive enum" {...@@ -987,7 +990,9 @@ test "@tagName non-exhaustive enum" {
987 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;990 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
988 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO991 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
989 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;992 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
993 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
990994
995 try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B"));
991 comptime assert(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B"));996 comptime assert(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B"));
992}997}
993const NonExhaustive = enum(u8) { A, B, _ };998const NonExhaustive = enum(u8) { A, B, _ };
...@@ -1029,6 +1034,7 @@ test "@tagName on enum literals" {...@@ -1029,6 +1034,7 @@ test "@tagName on enum literals" {
1029 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;1034 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
10301035
1031 try expect(mem.eql(u8, @tagName(.FooBar), "FooBar"));1036 try expect(mem.eql(u8, @tagName(.FooBar), "FooBar"));
1037 comptime assert(mem.eql(u8, @tagName(.FooBar), "FooBar"));
1032}1038}
10331039
1034test "tag name with signed enum values" {1040test "tag name with signed enum values" {
test/behavior/error.zig+10
...@@ -145,11 +145,17 @@ test "implicit cast to optional to error union to return result loc" {...@@ -145,11 +145,17 @@ test "implicit cast to optional to error union to return result loc" {
145}145}
146146
147test "fn returning empty error set can be passed as fn returning any error" {147test "fn returning empty error set can be passed as fn returning any error" {
148 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
149
150 entry();
151 comptime entry();
148}152}
149153
150test "fn returning empty error set can be passed as fn returning any error - pointer" {154test "fn returning empty error set can be passed as fn returning any error - pointer" {
151 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;155 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
156
152 entryPtr();157 entryPtr();
158 comptime entryPtr();
153}159}
154fn entry() void {160fn entry() void {
155 foo2(bar2);161 foo2(bar2);
...@@ -362,8 +368,10 @@ test "error: Infer error set from literals" {...@@ -362,8 +368,10 @@ test "error: Infer error set from literals" {
362 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;368 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
363369
364 _ = nullLiteral("n") catch |err| handleErrors(err);370 _ = nullLiteral("n") catch |err| handleErrors(err);
371 _ = floatLiteral("n") catch |err| handleErrors(err);
365 _ = intLiteral("n") catch |err| handleErrors(err);372 _ = intLiteral("n") catch |err| handleErrors(err);
366 _ = comptime nullLiteral("n") catch |err| handleErrors(err);373 _ = comptime nullLiteral("n") catch |err| handleErrors(err);
374 _ = comptime floatLiteral("n") catch |err| handleErrors(err);
367 _ = comptime intLiteral("n") catch |err| handleErrors(err);375 _ = comptime intLiteral("n") catch |err| handleErrors(err);
368}376}
369377
...@@ -689,6 +697,7 @@ test "coerce error set to the current inferred error set" {...@@ -689,6 +697,7 @@ test "coerce error set to the current inferred error set" {
689test "error union payload is properly aligned" {697test "error union payload is properly aligned" {
690 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO698 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
691 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO699 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
700 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
692701
693 const S = struct {702 const S = struct {
694 a: u128,703 a: u128,
...@@ -746,6 +755,7 @@ test "pointer to error union payload" {...@@ -746,6 +755,7 @@ test "pointer to error union payload" {
746 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO755 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
747 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO756 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
748 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;757 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
758 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
749759
750 var err_union: anyerror!u8 = 15;760 var err_union: anyerror!u8 = 15;
751761
test/behavior/eval.zig-1
...@@ -1181,7 +1181,6 @@ test "lazy sizeof is resolved in division" {...@@ -1181,7 +1181,6 @@ test "lazy sizeof is resolved in division" {
1181}1181}
11821182
1183test "lazy sizeof union tag size in compare" {1183test "lazy sizeof union tag size in compare" {
1184
1185 const A = union(enum) {1184 const A = union(enum) {
1186 a: void,1185 a: void,
1187 b: void,1186 b: void,
test/behavior/floatop.zig+8
...@@ -134,6 +134,8 @@ test "cmp f32" {...@@ -134,6 +134,8 @@ test "cmp f32" {
134}134}
135135
136test "cmp f64" {136test "cmp f64" {
137 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
138
137 try testCmp(f64);139 try testCmp(f64);
138 try comptime testCmp(f64);140 try comptime testCmp(f64);
139}141}
...@@ -142,7 +144,9 @@ test "cmp f128" {...@@ -142,7 +144,9 @@ test "cmp f128" {
142 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO144 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
143 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;145 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
144 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;146 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
147 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
145148
149 try testCmp(f128);
146 try comptime testCmp(f128);150 try comptime testCmp(f128);
147}151}
148152
...@@ -150,7 +154,10 @@ test "cmp f80/c_longdouble" {...@@ -150,7 +154,10 @@ test "cmp f80/c_longdouble" {
150 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO154 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
151 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;155 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
152 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;156 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
157 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
153158
159 try testCmp(f80);
160 try comptime testCmp(f80);
154 try testCmp(c_longdouble);161 try testCmp(c_longdouble);
155 try comptime testCmp(c_longdouble);162 try comptime testCmp(c_longdouble);
156}163}
...@@ -225,6 +232,7 @@ test "vector cmp f32" {...@@ -225,6 +232,7 @@ test "vector cmp f32" {
225 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;232 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
226 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO233 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
227 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;234 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
235 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isArm()) return error.SkipZigTest;
228 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;236 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
229 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;237 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
230238
test/behavior/fn.zig+6
...@@ -292,6 +292,9 @@ fn voidFun(a: i32, b: void, c: i32, d: void) !void {...@@ -292,6 +292,9 @@ fn voidFun(a: i32, b: void, c: i32, d: void) !void {
292292
293test "call function with empty string" {293test "call function with empty string" {
294 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO294 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
295 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
296
297 acceptsString("");
295}298}
296299
297fn acceptsString(foo: []u8) void {300fn acceptsString(foo: []u8) void {
...@@ -302,7 +305,9 @@ test "function pointers" {...@@ -302,7 +305,9 @@ test "function pointers" {
302 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO305 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
303 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO306 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
304 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;307 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
308
305 const fns = [_]*const @TypeOf(fn1){309 const fns = [_]*const @TypeOf(fn1){
310 &fn1,
306 &fn2,311 &fn2,
307 &fn3,312 &fn3,
308 &fn4,313 &fn4,
...@@ -440,6 +445,7 @@ test "method call with optional and error union first param" {...@@ -440,6 +445,7 @@ test "method call with optional and error union first param" {
440 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;445 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
441446
442 const S = struct {447 const S = struct {
448 x: i32 = 1234,
443449
444 fn opt(s: ?@This()) !void {450 fn opt(s: ?@This()) !void {
445 try expect(s.?.x == 1234);451 try expect(s.?.x == 1234);
test/behavior/math.zig+1-1
...@@ -574,6 +574,7 @@ test "large integer division" {...@@ -574,6 +574,7 @@ test "large integer division" {
574 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;574 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
575 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;575 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
576 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;576 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
577 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
577578
578 {579 {
579 var numerator: u256 = 99999999999999999997315645440;580 var numerator: u256 = 99999999999999999997315645440;
...@@ -654,7 +655,6 @@ fn testSignedWrappingEval(x: i32) !void {...@@ -654,7 +655,6 @@ fn testSignedWrappingEval(x: i32) !void {
654}655}
655656
656test "signed negation wrapping" {657test "signed negation wrapping" {
657
658 try testSignedNegationWrappingEval(minInt(i16));658 try testSignedNegationWrappingEval(minInt(i16));
659 try comptime testSignedNegationWrappingEval(minInt(i16));659 try comptime testSignedNegationWrappingEval(minInt(i16));
660}660}
test/behavior/maximum_minimum.zig+1
...@@ -350,6 +350,7 @@ test "@min/@max with runtime signed and unsigned integers of same size" {...@@ -350,6 +350,7 @@ test "@min/@max with runtime signed and unsigned integers of same size" {
350350
351test "@min/@max with runtime vectors of signed and unsigned integers of same size" {351test "@min/@max with runtime vectors of signed and unsigned integers of same size" {
352 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;352 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
353 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
353 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO354 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
354 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO355 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
355 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;356 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
test/behavior/memcpy.zig-1
...@@ -168,7 +168,6 @@ test "@memcpy with sentinel" {...@@ -168,7 +168,6 @@ test "@memcpy with sentinel" {
168}168}
169169
170test "@memcpy no sentinel source into sentinel destination" {170test "@memcpy no sentinel source into sentinel destination" {
171
172 const S = struct {171 const S = struct {
173 fn doTheTest() void {172 fn doTheTest() void {
174 const src: []const u8 = &.{ 1, 2, 3 };173 const src: []const u8 = &.{ 1, 2, 3 };
test/behavior/muladd.zig+3
...@@ -34,6 +34,7 @@ test "@mulAdd f16" {...@@ -34,6 +34,7 @@ test "@mulAdd f16" {
34 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;34 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
3535
36 try comptime testMulAdd16();36 try comptime testMulAdd16();
37 try testMulAdd16();
37}38}
3839
39fn testMulAdd16() !void {40fn testMulAdd16() !void {
...@@ -48,7 +49,9 @@ test "@mulAdd f80" {...@@ -48,7 +49,9 @@ test "@mulAdd f80" {
48 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO49 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
49 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO50 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
50 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;51 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
52 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
51 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;53 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
54
52 try comptime testMulAdd80();55 try comptime testMulAdd80();
53 try testMulAdd80();56 try testMulAdd80();
54}57}
test/behavior/optional.zig+1
...@@ -522,6 +522,7 @@ test "alignment of wrapping an optional payload" {...@@ -522,6 +522,7 @@ test "alignment of wrapping an optional payload" {
522 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;522 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
523 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO523 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
524 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;524 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
525 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
525526
526 const S = struct {527 const S = struct {
527 const I = extern struct { x: i128 };528 const I = extern struct { x: i128 };
test/behavior/packed-struct.zig+3
...@@ -227,6 +227,8 @@ test "nested packed structs" {...@@ -227,6 +227,8 @@ test "nested packed structs" {
227test "regular in irregular packed struct" {227test "regular in irregular packed struct" {
228 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;228 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
229 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO229 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
230 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
231
230 const Irregular = packed struct {232 const Irregular = packed struct {
231 bar: Regular = Regular{},233 bar: Regular = Regular{},
232 _: u24 = 0,234 _: u24 = 0,
...@@ -247,6 +249,7 @@ test "nested packed struct unaligned" {...@@ -247,6 +249,7 @@ test "nested packed struct unaligned" {
247 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO249 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
248 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;250 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
249 const S1 = packed struct {251 const S1 = packed struct {
252 a: u4,
250 b: u4,253 b: u4,
251 c: u8,254 c: u8,
252 };255 };
test/behavior/struct.zig+3
...@@ -446,6 +446,7 @@ test "runtime struct initialization of bitfield" {...@@ -446,6 +446,7 @@ test "runtime struct initialization of bitfield" {
446 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;446 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
447 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO447 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
448 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO448 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
449 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
449450
450 const s1 = Nibbles{451 const s1 = Nibbles{
451 .x = x1,452 .x = x1,
...@@ -503,6 +504,7 @@ test "implicit cast packed struct field to const ptr" {...@@ -503,6 +504,7 @@ test "implicit cast packed struct field to const ptr" {
503 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;504 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
504 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO505 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
505 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO506 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
507 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO
506508
507 const LevelUpMove = packed struct {509 const LevelUpMove = packed struct {
508 move_id: u9,510 move_id: u9,
...@@ -536,6 +538,7 @@ test "packed struct with non-ABI-aligned field" {...@@ -536,6 +538,7 @@ test "packed struct with non-ABI-aligned field" {
536 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO538 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
537 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO539 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
538 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;540 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
541 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
539542
540 const S = packed struct {543 const S = packed struct {
541 x: u9,544 x: u9,
test/behavior/vector.zig+2
...@@ -415,6 +415,7 @@ test "vector @splat" {...@@ -415,6 +415,7 @@ test "vector @splat" {
415415
416test "load vector elements via comptime index" {416test "load vector elements via comptime index" {
417 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;417 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
418 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
418 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO419 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
419420
420 const S = struct {421 const S = struct {
...@@ -617,6 +618,7 @@ test "vector division operators" {...@@ -617,6 +618,7 @@ test "vector division operators" {
617test "vector bitwise not operator" {618test "vector bitwise not operator" {
618 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;619 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
619 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;620 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
621 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
620 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO622 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
621 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;623 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
622624
test/behavior/while.zig-1
...@@ -38,7 +38,6 @@ fn staticWhileLoop2() i32 {...@@ -38,7 +38,6 @@ fn staticWhileLoop2() i32 {
38}38}
3939
40test "while with continue expression" {40test "while with continue expression" {
41
42 var sum: i32 = 0;41 var sum: i32 = 0;
43 {42 {
44 var i: i32 = 0;43 var i: i32 = 0;
test/cases/compile_errors/extern_spirv_decoration_validation.zig created+13
...@@ -0,0 +1,13 @@
1const x = @extern(*addrspace(.output) u32, .{
2 .name = "x",
3 .decoration = .{ .flat = 0 },
4});
5comptime {
6 _ = x;
7}
8
9// error
10// backend=selfhosted
11// target=spirv64-vulkan
12//
13// :1:45: error: 'flat' decoration requires 'input' address space