From 9e5b2489913f72764ded2089bccd7e612a3cc347 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 7 Feb 2020 12:41:02 -0500 Subject: [PATCH] remove workarounds for Windows native CPU features bug fixed in LLVM 10 closes #508 --- lib/std/fmt/parse_float.zig | 4 ---- lib/std/io/test.zig | 4 ---- lib/std/math/fabs.zig | 4 ---- lib/std/math/isinf.zig | 12 ------------ lib/std/math/isnan.zig | 4 ---- lib/std/special/compiler_rt/addXf3_test.zig | 8 -------- lib/std/special/compiler_rt/fixtfdi_test.zig | 4 ---- lib/std/special/compiler_rt/fixtfsi_test.zig | 4 ---- lib/std/special/compiler_rt/fixtfti_test.zig | 4 ---- lib/std/special/compiler_rt/fixunstfdi_test.zig | 4 ---- lib/std/special/compiler_rt/fixunstfsi_test.zig | 4 ---- lib/std/special/compiler_rt/fixunstfti_test.zig | 4 ---- lib/std/special/compiler_rt/floattitf_test.zig | 4 ---- lib/std/special/compiler_rt/floatuntitf_test.zig | 4 ---- lib/std/special/compiler_rt/mulXf3_test.zig | 4 ---- lib/std/special/compiler_rt/truncXfYf2_test.zig | 8 -------- src-self-hosted/compilation.zig | 5 +---- 17 files changed, 1 insertion(+), 84 deletions(-) diff --git a/lib/std/fmt/parse_float.zig b/lib/std/fmt/parse_float.zig index 1456dd8e57..2c480852ac 100644 --- a/lib/std/fmt/parse_float.zig +++ b/lib/std/fmt/parse_float.zig @@ -382,10 +382,6 @@ pub fn parseFloat(comptime T: type, s: []const u8) !T { } test "fmt.parseFloat" { - if (std.Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } const testing = std.testing; const expect = testing.expect; const expectEqual = testing.expectEqual; diff --git a/lib/std/io/test.zig b/lib/std/io/test.zig index 21ebd723c4..92259fd6e9 100644 --- a/lib/std/io/test.zig +++ b/lib/std/io/test.zig @@ -547,10 +547,6 @@ fn testSerializerDeserializer(comptime endian: builtin.Endian, comptime packing: } test "Serializer/Deserializer generic" { - if (std.Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } try testSerializerDeserializer(builtin.Endian.Big, .Byte); try testSerializerDeserializer(builtin.Endian.Little, .Byte); try testSerializerDeserializer(builtin.Endian.Big, .Bit); diff --git a/lib/std/math/fabs.zig b/lib/std/math/fabs.zig index 61692283e6..a659e35ca2 100644 --- a/lib/std/math/fabs.zig +++ b/lib/std/math/fabs.zig @@ -95,10 +95,6 @@ test "math.fabs64.special" { } test "math.fabs128.special" { - if (std.Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } expect(math.isPositiveInf(fabs(math.inf(f128)))); expect(math.isPositiveInf(fabs(-math.inf(f128)))); expect(math.isNan(fabs(math.nan(f128)))); diff --git a/lib/std/math/isinf.zig b/lib/std/math/isinf.zig index eeac61915c..6eacab52ad 100644 --- a/lib/std/math/isinf.zig +++ b/lib/std/math/isinf.zig @@ -74,10 +74,6 @@ pub fn isNegativeInf(x: var) bool { } test "math.isInf" { - if (std.Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } expect(!isInf(@as(f16, 0.0))); expect(!isInf(@as(f16, -0.0))); expect(!isInf(@as(f32, 0.0))); @@ -97,10 +93,6 @@ test "math.isInf" { } test "math.isPositiveInf" { - if (std.Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } expect(!isPositiveInf(@as(f16, 0.0))); expect(!isPositiveInf(@as(f16, -0.0))); expect(!isPositiveInf(@as(f32, 0.0))); @@ -120,10 +112,6 @@ test "math.isPositiveInf" { } test "math.isNegativeInf" { - if (std.Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } expect(!isNegativeInf(@as(f16, 0.0))); expect(!isNegativeInf(@as(f16, -0.0))); expect(!isNegativeInf(@as(f32, 0.0))); diff --git a/lib/std/math/isnan.zig b/lib/std/math/isnan.zig index 4b7e69490a..ac865f0d0c 100644 --- a/lib/std/math/isnan.zig +++ b/lib/std/math/isnan.zig @@ -16,10 +16,6 @@ pub fn isSignalNan(x: var) bool { } test "math.isNan" { - if (std.Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } expect(isNan(math.nan(f16))); expect(isNan(math.nan(f32))); expect(isNan(math.nan(f64))); diff --git a/lib/std/special/compiler_rt/addXf3_test.zig b/lib/std/special/compiler_rt/addXf3_test.zig index 402bb5a43c..af991b37e9 100644 --- a/lib/std/special/compiler_rt/addXf3_test.zig +++ b/lib/std/special/compiler_rt/addXf3_test.zig @@ -31,10 +31,6 @@ fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) void { } test "addtf3" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } test__addtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0); // NaN + any = NaN @@ -75,10 +71,6 @@ fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) void { } test "subtf3" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } // qNaN - any = qNaN test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0); diff --git a/lib/std/special/compiler_rt/fixtfdi_test.zig b/lib/std/special/compiler_rt/fixtfdi_test.zig index 4c43c90550..6baa9011c3 100644 --- a/lib/std/special/compiler_rt/fixtfdi_test.zig +++ b/lib/std/special/compiler_rt/fixtfdi_test.zig @@ -11,10 +11,6 @@ fn test__fixtfdi(a: f128, expected: i64) void { } test "fixtfdi" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } //warn("\n", .{}); test__fixtfdi(-math.f128_max, math.minInt(i64)); diff --git a/lib/std/special/compiler_rt/fixtfsi_test.zig b/lib/std/special/compiler_rt/fixtfsi_test.zig index 4eabd0c594..c7294fe250 100644 --- a/lib/std/special/compiler_rt/fixtfsi_test.zig +++ b/lib/std/special/compiler_rt/fixtfsi_test.zig @@ -11,10 +11,6 @@ fn test__fixtfsi(a: f128, expected: i32) void { } test "fixtfsi" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } //warn("\n", .{}); test__fixtfsi(-math.f128_max, math.minInt(i32)); diff --git a/lib/std/special/compiler_rt/fixtfti_test.zig b/lib/std/special/compiler_rt/fixtfti_test.zig index acda2f162b..6b8218e2f6 100644 --- a/lib/std/special/compiler_rt/fixtfti_test.zig +++ b/lib/std/special/compiler_rt/fixtfti_test.zig @@ -11,10 +11,6 @@ fn test__fixtfti(a: f128, expected: i128) void { } test "fixtfti" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } //warn("\n", .{}); test__fixtfti(-math.f128_max, math.minInt(i128)); diff --git a/lib/std/special/compiler_rt/fixunstfdi_test.zig b/lib/std/special/compiler_rt/fixunstfdi_test.zig index 154fffe18a..0d47641c09 100644 --- a/lib/std/special/compiler_rt/fixunstfdi_test.zig +++ b/lib/std/special/compiler_rt/fixunstfdi_test.zig @@ -7,10 +7,6 @@ fn test__fixunstfdi(a: f128, expected: u64) void { } test "fixunstfdi" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } test__fixunstfdi(0.0, 0); test__fixunstfdi(0.5, 0); diff --git a/lib/std/special/compiler_rt/fixunstfsi_test.zig b/lib/std/special/compiler_rt/fixunstfsi_test.zig index af312ddc46..286567629a 100644 --- a/lib/std/special/compiler_rt/fixunstfsi_test.zig +++ b/lib/std/special/compiler_rt/fixunstfsi_test.zig @@ -9,10 +9,6 @@ fn test__fixunstfsi(a: f128, expected: u32) void { const inf128 = @bitCast(f128, @as(u128, 0x7fff0000000000000000000000000000)); test "fixunstfsi" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } test__fixunstfsi(inf128, 0xffffffff); test__fixunstfsi(0, 0x0); test__fixunstfsi(0x1.23456789abcdefp+5, 0x24); diff --git a/lib/std/special/compiler_rt/fixunstfti_test.zig b/lib/std/special/compiler_rt/fixunstfti_test.zig index 84dbf991e2..62a9bbfecf 100644 --- a/lib/std/special/compiler_rt/fixunstfti_test.zig +++ b/lib/std/special/compiler_rt/fixunstfti_test.zig @@ -9,10 +9,6 @@ fn test__fixunstfti(a: f128, expected: u128) void { const inf128 = @bitCast(f128, @as(u128, 0x7fff0000000000000000000000000000)); test "fixunstfti" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } test__fixunstfti(inf128, 0xffffffffffffffffffffffffffffffff); test__fixunstfti(0.0, 0); diff --git a/lib/std/special/compiler_rt/floattitf_test.zig b/lib/std/special/compiler_rt/floattitf_test.zig index 0b2b5b958a..53e3e48bdb 100644 --- a/lib/std/special/compiler_rt/floattitf_test.zig +++ b/lib/std/special/compiler_rt/floattitf_test.zig @@ -7,10 +7,6 @@ fn test__floattitf(a: i128, expected: f128) void { } test "floattitf" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } test__floattitf(0, 0.0); test__floattitf(1, 1.0); diff --git a/lib/std/special/compiler_rt/floatuntitf_test.zig b/lib/std/special/compiler_rt/floatuntitf_test.zig index 8b99bbef5d..09f3eabb3e 100644 --- a/lib/std/special/compiler_rt/floatuntitf_test.zig +++ b/lib/std/special/compiler_rt/floatuntitf_test.zig @@ -7,10 +7,6 @@ fn test__floatuntitf(a: u128, expected: f128) void { } test "floatuntitf" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } test__floatuntitf(0, 0.0); test__floatuntitf(1, 1.0); diff --git a/lib/std/special/compiler_rt/mulXf3_test.zig b/lib/std/special/compiler_rt/mulXf3_test.zig index 00db984a89..57dc385321 100644 --- a/lib/std/special/compiler_rt/mulXf3_test.zig +++ b/lib/std/special/compiler_rt/mulXf3_test.zig @@ -44,10 +44,6 @@ fn makeNaN128(rand: u64) f128 { return float_result; } test "multf3" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } // qNaN * any = qNaN test__multf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0); diff --git a/lib/std/special/compiler_rt/truncXfYf2_test.zig b/lib/std/special/compiler_rt/truncXfYf2_test.zig index f14dbe6b43..baec2a4450 100644 --- a/lib/std/special/compiler_rt/truncXfYf2_test.zig +++ b/lib/std/special/compiler_rt/truncXfYf2_test.zig @@ -151,10 +151,6 @@ fn test__trunctfsf2(a: f128, expected: u32) void { } test "trunctfsf2" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } // qnan test__trunctfsf2(@bitCast(f128, @as(u128, 0x7fff800000000000 << 64)), 0x7fc00000); // nan @@ -190,10 +186,6 @@ fn test__trunctfdf2(a: f128, expected: u64) void { } test "trunctfdf2" { - if (@import("std").Target.current.isWindows()) { - // TODO https://github.com/ziglang/zig/issues/508 - return error.SkipZigTest; - } // qnan test__trunctfdf2(@bitCast(f128, @as(u128, 0x7fff800000000000 << 64)), 0x7ff8000000000000); // nan diff --git a/src-self-hosted/compilation.zig b/src-self-hosted/compilation.zig index 0f455fadcd..94711054fc 100644 --- a/src-self-hosted/compilation.zig +++ b/src-self-hosted/compilation.zig @@ -451,14 +451,11 @@ pub const Compilation = struct { const reloc_mode = if (is_static) llvm.RelocStatic else llvm.RelocPIC; - // LLVM creates invalid binaries on Windows sometimes. - // See https://github.com/ziglang/zig/issues/508 - // As a workaround we do not use target native features on Windows. var target_specific_cpu_args: ?[*:0]u8 = null; var target_specific_cpu_features: ?[*:0]u8 = null; defer llvm.DisposeMessage(target_specific_cpu_args); defer llvm.DisposeMessage(target_specific_cpu_features); - if (target == Target.Native and !target.isWindows()) { + if (target == Target.Native) { target_specific_cpu_args = llvm.GetHostCPUName() orelse return error.OutOfMemory; target_specific_cpu_features = llvm.GetNativeFeatures() orelse return error.OutOfMemory; }