authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-27 08:29:24-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-10-27 08:29:24-04:00
log3b0dce8ebd252161bfca237953c00b2a40705b90
treef0df484b4b6cf67b28dedff0f9622ba319d425c4
parent8f48533691e93538846993f78f732272a03a600b
parentb0cf620fe3032d485b581c8ab6239f719ef2cada
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #17716 from jacobly0/x86_64

x86_64: pass more tests

46 files changed, 507 insertions(+), 403 deletions(-)

lib/std/Build/Step/Options.zig-2
...@@ -295,8 +295,6 @@ const Arg = struct {...@@ -295,8 +295,6 @@ const Arg = struct {
295test Options {295test Options {
296 if (builtin.os.tag == .wasi) return error.SkipZigTest;296 if (builtin.os.tag == .wasi) return error.SkipZigTest;
297297
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
300 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);298 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
301 defer arena.deinit();299 defer arena.deinit();
302300
lib/std/array_hash_map.zig-2
...@@ -2294,8 +2294,6 @@ test "popOrNull" {...@@ -2294,8 +2294,6 @@ test "popOrNull" {
2294}2294}
22952295
2296test "reIndex" {2296test "reIndex" {
2297 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
2298
2299 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);2297 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
2300 defer map.deinit();2298 defer map.deinit();
23012299
lib/std/compress/deflate/compressor.zig-2
...@@ -1069,8 +1069,6 @@ var deflate_tests = [_]DeflateTest{...@@ -1069,8 +1069,6 @@ var deflate_tests = [_]DeflateTest{
1069};1069};
10701070
1071test "deflate" {1071test "deflate" {
1072 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1073
1074 for (deflate_tests) |dt| {1072 for (deflate_tests) |dt| {
1075 var output = ArrayList(u8).init(testing.allocator);1073 var output = ArrayList(u8).init(testing.allocator);
1076 defer output.deinit();1074 defer output.deinit();
lib/std/compress/deflate/compressor_test.zig-19
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const expect = std.testing.expect;2const expect = std.testing.expect;
4const fifo = std.fifo;3const fifo = std.fifo;
5const io = std.io;4const io = std.io;
...@@ -154,8 +153,6 @@ fn testToFromWithLimit(input: []const u8, limit: [11]u32) !void {...@@ -154,8 +153,6 @@ fn testToFromWithLimit(input: []const u8, limit: [11]u32) !void {
154}153}
155154
156test "deflate/inflate" {155test "deflate/inflate" {
157 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
158
159 var limits = [_]u32{0} ** 11;156 var limits = [_]u32{0} ** 11;
160157
161 var test0 = [_]u8{};158 var test0 = [_]u8{};
...@@ -180,8 +177,6 @@ test "deflate/inflate" {...@@ -180,8 +177,6 @@ test "deflate/inflate" {
180}177}
181178
182test "very long sparse chunk" {179test "very long sparse chunk" {
183 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
184
185 // A SparseReader returns a stream consisting of 0s ending with 65,536 (1<<16) 1s.180 // A SparseReader returns a stream consisting of 0s ending with 65,536 (1<<16) 1s.
186 // This tests missing hash references in a very large input.181 // This tests missing hash references in a very large input.
187 const SparseReader = struct {182 const SparseReader = struct {
...@@ -243,8 +238,6 @@ test "very long sparse chunk" {...@@ -243,8 +238,6 @@ test "very long sparse chunk" {
243}238}
244239
245test "compressor reset" {240test "compressor reset" {
246 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
247
248 for (std.enums.values(deflate.Compression)) |c| {241 for (std.enums.values(deflate.Compression)) |c| {
249 try testWriterReset(c, null);242 try testWriterReset(c, null);
250 try testWriterReset(c, "dict");243 try testWriterReset(c, "dict");
...@@ -295,8 +288,6 @@ fn testWriterReset(level: deflate.Compression, dict: ?[]const u8) !void {...@@ -295,8 +288,6 @@ fn testWriterReset(level: deflate.Compression, dict: ?[]const u8) !void {
295}288}
296289
297test "decompressor dictionary" {290test "decompressor dictionary" {
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
300 const dict = "hello world"; // dictionary291 const dict = "hello world"; // dictionary
301 const text = "hello again world";292 const text = "hello again world";
302293
...@@ -337,8 +328,6 @@ test "decompressor dictionary" {...@@ -337,8 +328,6 @@ test "decompressor dictionary" {
337}328}
338329
339test "compressor dictionary" {330test "compressor dictionary" {
340 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
341
342 const dict = "hello world";331 const dict = "hello world";
343 const text = "hello again world";332 const text = "hello again world";
344333
...@@ -385,8 +374,6 @@ test "compressor dictionary" {...@@ -385,8 +374,6 @@ test "compressor dictionary" {
385// Update the hash for best_speed only if d.index < d.maxInsertIndex374// Update the hash for best_speed only if d.index < d.maxInsertIndex
386// See https://golang.org/issue/2508375// See https://golang.org/issue/2508
387test "Go non-regression test for 2508" {376test "Go non-regression test for 2508" {
388 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
390 var comp = try compressor(377 var comp = try compressor(
391 testing.allocator,378 testing.allocator,
392 io.null_writer,379 io.null_writer,
...@@ -404,8 +391,6 @@ test "Go non-regression test for 2508" {...@@ -404,8 +391,6 @@ test "Go non-regression test for 2508" {
404}391}
405392
406test "deflate/inflate string" {393test "deflate/inflate string" {
407 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
408
409 const StringTest = struct {394 const StringTest = struct {
410 filename: []const u8,395 filename: []const u8,
411 limit: [11]u32,396 limit: [11]u32,
...@@ -453,8 +438,6 @@ test "deflate/inflate string" {...@@ -453,8 +438,6 @@ test "deflate/inflate string" {
453}438}
454439
455test "inflate reset" {440test "inflate reset" {
456 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
457
458 const strings = [_][]const u8{441 const strings = [_][]const u8{
459 "lorem ipsum izzle fo rizzle",442 "lorem ipsum izzle fo rizzle",
460 "the quick brown fox jumped over",443 "the quick brown fox jumped over",
...@@ -501,8 +484,6 @@ test "inflate reset" {...@@ -501,8 +484,6 @@ test "inflate reset" {
501}484}
502485
503test "inflate reset dictionary" {486test "inflate reset dictionary" {
504 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
505
506 const dict = "the lorem fox";487 const dict = "the lorem fox";
507 const strings = [_][]const u8{488 const strings = [_][]const u8{
508 "lorem ipsum izzle fo rizzle",489 "lorem ipsum izzle fo rizzle",
lib/std/compress/deflate/deflate_fast.zig-2
...@@ -649,8 +649,6 @@ test "best speed shift offsets" {...@@ -649,8 +649,6 @@ test "best speed shift offsets" {
649}649}
650650
651test "best speed reset" {651test "best speed reset" {
652 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654 // test that encoding is consistent across a warparound of the table offset.652 // test that encoding is consistent across a warparound of the table offset.
655 // See https://github.com/golang/go/issues/34121653 // See https://github.com/golang/go/issues/34121
656 const fmt = std.fmt;654 const fmt = std.fmt;
lib/std/compress/deflate/deflate_fast_test.zig-5
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const expect = std.testing.expect;2const expect = std.testing.expect;
4const io = std.io;3const io = std.io;
5const mem = std.mem;4const mem = std.mem;
...@@ -12,8 +11,6 @@ const inflate = @import("decompressor.zig");...@@ -12,8 +11,6 @@ const inflate = @import("decompressor.zig");
12const deflate_const = @import("deflate_const.zig");11const deflate_const = @import("deflate_const.zig");
1312
14test "best speed" {13test "best speed" {
15 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
16
17 // Tests that round-tripping through deflate and then inflate recovers the original input.14 // Tests that round-tripping through deflate and then inflate recovers the original input.
18 // The Write sizes are near the thresholds in the compressor.encSpeed method (0, 16, 128), as well15 // The Write sizes are near the thresholds in the compressor.encSpeed method (0, 16, 128), as well
19 // as near `deflate_const.max_store_block_size` (65535).16 // as near `deflate_const.max_store_block_size` (65535).
...@@ -96,8 +93,6 @@ test "best speed" {...@@ -96,8 +93,6 @@ test "best speed" {
96}93}
9794
98test "best speed max match offset" {95test "best speed max match offset" {
99 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
100
101 const abc = "abcdefgh";96 const abc = "abcdefgh";
102 const xyz = "stuvwxyz";97 const xyz = "stuvwxyz";
103 const input_margin = 16 - 1;98 const input_margin = 16 - 1;
lib/std/compress/deflate/huffman_bit_writer.zig-7
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const io = std.io;2const io = std.io;
43
5const Allocator = std.mem.Allocator;4const Allocator = std.mem.Allocator;
...@@ -845,8 +844,6 @@ const testing = std.testing;...@@ -845,8 +844,6 @@ const testing = std.testing;
845const ArrayList = std.ArrayList;844const ArrayList = std.ArrayList;
846845
847test "writeBlockHuff" {846test "writeBlockHuff" {
848 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
849
850 // Tests huffman encoding against reference files to detect possible regressions.847 // Tests huffman encoding against reference files to detect possible regressions.
851 // If encoding/bit allocation changes you can regenerate these files848 // If encoding/bit allocation changes you can regenerate these files
852849
...@@ -1571,8 +1568,6 @@ const TestType = enum {...@@ -1571,8 +1568,6 @@ const TestType = enum {
1571};1568};
15721569
1573test "writeBlock" {1570test "writeBlock" {
1574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1575
1576 // tests if the writeBlock encoding has changed.1571 // tests if the writeBlock encoding has changed.
15771572
1578 const ttype: TestType = .write_block;1573 const ttype: TestType = .write_block;
...@@ -1588,8 +1583,6 @@ test "writeBlock" {...@@ -1588,8 +1583,6 @@ test "writeBlock" {
1588}1583}
15891584
1590test "writeBlockDynamic" {1585test "writeBlockDynamic" {
1591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1592
1593 // tests if the writeBlockDynamic encoding has changed.1586 // tests if the writeBlockDynamic encoding has changed.
15941587
1595 const ttype: TestType = .write_dyn_block;1588 const ttype: TestType = .write_dyn_block;
lib/std/compress/lzma/test.zig-11
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("../../std.zig");1const std = @import("../../std.zig");
2const builtin = @import("builtin");
3const lzma = @import("../lzma.zig");2const lzma = @import("../lzma.zig");
43
5fn testDecompress(compressed: []const u8) ![]u8 {4fn testDecompress(compressed: []const u8) ![]u8 {
...@@ -33,8 +32,6 @@ test "LZMA: decompress empty world" {...@@ -33,8 +32,6 @@ test "LZMA: decompress empty world" {
33}32}
3433
35test "LZMA: decompress hello world" {34test "LZMA: decompress hello world" {
36 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
37
38 try testDecompressEqual(35 try testDecompressEqual(
39 "Hello world\n",36 "Hello world\n",
40 &[_]u8{37 &[_]u8{
...@@ -46,8 +43,6 @@ test "LZMA: decompress hello world" {...@@ -46,8 +43,6 @@ test "LZMA: decompress hello world" {
46}43}
4744
48test "LZMA: decompress huge dict" {45test "LZMA: decompress huge dict" {
49 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
50
51 try testDecompressEqual(46 try testDecompressEqual(
52 "Hello world\n",47 "Hello world\n",
53 &[_]u8{48 &[_]u8{
...@@ -59,8 +54,6 @@ test "LZMA: decompress huge dict" {...@@ -59,8 +54,6 @@ test "LZMA: decompress huge dict" {
59}54}
6055
61test "LZMA: unknown size with end of payload marker" {56test "LZMA: unknown size with end of payload marker" {
62 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
63
64 try testDecompressEqual(57 try testDecompressEqual(
65 "Hello\nWorld!\n",58 "Hello\nWorld!\n",
66 @embedFile("testdata/good-unknown_size-with_eopm.lzma"),59 @embedFile("testdata/good-unknown_size-with_eopm.lzma"),
...@@ -68,8 +61,6 @@ test "LZMA: unknown size with end of payload marker" {...@@ -68,8 +61,6 @@ test "LZMA: unknown size with end of payload marker" {
68}61}
6962
70test "LZMA: known size without end of payload marker" {63test "LZMA: known size without end of payload marker" {
71 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
72
73 try testDecompressEqual(64 try testDecompressEqual(
74 "Hello\nWorld!\n",65 "Hello\nWorld!\n",
75 @embedFile("testdata/good-known_size-without_eopm.lzma"),66 @embedFile("testdata/good-known_size-without_eopm.lzma"),
...@@ -77,8 +68,6 @@ test "LZMA: known size without end of payload marker" {...@@ -77,8 +68,6 @@ test "LZMA: known size without end of payload marker" {
77}68}
7869
79test "LZMA: known size with end of payload marker" {70test "LZMA: known size with end of payload marker" {
80 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
81
82 try testDecompressEqual(71 try testDecompressEqual(
83 "Hello\nWorld!\n",72 "Hello\nWorld!\n",
84 @embedFile("testdata/good-known_size-with_eopm.lzma"),73 @embedFile("testdata/good-known_size-with_eopm.lzma"),
lib/std/compress/lzma/vec2d.zig-2
...@@ -50,8 +50,6 @@ const expectEqualSlices = std.testing.expectEqualSlices;...@@ -50,8 +50,6 @@ const expectEqualSlices = std.testing.expectEqualSlices;
50const expectError = std.testing.expectError;50const expectError = std.testing.expectError;
5151
52test "Vec2D.init" {52test "Vec2D.init" {
53 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
54
55 const allocator = testing.allocator;53 const allocator = testing.allocator;
56 var vec2d = try Vec2D(i32).init(allocator, 1, .{ 2, 3 });54 var vec2d = try Vec2D(i32).init(allocator, 1, .{ 2, 3 });
57 defer vec2d.deinit(allocator);55 defer vec2d.deinit(allocator);
lib/std/compress/xz/test.zig-2
...@@ -19,8 +19,6 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {...@@ -19,8 +19,6 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
19}19}
2020
21test "compressed data" {21test "compressed data" {
22 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
24 try testReader(@embedFile("testdata/good-0-empty.xz"), "");22 try testReader(@embedFile("testdata/good-0-empty.xz"), "");
2523
26 inline for ([_][]const u8{24 inline for ([_][]const u8{
lib/std/compress/zlib.zig-2
...@@ -264,8 +264,6 @@ test "sanity checks" {...@@ -264,8 +264,6 @@ test "sanity checks" {
264}264}
265265
266test "compress data" {266test "compress data" {
267 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
269 const allocator = testing.allocator;267 const allocator = testing.allocator;
270 const rfc1951_txt = @embedFile("testdata/rfc1951.txt");268 const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
271269
lib/std/crypto/25519/ed25519.zig-2
...@@ -685,8 +685,6 @@ test "ed25519 signatures with streaming" {...@@ -685,8 +685,6 @@ test "ed25519 signatures with streaming" {
685}685}
686686
687test "ed25519 key pair from secret key" {687test "ed25519 key pair from secret key" {
688 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
689
690 const kp = try Ed25519.KeyPair.create(null);688 const kp = try Ed25519.KeyPair.create(null);
691 const kp2 = try Ed25519.KeyPair.fromSecretKey(kp.secret_key);689 const kp2 = try Ed25519.KeyPair.fromSecretKey(kp.secret_key);
692 try std.testing.expectEqualSlices(u8, &kp.secret_key.toBytes(), &kp2.secret_key.toBytes());690 try std.testing.expectEqualSlices(u8, &kp.secret_key.toBytes(), &kp2.secret_key.toBytes());
lib/std/crypto/chacha20.zig-6
...@@ -1029,8 +1029,6 @@ test "crypto.chacha20 test vector 5" {...@@ -1029,8 +1029,6 @@ test "crypto.chacha20 test vector 5" {
1029}1029}
10301030
1031test "seal" {1031test "seal" {
1032 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1033
1034 {1032 {
1035 const m = "";1033 const m = "";
1036 const ad = "";1034 const ad = "";
...@@ -1081,8 +1079,6 @@ test "seal" {...@@ -1081,8 +1079,6 @@ test "seal" {
1081}1079}
10821080
1083test "open" {1081test "open" {
1084 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1085
1086 {1082 {
1087 const c = [_]u8{ 0xa0, 0x78, 0x4d, 0x7a, 0x47, 0x16, 0xf3, 0xfe, 0xb4, 0xf6, 0x4e, 0x7f, 0x4b, 0x39, 0xbf, 0x4 };1083 const c = [_]u8{ 0xa0, 0x78, 0x4d, 0x7a, 0x47, 0x16, 0xf3, 0xfe, 0xb4, 0xf6, 0x4e, 0x7f, 0x4b, 0x39, 0xbf, 0x4 };
1088 const ad = "";1084 const ad = "";
...@@ -1147,8 +1143,6 @@ test "open" {...@@ -1147,8 +1143,6 @@ test "open" {
1147}1143}
11481144
1149test "crypto.xchacha20" {1145test "crypto.xchacha20" {
1150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1151
1152 const key = [_]u8{69} ** 32;1146 const key = [_]u8{69} ** 32;
1153 const nonce = [_]u8{42} ** 24;1147 const nonce = [_]u8{42} ** 24;
1154 const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.";1148 const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.";
lib/std/crypto/ecdsa.zig+12-24
...@@ -372,10 +372,8 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type {...@@ -372,10 +372,8 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type {
372}372}
373373
374test "ECDSA - Basic operations over EcdsaP384Sha384" {374test "ECDSA - Basic operations over EcdsaP384Sha384" {
375 switch (builtin.zig_backend) {375 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
376 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,376 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
377 else => {},
378 }
379377
380 const Scheme = EcdsaP384Sha384;378 const Scheme = EcdsaP384Sha384;
381 const kp = try Scheme.KeyPair.create(null);379 const kp = try Scheme.KeyPair.create(null);
...@@ -391,10 +389,8 @@ test "ECDSA - Basic operations over EcdsaP384Sha384" {...@@ -391,10 +389,8 @@ test "ECDSA - Basic operations over EcdsaP384Sha384" {
391}389}
392390
393test "ECDSA - Basic operations over Secp256k1" {391test "ECDSA - Basic operations over Secp256k1" {
394 switch (builtin.zig_backend) {392 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
395 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,393 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396 else => {},
397 }
398394
399 const Scheme = EcdsaSecp256k1Sha256oSha256;395 const Scheme = EcdsaSecp256k1Sha256oSha256;
400 const kp = try Scheme.KeyPair.create(null);396 const kp = try Scheme.KeyPair.create(null);
...@@ -410,10 +406,8 @@ test "ECDSA - Basic operations over Secp256k1" {...@@ -410,10 +406,8 @@ test "ECDSA - Basic operations over Secp256k1" {
410}406}
411407
412test "ECDSA - Basic operations over EcdsaP384Sha256" {408test "ECDSA - Basic operations over EcdsaP384Sha256" {
413 switch (builtin.zig_backend) {409 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
414 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,410 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
415 else => {},
416 }
417411
418 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);412 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
419 const kp = try Scheme.KeyPair.create(null);413 const kp = try Scheme.KeyPair.create(null);
...@@ -429,10 +423,8 @@ test "ECDSA - Basic operations over EcdsaP384Sha256" {...@@ -429,10 +423,8 @@ test "ECDSA - Basic operations over EcdsaP384Sha256" {
429}423}
430424
431test "ECDSA - Verifying a existing signature with EcdsaP384Sha256" {425test "ECDSA - Verifying a existing signature with EcdsaP384Sha256" {
432 switch (builtin.zig_backend) {426 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
433 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,427 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
434 else => {},
435 }
436428
437 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);429 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
438 // zig fmt: off430 // zig fmt: off
...@@ -476,10 +468,8 @@ const TestVector = struct {...@@ -476,10 +468,8 @@ const TestVector = struct {
476};468};
477469
478test "ECDSA - Test vectors from Project Wycheproof" {470test "ECDSA - Test vectors from Project Wycheproof" {
479 switch (builtin.zig_backend) {471 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
480 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,472 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
481 else => {},
482 }
483473
484 const vectors = [_]TestVector{474 const vectors = [_]TestVector{
485 .{ .key = "042927b10512bae3eddcfe467828128bad2903269919f7086069c8c4df6c732838c7787964eaac00e5921fb1498a60f4606766b3d9685001558d1a974e7341513e", .msg = "313233343030", .sig = "304402202ba3a8be6b94d5ec80a6d9d1190a436effe50d85a1eee859b8cc6af9bd5c2e1802204cd60b855d442f5b3c7b11eb6c4e0ae7525fe710fab9aa7c77a67f79e6fadd76", .result = .valid },475 .{ .key = "042927b10512bae3eddcfe467828128bad2903269919f7086069c8c4df6c732838c7787964eaac00e5921fb1498a60f4606766b3d9685001558d1a974e7341513e", .msg = "313233343030", .sig = "304402202ba3a8be6b94d5ec80a6d9d1190a436effe50d85a1eee859b8cc6af9bd5c2e1802204cd60b855d442f5b3c7b11eb6c4e0ae7525fe710fab9aa7c77a67f79e6fadd76", .result = .valid },
...@@ -893,10 +883,8 @@ fn tvTry(vector: TestVector) !void {...@@ -893,10 +883,8 @@ fn tvTry(vector: TestVector) !void {
893}883}
894884
895test "ECDSA - Sec1 encoding/decoding" {885test "ECDSA - Sec1 encoding/decoding" {
896 switch (builtin.zig_backend) {886 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
897 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,887 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
898 else => {},
899 }
900888
901 const Scheme = EcdsaP384Sha384;889 const Scheme = EcdsaP384Sha384;
902 const kp = try Scheme.KeyPair.create(null);890 const kp = try Scheme.KeyPair.create(null);
lib/std/crypto/ff.zig+14-15
...@@ -6,7 +6,7 @@...@@ -6,7 +6,7 @@
6//! Parts of that code was ported from the BSD-licensed crypto/internal/bigmod/nat.go file in the Go language, itself inspired from BearSSL.6//! Parts of that code was ported from the BSD-licensed crypto/internal/bigmod/nat.go file in the Go language, itself inspired from BearSSL.
77
8const std = @import("std");8const std = @import("std");
9const builtin = std.builtin;9const builtin = @import("builtin");
10const crypto = std.crypto;10const crypto = std.crypto;
11const math = std.math;11const math = std.math;
12const mem = std.mem;12const mem = std.mem;
...@@ -14,6 +14,7 @@ const meta = std.meta;...@@ -14,6 +14,7 @@ const meta = std.meta;
14const testing = std.testing;14const testing = std.testing;
15const BoundedArray = std.BoundedArray;15const BoundedArray = std.BoundedArray;
16const assert = std.debug.assert;16const assert = std.debug.assert;
17const Endian = std.builtin.Endian;
1718
18// A Limb is a single digit in a big integer.19// A Limb is a single digit in a big integer.
19const Limb = usize;20const Limb = usize;
...@@ -27,7 +28,7 @@ const t_bits: usize = @bitSizeOf(Limb) - carry_bits;...@@ -27,7 +28,7 @@ const t_bits: usize = @bitSizeOf(Limb) - carry_bits;
27// A TLimb is a Limb that is truncated to t_bits.28// A TLimb is a Limb that is truncated to t_bits.
28const TLimb = meta.Int(.unsigned, t_bits);29const TLimb = meta.Int(.unsigned, t_bits);
2930
30const native_endian = @import("builtin").target.cpu.arch.endian();31const native_endian = builtin.target.cpu.arch.endian();
3132
32// A WideLimb is a Limb that is twice as wide as a normal Limb.33// A WideLimb is a Limb that is twice as wide as a normal Limb.
33const WideLimb = struct {34const WideLimb = struct {
...@@ -128,7 +129,7 @@ pub fn Uint(comptime max_bits: comptime_int) type {...@@ -128,7 +129,7 @@ pub fn Uint(comptime max_bits: comptime_int) type {
128 }129 }
129130
130 /// Encodes a big integer into a byte array.131 /// Encodes a big integer into a byte array.
131 pub fn toBytes(self: Self, bytes: []u8, comptime endian: builtin.Endian) OverflowError!void {132 pub fn toBytes(self: Self, bytes: []u8, comptime endian: Endian) OverflowError!void {
132 if (bytes.len == 0) {133 if (bytes.len == 0) {
133 if (self.isZero()) return;134 if (self.isZero()) return;
134 return error.Overflow;135 return error.Overflow;
...@@ -175,7 +176,7 @@ pub fn Uint(comptime max_bits: comptime_int) type {...@@ -175,7 +176,7 @@ pub fn Uint(comptime max_bits: comptime_int) type {
175 }176 }
176177
177 /// Creates a new big integer from a byte array.178 /// Creates a new big integer from a byte array.
178 pub fn fromBytes(bytes: []const u8, comptime endian: builtin.Endian) OverflowError!Self {179 pub fn fromBytes(bytes: []const u8, comptime endian: Endian) OverflowError!Self {
179 if (bytes.len == 0) return Self.zero;180 if (bytes.len == 0) return Self.zero;
180 var shift: usize = 0;181 var shift: usize = 0;
181 var out = Self.zero;182 var out = Self.zero;
...@@ -335,7 +336,7 @@ fn Fe_(comptime bits: comptime_int) type {...@@ -335,7 +336,7 @@ fn Fe_(comptime bits: comptime_int) type {
335 }336 }
336337
337 /// Creates a field element from a byte string.338 /// Creates a field element from a byte string.
338 pub fn fromBytes(m: Modulus(bits), bytes: []const u8, comptime endian: builtin.Endian) (OverflowError || FieldElementError)!Self {339 pub fn fromBytes(m: Modulus(bits), bytes: []const u8, comptime endian: Endian) (OverflowError || FieldElementError)!Self {
339 const v = try FeUint.fromBytes(bytes, endian);340 const v = try FeUint.fromBytes(bytes, endian);
340 var fe = Self{ .v = v };341 var fe = Self{ .v = v };
341 try m.shrink(&fe);342 try m.shrink(&fe);
...@@ -344,7 +345,7 @@ fn Fe_(comptime bits: comptime_int) type {...@@ -344,7 +345,7 @@ fn Fe_(comptime bits: comptime_int) type {
344 }345 }
345346
346 /// Converts the field element to a byte string.347 /// Converts the field element to a byte string.
347 pub fn toBytes(self: Self, bytes: []u8, comptime endian: builtin.Endian) OverflowError!void {348 pub fn toBytes(self: Self, bytes: []u8, comptime endian: Endian) OverflowError!void {
348 return self.v.toBytes(bytes, endian);349 return self.v.toBytes(bytes, endian);
349 }350 }
350351
...@@ -458,13 +459,13 @@ pub fn Modulus(comptime max_bits: comptime_int) type {...@@ -458,13 +459,13 @@ pub fn Modulus(comptime max_bits: comptime_int) type {
458 }459 }
459460
460 /// Creates a new modulus from a byte string.461 /// Creates a new modulus from a byte string.
461 pub fn fromBytes(bytes: []const u8, comptime endian: builtin.Endian) (InvalidModulusError || OverflowError)!Self {462 pub fn fromBytes(bytes: []const u8, comptime endian: Endian) (InvalidModulusError || OverflowError)!Self {
462 const v = try FeUint.fromBytes(bytes, endian);463 const v = try FeUint.fromBytes(bytes, endian);
463 return try Self.fromUint(v);464 return try Self.fromUint(v);
464 }465 }
465466
466 /// Serializes the modulus to a byte string.467 /// Serializes the modulus to a byte string.
467 pub fn toBytes(self: Self, bytes: []u8, comptime endian: builtin.Endian) OverflowError!void {468 pub fn toBytes(self: Self, bytes: []u8, comptime endian: Endian) OverflowError!void {
468 return self.v.toBytes(bytes, endian);469 return self.v.toBytes(bytes, endian);
469 }470 }
470471
...@@ -658,7 +659,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type {...@@ -658,7 +659,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type {
658659
659 // Returns x^e (mod m), with the exponent provided as a byte string.660 // Returns x^e (mod m), with the exponent provided as a byte string.
660 // `public` must be set to `false` if the exponent it secret.661 // `public` must be set to `false` if the exponent it secret.
661 fn powWithEncodedExponentInternal(self: Self, x: Fe, e: []const u8, endian: builtin.Endian, comptime public: bool) NullExponentError!Fe {662 fn powWithEncodedExponentInternal(self: Self, x: Fe, e: []const u8, endian: Endian, comptime public: bool) NullExponentError!Fe {
662 var acc: u8 = 0;663 var acc: u8 = 0;
663 for (e) |b| acc |= b;664 for (e) |b| acc |= b;
664 if (acc == 0) return error.NullExponent;665 if (acc == 0) return error.NullExponent;
...@@ -801,7 +802,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type {...@@ -801,7 +802,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type {
801 /// doesn't have to be created if a serialized representation is already available.802 /// doesn't have to be created if a serialized representation is already available.
802 ///803 ///
803 /// If the exponent is public, `powWithEncodedPublicExponent()` can be used instead for a slight speedup.804 /// If the exponent is public, `powWithEncodedPublicExponent()` can be used instead for a slight speedup.
804 pub fn powWithEncodedExponent(self: Self, x: Fe, e: []const u8, endian: builtin.Endian) NullExponentError!Fe {805 pub fn powWithEncodedExponent(self: Self, x: Fe, e: []const u8, endian: Endian) NullExponentError!Fe {
805 return self.powWithEncodedExponentInternal(x, e, endian, false);806 return self.powWithEncodedExponentInternal(x, e, endian, false);
806 }807 }
807808
...@@ -810,7 +811,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type {...@@ -810,7 +811,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type {
810 /// doesn't have to be created if a serialized representation is already available.811 /// doesn't have to be created if a serialized representation is already available.
811 ///812 ///
812 /// If the exponent is secret, `powWithEncodedExponent` must be used instead.813 /// If the exponent is secret, `powWithEncodedExponent` must be used instead.
813 pub fn powWithEncodedPublicExponent(self: Self, x: Fe, e: []const u8, endian: builtin.Endian) NullExponentError!Fe {814 pub fn powWithEncodedPublicExponent(self: Self, x: Fe, e: []const u8, endian: Endian) NullExponentError!Fe {
814 return self.powWithEncodedExponentInternal(x, e, endian, true);815 return self.powWithEncodedExponentInternal(x, e, endian, true);
815 }816 }
816 };817 };
...@@ -912,10 +913,8 @@ const ct_unprotected = struct {...@@ -912,10 +913,8 @@ const ct_unprotected = struct {
912};913};
913914
914test {915test {
915 switch (@import("builtin").zig_backend) {916 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
916 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,917 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
917 else => {},
918 }
919918
920 const M = Modulus(256);919 const M = Modulus(256);
921 const m = try M.fromPrimitive(u256, 3429938563481314093726330772853735541133072814650493833233);920 const m = try M.fromPrimitive(u256, 3429938563481314093726330772853735541133072814650493833233);
lib/std/crypto/pcurves/p384.zig+2-4
...@@ -478,10 +478,8 @@ pub const AffineCoordinates = struct {...@@ -478,10 +478,8 @@ pub const AffineCoordinates = struct {
478};478};
479479
480test {480test {
481 switch (@import("builtin").zig_backend) {481 if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
482 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,482 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
483 else => {},
484 }
485483
486 _ = @import("tests/p384.zig");484 _ = @import("tests/p384.zig");
487}485}
lib/std/crypto/pcurves/secp256k1.zig+2-4
...@@ -556,10 +556,8 @@ pub const AffineCoordinates = struct {...@@ -556,10 +556,8 @@ pub const AffineCoordinates = struct {
556};556};
557557
558test {558test {
559 switch (@import("builtin").zig_backend) {559 if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
560 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,560 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
561 else => {},
562 }
563561
564 _ = @import("tests/secp256k1.zig");562 _ = @import("tests/secp256k1.zig");
565}563}
lib/std/crypto/poly1305.zig-2
...@@ -196,8 +196,6 @@ pub const Poly1305 = struct {...@@ -196,8 +196,6 @@ pub const Poly1305 = struct {
196};196};
197197
198test "poly1305 rfc7439 vector1" {198test "poly1305 rfc7439 vector1" {
199 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
200
201 const expected_mac = "\xa8\x06\x1d\xc1\x30\x51\x36\xc6\xc2\x2b\x8b\xaf\x0c\x01\x27\xa9";199 const expected_mac = "\xa8\x06\x1d\xc1\x30\x51\x36\xc6\xc2\x2b\x8b\xaf\x0c\x01\x27\xa9";
202200
203 const msg = "Cryptographic Forum Research Group";201 const msg = "Cryptographic Forum Research Group";
lib/std/crypto/salsa20.zig-2
...@@ -623,8 +623,6 @@ test "xsalsa20poly1305 sealedbox" {...@@ -623,8 +623,6 @@ test "xsalsa20poly1305 sealedbox" {
623}623}
624624
625test "secretbox twoblocks" {625test "secretbox twoblocks" {
626 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
627
628 const key = [_]u8{ 0xc9, 0xc9, 0x4d, 0xcf, 0x68, 0xbe, 0x00, 0xe4, 0x7f, 0xe6, 0x13, 0x26, 0xfc, 0xc4, 0x2f, 0xd0, 0xdb, 0x93, 0x91, 0x1c, 0x09, 0x94, 0x89, 0xe1, 0x1b, 0x88, 0x63, 0x18, 0x86, 0x64, 0x8b, 0x7b };626 const key = [_]u8{ 0xc9, 0xc9, 0x4d, 0xcf, 0x68, 0xbe, 0x00, 0xe4, 0x7f, 0xe6, 0x13, 0x26, 0xfc, 0xc4, 0x2f, 0xd0, 0xdb, 0x93, 0x91, 0x1c, 0x09, 0x94, 0x89, 0xe1, 0x1b, 0x88, 0x63, 0x18, 0x86, 0x64, 0x8b, 0x7b };
629 const nonce = [_]u8{ 0xa4, 0x33, 0xe9, 0x0a, 0x07, 0x68, 0x6e, 0x9a, 0x2b, 0x6d, 0xd4, 0x59, 0x04, 0x72, 0x3e, 0xd3, 0x8a, 0x67, 0x55, 0xc7, 0x9e, 0x3e, 0x77, 0xdc };627 const nonce = [_]u8{ 0xa4, 0x33, 0xe9, 0x0a, 0x07, 0x68, 0x6e, 0x9a, 0x2b, 0x6d, 0xd4, 0x59, 0x04, 0x72, 0x3e, 0xd3, 0x8a, 0x67, 0x55, 0xc7, 0x9e, 0x3e, 0x77, 0xdc };
630 const msg = [_]u8{'a'} ** 97;628 const msg = [_]u8{'a'} ** 97;
lib/std/crypto/sha2.zig+1-1
...@@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type {...@@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type {
238 return;238 return;
239 },239 },
240 // C backend doesn't currently support passing vectors to inline asm.240 // C backend doesn't currently support passing vectors to inline asm.
241 .x86_64 => if (builtin.zig_backend != .stage2_c and builtin.zig_backend != .stage2_x86_64 and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) {241 .x86_64 => if (builtin.zig_backend != .stage2_c and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) {
242 var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] };242 var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] };
243 var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] };243 var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] };
244 const s_v = @as(*[16]v4u32, @ptrCast(&s));244 const s_v = @as(*[16]v4u32, @ptrCast(&s));
lib/std/fs.zig+1-3
...@@ -3248,9 +3248,7 @@ test {...@@ -3248,9 +3248,7 @@ test {
3248 _ = &makeDirAbsolute;3248 _ = &makeDirAbsolute;
3249 _ = &makeDirAbsoluteZ;3249 _ = &makeDirAbsoluteZ;
3250 _ = &copyFileAbsolute;3250 _ = &copyFileAbsolute;
3251 if (builtin.zig_backend != .stage2_x86_64) {3251 _ = &updateFileAbsolute;
3252 _ = &updateFileAbsolute;
3253 }
3254 }3252 }
3255 _ = &Dir.copyFile;3253 _ = &Dir.copyFile;
3256 _ = @import("fs/test.zig");3254 _ = @import("fs/test.zig");
lib/std/fs/test.zig-4
...@@ -1460,8 +1460,6 @@ test "walker without fully iterating" {...@@ -1460,8 +1460,6 @@ test "walker without fully iterating" {
1460test ". and .. in fs.Dir functions" {1460test ". and .. in fs.Dir functions" {
1461 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;1461 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
14621462
1463 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1464
1465 if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) {1463 if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) {
1466 // https://github.com/ziglang/zig/issues/171341464 // https://github.com/ziglang/zig/issues/17134
1467 return error.SkipZigTest;1465 return error.SkipZigTest;
...@@ -1502,8 +1500,6 @@ test ". and .. in fs.Dir functions" {...@@ -1502,8 +1500,6 @@ test ". and .. in fs.Dir functions" {
1502test ". and .. in absolute functions" {1500test ". and .. in absolute functions" {
1503 if (builtin.os.tag == .wasi) return error.SkipZigTest;1501 if (builtin.os.tag == .wasi) return error.SkipZigTest;
15041502
1505 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1506
1507 var tmp = tmpDir(.{});1503 var tmp = tmpDir(.{});
1508 defer tmp.cleanup();1504 defer tmp.cleanup();
15091505
lib/std/io/test.zig-2
...@@ -161,8 +161,6 @@ test "setEndPos" {...@@ -161,8 +161,6 @@ test "setEndPos" {
161}161}
162162
163test "updateTimes" {163test "updateTimes" {
164 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
165
166 var tmp = tmpDir(.{});164 var tmp = tmpDir(.{});
167 defer tmp.cleanup();165 defer tmp.cleanup();
168166
lib/std/json/JSONTestSuite_test.zig-6
...@@ -764,8 +764,6 @@ test "y_number_simple_real.json" {...@@ -764,8 +764,6 @@ test "y_number_simple_real.json" {
764 try ok("[123.456789]");764 try ok("[123.456789]");
765}765}
766test "y_object.json" {766test "y_object.json" {
767 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
768
769 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");767 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
770}768}
771test "y_object_basic.json" {769test "y_object_basic.json" {
...@@ -787,13 +785,9 @@ test "y_object_escaped_null_in_key.json" {...@@ -787,13 +785,9 @@ test "y_object_escaped_null_in_key.json" {
787 try ok("{\"foo\\u0000bar\": 42}");785 try ok("{\"foo\\u0000bar\": 42}");
788}786}
789test "y_object_extreme_numbers.json" {787test "y_object_extreme_numbers.json" {
790 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
791
792 try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");788 try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");
793}789}
794test "y_object_long_strings.json" {790test "y_object_long_strings.json" {
795 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
796
797 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");791 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
798}792}
799test "y_object_simple.json" {793test "y_object_simple.json" {
lib/std/json/dynamic_test.zig-13
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const mem = std.mem;2const mem = std.mem;
4const testing = std.testing;3const testing = std.testing;
5const ArenaAllocator = std.heap.ArenaAllocator;4const ArenaAllocator = std.heap.ArenaAllocator;
...@@ -19,8 +18,6 @@ const jsonReader = @import("scanner.zig").reader;...@@ -19,8 +18,6 @@ const jsonReader = @import("scanner.zig").reader;
19const JsonReader = @import("scanner.zig").Reader;18const JsonReader = @import("scanner.zig").Reader;
2019
21test "json.parser.dynamic" {20test "json.parser.dynamic" {
22 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
24 const s =21 const s =
25 \\{22 \\{
26 \\ "Image": {23 \\ "Image": {
...@@ -75,8 +72,6 @@ test "json.parser.dynamic" {...@@ -75,8 +72,6 @@ test "json.parser.dynamic" {
7572
76const writeStream = @import("./stringify.zig").writeStream;73const writeStream = @import("./stringify.zig").writeStream;
77test "write json then parse it" {74test "write json then parse it" {
78 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
79
80 var out_buffer: [1000]u8 = undefined;75 var out_buffer: [1000]u8 = undefined;
8176
82 var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);77 var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);
...@@ -143,8 +138,6 @@ test "Value.array allocator should still be usable after parsing" {...@@ -143,8 +138,6 @@ test "Value.array allocator should still be usable after parsing" {
143}138}
144139
145test "integer after float has proper type" {140test "integer after float has proper type" {
146 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
147
148 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);141 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
149 defer arena_allocator.deinit();142 defer arena_allocator.deinit();
150 const parsed = try testParse(arena_allocator.allocator(),143 const parsed = try testParse(arena_allocator.allocator(),
...@@ -157,8 +150,6 @@ test "integer after float has proper type" {...@@ -157,8 +150,6 @@ test "integer after float has proper type" {
157}150}
158151
159test "escaped characters" {152test "escaped characters" {
160 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
161
162 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);153 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
163 defer arena_allocator.deinit();154 defer arena_allocator.deinit();
164 const input =155 const input =
...@@ -238,8 +229,6 @@ test "Value.jsonStringify" {...@@ -238,8 +229,6 @@ test "Value.jsonStringify" {
238}229}
239230
240test "parseFromValue(std.json.Value,...)" {231test "parseFromValue(std.json.Value,...)" {
241 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
242
243 const str =232 const str =
244 \\{233 \\{
245 \\ "int": 32,234 \\ "int": 32,
...@@ -328,8 +317,6 @@ test "ParseOptions.max_value_len" {...@@ -328,8 +317,6 @@ test "ParseOptions.max_value_len" {
328}317}
329318
330test "many object keys" {319test "many object keys" {
331 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
332
333 const doc =320 const doc =
334 \\{321 \\{
335 \\ "k1": "v1",322 \\ "k1": "v1",
lib/std/json/hashmap_test.zig-13
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const testing = std.testing;2const testing = std.testing;
43
5const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;4const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;
...@@ -19,8 +18,6 @@ const T = struct {...@@ -19,8 +18,6 @@ const T = struct {
19};18};
2019
21test "parse json hashmap" {20test "parse json hashmap" {
22 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
24 const doc =21 const doc =
25 \\{22 \\{
26 \\ "abc": {"i": 0, "s": "d"},23 \\ "abc": {"i": 0, "s": "d"},
...@@ -36,8 +33,6 @@ test "parse json hashmap" {...@@ -36,8 +33,6 @@ test "parse json hashmap" {
36}33}
3734
38test "parse json hashmap while streaming" {35test "parse json hashmap while streaming" {
39 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
40
41 const doc =36 const doc =
42 \\{37 \\{
43 \\ "abc": {"i": 0, "s": "d"},38 \\ "abc": {"i": 0, "s": "d"},
...@@ -63,8 +58,6 @@ test "parse json hashmap while streaming" {...@@ -63,8 +58,6 @@ test "parse json hashmap while streaming" {
63}58}
6459
65test "parse json hashmap duplicate fields" {60test "parse json hashmap duplicate fields" {
66 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
67
68 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);61 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
69 defer arena.deinit();62 defer arena.deinit();
7063
...@@ -93,8 +86,6 @@ test "parse json hashmap duplicate fields" {...@@ -93,8 +86,6 @@ test "parse json hashmap duplicate fields" {
93}86}
9487
95test "stringify json hashmap" {88test "stringify json hashmap" {
96 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
97
98 var value = ArrayHashMap(T){};89 var value = ArrayHashMap(T){};
99 defer value.deinit(testing.allocator);90 defer value.deinit(testing.allocator);
100 {91 {
...@@ -132,8 +123,6 @@ test "stringify json hashmap" {...@@ -132,8 +123,6 @@ test "stringify json hashmap" {
132}123}
133124
134test "stringify json hashmap whitespace" {125test "stringify json hashmap whitespace" {
135 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
136
137 var value = ArrayHashMap(T){};126 var value = ArrayHashMap(T){};
138 defer value.deinit(testing.allocator);127 defer value.deinit(testing.allocator);
139 try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });128 try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });
...@@ -158,8 +147,6 @@ test "stringify json hashmap whitespace" {...@@ -158,8 +147,6 @@ test "stringify json hashmap whitespace" {
158}147}
159148
160test "json parse from value hashmap" {149test "json parse from value hashmap" {
161 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
162
163 const doc =150 const doc =
164 \\{151 \\{
165 \\ "abc": {"i": 0, "s": "d"},152 \\ "abc": {"i": 0, "s": "d"},
lib/std/json/static_test.zig+1-2
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const testing = std.testing;2const testing = std.testing;
4const ArenaAllocator = std.heap.ArenaAllocator;3const ArenaAllocator = std.heap.ArenaAllocator;
5const Allocator = std.mem.Allocator;4const Allocator = std.mem.Allocator;
...@@ -786,7 +785,7 @@ test "max_value_len" {...@@ -786,7 +785,7 @@ test "max_value_len" {
786}785}
787786
788test "parse into vector" {787test "parse into vector" {
789 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;788 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
790789
791 const T = struct {790 const T = struct {
792 vec_i32: @Vector(4, i32),791 vec_i32: @Vector(4, i32),
lib/std/json/stringify_test.zig-3
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const mem = std.mem;2const mem = std.mem;
4const testing = std.testing;3const testing = std.testing;
54
...@@ -16,8 +15,6 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;...@@ -16,8 +15,6 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;
16const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;15const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;
1716
18test "json write stream" {17test "json write stream" {
19 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
20
21 var out_buf: [1024]u8 = undefined;18 var out_buf: [1024]u8 = undefined;
22 var slice_stream = std.io.fixedBufferStream(&out_buf);19 var slice_stream = std.io.fixedBufferStream(&out_buf);
23 const out = slice_stream.writer();20 const out = slice_stream.writer();
lib/std/json/test.zig-2
...@@ -34,8 +34,6 @@ fn testHighLevelDynamicParser(s: []const u8) !void {...@@ -34,8 +34,6 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
3434
35// Additional tests not part of test JSONTestSuite.35// Additional tests not part of test JSONTestSuite.
36test "y_trailing_comma_after_empty" {36test "y_trailing_comma_after_empty" {
37 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
38
39 try roundTrip(37 try roundTrip(
40 \\{"1":[],"2":{},"3":"4"}38 \\{"1":[],"2":{},"3":"4"}
41 );39 );
lib/std/math/big/int_test.zig+12-92
...@@ -517,8 +517,6 @@ test "big.int add multi-single" {...@@ -517,8 +517,6 @@ test "big.int add multi-single" {
517}517}
518518
519test "big.int add multi-multi" {519test "big.int add multi-multi" {
520 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
521
522 var op1: u128 = 0xefefefef7f7f7f7f;520 var op1: u128 = 0xefefefef7f7f7f7f;
523 var op2: u128 = 0xfefefefe9f9f9f9f;521 var op2: u128 = 0xfefefefe9f9f9f9f;
524 var a = try Managed.initSet(testing.allocator, op1);522 var a = try Managed.initSet(testing.allocator, op1);
...@@ -633,8 +631,6 @@ test "big.int subWrap single-single, unsigned" {...@@ -633,8 +631,6 @@ test "big.int subWrap single-single, unsigned" {
633}631}
634632
635test "big.int addWrap multi-multi, unsigned, limb aligned" {633test "big.int addWrap multi-multi, unsigned, limb aligned" {
636 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
637
638 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));634 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
639 defer a.deinit();635 defer a.deinit();
640636
...@@ -687,8 +683,6 @@ test "big.int subWrap single-single, signed" {...@@ -687,8 +683,6 @@ test "big.int subWrap single-single, signed" {
687}683}
688684
689test "big.int addWrap multi-multi, signed, limb aligned" {685test "big.int addWrap multi-multi, signed, limb aligned" {
690 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
691
692 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));686 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));
693 defer a.deinit();687 defer a.deinit();
694688
...@@ -739,8 +733,6 @@ test "big.int subSat single-single, unsigned" {...@@ -739,8 +733,6 @@ test "big.int subSat single-single, unsigned" {
739}733}
740734
741test "big.int addSat multi-multi, unsigned, limb aligned" {735test "big.int addSat multi-multi, unsigned, limb aligned" {
742 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
743
744 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));736 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
745 defer a.deinit();737 defer a.deinit();
746738
...@@ -826,8 +818,6 @@ test "big.int sub single-single" {...@@ -826,8 +818,6 @@ test "big.int sub single-single" {
826}818}
827819
828test "big.int sub multi-single" {820test "big.int sub multi-single" {
829 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
830
831 var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1);821 var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1);
832 defer a.deinit();822 defer a.deinit();
833 var b = try Managed.initSet(testing.allocator, 1);823 var b = try Managed.initSet(testing.allocator, 1);
...@@ -841,8 +831,6 @@ test "big.int sub multi-single" {...@@ -841,8 +831,6 @@ test "big.int sub multi-single" {
841}831}
842832
843test "big.int sub multi-multi" {833test "big.int sub multi-multi" {
844 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
845
846 var op1: u128 = 0xefefefefefefefefefefefef;834 var op1: u128 = 0xefefefefefefefefefefefef;
847 var op2: u128 = 0xabababababababababababab;835 var op2: u128 = 0xabababababababababababab;
848836
...@@ -927,10 +915,8 @@ test "big.int mul multi-single" {...@@ -927,10 +915,8 @@ test "big.int mul multi-single" {
927}915}
928916
929test "big.int mul multi-multi" {917test "big.int mul multi-multi" {
930 switch (builtin.zig_backend) {918 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
931 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,919 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
932 else => {},
933 }
934920
935 var op1: u256 = 0x998888efefefefefefefef;921 var op1: u256 = 0x998888efefefefefefefef;
936 var op2: u256 = 0x333000abababababababab;922 var op2: u256 = 0x333000abababababababab;
...@@ -1053,10 +1039,8 @@ test "big.int mulWrap single-single signed" {...@@ -1053,10 +1039,8 @@ test "big.int mulWrap single-single signed" {
1053}1039}
10541040
1055test "big.int mulWrap multi-multi unsigned" {1041test "big.int mulWrap multi-multi unsigned" {
1056 switch (builtin.zig_backend) {1042 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1057 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,1043 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1058 else => {},
1059 }
10601044
1061 var op1: u256 = 0x998888efefefefefefefef;1045 var op1: u256 = 0x998888efefefefefefefef;
1062 var op2: u256 = 0x333000abababababababab;1046 var op2: u256 = 0x333000abababababababab;
...@@ -1182,8 +1166,6 @@ test "big.int div single-single with rem" {...@@ -1182,8 +1166,6 @@ test "big.int div single-single with rem" {
1182}1166}
11831167
1184test "big.int div multi-single no rem" {1168test "big.int div multi-single no rem" {
1185 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1186
1187 var op1: u128 = 0xffffeeeeddddcccc;1169 var op1: u128 = 0xffffeeeeddddcccc;
1188 var op2: u128 = 34;1170 var op2: u128 = 34;
11891171
...@@ -1203,8 +1185,6 @@ test "big.int div multi-single no rem" {...@@ -1203,8 +1185,6 @@ test "big.int div multi-single no rem" {
1203}1185}
12041186
1205test "big.int div multi-single with rem" {1187test "big.int div multi-single with rem" {
1206 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1207
1208 var op1: u128 = 0xffffeeeeddddcccf;1188 var op1: u128 = 0xffffeeeeddddcccf;
1209 var op2: u128 = 34;1189 var op2: u128 = 34;
12101190
...@@ -1224,8 +1204,6 @@ test "big.int div multi-single with rem" {...@@ -1224,8 +1204,6 @@ test "big.int div multi-single with rem" {
1224}1204}
12251205
1226test "big.int div multi>2-single" {1206test "big.int div multi>2-single" {
1227 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1228
1229 var op1: u128 = 0xfefefefefefefefefefefefefefefefe;1207 var op1: u128 = 0xfefefefefefefefefefefefefefefefe;
1230 var op2: u128 = 0xefab8;1208 var op2: u128 = 0xefab8;
12311209
...@@ -1405,8 +1383,6 @@ test "big.int div trunc single-single -/-" {...@@ -1405,8 +1383,6 @@ test "big.int div trunc single-single -/-" {
1405}1383}
14061384
1407test "big.int divTrunc #15535" {1385test "big.int divTrunc #15535" {
1408 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1409
1410 var one = try Managed.initSet(testing.allocator, 1);1386 var one = try Managed.initSet(testing.allocator, 1);
1411 defer one.deinit();1387 defer one.deinit();
1412 var x = try Managed.initSet(testing.allocator, std.math.pow(u128, 2, 64));1388 var x = try Managed.initSet(testing.allocator, std.math.pow(u128, 2, 64));
...@@ -1420,8 +1396,6 @@ test "big.int divTrunc #15535" {...@@ -1420,8 +1396,6 @@ test "big.int divTrunc #15535" {
1420}1396}
14211397
1422test "big.int divFloor #10932" {1398test "big.int divFloor #10932" {
1423 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1424
1425 var a = try Managed.init(testing.allocator);1399 var a = try Managed.init(testing.allocator);
1426 defer a.deinit();1400 defer a.deinit();
14271401
...@@ -1446,8 +1420,6 @@ test "big.int divFloor #10932" {...@@ -1446,8 +1420,6 @@ test "big.int divFloor #10932" {
1446}1420}
14471421
1448test "big.int divFloor #11166" {1422test "big.int divFloor #11166" {
1449 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1450
1451 var a = try Managed.init(testing.allocator);1423 var a = try Managed.init(testing.allocator);
1452 defer a.deinit();1424 defer a.deinit();
14531425
...@@ -1475,8 +1447,6 @@ test "big.int divFloor #11166" {...@@ -1475,8 +1447,6 @@ test "big.int divFloor #11166" {
1475}1447}
14761448
1477test "big.int gcd #10932" {1449test "big.int gcd #10932" {
1478 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1479
1480 var a = try Managed.init(testing.allocator);1450 var a = try Managed.init(testing.allocator);
1481 defer a.deinit();1451 defer a.deinit();
14821452
...@@ -1668,10 +1638,7 @@ test "big.int div floor positive close to zero" {...@@ -1668,10 +1638,7 @@ test "big.int div floor positive close to zero" {
1668}1638}
16691639
1670test "big.int div multi-multi with rem" {1640test "big.int div multi-multi with rem" {
1671 switch (builtin.zig_backend) {1641 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1672 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1673 else => {},
1674 }
16751642
1676 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeeddddccccbbbbaaaa9999);1643 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeeddddccccbbbbaaaa9999);
1677 defer a.deinit();1644 defer a.deinit();
...@@ -1689,10 +1656,7 @@ test "big.int div multi-multi with rem" {...@@ -1689,10 +1656,7 @@ test "big.int div multi-multi with rem" {
1689}1656}
16901657
1691test "big.int div multi-multi no rem" {1658test "big.int div multi-multi no rem" {
1692 switch (builtin.zig_backend) {1659 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1693 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1694 else => {},
1695 }
16961660
1697 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeedb4fec200ee3a4286361);1661 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeedb4fec200ee3a4286361);
1698 defer a.deinit();1662 defer a.deinit();
...@@ -1728,10 +1692,8 @@ test "big.int div multi-multi (2 branch)" {...@@ -1728,10 +1692,8 @@ test "big.int div multi-multi (2 branch)" {
1728}1692}
17291693
1730test "big.int div multi-multi (3.1/3.3 branch)" {1694test "big.int div multi-multi (3.1/3.3 branch)" {
1731 switch (builtin.zig_backend) {1695 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1732 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,1696 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1733 else => {},
1734 }
17351697
1736 var a = try Managed.initSet(testing.allocator, 0x11111111111111111111111111111111111111111111111111111111111111);1698 var a = try Managed.initSet(testing.allocator, 0x11111111111111111111111111111111111111111111111111111111111111);
1737 defer a.deinit();1699 defer a.deinit();
...@@ -1790,10 +1752,7 @@ test "big.int div multi-multi zero-limb trailing (with rem)" {...@@ -1790,10 +1752,7 @@ test "big.int div multi-multi zero-limb trailing (with rem)" {
1790}1752}
17911753
1792test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count > divisor zero-limb count" {1754test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count > divisor zero-limb count" {
1793 switch (builtin.zig_backend) {1755 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1794 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1795 else => {},
1796 }
17971756
1798 var a = try Managed.initSet(testing.allocator, 0x8666666655555555888888877777777611111111111111110000000000000000);1757 var a = try Managed.initSet(testing.allocator, 0x8666666655555555888888877777777611111111111111110000000000000000);
1799 defer a.deinit();1758 defer a.deinit();
...@@ -1814,10 +1773,7 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li...@@ -1814,10 +1773,7 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li
1814}1773}
18151774
1816test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count < divisor zero-limb count" {1775test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count < divisor zero-limb count" {
1817 switch (builtin.zig_backend) {1776 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1818 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1819 else => {},
1820 }
18211777
1822 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);1778 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
1823 defer a.deinit();1779 defer a.deinit();
...@@ -1840,8 +1796,6 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li...@@ -1840,8 +1796,6 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li
1840}1796}
18411797
1842test "big.int div multi-multi fuzz case #1" {1798test "big.int div multi-multi fuzz case #1" {
1843 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1844
1845 var a = try Managed.init(testing.allocator);1799 var a = try Managed.init(testing.allocator);
1846 defer a.deinit();1800 defer a.deinit();
1847 var b = try Managed.init(testing.allocator);1801 var b = try Managed.init(testing.allocator);
...@@ -1938,8 +1892,6 @@ test "big.int truncate multi to multi unsigned" {...@@ -1938,8 +1892,6 @@ test "big.int truncate multi to multi unsigned" {
1938}1892}
19391893
1940test "big.int truncate multi to multi signed" {1894test "big.int truncate multi to multi signed" {
1941 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1942
1943 var a = try Managed.initSet(testing.allocator, 3 << @bitSizeOf(Limb));1895 var a = try Managed.initSet(testing.allocator, 3 << @bitSizeOf(Limb));
1944 defer a.deinit();1896 defer a.deinit();
19451897
...@@ -1949,8 +1901,6 @@ test "big.int truncate multi to multi signed" {...@@ -1949,8 +1901,6 @@ test "big.int truncate multi to multi signed" {
1949}1901}
19501902
1951test "big.int truncate negative multi to single" {1903test "big.int truncate negative multi to single" {
1952 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1953
1954 var a = try Managed.initSet(testing.allocator, -@as(SignedDoubleLimb, maxInt(Limb) + 1));1904 var a = try Managed.initSet(testing.allocator, -@as(SignedDoubleLimb, maxInt(Limb) + 1));
1955 defer a.deinit();1905 defer a.deinit();
19561906
...@@ -2057,8 +2007,6 @@ test "big.int shift-right multi" {...@@ -2057,8 +2007,6 @@ test "big.int shift-right multi" {
2057}2007}
20582008
2059test "big.int shift-left single" {2009test "big.int shift-left single" {
2060 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2061
2062 var a = try Managed.initSet(testing.allocator, 0xffff);2010 var a = try Managed.initSet(testing.allocator, 0xffff);
2063 defer a.deinit();2011 defer a.deinit();
2064 try a.shiftLeft(&a, 16);2012 try a.shiftLeft(&a, 16);
...@@ -2103,8 +2051,6 @@ test "big.int sat shift-left simple unsigned" {...@@ -2103,8 +2051,6 @@ test "big.int sat shift-left simple unsigned" {
2103}2051}
21042052
2105test "big.int sat shift-left simple unsigned no sat" {2053test "big.int sat shift-left simple unsigned no sat" {
2106 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2107
2108 var a = try Managed.initSet(testing.allocator, 1);2054 var a = try Managed.initSet(testing.allocator, 1);
2109 defer a.deinit();2055 defer a.deinit();
2110 try a.shiftLeftSat(&a, 16, .unsigned, 21);2056 try a.shiftLeftSat(&a, 16, .unsigned, 21);
...@@ -2362,8 +2308,6 @@ test "big.int bitwise xor simple" {...@@ -2362,8 +2308,6 @@ test "big.int bitwise xor simple" {
2362}2308}
23632309
2364test "big.int bitwise xor multi-limb" {2310test "big.int bitwise xor multi-limb" {
2365 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2366
2367 var x: DoubleLimb = maxInt(Limb) + 1;2311 var x: DoubleLimb = maxInt(Limb) + 1;
2368 var y: DoubleLimb = maxInt(Limb);2312 var y: DoubleLimb = maxInt(Limb);
2369 var a = try Managed.initSet(testing.allocator, x);2313 var a = try Managed.initSet(testing.allocator, x);
...@@ -2538,8 +2482,6 @@ test "big.int var args" {...@@ -2538,8 +2482,6 @@ test "big.int var args" {
2538}2482}
25392483
2540test "big.int gcd non-one small" {2484test "big.int gcd non-one small" {
2541 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2542
2543 var a = try Managed.initSet(testing.allocator, 17);2485 var a = try Managed.initSet(testing.allocator, 17);
2544 defer a.deinit();2486 defer a.deinit();
2545 var b = try Managed.initSet(testing.allocator, 97);2487 var b = try Managed.initSet(testing.allocator, 97);
...@@ -2553,8 +2495,6 @@ test "big.int gcd non-one small" {...@@ -2553,8 +2495,6 @@ test "big.int gcd non-one small" {
2553}2495}
25542496
2555test "big.int gcd non-one medium" {2497test "big.int gcd non-one medium" {
2556 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2557
2558 var a = try Managed.initSet(testing.allocator, 4864);2498 var a = try Managed.initSet(testing.allocator, 4864);
2559 defer a.deinit();2499 defer a.deinit();
2560 var b = try Managed.initSet(testing.allocator, 3458);2500 var b = try Managed.initSet(testing.allocator, 3458);
...@@ -2568,8 +2508,6 @@ test "big.int gcd non-one medium" {...@@ -2568,8 +2508,6 @@ test "big.int gcd non-one medium" {
2568}2508}
25692509
2570test "big.int gcd non-one large" {2510test "big.int gcd non-one large" {
2571 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2572
2573 var a = try Managed.initSet(testing.allocator, 0xffffffffffffffff);2511 var a = try Managed.initSet(testing.allocator, 0xffffffffffffffff);
2574 defer a.deinit();2512 defer a.deinit();
2575 var b = try Managed.initSet(testing.allocator, 0xffffffffffffffff7777);2513 var b = try Managed.initSet(testing.allocator, 0xffffffffffffffff7777);
...@@ -2583,10 +2521,8 @@ test "big.int gcd non-one large" {...@@ -2583,10 +2521,8 @@ test "big.int gcd non-one large" {
2583}2521}
25842522
2585test "big.int gcd large multi-limb result" {2523test "big.int gcd large multi-limb result" {
2586 switch (builtin.zig_backend) {2524 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
2587 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,2525 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2588 else => {},
2589 }
25902526
2591 var a = try Managed.initSet(testing.allocator, 0x12345678123456781234567812345678123456781234567812345678);2527 var a = try Managed.initSet(testing.allocator, 0x12345678123456781234567812345678123456781234567812345678);
2592 defer a.deinit();2528 defer a.deinit();
...@@ -2602,8 +2538,6 @@ test "big.int gcd large multi-limb result" {...@@ -2602,8 +2538,6 @@ test "big.int gcd large multi-limb result" {
2602}2538}
26032539
2604test "big.int gcd one large" {2540test "big.int gcd one large" {
2605 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2606
2607 var a = try Managed.initSet(testing.allocator, 1897056385327307);2541 var a = try Managed.initSet(testing.allocator, 1897056385327307);
2608 defer a.deinit();2542 defer a.deinit();
2609 var b = try Managed.initSet(testing.allocator, 2251799813685248);2543 var b = try Managed.initSet(testing.allocator, 2251799813685248);
...@@ -2695,8 +2629,6 @@ test "big.int pow" {...@@ -2695,8 +2629,6 @@ test "big.int pow" {
2695}2629}
26962630
2697test "big.int sqrt" {2631test "big.int sqrt" {
2698 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2699
2700 var r = try Managed.init(testing.allocator);2632 var r = try Managed.init(testing.allocator);
2701 defer r.deinit();2633 defer r.deinit();
2702 var a = try Managed.init(testing.allocator);2634 var a = try Managed.init(testing.allocator);
...@@ -2727,8 +2659,6 @@ test "big.int sqrt" {...@@ -2727,8 +2659,6 @@ test "big.int sqrt" {
2727}2659}
27282660
2729test "big.int regression test for 1 limb overflow with alias" {2661test "big.int regression test for 1 limb overflow with alias" {
2730 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2731
2732 // Note these happen to be two consecutive Fibonacci sequence numbers, the2662 // Note these happen to be two consecutive Fibonacci sequence numbers, the
2733 // first two whose sum exceeds 2**64.2663 // first two whose sum exceeds 2**64.
2734 var a = try Managed.initSet(testing.allocator, 7540113804746346429);2664 var a = try Managed.initSet(testing.allocator, 7540113804746346429);
...@@ -2743,8 +2673,6 @@ test "big.int regression test for 1 limb overflow with alias" {...@@ -2743,8 +2673,6 @@ test "big.int regression test for 1 limb overflow with alias" {
2743}2673}
27442674
2745test "big.int regression test for realloc with alias" {2675test "big.int regression test for realloc with alias" {
2746 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2747
2748 // Note these happen to be two consecutive Fibonacci sequence numbers, the2676 // Note these happen to be two consecutive Fibonacci sequence numbers, the
2749 // second of which is the first such number to exceed 2**192.2677 // second of which is the first such number to exceed 2**192.
2750 var a = try Managed.initSet(testing.allocator, 5611500259351924431073312796924978741056961814867751431689);2678 var a = try Managed.initSet(testing.allocator, 5611500259351924431073312796924978741056961814867751431689);
...@@ -2759,8 +2687,6 @@ test "big.int regression test for realloc with alias" {...@@ -2759,8 +2687,6 @@ test "big.int regression test for realloc with alias" {
2759}2687}
27602688
2761test "big int popcount" {2689test "big int popcount" {
2762 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2763
2764 var a = try Managed.init(testing.allocator);2690 var a = try Managed.init(testing.allocator);
2765 defer a.deinit();2691 defer a.deinit();
27662692
...@@ -3126,8 +3052,6 @@ fn byteSwapTest(comptime T: type, comptime input: comptime_int, comptime expecte...@@ -3126,8 +3052,6 @@ fn byteSwapTest(comptime T: type, comptime input: comptime_int, comptime expecte
3126}3052}
31273053
3128test "big int byte swap" {3054test "big int byte swap" {
3129 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
3130
3131 var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);3055 var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);
3132 defer a.deinit();3056 defer a.deinit();
31333057
...@@ -3172,8 +3096,6 @@ test "big int byte swap" {...@@ -3172,8 +3096,6 @@ test "big int byte swap" {
3172}3096}
31733097
3174test "big.int mul multi-multi alias r with a and b" {3098test "big.int mul multi-multi alias r with a and b" {
3175 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
3176
3177 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));3099 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));
3178 defer a.deinit();3100 defer a.deinit();
31793101
...@@ -3190,8 +3112,6 @@ test "big.int mul multi-multi alias r with a and b" {...@@ -3190,8 +3112,6 @@ test "big.int mul multi-multi alias r with a and b" {
3190}3112}
31913113
3192test "big.int sqr multi alias r with a" {3114test "big.int sqr multi alias r with a" {
3193 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
3194
3195 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));3115 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));
3196 defer a.deinit();3116 defer a.deinit();
31973117
lib/std/math/big/rational.zig-28
...@@ -514,8 +514,6 @@ test "big.rational extractLowBits" {...@@ -514,8 +514,6 @@ test "big.rational extractLowBits" {
514}514}
515515
516test "big.rational set" {516test "big.rational set" {
517 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
518
519 var a = try Rational.init(testing.allocator);517 var a = try Rational.init(testing.allocator);
520 defer a.deinit();518 defer a.deinit();
521519
...@@ -545,8 +543,6 @@ test "big.rational set" {...@@ -545,8 +543,6 @@ test "big.rational set" {
545}543}
546544
547test "big.rational setFloat" {545test "big.rational setFloat" {
548 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
549
550 var a = try Rational.init(testing.allocator);546 var a = try Rational.init(testing.allocator);
551 defer a.deinit();547 defer a.deinit();
552548
...@@ -572,8 +568,6 @@ test "big.rational setFloat" {...@@ -572,8 +568,6 @@ test "big.rational setFloat" {
572}568}
573569
574test "big.rational setFloatString" {570test "big.rational setFloatString" {
575 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
576
577 var a = try Rational.init(testing.allocator);571 var a = try Rational.init(testing.allocator);
578 defer a.deinit();572 defer a.deinit();
579573
...@@ -585,8 +579,6 @@ test "big.rational setFloatString" {...@@ -585,8 +579,6 @@ test "big.rational setFloatString" {
585}579}
586580
587test "big.rational toFloat" {581test "big.rational toFloat" {
588 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
589
590 var a = try Rational.init(testing.allocator);582 var a = try Rational.init(testing.allocator);
591 defer a.deinit();583 defer a.deinit();
592584
...@@ -600,8 +592,6 @@ test "big.rational toFloat" {...@@ -600,8 +592,6 @@ test "big.rational toFloat" {
600}592}
601593
602test "big.rational set/to Float round-trip" {594test "big.rational set/to Float round-trip" {
603 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
604
605 var a = try Rational.init(testing.allocator);595 var a = try Rational.init(testing.allocator);
606 defer a.deinit();596 defer a.deinit();
607 var prng = std.rand.DefaultPrng.init(0x5EED);597 var prng = std.rand.DefaultPrng.init(0x5EED);
...@@ -615,8 +605,6 @@ test "big.rational set/to Float round-trip" {...@@ -615,8 +605,6 @@ test "big.rational set/to Float round-trip" {
615}605}
616606
617test "big.rational copy" {607test "big.rational copy" {
618 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
619
620 var a = try Rational.init(testing.allocator);608 var a = try Rational.init(testing.allocator);
621 defer a.deinit();609 defer a.deinit();
622610
...@@ -681,8 +669,6 @@ test "big.rational abs" {...@@ -681,8 +669,6 @@ test "big.rational abs" {
681}669}
682670
683test "big.rational swap" {671test "big.rational swap" {
684 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
685
686 var a = try Rational.init(testing.allocator);672 var a = try Rational.init(testing.allocator);
687 defer a.deinit();673 defer a.deinit();
688 var b = try Rational.init(testing.allocator);674 var b = try Rational.init(testing.allocator);
...@@ -707,8 +693,6 @@ test "big.rational swap" {...@@ -707,8 +693,6 @@ test "big.rational swap" {
707}693}
708694
709test "big.rational order" {695test "big.rational order" {
710 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
711
712 var a = try Rational.init(testing.allocator);696 var a = try Rational.init(testing.allocator);
713 defer a.deinit();697 defer a.deinit();
714 var b = try Rational.init(testing.allocator);698 var b = try Rational.init(testing.allocator);
...@@ -724,8 +708,6 @@ test "big.rational order" {...@@ -724,8 +708,6 @@ test "big.rational order" {
724}708}
725709
726test "big.rational order/orderAbs with negative" {710test "big.rational order/orderAbs with negative" {
727 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
728
729 var a = try Rational.init(testing.allocator);711 var a = try Rational.init(testing.allocator);
730 defer a.deinit();712 defer a.deinit();
731 var b = try Rational.init(testing.allocator);713 var b = try Rational.init(testing.allocator);
...@@ -738,8 +720,6 @@ test "big.rational order/orderAbs with negative" {...@@ -738,8 +720,6 @@ test "big.rational order/orderAbs with negative" {
738}720}
739721
740test "big.rational add single-limb" {722test "big.rational add single-limb" {
741 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
742
743 var a = try Rational.init(testing.allocator);723 var a = try Rational.init(testing.allocator);
744 defer a.deinit();724 defer a.deinit();
745 var b = try Rational.init(testing.allocator);725 var b = try Rational.init(testing.allocator);
...@@ -755,8 +735,6 @@ test "big.rational add single-limb" {...@@ -755,8 +735,6 @@ test "big.rational add single-limb" {
755}735}
756736
757test "big.rational add" {737test "big.rational add" {
758 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
759
760 var a = try Rational.init(testing.allocator);738 var a = try Rational.init(testing.allocator);
761 defer a.deinit();739 defer a.deinit();
762 var b = try Rational.init(testing.allocator);740 var b = try Rational.init(testing.allocator);
...@@ -773,8 +751,6 @@ test "big.rational add" {...@@ -773,8 +751,6 @@ test "big.rational add" {
773}751}
774752
775test "big.rational sub" {753test "big.rational sub" {
776 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
777
778 var a = try Rational.init(testing.allocator);754 var a = try Rational.init(testing.allocator);
779 defer a.deinit();755 defer a.deinit();
780 var b = try Rational.init(testing.allocator);756 var b = try Rational.init(testing.allocator);
...@@ -791,8 +767,6 @@ test "big.rational sub" {...@@ -791,8 +767,6 @@ test "big.rational sub" {
791}767}
792768
793test "big.rational mul" {769test "big.rational mul" {
794 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
795
796 var a = try Rational.init(testing.allocator);770 var a = try Rational.init(testing.allocator);
797 defer a.deinit();771 defer a.deinit();
798 var b = try Rational.init(testing.allocator);772 var b = try Rational.init(testing.allocator);
...@@ -809,8 +783,6 @@ test "big.rational mul" {...@@ -809,8 +783,6 @@ test "big.rational mul" {
809}783}
810784
811test "big.rational div" {785test "big.rational div" {
812 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
813
814 {786 {
815 var a = try Rational.init(testing.allocator);787 var a = try Rational.init(testing.allocator);
816 defer a.deinit();788 defer a.deinit();
lib/std/math/ilogb.zig+1-2
...@@ -6,7 +6,6 @@...@@ -6,7 +6,6 @@
6// https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c6// https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c
77
8const std = @import("../std.zig");8const std = @import("../std.zig");
9const builtin = @import("builtin");
10const math = std.math;9const math = std.math;
11const expect = std.testing.expect;10const expect = std.testing.expect;
12const maxInt = std.math.maxInt;11const maxInt = std.math.maxInt;
...@@ -109,7 +108,7 @@ test "64" {...@@ -109,7 +108,7 @@ test "64" {
109}108}
110109
111test "80" {110test "80" {
112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;111 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
113112
114 try expect(ilogbX(f80, 0.0) == fp_ilogb0);113 try expect(ilogbX(f80, 0.0) == fp_ilogb0);
115 try expect(ilogbX(f80, 0.5) == -1);114 try expect(ilogbX(f80, 0.5) == -1);
lib/std/mem.zig+2-6
...@@ -1025,8 +1025,6 @@ pub fn indexOfSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]co...@@ -1025,8 +1025,6 @@ pub fn indexOfSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]co
1025}1025}
10261026
1027test "indexOfSentinel vector paths" {1027test "indexOfSentinel vector paths" {
1028 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1029
1030 const Types = [_]type{ u8, u16, u32, u64 };1028 const Types = [_]type{ u8, u16, u32, u64 };
1031 const allocator = std.testing.allocator;1029 const allocator = std.testing.allocator;
10321030
...@@ -4661,10 +4659,8 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice...@@ -4661,10 +4659,8 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice
4661}4659}
46624660
4663test "read/write(Var)PackedInt" {4661test "read/write(Var)PackedInt" {
4664 switch (builtin.zig_backend) {4662 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
4665 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,4663 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
4666 else => {},
4667 }
46684664
4669 switch (builtin.cpu.arch) {4665 switch (builtin.cpu.arch) {
4670 // This test generates too much code to execute on WASI.4666 // This test generates too much code to execute on WASI.
lib/std/net/test.zig-1
...@@ -107,7 +107,6 @@ test "parse and render UNIX addresses" {...@@ -107,7 +107,6 @@ test "parse and render UNIX addresses" {
107}107}
108108
109test "resolve DNS" {109test "resolve DNS" {
110 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
111 if (builtin.os.tag == .wasi) return error.SkipZigTest;110 if (builtin.os.tag == .wasi) return error.SkipZigTest;
112111
113 if (builtin.os.tag == .windows) {112 if (builtin.os.tag == .windows) {
lib/std/os/linux/io_uring.zig-4
...@@ -2212,8 +2212,6 @@ test "sendmsg/recvmsg" {...@@ -2212,8 +2212,6 @@ test "sendmsg/recvmsg" {
2212test "timeout (after a relative time)" {2212test "timeout (after a relative time)" {
2213 if (builtin.os.tag != .linux) return error.SkipZigTest;2213 if (builtin.os.tag != .linux) return error.SkipZigTest;
22142214
2215 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2216
2217 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2215 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2218 error.SystemOutdated => return error.SkipZigTest,2216 error.SystemOutdated => return error.SkipZigTest,
2219 error.PermissionDenied => return error.SkipZigTest,2217 error.PermissionDenied => return error.SkipZigTest,
...@@ -2278,8 +2276,6 @@ test "timeout (after a number of completions)" {...@@ -2278,8 +2276,6 @@ test "timeout (after a number of completions)" {
2278test "timeout_remove" {2276test "timeout_remove" {
2279 if (builtin.os.tag != .linux) return error.SkipZigTest;2277 if (builtin.os.tag != .linux) return error.SkipZigTest;
22802278
2281 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2282
2283 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {2279 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
2284 error.SystemOutdated => return error.SkipZigTest,2280 error.SystemOutdated => return error.SkipZigTest,
2285 error.PermissionDenied => return error.SkipZigTest,2281 error.PermissionDenied => return error.SkipZigTest,
lib/std/rand/Xoshiro256.zig+2-4
...@@ -90,10 +90,8 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void {...@@ -90,10 +90,8 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void {
90}90}
9191
92test "xoroshiro sequence" {92test "xoroshiro sequence" {
93 switch (@import("builtin").zig_backend) {93 if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
94 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,94 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
95 else => {},
96 }
9795
98 var r = Xoshiro256.init(0);96 var r = Xoshiro256.init(0);
9997
lib/std/simd.zig+1-1
...@@ -436,7 +436,7 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a...@@ -436,7 +436,7 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a
436}436}
437437
438test "vector prefix scan" {438test "vector prefix scan" {
439 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;439 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
440440
441 if (comptime builtin.cpu.arch.isMIPS()) {441 if (comptime builtin.cpu.arch.isMIPS()) {
442 return error.SkipZigTest;442 return error.SkipZigTest;
lib/std/time.zig-2
...@@ -122,8 +122,6 @@ pub fn nanoTimestamp() i128 {...@@ -122,8 +122,6 @@ pub fn nanoTimestamp() i128 {
122}122}
123123
124test "timestamp" {124test "timestamp" {
125 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
126
127 const margin = ns_per_ms * 50;125 const margin = ns_per_ms * 50;
128126
129 const time_0 = milliTimestamp();127 const time_0 = milliTimestamp();
lib/std/treap.zig-2
...@@ -350,8 +350,6 @@ const TestTreap = Treap(u64, std.math.order);...@@ -350,8 +350,6 @@ const TestTreap = Treap(u64, std.math.order);
350const TestNode = TestTreap.Node;350const TestNode = TestTreap.Node;
351351
352test "std.Treap: insert, find, replace, remove" {352test "std.Treap: insert, find, replace, remove" {
353 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
354
355 var treap = TestTreap{};353 var treap = TestTreap{};
356 var nodes: [10]TestNode = undefined;354 var nodes: [10]TestNode = undefined;
357355
lib/std/zig/Parse.zig-2
...@@ -4102,7 +4102,5 @@ const TokenIndex = Ast.TokenIndex;...@@ -4102,7 +4102,5 @@ const TokenIndex = Ast.TokenIndex;
4102const Token = std.zig.Token;4102const Token = std.zig.Token;
41034103
4104test {4104test {
4105 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4106
4107 _ = @import("parser_test.zig");4105 _ = @import("parser_test.zig");
4108}4106}
src/arch/x86_64/CodeGen.zig+159-40
...@@ -2293,7 +2293,11 @@ fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void {...@@ -2293,7 +2293,11 @@ fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void {
2293 }2293 }
2294}2294}
22952295
2296fn getValue(self: *Self, value: MCValue, inst: ?Air.Inst.Index) void {2296fn getValue(self: *Self, value: MCValue, inst: ?Air.Inst.Index) !void {
2297 for (value.getRegs()) |reg| try self.register_manager.getReg(reg, inst);
2298}
2299
2300fn getValueIfFree(self: *Self, value: MCValue, inst: ?Air.Inst.Index) void {
2297 for (value.getRegs()) |reg| if (self.register_manager.isRegFree(reg))2301 for (value.getRegs()) |reg| if (self.register_manager.isRegFree(reg))
2298 self.register_manager.getRegAssumeFree(reg, inst);2302 self.register_manager.getRegAssumeFree(reg, inst);
2299}2303}
...@@ -2341,7 +2345,7 @@ fn finishAirResult(self: *Self, inst: Air.Inst.Index, result: MCValue) void {...@@ -2341,7 +2345,7 @@ fn finishAirResult(self: *Self, inst: Air.Inst.Index, result: MCValue) void {
2341 // In some cases, an operand may be reused as the result.2345 // In some cases, an operand may be reused as the result.
2342 // If that operand died and was a register, it was freed by2346 // If that operand died and was a register, it was freed by
2343 // processDeath, so we have to "re-allocate" the register.2347 // processDeath, so we have to "re-allocate" the register.
2344 self.getValue(result, inst);2348 self.getValueIfFree(result, inst);
2345 }2349 }
2346 self.finishAirBookkeeping();2350 self.finishAirBookkeeping();
2347}2351}
...@@ -3221,6 +3225,7 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {...@@ -3221,6 +3225,7 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {
3221 .Float, .Vector => break :result try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs),3225 .Float, .Vector => break :result try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs),
3222 else => {},3226 else => {},
3223 }3227 }
3228 const dst_abi_size: u32 = @intCast(dst_ty.abiSize(mod));
32243229
3225 const dst_info = dst_ty.intInfo(mod);3230 const dst_info = dst_ty.intInfo(mod);
3226 const src_ty = try mod.intType(dst_info.signedness, switch (tag) {3231 const src_ty = try mod.intType(dst_info.signedness, switch (tag) {
...@@ -3232,12 +3237,153 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {...@@ -3232,12 +3237,153 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {
3232 ),3237 ),
3233 .div_trunc, .div_floor, .div_exact, .rem, .mod => dst_info.bits,3238 .div_trunc, .div_floor, .div_exact, .rem, .mod => dst_info.bits,
3234 });3239 });
3240 const src_abi_size: u32 = @intCast(src_ty.abiSize(mod));
3241
3242 if (dst_abi_size == 16 and src_abi_size == 16) switch (tag) {
3243 else => unreachable,
3244 .mul, .mul_wrap => {},
3245 .div_trunc, .div_floor, .div_exact, .rem, .mod => {
3246 const signed = dst_ty.isSignedInt(mod);
3247 var callee_buf: ["__udiv?i3".len]u8 = undefined;
3248 const signed_div_floor_state: struct {
3249 frame_index: FrameIndex,
3250 reloc: Mir.Inst.Index,
3251 } = if (signed and tag == .div_floor) state: {
3252 const frame_index = try self.allocFrameIndex(FrameAlloc.initType(Type.usize, mod));
3253 try self.asmMemoryImmediate(
3254 .{ ._, .mov },
3255 Memory.sib(.qword, .{ .base = .{ .frame = frame_index } }),
3256 Immediate.u(0),
3257 );
3258
3259 const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);
3260 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);
3261 defer self.register_manager.unlockReg(tmp_lock);
3262
3263 const lhs_mcv = try self.resolveInst(bin_op.lhs);
3264 if (lhs_mcv.isMemory()) try self.asmRegisterMemory(
3265 .{ ._, .mov },
3266 tmp_reg,
3267 lhs_mcv.address().offset(8).deref().mem(.qword),
3268 ) else try self.asmRegisterRegister(
3269 .{ ._, .mov },
3270 tmp_reg,
3271 lhs_mcv.register_pair[1],
3272 );
3273
3274 const rhs_mcv = try self.resolveInst(bin_op.rhs);
3275 if (rhs_mcv.isMemory()) try self.asmRegisterMemory(
3276 .{ ._, .xor },
3277 tmp_reg,
3278 rhs_mcv.address().offset(8).deref().mem(.qword),
3279 ) else try self.asmRegisterRegister(
3280 .{ ._, .xor },
3281 tmp_reg,
3282 rhs_mcv.register_pair[1],
3283 );
3284 const reloc = try self.asmJccReloc(.ns, undefined);
3285
3286 break :state .{ .frame_index = frame_index, .reloc = reloc };
3287 } else undefined;
3288 const call_mcv = try self.genCall(
3289 .{ .lib = .{
3290 .return_type = dst_ty.toIntern(),
3291 .param_types = &.{ src_ty.toIntern(), src_ty.toIntern() },
3292 .callee = std.fmt.bufPrint(&callee_buf, "__{s}{s}{c}i3", .{
3293 if (signed) "" else "u",
3294 switch (tag) {
3295 .div_trunc, .div_exact => "div",
3296 .div_floor => if (signed) "mod" else "div",
3297 .rem, .mod => "mod",
3298 else => unreachable,
3299 },
3300 intCompilerRtAbiName(@intCast(dst_ty.bitSize(mod))),
3301 }) catch unreachable,
3302 } },
3303 &.{ src_ty, src_ty },
3304 &.{ .{ .air_ref = bin_op.lhs }, .{ .air_ref = bin_op.rhs } },
3305 );
3306 break :result if (signed) switch (tag) {
3307 .div_floor => {
3308 try self.asmRegisterRegister(
3309 .{ ._, .@"or" },
3310 call_mcv.register_pair[0],
3311 call_mcv.register_pair[1],
3312 );
3313 try self.asmSetccMemory(.nz, Memory.sib(.byte, .{
3314 .base = .{ .frame = signed_div_floor_state.frame_index },
3315 }));
3316 try self.performReloc(signed_div_floor_state.reloc);
3317 const dst_mcv = try self.genCall(
3318 .{ .lib = .{
3319 .return_type = dst_ty.toIntern(),
3320 .param_types = &.{ src_ty.toIntern(), src_ty.toIntern() },
3321 .callee = std.fmt.bufPrint(&callee_buf, "__div{c}i3", .{
3322 intCompilerRtAbiName(@intCast(dst_ty.bitSize(mod))),
3323 }) catch unreachable,
3324 } },
3325 &.{ src_ty, src_ty },
3326 &.{ .{ .air_ref = bin_op.lhs }, .{ .air_ref = bin_op.rhs } },
3327 );
3328 try self.asmRegisterMemory(
3329 .{ ._, .sub },
3330 dst_mcv.register_pair[0],
3331 Memory.sib(.qword, .{
3332 .base = .{ .frame = signed_div_floor_state.frame_index },
3333 }),
3334 );
3335 try self.asmRegisterImmediate(
3336 .{ ._, .sbb },
3337 dst_mcv.register_pair[1],
3338 Immediate.u(0),
3339 );
3340 try self.freeValue(
3341 .{ .load_frame = .{ .index = signed_div_floor_state.frame_index } },
3342 );
3343 break :result dst_mcv;
3344 },
3345 .mod => {
3346 const dst_regs = call_mcv.register_pair;
3347 const dst_locks = self.register_manager.lockRegsAssumeUnused(2, dst_regs);
3348 defer for (dst_locks) |lock| self.register_manager.unlockReg(lock);
3349
3350 const tmp_regs =
3351 try self.register_manager.allocRegs(2, .{null} ** 2, abi.RegisterClass.gp);
3352 const tmp_locks = self.register_manager.lockRegsAssumeUnused(2, tmp_regs);
3353 defer for (tmp_locks) |lock| self.register_manager.unlockReg(lock);
3354
3355 const rhs_mcv = try self.resolveInst(bin_op.rhs);
3356
3357 for (tmp_regs, dst_regs) |tmp_reg, dst_reg|
3358 try self.asmRegisterRegister(.{ ._, .mov }, tmp_reg, dst_reg);
3359 if (rhs_mcv.isMemory()) {
3360 try self.asmRegisterMemory(.{ ._, .add }, tmp_regs[0], rhs_mcv.mem(.qword));
3361 try self.asmRegisterMemory(
3362 .{ ._, .adc },
3363 tmp_regs[1],
3364 rhs_mcv.address().offset(8).deref().mem(.qword),
3365 );
3366 } else for (
3367 [_]Mir.Inst.Tag{ .add, .adc },
3368 tmp_regs,
3369 rhs_mcv.register_pair,
3370 ) |op, tmp_reg, rhs_reg|
3371 try self.asmRegisterRegister(.{ ._, op }, tmp_reg, rhs_reg);
3372 try self.asmRegisterRegister(.{ ._, .@"test" }, dst_regs[1], dst_regs[1]);
3373 for (dst_regs, tmp_regs) |dst_reg, tmp_reg|
3374 try self.asmCmovccRegisterRegister(.s, dst_reg, tmp_reg);
3375 break :result call_mcv;
3376 },
3377 else => call_mcv,
3378 } else call_mcv;
3379 },
3380 };
32353381
3236 try self.spillEflagsIfOccupied();3382 try self.spillEflagsIfOccupied();
3237 try self.spillRegisters(&.{ .rax, .rdx });3383 try self.spillRegisters(&.{ .rax, .rdx });
3238 const lhs = try self.resolveInst(bin_op.lhs);3384 const lhs_mcv = try self.resolveInst(bin_op.lhs);
3239 const rhs = try self.resolveInst(bin_op.rhs);3385 const rhs_mcv = try self.resolveInst(bin_op.rhs);
3240 break :result try self.genMulDivBinOp(tag, inst, dst_ty, src_ty, lhs, rhs);3386 break :result try self.genMulDivBinOp(tag, inst, dst_ty, src_ty, lhs_mcv, rhs_mcv);
3241 };3387 };
3242 return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });3388 return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
3243}3389}
...@@ -4594,6 +4740,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void {...@@ -4594,6 +4740,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void {
45944740
4595 // TODO we could allocate register here, but need to expect addr register and potentially4741 // TODO we could allocate register here, but need to expect addr register and potentially
4596 // offset register.4742 // offset register.
4743 try self.spillEflagsIfOccupied();
4597 const dst_mcv = try self.allocRegOrMem(inst, false);4744 const dst_mcv = try self.allocRegOrMem(inst, false);
4598 try self.genBinOpMir(4745 try self.genBinOpMir(
4599 .{ ._, .add },4746 .{ ._, .add },
...@@ -7201,37 +7348,7 @@ fn genMulDivBinOp(...@@ -7201,37 +7348,7 @@ fn genMulDivBinOp(
7201 assert(self.eflags_inst == null);7348 assert(self.eflags_inst == null);
72027349
7203 if (dst_abi_size == 16 and src_abi_size == 16) {7350 if (dst_abi_size == 16 and src_abi_size == 16) {
7204 switch (tag) {7351 assert(tag == .mul or tag == .mul_wrap);
7205 else => unreachable,
7206 .mul, .mul_wrap => {},
7207 .div_trunc, .div_floor, .div_exact, .rem, .mod => {
7208 const signed = dst_ty.isSignedInt(mod);
7209 if (signed) switch (tag) {
7210 .div_floor, .mod => return self.fail(
7211 "TODO implement genMulDivBinOp for {s} from {} to {}",
7212 .{ @tagName(tag), src_ty.fmt(mod), dst_ty.fmt(mod) },
7213 ),
7214 else => {},
7215 };
7216 var callee_buf: ["__udiv?i3".len]u8 = undefined;
7217 return try self.genCall(.{ .lib = .{
7218 .return_type = dst_ty.toIntern(),
7219 .param_types = &.{ src_ty.toIntern(), src_ty.toIntern() },
7220 .callee = std.fmt.bufPrint(&callee_buf, "__{s}{s}{c}i3", .{
7221 if (signed) "" else "u",
7222 switch (tag) {
7223 .div_trunc, .div_exact => "div",
7224 .div_floor => if (signed) unreachable else "div",
7225 .rem => "mod",
7226 .mod => if (signed) unreachable else "mod",
7227 else => unreachable,
7228 },
7229 intCompilerRtAbiName(@intCast(dst_ty.bitSize(mod))),
7230 }) catch unreachable,
7231 } }, &.{ src_ty, src_ty }, &.{ lhs_mcv, rhs_mcv });
7232 },
7233 }
7234
7235 const reg_locks = self.register_manager.lockRegsAssumeUnused(2, .{ .rax, .rdx });7352 const reg_locks = self.register_manager.lockRegsAssumeUnused(2, .{ .rax, .rdx });
7236 defer for (reg_locks) |lock| self.register_manager.unlockReg(lock);7353 defer for (reg_locks) |lock| self.register_manager.unlockReg(lock);
72377354
...@@ -9436,6 +9553,7 @@ fn genBinOpMir(...@@ -9436,6 +9553,7 @@ fn genBinOpMir(
9436fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError!void {9553fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError!void {
9437 const mod = self.bin_file.options.module.?;9554 const mod = self.bin_file.options.module.?;
9438 const abi_size: u32 = @intCast(dst_ty.abiSize(mod));9555 const abi_size: u32 = @intCast(dst_ty.abiSize(mod));
9556 try self.spillEflagsIfOccupied();
9439 switch (dst_mcv) {9557 switch (dst_mcv) {
9440 .none,9558 .none,
9441 .unreach,9559 .unreach,
...@@ -10509,8 +10627,6 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {...@@ -10509,8 +10627,6 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
10509 const else_body = self.air.extra[extra.end + then_body.len ..][0..extra.data.else_body_len];10627 const else_body = self.air.extra[extra.end + then_body.len ..][0..extra.data.else_body_len];
10510 const liveness_cond_br = self.liveness.getCondBr(inst);10628 const liveness_cond_br = self.liveness.getCondBr(inst);
1051110629
10512 const reloc = try self.genCondBrMir(cond_ty, cond);
10513
10514 // If the condition dies here in this condbr instruction, process10630 // If the condition dies here in this condbr instruction, process
10515 // that death now instead of later as this has an effect on10631 // that death now instead of later as this has an effect on
10516 // whether it needs to be spilled in the branches10632 // whether it needs to be spilled in the branches
...@@ -10520,6 +10636,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {...@@ -10520,6 +10636,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
1052010636
10521 self.scope_generation += 1;10637 self.scope_generation += 1;
10522 const state = try self.saveState();10638 const state = try self.saveState();
10639 const reloc = try self.genCondBrMir(cond_ty, cond);
1052310640
10524 for (liveness_cond_br.then_deaths) |death| try self.processDeath(death);10641 for (liveness_cond_br.then_deaths) |death| try self.processDeath(death);
10525 try self.genBody(then_body);10642 try self.genBody(then_body);
...@@ -10905,7 +11022,7 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void {...@@ -10905,7 +11022,7 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void {
10905 if (std.debug.runtime_safety) assert(self.inst_tracking.getIndex(inst).? == inst_tracking_i);11022 if (std.debug.runtime_safety) assert(self.inst_tracking.getIndex(inst).? == inst_tracking_i);
10906 const tracking = &self.inst_tracking.values()[inst_tracking_i];11023 const tracking = &self.inst_tracking.values()[inst_tracking_i];
10907 if (self.liveness.isUnused(inst)) try tracking.die(self, inst);11024 if (self.liveness.isUnused(inst)) try tracking.die(self, inst);
10908 self.getValue(tracking.short, inst);11025 self.getValueIfFree(tracking.short, inst);
10909 self.finishAirBookkeeping();11026 self.finishAirBookkeeping();
10910}11027}
1091111028
...@@ -11019,7 +11136,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void {...@@ -11019,7 +11136,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void {
11019 }11136 }
1102011137
11021 const dst_mcv = if (first_br) try self.allocRegOrMem(br.block_inst, true) else dst: {11138 const dst_mcv = if (first_br) try self.allocRegOrMem(br.block_inst, true) else dst: {
11022 self.getValue(block_tracking.short, br.block_inst);11139 try self.getValue(block_tracking.short, br.block_inst);
11023 break :dst block_tracking.short;11140 break :dst block_tracking.short;
11024 };11141 };
11025 try self.genCopy(block_ty, dst_mcv, src_mcv);11142 try self.genCopy(block_ty, dst_mcv, src_mcv);
...@@ -13248,6 +13365,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {...@@ -13248,6 +13365,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
13248 defer self.register_manager.unlockReg(len_lock);13365 defer self.register_manager.unlockReg(len_lock);
1324913366
13250 try self.genSetReg(len_reg, Type.usize, len);13367 try self.genSetReg(len_reg, Type.usize, len);
13368 try self.asmRegisterRegister(.{ ._, .@"test" }, len_reg, len_reg);
1325113369
13252 const skip_reloc = try self.asmJccReloc(.z, undefined);13370 const skip_reloc = try self.asmJccReloc(.z, undefined);
13253 try self.store(slice_ptr_ty, ptr, src_val);13371 try self.store(slice_ptr_ty, ptr, src_val);
...@@ -14768,6 +14886,7 @@ fn truncateRegister(self: *Self, ty: Type, reg: Register) !void {...@@ -14768,6 +14886,7 @@ fn truncateRegister(self: *Self, ty: Type, reg: Register) !void {
14768 .bits = @intCast(ty.bitSize(mod)),14886 .bits = @intCast(ty.bitSize(mod)),
14769 };14887 };
14770 const max_reg_bit_width = Register.rax.bitSize();14888 const max_reg_bit_width = Register.rax.bitSize();
14889 try self.spillEflagsIfOccupied();
14771 switch (int_info.signedness) {14890 switch (int_info.signedness) {
14772 .signed => {14891 .signed => {
14773 const shift: u6 = @intCast(max_reg_bit_width - int_info.bits);14892 const shift: u6 = @intCast(max_reg_bit_width - int_info.bits);
src/main.zig+59-7
...@@ -3774,7 +3774,9 @@ fn serve(...@@ -3774,7 +3774,9 @@ fn serve(
3774 try comp.makeBinFileWritable();3774 try comp.makeBinFileWritable();
3775 }3775 }
37763776
3777 {3777 if (builtin.single_threaded) {
3778 try comp.update(main_progress_node);
3779 } else {
3778 var reset: std.Thread.ResetEvent = .{};3780 var reset: std.Thread.ResetEvent = .{};
37793781
3780 var progress_thread = try std.Thread.spawn(.{}, progressThread, .{3782 var progress_thread = try std.Thread.spawn(.{}, progressThread, .{
...@@ -4920,6 +4922,17 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi...@@ -4920,6 +4922,17 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
4920 var child_argv = std.ArrayList([]const u8).init(arena);4922 var child_argv = std.ArrayList([]const u8).init(arena);
4921 var reference_trace: ?u32 = null;4923 var reference_trace: ?u32 = null;
4922 var debug_compile_errors = false;4924 var debug_compile_errors = false;
4925 var verbose_link = (builtin.os.tag != .wasi or builtin.link_libc) and
4926 EnvVar.ZIG_VERBOSE_LINK.isSet();
4927 var verbose_cc = (builtin.os.tag != .wasi or builtin.link_libc) and
4928 EnvVar.ZIG_VERBOSE_CC.isSet();
4929 var verbose_air = false;
4930 var verbose_intern_pool = false;
4931 var verbose_generic_instances = false;
4932 var verbose_llvm_ir: ?[]const u8 = null;
4933 var verbose_llvm_bc: ?[]const u8 = null;
4934 var verbose_cimport = false;
4935 var verbose_llvm_cpu_features = false;
4923 var fetch_only = false;4936 var fetch_only = false;
49244937
4925 const argv_index_exe = child_argv.items.len;4938 const argv_index_exe = child_argv.items.len;
...@@ -4956,7 +4969,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi...@@ -4956,7 +4969,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
4956 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});4969 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
4957 i += 1;4970 i += 1;
4958 override_lib_dir = args[i];4971 override_lib_dir = args[i];
4959 try child_argv.appendSlice(&[_][]const u8{ arg, args[i] });4972 try child_argv.appendSlice(&.{ arg, args[i] });
4960 continue;4973 continue;
4961 } else if (mem.eql(u8, arg, "--build-runner")) {4974 } else if (mem.eql(u8, arg, "--build-runner")) {
4962 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});4975 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
...@@ -4974,22 +4987,52 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi...@@ -4974,22 +4987,52 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
4974 override_global_cache_dir = args[i];4987 override_global_cache_dir = args[i];
4975 continue;4988 continue;
4976 } else if (mem.eql(u8, arg, "-freference-trace")) {4989 } else if (mem.eql(u8, arg, "-freference-trace")) {
4977 try child_argv.append(arg);
4978 reference_trace = 256;4990 reference_trace = 256;
4979 } else if (mem.eql(u8, arg, "--fetch")) {4991 } else if (mem.eql(u8, arg, "--fetch")) {
4980 fetch_only = true;4992 fetch_only = true;
4981 } else if (mem.startsWith(u8, arg, "-freference-trace=")) {4993 } else if (mem.startsWith(u8, arg, "-freference-trace=")) {
4982 try child_argv.append(arg);
4983 const num = arg["-freference-trace=".len..];4994 const num = arg["-freference-trace=".len..];
4984 reference_trace = std.fmt.parseUnsigned(u32, num, 10) catch |err| {4995 reference_trace = std.fmt.parseUnsigned(u32, num, 10) catch |err| {
4985 fatal("unable to parse reference_trace count '{s}': {s}", .{ num, @errorName(err) });4996 fatal("unable to parse reference_trace count '{s}': {s}", .{ num, @errorName(err) });
4986 };4997 };
4987 } else if (mem.eql(u8, arg, "-fno-reference-trace")) {4998 } else if (mem.eql(u8, arg, "-fno-reference-trace")) {
4988 try child_argv.append(arg);
4989 reference_trace = null;4999 reference_trace = null;
5000 } else if (mem.eql(u8, arg, "--debug-log")) {
5001 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5002 try child_argv.appendSlice(args[i .. i + 2]);
5003 i += 1;
5004 if (!build_options.enable_logging) {
5005 std.log.warn("Zig was compiled without logging enabled (-Dlog). --debug-log has no effect.", .{});
5006 } else {
5007 try log_scopes.append(gpa, args[i]);
5008 }
5009 continue;
4990 } else if (mem.eql(u8, arg, "--debug-compile-errors")) {5010 } else if (mem.eql(u8, arg, "--debug-compile-errors")) {
4991 try child_argv.append(arg);5011 if (!crash_report.is_enabled) {
4992 debug_compile_errors = true;5012 std.log.warn("Zig was compiled in a release mode. --debug-compile-errors has no effect.", .{});
5013 } else {
5014 debug_compile_errors = true;
5015 }
5016 } else if (mem.eql(u8, arg, "--verbose-link")) {
5017 verbose_link = true;
5018 } else if (mem.eql(u8, arg, "--verbose-cc")) {
5019 verbose_cc = true;
5020 } else if (mem.eql(u8, arg, "--verbose-air")) {
5021 verbose_air = true;
5022 } else if (mem.eql(u8, arg, "--verbose-intern-pool")) {
5023 verbose_intern_pool = true;
5024 } else if (mem.eql(u8, arg, "--verbose-generic-instances")) {
5025 verbose_generic_instances = true;
5026 } else if (mem.eql(u8, arg, "--verbose-llvm-ir")) {
5027 verbose_llvm_ir = "-";
5028 } else if (mem.startsWith(u8, arg, "--verbose-llvm-ir=")) {
5029 verbose_llvm_ir = arg["--verbose-llvm-ir=".len..];
5030 } else if (mem.startsWith(u8, arg, "--verbose-llvm-bc=")) {
5031 verbose_llvm_bc = arg["--verbose-llvm-bc=".len..];
5032 } else if (mem.eql(u8, arg, "--verbose-cimport")) {
5033 verbose_cimport = true;
5034 } else if (mem.eql(u8, arg, "--verbose-llvm-cpu-features")) {
5035 verbose_llvm_cpu_features = true;
4993 } else if (mem.eql(u8, arg, "--seed")) {5036 } else if (mem.eql(u8, arg, "--seed")) {
4994 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});5037 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
4995 i += 1;5038 i += 1;
...@@ -5264,6 +5307,15 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi...@@ -5264,6 +5307,15 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
5264 .optimize_mode = .Debug,5307 .optimize_mode = .Debug,
5265 .self_exe_path = self_exe_path,5308 .self_exe_path = self_exe_path,
5266 .thread_pool = &thread_pool,5309 .thread_pool = &thread_pool,
5310 .verbose_cc = verbose_cc,
5311 .verbose_link = verbose_link,
5312 .verbose_air = verbose_air,
5313 .verbose_intern_pool = verbose_intern_pool,
5314 .verbose_generic_instances = verbose_generic_instances,
5315 .verbose_llvm_ir = verbose_llvm_ir,
5316 .verbose_llvm_bc = verbose_llvm_bc,
5317 .verbose_cimport = verbose_cimport,
5318 .verbose_llvm_cpu_features = verbose_llvm_cpu_features,
5267 .cache_mode = .whole,5319 .cache_mode = .whole,
5268 .reference_trace = reference_trace,5320 .reference_trace = reference_trace,
5269 .debug_compile_errors = debug_compile_errors,5321 .debug_compile_errors = debug_compile_errors,
test/behavior/maximum_minimum.zig+1-1
...@@ -282,7 +282,7 @@ test "@min/@max notices bounds from vector types when element of comptime-known...@@ -282,7 +282,7 @@ test "@min/@max notices bounds from vector types when element of comptime-known
282 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO282 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
283 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;283 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
284 if (builtin.zig_backend == .stage2_x86_64 and284 if (builtin.zig_backend == .stage2_x86_64 and
285 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sse4_1)) return error.SkipZigTest;285 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .avx)) return error.SkipZigTest;
286286
287 var x: @Vector(2, u32) = .{ 1_000_000, 12345 };287 var x: @Vector(2, u32) = .{ 1_000_000, 12345 };
288 const y: @Vector(2, u16) = .{ 10, undefined };288 const y: @Vector(2, u16) = .{ 10, undefined };
test/c_abi/cfuncs.c+7-3
...@@ -73,6 +73,10 @@ static void assert_or_panic(bool ok) {...@@ -73,6 +73,10 @@ static void assert_or_panic(bool ok) {
73#define ZIG_NO_RAW_F1673#define ZIG_NO_RAW_F16
74#endif74#endif
7575
76#ifdef ZIG_BACKEND_STAGE2_X86_64
77#define ZIG_NO_COMPLEX
78#endif
79
76#ifdef __i386__80#ifdef __i386__
77#define ZIG_NO_RAW_F1681#define ZIG_NO_RAW_F16
78#endif82#endif
...@@ -274,7 +278,7 @@ void run_c_tests(void) {...@@ -274,7 +278,7 @@ void run_c_tests(void) {
274 zig_u32(0xfffffffd);278 zig_u32(0xfffffffd);
275 zig_u64(0xfffffffffffffffc);279 zig_u64(0xfffffffffffffffc);
276280
277#ifndef ZIG_NO_I128281#if !defined ZIG_NO_I128 && !defined ZIG_BACKEND_STAGE2_X86_64
278 {282 {
279 struct u128 s = {0xfffffffffffffffc};283 struct u128 s = {0xfffffffffffffffc};
280 zig_struct_u128(s);284 zig_struct_u128(s);
...@@ -288,7 +292,7 @@ void run_c_tests(void) {...@@ -288,7 +292,7 @@ void run_c_tests(void) {
288 zig_i32(-3);292 zig_i32(-3);
289 zig_i64(-4);293 zig_i64(-4);
290294
291#ifndef ZIG_NO_I128295#if !defined ZIG_NO_I128 && !defined ZIG_BACKEND_STAGE2_X86_64
292 {296 {
293 struct i128 s = {-6};297 struct i128 s = {-6};
294 zig_struct_i128(s);298 zig_struct_i128(s);
...@@ -429,7 +433,7 @@ void run_c_tests(void) {...@@ -429,7 +433,7 @@ void run_c_tests(void) {
429 }433 }
430#endif434#endif
431435
432#if !defined __mips__ && !defined ZIG_PPC32436#if !defined __mips__ && !defined ZIG_PPC32 && !defined ZIG_BACKEND_STAGE2_X86_64
433 {437 {
434 struct FloatRect r1 = {1, 21, 16, 4};438 struct FloatRect r1 = {1, 21, 16, 4};
435 struct FloatRect r2 = {178, 189, 21, 15};439 struct FloatRect r2 = {178, 189, 21, 15};
test/c_abi/main.zig+86
...@@ -49,6 +49,8 @@ export fn zig_five_integers(a: i32, b: i32, c: i32, d: i32, e: i32) void {...@@ -49,6 +49,8 @@ export fn zig_five_integers(a: i32, b: i32, c: i32, d: i32, e: i32) void {
49}49}
5050
51test "C ABI integers" {51test "C ABI integers" {
52 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
53
52 c_u8(0xff);54 c_u8(0xff);
53 c_u16(0xfffe);55 c_u16(0xfffe);
54 c_u32(0xfffffffd);56 c_u32(0xfffffffd);
...@@ -185,6 +187,8 @@ const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.is...@@ -185,6 +187,8 @@ const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.is
185 !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV();187 !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV();
186188
187test "C ABI complex float" {189test "C ABI complex float" {
190 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
191
188 if (!complex_abi_compatible) return error.SkipZigTest;192 if (!complex_abi_compatible) return error.SkipZigTest;
189 if (builtin.cpu.arch == .x86_64) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/8465193 if (builtin.cpu.arch == .x86_64) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/8465
190194
...@@ -197,6 +201,8 @@ test "C ABI complex float" {...@@ -197,6 +201,8 @@ test "C ABI complex float" {
197}201}
198202
199test "C ABI complex float by component" {203test "C ABI complex float by component" {
204 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
205
200 if (!complex_abi_compatible) return error.SkipZigTest;206 if (!complex_abi_compatible) return error.SkipZigTest;
201207
202 const a = ComplexFloat{ .real = 1.25, .imag = 2.6 };208 const a = ComplexFloat{ .real = 1.25, .imag = 2.6 };
...@@ -208,6 +214,8 @@ test "C ABI complex float by component" {...@@ -208,6 +214,8 @@ test "C ABI complex float by component" {
208}214}
209215
210test "C ABI complex double" {216test "C ABI complex double" {
217 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
218
211 if (!complex_abi_compatible) return error.SkipZigTest;219 if (!complex_abi_compatible) return error.SkipZigTest;
212220
213 const a = ComplexDouble{ .real = 1.25, .imag = 2.6 };221 const a = ComplexDouble{ .real = 1.25, .imag = 2.6 };
...@@ -219,6 +227,8 @@ test "C ABI complex double" {...@@ -219,6 +227,8 @@ test "C ABI complex double" {
219}227}
220228
221test "C ABI complex double by component" {229test "C ABI complex double by component" {
230 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
231
222 if (!complex_abi_compatible) return error.SkipZigTest;232 if (!complex_abi_compatible) return error.SkipZigTest;
223233
224 const a = ComplexDouble{ .real = 1.25, .imag = 2.6 };234 const a = ComplexDouble{ .real = 1.25, .imag = 2.6 };
...@@ -230,6 +240,8 @@ test "C ABI complex double by component" {...@@ -230,6 +240,8 @@ test "C ABI complex double by component" {
230}240}
231241
232export fn zig_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat {242export fn zig_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat {
243 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
244
233 expect(a.real == 1.25) catch @panic("test failure: zig_cmultf 1");245 expect(a.real == 1.25) catch @panic("test failure: zig_cmultf 1");
234 expect(a.imag == 2.6) catch @panic("test failure: zig_cmultf 2");246 expect(a.imag == 2.6) catch @panic("test failure: zig_cmultf 2");
235 expect(b.real == 11.3) catch @panic("test failure: zig_cmultf 3");247 expect(b.real == 11.3) catch @panic("test failure: zig_cmultf 3");
...@@ -239,6 +251,8 @@ export fn zig_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat {...@@ -239,6 +251,8 @@ export fn zig_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat {
239}251}
240252
241export fn zig_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble {253export fn zig_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble {
254 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
255
242 expect(a.real == 1.25) catch @panic("test failure: zig_cmultd 1");256 expect(a.real == 1.25) catch @panic("test failure: zig_cmultd 1");
243 expect(a.imag == 2.6) catch @panic("test failure: zig_cmultd 2");257 expect(a.imag == 2.6) catch @panic("test failure: zig_cmultd 2");
244 expect(b.real == 11.3) catch @panic("test failure: zig_cmultd 3");258 expect(b.real == 11.3) catch @panic("test failure: zig_cmultd 3");
...@@ -248,6 +262,8 @@ export fn zig_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble {...@@ -248,6 +262,8 @@ export fn zig_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble {
248}262}
249263
250export fn zig_cmultf_comp(a_r: f32, a_i: f32, b_r: f32, b_i: f32) ComplexFloat {264export fn zig_cmultf_comp(a_r: f32, a_i: f32, b_r: f32, b_i: f32) ComplexFloat {
265 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
266
251 expect(a_r == 1.25) catch @panic("test failure: zig_cmultf_comp 1");267 expect(a_r == 1.25) catch @panic("test failure: zig_cmultf_comp 1");
252 expect(a_i == 2.6) catch @panic("test failure: zig_cmultf_comp 2");268 expect(a_i == 2.6) catch @panic("test failure: zig_cmultf_comp 2");
253 expect(b_r == 11.3) catch @panic("test failure: zig_cmultf_comp 3");269 expect(b_r == 11.3) catch @panic("test failure: zig_cmultf_comp 3");
...@@ -257,6 +273,8 @@ export fn zig_cmultf_comp(a_r: f32, a_i: f32, b_r: f32, b_i: f32) ComplexFloat {...@@ -257,6 +273,8 @@ export fn zig_cmultf_comp(a_r: f32, a_i: f32, b_r: f32, b_i: f32) ComplexFloat {
257}273}
258274
259export fn zig_cmultd_comp(a_r: f64, a_i: f64, b_r: f64, b_i: f64) ComplexDouble {275export fn zig_cmultd_comp(a_r: f64, a_i: f64, b_r: f64, b_i: f64) ComplexDouble {
276 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
277
260 expect(a_r == 1.25) catch @panic("test failure: zig_cmultd_comp 1");278 expect(a_r == 1.25) catch @panic("test failure: zig_cmultd_comp 1");
261 expect(a_i == 2.6) catch @panic("test failure: zig_cmultd_comp 2");279 expect(a_i == 2.6) catch @panic("test failure: zig_cmultd_comp 2");
262 expect(b_r == 11.3) catch @panic("test failure: zig_cmultd_comp 3");280 expect(b_r == 11.3) catch @panic("test failure: zig_cmultd_comp 3");
...@@ -334,6 +352,8 @@ extern fn c_med_struct_mixed(MedStructMixed) void;...@@ -334,6 +352,8 @@ extern fn c_med_struct_mixed(MedStructMixed) void;
334extern fn c_ret_med_struct_mixed() MedStructMixed;352extern fn c_ret_med_struct_mixed() MedStructMixed;
335353
336test "C ABI medium struct of ints and floats" {354test "C ABI medium struct of ints and floats" {
355 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
356
337 if (builtin.cpu.arch == .x86) return error.SkipZigTest;357 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
338 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;358 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
339 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;359 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -402,6 +422,8 @@ extern fn c_med_struct_ints(MedStructInts) void;...@@ -402,6 +422,8 @@ extern fn c_med_struct_ints(MedStructInts) void;
402extern fn c_ret_med_struct_ints() MedStructInts;422extern fn c_ret_med_struct_ints() MedStructInts;
403423
404test "C ABI medium struct of ints" {424test "C ABI medium struct of ints" {
425 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
426
405 if (builtin.cpu.arch == .x86) return error.SkipZigTest;427 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
406 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;428 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
407 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;429 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -509,6 +531,8 @@ extern fn c_split_struct_mixed(SplitStructMixed) void;...@@ -509,6 +531,8 @@ extern fn c_split_struct_mixed(SplitStructMixed) void;
509extern fn c_ret_split_struct_mixed() SplitStructMixed;531extern fn c_ret_split_struct_mixed() SplitStructMixed;
510532
511test "C ABI split struct of ints and floats" {533test "C ABI split struct of ints and floats" {
534 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
535
512 if (builtin.cpu.arch == .x86) return error.SkipZigTest;536 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
513 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;537 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
514 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;538 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -590,6 +614,8 @@ const Vector5 = extern struct {...@@ -590,6 +614,8 @@ const Vector5 = extern struct {
590extern fn c_big_struct_floats(Vector5) void;614extern fn c_big_struct_floats(Vector5) void;
591615
592test "C ABI structs of floats as parameter" {616test "C ABI structs of floats as parameter" {
617 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
618
593 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;619 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
594 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;620 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
595 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;621 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
...@@ -657,6 +683,8 @@ const FloatRect = extern struct {...@@ -657,6 +683,8 @@ const FloatRect = extern struct {
657};683};
658684
659export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void {685export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void {
686 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
687
660 expect(x.left == 1) catch @panic("test failure");688 expect(x.left == 1) catch @panic("test failure");
661 expect(x.right == 21) catch @panic("test failure");689 expect(x.right == 21) catch @panic("test failure");
662 expect(x.top == 16) catch @panic("test failure");690 expect(x.top == 16) catch @panic("test failure");
...@@ -668,6 +696,8 @@ export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void {...@@ -668,6 +696,8 @@ export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void {
668}696}
669697
670test "C ABI structs of floats as multiple parameters" {698test "C ABI structs of floats as multiple parameters" {
699 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
700
671 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;701 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
672 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;702 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
673703
...@@ -724,6 +754,8 @@ export fn zig_ret_small_struct_ints() SmallStructInts {...@@ -724,6 +754,8 @@ export fn zig_ret_small_struct_ints() SmallStructInts {
724}754}
725755
726export fn zig_ret_med_struct_ints() MedStructInts {756export fn zig_ret_med_struct_ints() MedStructInts {
757 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
758
727 return .{759 return .{
728 .x = 1,760 .x = 1,
729 .y = 2,761 .y = 2,
...@@ -732,6 +764,8 @@ export fn zig_ret_med_struct_ints() MedStructInts {...@@ -732,6 +764,8 @@ export fn zig_ret_med_struct_ints() MedStructInts {
732}764}
733765
734export fn zig_ret_med_struct_mixed() MedStructMixed {766export fn zig_ret_med_struct_mixed() MedStructMixed {
767 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
768
735 return .{769 return .{
736 .a = 1234,770 .a = 1234,
737 .b = 100.0,771 .b = 100.0,
...@@ -740,6 +774,8 @@ export fn zig_ret_med_struct_mixed() MedStructMixed {...@@ -740,6 +774,8 @@ export fn zig_ret_med_struct_mixed() MedStructMixed {
740}774}
741775
742export fn zig_ret_split_struct_mixed() SplitStructMixed {776export fn zig_ret_split_struct_mixed() SplitStructMixed {
777 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
778
743 return .{779 return .{
744 .a = 1234,780 .a = 1234,
745 .b = 100,781 .b = 100,
...@@ -780,6 +816,8 @@ extern fn c_struct_with_array(StructWithArray) void;...@@ -780,6 +816,8 @@ extern fn c_struct_with_array(StructWithArray) void;
780extern fn c_ret_struct_with_array() StructWithArray;816extern fn c_ret_struct_with_array() StructWithArray;
781817
782test "Struct with array as padding." {818test "Struct with array as padding." {
819 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
820
783 if (builtin.cpu.arch == .x86) return error.SkipZigTest;821 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
784 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;822 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
785 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;823 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -851,6 +889,8 @@ extern fn c_medium_vec(MediumVec) void;...@@ -851,6 +889,8 @@ extern fn c_medium_vec(MediumVec) void;
851extern fn c_ret_medium_vec() MediumVec;889extern fn c_ret_medium_vec() MediumVec;
852890
853test "medium simd vector" {891test "medium simd vector" {
892 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
893
854 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;894 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
855895
856 c_medium_vec(.{ 1, 2, 3, 4 });896 c_medium_vec(.{ 1, 2, 3, 4 });
...@@ -868,6 +908,8 @@ extern fn c_big_vec(BigVec) void;...@@ -868,6 +908,8 @@ extern fn c_big_vec(BigVec) void;
868extern fn c_ret_big_vec() BigVec;908extern fn c_ret_big_vec() BigVec;
869909
870test "big simd vector" {910test "big simd vector" {
911 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
912
871 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;913 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
872 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;914 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
873 if (builtin.cpu.arch == .x86_64 and builtin.os.tag == .macos and builtin.mode != .Debug) return error.SkipZigTest;915 if (builtin.cpu.arch == .x86_64 and builtin.os.tag == .macos and builtin.mode != .Debug) return error.SkipZigTest;
...@@ -891,6 +933,8 @@ extern fn c_ptr_size_float_struct(Vector2) void;...@@ -891,6 +933,8 @@ extern fn c_ptr_size_float_struct(Vector2) void;
891extern fn c_ret_ptr_size_float_struct() Vector2;933extern fn c_ret_ptr_size_float_struct() Vector2;
892934
893test "C ABI pointer sized float struct" {935test "C ABI pointer sized float struct" {
936 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
937
894 if (builtin.cpu.arch == .x86) return error.SkipZigTest;938 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
895 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;939 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
896 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;940 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
...@@ -914,6 +958,8 @@ pub inline fn expectOk(c_err: c_int) !void {...@@ -914,6 +958,8 @@ pub inline fn expectOk(c_err: c_int) !void {
914/// Tests for Double + Char struct958/// Tests for Double + Char struct
915const DC = extern struct { v1: f64, v2: u8 };959const DC = extern struct { v1: f64, v2: u8 };
916test "DC: Zig passes to C" {960test "DC: Zig passes to C" {
961 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
962
917 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;963 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
918 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;964 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
919 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;965 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -921,6 +967,8 @@ test "DC: Zig passes to C" {...@@ -921,6 +967,8 @@ test "DC: Zig passes to C" {
921 try expectOk(c_assert_DC(.{ .v1 = -0.25, .v2 = 15 }));967 try expectOk(c_assert_DC(.{ .v1 = -0.25, .v2 = 15 }));
922}968}
923test "DC: Zig returns to C" {969test "DC: Zig returns to C" {
970 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
971
924 if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest;972 if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest;
925 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;973 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
926 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;974 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
...@@ -929,6 +977,8 @@ test "DC: Zig returns to C" {...@@ -929,6 +977,8 @@ test "DC: Zig returns to C" {
929 try expectOk(c_assert_ret_DC());977 try expectOk(c_assert_ret_DC());
930}978}
931test "DC: C passes to Zig" {979test "DC: C passes to Zig" {
980 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
981
932 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;982 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
933 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;983 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
934 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;984 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -936,6 +986,8 @@ test "DC: C passes to Zig" {...@@ -936,6 +986,8 @@ test "DC: C passes to Zig" {
936 try expectOk(c_send_DC());986 try expectOk(c_send_DC());
937}987}
938test "DC: C returns to Zig" {988test "DC: C returns to Zig" {
989 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
990
939 if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest;991 if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest;
940 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;992 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
941 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;993 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
...@@ -949,6 +1001,8 @@ pub extern fn c_assert_ret_DC() c_int;...@@ -949,6 +1001,8 @@ pub extern fn c_assert_ret_DC() c_int;
949pub extern fn c_send_DC() c_int;1001pub extern fn c_send_DC() c_int;
950pub extern fn c_ret_DC() DC;1002pub extern fn c_ret_DC() DC;
951pub export fn zig_assert_DC(lv: DC) c_int {1003pub export fn zig_assert_DC(lv: DC) c_int {
1004 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
1005
952 var err: c_int = 0;1006 var err: c_int = 0;
953 if (lv.v1 != -0.25) err = 1;1007 if (lv.v1 != -0.25) err = 1;
954 if (lv.v2 != 15) err = 2;1008 if (lv.v2 != 15) err = 2;
...@@ -956,6 +1010,8 @@ pub export fn zig_assert_DC(lv: DC) c_int {...@@ -956,6 +1010,8 @@ pub export fn zig_assert_DC(lv: DC) c_int {
956 return err;1010 return err;
957}1011}
958pub export fn zig_ret_DC() DC {1012pub export fn zig_ret_DC() DC {
1013 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
1014
959 return .{ .v1 = -0.25, .v2 = 15 };1015 return .{ .v1 = -0.25, .v2 = 15 };
960}1016}
9611017
...@@ -963,6 +1019,8 @@ pub export fn zig_ret_DC() DC {...@@ -963,6 +1019,8 @@ pub export fn zig_ret_DC() DC {
963const CFF = extern struct { v1: u8, v2: f32, v3: f32 };1019const CFF = extern struct { v1: u8, v2: f32, v3: f32 };
9641020
965test "CFF: Zig passes to C" {1021test "CFF: Zig passes to C" {
1022 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1023
966 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;1024 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
967 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;1025 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
968 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;1026 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -970,6 +1028,8 @@ test "CFF: Zig passes to C" {...@@ -970,6 +1028,8 @@ test "CFF: Zig passes to C" {
970 try expectOk(c_assert_CFF(.{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }));1028 try expectOk(c_assert_CFF(.{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }));
971}1029}
972test "CFF: Zig returns to C" {1030test "CFF: Zig returns to C" {
1031 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1032
973 if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest;1033 if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest;
974 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;1034 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
975 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;1035 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -977,6 +1037,8 @@ test "CFF: Zig returns to C" {...@@ -977,6 +1037,8 @@ test "CFF: Zig returns to C" {
977 try expectOk(c_assert_ret_CFF());1037 try expectOk(c_assert_ret_CFF());
978}1038}
979test "CFF: C passes to Zig" {1039test "CFF: C passes to Zig" {
1040 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1041
980 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;1042 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
981 if (comptime builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest;1043 if (comptime builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest;
982 if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest;1044 if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest;
...@@ -987,6 +1049,8 @@ test "CFF: C passes to Zig" {...@@ -987,6 +1049,8 @@ test "CFF: C passes to Zig" {
987 try expectOk(c_send_CFF());1049 try expectOk(c_send_CFF());
988}1050}
989test "CFF: C returns to Zig" {1051test "CFF: C returns to Zig" {
1052 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1053
990 if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest;1054 if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest;
991 if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest;1055 if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest;
992 if (comptime builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest;1056 if (comptime builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest;
...@@ -1000,6 +1064,8 @@ pub extern fn c_assert_ret_CFF() c_int;...@@ -1000,6 +1064,8 @@ pub extern fn c_assert_ret_CFF() c_int;
1000pub extern fn c_send_CFF() c_int;1064pub extern fn c_send_CFF() c_int;
1001pub extern fn c_ret_CFF() CFF;1065pub extern fn c_ret_CFF() CFF;
1002pub export fn zig_assert_CFF(lv: CFF) c_int {1066pub export fn zig_assert_CFF(lv: CFF) c_int {
1067 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
1068
1003 var err: c_int = 0;1069 var err: c_int = 0;
1004 if (lv.v1 != 39) err = 1;1070 if (lv.v1 != 39) err = 1;
1005 if (lv.v2 != 0.875) err = 2;1071 if (lv.v2 != 0.875) err = 2;
...@@ -1008,6 +1074,8 @@ pub export fn zig_assert_CFF(lv: CFF) c_int {...@@ -1008,6 +1074,8 @@ pub export fn zig_assert_CFF(lv: CFF) c_int {
1008 return err;1074 return err;
1009}1075}
1010pub export fn zig_ret_CFF() CFF {1076pub export fn zig_ret_CFF() CFF {
1077 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
1078
1011 return .{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 };1079 return .{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 };
1012}1080}
10131081
...@@ -1015,6 +1083,8 @@ pub export fn zig_ret_CFF() CFF {...@@ -1015,6 +1083,8 @@ pub export fn zig_ret_CFF() CFF {
1015const PD = extern struct { v1: ?*anyopaque, v2: f64 };1083const PD = extern struct { v1: ?*anyopaque, v2: f64 };
10161084
1017test "PD: Zig passes to C" {1085test "PD: Zig passes to C" {
1086 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1087
1018 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;1088 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
1019 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;1089 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
1020 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;1090 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -1022,6 +1092,8 @@ test "PD: Zig passes to C" {...@@ -1022,6 +1092,8 @@ test "PD: Zig passes to C" {
1022 try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 }));1092 try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 }));
1023}1093}
1024test "PD: Zig returns to C" {1094test "PD: Zig returns to C" {
1095 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1096
1025 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;1097 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
1026 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;1098 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
1027 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;1099 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -1029,6 +1101,8 @@ test "PD: Zig returns to C" {...@@ -1029,6 +1101,8 @@ test "PD: Zig returns to C" {
1029 try expectOk(c_assert_ret_PD());1101 try expectOk(c_assert_ret_PD());
1030}1102}
1031test "PD: C passes to Zig" {1103test "PD: C passes to Zig" {
1104 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1105
1032 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;1106 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
1033 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;1107 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
1034 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;1108 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -1036,6 +1110,8 @@ test "PD: C passes to Zig" {...@@ -1036,6 +1110,8 @@ test "PD: C passes to Zig" {
1036 try expectOk(c_send_PD());1110 try expectOk(c_send_PD());
1037}1111}
1038test "PD: C returns to Zig" {1112test "PD: C returns to Zig" {
1113 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1114
1039 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;1115 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
1040 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;1116 if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest;
1041 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;1117 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
...@@ -1047,6 +1123,8 @@ pub extern fn c_assert_ret_PD() c_int;...@@ -1047,6 +1123,8 @@ pub extern fn c_assert_ret_PD() c_int;
1047pub extern fn c_send_PD() c_int;1123pub extern fn c_send_PD() c_int;
1048pub extern fn c_ret_PD() PD;1124pub extern fn c_ret_PD() PD;
1049pub export fn zig_c_assert_PD(lv: PD) c_int {1125pub export fn zig_c_assert_PD(lv: PD) c_int {
1126 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
1127
1050 var err: c_int = 0;1128 var err: c_int = 0;
1051 if (lv.v1 != null) err = 1;1129 if (lv.v1 != null) err = 1;
1052 if (lv.v2 != 0.5) err = 2;1130 if (lv.v2 != 0.5) err = 2;
...@@ -1054,9 +1132,13 @@ pub export fn zig_c_assert_PD(lv: PD) c_int {...@@ -1054,9 +1132,13 @@ pub export fn zig_c_assert_PD(lv: PD) c_int {
1054 return err;1132 return err;
1055}1133}
1056pub export fn zig_ret_PD() PD {1134pub export fn zig_ret_PD() PD {
1135 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
1136
1057 return .{ .v1 = null, .v2 = 0.5 };1137 return .{ .v1 = null, .v2 = 0.5 };
1058}1138}
1059pub export fn zig_assert_PD(lv: PD) c_int {1139pub export fn zig_assert_PD(lv: PD) c_int {
1140 if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest");
1141
1060 var err: c_int = 0;1142 var err: c_int = 0;
1061 if (lv.v1 != null) err = 1;1143 if (lv.v1 != null) err = 1;
1062 if (lv.v2 != 0.5) err = 2;1144 if (lv.v2 != 0.5) err = 2;
...@@ -1146,6 +1228,8 @@ const f80_struct = extern struct {...@@ -1146,6 +1228,8 @@ const f80_struct = extern struct {
1146};1228};
1147extern fn c_f80_struct(f80_struct) f80_struct;1229extern fn c_f80_struct(f80_struct) f80_struct;
1148test "f80 struct" {1230test "f80 struct" {
1231 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1232
1149 if (!has_f80) return error.SkipZigTest;1233 if (!has_f80) return error.SkipZigTest;
1150 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;1234 if (builtin.target.cpu.arch == .x86) return error.SkipZigTest;
1151 if (builtin.mode != .Debug) return error.SkipZigTest;1235 if (builtin.mode != .Debug) return error.SkipZigTest;
...@@ -1233,6 +1317,8 @@ test "Stdcall ABI big union" {...@@ -1233,6 +1317,8 @@ test "Stdcall ABI big union" {
12331317
1234extern fn c_explict_win64(ByRef) callconv(.Win64) ByRef;1318extern fn c_explict_win64(ByRef) callconv(.Win64) ByRef;
1235test "explicit SysV calling convention" {1319test "explicit SysV calling convention" {
1320 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1321
1236 if (builtin.cpu.arch != .x86_64) return error.SkipZigTest;1322 if (builtin.cpu.arch != .x86_64) return error.SkipZigTest;
12371323
1238 const res = c_explict_win64(.{ .val = 1, .arr = undefined });1324 const res = c_explict_win64(.{ .val = 1, .arr = undefined });
test/tests.zig+144-44
...@@ -94,6 +94,26 @@ const test_targets = blk: {...@@ -94,6 +94,26 @@ const test_targets = blk: {
94 .use_llvm = false,94 .use_llvm = false,
95 .use_lld = false,95 .use_lld = false,
96 },96 },
97 .{
98 .target = .{
99 .cpu_arch = .x86_64,
100 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 },
101 .os_tag = .linux,
102 .abi = .none,
103 },
104 .use_llvm = false,
105 .use_lld = false,
106 },
107 .{
108 .target = .{
109 .cpu_arch = .x86_64,
110 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v3 },
111 .os_tag = .linux,
112 .abi = .none,
113 },
114 .use_llvm = false,
115 .use_lld = false,
116 },
97 // Doesn't support new liveness117 // Doesn't support new liveness
98 //.{118 //.{
99 // .target = .{119 // .target = .{
...@@ -470,62 +490,123 @@ const test_targets = blk: {...@@ -470,62 +490,123 @@ const test_targets = blk: {
470 };490 };
471};491};
472492
473const c_abi_targets = [_]CrossTarget{493const CAbiTarget = struct {
494 target: CrossTarget = .{},
495 use_llvm: ?bool = null,
496 use_lld: ?bool = null,
497 c_defines: []const []const u8 = &.{},
498};
499
500const c_abi_targets = [_]CAbiTarget{
474 .{},501 .{},
475 .{502 .{
476 .cpu_arch = .x86_64,503 .target = .{
477 .os_tag = .linux,504 .cpu_arch = .x86_64,
478 .abi = .musl,505 .os_tag = .linux,
506 .abi = .musl,
507 },
479 },508 },
480 .{509 .{
481 .cpu_arch = .x86,510 .target = .{
482 .os_tag = .linux,511 .cpu_arch = .x86_64,
483 .abi = .musl,512 .os_tag = .linux,
513 .abi = .musl,
514 },
515 .use_llvm = false,
516 .use_lld = false,
517 .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"},
484 },518 },
485 .{519 .{
486 .cpu_arch = .aarch64,520 .target = .{
487 .os_tag = .linux,521 .cpu_arch = .x86_64,
488 .abi = .musl,522 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 },
523 .os_tag = .linux,
524 .abi = .musl,
525 },
526 .use_llvm = false,
527 .use_lld = false,
528 .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"},
489 },529 },
490 .{530 .{
491 .cpu_arch = .arm,531 .target = .{
492 .os_tag = .linux,532 .cpu_arch = .x86_64,
493 .abi = .musleabihf,533 .cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v3 },
534 .os_tag = .linux,
535 .abi = .musl,
536 },
537 .use_llvm = false,
538 .use_lld = false,
539 .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"},
494 },540 },
495 .{541 .{
496 .cpu_arch = .mips,542 .target = .{
497 .os_tag = .linux,543 .cpu_arch = .x86,
498 .abi = .musl,544 .os_tag = .linux,
545 .abi = .musl,
546 },
499 },547 },
500 .{548 .{
501 .cpu_arch = .riscv64,549 .target = .{
502 .os_tag = .linux,550 .cpu_arch = .aarch64,
503 .abi = .musl,551 .os_tag = .linux,
552 .abi = .musl,
553 },
504 },554 },
505 .{555 .{
506 .cpu_arch = .wasm32,556 .target = .{
507 .os_tag = .wasi,557 .cpu_arch = .arm,
508 .abi = .musl,558 .os_tag = .linux,
559 .abi = .musleabihf,
560 },
509 },561 },
510 .{562 .{
511 .cpu_arch = .powerpc,563 .target = .{
512 .os_tag = .linux,564 .cpu_arch = .mips,
513 .abi = .musl,565 .os_tag = .linux,
566 .abi = .musl,
567 },
514 },568 },
515 .{569 .{
516 .cpu_arch = .powerpc64le,570 .target = .{
517 .os_tag = .linux,571 .cpu_arch = .riscv64,
518 .abi = .musl,572 .os_tag = .linux,
573 .abi = .musl,
574 },
519 },575 },
520 .{576 .{
521 .cpu_arch = .x86,577 .target = .{
522 .os_tag = .windows,578 .cpu_arch = .wasm32,
523 .abi = .gnu,579 .os_tag = .wasi,
580 .abi = .musl,
581 },
524 },582 },
525 .{583 .{
526 .cpu_arch = .x86_64,584 .target = .{
527 .os_tag = .windows,585 .cpu_arch = .powerpc,
528 .abi = .gnu,586 .os_tag = .linux,
587 .abi = .musl,
588 },
589 },
590 .{
591 .target = .{
592 .cpu_arch = .powerpc64le,
593 .os_tag = .linux,
594 .abi = .musl,
595 },
596 },
597 .{
598 .target = .{
599 .cpu_arch = .x86,
600 .os_tag = .windows,
601 .abi = .gnu,
602 },
603 },
604 .{
605 .target = .{
606 .cpu_arch = .x86_64,
607 .os_tag = .windows,
608 .abi = .gnu,
609 },
529 },610 },
530};611};
531612
...@@ -1017,6 +1098,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -1017,6 +1098,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
10171098
1018 const libc_suffix = if (test_target.link_libc == true) "-libc" else "";1099 const libc_suffix = if (test_target.link_libc == true) "-libc" else "";
1019 const triple_txt = test_target.target.zigTriple(b.allocator) catch @panic("OOM");1100 const triple_txt = test_target.target.zigTriple(b.allocator) catch @panic("OOM");
1101 const model_txt = test_target.target.getCpuModel().name;
10201102
1021 // wasm32-wasi builds need more RAM, idk why1103 // wasm32-wasi builds need more RAM, idk why
1022 const max_rss = if (test_target.target.getOs().tag == .wasi)1104 const max_rss = if (test_target.target.getOs().tag == .wasi)
...@@ -1054,9 +1136,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -1054,9 +1136,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
1054 these_tests.stack_size = 2 * 1024 * 1024;1136 these_tests.stack_size = 2 * 1024 * 1024;
1055 }1137 }
10561138
1057 const qualified_name = b.fmt("{s}-{s}-{s}{s}{s}{s}{s}", .{1139 const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}", .{
1058 options.name,1140 options.name,
1059 triple_txt,1141 triple_txt,
1142 model_txt,
1060 @tagName(test_target.optimize_mode),1143 @tagName(test_target.optimize_mode),
1061 libc_suffix,1144 libc_suffix,
1062 single_threaded_suffix,1145 single_threaded_suffix,
...@@ -1144,33 +1227,50 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S...@@ -1144,33 +1227,50 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S
1144 if (optimize_mode != .Debug and skip_release) continue;1227 if (optimize_mode != .Debug and skip_release) continue;
11451228
1146 for (c_abi_targets) |c_abi_target| {1229 for (c_abi_targets) |c_abi_target| {
1147 if (skip_non_native and !c_abi_target.isNative()) continue;1230 if (skip_non_native and !c_abi_target.target.isNative()) continue;
11481231
1149 if (c_abi_target.isWindows() and c_abi_target.getCpuArch() == .aarch64) {1232 if (c_abi_target.target.isWindows() and c_abi_target.target.getCpuArch() == .aarch64) {
1150 // https://github.com/ziglang/zig/issues/149081233 // https://github.com/ziglang/zig/issues/14908
1151 continue;1234 continue;
1152 }1235 }
11531236
1154 const triple_prefix = c_abi_target.zigTriple(b.allocator) catch @panic("OOM");1237 if (c_abi_target.use_llvm == false and optimize_mode == .ReleaseFast) {
1238 // panic: unrecognized command line argument
1239 continue;
1240 }
11551241
1156 const test_step = b.addTest(.{1242 const test_step = b.addTest(.{
1243 .name = b.fmt("test-c-abi-{s}-{s}-{s}{s}{s}", .{
1244 c_abi_target.target.zigTriple(b.allocator) catch @panic("OOM"),
1245 c_abi_target.target.getCpuModel().name,
1246 @tagName(optimize_mode),
1247 if (c_abi_target.use_llvm == true)
1248 "-llvm"
1249 else if (c_abi_target.target.ofmt == std.Target.ObjectFormat.c)
1250 "-cbe"
1251 else if (c_abi_target.use_llvm == false)
1252 "-selfhosted"
1253 else
1254 "",
1255 if (c_abi_target.use_lld == false) "-no-lld" else "",
1256 }),
1157 .root_source_file = .{ .path = "test/c_abi/main.zig" },1257 .root_source_file = .{ .path = "test/c_abi/main.zig" },
1258 .target = c_abi_target.target,
1158 .optimize = optimize_mode,1259 .optimize = optimize_mode,
1159 .target = c_abi_target,1260 .link_libc = true,
1160 .name = b.fmt("test-c-abi-{s}-{s}", .{1261 .use_llvm = c_abi_target.use_llvm,
1161 triple_prefix, @tagName(optimize_mode),1262 .use_lld = c_abi_target.use_lld,
1162 }),
1163 });1263 });
1164 if (c_abi_target.abi != null and c_abi_target.abi.?.isMusl()) {1264 if (c_abi_target.target.abi != null and c_abi_target.target.abi.?.isMusl()) {
1165 // TODO NativeTargetInfo insists on dynamically linking musl1265 // TODO NativeTargetInfo insists on dynamically linking musl
1166 // for some reason?1266 // for some reason?
1167 test_step.target_info.dynamic_linker.max_byte = null;1267 test_step.target_info.dynamic_linker.max_byte = null;
1168 }1268 }
1169 test_step.linkLibC();
1170 test_step.addCSourceFile(.{1269 test_step.addCSourceFile(.{
1171 .file = .{ .path = "test/c_abi/cfuncs.c" },1270 .file = .{ .path = "test/c_abi/cfuncs.c" },
1172 .flags = &.{"-std=c99"},1271 .flags = &.{"-std=c99"},
1173 });1272 });
1273 for (c_abi_target.c_defines) |define| test_step.defineCMacro(define, null);
11741274
1175 // This test is intentionally trying to check if the external ABI is1275 // This test is intentionally trying to check if the external ABI is
1176 // done properly. LTO would be a hindrance to this.1276 // done properly. LTO would be a hindrance to this.