| author | |
| committer | |
| log | 79f7481575005f9f63b5b3be8dd89b92b11b9c77 |
| tree | ab44253bc9180d8947322504c78ddc5c91e01b75 |
| parent | 865b2e259bf78dbf1d4c1051b5fff68b90bca65f |
22 files changed, 61 insertions(+), 0 deletions(-)
src/codegen/spirv.zig+1| ... | ... | @@ -1242,6 +1242,7 @@ pub const DeclGen = struct { |
| 1242 | 1242 | }, |
| 1243 | 1243 | .Int => { |
| 1244 | 1244 | const int_info = ty.intInfo(mod); |
| 1245 | // TODO: Integers in OpenCL kernels are always unsigned. | |
| 1245 | 1246 | return try self.intType(int_info.signedness, int_info.bits); |
| 1246 | 1247 | }, |
| 1247 | 1248 | .Enum => { |
src/link/SpirV.zig+5| ... | ... | @@ -110,6 +110,8 @@ pub fn updateFunc(self: *SpirV, module: *Module, func_index: InternPool.Index, a |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | const func = module.funcInfo(func_index); |
| 113 | const decl = module.declPtr(func.owner_decl); | |
| 114 | log.debug("lowering function {s}", .{ module.intern_pool.stringToSlice(decl.name) }); | |
| 113 | 115 | |
| 114 | 116 | var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link); |
| 115 | 117 | defer decl_gen.deinit(); |
| ... | ... | @@ -124,6 +126,9 @@ pub fn updateDecl(self: *SpirV, module: *Module, decl_index: Module.Decl.Index) |
| 124 | 126 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 125 | 127 | } |
| 126 | 128 | |
| 129 | const decl = module.declPtr(decl_index); | |
| 130 | log.debug("lowering declaration {s}", .{ module.intern_pool.stringToSlice(decl.name) }); | |
| 131 | ||
| 127 | 132 | var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link); |
| 128 | 133 | defer decl_gen.deinit(); |
| 129 | 134 |
test/behavior/alignof.zig+2| ... | ... | @@ -28,6 +28,8 @@ test "comparison of @alignOf(T) against zero" { |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | test "correct alignment for elements and slices of aligned array" { |
| 31 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 32 | ||
| 31 | 33 | var buf: [1024]u8 align(64) = undefined; |
| 32 | 34 | var start: usize = 1; |
| 33 | 35 | var end: usize = undefined; |
test/behavior/array.zig+4| ... | ... | @@ -763,6 +763,8 @@ test "slicing array of zero-sized values" { |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | test "array init with no result pointer sets field result types" { |
| 766 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 767 | ||
| 766 | 768 | const S = struct { |
| 767 | 769 | // A function parameter has a result type, but no result pointer. |
| 768 | 770 | fn f(arr: [1]u32) u32 { |
| ... | ... | @@ -777,6 +779,8 @@ test "array init with no result pointer sets field result types" { |
| 777 | 779 | } |
| 778 | 780 | |
| 779 | 781 | test "runtime side-effects in comptime-known array init" { |
| 782 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 783 | ||
| 780 | 784 | var side_effects: u4 = 0; |
| 781 | 785 | const init = [4]u4{ |
| 782 | 786 | blk: { |
test/behavior/bitcast.zig+4| ... | ... | @@ -271,6 +271,8 @@ test "comptime bitcast used in expression has the correct type" { |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | test "bitcast passed as tuple element" { |
| 274 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 275 | ||
| 274 | 276 | const S = struct { |
| 275 | 277 | fn foo(args: anytype) !void { |
| 276 | 278 | try comptime expect(@TypeOf(args[0]) == f32); |
| ... | ... | @@ -281,6 +283,8 @@ test "bitcast passed as tuple element" { |
| 281 | 283 | } |
| 282 | 284 | |
| 283 | 285 | test "triple level result location with bitcast sandwich passed as tuple element" { |
| 286 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 287 | ||
| 284 | 288 | const S = struct { |
| 285 | 289 | fn foo(args: anytype) !void { |
| 286 | 290 | try comptime expect(@TypeOf(args[0]) == f64); |
test/behavior/bugs/5487.zig+1| ... | ... | @@ -13,5 +13,6 @@ test "crash" { |
| 13 | 13 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 14 | 14 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 15 | 15 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 16 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 16 | 17 | _ = io.multiWriter(.{writer()}); |
| 17 | 18 | } |
test/behavior/call_tail.zig+1| ... | ... | @@ -46,6 +46,7 @@ test "arguments pointed to on stack into tailcall" { |
| 46 | 46 | } |
| 47 | 47 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 48 | 48 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 49 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 49 | 50 | |
| 50 | 51 | var data = [_]u64{ 1, 6, 2, 7, 1, 9, 3 }; |
| 51 | 52 | base = @intFromPtr(&data); |
test/behavior/cast.zig+2| ... | ... | @@ -1156,6 +1156,7 @@ fn foobar(func: PFN_void) !void { |
| 1156 | 1156 | |
| 1157 | 1157 | test "cast function with an opaque parameter" { |
| 1158 | 1158 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 1159 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1159 | 1160 | |
| 1160 | 1161 | if (builtin.zig_backend == .stage2_c) { |
| 1161 | 1162 | // https://github.com/ziglang/zig/issues/16845 |
| ... | ... | @@ -2501,6 +2502,7 @@ test "@intFromBool on vector" { |
| 2501 | 2502 | test "numeric coercions with undefined" { |
| 2502 | 2503 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 2503 | 2504 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 2505 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 2504 | 2506 | |
| 2505 | 2507 | const from: i32 = undefined; |
| 2506 | 2508 | var to: f32 = from; |
test/behavior/comptime_memory.zig+2| ... | ... | @@ -425,6 +425,8 @@ test "mutate entire slice at comptime" { |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | test "dereference undefined pointer to zero-bit type" { |
| 428 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 429 | ||
| 428 | 430 | const p0: *void = undefined; |
| 429 | 431 | try testing.expectEqual({}, p0.*); |
| 430 | 432 |
test/behavior/error.zig+1| ... | ... | @@ -942,6 +942,7 @@ test "returning an error union containing a type with no runtime bits" { |
| 942 | 942 | test "try used in recursive function with inferred error set" { |
| 943 | 943 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 944 | 944 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 945 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 945 | 946 | |
| 946 | 947 | const Value = union(enum) { |
| 947 | 948 | values: []const @This(), |
test/behavior/eval.zig+1| ... | ... | @@ -729,6 +729,7 @@ fn loopNTimes(comptime n: usize) void { |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | test "variable inside inline loop that has different types on different iterations" { |
| 732 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 732 | 733 | try testVarInsideInlineLoop(.{ true, @as(u32, 42) }); |
| 733 | 734 | } |
| 734 | 735 |
test/behavior/fn.zig+2| ... | ... | @@ -583,6 +583,8 @@ test "lazy values passed to anytype parameter" { |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | test "pass and return comptime-only types" { |
| 586 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 587 | ||
| 586 | 588 | const S = struct { |
| 587 | 589 | fn returnNull(comptime x: @Type(.Null)) @Type(.Null) { |
| 588 | 590 | return x; |
test/behavior/generics.zig+1| ... | ... | @@ -288,6 +288,7 @@ test "generic function instantiation turns into comptime call" { |
| 288 | 288 | |
| 289 | 289 | test "generic function with void and comptime parameter" { |
| 290 | 290 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 291 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 291 | 292 | |
| 292 | 293 | const S = struct { x: i32 }; |
| 293 | 294 | const namespace = struct { |
test/behavior/math.zig+2| ... | ... | @@ -1289,6 +1289,8 @@ fn testShrExact(x: u8) !void { |
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | 1291 | test "shift left/right on u0 operand" { |
| 1292 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1293 | ||
| 1292 | 1294 | const S = struct { |
| 1293 | 1295 | fn doTheTest() !void { |
| 1294 | 1296 | var x: u0 = 0; |
test/behavior/optional.zig+2| ... | ... | @@ -500,6 +500,8 @@ test "cast slice to const slice nested in error union and optional" { |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | test "variable of optional of noreturn" { |
| 503 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 504 | ||
| 503 | 505 | var null_opv: ?noreturn = null; |
| 504 | 506 | try std.testing.expectEqual(@as(?noreturn, null), null_opv); |
| 505 | 507 | } |
test/behavior/struct.zig+11| ... | ... | @@ -137,6 +137,8 @@ test "invoke static method in global scope" { |
| 137 | 137 | const empty_global_instance = StructWithNoFields{}; |
| 138 | 138 | |
| 139 | 139 | test "return empty struct instance" { |
| 140 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 141 | ||
| 140 | 142 | _ = returnEmptyStructInstance(); |
| 141 | 143 | } |
| 142 | 144 | fn returnEmptyStructInstance() StructWithNoFields { |
| ... | ... | @@ -331,6 +333,7 @@ const VoidStructFieldsFoo = struct { |
| 331 | 333 | |
| 332 | 334 | test "return empty struct from fn" { |
| 333 | 335 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 336 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 334 | 337 | |
| 335 | 338 | _ = testReturnEmptyStructFromFn(); |
| 336 | 339 | } |
| ... | ... | @@ -893,6 +896,8 @@ test "anonymous struct literal syntax" { |
| 893 | 896 | } |
| 894 | 897 | |
| 895 | 898 | test "fully anonymous struct" { |
| 899 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 900 | ||
| 896 | 901 | const S = struct { |
| 897 | 902 | fn doTheTest() !void { |
| 898 | 903 | try dump(.{ |
| ... | ... | @@ -915,6 +920,8 @@ test "fully anonymous struct" { |
| 915 | 920 | } |
| 916 | 921 | |
| 917 | 922 | test "fully anonymous list literal" { |
| 923 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 924 | ||
| 918 | 925 | const S = struct { |
| 919 | 926 | fn doTheTest() !void { |
| 920 | 927 | try dump(.{ @as(u32, 1234), @as(f64, 12.34), true, "hi" }); |
| ... | ... | @@ -1715,6 +1722,8 @@ test "extern struct field pointer has correct alignment" { |
| 1715 | 1722 | } |
| 1716 | 1723 | |
| 1717 | 1724 | test "packed struct field in anonymous struct" { |
| 1725 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1726 | ||
| 1718 | 1727 | const T = packed struct { |
| 1719 | 1728 | f1: bool = false, |
| 1720 | 1729 | }; |
| ... | ... | @@ -1740,6 +1749,8 @@ test "struct init with no result pointer sets field result types" { |
| 1740 | 1749 | } |
| 1741 | 1750 | |
| 1742 | 1751 | test "runtime side-effects in comptime-known struct init" { |
| 1752 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1753 | ||
| 1743 | 1754 | var side_effects: u4 = 0; |
| 1744 | 1755 | const S = struct { a: u4, b: u4, c: u4, d: u4 }; |
| 1745 | 1756 | const init = S{ |
test/behavior/switch.zig+2| ... | ... | @@ -799,6 +799,8 @@ test "inline switch range that includes the maximum value of the switched type" |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | test "nested break ignores switch conditions and breaks instead" { |
| 802 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 803 | ||
| 802 | 804 | const S = struct { |
| 803 | 805 | fn register_to_address(ident: []const u8) !u8 { |
| 804 | 806 | const reg: u8 = if (std.mem.eql(u8, ident, "zero")) 0x00 else blk: { |
test/behavior/translate_c_macros.zig+2| ... | ... | @@ -233,6 +233,8 @@ test "@typeInfo on @cImport result" { |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | test "Macro that uses Long type concatenation casting" { |
| 236 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 237 | ||
| 236 | 238 | try expect((@TypeOf(h.X)) == c_long); |
| 237 | 239 | try expectEqual(h.X, @as(c_long, 10)); |
| 238 | 240 | } |
test/behavior/type_info_only_pub_decls.zig+3| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | const builtin = @import("builtin"); | |
| 1 | 2 | const std = @import("std"); |
| 2 | 3 | const other = struct { |
| 3 | 4 | const std = @import("std"); |
| ... | ... | @@ -14,6 +15,8 @@ const other = struct { |
| 14 | 15 | }; |
| 15 | 16 | |
| 16 | 17 | test { |
| 18 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 19 | ||
| 17 | 20 | const ti = @typeInfo(other); |
| 18 | 21 | const decls = ti.Struct.decls; |
| 19 | 22 |
test/behavior/undefined.zig+1| ... | ... | @@ -82,6 +82,7 @@ test "assign undefined to struct with method" { |
| 82 | 82 | |
| 83 | 83 | test "type name of undefined" { |
| 84 | 84 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 85 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 85 | 86 | |
| 86 | 87 | const x = undefined; |
| 87 | 88 | try expect(mem.eql(u8, @typeName(@TypeOf(x)), "@TypeOf(undefined)")); |
test/behavior/union.zig+2| ... | ... | @@ -1669,6 +1669,8 @@ test "packed union field pointer has correct alignment" { |
| 1669 | 1669 | } |
| 1670 | 1670 | |
| 1671 | 1671 | test "union with 128 bit integer" { |
| 1672 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1673 | ||
| 1672 | 1674 | const ValueTag = enum { int, other }; |
| 1673 | 1675 | |
| 1674 | 1676 | const Value3 = union(ValueTag) { |
test/behavior/var_args.zig+9| ... | ... | @@ -14,6 +14,8 @@ fn add(args: anytype) i32 { |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | test "add arbitrary args" { |
| 17 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 18 | ||
| 17 | 19 | try expect(add(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10); |
| 18 | 20 | try expect(add(.{@as(i32, 1234)}) == 1234); |
| 19 | 21 | try expect(add(.{}) == 0); |
| ... | ... | @@ -24,12 +26,15 @@ fn readFirstVarArg(args: anytype) void { |
| 24 | 26 | } |
| 25 | 27 | |
| 26 | 28 | test "send void arg to var args" { |
| 29 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 30 | ||
| 27 | 31 | readFirstVarArg(.{{}}); |
| 28 | 32 | } |
| 29 | 33 | |
| 30 | 34 | test "pass args directly" { |
| 31 | 35 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 32 | 36 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 37 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 33 | 38 | |
| 34 | 39 | try expect(addSomeStuff(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10); |
| 35 | 40 | try expect(addSomeStuff(.{@as(i32, 1234)}) == 1234); |
| ... | ... | @@ -82,11 +87,15 @@ fn foo2(args: anytype) bool { |
| 82 | 87 | } |
| 83 | 88 | |
| 84 | 89 | test "array of var args functions" { |
| 90 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 91 | ||
| 85 | 92 | try expect(foos[0](.{})); |
| 86 | 93 | try expect(!foos[1](.{})); |
| 87 | 94 | } |
| 88 | 95 | |
| 89 | 96 | test "pass zero length array to var args param" { |
| 97 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 98 | ||
| 90 | 99 | doNothingWithFirstArg(.{""}); |
| 91 | 100 | } |
| 92 | 101 |