aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2025-02-09 00:44:13 -0500
committerJacob Young <jacobly0@users.noreply.github.com>2025-02-12 09:48:17 -0500
commit348d1773baec1f9b853827b8318735d9686b699d (patch)
tree21c3a9e187a0282030a8a94b7dba07d07148ef0d /lib/std
parent53216d2f22053ca94a68f5da234038c01f73d60f (diff)
downloadzig-348d1773baec1f9b853827b8318735d9686b699d.tar.gz
zig-348d1773baec1f9b853827b8318735d9686b699d.zip
std: remove special cases for stage2_x86_64 that are no longer needed
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/Target.zig45
-rw-r--r--lib/std/math.zig2
2 files changed, 19 insertions, 28 deletions
diff --git a/lib/std/Target.zig b/lib/std/Target.zig
index 75bad7d585..42267f0ae1 100644
--- a/lib/std/Target.zig
+++ b/lib/std/Target.zig
@@ -1240,13 +1240,10 @@ pub const Cpu = struct {
/// Adds the specified feature set but not its dependencies.
pub fn addFeatureSet(set: *Set, other_set: Set) void {
- switch (builtin.zig_backend) {
- .stage2_x86_64 => {
- for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* |= other_set_int;
- },
- else => {
- set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints);
- },
+ if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff) {
+ for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* |= other_set_int;
+ } else {
+ set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints);
}
}
@@ -1259,13 +1256,10 @@ pub const Cpu = struct {
/// Removes the specified feature but not its dependents.
pub fn removeFeatureSet(set: *Set, other_set: Set) void {
- switch (builtin.zig_backend) {
- .stage2_x86_64 => {
- for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* &= ~other_set_int;
- },
- else => {
- set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints);
- },
+ if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff) {
+ for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* &= ~other_set_int;
+ } else {
+ set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints);
}
}
@@ -1295,19 +1289,16 @@ pub const Cpu = struct {
}
pub fn isSuperSetOf(set: Set, other_set: Set) bool {
- switch (builtin.zig_backend) {
- .stage2_x86_64 => {
- var result = true;
- for (&set.ints, other_set.ints) |*set_int, other_set_int|
- result = result and (set_int.* & other_set_int) == other_set_int;
- return result;
- },
- else => {
- const V = @Vector(usize_count, usize);
- const set_v: V = set.ints;
- const other_v: V = other_set.ints;
- return @reduce(.And, (set_v & other_v) == other_v);
- },
+ if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff) {
+ var result = true;
+ for (&set.ints, other_set.ints) |*set_int, other_set_int|
+ result = result and (set_int.* & other_set_int) == other_set_int;
+ return result;
+ } else {
+ const V = @Vector(usize_count, usize);
+ const set_v: V = set.ints;
+ const other_v: V = other_set.ints;
+ return @reduce(.And, (set_v & other_v) == other_v);
}
}
};
diff --git a/lib/std/math.zig b/lib/std/math.zig
index 1e7858aaa9..262d741e43 100644
--- a/lib/std/math.zig
+++ b/lib/std/math.zig
@@ -1356,7 +1356,7 @@ pub fn lerp(a: anytype, b: anytype, t: anytype) @TypeOf(a, b, t) {
test lerp {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/17884
if (builtin.zig_backend == .stage2_x86_64 and
- !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .fma)) return error.SkipZigTest;
+ !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .fma)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/17884
try testing.expectEqual(@as(f64, 75), lerp(50, 100, 0.5));
try testing.expectEqual(@as(f32, 43.75), lerp(50, 25, 0.25));