Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ pub fn build(b: *std.Build) !void {
b.getInstallStep().dependOn(&install_std_docs.step);
}

const update_cpu_features = b.addExecutable(.{
.name = "update-cpu-features",
.root_module = b.createModule(.{
.root_source_file = b.path("tools/update_cpu_features.zig"),
.target = b.graph.host,
.imports = &.{.{
.name = "spirv_spec",
.module = b.createModule(.{
.root_source_file = b.path("src/codegen/spirv/spec.zig"),
.target = b.graph.host,
}),
}},
}),
});
const run_update_cpu_features = b.addRunArtifact(update_cpu_features);
if (b.args) |args| run_update_cpu_features.addArgs(args);

if (flat) {
b.installFile("LICENSE", "LICENSE");
b.installFile("README.md", "README.md");
Expand All @@ -81,6 +98,9 @@ pub fn build(b: *std.Build) !void {
docs_step.dependOn(langref_step);
docs_step.dependOn(std_docs_step);

const update_cpu_features_step = b.step("update-cpu-features", "Update CPU Features");
update_cpu_features_step.dependOn(&run_update_cpu_features.step);

const no_matrix = b.option(bool, "no-matrix", "Limit test matrix to exactly one target configuration") orelse false;
const skip_debug = b.option(bool, "skip-debug", "Main test suite skips debug builds") orelse false;
const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse no_matrix;
Expand Down
13 changes: 10 additions & 3 deletions lib/std/Target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ pub const Cpu = struct {
pub const Set = struct {
ints: [usize_count]usize,

pub const needed_bit_count = 317;
pub const needed_bit_count = 421;
Comment thread
This conversation was marked as resolved.
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)));
Expand Down Expand Up @@ -1917,6 +1917,8 @@ pub const Cpu = struct {
.spirv_kernel,
.spirv_fragment,
.spirv_vertex,
.spirv_task,
.spirv_mesh,
=> &.{ .spirv32, .spirv64 },
};
}
Expand Down Expand Up @@ -3265,6 +3267,12 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
.longdouble => return 128,
},

// OpenGL has no well defined C ABI, we do this to prevent panic when using floating point types.
.opengl => switch (c_type) {
.char, .short, .ushort, .int, .uint, .float, .long, .ulong, .longlong, .ulonglong => return 32,
.double, .longdouble => return 64,
},

.opencl, .vulkan => switch (c_type) {
.char => return 8,
.short, .ushort => return 16,
Expand Down Expand Up @@ -3300,9 +3308,8 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
},

.ps3,
.contiki,
.managarm,
.opengl,
.contiki,
=> @panic("specify the C integer and float type sizes for this OS"),
}
}
Expand Down
Loading