authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-03-12 16:52:03+03:30
committergravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-03-18 07:05:50+03:30
logd18eaf8586cf173d5605d5885fcbe26d64af00c5
treec7fab57686d0931e975ab2f362b4a48b3c01551a
parent54c097f50ddc794dc2b3890490379ab2f8371443

spirv: aligned load for physical storage variables

Resolves #23212

5 files changed, 83 insertions(+), 54 deletions(-)

src/codegen/spirv.zig+81-34
...@@ -1024,6 +1024,11 @@ const NavGen = struct {...@@ -1024,6 +1024,11 @@ const NavGen = struct {
1024 else => unreachable,1024 else => unreachable,
1025 },1025 },
1026 .un => |un| {1026 .un => |un| {
1027 if (un.tag == .none) {
1028 assert(ty.containerLayout(zcu) == .@"packed"); // TODO
1029 const int_ty = try pt.intType(.unsigned, @intCast(ty.bitSize(zcu)));
1030 return try self.constant(int_ty, Value.fromInterned(un.val), .direct);
1031 }
1027 const active_field = ty.unionTagFieldIndex(Value.fromInterned(un.tag), zcu).?;1032 const active_field = ty.unionTagFieldIndex(Value.fromInterned(un.tag), zcu).?;
1028 const union_obj = zcu.typeToUnion(ty).?;1033 const union_obj = zcu.typeToUnion(ty).?;
1029 const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[active_field]);1034 const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[active_field]);
...@@ -1356,7 +1361,7 @@ const NavGen = struct {...@@ -1356,7 +1361,7 @@ const NavGen = struct {
1356 const union_obj = zcu.typeToUnion(ty).?;1361 const union_obj = zcu.typeToUnion(ty).?;
13571362
1358 if (union_obj.flagsUnordered(ip).layout == .@"packed") {1363 if (union_obj.flagsUnordered(ip).layout == .@"packed") {
1359 return self.todo("packed union types", .{});1364 return try self.intType(.unsigned, @intCast(ty.bitSize(zcu)));
1360 }1365 }
13611366
1362 const layout = self.unionLayout(ty);1367 const layout = self.unionLayout(ty);
...@@ -3226,10 +3231,13 @@ const NavGen = struct {...@@ -3226,10 +3231,13 @@ const NavGen = struct {
3226 };3231 };
32273232
3228 fn load(self: *NavGen, value_ty: Type, ptr_id: IdRef, options: MemoryOptions) !IdRef {3233 fn load(self: *NavGen, value_ty: Type, ptr_id: IdRef, options: MemoryOptions) !IdRef {
3234 const zcu = self.pt.zcu;
3235 const alignment: u32 = @intCast(value_ty.abiAlignment(zcu).toByteUnits().?);
3229 const indirect_value_ty_id = try self.resolveType(value_ty, .indirect);3236 const indirect_value_ty_id = try self.resolveType(value_ty, .indirect);
3230 const result_id = self.spv.allocId();3237 const result_id = self.spv.allocId();
3231 const access = spec.MemoryAccess.Extended{3238 const access = spec.MemoryAccess.Extended{
3232 .Volatile = options.is_volatile,3239 .Volatile = options.is_volatile,
3240 .Aligned = .{ .literal_integer = alignment },
3233 };3241 };
3234 try self.func.body.emit(self.spv.gpa, .OpLoad, .{3242 try self.func.body.emit(self.spv.gpa, .OpLoad, .{
3235 .id_result_type = indirect_value_ty_id,3243 .id_result_type = indirect_value_ty_id,
...@@ -5130,11 +5138,33 @@ const NavGen = struct {...@@ -5130,11 +5138,33 @@ const NavGen = struct {
5130 const union_ty = zcu.typeToUnion(ty).?;5138 const union_ty = zcu.typeToUnion(ty).?;
5131 const tag_ty = Type.fromInterned(union_ty.enum_tag_ty);5139 const tag_ty = Type.fromInterned(union_ty.enum_tag_ty);
51325140
5141 const layout = self.unionLayout(ty);
5142 const payload_ty = Type.fromInterned(union_ty.field_types.get(ip)[active_field]);
5143
5133 if (union_ty.flagsUnordered(ip).layout == .@"packed") {5144 if (union_ty.flagsUnordered(ip).layout == .@"packed") {
5134 unreachable; // TODO5145 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
5135 }5146 const int_ty = try pt.intType(.unsigned, @intCast(ty.bitSize(zcu)));
5147 return self.constInt(int_ty, 0);
5148 }
51365149
5137 const layout = self.unionLayout(ty);5150 assert(payload != null);
5151 if (payload_ty.isInt(zcu)) {
5152 if (ty.bitSize(zcu) == payload_ty.bitSize(zcu)) {
5153 return self.bitCast(ty, payload_ty, payload.?);
5154 }
5155
5156 const trunc = try self.buildIntConvert(ty, .{ .ty = payload_ty, .value = .{ .singleton = payload.? } });
5157 return try trunc.materialize(self);
5158 }
5159
5160 const payload_int_ty = try pt.intType(.unsigned, @intCast(payload_ty.bitSize(zcu)));
5161 const payload_int = if (payload_ty.ip_index == .bool_type)
5162 try self.convertToIndirect(payload_ty, payload.?)
5163 else
5164 try self.bitCast(payload_int_ty, payload_ty, payload.?);
5165 const trunc = try self.buildIntConvert(ty, .{ .ty = payload_int_ty, .value = .{ .singleton = payload_int } });
5166 return try trunc.materialize(self);
5167 }
51385168
5139 const tag_int = if (layout.tag_size != 0) blk: {5169 const tag_int = if (layout.tag_size != 0) blk: {
5140 const tag_val = try pt.enumValueFieldIndex(tag_ty, active_field);5170 const tag_val = try pt.enumValueFieldIndex(tag_ty, active_field);
...@@ -5155,7 +5185,6 @@ const NavGen = struct {...@@ -5155,7 +5185,6 @@ const NavGen = struct {
5155 try self.store(tag_ty, ptr_id, tag_id, .{});5185 try self.store(tag_ty, ptr_id, tag_id, .{});
5156 }5186 }
51575187
5158 const payload_ty = Type.fromInterned(union_ty.field_types.get(ip)[active_field]);
5159 if (payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {5188 if (payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
5160 const pl_ptr_ty_id = try self.ptrType(layout.payload_ty, .Function, .indirect);5189 const pl_ptr_ty_id = try self.ptrType(layout.payload_ty, .Function, .indirect);
5161 const pl_ptr_id = try self.accessChain(pl_ptr_ty_id, tmp_id, &.{layout.payload_index});5190 const pl_ptr_id = try self.accessChain(pl_ptr_ty_id, tmp_id, &.{layout.payload_index});
...@@ -5198,7 +5227,6 @@ const NavGen = struct {...@@ -5198,7 +5227,6 @@ const NavGen = struct {
5198 fn airStructFieldVal(self: *NavGen, inst: Air.Inst.Index) !?IdRef {5227 fn airStructFieldVal(self: *NavGen, inst: Air.Inst.Index) !?IdRef {
5199 const pt = self.pt;5228 const pt = self.pt;
5200 const zcu = pt.zcu;5229 const zcu = pt.zcu;
5201 const ip = &zcu.intern_pool;
5202 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;5230 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
5203 const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data;5231 const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data;
52045232
...@@ -5213,16 +5241,39 @@ const NavGen = struct {...@@ -5213,16 +5241,39 @@ const NavGen = struct {
5213 .@"struct" => switch (object_ty.containerLayout(zcu)) {5241 .@"struct" => switch (object_ty.containerLayout(zcu)) {
5214 .@"packed" => {5242 .@"packed" => {
5215 const struct_ty = zcu.typeToPackedStruct(object_ty).?;5243 const struct_ty = zcu.typeToPackedStruct(object_ty).?;
5216 const backing_int_ty = Type.fromInterned(struct_ty.backingIntTypeUnordered(ip));
5217 const bit_offset = pt.structPackedFieldBitOffset(struct_ty, field_index);5244 const bit_offset = pt.structPackedFieldBitOffset(struct_ty, field_index);
5218 const bit_offset_id = try self.constInt(.u16, bit_offset);5245 const bit_offset_id = try self.constInt(.u16, bit_offset);
5219 const signedness = if (field_ty.isInt(zcu)) field_ty.intInfo(zcu).signedness else .unsigned;5246 const signedness = if (field_ty.isInt(zcu)) field_ty.intInfo(zcu).signedness else .unsigned;
5220 const field_bit_size: u16 = @intCast(field_ty.bitSize(zcu));5247 const field_bit_size: u16 = @intCast(field_ty.bitSize(zcu));
5221 const int_ty = try pt.intType(signedness, field_bit_size);5248 const field_int_ty = try pt.intType(signedness, field_bit_size);
5222 const shift_lhs: Temporary = .{ .ty = backing_int_ty, .value = .{ .singleton = object_id } };5249 const shift_lhs: Temporary = .{ .ty = object_ty, .value = .{ .singleton = object_id } };
5223 const shift = try self.buildBinary(.srl, shift_lhs, .{ .ty = .u16, .value = .{ .singleton = bit_offset_id } });5250 const shift = try self.buildBinary(.srl, shift_lhs, .{ .ty = .u16, .value = .{ .singleton = bit_offset_id } });
5251 const mask_id = try self.constInt(object_ty, (@as(u64, 1) << @as(u6, @intCast(field_bit_size))) - 1);
5252 const masked = try self.buildBinary(.bit_and, shift, .{ .ty = object_ty, .value = .{ .singleton = mask_id } });
5253 const result_id = blk: {
5254 if (self.backingIntBits(field_bit_size).? == self.backingIntBits(@intCast(object_ty.bitSize(zcu))).?)
5255 break :blk try self.bitCast(field_int_ty, object_ty, try masked.materialize(self));
5256 const trunc = try self.buildIntConvert(field_int_ty, masked);
5257 break :blk try trunc.materialize(self);
5258 };
5259 if (field_ty.ip_index == .bool_type) return try self.convertToDirect(.bool, result_id);
5260 if (field_ty.isInt(zcu)) return result_id;
5261 return try self.bitCast(field_ty, field_int_ty, result_id);
5262 },
5263 else => return try self.extractField(field_ty, object_id, field_index),
5264 },
5265 .@"union" => switch (object_ty.containerLayout(zcu)) {
5266 .@"packed" => {
5267 const backing_int_ty = try pt.intType(.unsigned, @intCast(object_ty.bitSize(zcu)));
5268 const signedness = if (field_ty.isInt(zcu)) field_ty.intInfo(zcu).signedness else .unsigned;
5269 const field_bit_size: u16 = @intCast(field_ty.bitSize(zcu));
5270 const int_ty = try pt.intType(signedness, field_bit_size);
5224 const mask_id = try self.constInt(backing_int_ty, (@as(u64, 1) << @as(u6, @intCast(field_bit_size))) - 1);5271 const mask_id = try self.constInt(backing_int_ty, (@as(u64, 1) << @as(u6, @intCast(field_bit_size))) - 1);
5225 const masked = try self.buildBinary(.bit_and, shift, .{ .ty = backing_int_ty, .value = .{ .singleton = mask_id } });5272 const masked = try self.buildBinary(
5273 .bit_and,
5274 .{ .ty = backing_int_ty, .value = .{ .singleton = object_id } },
5275 .{ .ty = backing_int_ty, .value = .{ .singleton = mask_id } },
5276 );
5226 const result_id = blk: {5277 const result_id = blk: {
5227 if (self.backingIntBits(field_bit_size).? == self.backingIntBits(@intCast(backing_int_ty.bitSize(zcu))).?)5278 if (self.backingIntBits(field_bit_size).? == self.backingIntBits(@intCast(backing_int_ty.bitSize(zcu))).?)
5228 break :blk try self.bitCast(int_ty, backing_int_ty, try masked.materialize(self));5279 break :blk try self.bitCast(int_ty, backing_int_ty, try masked.materialize(self));
...@@ -5233,10 +5284,6 @@ const NavGen = struct {...@@ -5233,10 +5284,6 @@ const NavGen = struct {
5233 if (field_ty.isInt(zcu)) return result_id;5284 if (field_ty.isInt(zcu)) return result_id;
5234 return try self.bitCast(field_ty, int_ty, result_id);5285 return try self.bitCast(field_ty, int_ty, result_id);
5235 },5286 },
5236 else => return try self.extractField(field_ty, object_id, field_index),
5237 },
5238 .@"union" => switch (object_ty.containerLayout(zcu)) {
5239 .@"packed" => unreachable, // TODO
5240 else => {5287 else => {
5241 // Store, ptr-elem-ptr, pointer-cast, load5288 // Store, ptr-elem-ptr, pointer-cast, load
5242 const layout = self.unionLayout(object_ty);5289 const layout = self.unionLayout(object_ty);
...@@ -5317,28 +5364,28 @@ const NavGen = struct {...@@ -5317,28 +5364,28 @@ const NavGen = struct {
5317 return try self.accessChain(result_ty_id, object_ptr, &.{field_index});5364 return try self.accessChain(result_ty_id, object_ptr, &.{field_index});
5318 },5365 },
5319 },5366 },
5320 .@"union" => switch (object_ty.containerLayout(zcu)) {5367 .@"union" => {
5321 .@"packed" => return self.todo("implement field access for packed unions", .{}),5368 const layout = self.unionLayout(object_ty);
5322 else => {5369 if (!layout.has_payload) {
5323 const layout = self.unionLayout(object_ty);5370 // Asked to get a pointer to a zero-sized field. Just lower this
5324 if (!layout.has_payload) {5371 // to undefined, there is no reason to make it be a valid pointer.
5325 // Asked to get a pointer to a zero-sized field. Just lower this5372 return try self.spv.constUndef(result_ty_id);
5326 // to undefined, there is no reason to make it be a valid pointer.5373 }
5327 return try self.spv.constUndef(result_ty_id);
5328 }
53295374
5330 const storage_class = self.spvStorageClass(object_ptr_ty.ptrAddressSpace(zcu));5375 const storage_class = self.spvStorageClass(object_ptr_ty.ptrAddressSpace(zcu));
5331 const pl_ptr_ty_id = try self.ptrType(layout.payload_ty, storage_class, .indirect);5376 const pl_ptr_ty_id = try self.ptrType(layout.payload_ty, storage_class, .indirect);
5332 const pl_ptr_id = try self.accessChain(pl_ptr_ty_id, object_ptr, &.{layout.payload_index});5377 const pl_ptr_id = blk: {
5378 if (object_ty.containerLayout(zcu) == .@"packed") break :blk object_ptr;
5379 break :blk try self.accessChain(pl_ptr_ty_id, object_ptr, &.{layout.payload_index});
5380 };
53335381
5334 const active_pl_ptr_id = self.spv.allocId();5382 const active_pl_ptr_id = self.spv.allocId();
5335 try self.func.body.emit(self.spv.gpa, .OpBitcast, .{5383 try self.func.body.emit(self.spv.gpa, .OpBitcast, .{
5336 .id_result_type = result_ty_id,5384 .id_result_type = result_ty_id,
5337 .id_result = active_pl_ptr_id,5385 .id_result = active_pl_ptr_id,
5338 .operand = pl_ptr_id,5386 .operand = pl_ptr_id,
5339 });5387 });
5340 return active_pl_ptr_id;5388 return active_pl_ptr_id;
5341 },
5342 },5389 },
5343 else => unreachable,5390 else => unreachable,
5344 }5391 }
test/behavior/cast_int.zig-4
...@@ -22,7 +22,6 @@ test "coerce i8 to i32 and @intCast back" {...@@ -22,7 +22,6 @@ test "coerce i8 to i32 and @intCast back" {
22 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO22 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
23 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO23 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
24 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO24 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
25 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
2625
27 var x: i8 = -5;26 var x: i8 = -5;
28 var y: i32 = -5;27 var y: i32 = -5;
...@@ -36,8 +35,6 @@ test "coerce i8 to i32 and @intCast back" {...@@ -36,8 +35,6 @@ test "coerce i8 to i32 and @intCast back" {
36}35}
3736
38test "coerce non byte-sized integers accross 32bits boundary" {37test "coerce non byte-sized integers accross 32bits boundary" {
39 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
40
41 {38 {
42 var v: u21 = 6417;39 var v: u21 = 6417;
43 _ = &v;40 _ = &v;
...@@ -217,7 +214,6 @@ test "load non byte-sized value in union" {...@@ -217,7 +214,6 @@ test "load non byte-sized value in union" {
217 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;214 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
218 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;215 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
219 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;216 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
220 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
221 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;217 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
222 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;218 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
223219
test/behavior/export_keyword.zig-1
...@@ -25,7 +25,6 @@ const PackedUnion = packed union {...@@ -25,7 +25,6 @@ const PackedUnion = packed union {
2525
26test "packed struct, enum, union parameters in extern function" {26test "packed struct, enum, union parameters in extern function" {
27 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO27 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
28 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
2928
30 testPackedStuff(&(PackedStruct{29 testPackedStuff(&(PackedStruct{
31 .a = 1,30 .a = 1,
test/behavior/packed-union.zig-3
...@@ -137,7 +137,6 @@ test "packed union initialized with a runtime value" {...@@ -137,7 +137,6 @@ test "packed union initialized with a runtime value" {
137 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO137 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
138 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO138 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
139 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO139 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
140 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
141 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;140 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
142141
143 const Fields = packed struct {142 const Fields = packed struct {
...@@ -174,8 +173,6 @@ test "assigning to non-active field at comptime" {...@@ -174,8 +173,6 @@ test "assigning to non-active field at comptime" {
174}173}
175174
176test "comptime packed union of pointers" {175test "comptime packed union of pointers" {
177 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
178
179 const U = packed union {176 const U = packed union {
180 a: *const u32,177 a: *const u32,
181 b: *const [1]u32,178 b: *const [1]u32,
test/behavior/union.zig+2-12
...@@ -1372,14 +1372,13 @@ test "packed union in packed struct" {...@@ -1372,14 +1372,13 @@ test "packed union in packed struct" {
1372 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO1372 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1373 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1373 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1374 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1374 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1375 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
13761375
1377 const S = packed struct {1376 const S = packed struct {
1378 nested: packed union {1377 nested: packed union {
1379 val: usize,1378 val: u16,
1380 foo: u32,1379 foo: u32,
1381 },1380 },
1382 bar: u32,1381 bar: u16,
13831382
1384 fn unpack(self: @This()) usize {1383 fn unpack(self: @This()) usize {
1385 return self.nested.foo;1384 return self.nested.foo;
...@@ -1460,7 +1459,6 @@ test "packed union with zero-bit field" {...@@ -1460,7 +1459,6 @@ test "packed union with zero-bit field" {
1460 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO1459 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1461 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1460 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1462 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1461 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1463 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
14641462
1465 const S = packed struct {1463 const S = packed struct {
1466 nested: packed union {1464 nested: packed union {
...@@ -1479,7 +1477,6 @@ test "packed union with zero-bit field" {...@@ -1479,7 +1477,6 @@ test "packed union with zero-bit field" {
1479test "reinterpreting enum value inside packed union" {1477test "reinterpreting enum value inside packed union" {
1480 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO1478 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1481 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1479 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1482 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
14831480
1484 const U = packed union {1481 const U = packed union {
1485 tag: enum(u8) { a, b },1482 tag: enum(u8) { a, b },
...@@ -1527,7 +1524,6 @@ test "defined-layout union field pointer has correct alignment" {...@@ -1527,7 +1524,6 @@ test "defined-layout union field pointer has correct alignment" {
1527 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1524 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1528 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO1525 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1529 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1526 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1530 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO
15311527
1532 const S = struct {1528 const S = struct {
1533 fn doTheTest(comptime U: type) !void {1529 fn doTheTest(comptime U: type) !void {
...@@ -1901,8 +1897,6 @@ test "inner struct initializer uses union layout" {...@@ -1901,8 +1897,6 @@ test "inner struct initializer uses union layout" {
1901}1897}
19021898
1903test "inner struct initializer uses packed union layout" {1899test "inner struct initializer uses packed union layout" {
1904 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1905
1906 const namespace = struct {1900 const namespace = struct {
1907 const U = packed union {1901 const U = packed union {
1908 a: packed struct {1902 a: packed struct {
...@@ -1946,8 +1940,6 @@ test "extern union initialized via reintepreted struct field initializer" {...@@ -1946,8 +1940,6 @@ test "extern union initialized via reintepreted struct field initializer" {
1946}1940}
19471941
1948test "packed union initialized via reintepreted struct field initializer" {1942test "packed union initialized via reintepreted struct field initializer" {
1949 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1950
1951 const bytes = [_]u8{ 0xaa, 0xbb, 0xcc, 0xdd };1943 const bytes = [_]u8{ 0xaa, 0xbb, 0xcc, 0xdd };
19521944
1953 const U = packed union {1945 const U = packed union {
...@@ -1988,8 +1980,6 @@ test "store of comptime reinterpreted memory to extern union" {...@@ -1988,8 +1980,6 @@ test "store of comptime reinterpreted memory to extern union" {
1988}1980}
19891981
1990test "store of comptime reinterpreted memory to packed union" {1982test "store of comptime reinterpreted memory to packed union" {
1991 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1992
1993 const bytes = [_]u8{ 0xaa, 0xbb, 0xcc, 0xdd };1983 const bytes = [_]u8{ 0xaa, 0xbb, 0xcc, 0xdd };
19941984
1995 const U = packed union {1985 const U = packed union {