diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-05-14 17:02:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-14 17:02:51 -0400 |
| commit | 2dcec42b74cc0ae2bac5e5ef8a65955a55dca587 (patch) | |
| tree | 5e1c15838a561584e1013e4751bf7986388acea6 /lib/std/target.zig | |
| parent | 612ad779bb2df8e7e15ab20dd3df3a2900ff82f0 (diff) | |
| parent | 00428ac11b4d5b71ded1f9e572652ff52814f7b7 (diff) | |
| download | zig-2dcec42b74cc0ae2bac5e5ef8a65955a55dca587.tar.gz zig-2dcec42b74cc0ae2bac5e5ef8a65955a55dca587.zip | |
Merge pull request #8757 from Snektron/spirv-stuff
SPIR-V: Features + some other stuff
Diffstat (limited to 'lib/std/target.zig')
| -rw-r--r-- | lib/std/target.zig | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/std/target.zig b/lib/std/target.zig index d7b00cf79e..512021bab5 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -431,6 +431,7 @@ pub const Target = struct { pub const powerpc = @import("target/powerpc.zig"); pub const riscv = @import("target/riscv.zig"); pub const sparc = @import("target/sparc.zig"); + pub const spirv = @import("target/spirv.zig"); pub const systemz = @import("target/systemz.zig"); pub const ve = @import("target/ve.zig"); pub const wasm = @import("target/wasm.zig"); @@ -594,7 +595,7 @@ pub const Target = struct { pub const Set = struct { ints: [usize_count]usize, - pub const needed_bit_count = 172; + pub const needed_bit_count = 288; pub const byte_count = (needed_bit_count + 7) / 8; pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize); pub const Index = std.math.Log2Int(std.meta.Int(.unsigned, usize_count * @bitSizeOf(usize))); @@ -822,6 +823,13 @@ pub const Target = struct { }; } + pub fn isSPIRV(arch: Arch) bool { + return switch (arch) { + .spirv32, .spirv64 => true, + else => false, + }; + } + pub fn parseCpuModel(arch: Arch, cpu_name: []const u8) !*const Cpu.Model { for (arch.allCpuModels()) |cpu| { if (mem.eql(u8, cpu_name, cpu.name)) { @@ -1116,6 +1124,7 @@ pub const Target = struct { .amdgcn => &amdgpu.all_features, .riscv32, .riscv64 => &riscv.all_features, .sparc, .sparcv9, .sparcel => &sparc.all_features, + .spirv32, .spirv64 => &spirv.all_features, .s390x => &systemz.all_features, .i386, .x86_64 => &x86.all_features, .nvptx, .nvptx64 => &nvptx.all_features, @@ -1324,6 +1333,9 @@ pub const Target = struct { if (cpu_arch.isWasm()) { return .wasm; } + if (cpu_arch.isSPIRV()) { + return .spirv; + } return .elf; } |
