Commit 79f7481575
Changed files (22)
src/codegen/spirv.zig
@@ -1242,6 +1242,7 @@ pub const DeclGen = struct {
},
.Int => {
const int_info = ty.intInfo(mod);
+ // TODO: Integers in OpenCL kernels are always unsigned.
return try self.intType(int_info.signedness, int_info.bits);
},
.Enum => {
src/link/SpirV.zig
@@ -110,6 +110,8 @@ pub fn updateFunc(self: *SpirV, module: *Module, func_index: InternPool.Index, a
}
const func = module.funcInfo(func_index);
+ const decl = module.declPtr(func.owner_decl);
+ log.debug("lowering function {s}", .{ module.intern_pool.stringToSlice(decl.name) });
var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link);
defer decl_gen.deinit();
@@ -124,6 +126,9 @@ pub fn updateDecl(self: *SpirV, module: *Module, decl_index: Module.Decl.Index)
@panic("Attempted to compile for architecture that was disabled by build configuration");
}
+ const decl = module.declPtr(decl_index);
+ log.debug("lowering declaration {s}", .{ module.intern_pool.stringToSlice(decl.name) });
+
var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link);
defer decl_gen.deinit();
test/behavior/bugs/5487.zig
@@ -13,5 +13,6 @@ test "crash" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
_ = io.multiWriter(.{writer()});
}
test/behavior/alignof.zig
@@ -28,6 +28,8 @@ test "comparison of @alignOf(T) against zero" {
}
test "correct alignment for elements and slices of aligned array" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
var buf: [1024]u8 align(64) = undefined;
var start: usize = 1;
var end: usize = undefined;
test/behavior/array.zig
@@ -763,6 +763,8 @@ test "slicing array of zero-sized values" {
}
test "array init with no result pointer sets field result types" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const S = struct {
// A function parameter has a result type, but no result pointer.
fn f(arr: [1]u32) u32 {
@@ -777,6 +779,8 @@ test "array init with no result pointer sets field result types" {
}
test "runtime side-effects in comptime-known array init" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
var side_effects: u4 = 0;
const init = [4]u4{
blk: {
test/behavior/bitcast.zig
@@ -271,6 +271,8 @@ test "comptime bitcast used in expression has the correct type" {
}
test "bitcast passed as tuple element" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const S = struct {
fn foo(args: anytype) !void {
try comptime expect(@TypeOf(args[0]) == f32);
@@ -281,6 +283,8 @@ test "bitcast passed as tuple element" {
}
test "triple level result location with bitcast sandwich passed as tuple element" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const S = struct {
fn foo(args: anytype) !void {
try comptime expect(@TypeOf(args[0]) == f64);
test/behavior/call_tail.zig
@@ -46,6 +46,7 @@ test "arguments pointed to on stack into tailcall" {
}
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
var data = [_]u64{ 1, 6, 2, 7, 1, 9, 3 };
base = @intFromPtr(&data);
test/behavior/cast.zig
@@ -1156,6 +1156,7 @@ fn foobar(func: PFN_void) !void {
test "cast function with an opaque parameter" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c) {
// https://github.com/ziglang/zig/issues/16845
@@ -2501,6 +2502,7 @@ test "@intFromBool on vector" {
test "numeric coercions with undefined" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
const from: i32 = undefined;
var to: f32 = from;
test/behavior/comptime_memory.zig
@@ -425,6 +425,8 @@ test "mutate entire slice at comptime" {
}
test "dereference undefined pointer to zero-bit type" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const p0: *void = undefined;
try testing.expectEqual({}, p0.*);
test/behavior/error.zig
@@ -942,6 +942,7 @@ test "returning an error union containing a type with no runtime bits" {
test "try used in recursive function with inferred error set" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
const Value = union(enum) {
values: []const @This(),
test/behavior/eval.zig
@@ -729,6 +729,7 @@ fn loopNTimes(comptime n: usize) void {
}
test "variable inside inline loop that has different types on different iterations" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
try testVarInsideInlineLoop(.{ true, @as(u32, 42) });
}
test/behavior/fn.zig
@@ -583,6 +583,8 @@ test "lazy values passed to anytype parameter" {
}
test "pass and return comptime-only types" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const S = struct {
fn returnNull(comptime x: @Type(.Null)) @Type(.Null) {
return x;
test/behavior/generics.zig
@@ -288,6 +288,7 @@ test "generic function instantiation turns into comptime call" {
test "generic function with void and comptime parameter" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
const S = struct { x: i32 };
const namespace = struct {
test/behavior/math.zig
@@ -1289,6 +1289,8 @@ fn testShrExact(x: u8) !void {
}
test "shift left/right on u0 operand" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const S = struct {
fn doTheTest() !void {
var x: u0 = 0;
test/behavior/optional.zig
@@ -500,6 +500,8 @@ test "cast slice to const slice nested in error union and optional" {
}
test "variable of optional of noreturn" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
var null_opv: ?noreturn = null;
try std.testing.expectEqual(@as(?noreturn, null), null_opv);
}
test/behavior/struct.zig
@@ -137,6 +137,8 @@ test "invoke static method in global scope" {
const empty_global_instance = StructWithNoFields{};
test "return empty struct instance" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
_ = returnEmptyStructInstance();
}
fn returnEmptyStructInstance() StructWithNoFields {
@@ -331,6 +333,7 @@ const VoidStructFieldsFoo = struct {
test "return empty struct from fn" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
_ = testReturnEmptyStructFromFn();
}
@@ -893,6 +896,8 @@ test "anonymous struct literal syntax" {
}
test "fully anonymous struct" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const S = struct {
fn doTheTest() !void {
try dump(.{
@@ -915,6 +920,8 @@ test "fully anonymous struct" {
}
test "fully anonymous list literal" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const S = struct {
fn doTheTest() !void {
try dump(.{ @as(u32, 1234), @as(f64, 12.34), true, "hi" });
@@ -1715,6 +1722,8 @@ test "extern struct field pointer has correct alignment" {
}
test "packed struct field in anonymous struct" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const T = packed struct {
f1: bool = false,
};
@@ -1740,6 +1749,8 @@ test "struct init with no result pointer sets field result types" {
}
test "runtime side-effects in comptime-known struct init" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
var side_effects: u4 = 0;
const S = struct { a: u4, b: u4, c: u4, d: u4 };
const init = S{
test/behavior/switch.zig
@@ -799,6 +799,8 @@ test "inline switch range that includes the maximum value of the switched type"
}
test "nested break ignores switch conditions and breaks instead" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const S = struct {
fn register_to_address(ident: []const u8) !u8 {
const reg: u8 = if (std.mem.eql(u8, ident, "zero")) 0x00 else blk: {
test/behavior/translate_c_macros.zig
@@ -233,6 +233,8 @@ test "@typeInfo on @cImport result" {
}
test "Macro that uses Long type concatenation casting" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
try expect((@TypeOf(h.X)) == c_long);
try expectEqual(h.X, @as(c_long, 10));
}
test/behavior/type_info_only_pub_decls.zig
@@ -1,3 +1,4 @@
+const builtin = @import("builtin");
const std = @import("std");
const other = struct {
const std = @import("std");
@@ -14,6 +15,8 @@ const other = struct {
};
test {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const ti = @typeInfo(other);
const decls = ti.Struct.decls;
test/behavior/undefined.zig
@@ -82,6 +82,7 @@ test "assign undefined to struct with method" {
test "type name of undefined" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
const x = undefined;
try expect(mem.eql(u8, @typeName(@TypeOf(x)), "@TypeOf(undefined)"));
test/behavior/union.zig
@@ -1669,6 +1669,8 @@ test "packed union field pointer has correct alignment" {
}
test "union with 128 bit integer" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
const ValueTag = enum { int, other };
const Value3 = union(ValueTag) {
test/behavior/var_args.zig
@@ -14,6 +14,8 @@ fn add(args: anytype) i32 {
}
test "add arbitrary args" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
try expect(add(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10);
try expect(add(.{@as(i32, 1234)}) == 1234);
try expect(add(.{}) == 0);
@@ -24,12 +26,15 @@ fn readFirstVarArg(args: anytype) void {
}
test "send void arg to var args" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
readFirstVarArg(.{{}});
}
test "pass args directly" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
try expect(addSomeStuff(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10);
try expect(addSomeStuff(.{@as(i32, 1234)}) == 1234);
@@ -82,11 +87,15 @@ fn foo2(args: anytype) bool {
}
test "array of var args functions" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
try expect(foos[0](.{}));
try expect(!foos[1](.{}));
}
test "pass zero length array to var args param" {
+ if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
+
doNothingWithFirstArg(.{""});
}