| author | |
| committer | |
| log | 50539a2447c0720f91789063d7349bd0103de4bd |
| tree | 4e199fd54e58623f363b84c0899f149c8c718d97 |
| parent | e2e75774748591fb44bfc905080e7a14008d4ec3 |
4 files changed, 12 insertions(+), 4 deletions(-)
lib/std/Target/spirv.zig+6| ... | ... | @@ -17,6 +17,7 @@ pub const Feature = enum { |
| 17 | 17 | float64, |
| 18 | 18 | matrix, |
| 19 | 19 | storage_push_constant16, |
| 20 | arbitrary_precision_integers, | |
| 20 | 21 | kernel, |
| 21 | 22 | addresses, |
| 22 | 23 | generic_pointer, |
| ... | ... | @@ -105,6 +106,11 @@ pub const all_features = blk: { |
| 105 | 106 | .description = "Enable SPV_KHR_16bit_storage extension and the StoragePushConstant16 capability", |
| 106 | 107 | .dependencies = featureSet(&[_]Feature{.v1_3}), |
| 107 | 108 | }; |
| 109 | result[@intFromEnum(Feature.arbitrary_precision_integers)] = .{ | |
| 110 | .llvm_name = null, | |
| 111 | .description = "Enable SPV_INTEL_arbitrary_precision_integers extension and the ArbitraryPrecisionIntegersINTEL capability", | |
| 112 | .dependencies = featureSet(&[_]Feature{ .v1_5, .int8, .int16 }), | |
| 113 | }; | |
| 108 | 114 | result[@intFromEnum(Feature.kernel)] = .{ |
| 109 | 115 | .llvm_name = null, |
| 110 | 116 | .description = "Enable Kernel capability", |
src/codegen/spirv.zig+2-2| ... | ... | @@ -581,13 +581,13 @@ const NavGen = struct { |
| 581 | 581 | /// that size. In this case, multiple elements of the largest type should be used. |
| 582 | 582 | /// The backing type will be chosen as the smallest supported integer larger or equal to it in number of bits. |
| 583 | 583 | /// The result is valid to be used with OpTypeInt. |
| 584 | /// TODO: The extension SPV_INTEL_arbitrary_precision_integers allows any integer size (at least up to 32 bits). | |
| 585 | /// TODO: This probably needs an ABI-version as well (especially in combination with SPV_INTEL_arbitrary_precision_integers). | |
| 586 | 584 | /// TODO: Should the result of this function be cached? |
| 587 | 585 | fn backingIntBits(self: *NavGen, bits: u16) ?u16 { |
| 588 | 586 | // The backend will never be asked to compiler a 0-bit integer, so we won't have to handle those in this function. |
| 589 | 587 | assert(bits != 0); |
| 590 | 588 | |
| 589 | if (self.spv.hasFeature(.arbitrary_precision_integers) and bits <= 32) return bits; | |
| 590 | ||
| 591 | 591 | // 8, 16 and 64-bit integers require the Int8, Int16 and Inr64 capabilities respectively. |
| 592 | 592 | // 32-bit integers are always supported (see spec, 2.16.1, Data rules). |
| 593 | 593 | const ints = [_]struct { bits: u16, feature: ?Target.spirv.Feature }{ |
src/codegen/spirv/Module.zig+4| ... | ... | @@ -343,6 +343,10 @@ pub fn finalize(self: *Module, a: Allocator) ![]Word { |
| 343 | 343 | try self.addExtension("SPV_KHR_16bit_storage"); |
| 344 | 344 | try self.addCapability(.StoragePushConstant16); |
| 345 | 345 | }, |
| 346 | .arbitrary_precision_integers => { | |
| 347 | try self.addExtension("SPV_INTEL_arbitrary_precision_integers"); | |
| 348 | try self.addCapability(.ArbitraryPrecisionIntegersINTEL); | |
| 349 | }, | |
| 346 | 350 | .addresses => try self.addCapability(.Addresses), |
| 347 | 351 | // Kernel |
| 348 | 352 | .kernel => try self.addCapability(.Kernel), |
test/behavior/vector.zig-2| ... | ... | @@ -11,7 +11,6 @@ test "implicit cast vector to array - bool" { |
| 11 | 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 12 | 12 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 13 | 13 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 14 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 15 | 14 | |
| 16 | 15 | const S = struct { |
| 17 | 16 | fn doTheTest() !void { |
| ... | ... | @@ -30,7 +29,6 @@ test "vector wrap operators" { |
| 30 | 29 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 31 | 30 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 32 | 31 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 33 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 34 | 32 | if (builtin.zig_backend == .stage2_x86_64 and |
| 35 | 33 | !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sse4_1)) return error.SkipZigTest; |
| 36 | 34 |