authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2025-02-09 00:44:13-05:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2025-02-12 09:48:17-05:00
log348d1773baec1f9b853827b8318735d9686b699d
tree21c3a9e187a0282030a8a94b7dba07d07148ef0d
parent53216d2f22053ca94a68f5da234038c01f73d60f

std: remove special cases for stage2_x86_64 that are no longer needed


2 files changed, 19 insertions(+), 28 deletions(-)

lib/std/Target.zig+18-27
......@@ -1240,13 +1240,10 @@ pub const Cpu = struct {
12401240
12411241 /// Adds the specified feature set but not its dependencies.
12421242 pub fn addFeatureSet(set: *Set, other_set: Set) void {
1243 switch (builtin.zig_backend) {
1244 .stage2_x86_64 => {
1245 for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* |= other_set_int;
1246 },
1247 else => {
1248 set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints);
1249 },
1243 if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff) {
1244 for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* |= other_set_int;
1245 } else {
1246 set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints);
12501247 }
12511248 }
12521249
......@@ -1259,13 +1256,10 @@ pub const Cpu = struct {
12591256
12601257 /// Removes the specified feature but not its dependents.
12611258 pub fn removeFeatureSet(set: *Set, other_set: Set) void {
1262 switch (builtin.zig_backend) {
1263 .stage2_x86_64 => {
1264 for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* &= ~other_set_int;
1265 },
1266 else => {
1267 set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints);
1268 },
1259 if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff) {
1260 for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* &= ~other_set_int;
1261 } else {
1262 set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints);
12691263 }
12701264 }
12711265
......@@ -1295,19 +1289,16 @@ pub const Cpu = struct {
12951289 }
12961290
12971291 pub fn isSuperSetOf(set: Set, other_set: Set) bool {
1298 switch (builtin.zig_backend) {
1299 .stage2_x86_64 => {
1300 var result = true;
1301 for (&set.ints, other_set.ints) |*set_int, other_set_int|
1302 result = result and (set_int.* & other_set_int) == other_set_int;
1303 return result;
1304 },
1305 else => {
1306 const V = @Vector(usize_count, usize);
1307 const set_v: V = set.ints;
1308 const other_v: V = other_set.ints;
1309 return @reduce(.And, (set_v & other_v) == other_v);
1310 },
1292 if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff) {
1293 var result = true;
1294 for (&set.ints, other_set.ints) |*set_int, other_set_int|
1295 result = result and (set_int.* & other_set_int) == other_set_int;
1296 return result;
1297 } else {
1298 const V = @Vector(usize_count, usize);
1299 const set_v: V = set.ints;
1300 const other_v: V = other_set.ints;
1301 return @reduce(.And, (set_v & other_v) == other_v);
13111302 }
13121303 }
13131304 };
lib/std/math.zig+1-1
......@@ -1356,7 +1356,7 @@ pub fn lerp(a: anytype, b: anytype, t: anytype) @TypeOf(a, b, t) {
13561356test lerp {
13571357 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/17884
13581358 if (builtin.zig_backend == .stage2_x86_64 and
1359 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .fma)) return error.SkipZigTest;
1359 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .fma)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/17884
13601360
13611361 try testing.expectEqual(@as(f64, 75), lerp(50, 100, 0.5));
13621362 try testing.expectEqual(@as(f32, 43.75), lerp(50, 25, 0.25));