authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-21 21:46:06-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-21 21:46:06-05:00
log830e0ba2d27b55f999a891d007b24131b790e8c9
treeae30c1b2d8ec408a9a530ac1dac47c42951ffae9
parent4640ef589e8fddcab7aeab2c6044bc031cf33515

enable native CPU feature for windows; disable failing tests

See #508. These can be re-enabled when we upgrade to LLVM 10.

8 files changed, 40 insertions(+), 21 deletions(-)

lib/std/fmt/parse_float.zig+4
...@@ -382,6 +382,10 @@ pub fn parseFloat(comptime T: type, s: []const u8) !T {...@@ -382,6 +382,10 @@ pub fn parseFloat(comptime T: type, s: []const u8) !T {
382}382}
383383
384test "fmt.parseFloat" {384test "fmt.parseFloat" {
385 if (std.Target.current.isWindows()) {
386 // TODO https://github.com/ziglang/zig/issues/508
387 return error.SkipZigTest;
388 }
385 const testing = std.testing;389 const testing = std.testing;
386 const expect = testing.expect;390 const expect = testing.expect;
387 const expectEqual = testing.expectEqual;391 const expectEqual = testing.expectEqual;
lib/std/io/test.zig+4
...@@ -547,6 +547,10 @@ fn testSerializerDeserializer(comptime endian: builtin.Endian, comptime packing:...@@ -547,6 +547,10 @@ fn testSerializerDeserializer(comptime endian: builtin.Endian, comptime packing:
547}547}
548548
549test "Serializer/Deserializer generic" {549test "Serializer/Deserializer generic" {
550 if (std.Target.current.isWindows()) {
551 // TODO https://github.com/ziglang/zig/issues/508
552 return error.SkipZigTest;
553 }
550 try testSerializerDeserializer(builtin.Endian.Big, .Byte);554 try testSerializerDeserializer(builtin.Endian.Big, .Byte);
551 try testSerializerDeserializer(builtin.Endian.Little, .Byte);555 try testSerializerDeserializer(builtin.Endian.Little, .Byte);
552 try testSerializerDeserializer(builtin.Endian.Big, .Bit);556 try testSerializerDeserializer(builtin.Endian.Big, .Bit);
lib/std/math/fabs.zig+4
...@@ -95,6 +95,10 @@ test "math.fabs64.special" {...@@ -95,6 +95,10 @@ test "math.fabs64.special" {
95}95}
9696
97test "math.fabs128.special" {97test "math.fabs128.special" {
98 if (std.Target.current.isWindows()) {
99 // TODO https://github.com/ziglang/zig/issues/508
100 return error.SkipZigTest;
101 }
98 expect(math.isPositiveInf(fabs(math.inf(f128))));102 expect(math.isPositiveInf(fabs(math.inf(f128))));
99 expect(math.isPositiveInf(fabs(-math.inf(f128))));103 expect(math.isPositiveInf(fabs(-math.inf(f128))));
100 expect(math.isNan(fabs(math.nan(f128))));104 expect(math.isNan(fabs(math.nan(f128))));
lib/std/math/isinf.zig+12
...@@ -74,6 +74,10 @@ pub fn isNegativeInf(x: var) bool {...@@ -74,6 +74,10 @@ pub fn isNegativeInf(x: var) bool {
74}74}
7575
76test "math.isInf" {76test "math.isInf" {
77 if (std.Target.current.isWindows()) {
78 // TODO https://github.com/ziglang/zig/issues/508
79 return error.SkipZigTest;
80 }
77 expect(!isInf(@as(f16, 0.0)));81 expect(!isInf(@as(f16, 0.0)));
78 expect(!isInf(@as(f16, -0.0)));82 expect(!isInf(@as(f16, -0.0)));
79 expect(!isInf(@as(f32, 0.0)));83 expect(!isInf(@as(f32, 0.0)));
...@@ -93,6 +97,10 @@ test "math.isInf" {...@@ -93,6 +97,10 @@ test "math.isInf" {
93}97}
9498
95test "math.isPositiveInf" {99test "math.isPositiveInf" {
100 if (std.Target.current.isWindows()) {
101 // TODO https://github.com/ziglang/zig/issues/508
102 return error.SkipZigTest;
103 }
96 expect(!isPositiveInf(@as(f16, 0.0)));104 expect(!isPositiveInf(@as(f16, 0.0)));
97 expect(!isPositiveInf(@as(f16, -0.0)));105 expect(!isPositiveInf(@as(f16, -0.0)));
98 expect(!isPositiveInf(@as(f32, 0.0)));106 expect(!isPositiveInf(@as(f32, 0.0)));
...@@ -112,6 +120,10 @@ test "math.isPositiveInf" {...@@ -112,6 +120,10 @@ test "math.isPositiveInf" {
112}120}
113121
114test "math.isNegativeInf" {122test "math.isNegativeInf" {
123 if (std.Target.current.isWindows()) {
124 // TODO https://github.com/ziglang/zig/issues/508
125 return error.SkipZigTest;
126 }
115 expect(!isNegativeInf(@as(f16, 0.0)));127 expect(!isNegativeInf(@as(f16, 0.0)));
116 expect(!isNegativeInf(@as(f16, -0.0)));128 expect(!isNegativeInf(@as(f16, -0.0)));
117 expect(!isNegativeInf(@as(f32, 0.0)));129 expect(!isNegativeInf(@as(f32, 0.0)));
lib/std/math/isnan.zig+4
...@@ -16,6 +16,10 @@ pub fn isSignalNan(x: var) bool {...@@ -16,6 +16,10 @@ pub fn isSignalNan(x: var) bool {
16}16}
1717
18test "math.isNan" {18test "math.isNan" {
19 if (std.Target.current.isWindows()) {
20 // TODO https://github.com/ziglang/zig/issues/508
21 return error.SkipZigTest;
22 }
19 expect(isNan(math.nan(f16)));23 expect(isNan(math.nan(f16)));
20 expect(isNan(math.nan(f32)));24 expect(isNan(math.nan(f32)));
21 expect(isNan(math.nan(f64)));25 expect(isNan(math.nan(f64)));
src-self-hosted/stage1.zig+4-13
...@@ -659,20 +659,11 @@ const Stage2CpuFeatures = struct {...@@ -659,20 +659,11 @@ const Stage2CpuFeatures = struct {
659 const target = try Target.parse(mem.toSliceConst(u8, zig_triple));659 const target = try Target.parse(mem.toSliceConst(u8, zig_triple));
660 const arch = target.Cross.arch;660 const arch = target.Cross.arch;
661 const cpu_features = try cpuFeaturesFromLLVM(arch, llvm_cpu_name_z, llvm_cpu_features);661 const cpu_features = try cpuFeaturesFromLLVM(arch, llvm_cpu_name_z, llvm_cpu_features);
662 const result = switch (cpu_features) {662 switch (cpu_features) {
663 .baseline => try createBaseline(allocator, arch),663 .baseline => return createBaseline(allocator, arch),
664 .cpu => |cpu| try createFromCpu(allocator, arch, cpu),664 .cpu => |cpu| return createFromCpu(allocator, arch, cpu),
665 .features => |features| try createFromCpuFeatures(allocator, arch, features),665 .features => |features| return createFromCpuFeatures(allocator, arch, features),
666 };
667 // LLVM creates invalid binaries on Windows sometimes.
668 // See https://github.com/ziglang/zig/issues/508
669 // As a workaround we do not use target native features on Windows.
670 // This logic is repeated in codegen.cpp
671 if (target.isWindows() or target.isUefi()) {
672 result.llvm_cpu_name = "";
673 result.llvm_features_str = "";
674 }666 }
675 return result;
676 }667 }
677668
678 fn createFromCpu(allocator: *mem.Allocator, arch: Target.Arch, cpu: *const Target.Cpu) !*Self {669 fn createFromCpu(allocator: *mem.Allocator, arch: Target.Arch, cpu: *const Target.Cpu) !*Self {
src/codegen.cpp-8
...@@ -8787,14 +8787,6 @@ static void init(CodeGen *g) {...@@ -8787,14 +8787,6 @@ static void init(CodeGen *g) {
8787 if (g->zig_target->is_native) {8787 if (g->zig_target->is_native) {
8788 target_specific_cpu_args = ZigLLVMGetHostCPUName();8788 target_specific_cpu_args = ZigLLVMGetHostCPUName();
8789 target_specific_features = ZigLLVMGetNativeFeatures();8789 target_specific_features = ZigLLVMGetNativeFeatures();
8790 // LLVM creates invalid binaries on Windows sometimes.
8791 // See https://github.com/ziglang/zig/issues/508
8792 // As a workaround we do not use target native features on Windows.
8793 // This logic is repeated in stage1.zig
8794 if (g->zig_target->os == OsWindows || g->zig_target->os == OsUefi) {
8795 target_specific_cpu_args = "";
8796 target_specific_features = "";
8797 }
8798 }8790 }
87998791
8800 // Override CPU and features if defined by user.8792 // Override CPU and features if defined by user.
test/stage1/behavior/math.zig+8
...@@ -529,6 +529,10 @@ test "comptime_int xor" {...@@ -529,6 +529,10 @@ test "comptime_int xor" {
529}529}
530530
531test "f128" {531test "f128" {
532 if (std.Target.current.isWindows()) {
533 // TODO https://github.com/ziglang/zig/issues/508
534 return error.SkipZigTest;
535 }
532 test_f128();536 test_f128();
533 comptime test_f128();537 comptime test_f128();
534}538}
...@@ -627,6 +631,10 @@ test "NaN comparison" {...@@ -627,6 +631,10 @@ test "NaN comparison" {
627 // TODO: https://github.com/ziglang/zig/issues/3338631 // TODO: https://github.com/ziglang/zig/issues/3338
628 return error.SkipZigTest;632 return error.SkipZigTest;
629 }633 }
634 if (std.Target.current.isWindows()) {
635 // TODO https://github.com/ziglang/zig/issues/508
636 return error.SkipZigTest;
637 }
630 testNanEqNan(f16);638 testNanEqNan(f16);
631 testNanEqNan(f32);639 testNanEqNan(f32);
632 testNanEqNan(f64);640 testNanEqNan(f64);