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 {...@@ -1240,13 +1240,10 @@ pub const Cpu = struct {
12401240
1241 /// Adds the specified feature set but not its dependencies.1241 /// Adds the specified feature set but not its dependencies.
1242 pub fn addFeatureSet(set: *Set, other_set: Set) void {1242 pub fn addFeatureSet(set: *Set, other_set: Set) void {
1243 switch (builtin.zig_backend) {1243 if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff) {
1244 .stage2_x86_64 => {1244 for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* |= other_set_int;
1245 for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* |= other_set_int;1245 } else {
1246 },1246 set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints);
1247 else => {
1248 set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints);
1249 },
1250 }1247 }
1251 }1248 }
12521249
...@@ -1259,13 +1256,10 @@ pub const Cpu = struct {...@@ -1259,13 +1256,10 @@ pub const Cpu = struct {
12591256
1260 /// Removes the specified feature but not its dependents.1257 /// Removes the specified feature but not its dependents.
1261 pub fn removeFeatureSet(set: *Set, other_set: Set) void {1258 pub fn removeFeatureSet(set: *Set, other_set: Set) void {
1262 switch (builtin.zig_backend) {1259 if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff) {
1263 .stage2_x86_64 => {1260 for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* &= ~other_set_int;
1264 for (&set.ints, other_set.ints) |*set_int, other_set_int| set_int.* &= ~other_set_int;1261 } else {
1265 },1262 set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints);
1266 else => {
1267 set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints);
1268 },
1269 }1263 }
1270 }1264 }
12711265
...@@ -1295,19 +1289,16 @@ pub const Cpu = struct {...@@ -1295,19 +1289,16 @@ pub const Cpu = struct {
1295 }1289 }
12961290
1297 pub fn isSuperSetOf(set: Set, other_set: Set) bool {1291 pub fn isSuperSetOf(set: Set, other_set: Set) bool {
1298 switch (builtin.zig_backend) {1292 if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff) {
1299 .stage2_x86_64 => {1293 var result = true;
1300 var result = true;1294 for (&set.ints, other_set.ints) |*set_int, other_set_int|
1301 for (&set.ints, other_set.ints) |*set_int, other_set_int|1295 result = result and (set_int.* & other_set_int) == other_set_int;
1302 result = result and (set_int.* & other_set_int) == other_set_int;1296 return result;
1303 return result;1297 } else {
1304 },1298 const V = @Vector(usize_count, usize);
1305 else => {1299 const set_v: V = set.ints;
1306 const V = @Vector(usize_count, usize);1300 const other_v: V = other_set.ints;
1307 const set_v: V = set.ints;1301 return @reduce(.And, (set_v & other_v) == other_v);
1308 const other_v: V = other_set.ints;
1309 return @reduce(.And, (set_v & other_v) == other_v);
1310 },
1311 }1302 }
1312 }1303 }
1313 };1304 };
lib/std/math.zig+1-1
...@@ -1356,7 +1356,7 @@ pub fn lerp(a: anytype, b: anytype, t: anytype) @TypeOf(a, b, t) {...@@ -1356,7 +1356,7 @@ pub fn lerp(a: anytype, b: anytype, t: anytype) @TypeOf(a, b, t) {
1356test lerp {1356test lerp {
1357 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/178841357 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/17884
1358 if (builtin.zig_backend == .stage2_x86_64 and1358 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
1361 try testing.expectEqual(@as(f64, 75), lerp(50, 100, 0.5));1361 try testing.expectEqual(@as(f64, 75), lerp(50, 100, 0.5));
1362 try testing.expectEqual(@as(f32, 43.75), lerp(50, 25, 0.25));1362 try testing.expectEqual(@as(f32, 43.75), lerp(50, 25, 0.25));