| author | |
| committer | |
| log | c0f9b51d846e71f46f37ffa010152c7776d77991 |
| tree | 84d9ecf50159a66bbdc56713f9e1140936f00f73 |
| parent | 002f324dfcd4f70d98cbfb7df57cee27bdf3db9f |
| parent | 827c3d528c02b0f2b708718254b10621c08c8b19 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36051
Reviewed-by: Andrew Kelley <andrew@ziglang.org>25 files changed, 154 insertions(+), 91 deletions(-)
src/Sema.zig+9-1| ... | ... | @@ -25377,12 +25377,16 @@ pub fn explainWhyTypeIsNotExtern( |
| 25377 | 25377 | .noreturn => try sema.errNote(src_loc, msg, "'noreturn' is only allowed as a return type", .{}), |
| 25378 | 25378 | |
| 25379 | 25379 | .@"opaque", |
| 25380 | .spirv, | |
| 25381 | 25380 | .bool, |
| 25382 | 25381 | .float, |
| 25383 | 25382 | .@"anyframe", |
| 25384 | 25383 | => unreachable, // these *are* allowed |
| 25385 | 25384 | |
| 25385 | .spirv => { | |
| 25386 | assert(ty.isSpirvRuntimeArray(zcu)); | |
| 25387 | try sema.errNote(src_loc, msg, "SPIR-V runtime arrays must be the last field of an extern struct", .{}); | |
| 25388 | }, | |
| 25389 | ||
| 25386 | 25390 | .pointer => if (ty.isSlice(zcu)) { |
| 25387 | 25391 | try sema.errNote(src_loc, msg, "slices have no guaranteed in-memory representation", .{}); |
| 25388 | 25392 | } else { |
| ... | ... | @@ -30541,6 +30545,10 @@ fn analyzeLoad( |
| 30541 | 30545 | |
| 30542 | 30546 | try sema.ensureLayoutResolved(elem_ty, src, .ptr_access); |
| 30543 | 30547 | |
| 30548 | if (elem_ty.isSpirvRuntimeArray(zcu)) { | |
| 30549 | return sema.fail(block, src, "cannot load SPIR-V runtime array value", .{}); | |
| 30550 | } | |
| 30551 | ||
| 30544 | 30552 | const comptime_only = switch (elem_ty.classify(zcu)) { |
| 30545 | 30553 | .no_possible_value => switch (elem_ty.zigTypeTag(zcu)) { |
| 30546 | 30554 | .@"opaque" => return sema.fail(block, src, "cannot load opaque type '{f}'", .{elem_ty.fmt(pt)}), |
src/Type.zig+5-1| ... | ... | @@ -3119,12 +3119,16 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool |
| 3119 | 3119 | .noreturn => position == .ret_ty, |
| 3120 | 3120 | |
| 3121 | 3121 | .@"opaque", |
| 3122 | .spirv, | |
| 3123 | 3122 | .bool, |
| 3124 | 3123 | .float, |
| 3125 | 3124 | .@"anyframe", |
| 3126 | 3125 | => true, |
| 3127 | 3126 | |
| 3127 | .spirv => switch (position) { | |
| 3128 | .struct_field, .union_field => true, | |
| 3129 | .ret_ty, .param_ty, .element, .other => !ty.isSpirvRuntimeArray(zcu), | |
| 3130 | }, | |
| 3131 | ||
| 3128 | 3132 | .pointer => { |
| 3129 | 3133 | if (ty.isSlice(zcu)) return false; |
| 3130 | 3134 | const child_ty = ty.childType(zcu); |
src/codegen/spirv/CodeGen.zig+88-4| ... | ... | @@ -625,6 +625,49 @@ pub fn layoutType(cg: *CodeGen, ty: Type, is_block_root: bool) Error!Id { |
| 625 | 625 | }); |
| 626 | 626 | break :id id; |
| 627 | 627 | }, |
| 628 | .@"union" => id: { | |
| 629 | const union_obj = zcu.typeToUnion(ty).?; | |
| 630 | if (union_obj.layout == .@"packed") return cg.resolveType(ty, .indirect); | |
| 631 | ||
| 632 | const layout = cg.unionLayout(ty); | |
| 633 | if (!layout.has_payload) return cg.resolveType(ty, .indirect); | |
| 634 | ||
| 635 | const id = cg.allocId(); | |
| 636 | if (is_block_root) try cg.decorate(id, .block); | |
| 637 | ||
| 638 | var member_types: [4]Id = undefined; | |
| 639 | const u8_id = try cg.resolveType(.u8, .direct); | |
| 640 | if (layout.tag_size != 0) { | |
| 641 | const tag_ty: Type = .fromInterned(union_obj.enum_tag_type); | |
| 642 | try cg.decorateMember(id, layout.tag_index, .{ .offset = .{ | |
| 643 | .byte_offset = @intCast(ty.unionGetLayout(zcu).tagOffset()), | |
| 644 | } }); | |
| 645 | member_types[layout.tag_index] = try cg.layoutType(tag_ty, false); | |
| 646 | } | |
| 647 | if (layout.payload_size != 0) { | |
| 648 | try cg.decorateMember(id, layout.payload_index, .{ .offset = .{ | |
| 649 | .byte_offset = @intCast(ty.unionGetLayout(zcu).payloadOffset()), | |
| 650 | } }); | |
| 651 | member_types[layout.payload_index] = try cg.layoutType(layout.payload_ty, false); | |
| 652 | } | |
| 653 | if (layout.payload_padding_size != 0) { | |
| 654 | const len_id = try cg.constInt(.u32, layout.payload_padding_size); | |
| 655 | const arr_id = try cg.arrayType(len_id, u8_id); | |
| 656 | try cg.decorate(arr_id, .{ .array_stride = .{ .array_stride = 1 } }); | |
| 657 | member_types[layout.payload_padding_index] = arr_id; | |
| 658 | } | |
| 659 | if (layout.padding_size != 0) { | |
| 660 | const len_id = try cg.constInt(.u32, layout.padding_size); | |
| 661 | const arr_id = try cg.arrayType(len_id, u8_id); | |
| 662 | try cg.decorate(arr_id, .{ .array_stride = .{ .array_stride = 1 } }); | |
| 663 | member_types[layout.padding_index] = arr_id; | |
| 664 | } | |
| 665 | try cg.sections.globals.emit(gpa, .OpTypeStruct, .{ | |
| 666 | .id_result = id, | |
| 667 | .id_ref = member_types[0..layout.total_fields], | |
| 668 | }); | |
| 669 | break :id id; | |
| 670 | }, | |
| 628 | 671 | .array => id: { |
| 629 | 672 | const elem_ty = ty.childType(zcu); |
| 630 | 673 | const elem_ty_id = try cg.layoutType(elem_ty, false); |
| ... | ... | @@ -1883,8 +1926,13 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { |
| 1883 | 1926 | |
| 1884 | 1927 | const nav_ty_id = try cg.resolveType(nav_ty, .indirect); |
| 1885 | 1928 | const decl_ptr_ty_id = try cg.ptrType(nav_ty_id, storage_class); |
| 1886 | if (nav_ty.zigTypeTag(zcu) == .@"struct" and cg.needsLayout(nav.resolved.?.@"addrspace", nav_ty)) { | |
| 1887 | try cg.block_var_ids.put(gpa, spv_decl.result_id, {}); | |
| 1929 | switch (nav_ty.zigTypeTag(zcu)) { | |
| 1930 | .@"struct", .@"union" => { | |
| 1931 | if (cg.needsLayout(nav.resolved.?.@"addrspace", nav_ty)) { | |
| 1932 | try cg.block_var_ids.put(gpa, spv_decl.result_id, {}); | |
| 1933 | } | |
| 1934 | }, | |
| 1935 | else => {}, | |
| 1888 | 1936 | } |
| 1889 | 1937 | if (decl_ptr_ty_id == ty_id) return spv_decl.result_id; |
| 1890 | 1938 | switch (target.os.tag) { |
| ... | ... | @@ -4175,7 +4223,7 @@ fn needsLayout(cg: *CodeGen, as: std.lang.AddressSpace, pointee_ty: Type) bool { |
| 4175 | 4223 | else => return false, |
| 4176 | 4224 | } |
| 4177 | 4225 | return switch (pointee_ty.zigTypeTag(cg.zcu)) { |
| 4178 | .@"struct", .array => true, | |
| 4226 | .@"struct", .@"union", .array => true, | |
| 4179 | 4227 | .spirv => pointee_ty.isSpirvRuntimeArray(cg.zcu), |
| 4180 | 4228 | else => false, |
| 4181 | 4229 | }; |
| ... | ... | @@ -4222,6 +4270,8 @@ fn load(cg: *CodeGen, value_ty: Type, ptr_id: Id, options: MemoryOptions) !Id { |
| 4222 | 4270 | } |
| 4223 | 4271 | |
| 4224 | 4272 | fn store(cg: *CodeGen, value_ty: Type, ptr_id: Id, value_id: Id, options: MemoryOptions) !void { |
| 4273 | const zcu = cg.zcu; | |
| 4274 | const alignment: u32 = @intCast(value_ty.abiAlignment(zcu).toByteUnits().?); | |
| 4225 | 4275 | const bare_value_id = try cg.convertToIndirect(value_ty, value_id); |
| 4226 | 4276 | const bare_ty_id = try cg.resolveType(value_ty, .indirect); |
| 4227 | 4277 | const store_ty_id = if (cg.needsLayout(options.ptr_address_space, value_ty)) |
| ... | ... | @@ -4232,7 +4282,10 @@ fn store(cg: *CodeGen, value_ty: Type, ptr_id: Id, value_id: Id, options: Memory |
| 4232 | 4282 | try cg.body.emit(cg.gpa, .OpStore, .{ |
| 4233 | 4283 | .pointer = ptr_id, |
| 4234 | 4284 | .object = object_id, |
| 4235 | .memory_access = .{ .@"volatile" = options.is_volatile }, | |
| 4285 | .memory_access = .{ | |
| 4286 | .@"volatile" = options.is_volatile, | |
| 4287 | .aligned = .{ .literal_integer = alignment }, | |
| 4288 | }, | |
| 4236 | 4289 | }); |
| 4237 | 4290 | } |
| 4238 | 4291 | |
| ... | ... | @@ -6896,6 +6949,20 @@ fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6896 | 6949 | const pl_ptr_ty_id = try cg.ptrType(layout_payload_ty_id, .function); |
| 6897 | 6950 | const pl_ptr_id = try cg.accessChain(pl_ptr_ty_id, tmp_id, &.{layout.payload_index}); |
| 6898 | 6951 | |
| 6952 | if (field_ty.toIntern() == layout.payload_ty.toIntern()) { | |
| 6953 | return try cg.load(field_ty, pl_ptr_id, .{}); | |
| 6954 | } | |
| 6955 | ||
| 6956 | switch (zcu.getTarget().os.tag) { | |
| 6957 | .vulkan, .opengl => { | |
| 6958 | // Logical addressing forbids OpBitcast on pointers. Load the | |
| 6959 | // payload as its type and bitcast the value instead. | |
| 6960 | const payload_id = try cg.load(layout.payload_ty, pl_ptr_id, .{}); | |
| 6961 | return try cg.bitCast(field_ty, layout.payload_ty, payload_id); | |
| 6962 | }, | |
| 6963 | else => {}, | |
| 6964 | } | |
| 6965 | ||
| 6899 | 6966 | const field_ty_id = try cg.resolveType(field_ty, .indirect); |
| 6900 | 6967 | const active_pl_ptr_ty_id = try cg.ptrType(field_ty_id, .function); |
| 6901 | 6968 | const active_pl_ptr_id = cg.allocId(); |
| ... | ... | @@ -7008,6 +7075,23 @@ fn structFieldPtr( |
| 7008 | 7075 | } |
| 7009 | 7076 | |
| 7010 | 7077 | const storage_class = cg.storageClass(object_ptr_ty.ptrAddressSpace(zcu)); |
| 7078 | const field_ty = result_ptr_ty.childType(zcu); | |
| 7079 | if (field_ty.toIntern() == layout.payload_ty.toIntern()) { | |
| 7080 | if (object_ty.containerLayout(zcu) == .@"packed") return object_ptr; | |
| 7081 | return try cg.accessChain(result_ty_id, object_ptr, &.{layout.payload_index}); | |
| 7082 | } | |
| 7083 | ||
| 7084 | switch (zcu.getTarget().os.tag) { | |
| 7085 | .vulkan, .opengl => { | |
| 7086 | // Logical addressing forbids OpBitcast on pointers. If the field | |
| 7087 | // type is structurally identical to the payload type (dedup will | |
| 7088 | // unify them) the access chain typed as the field type is valid. | |
| 7089 | if (object_ty.containerLayout(zcu) == .@"packed") return object_ptr; | |
| 7090 | return try cg.accessChain(result_ty_id, object_ptr, &.{layout.payload_index}); | |
| 7091 | }, | |
| 7092 | else => {}, | |
| 7093 | } | |
| 7094 | ||
| 7011 | 7095 | const layout_payload_ty_id = try cg.resolveType(layout.payload_ty, .indirect); |
| 7012 | 7096 | const pl_ptr_ty_id = try cg.ptrType(layout_payload_ty_id, storage_class); |
| 7013 | 7097 | const pl_ptr_id = blk: { |
test/behavior/align.zig-4| ... | ... | @@ -89,8 +89,6 @@ test "implicitly-aligned pointer is coercible to equivalent explicitly-aligned p |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | test "implicitly decreasing pointer alignment" { |
| 92 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 93 | ||
| 94 | 92 | const a: u32 align(4) = 3; |
| 95 | 93 | const b: u32 align(8) = 4; |
| 96 | 94 | try expect(addUnaligned(&a, &b) == 7); |
| ... | ... | @@ -450,7 +448,6 @@ test "read 128-bit field from default aligned struct in global memory" { |
| 450 | 448 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO |
| 451 | 449 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 452 | 450 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 453 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 454 | 451 | |
| 455 | 452 | try expect(12 == default_aligned_global.badguy); |
| 456 | 453 | } |
| ... | ... | @@ -505,7 +502,6 @@ test "comptime alloc alignment" { |
| 505 | 502 | if (true) return error.SkipZigTest; |
| 506 | 503 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 507 | 504 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 508 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // flaky | |
| 509 | 505 | |
| 510 | 506 | comptime var bytes1 = [_]u8{0}; |
| 511 | 507 | _ = &bytes1; |
test/behavior/array.zig-1| ... | ... | @@ -7,7 +7,6 @@ const expect = testing.expect; |
| 7 | 7 | const expectEqual = testing.expectEqual; |
| 8 | 8 | |
| 9 | 9 | test "array to slice" { |
| 10 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 11 | 10 | const a: u32 align(4) = 3; |
| 12 | 11 | const b: u32 align(8) = 4; |
| 13 | 12 | const a_slice: []align(1) const u32 = @as(*const [1]u32, &a)[0..]; |
test/behavior/bitcast.zig-1| ... | ... | @@ -138,7 +138,6 @@ test "bitcast packed struct to integer and back" { |
| 138 | 138 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 139 | 139 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 140 | 140 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 141 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 142 | 141 | |
| 143 | 142 | const LevelUpMove = packed struct { |
| 144 | 143 | move_id: u9, |
test/behavior/cast.zig-9| ... | ... | @@ -1811,7 +1811,6 @@ test "cast compatible optional types" { |
| 1811 | 1811 | } |
| 1812 | 1812 | |
| 1813 | 1813 | test "coerce undefined single-item pointer of array to error union of slice" { |
| 1814 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1815 | 1814 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1816 | 1815 | |
| 1817 | 1816 | const a = @as([*]u8, undefined)[0..0]; |
| ... | ... | @@ -1901,8 +1900,6 @@ test "cast typed undefined to int" { |
| 1901 | 1900 | // } |
| 1902 | 1901 | |
| 1903 | 1902 | test "bitcast packed struct with u0" { |
| 1904 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1905 | ||
| 1906 | 1903 | const S = packed struct(u2) { a: u0, b: u2 }; |
| 1907 | 1904 | const s = @as(S, @bitCast(@as(u2, 2))); |
| 1908 | 1905 | try expect(s.a == 0); |
| ... | ... | @@ -1976,7 +1973,6 @@ test "peer type resolution forms error union" { |
| 1976 | 1973 | } |
| 1977 | 1974 | |
| 1978 | 1975 | test "@constCast without a result location" { |
| 1979 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1980 | 1976 | const x: i32 = 1234; |
| 1981 | 1977 | const y = @constCast(&x); |
| 1982 | 1978 | try expect(@TypeOf(y) == *i32); |
| ... | ... | @@ -1984,7 +1980,6 @@ test "@constCast without a result location" { |
| 1984 | 1980 | } |
| 1985 | 1981 | |
| 1986 | 1982 | test "@constCast optional" { |
| 1987 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1988 | 1983 | const x: u8 = 10; |
| 1989 | 1984 | const m: ?*const u8 = &x; |
| 1990 | 1985 | const p = @constCast(m); |
| ... | ... | @@ -2552,7 +2547,6 @@ test "peer type resolution: many compatible pointers" { |
| 2552 | 2547 | test "peer type resolution: tuples with comptime fields" { |
| 2553 | 2548 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2554 | 2549 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2555 | // if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO | |
| 2556 | 2550 | |
| 2557 | 2551 | const a = .{ 1, 2 }; |
| 2558 | 2552 | const b = .{ @as(u32, 3), @as(i16, 4) }; |
| ... | ... | @@ -3029,7 +3023,6 @@ test "@intCast vector of signed integer" { |
| 3029 | 3023 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 3030 | 3024 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 3031 | 3025 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 3032 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 3033 | 3026 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 3034 | 3027 | |
| 3035 | 3028 | var x: @Vector(4, i32) = .{ 1, 2, 3, 4 }; |
| ... | ... | @@ -3077,7 +3070,6 @@ test "peer type resolution: slice of sentinel-terminated array" { |
| 3077 | 3070 | } |
| 3078 | 3071 | |
| 3079 | 3072 | test "@intFromFloat boundary cases" { |
| 3080 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 3081 | 3073 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 3082 | 3074 | |
| 3083 | 3075 | const S = struct { |
| ... | ... | @@ -3109,7 +3101,6 @@ test "@intFromFloat boundary cases" { |
| 3109 | 3101 | } |
| 3110 | 3102 | |
| 3111 | 3103 | test "@intFromFloat vector boundary cases" { |
| 3112 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 3113 | 3104 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 3114 | 3105 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 3115 | 3106 |
test/behavior/enum.zig-2| ... | ... | @@ -1221,7 +1221,6 @@ test "bit field access with enum fields" { |
| 1221 | 1221 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1222 | 1222 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 1223 | 1223 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1224 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1225 | 1224 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO |
| 1226 | 1225 | |
| 1227 | 1226 | var data = bit_field_1; |
| ... | ... | @@ -1406,7 +1405,6 @@ test "matching captures causes enum equivalence" { |
| 1406 | 1405 | |
| 1407 | 1406 | test "large enum field values" { |
| 1408 | 1407 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1409 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1410 | 1408 | |
| 1411 | 1409 | { |
| 1412 | 1410 | const E = enum(u64) { min = std.math.minInt(u64), max = std.math.maxInt(u64) }; |
test/behavior/error.zig-4| ... | ... | @@ -785,7 +785,6 @@ const NoReturn = struct { |
| 785 | 785 | test "error union of noreturn used with if" { |
| 786 | 786 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 787 | 787 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 788 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 789 | 788 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 790 | 789 | |
| 791 | 790 | NoReturn.a = 64; |
| ... | ... | @@ -799,7 +798,6 @@ test "error union of noreturn used with if" { |
| 799 | 798 | test "error union of noreturn used with try" { |
| 800 | 799 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 801 | 800 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 802 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 803 | 801 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 804 | 802 | |
| 805 | 803 | NoReturn.a = 64; |
| ... | ... | @@ -810,7 +808,6 @@ test "error union of noreturn used with try" { |
| 810 | 808 | test "error union of noreturn used with catch" { |
| 811 | 809 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 812 | 810 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 813 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 814 | 811 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 815 | 812 | |
| 816 | 813 | NoReturn.a = 64; |
| ... | ... | @@ -1070,7 +1067,6 @@ test "result location initialization of error union with OPV payload" { |
| 1070 | 1067 | |
| 1071 | 1068 | test "return error union with i65" { |
| 1072 | 1069 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1073 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1074 | 1070 | |
| 1075 | 1071 | try expect(try add(1000, 234) == 1234); |
| 1076 | 1072 | } |
test/behavior/generics.zig-1| ... | ... | @@ -559,7 +559,6 @@ fn StructCapture(comptime T: type) type { |
| 559 | 559 | |
| 560 | 560 | test "call generic function that uses capture from function declaration's scope" { |
| 561 | 561 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 562 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 563 | 562 | |
| 564 | 563 | const S = StructCapture(f64); |
| 565 | 564 | const s = S.foo(123); |
test/behavior/inline_switch.zig-6| ... | ... | @@ -46,7 +46,6 @@ const U = union(E) { a: void, b: u2, c: u3, d: u4 }; |
| 46 | 46 | test "inline switch unions" { |
| 47 | 47 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 48 | 48 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 49 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 50 | 49 | var x: U = .a; |
| 51 | 50 | _ = &x; |
| 52 | 51 | switch (x) { |
| ... | ... | @@ -93,7 +92,6 @@ test "inline else error" { |
| 93 | 92 | |
| 94 | 93 | test "inline else enum" { |
| 95 | 94 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 96 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 97 | 95 | |
| 98 | 96 | const E2 = enum(u8) { a = 2, b = 3, c = 4, d = 5 }; |
| 99 | 97 | var a: E2 = .a; |
| ... | ... | @@ -106,7 +104,6 @@ test "inline else enum" { |
| 106 | 104 | |
| 107 | 105 | test "inline else int with gaps" { |
| 108 | 106 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 109 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO | |
| 110 | 107 | |
| 111 | 108 | var a: u8 = 0; |
| 112 | 109 | _ = &a; |
| ... | ... | @@ -124,7 +121,6 @@ test "inline else int with gaps" { |
| 124 | 121 | |
| 125 | 122 | test "inline else int all values" { |
| 126 | 123 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 127 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 128 | 124 | |
| 129 | 125 | var a: u2 = 0; |
| 130 | 126 | _ = &a; |
| ... | ... | @@ -140,8 +136,6 @@ test "inline else int all values" { |
| 140 | 136 | } |
| 141 | 137 | |
| 142 | 138 | test "inline switch capture is set when switch operand is comptime known" { |
| 143 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 144 | ||
| 145 | 139 | const U2 = union(enum) { |
| 146 | 140 | a: u32, |
| 147 | 141 | }; |
test/behavior/math.zig-3| ... | ... | @@ -1744,7 +1744,6 @@ fn testAbs(comptime T: type, a: T, expected: anytype) !void { |
| 1744 | 1744 | test "@abs > 128 bits" { |
| 1745 | 1745 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1746 | 1746 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 1747 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1748 | 1747 | |
| 1749 | 1748 | try testAbs(u140, 0, 0); |
| 1750 | 1749 | try testAbs(u140, 1 << 139, 1 << 139); |
| ... | ... | @@ -1877,8 +1876,6 @@ test "@divTrunc > 128 bits" { |
| 1877 | 1876 | } |
| 1878 | 1877 | |
| 1879 | 1878 | test "overflow arithmetic with u0 values" { |
| 1880 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1881 | ||
| 1882 | 1879 | { |
| 1883 | 1880 | var a: u0 = 0; |
| 1884 | 1881 | _ = &a; |
test/behavior/muladd.zig-2| ... | ... | @@ -124,7 +124,6 @@ test "vector f32" { |
| 124 | 124 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 125 | 125 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 126 | 126 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 127 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 128 | 127 | |
| 129 | 128 | try comptime vector32(); |
| 130 | 129 | try vector32(); |
| ... | ... | @@ -148,7 +147,6 @@ test "vector f64" { |
| 148 | 147 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 149 | 148 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 150 | 149 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 151 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 152 | 150 | |
| 153 | 151 | try comptime vector64(); |
| 154 | 152 | try vector64(); |
test/behavior/optional.zig-1| ... | ... | @@ -520,7 +520,6 @@ test "alignment of wrapping an optional payload" { |
| 520 | 520 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 521 | 521 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 522 | 522 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 523 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 524 | 523 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 525 | 524 | |
| 526 | 525 | const S = struct { |
test/behavior/overlapping_assign.zig+3| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | const builtin = @import("builtin"); | |
| 1 | 2 | const std = @import("std"); |
| 2 | 3 | const expect = std.testing.expect; |
| 3 | 4 | |
| 4 | 5 | test "assignment to overlapping memory" { |
| 6 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 7 | ||
| 5 | 8 | try theTest(); |
| 6 | 9 | try comptime theTest(); |
| 7 | 10 | } |
test/behavior/slice.zig-3| ... | ... | @@ -852,8 +852,6 @@ test "slice len modification at comptime" { |
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | test "slice field ptr const" { |
| 855 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 856 | ||
| 857 | 855 | const const_slice: []const u8 = "string"; |
| 858 | 856 | |
| 859 | 857 | const const_ptr_const_slice = &const_slice; |
| ... | ... | @@ -867,7 +865,6 @@ test "slice field ptr const" { |
| 867 | 865 | |
| 868 | 866 | test "slice field ptr var" { |
| 869 | 867 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 870 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 871 | 868 | |
| 872 | 869 | var var_slice: []const u8 = "string"; |
| 873 | 870 |
test/behavior/splat.zig-1| ... | ... | @@ -5,7 +5,6 @@ const expect = std.testing.expect; |
| 5 | 5 | const assert = std.debug.assert; |
| 6 | 6 | |
| 7 | 7 | test "@splat array" { |
| 8 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 9 | 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 10 | 9 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 11 | 10 |
test/behavior/struct.zig-6| ... | ... | @@ -689,7 +689,6 @@ test "pointer to packed struct member in a stack variable" { |
| 689 | 689 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 690 | 690 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 691 | 691 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 692 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 693 | 692 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO |
| 694 | 693 | |
| 695 | 694 | const S = packed struct { |
| ... | ... | @@ -819,7 +818,6 @@ test "packed struct field passed to generic function" { |
| 819 | 818 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 820 | 819 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 821 | 820 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 822 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 823 | 821 | |
| 824 | 822 | const S = struct { |
| 825 | 823 | const P = packed struct { |
| ... | ... | @@ -1204,7 +1202,6 @@ test "packed struct field access via pointer" { |
| 1204 | 1202 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1205 | 1203 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1206 | 1204 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1207 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1208 | 1205 | |
| 1209 | 1206 | const S = struct { |
| 1210 | 1207 | fn doTheTest() !void { |
| ... | ... | @@ -1502,8 +1499,6 @@ test "struct fields get automatically reordered" { |
| 1502 | 1499 | } |
| 1503 | 1500 | |
| 1504 | 1501 | test "directly initiating tuple like struct" { |
| 1505 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1506 | ||
| 1507 | 1502 | const a = struct { u8 }{8}; |
| 1508 | 1503 | try expect(a[0] == 8); |
| 1509 | 1504 | } |
| ... | ... | @@ -2306,7 +2301,6 @@ test "struct queries typeinfo of struct containing pointer back to first struct" |
| 2306 | 2301 | } |
| 2307 | 2302 | |
| 2308 | 2303 | test "pointer to runtime field of struct containing struct containing comptime-only optional" { |
| 2309 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 2310 | 2304 | const Foo = struct { |
| 2311 | 2305 | padding: struct { a: u8, b: ?comptime_int }, |
| 2312 | 2306 | number: u8, |
test/behavior/switch.zig-17| ... | ... | @@ -354,7 +354,6 @@ fn testSwitchHandleAllCasesRange(x: u8) u8 { |
| 354 | 354 | test "switch on union with some prongs capturing" { |
| 355 | 355 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 356 | 356 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 357 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 358 | 357 | |
| 359 | 358 | const X = union(enum) { |
| 360 | 359 | a, |
| ... | ... | @@ -391,7 +390,6 @@ test "switch on const enum with var" { |
| 391 | 390 | |
| 392 | 391 | test "anon enum literal used in switch on union enum" { |
| 393 | 392 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 394 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 395 | 393 | |
| 396 | 394 | const Foo = union(enum) { |
| 397 | 395 | a: i32, |
| ... | ... | @@ -534,7 +532,6 @@ test "switch prongs with error set cases make a new error set type for capture v |
| 534 | 532 | |
| 535 | 533 | test "return result loc and then switch with range implicit casted to error union" { |
| 536 | 534 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 537 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO | |
| 538 | 535 | |
| 539 | 536 | const S = struct { |
| 540 | 537 | fn doTheTest() !void { |
| ... | ... | @@ -615,8 +612,6 @@ test "switch prongs with cases with identical payload types" { |
| 615 | 612 | } |
| 616 | 613 | |
| 617 | 614 | test "switch prong pointer capture alignment" { |
| 618 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 619 | ||
| 620 | 615 | const U = union(enum) { |
| 621 | 616 | a: u8 align(8), |
| 622 | 617 | b: u8 align(4), |
| ... | ... | @@ -755,7 +750,6 @@ test "switch capture copies its payload" { |
| 755 | 750 | |
| 756 | 751 | test "capture of integer forwards the switch condition directly" { |
| 757 | 752 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 758 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO | |
| 759 | 753 | |
| 760 | 754 | const S = struct { |
| 761 | 755 | fn foo(x: u8) !void { |
| ... | ... | @@ -971,8 +965,6 @@ test "switch prong captures range" { |
| 971 | 965 | } |
| 972 | 966 | |
| 973 | 967 | test "prong with inline call to unreachable" { |
| 974 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 975 | ||
| 976 | 968 | const U = union(enum) { |
| 977 | 969 | void: void, |
| 978 | 970 | bool: bool, |
| ... | ... | @@ -1018,8 +1010,6 @@ test "block error return trace index is reset between prongs" { |
| 1018 | 1010 | } |
| 1019 | 1011 | |
| 1020 | 1012 | test "labeled switch with break" { |
| 1021 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO | |
| 1022 | ||
| 1023 | 1013 | var six: u32 = undefined; |
| 1024 | 1014 | six = 6; |
| 1025 | 1015 | |
| ... | ... | @@ -1047,7 +1037,6 @@ test "unlabeled break ignores switch" { |
| 1047 | 1037 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1048 | 1038 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1049 | 1039 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1050 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO | |
| 1051 | 1040 | |
| 1052 | 1041 | const result = while (true) { |
| 1053 | 1042 | _ = s: switch (@as(u32, 1)) { |
| ... | ... | @@ -1079,8 +1068,6 @@ test "switch on 8-bit mod result" { |
| 1079 | 1068 | } |
| 1080 | 1069 | |
| 1081 | 1070 | test "switch on non-exhaustive enum" { |
| 1082 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO | |
| 1083 | ||
| 1084 | 1071 | const E = enum(u4) { |
| 1085 | 1072 | a, |
| 1086 | 1073 | b, |
| ... | ... | @@ -1314,8 +1301,6 @@ test "single-item prong in switch on enum has comptime-known capture" { |
| 1314 | 1301 | } |
| 1315 | 1302 | |
| 1316 | 1303 | test "single range switch prong capture" { |
| 1317 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1318 | ||
| 1319 | 1304 | const S = struct { |
| 1320 | 1305 | fn doTheTest(x: u8) !void { |
| 1321 | 1306 | switch (x) { |
| ... | ... | @@ -1575,8 +1560,6 @@ test "repeated switch analysis overrides previous analysis results" { |
| 1575 | 1560 | } |
| 1576 | 1561 | |
| 1577 | 1562 | test "union field pointer capture preserves alignment in inline prong" { |
| 1578 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1579 | ||
| 1580 | 1563 | const U = union(enum) { |
| 1581 | 1564 | a: u32, |
| 1582 | 1565 | b: u32, |
test/behavior/switch_loop.zig-1| ... | ... | @@ -179,7 +179,6 @@ test "switch loop with pointer capture" { |
| 179 | 179 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 180 | 180 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 181 | 181 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 182 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO | |
| 183 | 182 | |
| 184 | 183 | const S = struct { |
| 185 | 184 | const U = union(enum) { |
test/behavior/tuple.zig-6| ... | ... | @@ -255,7 +255,6 @@ test "coerce tuple to tuple" { |
| 255 | 255 | test "tuple type with void field" { |
| 256 | 256 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 257 | 257 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 258 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 259 | 258 | |
| 260 | 259 | const T = @Tuple(&.{void}); |
| 261 | 260 | const x = T{{}}; |
| ... | ... | @@ -280,7 +279,6 @@ test "zero sized struct in tuple handled correctly" { |
| 280 | 279 | |
| 281 | 280 | test "tuple type with void field and a runtime field" { |
| 282 | 281 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 283 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 284 | 282 | |
| 285 | 283 | const T = @Tuple(&.{ usize, void }); |
| 286 | 284 | var t: T = .{ 5, {} }; |
| ... | ... | @@ -291,7 +289,6 @@ test "tuple type with void field and a runtime field" { |
| 291 | 289 | test "branching inside tuple literal" { |
| 292 | 290 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 293 | 291 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 294 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 295 | 292 | |
| 296 | 293 | const S = struct { |
| 297 | 294 | fn foo(a: anytype) !void { |
| ... | ... | @@ -371,7 +368,6 @@ test "sentinel slice in tuple" { |
| 371 | 368 | test "tuple pointer is indexable" { |
| 372 | 369 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 373 | 370 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 374 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 375 | 371 | |
| 376 | 372 | const S = struct { u32, bool }; |
| 377 | 373 | |
| ... | ... | @@ -552,8 +548,6 @@ test "OPV tuple fields aren't comptime" { |
| 552 | 548 | } |
| 553 | 549 | |
| 554 | 550 | test "array of tuples that end with a zero-bit field followed by padding" { |
| 555 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 556 | ||
| 557 | 551 | const S = struct { |
| 558 | 552 | var foo: [2]struct { u32, u8, void } = .{ .{ 1, 2, {} }, .{ 3, 4, {} } }; |
| 559 | 553 | }; |
test/behavior/union.zig-13| ... | ... | @@ -31,7 +31,6 @@ test "init union with runtime value - floats" { |
| 31 | 31 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 32 | 32 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 33 | 33 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 34 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 35 | 34 | |
| 36 | 35 | var foo: FooWithFloats = undefined; |
| 37 | 36 | |
| ... | ... | @@ -445,7 +444,6 @@ var glbl: Foo1 = undefined; |
| 445 | 444 | test "global union with single field is correctly initialized" { |
| 446 | 445 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 447 | 446 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 448 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 449 | 447 | |
| 450 | 448 | glbl = Foo1{ |
| 451 | 449 | .f = @typeInfo(Foo1).@"union".field_types[0]{ .x = 123 }, |
| ... | ... | @@ -488,7 +486,6 @@ test "update the tag value for zero-sized unions" { |
| 488 | 486 | test "union initializer generates padding only if needed" { |
| 489 | 487 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 490 | 488 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 491 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 492 | 489 | |
| 493 | 490 | const U = union(enum) { |
| 494 | 491 | A: u24, |
| ... | ... | @@ -659,7 +656,6 @@ fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { |
| 659 | 656 | test "switch on union with only 1 field" { |
| 660 | 657 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 661 | 658 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 662 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 663 | 659 | |
| 664 | 660 | var r: PartialInst = undefined; |
| 665 | 661 | r = PartialInst.Compiled; |
| ... | ... | @@ -773,7 +769,6 @@ test "return union init with void payload" { |
| 773 | 769 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 774 | 770 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 775 | 771 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 776 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 777 | 772 | |
| 778 | 773 | const S = struct { |
| 779 | 774 | fn entry() !void { |
| ... | ... | @@ -925,7 +920,6 @@ test "function call result coerces from tagged union to the tag" { |
| 925 | 920 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 926 | 921 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 927 | 922 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 928 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 929 | 923 | |
| 930 | 924 | const S = struct { |
| 931 | 925 | const Arch = union(enum) { |
| ... | ... | @@ -1142,7 +1136,6 @@ test "union tag is set when initiated as a temporary value at runtime" { |
| 1142 | 1136 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1143 | 1137 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1144 | 1138 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1145 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1146 | 1139 | |
| 1147 | 1140 | const U = union(enum) { |
| 1148 | 1141 | a, |
| ... | ... | @@ -1392,7 +1385,6 @@ test "no dependency loop when function pointer in union returns the union" { |
| 1392 | 1385 | test "union reassignment can use previous value" { |
| 1393 | 1386 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1394 | 1387 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1395 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1396 | 1388 | |
| 1397 | 1389 | const U = union { |
| 1398 | 1390 | a: u32, |
| ... | ... | @@ -1550,7 +1542,6 @@ test "packed union field pointer has correct alignment" { |
| 1550 | 1542 | |
| 1551 | 1543 | test "union with 128 bit integer" { |
| 1552 | 1544 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1553 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1554 | 1545 | |
| 1555 | 1546 | const ValueTag = enum { int, other }; |
| 1556 | 1547 | |
| ... | ... | @@ -2040,7 +2031,6 @@ test "pass nested union with rls" { |
| 2040 | 2031 | test "runtime union init, most-aligned field != largest" { |
| 2041 | 2032 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2042 | 2033 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2043 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 2044 | 2034 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 2045 | 2035 | if (builtin.zig_backend == .stage2_c and builtin.target.abi == .msvc) return error.SkipZigTest; |
| 2046 | 2036 | |
| ... | ... | @@ -2202,7 +2192,6 @@ test "matching captures causes union equivalence" { |
| 2202 | 2192 | |
| 2203 | 2193 | test "signed enum tag with negative value" { |
| 2204 | 2194 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2205 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 2206 | 2195 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 2207 | 2196 | |
| 2208 | 2197 | const Enum = enum(i8) { |
| ... | ... | @@ -2278,8 +2267,6 @@ test "assign global tagged union" { |
| 2278 | 2267 | } |
| 2279 | 2268 | |
| 2280 | 2269 | test "set mutable union by switching on same union" { |
| 2281 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 2282 | ||
| 2283 | 2270 | const U = union(enum) { |
| 2284 | 2271 | foo, |
| 2285 | 2272 | bar: usize, |
test/behavior/vector.zig-4| ... | ... | @@ -395,7 +395,6 @@ test "load vector elements via comptime index" { |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | test "store vector elements via comptime index" { |
| 398 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 399 | 398 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 400 | 399 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 401 | 400 | |
| ... | ... | @@ -577,7 +576,6 @@ test "vector division operators" { |
| 577 | 576 | |
| 578 | 577 | test "vector bitwise not operator" { |
| 579 | 578 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 580 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 581 | 579 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 582 | 580 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 583 | 581 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| ... | ... | @@ -610,7 +608,6 @@ test "vector bitwise not operator" { |
| 610 | 608 | |
| 611 | 609 | test "vector boolean not operator" { |
| 612 | 610 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 613 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 614 | 611 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 615 | 612 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 616 | 613 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| ... | ... | @@ -1090,7 +1087,6 @@ test "multiplication-assignment operator with an array operand" { |
| 1090 | 1087 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1091 | 1088 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1092 | 1089 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1093 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | |
| 1094 | 1090 | |
| 1095 | 1091 | const S = struct { |
| 1096 | 1092 | fn doTheTest() !void { |
test/cases/compile_errors/loading_spirv_runtime_array_value.zig created+23| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | const RuntimeArray = @SpirvType(.{ .runtime_array = f32 }); | |
| 2 | const Buffer = extern struct { | |
| 3 | data: RuntimeArray, | |
| 4 | }; | |
| 5 | const buf = @extern(*addrspace(.storage_buffer) Buffer, .{ | |
| 6 | .name = "buf", | |
| 7 | .decoration = .{ .descriptor = .{ .set = 0, .binding = 0 } }, | |
| 8 | }); | |
| 9 | export fn main() callconv(.{ .spirv_kernel = .{ .x = 1, .y = 1, .z = 1 } }) void { | |
| 10 | const a = buf.data; | |
| 11 | _ = a; | |
| 12 | } | |
| 13 | export fn main2() callconv(.{ .spirv_kernel = .{ .x = 1, .y = 1, .z = 1 } }) void { | |
| 14 | const p: *addrspace(.storage_buffer) const RuntimeArray = &buf.data; | |
| 15 | _ = p.*; | |
| 16 | } | |
| 17 | ||
| 18 | // error | |
| 19 | // backend=selfhosted | |
| 20 | // target=spirv32-vulkan | |
| 21 | // | |
| 22 | // :10:15: error: cannot load SPIR-V runtime array value | |
| 23 | // :15:12: error: cannot load SPIR-V runtime array value |
test/cases/compile_errors/spirv_runtime_array_as_value_type.zig created+26| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | const RuntimeArray = @SpirvType(.{ .runtime_array = u32 }); | |
| 2 | ||
| 3 | const a = @extern(*addrspace(.storage_buffer) RuntimeArray, .{ | |
| 4 | .name = "a", | |
| 5 | .decoration = .{ .descriptor = .{ .set = 0, .binding = 0 } }, | |
| 6 | }); | |
| 7 | const b = @extern(*addrspace(.uniform) const RuntimeArray, .{ | |
| 8 | .name = "b", | |
| 9 | .decoration = .{ .descriptor = .{ .set = 0, .binding = 1 } }, | |
| 10 | }); | |
| 11 | ||
| 12 | comptime { | |
| 13 | _ = a; | |
| 14 | _ = b; | |
| 15 | } | |
| 16 | ||
| 17 | // error | |
| 18 | // backend=selfhosted | |
| 19 | // target=spirv32-vulkan | |
| 20 | // | |
| 21 | // :3:19: error: extern symbol cannot have type '*addrspace(.storage_buffer) @SpirvType(.runtime_array, u32)' | |
| 22 | // :3:19: note: pointer element type '@SpirvType(.runtime_array, u32)' is not extern compatible | |
| 23 | // :3:19: note: SPIR-V runtime arrays must be the last field of an extern struct | |
| 24 | // :7:19: error: extern symbol cannot have type '*addrspace(.uniform) const @SpirvType(.runtime_array, u32)' | |
| 25 | // :7:19: note: pointer element type '@SpirvType(.runtime_array, u32)' is not extern compatible | |
| 26 | // :7:19: note: SPIR-V runtime arrays must be the last field of an extern struct |