| author | |
| committer | |
| log | 3b0dce8ebd252161bfca237953c00b2a40705b90 |
| tree | f0df484b4b6cf67b28dedff0f9622ba319d425c4 |
| parent | 8f48533691e93538846993f78f732272a03a600b |
| parent | b0cf620fe3032d485b581c8ab6239f719ef2cada |
| signature |
x86_64: pass more tests46 files changed, 507 insertions(+), 403 deletions(-)
lib/std/Build/Step/Options.zig-2| ... | ... | @@ -295,8 +295,6 @@ const Arg = struct { |
| 295 | 295 | test Options { |
| 296 | 296 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 297 | 297 | |
| 298 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 299 | ||
| 300 | 298 | var arena = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 301 | 299 | defer arena.deinit(); |
| 302 | 300 |
lib/std/array_hash_map.zig-2| ... | ... | @@ -2294,8 +2294,6 @@ test "popOrNull" { |
| 2294 | 2294 | } |
| 2295 | 2295 | |
| 2296 | 2296 | test "reIndex" { |
| 2297 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2298 | ||
| 2299 | 2297 | var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator); |
| 2300 | 2298 | defer map.deinit(); |
| 2301 | 2299 |
lib/std/compress/deflate/compressor.zig-2| ... | ... | @@ -1069,8 +1069,6 @@ var deflate_tests = [_]DeflateTest{ |
| 1069 | 1069 | }; |
| 1070 | 1070 | |
| 1071 | 1071 | test "deflate" { |
| 1072 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1073 | ||
| 1074 | 1072 | for (deflate_tests) |dt| { |
| 1075 | 1073 | var output = ArrayList(u8).init(testing.allocator); |
| 1076 | 1074 | defer output.deinit(); |
lib/std/compress/deflate/compressor_test.zig-19| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const expect = std.testing.expect; |
| 4 | 3 | const fifo = std.fifo; |
| 5 | 4 | const io = std.io; |
| ... | ... | @@ -154,8 +153,6 @@ fn testToFromWithLimit(input: []const u8, limit: [11]u32) !void { |
| 154 | 153 | } |
| 155 | 154 | |
| 156 | 155 | test "deflate/inflate" { |
| 157 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 158 | ||
| 159 | 156 | var limits = [_]u32{0} ** 11; |
| 160 | 157 | |
| 161 | 158 | var test0 = [_]u8{}; |
| ... | ... | @@ -180,8 +177,6 @@ test "deflate/inflate" { |
| 180 | 177 | } |
| 181 | 178 | |
| 182 | 179 | test "very long sparse chunk" { |
| 183 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 184 | ||
| 185 | 180 | // A SparseReader returns a stream consisting of 0s ending with 65,536 (1<<16) 1s. |
| 186 | 181 | // This tests missing hash references in a very large input. |
| 187 | 182 | const SparseReader = struct { |
| ... | ... | @@ -243,8 +238,6 @@ test "very long sparse chunk" { |
| 243 | 238 | } |
| 244 | 239 | |
| 245 | 240 | test "compressor reset" { |
| 246 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 247 | ||
| 248 | 241 | for (std.enums.values(deflate.Compression)) |c| { |
| 249 | 242 | try testWriterReset(c, null); |
| 250 | 243 | try testWriterReset(c, "dict"); |
| ... | ... | @@ -295,8 +288,6 @@ fn testWriterReset(level: deflate.Compression, dict: ?[]const u8) !void { |
| 295 | 288 | } |
| 296 | 289 | |
| 297 | 290 | test "decompressor dictionary" { |
| 298 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 299 | ||
| 300 | 291 | const dict = "hello world"; // dictionary |
| 301 | 292 | const text = "hello again world"; |
| 302 | 293 | |
| ... | ... | @@ -337,8 +328,6 @@ test "decompressor dictionary" { |
| 337 | 328 | } |
| 338 | 329 | |
| 339 | 330 | test "compressor dictionary" { |
| 340 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 341 | ||
| 342 | 331 | const dict = "hello world"; |
| 343 | 332 | const text = "hello again world"; |
| 344 | 333 | |
| ... | ... | @@ -385,8 +374,6 @@ test "compressor dictionary" { |
| 385 | 374 | // Update the hash for best_speed only if d.index < d.maxInsertIndex |
| 386 | 375 | // See https://golang.org/issue/2508 |
| 387 | 376 | test "Go non-regression test for 2508" { |
| 388 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 389 | ||
| 390 | 377 | var comp = try compressor( |
| 391 | 378 | testing.allocator, |
| 392 | 379 | io.null_writer, |
| ... | ... | @@ -404,8 +391,6 @@ test "Go non-regression test for 2508" { |
| 404 | 391 | } |
| 405 | 392 | |
| 406 | 393 | test "deflate/inflate string" { |
| 407 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 408 | ||
| 409 | 394 | const StringTest = struct { |
| 410 | 395 | filename: []const u8, |
| 411 | 396 | limit: [11]u32, |
| ... | ... | @@ -453,8 +438,6 @@ test "deflate/inflate string" { |
| 453 | 438 | } |
| 454 | 439 | |
| 455 | 440 | test "inflate reset" { |
| 456 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 457 | ||
| 458 | 441 | const strings = [_][]const u8{ |
| 459 | 442 | "lorem ipsum izzle fo rizzle", |
| 460 | 443 | "the quick brown fox jumped over", |
| ... | ... | @@ -501,8 +484,6 @@ test "inflate reset" { |
| 501 | 484 | } |
| 502 | 485 | |
| 503 | 486 | test "inflate reset dictionary" { |
| 504 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 505 | ||
| 506 | 487 | const dict = "the lorem fox"; |
| 507 | 488 | const strings = [_][]const u8{ |
| 508 | 489 | "lorem ipsum izzle fo rizzle", |
lib/std/compress/deflate/deflate_fast.zig-2| ... | ... | @@ -649,8 +649,6 @@ test "best speed shift offsets" { |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | test "best speed reset" { |
| 652 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 653 | ||
| 654 | 652 | // test that encoding is consistent across a warparound of the table offset. |
| 655 | 653 | // See https://github.com/golang/go/issues/34121 |
| 656 | 654 | const fmt = std.fmt; |
lib/std/compress/deflate/deflate_fast_test.zig-5| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const expect = std.testing.expect; |
| 4 | 3 | const io = std.io; |
| 5 | 4 | const mem = std.mem; |
| ... | ... | @@ -12,8 +11,6 @@ const inflate = @import("decompressor.zig"); |
| 12 | 11 | const deflate_const = @import("deflate_const.zig"); |
| 13 | 12 | |
| 14 | 13 | test "best speed" { |
| 15 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 16 | ||
| 17 | 14 | // Tests that round-tripping through deflate and then inflate recovers the original input. |
| 18 | 15 | // The Write sizes are near the thresholds in the compressor.encSpeed method (0, 16, 128), as well |
| 19 | 16 | // as near `deflate_const.max_store_block_size` (65535). |
| ... | ... | @@ -96,8 +93,6 @@ test "best speed" { |
| 96 | 93 | } |
| 97 | 94 | |
| 98 | 95 | test "best speed max match offset" { |
| 99 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 100 | ||
| 101 | 96 | const abc = "abcdefgh"; |
| 102 | 97 | const xyz = "stuvwxyz"; |
| 103 | 98 | const input_margin = 16 - 1; |
lib/std/compress/deflate/huffman_bit_writer.zig-7| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const io = std.io; |
| 4 | 3 | |
| 5 | 4 | const Allocator = std.mem.Allocator; |
| ... | ... | @@ -845,8 +844,6 @@ const testing = std.testing; |
| 845 | 844 | const ArrayList = std.ArrayList; |
| 846 | 845 | |
| 847 | 846 | test "writeBlockHuff" { |
| 848 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 849 | ||
| 850 | 847 | // Tests huffman encoding against reference files to detect possible regressions. |
| 851 | 848 | // If encoding/bit allocation changes you can regenerate these files |
| 852 | 849 | |
| ... | ... | @@ -1571,8 +1568,6 @@ const TestType = enum { |
| 1571 | 1568 | }; |
| 1572 | 1569 | |
| 1573 | 1570 | test "writeBlock" { |
| 1574 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1575 | ||
| 1576 | 1571 | // tests if the writeBlock encoding has changed. |
| 1577 | 1572 | |
| 1578 | 1573 | const ttype: TestType = .write_block; |
| ... | ... | @@ -1588,8 +1583,6 @@ test "writeBlock" { |
| 1588 | 1583 | } |
| 1589 | 1584 | |
| 1590 | 1585 | test "writeBlockDynamic" { |
| 1591 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1592 | ||
| 1593 | 1586 | // tests if the writeBlockDynamic encoding has changed. |
| 1594 | 1587 | |
| 1595 | 1588 | const ttype: TestType = .write_dyn_block; |
lib/std/compress/lzma/test.zig-11| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("../../std.zig"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const lzma = @import("../lzma.zig"); |
| 4 | 3 | |
| 5 | 4 | fn testDecompress(compressed: []const u8) ![]u8 { |
| ... | ... | @@ -33,8 +32,6 @@ test "LZMA: decompress empty world" { |
| 33 | 32 | } |
| 34 | 33 | |
| 35 | 34 | test "LZMA: decompress hello world" { |
| 36 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 37 | ||
| 38 | 35 | try testDecompressEqual( |
| 39 | 36 | "Hello world\n", |
| 40 | 37 | &[_]u8{ |
| ... | ... | @@ -46,8 +43,6 @@ test "LZMA: decompress hello world" { |
| 46 | 43 | } |
| 47 | 44 | |
| 48 | 45 | test "LZMA: decompress huge dict" { |
| 49 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 50 | ||
| 51 | 46 | try testDecompressEqual( |
| 52 | 47 | "Hello world\n", |
| 53 | 48 | &[_]u8{ |
| ... | ... | @@ -59,8 +54,6 @@ test "LZMA: decompress huge dict" { |
| 59 | 54 | } |
| 60 | 55 | |
| 61 | 56 | test "LZMA: unknown size with end of payload marker" { |
| 62 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 63 | ||
| 64 | 57 | try testDecompressEqual( |
| 65 | 58 | "Hello\nWorld!\n", |
| 66 | 59 | @embedFile("testdata/good-unknown_size-with_eopm.lzma"), |
| ... | ... | @@ -68,8 +61,6 @@ test "LZMA: unknown size with end of payload marker" { |
| 68 | 61 | } |
| 69 | 62 | |
| 70 | 63 | test "LZMA: known size without end of payload marker" { |
| 71 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 72 | ||
| 73 | 64 | try testDecompressEqual( |
| 74 | 65 | "Hello\nWorld!\n", |
| 75 | 66 | @embedFile("testdata/good-known_size-without_eopm.lzma"), |
| ... | ... | @@ -77,8 +68,6 @@ test "LZMA: known size without end of payload marker" { |
| 77 | 68 | } |
| 78 | 69 | |
| 79 | 70 | test "LZMA: known size with end of payload marker" { |
| 80 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 81 | ||
| 82 | 71 | try testDecompressEqual( |
| 83 | 72 | "Hello\nWorld!\n", |
| 84 | 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 | 50 | const expectError = std.testing.expectError; |
| 51 | 51 | |
| 52 | 52 | test "Vec2D.init" { |
| 53 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 54 | ||
| 55 | 53 | const allocator = testing.allocator; |
| 56 | 54 | var vec2d = try Vec2D(i32).init(allocator, 1, .{ 2, 3 }); |
| 57 | 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 | 19 | } |
| 20 | 20 | |
| 21 | 21 | test "compressed data" { |
| 22 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 23 | ||
| 24 | 22 | try testReader(@embedFile("testdata/good-0-empty.xz"), ""); |
| 25 | 23 | |
| 26 | 24 | inline for ([_][]const u8{ |
lib/std/compress/zlib.zig-2| ... | ... | @@ -264,8 +264,6 @@ test "sanity checks" { |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | test "compress data" { |
| 267 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 268 | ||
| 269 | 267 | const allocator = testing.allocator; |
| 270 | 268 | const rfc1951_txt = @embedFile("testdata/rfc1951.txt"); |
| 271 | 269 |
lib/std/crypto/25519/ed25519.zig-2| ... | ... | @@ -685,8 +685,6 @@ test "ed25519 signatures with streaming" { |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | test "ed25519 key pair from secret key" { |
| 688 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 689 | ||
| 690 | 688 | const kp = try Ed25519.KeyPair.create(null); |
| 691 | 689 | const kp2 = try Ed25519.KeyPair.fromSecretKey(kp.secret_key); |
| 692 | 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 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | test "seal" { |
| 1032 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1033 | ||
| 1034 | 1032 | { |
| 1035 | 1033 | const m = ""; |
| 1036 | 1034 | const ad = ""; |
| ... | ... | @@ -1081,8 +1079,6 @@ test "seal" { |
| 1081 | 1079 | } |
| 1082 | 1080 | |
| 1083 | 1081 | test "open" { |
| 1084 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1085 | ||
| 1086 | 1082 | { |
| 1087 | 1083 | const c = [_]u8{ 0xa0, 0x78, 0x4d, 0x7a, 0x47, 0x16, 0xf3, 0xfe, 0xb4, 0xf6, 0x4e, 0x7f, 0x4b, 0x39, 0xbf, 0x4 }; |
| 1088 | 1084 | const ad = ""; |
| ... | ... | @@ -1147,8 +1143,6 @@ test "open" { |
| 1147 | 1143 | } |
| 1148 | 1144 | |
| 1149 | 1145 | test "crypto.xchacha20" { |
| 1150 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1151 | ||
| 1152 | 1146 | const key = [_]u8{69} ** 32; |
| 1153 | 1147 | const nonce = [_]u8{42} ** 24; |
| 1154 | 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 | 372 | } |
| 373 | 373 | |
| 374 | 374 | test "ECDSA - Basic operations over EcdsaP384Sha384" { |
| 375 | switch (builtin.zig_backend) { | |
| 376 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 377 | else => {}, | |
| 378 | } | |
| 375 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 376 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 379 | 377 | |
| 380 | 378 | const Scheme = EcdsaP384Sha384; |
| 381 | 379 | const kp = try Scheme.KeyPair.create(null); |
| ... | ... | @@ -391,10 +389,8 @@ test "ECDSA - Basic operations over EcdsaP384Sha384" { |
| 391 | 389 | } |
| 392 | 390 | |
| 393 | 391 | test "ECDSA - Basic operations over Secp256k1" { |
| 394 | switch (builtin.zig_backend) { | |
| 395 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 396 | else => {}, | |
| 397 | } | |
| 392 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 393 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 398 | 394 | |
| 399 | 395 | const Scheme = EcdsaSecp256k1Sha256oSha256; |
| 400 | 396 | const kp = try Scheme.KeyPair.create(null); |
| ... | ... | @@ -410,10 +406,8 @@ test "ECDSA - Basic operations over Secp256k1" { |
| 410 | 406 | } |
| 411 | 407 | |
| 412 | 408 | test "ECDSA - Basic operations over EcdsaP384Sha256" { |
| 413 | switch (builtin.zig_backend) { | |
| 414 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 415 | else => {}, | |
| 416 | } | |
| 409 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 410 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 417 | 411 | |
| 418 | 412 | const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256); |
| 419 | 413 | const kp = try Scheme.KeyPair.create(null); |
| ... | ... | @@ -429,10 +423,8 @@ test "ECDSA - Basic operations over EcdsaP384Sha256" { |
| 429 | 423 | } |
| 430 | 424 | |
| 431 | 425 | test "ECDSA - Verifying a existing signature with EcdsaP384Sha256" { |
| 432 | switch (builtin.zig_backend) { | |
| 433 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 434 | else => {}, | |
| 435 | } | |
| 426 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 427 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 436 | 428 | |
| 437 | 429 | const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256); |
| 438 | 430 | // zig fmt: off |
| ... | ... | @@ -476,10 +468,8 @@ const TestVector = struct { |
| 476 | 468 | }; |
| 477 | 469 | |
| 478 | 470 | test "ECDSA - Test vectors from Project Wycheproof" { |
| 479 | switch (builtin.zig_backend) { | |
| 480 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 481 | else => {}, | |
| 482 | } | |
| 471 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 472 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 483 | 473 | |
| 484 | 474 | const vectors = [_]TestVector{ |
| 485 | 475 | .{ .key = "042927b10512bae3eddcfe467828128bad2903269919f7086069c8c4df6c732838c7787964eaac00e5921fb1498a60f4606766b3d9685001558d1a974e7341513e", .msg = "313233343030", .sig = "304402202ba3a8be6b94d5ec80a6d9d1190a436effe50d85a1eee859b8cc6af9bd5c2e1802204cd60b855d442f5b3c7b11eb6c4e0ae7525fe710fab9aa7c77a67f79e6fadd76", .result = .valid }, |
| ... | ... | @@ -893,10 +883,8 @@ fn tvTry(vector: TestVector) !void { |
| 893 | 883 | } |
| 894 | 884 | |
| 895 | 885 | test "ECDSA - Sec1 encoding/decoding" { |
| 896 | switch (builtin.zig_backend) { | |
| 897 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 898 | else => {}, | |
| 899 | } | |
| 886 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 887 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 900 | 888 | |
| 901 | 889 | const Scheme = EcdsaP384Sha384; |
| 902 | 890 | const kp = try Scheme.KeyPair.create(null); |
lib/std/crypto/ff.zig+14-15| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 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. |
| 7 | 7 | |
| 8 | 8 | const std = @import("std"); |
| 9 | const builtin = std.builtin; | |
| 9 | const builtin = @import("builtin"); | |
| 10 | 10 | const crypto = std.crypto; |
| 11 | 11 | const math = std.math; |
| 12 | 12 | const mem = std.mem; |
| ... | ... | @@ -14,6 +14,7 @@ const meta = std.meta; |
| 14 | 14 | const testing = std.testing; |
| 15 | 15 | const BoundedArray = std.BoundedArray; |
| 16 | 16 | const assert = std.debug.assert; |
| 17 | const Endian = std.builtin.Endian; | |
| 17 | 18 | |
| 18 | 19 | // A Limb is a single digit in a big integer. |
| 19 | 20 | const Limb = usize; |
| ... | ... | @@ -27,7 +28,7 @@ const t_bits: usize = @bitSizeOf(Limb) - carry_bits; |
| 27 | 28 | // A TLimb is a Limb that is truncated to t_bits. |
| 28 | 29 | const TLimb = meta.Int(.unsigned, t_bits); |
| 29 | 30 | |
| 30 | const native_endian = @import("builtin").target.cpu.arch.endian(); | |
| 31 | const native_endian = builtin.target.cpu.arch.endian(); | |
| 31 | 32 | |
| 32 | 33 | // A WideLimb is a Limb that is twice as wide as a normal Limb. |
| 33 | 34 | const WideLimb = struct { |
| ... | ... | @@ -128,7 +129,7 @@ pub fn Uint(comptime max_bits: comptime_int) type { |
| 128 | 129 | } |
| 129 | 130 | |
| 130 | 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 | 133 | if (bytes.len == 0) { |
| 133 | 134 | if (self.isZero()) return; |
| 134 | 135 | return error.Overflow; |
| ... | ... | @@ -175,7 +176,7 @@ pub fn Uint(comptime max_bits: comptime_int) type { |
| 175 | 176 | } |
| 176 | 177 | |
| 177 | 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 | 180 | if (bytes.len == 0) return Self.zero; |
| 180 | 181 | var shift: usize = 0; |
| 181 | 182 | var out = Self.zero; |
| ... | ... | @@ -335,7 +336,7 @@ fn Fe_(comptime bits: comptime_int) type { |
| 335 | 336 | } |
| 336 | 337 | |
| 337 | 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 | 340 | const v = try FeUint.fromBytes(bytes, endian); |
| 340 | 341 | var fe = Self{ .v = v }; |
| 341 | 342 | try m.shrink(&fe); |
| ... | ... | @@ -344,7 +345,7 @@ fn Fe_(comptime bits: comptime_int) type { |
| 344 | 345 | } |
| 345 | 346 | |
| 346 | 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 | 349 | return self.v.toBytes(bytes, endian); |
| 349 | 350 | } |
| 350 | 351 | |
| ... | ... | @@ -458,13 +459,13 @@ pub fn Modulus(comptime max_bits: comptime_int) type { |
| 458 | 459 | } |
| 459 | 460 | |
| 460 | 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 | 463 | const v = try FeUint.fromBytes(bytes, endian); |
| 463 | 464 | return try Self.fromUint(v); |
| 464 | 465 | } |
| 465 | 466 | |
| 466 | 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 | 469 | return self.v.toBytes(bytes, endian); |
| 469 | 470 | } |
| 470 | 471 | |
| ... | ... | @@ -658,7 +659,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type { |
| 658 | 659 | |
| 659 | 660 | // Returns x^e (mod m), with the exponent provided as a byte string. |
| 660 | 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 | 663 | var acc: u8 = 0; |
| 663 | 664 | for (e) |b| acc |= b; |
| 664 | 665 | if (acc == 0) return error.NullExponent; |
| ... | ... | @@ -801,7 +802,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type { |
| 801 | 802 | /// doesn't have to be created if a serialized representation is already available. |
| 802 | 803 | /// |
| 803 | 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 | 806 | return self.powWithEncodedExponentInternal(x, e, endian, false); |
| 806 | 807 | } |
| 807 | 808 | |
| ... | ... | @@ -810,7 +811,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type { |
| 810 | 811 | /// doesn't have to be created if a serialized representation is already available. |
| 811 | 812 | /// |
| 812 | 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 | 815 | return self.powWithEncodedExponentInternal(x, e, endian, true); |
| 815 | 816 | } |
| 816 | 817 | }; |
| ... | ... | @@ -912,10 +913,8 @@ const ct_unprotected = struct { |
| 912 | 913 | }; |
| 913 | 914 | |
| 914 | 915 | test { |
| 915 | switch (@import("builtin").zig_backend) { | |
| 916 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 917 | else => {}, | |
| 918 | } | |
| 916 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 917 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 919 | 918 | |
| 920 | 919 | const M = Modulus(256); |
| 921 | 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 | 478 | }; |
| 479 | 479 | |
| 480 | 480 | test { |
| 481 | switch (@import("builtin").zig_backend) { | |
| 482 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 483 | else => {}, | |
| 484 | } | |
| 481 | if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest; | |
| 482 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 485 | 483 | |
| 486 | 484 | _ = @import("tests/p384.zig"); |
| 487 | 485 | } |
lib/std/crypto/pcurves/secp256k1.zig+2-4| ... | ... | @@ -556,10 +556,8 @@ pub const AffineCoordinates = struct { |
| 556 | 556 | }; |
| 557 | 557 | |
| 558 | 558 | test { |
| 559 | switch (@import("builtin").zig_backend) { | |
| 560 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 561 | else => {}, | |
| 562 | } | |
| 559 | if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest; | |
| 560 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 563 | 561 | |
| 564 | 562 | _ = @import("tests/secp256k1.zig"); |
| 565 | 563 | } |
lib/std/crypto/poly1305.zig-2| ... | ... | @@ -196,8 +196,6 @@ pub const Poly1305 = struct { |
| 196 | 196 | }; |
| 197 | 197 | |
| 198 | 198 | test "poly1305 rfc7439 vector1" { |
| 199 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 200 | ||
| 201 | 199 | const expected_mac = "\xa8\x06\x1d\xc1\x30\x51\x36\xc6\xc2\x2b\x8b\xaf\x0c\x01\x27\xa9"; |
| 202 | 200 | |
| 203 | 201 | const msg = "Cryptographic Forum Research Group"; |
lib/std/crypto/salsa20.zig-2| ... | ... | @@ -623,8 +623,6 @@ test "xsalsa20poly1305 sealedbox" { |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | test "secretbox twoblocks" { |
| 626 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 627 | ||
| 628 | 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 | 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 | 628 | const msg = [_]u8{'a'} ** 97; |
lib/std/crypto/sha2.zig+1-1| ... | ... | @@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type { |
| 238 | 238 | return; |
| 239 | 239 | }, |
| 240 | 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 | 242 | var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] }; |
| 243 | 243 | var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] }; |
| 244 | 244 | const s_v = @as(*[16]v4u32, @ptrCast(&s)); |
lib/std/fs.zig+1-3| ... | ... | @@ -3248,9 +3248,7 @@ test { |
| 3248 | 3248 | _ = &makeDirAbsolute; |
| 3249 | 3249 | _ = &makeDirAbsoluteZ; |
| 3250 | 3250 | _ = &copyFileAbsolute; |
| 3251 | if (builtin.zig_backend != .stage2_x86_64) { | |
| 3252 | _ = &updateFileAbsolute; | |
| 3253 | } | |
| 3251 | _ = &updateFileAbsolute; | |
| 3254 | 3252 | } |
| 3255 | 3253 | _ = &Dir.copyFile; |
| 3256 | 3254 | _ = @import("fs/test.zig"); |
lib/std/fs/test.zig-4| ... | ... | @@ -1460,8 +1460,6 @@ test "walker without fully iterating" { |
| 1460 | 1460 | test ". and .. in fs.Dir functions" { |
| 1461 | 1461 | if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 1462 | 1462 | |
| 1463 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1464 | ||
| 1465 | 1463 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) { |
| 1466 | 1464 | // https://github.com/ziglang/zig/issues/17134 |
| 1467 | 1465 | return error.SkipZigTest; |
| ... | ... | @@ -1502,8 +1500,6 @@ test ". and .. in fs.Dir functions" { |
| 1502 | 1500 | test ". and .. in absolute functions" { |
| 1503 | 1501 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1504 | 1502 | |
| 1505 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1506 | ||
| 1507 | 1503 | var tmp = tmpDir(.{}); |
| 1508 | 1504 | defer tmp.cleanup(); |
| 1509 | 1505 |
lib/std/io/test.zig-2| ... | ... | @@ -161,8 +161,6 @@ test "setEndPos" { |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | test "updateTimes" { |
| 164 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 165 | ||
| 166 | 164 | var tmp = tmpDir(.{}); |
| 167 | 165 | defer tmp.cleanup(); |
| 168 | 166 |
lib/std/json/JSONTestSuite_test.zig-6| ... | ... | @@ -764,8 +764,6 @@ test "y_number_simple_real.json" { |
| 764 | 764 | try ok("[123.456789]"); |
| 765 | 765 | } |
| 766 | 766 | test "y_object.json" { |
| 767 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 768 | ||
| 769 | 767 | try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}"); |
| 770 | 768 | } |
| 771 | 769 | test "y_object_basic.json" { |
| ... | ... | @@ -787,13 +785,9 @@ test "y_object_escaped_null_in_key.json" { |
| 787 | 785 | try ok("{\"foo\\u0000bar\": 42}"); |
| 788 | 786 | } |
| 789 | 787 | test "y_object_extreme_numbers.json" { |
| 790 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 791 | ||
| 792 | 788 | try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }"); |
| 793 | 789 | } |
| 794 | 790 | test "y_object_long_strings.json" { |
| 795 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 796 | ||
| 797 | 791 | try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}"); |
| 798 | 792 | } |
| 799 | 793 | test "y_object_simple.json" { |
lib/std/json/dynamic_test.zig-13| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const mem = std.mem; |
| 4 | 3 | const testing = std.testing; |
| 5 | 4 | const ArenaAllocator = std.heap.ArenaAllocator; |
| ... | ... | @@ -19,8 +18,6 @@ const jsonReader = @import("scanner.zig").reader; |
| 19 | 18 | const JsonReader = @import("scanner.zig").Reader; |
| 20 | 19 | |
| 21 | 20 | test "json.parser.dynamic" { |
| 22 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 23 | ||
| 24 | 21 | const s = |
| 25 | 22 | \\{ |
| 26 | 23 | \\ "Image": { |
| ... | ... | @@ -75,8 +72,6 @@ test "json.parser.dynamic" { |
| 75 | 72 | |
| 76 | 73 | const writeStream = @import("./stringify.zig").writeStream; |
| 77 | 74 | test "write json then parse it" { |
| 78 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 79 | ||
| 80 | 75 | var out_buffer: [1000]u8 = undefined; |
| 81 | 76 | |
| 82 | 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 | 138 | } |
| 144 | 139 | |
| 145 | 140 | test "integer after float has proper type" { |
| 146 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 147 | ||
| 148 | 141 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 149 | 142 | defer arena_allocator.deinit(); |
| 150 | 143 | const parsed = try testParse(arena_allocator.allocator(), |
| ... | ... | @@ -157,8 +150,6 @@ test "integer after float has proper type" { |
| 157 | 150 | } |
| 158 | 151 | |
| 159 | 152 | test "escaped characters" { |
| 160 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 161 | ||
| 162 | 153 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 163 | 154 | defer arena_allocator.deinit(); |
| 164 | 155 | const input = |
| ... | ... | @@ -238,8 +229,6 @@ test "Value.jsonStringify" { |
| 238 | 229 | } |
| 239 | 230 | |
| 240 | 231 | test "parseFromValue(std.json.Value,...)" { |
| 241 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 242 | ||
| 243 | 232 | const str = |
| 244 | 233 | \\{ |
| 245 | 234 | \\ "int": 32, |
| ... | ... | @@ -328,8 +317,6 @@ test "ParseOptions.max_value_len" { |
| 328 | 317 | } |
| 329 | 318 | |
| 330 | 319 | test "many object keys" { |
| 331 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 332 | ||
| 333 | 320 | const doc = |
| 334 | 321 | \\{ |
| 335 | 322 | \\ "k1": "v1", |
lib/std/json/hashmap_test.zig-13| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const testing = std.testing; |
| 4 | 3 | |
| 5 | 4 | const ArrayHashMap = @import("hashmap.zig").ArrayHashMap; |
| ... | ... | @@ -19,8 +18,6 @@ const T = struct { |
| 19 | 18 | }; |
| 20 | 19 | |
| 21 | 20 | test "parse json hashmap" { |
| 22 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 23 | ||
| 24 | 21 | const doc = |
| 25 | 22 | \\{ |
| 26 | 23 | \\ "abc": {"i": 0, "s": "d"}, |
| ... | ... | @@ -36,8 +33,6 @@ test "parse json hashmap" { |
| 36 | 33 | } |
| 37 | 34 | |
| 38 | 35 | test "parse json hashmap while streaming" { |
| 39 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 40 | ||
| 41 | 36 | const doc = |
| 42 | 37 | \\{ |
| 43 | 38 | \\ "abc": {"i": 0, "s": "d"}, |
| ... | ... | @@ -63,8 +58,6 @@ test "parse json hashmap while streaming" { |
| 63 | 58 | } |
| 64 | 59 | |
| 65 | 60 | test "parse json hashmap duplicate fields" { |
| 66 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 67 | ||
| 68 | 61 | var arena = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 69 | 62 | defer arena.deinit(); |
| 70 | 63 | |
| ... | ... | @@ -93,8 +86,6 @@ test "parse json hashmap duplicate fields" { |
| 93 | 86 | } |
| 94 | 87 | |
| 95 | 88 | test "stringify json hashmap" { |
| 96 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 97 | ||
| 98 | 89 | var value = ArrayHashMap(T){}; |
| 99 | 90 | defer value.deinit(testing.allocator); |
| 100 | 91 | { |
| ... | ... | @@ -132,8 +123,6 @@ test "stringify json hashmap" { |
| 132 | 123 | } |
| 133 | 124 | |
| 134 | 125 | test "stringify json hashmap whitespace" { |
| 135 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 136 | ||
| 137 | 126 | var value = ArrayHashMap(T){}; |
| 138 | 127 | defer value.deinit(testing.allocator); |
| 139 | 128 | try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" }); |
| ... | ... | @@ -158,8 +147,6 @@ test "stringify json hashmap whitespace" { |
| 158 | 147 | } |
| 159 | 148 | |
| 160 | 149 | test "json parse from value hashmap" { |
| 161 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 162 | ||
| 163 | 150 | const doc = |
| 164 | 151 | \\{ |
| 165 | 152 | \\ "abc": {"i": 0, "s": "d"}, |
lib/std/json/static_test.zig+1-2| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const testing = std.testing; |
| 4 | 3 | const ArenaAllocator = std.heap.ArenaAllocator; |
| 5 | 4 | const Allocator = std.mem.Allocator; |
| ... | ... | @@ -786,7 +785,7 @@ test "max_value_len" { |
| 786 | 785 | } |
| 787 | 786 | |
| 788 | 787 | test "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; | |
| 790 | 789 | |
| 791 | 790 | const T = struct { |
| 792 | 791 | vec_i32: @Vector(4, i32), |
lib/std/json/stringify_test.zig-3| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const mem = std.mem; |
| 4 | 3 | const testing = std.testing; |
| 5 | 4 | |
| ... | ... | @@ -16,8 +15,6 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth; |
| 16 | 15 | const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth; |
| 17 | 16 | |
| 18 | 17 | test "json write stream" { |
| 19 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 20 | ||
| 21 | 18 | var out_buf: [1024]u8 = undefined; |
| 22 | 19 | var slice_stream = std.io.fixedBufferStream(&out_buf); |
| 23 | 20 | const out = slice_stream.writer(); |
lib/std/json/test.zig-2| ... | ... | @@ -34,8 +34,6 @@ fn testHighLevelDynamicParser(s: []const u8) !void { |
| 34 | 34 | |
| 35 | 35 | // Additional tests not part of test JSONTestSuite. |
| 36 | 36 | test "y_trailing_comma_after_empty" { |
| 37 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 38 | ||
| 39 | 37 | try roundTrip( |
| 40 | 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 | 517 | } |
| 518 | 518 | |
| 519 | 519 | test "big.int add multi-multi" { |
| 520 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 521 | ||
| 522 | 520 | var op1: u128 = 0xefefefef7f7f7f7f; |
| 523 | 521 | var op2: u128 = 0xfefefefe9f9f9f9f; |
| 524 | 522 | var a = try Managed.initSet(testing.allocator, op1); |
| ... | ... | @@ -633,8 +631,6 @@ test "big.int subWrap single-single, unsigned" { |
| 633 | 631 | } |
| 634 | 632 | |
| 635 | 633 | test "big.int addWrap multi-multi, unsigned, limb aligned" { |
| 636 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 637 | ||
| 638 | 634 | var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb)); |
| 639 | 635 | defer a.deinit(); |
| 640 | 636 | |
| ... | ... | @@ -687,8 +683,6 @@ test "big.int subWrap single-single, signed" { |
| 687 | 683 | } |
| 688 | 684 | |
| 689 | 685 | test "big.int addWrap multi-multi, signed, limb aligned" { |
| 690 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 691 | ||
| 692 | 686 | var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb)); |
| 693 | 687 | defer a.deinit(); |
| 694 | 688 | |
| ... | ... | @@ -739,8 +733,6 @@ test "big.int subSat single-single, unsigned" { |
| 739 | 733 | } |
| 740 | 734 | |
| 741 | 735 | test "big.int addSat multi-multi, unsigned, limb aligned" { |
| 742 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 743 | ||
| 744 | 736 | var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb)); |
| 745 | 737 | defer a.deinit(); |
| 746 | 738 | |
| ... | ... | @@ -826,8 +818,6 @@ test "big.int sub single-single" { |
| 826 | 818 | } |
| 827 | 819 | |
| 828 | 820 | test "big.int sub multi-single" { |
| 829 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 830 | ||
| 831 | 821 | var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1); |
| 832 | 822 | defer a.deinit(); |
| 833 | 823 | var b = try Managed.initSet(testing.allocator, 1); |
| ... | ... | @@ -841,8 +831,6 @@ test "big.int sub multi-single" { |
| 841 | 831 | } |
| 842 | 832 | |
| 843 | 833 | test "big.int sub multi-multi" { |
| 844 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 845 | ||
| 846 | 834 | var op1: u128 = 0xefefefefefefefefefefefef; |
| 847 | 835 | var op2: u128 = 0xabababababababababababab; |
| 848 | 836 | |
| ... | ... | @@ -927,10 +915,8 @@ test "big.int mul multi-single" { |
| 927 | 915 | } |
| 928 | 916 | |
| 929 | 917 | test "big.int mul multi-multi" { |
| 930 | switch (builtin.zig_backend) { | |
| 931 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 932 | else => {}, | |
| 933 | } | |
| 918 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 919 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 934 | 920 | |
| 935 | 921 | var op1: u256 = 0x998888efefefefefefefef; |
| 936 | 922 | var op2: u256 = 0x333000abababababababab; |
| ... | ... | @@ -1053,10 +1039,8 @@ test "big.int mulWrap single-single signed" { |
| 1053 | 1039 | } |
| 1054 | 1040 | |
| 1055 | 1041 | test "big.int mulWrap multi-multi unsigned" { |
| 1056 | switch (builtin.zig_backend) { | |
| 1057 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1058 | else => {}, | |
| 1059 | } | |
| 1042 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1043 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1060 | 1044 | |
| 1061 | 1045 | var op1: u256 = 0x998888efefefefefefefef; |
| 1062 | 1046 | var op2: u256 = 0x333000abababababababab; |
| ... | ... | @@ -1182,8 +1166,6 @@ test "big.int div single-single with rem" { |
| 1182 | 1166 | } |
| 1183 | 1167 | |
| 1184 | 1168 | test "big.int div multi-single no rem" { |
| 1185 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1186 | ||
| 1187 | 1169 | var op1: u128 = 0xffffeeeeddddcccc; |
| 1188 | 1170 | var op2: u128 = 34; |
| 1189 | 1171 | |
| ... | ... | @@ -1203,8 +1185,6 @@ test "big.int div multi-single no rem" { |
| 1203 | 1185 | } |
| 1204 | 1186 | |
| 1205 | 1187 | test "big.int div multi-single with rem" { |
| 1206 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1207 | ||
| 1208 | 1188 | var op1: u128 = 0xffffeeeeddddcccf; |
| 1209 | 1189 | var op2: u128 = 34; |
| 1210 | 1190 | |
| ... | ... | @@ -1224,8 +1204,6 @@ test "big.int div multi-single with rem" { |
| 1224 | 1204 | } |
| 1225 | 1205 | |
| 1226 | 1206 | test "big.int div multi>2-single" { |
| 1227 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1228 | ||
| 1229 | 1207 | var op1: u128 = 0xfefefefefefefefefefefefefefefefe; |
| 1230 | 1208 | var op2: u128 = 0xefab8; |
| 1231 | 1209 | |
| ... | ... | @@ -1405,8 +1383,6 @@ test "big.int div trunc single-single -/-" { |
| 1405 | 1383 | } |
| 1406 | 1384 | |
| 1407 | 1385 | test "big.int divTrunc #15535" { |
| 1408 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1409 | ||
| 1410 | 1386 | var one = try Managed.initSet(testing.allocator, 1); |
| 1411 | 1387 | defer one.deinit(); |
| 1412 | 1388 | var x = try Managed.initSet(testing.allocator, std.math.pow(u128, 2, 64)); |
| ... | ... | @@ -1420,8 +1396,6 @@ test "big.int divTrunc #15535" { |
| 1420 | 1396 | } |
| 1421 | 1397 | |
| 1422 | 1398 | test "big.int divFloor #10932" { |
| 1423 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1424 | ||
| 1425 | 1399 | var a = try Managed.init(testing.allocator); |
| 1426 | 1400 | defer a.deinit(); |
| 1427 | 1401 | |
| ... | ... | @@ -1446,8 +1420,6 @@ test "big.int divFloor #10932" { |
| 1446 | 1420 | } |
| 1447 | 1421 | |
| 1448 | 1422 | test "big.int divFloor #11166" { |
| 1449 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1450 | ||
| 1451 | 1423 | var a = try Managed.init(testing.allocator); |
| 1452 | 1424 | defer a.deinit(); |
| 1453 | 1425 | |
| ... | ... | @@ -1475,8 +1447,6 @@ test "big.int divFloor #11166" { |
| 1475 | 1447 | } |
| 1476 | 1448 | |
| 1477 | 1449 | test "big.int gcd #10932" { |
| 1478 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1479 | ||
| 1480 | 1450 | var a = try Managed.init(testing.allocator); |
| 1481 | 1451 | defer a.deinit(); |
| 1482 | 1452 | |
| ... | ... | @@ -1668,10 +1638,7 @@ test "big.int div floor positive close to zero" { |
| 1668 | 1638 | } |
| 1669 | 1639 | |
| 1670 | 1640 | test "big.int div multi-multi with rem" { |
| 1671 | switch (builtin.zig_backend) { | |
| 1672 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1673 | else => {}, | |
| 1674 | } | |
| 1641 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1675 | 1642 | |
| 1676 | 1643 | var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeeddddccccbbbbaaaa9999); |
| 1677 | 1644 | defer a.deinit(); |
| ... | ... | @@ -1689,10 +1656,7 @@ test "big.int div multi-multi with rem" { |
| 1689 | 1656 | } |
| 1690 | 1657 | |
| 1691 | 1658 | test "big.int div multi-multi no rem" { |
| 1692 | switch (builtin.zig_backend) { | |
| 1693 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1694 | else => {}, | |
| 1695 | } | |
| 1659 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1696 | 1660 | |
| 1697 | 1661 | var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeedb4fec200ee3a4286361); |
| 1698 | 1662 | defer a.deinit(); |
| ... | ... | @@ -1728,10 +1692,8 @@ test "big.int div multi-multi (2 branch)" { |
| 1728 | 1692 | } |
| 1729 | 1693 | |
| 1730 | 1694 | test "big.int div multi-multi (3.1/3.3 branch)" { |
| 1731 | switch (builtin.zig_backend) { | |
| 1732 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1733 | else => {}, | |
| 1734 | } | |
| 1695 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1696 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1735 | 1697 | |
| 1736 | 1698 | var a = try Managed.initSet(testing.allocator, 0x11111111111111111111111111111111111111111111111111111111111111); |
| 1737 | 1699 | defer a.deinit(); |
| ... | ... | @@ -1790,10 +1752,7 @@ test "big.int div multi-multi zero-limb trailing (with rem)" { |
| 1790 | 1752 | } |
| 1791 | 1753 | |
| 1792 | 1754 | test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count > divisor zero-limb count" { |
| 1793 | switch (builtin.zig_backend) { | |
| 1794 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1795 | else => {}, | |
| 1796 | } | |
| 1755 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1797 | 1756 | |
| 1798 | 1757 | var a = try Managed.initSet(testing.allocator, 0x8666666655555555888888877777777611111111111111110000000000000000); |
| 1799 | 1758 | defer a.deinit(); |
| ... | ... | @@ -1814,10 +1773,7 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li |
| 1814 | 1773 | } |
| 1815 | 1774 | |
| 1816 | 1775 | test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count < divisor zero-limb count" { |
| 1817 | switch (builtin.zig_backend) { | |
| 1818 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1819 | else => {}, | |
| 1820 | } | |
| 1776 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1821 | 1777 | |
| 1822 | 1778 | var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000); |
| 1823 | 1779 | defer a.deinit(); |
| ... | ... | @@ -1840,8 +1796,6 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li |
| 1840 | 1796 | } |
| 1841 | 1797 | |
| 1842 | 1798 | test "big.int div multi-multi fuzz case #1" { |
| 1843 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1844 | ||
| 1845 | 1799 | var a = try Managed.init(testing.allocator); |
| 1846 | 1800 | defer a.deinit(); |
| 1847 | 1801 | var b = try Managed.init(testing.allocator); |
| ... | ... | @@ -1938,8 +1892,6 @@ test "big.int truncate multi to multi unsigned" { |
| 1938 | 1892 | } |
| 1939 | 1893 | |
| 1940 | 1894 | test "big.int truncate multi to multi signed" { |
| 1941 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1942 | ||
| 1943 | 1895 | var a = try Managed.initSet(testing.allocator, 3 << @bitSizeOf(Limb)); |
| 1944 | 1896 | defer a.deinit(); |
| 1945 | 1897 | |
| ... | ... | @@ -1949,8 +1901,6 @@ test "big.int truncate multi to multi signed" { |
| 1949 | 1901 | } |
| 1950 | 1902 | |
| 1951 | 1903 | test "big.int truncate negative multi to single" { |
| 1952 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1953 | ||
| 1954 | 1904 | var a = try Managed.initSet(testing.allocator, -@as(SignedDoubleLimb, maxInt(Limb) + 1)); |
| 1955 | 1905 | defer a.deinit(); |
| 1956 | 1906 | |
| ... | ... | @@ -2057,8 +2007,6 @@ test "big.int shift-right multi" { |
| 2057 | 2007 | } |
| 2058 | 2008 | |
| 2059 | 2009 | test "big.int shift-left single" { |
| 2060 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2061 | ||
| 2062 | 2010 | var a = try Managed.initSet(testing.allocator, 0xffff); |
| 2063 | 2011 | defer a.deinit(); |
| 2064 | 2012 | try a.shiftLeft(&a, 16); |
| ... | ... | @@ -2103,8 +2051,6 @@ test "big.int sat shift-left simple unsigned" { |
| 2103 | 2051 | } |
| 2104 | 2052 | |
| 2105 | 2053 | test "big.int sat shift-left simple unsigned no sat" { |
| 2106 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2107 | ||
| 2108 | 2054 | var a = try Managed.initSet(testing.allocator, 1); |
| 2109 | 2055 | defer a.deinit(); |
| 2110 | 2056 | try a.shiftLeftSat(&a, 16, .unsigned, 21); |
| ... | ... | @@ -2362,8 +2308,6 @@ test "big.int bitwise xor simple" { |
| 2362 | 2308 | } |
| 2363 | 2309 | |
| 2364 | 2310 | test "big.int bitwise xor multi-limb" { |
| 2365 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2366 | ||
| 2367 | 2311 | var x: DoubleLimb = maxInt(Limb) + 1; |
| 2368 | 2312 | var y: DoubleLimb = maxInt(Limb); |
| 2369 | 2313 | var a = try Managed.initSet(testing.allocator, x); |
| ... | ... | @@ -2538,8 +2482,6 @@ test "big.int var args" { |
| 2538 | 2482 | } |
| 2539 | 2483 | |
| 2540 | 2484 | test "big.int gcd non-one small" { |
| 2541 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2542 | ||
| 2543 | 2485 | var a = try Managed.initSet(testing.allocator, 17); |
| 2544 | 2486 | defer a.deinit(); |
| 2545 | 2487 | var b = try Managed.initSet(testing.allocator, 97); |
| ... | ... | @@ -2553,8 +2495,6 @@ test "big.int gcd non-one small" { |
| 2553 | 2495 | } |
| 2554 | 2496 | |
| 2555 | 2497 | test "big.int gcd non-one medium" { |
| 2556 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2557 | ||
| 2558 | 2498 | var a = try Managed.initSet(testing.allocator, 4864); |
| 2559 | 2499 | defer a.deinit(); |
| 2560 | 2500 | var b = try Managed.initSet(testing.allocator, 3458); |
| ... | ... | @@ -2568,8 +2508,6 @@ test "big.int gcd non-one medium" { |
| 2568 | 2508 | } |
| 2569 | 2509 | |
| 2570 | 2510 | test "big.int gcd non-one large" { |
| 2571 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2572 | ||
| 2573 | 2511 | var a = try Managed.initSet(testing.allocator, 0xffffffffffffffff); |
| 2574 | 2512 | defer a.deinit(); |
| 2575 | 2513 | var b = try Managed.initSet(testing.allocator, 0xffffffffffffffff7777); |
| ... | ... | @@ -2583,10 +2521,8 @@ test "big.int gcd non-one large" { |
| 2583 | 2521 | } |
| 2584 | 2522 | |
| 2585 | 2523 | test "big.int gcd large multi-limb result" { |
| 2586 | switch (builtin.zig_backend) { | |
| 2587 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 2588 | else => {}, | |
| 2589 | } | |
| 2524 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 2525 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2590 | 2526 | |
| 2591 | 2527 | var a = try Managed.initSet(testing.allocator, 0x12345678123456781234567812345678123456781234567812345678); |
| 2592 | 2528 | defer a.deinit(); |
| ... | ... | @@ -2602,8 +2538,6 @@ test "big.int gcd large multi-limb result" { |
| 2602 | 2538 | } |
| 2603 | 2539 | |
| 2604 | 2540 | test "big.int gcd one large" { |
| 2605 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2606 | ||
| 2607 | 2541 | var a = try Managed.initSet(testing.allocator, 1897056385327307); |
| 2608 | 2542 | defer a.deinit(); |
| 2609 | 2543 | var b = try Managed.initSet(testing.allocator, 2251799813685248); |
| ... | ... | @@ -2695,8 +2629,6 @@ test "big.int pow" { |
| 2695 | 2629 | } |
| 2696 | 2630 | |
| 2697 | 2631 | test "big.int sqrt" { |
| 2698 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2699 | ||
| 2700 | 2632 | var r = try Managed.init(testing.allocator); |
| 2701 | 2633 | defer r.deinit(); |
| 2702 | 2634 | var a = try Managed.init(testing.allocator); |
| ... | ... | @@ -2727,8 +2659,6 @@ test "big.int sqrt" { |
| 2727 | 2659 | } |
| 2728 | 2660 | |
| 2729 | 2661 | test "big.int regression test for 1 limb overflow with alias" { |
| 2730 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2731 | ||
| 2732 | 2662 | // Note these happen to be two consecutive Fibonacci sequence numbers, the |
| 2733 | 2663 | // first two whose sum exceeds 2**64. |
| 2734 | 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 | 2673 | } |
| 2744 | 2674 | |
| 2745 | 2675 | test "big.int regression test for realloc with alias" { |
| 2746 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2747 | ||
| 2748 | 2676 | // Note these happen to be two consecutive Fibonacci sequence numbers, the |
| 2749 | 2677 | // second of which is the first such number to exceed 2**192. |
| 2750 | 2678 | var a = try Managed.initSet(testing.allocator, 5611500259351924431073312796924978741056961814867751431689); |
| ... | ... | @@ -2759,8 +2687,6 @@ test "big.int regression test for realloc with alias" { |
| 2759 | 2687 | } |
| 2760 | 2688 | |
| 2761 | 2689 | test "big int popcount" { |
| 2762 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2763 | ||
| 2764 | 2690 | var a = try Managed.init(testing.allocator); |
| 2765 | 2691 | defer a.deinit(); |
| 2766 | 2692 | |
| ... | ... | @@ -3126,8 +3052,6 @@ fn byteSwapTest(comptime T: type, comptime input: comptime_int, comptime expecte |
| 3126 | 3052 | } |
| 3127 | 3053 | |
| 3128 | 3054 | test "big int byte swap" { |
| 3129 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 3130 | ||
| 3131 | 3055 | var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff); |
| 3132 | 3056 | defer a.deinit(); |
| 3133 | 3057 | |
| ... | ... | @@ -3172,8 +3096,6 @@ test "big int byte swap" { |
| 3172 | 3096 | } |
| 3173 | 3097 | |
| 3174 | 3098 | test "big.int mul multi-multi alias r with a and b" { |
| 3175 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 3176 | ||
| 3177 | 3099 | var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb)); |
| 3178 | 3100 | defer a.deinit(); |
| 3179 | 3101 | |
| ... | ... | @@ -3190,8 +3112,6 @@ test "big.int mul multi-multi alias r with a and b" { |
| 3190 | 3112 | } |
| 3191 | 3113 | |
| 3192 | 3114 | test "big.int sqr multi alias r with a" { |
| 3193 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 3194 | ||
| 3195 | 3115 | var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb)); |
| 3196 | 3116 | defer a.deinit(); |
| 3197 | 3117 |
lib/std/math/big/rational.zig-28| ... | ... | @@ -514,8 +514,6 @@ test "big.rational extractLowBits" { |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | test "big.rational set" { |
| 517 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 518 | ||
| 519 | 517 | var a = try Rational.init(testing.allocator); |
| 520 | 518 | defer a.deinit(); |
| 521 | 519 | |
| ... | ... | @@ -545,8 +543,6 @@ test "big.rational set" { |
| 545 | 543 | } |
| 546 | 544 | |
| 547 | 545 | test "big.rational setFloat" { |
| 548 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 549 | ||
| 550 | 546 | var a = try Rational.init(testing.allocator); |
| 551 | 547 | defer a.deinit(); |
| 552 | 548 | |
| ... | ... | @@ -572,8 +568,6 @@ test "big.rational setFloat" { |
| 572 | 568 | } |
| 573 | 569 | |
| 574 | 570 | test "big.rational setFloatString" { |
| 575 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 576 | ||
| 577 | 571 | var a = try Rational.init(testing.allocator); |
| 578 | 572 | defer a.deinit(); |
| 579 | 573 | |
| ... | ... | @@ -585,8 +579,6 @@ test "big.rational setFloatString" { |
| 585 | 579 | } |
| 586 | 580 | |
| 587 | 581 | test "big.rational toFloat" { |
| 588 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 589 | ||
| 590 | 582 | var a = try Rational.init(testing.allocator); |
| 591 | 583 | defer a.deinit(); |
| 592 | 584 | |
| ... | ... | @@ -600,8 +592,6 @@ test "big.rational toFloat" { |
| 600 | 592 | } |
| 601 | 593 | |
| 602 | 594 | test "big.rational set/to Float round-trip" { |
| 603 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 604 | ||
| 605 | 595 | var a = try Rational.init(testing.allocator); |
| 606 | 596 | defer a.deinit(); |
| 607 | 597 | var prng = std.rand.DefaultPrng.init(0x5EED); |
| ... | ... | @@ -615,8 +605,6 @@ test "big.rational set/to Float round-trip" { |
| 615 | 605 | } |
| 616 | 606 | |
| 617 | 607 | test "big.rational copy" { |
| 618 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 619 | ||
| 620 | 608 | var a = try Rational.init(testing.allocator); |
| 621 | 609 | defer a.deinit(); |
| 622 | 610 | |
| ... | ... | @@ -681,8 +669,6 @@ test "big.rational abs" { |
| 681 | 669 | } |
| 682 | 670 | |
| 683 | 671 | test "big.rational swap" { |
| 684 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 685 | ||
| 686 | 672 | var a = try Rational.init(testing.allocator); |
| 687 | 673 | defer a.deinit(); |
| 688 | 674 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -707,8 +693,6 @@ test "big.rational swap" { |
| 707 | 693 | } |
| 708 | 694 | |
| 709 | 695 | test "big.rational order" { |
| 710 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 711 | ||
| 712 | 696 | var a = try Rational.init(testing.allocator); |
| 713 | 697 | defer a.deinit(); |
| 714 | 698 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -724,8 +708,6 @@ test "big.rational order" { |
| 724 | 708 | } |
| 725 | 709 | |
| 726 | 710 | test "big.rational order/orderAbs with negative" { |
| 727 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 728 | ||
| 729 | 711 | var a = try Rational.init(testing.allocator); |
| 730 | 712 | defer a.deinit(); |
| 731 | 713 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -738,8 +720,6 @@ test "big.rational order/orderAbs with negative" { |
| 738 | 720 | } |
| 739 | 721 | |
| 740 | 722 | test "big.rational add single-limb" { |
| 741 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 742 | ||
| 743 | 723 | var a = try Rational.init(testing.allocator); |
| 744 | 724 | defer a.deinit(); |
| 745 | 725 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -755,8 +735,6 @@ test "big.rational add single-limb" { |
| 755 | 735 | } |
| 756 | 736 | |
| 757 | 737 | test "big.rational add" { |
| 758 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 759 | ||
| 760 | 738 | var a = try Rational.init(testing.allocator); |
| 761 | 739 | defer a.deinit(); |
| 762 | 740 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -773,8 +751,6 @@ test "big.rational add" { |
| 773 | 751 | } |
| 774 | 752 | |
| 775 | 753 | test "big.rational sub" { |
| 776 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 777 | ||
| 778 | 754 | var a = try Rational.init(testing.allocator); |
| 779 | 755 | defer a.deinit(); |
| 780 | 756 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -791,8 +767,6 @@ test "big.rational sub" { |
| 791 | 767 | } |
| 792 | 768 | |
| 793 | 769 | test "big.rational mul" { |
| 794 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 795 | ||
| 796 | 770 | var a = try Rational.init(testing.allocator); |
| 797 | 771 | defer a.deinit(); |
| 798 | 772 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -809,8 +783,6 @@ test "big.rational mul" { |
| 809 | 783 | } |
| 810 | 784 | |
| 811 | 785 | test "big.rational div" { |
| 812 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 813 | ||
| 814 | 786 | { |
| 815 | 787 | var a = try Rational.init(testing.allocator); |
| 816 | 788 | defer a.deinit(); |
lib/std/math/ilogb.zig+1-2| ... | ... | @@ -6,7 +6,6 @@ |
| 6 | 6 | // https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c |
| 7 | 7 | |
| 8 | 8 | const std = @import("../std.zig"); |
| 9 | const builtin = @import("builtin"); | |
| 10 | 9 | const math = std.math; |
| 11 | 10 | const expect = std.testing.expect; |
| 12 | 11 | const maxInt = std.math.maxInt; |
| ... | ... | @@ -109,7 +108,7 @@ test "64" { |
| 109 | 108 | } |
| 110 | 109 | |
| 111 | 110 | test "80" { |
| 112 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 111 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 113 | 112 | |
| 114 | 113 | try expect(ilogbX(f80, 0.0) == fp_ilogb0); |
| 115 | 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 | 1025 | } |
| 1026 | 1026 | |
| 1027 | 1027 | test "indexOfSentinel vector paths" { |
| 1028 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1029 | ||
| 1030 | 1028 | const Types = [_]type{ u8, u16, u32, u64 }; |
| 1031 | 1029 | const allocator = std.testing.allocator; |
| 1032 | 1030 | |
| ... | ... | @@ -4661,10 +4659,8 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice |
| 4661 | 4659 | } |
| 4662 | 4660 | |
| 4663 | 4661 | test "read/write(Var)PackedInt" { |
| 4664 | switch (builtin.zig_backend) { | |
| 4665 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 4666 | else => {}, | |
| 4667 | } | |
| 4662 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 4663 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 4668 | 4664 | |
| 4669 | 4665 | switch (builtin.cpu.arch) { |
| 4670 | 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 | 107 | } |
| 108 | 108 | |
| 109 | 109 | test "resolve DNS" { |
| 110 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 111 | 110 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 112 | 111 | |
| 113 | 112 | if (builtin.os.tag == .windows) { |
lib/std/os/linux/io_uring.zig-4| ... | ... | @@ -2212,8 +2212,6 @@ test "sendmsg/recvmsg" { |
| 2212 | 2212 | test "timeout (after a relative time)" { |
| 2213 | 2213 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2214 | 2214 | |
| 2215 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2216 | ||
| 2217 | 2215 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2218 | 2216 | error.SystemOutdated => return error.SkipZigTest, |
| 2219 | 2217 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2278,8 +2276,6 @@ test "timeout (after a number of completions)" { |
| 2278 | 2276 | test "timeout_remove" { |
| 2279 | 2277 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2280 | 2278 | |
| 2281 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2282 | ||
| 2283 | 2279 | var ring = IO_Uring.init(2, 0) catch |err| switch (err) { |
| 2284 | 2280 | error.SystemOutdated => return error.SkipZigTest, |
| 2285 | 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 | 90 | } |
| 91 | 91 | |
| 92 | 92 | test "xoroshiro sequence" { |
| 93 | switch (@import("builtin").zig_backend) { | |
| 94 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 95 | else => {}, | |
| 96 | } | |
| 93 | if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest; | |
| 94 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 97 | 95 | |
| 98 | 96 | var r = Xoshiro256.init(0); |
| 99 | 97 |
lib/std/simd.zig+1-1| ... | ... | @@ -436,7 +436,7 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | test "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; | |
| 440 | 440 | |
| 441 | 441 | if (comptime builtin.cpu.arch.isMIPS()) { |
| 442 | 442 | return error.SkipZigTest; |
lib/std/time.zig-2| ... | ... | @@ -122,8 +122,6 @@ pub fn nanoTimestamp() i128 { |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | test "timestamp" { |
| 125 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 126 | ||
| 127 | 125 | const margin = ns_per_ms * 50; |
| 128 | 126 | |
| 129 | 127 | const time_0 = milliTimestamp(); |
lib/std/treap.zig-2| ... | ... | @@ -350,8 +350,6 @@ const TestTreap = Treap(u64, std.math.order); |
| 350 | 350 | const TestNode = TestTreap.Node; |
| 351 | 351 | |
| 352 | 352 | test "std.Treap: insert, find, replace, remove" { |
| 353 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 354 | ||
| 355 | 353 | var treap = TestTreap{}; |
| 356 | 354 | var nodes: [10]TestNode = undefined; |
| 357 | 355 |
lib/std/zig/Parse.zig-2| ... | ... | @@ -4102,7 +4102,5 @@ const TokenIndex = Ast.TokenIndex; |
| 4102 | 4102 | const Token = std.zig.Token; |
| 4103 | 4103 | |
| 4104 | 4104 | test { |
| 4105 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 4106 | ||
| 4107 | 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 | 2293 | } |
| 2294 | 2294 | } |
| 2295 | 2295 | |
| 2296 | fn getValue(self: *Self, value: MCValue, inst: ?Air.Inst.Index) void { | |
| 2296 | fn getValue(self: *Self, value: MCValue, inst: ?Air.Inst.Index) !void { | |
| 2297 | for (value.getRegs()) |reg| try self.register_manager.getReg(reg, inst); | |
| 2298 | } | |
| 2299 | ||
| 2300 | fn getValueIfFree(self: *Self, value: MCValue, inst: ?Air.Inst.Index) void { | |
| 2297 | 2301 | for (value.getRegs()) |reg| if (self.register_manager.isRegFree(reg)) |
| 2298 | 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 | 2345 | // In some cases, an operand may be reused as the result. |
| 2342 | 2346 | // If that operand died and was a register, it was freed by |
| 2343 | 2347 | // processDeath, so we have to "re-allocate" the register. |
| 2344 | self.getValue(result, inst); | |
| 2348 | self.getValueIfFree(result, inst); | |
| 2345 | 2349 | } |
| 2346 | 2350 | self.finishAirBookkeeping(); |
| 2347 | 2351 | } |
| ... | ... | @@ -3221,6 +3225,7 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void { |
| 3221 | 3225 | .Float, .Vector => break :result try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs), |
| 3222 | 3226 | else => {}, |
| 3223 | 3227 | } |
| 3228 | const dst_abi_size: u32 = @intCast(dst_ty.abiSize(mod)); | |
| 3224 | 3229 | |
| 3225 | 3230 | const dst_info = dst_ty.intInfo(mod); |
| 3226 | 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 | 3237 | ), |
| 3233 | 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 | }; | |
| 3235 | 3381 | |
| 3236 | 3382 | try self.spillEflagsIfOccupied(); |
| 3237 | 3383 | try self.spillRegisters(&.{ .rax, .rdx }); |
| 3238 | const lhs = try self.resolveInst(bin_op.lhs); | |
| 3239 | const rhs = try self.resolveInst(bin_op.rhs); | |
| 3240 | break :result try self.genMulDivBinOp(tag, inst, dst_ty, src_ty, lhs, rhs); | |
| 3384 | const lhs_mcv = try self.resolveInst(bin_op.lhs); | |
| 3385 | const rhs_mcv = try self.resolveInst(bin_op.rhs); | |
| 3386 | break :result try self.genMulDivBinOp(tag, inst, dst_ty, src_ty, lhs_mcv, rhs_mcv); | |
| 3241 | 3387 | }; |
| 3242 | 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 | 4740 | |
| 4595 | 4741 | // TODO we could allocate register here, but need to expect addr register and potentially |
| 4596 | 4742 | // offset register. |
| 4743 | try self.spillEflagsIfOccupied(); | |
| 4597 | 4744 | const dst_mcv = try self.allocRegOrMem(inst, false); |
| 4598 | 4745 | try self.genBinOpMir( |
| 4599 | 4746 | .{ ._, .add }, |
| ... | ... | @@ -7201,37 +7348,7 @@ fn genMulDivBinOp( |
| 7201 | 7348 | assert(self.eflags_inst == null); |
| 7202 | 7349 | |
| 7203 | 7350 | if (dst_abi_size == 16 and src_abi_size == 16) { |
| 7204 | switch (tag) { | |
| 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 | ||
| 7351 | assert(tag == .mul or tag == .mul_wrap); | |
| 7235 | 7352 | const reg_locks = self.register_manager.lockRegsAssumeUnused(2, .{ .rax, .rdx }); |
| 7236 | 7353 | defer for (reg_locks) |lock| self.register_manager.unlockReg(lock); |
| 7237 | 7354 | |
| ... | ... | @@ -9436,6 +9553,7 @@ fn genBinOpMir( |
| 9436 | 9553 | fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError!void { |
| 9437 | 9554 | const mod = self.bin_file.options.module.?; |
| 9438 | 9555 | const abi_size: u32 = @intCast(dst_ty.abiSize(mod)); |
| 9556 | try self.spillEflagsIfOccupied(); | |
| 9439 | 9557 | switch (dst_mcv) { |
| 9440 | 9558 | .none, |
| 9441 | 9559 | .unreach, |
| ... | ... | @@ -10509,8 +10627,6 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 10509 | 10627 | const else_body = self.air.extra[extra.end + then_body.len ..][0..extra.data.else_body_len]; |
| 10510 | 10628 | const liveness_cond_br = self.liveness.getCondBr(inst); |
| 10511 | 10629 | |
| 10512 | const reloc = try self.genCondBrMir(cond_ty, cond); | |
| 10513 | ||
| 10514 | 10630 | // If the condition dies here in this condbr instruction, process |
| 10515 | 10631 | // that death now instead of later as this has an effect on |
| 10516 | 10632 | // whether it needs to be spilled in the branches |
| ... | ... | @@ -10520,6 +10636,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 10520 | 10636 | |
| 10521 | 10637 | self.scope_generation += 1; |
| 10522 | 10638 | const state = try self.saveState(); |
| 10639 | const reloc = try self.genCondBrMir(cond_ty, cond); | |
| 10523 | 10640 | |
| 10524 | 10641 | for (liveness_cond_br.then_deaths) |death| try self.processDeath(death); |
| 10525 | 10642 | try self.genBody(then_body); |
| ... | ... | @@ -10905,7 +11022,7 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void { |
| 10905 | 11022 | if (std.debug.runtime_safety) assert(self.inst_tracking.getIndex(inst).? == inst_tracking_i); |
| 10906 | 11023 | const tracking = &self.inst_tracking.values()[inst_tracking_i]; |
| 10907 | 11024 | if (self.liveness.isUnused(inst)) try tracking.die(self, inst); |
| 10908 | self.getValue(tracking.short, inst); | |
| 11025 | self.getValueIfFree(tracking.short, inst); | |
| 10909 | 11026 | self.finishAirBookkeeping(); |
| 10910 | 11027 | } |
| 10911 | 11028 | |
| ... | ... | @@ -11019,7 +11136,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void { |
| 11019 | 11136 | } |
| 11020 | 11137 | |
| 11021 | 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 | 11140 | break :dst block_tracking.short; |
| 11024 | 11141 | }; |
| 11025 | 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 | 13365 | defer self.register_manager.unlockReg(len_lock); |
| 13249 | 13366 | |
| 13250 | 13367 | try self.genSetReg(len_reg, Type.usize, len); |
| 13368 | try self.asmRegisterRegister(.{ ._, .@"test" }, len_reg, len_reg); | |
| 13251 | 13369 | |
| 13252 | 13370 | const skip_reloc = try self.asmJccReloc(.z, undefined); |
| 13253 | 13371 | try self.store(slice_ptr_ty, ptr, src_val); |
| ... | ... | @@ -14768,6 +14886,7 @@ fn truncateRegister(self: *Self, ty: Type, reg: Register) !void { |
| 14768 | 14886 | .bits = @intCast(ty.bitSize(mod)), |
| 14769 | 14887 | }; |
| 14770 | 14888 | const max_reg_bit_width = Register.rax.bitSize(); |
| 14889 | try self.spillEflagsIfOccupied(); | |
| 14771 | 14890 | switch (int_info.signedness) { |
| 14772 | 14891 | .signed => { |
| 14773 | 14892 | const shift: u6 = @intCast(max_reg_bit_width - int_info.bits); |
src/main.zig+59-7| ... | ... | @@ -3774,7 +3774,9 @@ fn serve( |
| 3774 | 3774 | try comp.makeBinFileWritable(); |
| 3775 | 3775 | } |
| 3776 | 3776 | |
| 3777 | { | |
| 3777 | if (builtin.single_threaded) { | |
| 3778 | try comp.update(main_progress_node); | |
| 3779 | } else { | |
| 3778 | 3780 | var reset: std.Thread.ResetEvent = .{}; |
| 3779 | 3781 | |
| 3780 | 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 | 4922 | var child_argv = std.ArrayList([]const u8).init(arena); |
| 4921 | 4923 | var reference_trace: ?u32 = null; |
| 4922 | 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 | 4936 | var fetch_only = false; |
| 4924 | 4937 | |
| 4925 | 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 | 4969 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| 4957 | 4970 | i += 1; |
| 4958 | 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 | 4973 | continue; |
| 4961 | 4974 | } else if (mem.eql(u8, arg, "--build-runner")) { |
| 4962 | 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 | 4987 | override_global_cache_dir = args[i]; |
| 4975 | 4988 | continue; |
| 4976 | 4989 | } else if (mem.eql(u8, arg, "-freference-trace")) { |
| 4977 | try child_argv.append(arg); | |
| 4978 | 4990 | reference_trace = 256; |
| 4979 | 4991 | } else if (mem.eql(u8, arg, "--fetch")) { |
| 4980 | 4992 | fetch_only = true; |
| 4981 | 4993 | } else if (mem.startsWith(u8, arg, "-freference-trace=")) { |
| 4982 | try child_argv.append(arg); | |
| 4983 | 4994 | const num = arg["-freference-trace=".len..]; |
| 4984 | 4995 | reference_trace = std.fmt.parseUnsigned(u32, num, 10) catch |err| { |
| 4985 | 4996 | fatal("unable to parse reference_trace count '{s}': {s}", .{ num, @errorName(err) }); |
| 4986 | 4997 | }; |
| 4987 | 4998 | } else if (mem.eql(u8, arg, "-fno-reference-trace")) { |
| 4988 | try child_argv.append(arg); | |
| 4989 | 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 | 5010 | } else if (mem.eql(u8, arg, "--debug-compile-errors")) { |
| 4991 | try child_argv.append(arg); | |
| 4992 | debug_compile_errors = true; | |
| 5011 | if (!crash_report.is_enabled) { | |
| 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 | 5036 | } else if (mem.eql(u8, arg, "--seed")) { |
| 4994 | 5037 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| 4995 | 5038 | i += 1; |
| ... | ... | @@ -5264,6 +5307,15 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi |
| 5264 | 5307 | .optimize_mode = .Debug, |
| 5265 | 5308 | .self_exe_path = self_exe_path, |
| 5266 | 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 | 5319 | .cache_mode = .whole, |
| 5268 | 5320 | .reference_trace = reference_trace, |
| 5269 | 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 | 282 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 283 | 283 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 284 | 284 | 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; | |
| 286 | 286 | |
| 287 | 287 | var x: @Vector(2, u32) = .{ 1_000_000, 12345 }; |
| 288 | 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 | 73 | #define ZIG_NO_RAW_F16 |
| 74 | 74 | #endif |
| 75 | 75 | |
| 76 | #ifdef ZIG_BACKEND_STAGE2_X86_64 | |
| 77 | #define ZIG_NO_COMPLEX | |
| 78 | #endif | |
| 79 | ||
| 76 | 80 | #ifdef __i386__ |
| 77 | 81 | #define ZIG_NO_RAW_F16 |
| 78 | 82 | #endif |
| ... | ... | @@ -274,7 +278,7 @@ void run_c_tests(void) { |
| 274 | 278 | zig_u32(0xfffffffd); |
| 275 | 279 | zig_u64(0xfffffffffffffffc); |
| 276 | 280 | |
| 277 | #ifndef ZIG_NO_I128 | |
| 281 | #if !defined ZIG_NO_I128 && !defined ZIG_BACKEND_STAGE2_X86_64 | |
| 278 | 282 | { |
| 279 | 283 | struct u128 s = {0xfffffffffffffffc}; |
| 280 | 284 | zig_struct_u128(s); |
| ... | ... | @@ -288,7 +292,7 @@ void run_c_tests(void) { |
| 288 | 292 | zig_i32(-3); |
| 289 | 293 | zig_i64(-4); |
| 290 | 294 | |
| 291 | #ifndef ZIG_NO_I128 | |
| 295 | #if !defined ZIG_NO_I128 && !defined ZIG_BACKEND_STAGE2_X86_64 | |
| 292 | 296 | { |
| 293 | 297 | struct i128 s = {-6}; |
| 294 | 298 | zig_struct_i128(s); |
| ... | ... | @@ -429,7 +433,7 @@ void run_c_tests(void) { |
| 429 | 433 | } |
| 430 | 434 | #endif |
| 431 | 435 | |
| 432 | #if !defined __mips__ && !defined ZIG_PPC32 | |
| 436 | #if !defined __mips__ && !defined ZIG_PPC32 && !defined ZIG_BACKEND_STAGE2_X86_64 | |
| 433 | 437 | { |
| 434 | 438 | struct FloatRect r1 = {1, 21, 16, 4}; |
| 435 | 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 | 49 | } |
| 50 | 50 | |
| 51 | 51 | test "C ABI integers" { |
| 52 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 53 | ||
| 52 | 54 | c_u8(0xff); |
| 53 | 55 | c_u16(0xfffe); |
| 54 | 56 | c_u32(0xfffffffd); |
| ... | ... | @@ -185,6 +187,8 @@ const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.is |
| 185 | 187 | !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV(); |
| 186 | 188 | |
| 187 | 189 | test "C ABI complex float" { |
| 190 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 191 | ||
| 188 | 192 | if (!complex_abi_compatible) return error.SkipZigTest; |
| 189 | 193 | if (builtin.cpu.arch == .x86_64) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/8465 |
| 190 | 194 | |
| ... | ... | @@ -197,6 +201,8 @@ test "C ABI complex float" { |
| 197 | 201 | } |
| 198 | 202 | |
| 199 | 203 | test "C ABI complex float by component" { |
| 204 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 205 | ||
| 200 | 206 | if (!complex_abi_compatible) return error.SkipZigTest; |
| 201 | 207 | |
| 202 | 208 | const a = ComplexFloat{ .real = 1.25, .imag = 2.6 }; |
| ... | ... | @@ -208,6 +214,8 @@ test "C ABI complex float by component" { |
| 208 | 214 | } |
| 209 | 215 | |
| 210 | 216 | test "C ABI complex double" { |
| 217 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 218 | ||
| 211 | 219 | if (!complex_abi_compatible) return error.SkipZigTest; |
| 212 | 220 | |
| 213 | 221 | const a = ComplexDouble{ .real = 1.25, .imag = 2.6 }; |
| ... | ... | @@ -219,6 +227,8 @@ test "C ABI complex double" { |
| 219 | 227 | } |
| 220 | 228 | |
| 221 | 229 | test "C ABI complex double by component" { |
| 230 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 231 | ||
| 222 | 232 | if (!complex_abi_compatible) return error.SkipZigTest; |
| 223 | 233 | |
| 224 | 234 | const a = ComplexDouble{ .real = 1.25, .imag = 2.6 }; |
| ... | ... | @@ -230,6 +240,8 @@ test "C ABI complex double by component" { |
| 230 | 240 | } |
| 231 | 241 | |
| 232 | 242 | export fn zig_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat { |
| 243 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 244 | ||
| 233 | 245 | expect(a.real == 1.25) catch @panic("test failure: zig_cmultf 1"); |
| 234 | 246 | expect(a.imag == 2.6) catch @panic("test failure: zig_cmultf 2"); |
| 235 | 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 | 251 | } |
| 240 | 252 | |
| 241 | 253 | export fn zig_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble { |
| 254 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 255 | ||
| 242 | 256 | expect(a.real == 1.25) catch @panic("test failure: zig_cmultd 1"); |
| 243 | 257 | expect(a.imag == 2.6) catch @panic("test failure: zig_cmultd 2"); |
| 244 | 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 | 262 | } |
| 249 | 263 | |
| 250 | 264 | export 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 | 267 | expect(a_r == 1.25) catch @panic("test failure: zig_cmultf_comp 1"); |
| 252 | 268 | expect(a_i == 2.6) catch @panic("test failure: zig_cmultf_comp 2"); |
| 253 | 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 | 273 | } |
| 258 | 274 | |
| 259 | 275 | export 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 | 278 | expect(a_r == 1.25) catch @panic("test failure: zig_cmultd_comp 1"); |
| 261 | 279 | expect(a_i == 2.6) catch @panic("test failure: zig_cmultd_comp 2"); |
| 262 | 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 | 352 | extern fn c_ret_med_struct_mixed() MedStructMixed; |
| 335 | 353 | |
| 336 | 354 | test "C ABI medium struct of ints and floats" { |
| 355 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 356 | ||
| 337 | 357 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 338 | 358 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 339 | 359 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -402,6 +422,8 @@ extern fn c_med_struct_ints(MedStructInts) void; |
| 402 | 422 | extern fn c_ret_med_struct_ints() MedStructInts; |
| 403 | 423 | |
| 404 | 424 | test "C ABI medium struct of ints" { |
| 425 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 426 | ||
| 405 | 427 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 406 | 428 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 407 | 429 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -509,6 +531,8 @@ extern fn c_split_struct_mixed(SplitStructMixed) void; |
| 509 | 531 | extern fn c_ret_split_struct_mixed() SplitStructMixed; |
| 510 | 532 | |
| 511 | 533 | test "C ABI split struct of ints and floats" { |
| 534 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 535 | ||
| 512 | 536 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 513 | 537 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 514 | 538 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -590,6 +614,8 @@ const Vector5 = extern struct { |
| 590 | 614 | extern fn c_big_struct_floats(Vector5) void; |
| 591 | 615 | |
| 592 | 616 | test "C ABI structs of floats as parameter" { |
| 617 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 618 | ||
| 593 | 619 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 594 | 620 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 595 | 621 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| ... | ... | @@ -657,6 +683,8 @@ const FloatRect = extern struct { |
| 657 | 683 | }; |
| 658 | 684 | |
| 659 | 685 | export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void { |
| 686 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 687 | ||
| 660 | 688 | expect(x.left == 1) catch @panic("test failure"); |
| 661 | 689 | expect(x.right == 21) catch @panic("test failure"); |
| 662 | 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 | 696 | } |
| 669 | 697 | |
| 670 | 698 | test "C ABI structs of floats as multiple parameters" { |
| 699 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 700 | ||
| 671 | 701 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 672 | 702 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 673 | 703 | |
| ... | ... | @@ -724,6 +754,8 @@ export fn zig_ret_small_struct_ints() SmallStructInts { |
| 724 | 754 | } |
| 725 | 755 | |
| 726 | 756 | export fn zig_ret_med_struct_ints() MedStructInts { |
| 757 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 758 | ||
| 727 | 759 | return .{ |
| 728 | 760 | .x = 1, |
| 729 | 761 | .y = 2, |
| ... | ... | @@ -732,6 +764,8 @@ export fn zig_ret_med_struct_ints() MedStructInts { |
| 732 | 764 | } |
| 733 | 765 | |
| 734 | 766 | export fn zig_ret_med_struct_mixed() MedStructMixed { |
| 767 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 768 | ||
| 735 | 769 | return .{ |
| 736 | 770 | .a = 1234, |
| 737 | 771 | .b = 100.0, |
| ... | ... | @@ -740,6 +774,8 @@ export fn zig_ret_med_struct_mixed() MedStructMixed { |
| 740 | 774 | } |
| 741 | 775 | |
| 742 | 776 | export fn zig_ret_split_struct_mixed() SplitStructMixed { |
| 777 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 778 | ||
| 743 | 779 | return .{ |
| 744 | 780 | .a = 1234, |
| 745 | 781 | .b = 100, |
| ... | ... | @@ -780,6 +816,8 @@ extern fn c_struct_with_array(StructWithArray) void; |
| 780 | 816 | extern fn c_ret_struct_with_array() StructWithArray; |
| 781 | 817 | |
| 782 | 818 | test "Struct with array as padding." { |
| 819 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 820 | ||
| 783 | 821 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 784 | 822 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 785 | 823 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -851,6 +889,8 @@ extern fn c_medium_vec(MediumVec) void; |
| 851 | 889 | extern fn c_ret_medium_vec() MediumVec; |
| 852 | 890 | |
| 853 | 891 | test "medium simd vector" { |
| 892 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 893 | ||
| 854 | 894 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 855 | 895 | |
| 856 | 896 | c_medium_vec(.{ 1, 2, 3, 4 }); |
| ... | ... | @@ -868,6 +908,8 @@ extern fn c_big_vec(BigVec) void; |
| 868 | 908 | extern fn c_ret_big_vec() BigVec; |
| 869 | 909 | |
| 870 | 910 | test "big simd vector" { |
| 911 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 912 | ||
| 871 | 913 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 872 | 914 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 873 | 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 | 933 | extern fn c_ret_ptr_size_float_struct() Vector2; |
| 892 | 934 | |
| 893 | 935 | test "C ABI pointer sized float struct" { |
| 936 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 937 | ||
| 894 | 938 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 895 | 939 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 896 | 940 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| ... | ... | @@ -914,6 +958,8 @@ pub inline fn expectOk(c_err: c_int) !void { |
| 914 | 958 | /// Tests for Double + Char struct |
| 915 | 959 | const DC = extern struct { v1: f64, v2: u8 }; |
| 916 | 960 | test "DC: Zig passes to C" { |
| 961 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 962 | ||
| 917 | 963 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 918 | 964 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 919 | 965 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -921,6 +967,8 @@ test "DC: Zig passes to C" { |
| 921 | 967 | try expectOk(c_assert_DC(.{ .v1 = -0.25, .v2 = 15 })); |
| 922 | 968 | } |
| 923 | 969 | test "DC: Zig returns to C" { |
| 970 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 971 | ||
| 924 | 972 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; |
| 925 | 973 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 926 | 974 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| ... | ... | @@ -929,6 +977,8 @@ test "DC: Zig returns to C" { |
| 929 | 977 | try expectOk(c_assert_ret_DC()); |
| 930 | 978 | } |
| 931 | 979 | test "DC: C passes to Zig" { |
| 980 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 981 | ||
| 932 | 982 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 933 | 983 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 934 | 984 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -936,6 +986,8 @@ test "DC: C passes to Zig" { |
| 936 | 986 | try expectOk(c_send_DC()); |
| 937 | 987 | } |
| 938 | 988 | test "DC: C returns to Zig" { |
| 989 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 990 | ||
| 939 | 991 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; |
| 940 | 992 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 941 | 993 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| ... | ... | @@ -949,6 +1001,8 @@ pub extern fn c_assert_ret_DC() c_int; |
| 949 | 1001 | pub extern fn c_send_DC() c_int; |
| 950 | 1002 | pub extern fn c_ret_DC() DC; |
| 951 | 1003 | pub export fn zig_assert_DC(lv: DC) c_int { |
| 1004 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 1005 | ||
| 952 | 1006 | var err: c_int = 0; |
| 953 | 1007 | if (lv.v1 != -0.25) err = 1; |
| 954 | 1008 | if (lv.v2 != 15) err = 2; |
| ... | ... | @@ -956,6 +1010,8 @@ pub export fn zig_assert_DC(lv: DC) c_int { |
| 956 | 1010 | return err; |
| 957 | 1011 | } |
| 958 | 1012 | pub export fn zig_ret_DC() DC { |
| 1013 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 1014 | ||
| 959 | 1015 | return .{ .v1 = -0.25, .v2 = 15 }; |
| 960 | 1016 | } |
| 961 | 1017 | |
| ... | ... | @@ -963,6 +1019,8 @@ pub export fn zig_ret_DC() DC { |
| 963 | 1019 | const CFF = extern struct { v1: u8, v2: f32, v3: f32 }; |
| 964 | 1020 | |
| 965 | 1021 | test "CFF: Zig passes to C" { |
| 1022 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1023 | ||
| 966 | 1024 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 967 | 1025 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 968 | 1026 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -970,6 +1028,8 @@ test "CFF: Zig passes to C" { |
| 970 | 1028 | try expectOk(c_assert_CFF(.{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 })); |
| 971 | 1029 | } |
| 972 | 1030 | test "CFF: Zig returns to C" { |
| 1031 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1032 | ||
| 973 | 1033 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; |
| 974 | 1034 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 975 | 1035 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -977,6 +1037,8 @@ test "CFF: Zig returns to C" { |
| 977 | 1037 | try expectOk(c_assert_ret_CFF()); |
| 978 | 1038 | } |
| 979 | 1039 | test "CFF: C passes to Zig" { |
| 1040 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1041 | ||
| 980 | 1042 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 981 | 1043 | if (comptime builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest; |
| 982 | 1044 | if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest; |
| ... | ... | @@ -987,6 +1049,8 @@ test "CFF: C passes to Zig" { |
| 987 | 1049 | try expectOk(c_send_CFF()); |
| 988 | 1050 | } |
| 989 | 1051 | test "CFF: C returns to Zig" { |
| 1052 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1053 | ||
| 990 | 1054 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; |
| 991 | 1055 | if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest; |
| 992 | 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 | 1064 | pub extern fn c_send_CFF() c_int; |
| 1001 | 1065 | pub extern fn c_ret_CFF() CFF; |
| 1002 | 1066 | pub export fn zig_assert_CFF(lv: CFF) c_int { |
| 1067 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 1068 | ||
| 1003 | 1069 | var err: c_int = 0; |
| 1004 | 1070 | if (lv.v1 != 39) err = 1; |
| 1005 | 1071 | if (lv.v2 != 0.875) err = 2; |
| ... | ... | @@ -1008,6 +1074,8 @@ pub export fn zig_assert_CFF(lv: CFF) c_int { |
| 1008 | 1074 | return err; |
| 1009 | 1075 | } |
| 1010 | 1076 | pub export fn zig_ret_CFF() CFF { |
| 1077 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 1078 | ||
| 1011 | 1079 | return .{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }; |
| 1012 | 1080 | } |
| 1013 | 1081 | |
| ... | ... | @@ -1015,6 +1083,8 @@ pub export fn zig_ret_CFF() CFF { |
| 1015 | 1083 | const PD = extern struct { v1: ?*anyopaque, v2: f64 }; |
| 1016 | 1084 | |
| 1017 | 1085 | test "PD: Zig passes to C" { |
| 1086 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1087 | ||
| 1018 | 1088 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1019 | 1089 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 1020 | 1090 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -1022,6 +1092,8 @@ test "PD: Zig passes to C" { |
| 1022 | 1092 | try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 })); |
| 1023 | 1093 | } |
| 1024 | 1094 | test "PD: Zig returns to C" { |
| 1095 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1096 | ||
| 1025 | 1097 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1026 | 1098 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 1027 | 1099 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -1029,6 +1101,8 @@ test "PD: Zig returns to C" { |
| 1029 | 1101 | try expectOk(c_assert_ret_PD()); |
| 1030 | 1102 | } |
| 1031 | 1103 | test "PD: C passes to Zig" { |
| 1104 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1105 | ||
| 1032 | 1106 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1033 | 1107 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 1034 | 1108 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -1036,6 +1110,8 @@ test "PD: C passes to Zig" { |
| 1036 | 1110 | try expectOk(c_send_PD()); |
| 1037 | 1111 | } |
| 1038 | 1112 | test "PD: C returns to Zig" { |
| 1113 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1114 | ||
| 1039 | 1115 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1040 | 1116 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 1041 | 1117 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | ... | @@ -1047,6 +1123,8 @@ pub extern fn c_assert_ret_PD() c_int; |
| 1047 | 1123 | pub extern fn c_send_PD() c_int; |
| 1048 | 1124 | pub extern fn c_ret_PD() PD; |
| 1049 | 1125 | pub export fn zig_c_assert_PD(lv: PD) c_int { |
| 1126 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 1127 | ||
| 1050 | 1128 | var err: c_int = 0; |
| 1051 | 1129 | if (lv.v1 != null) err = 1; |
| 1052 | 1130 | if (lv.v2 != 0.5) err = 2; |
| ... | ... | @@ -1054,9 +1132,13 @@ pub export fn zig_c_assert_PD(lv: PD) c_int { |
| 1054 | 1132 | return err; |
| 1055 | 1133 | } |
| 1056 | 1134 | pub export fn zig_ret_PD() PD { |
| 1135 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 1136 | ||
| 1057 | 1137 | return .{ .v1 = null, .v2 = 0.5 }; |
| 1058 | 1138 | } |
| 1059 | 1139 | pub export fn zig_assert_PD(lv: PD) c_int { |
| 1140 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); | |
| 1141 | ||
| 1060 | 1142 | var err: c_int = 0; |
| 1061 | 1143 | if (lv.v1 != null) err = 1; |
| 1062 | 1144 | if (lv.v2 != 0.5) err = 2; |
| ... | ... | @@ -1146,6 +1228,8 @@ const f80_struct = extern struct { |
| 1146 | 1228 | }; |
| 1147 | 1229 | extern fn c_f80_struct(f80_struct) f80_struct; |
| 1148 | 1230 | test "f80 struct" { |
| 1231 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1232 | ||
| 1149 | 1233 | if (!has_f80) return error.SkipZigTest; |
| 1150 | 1234 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1151 | 1235 | if (builtin.mode != .Debug) return error.SkipZigTest; |
| ... | ... | @@ -1233,6 +1317,8 @@ test "Stdcall ABI big union" { |
| 1233 | 1317 | |
| 1234 | 1318 | extern fn c_explict_win64(ByRef) callconv(.Win64) ByRef; |
| 1235 | 1319 | test "explicit SysV calling convention" { |
| 1320 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1321 | ||
| 1236 | 1322 | if (builtin.cpu.arch != .x86_64) return error.SkipZigTest; |
| 1237 | 1323 | |
| 1238 | 1324 | const res = c_explict_win64(.{ .val = 1, .arr = undefined }); |
test/tests.zig+144-44| ... | ... | @@ -94,6 +94,26 @@ const test_targets = blk: { |
| 94 | 94 | .use_llvm = false, |
| 95 | 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 | 117 | // Doesn't support new liveness |
| 98 | 118 | //.{ |
| 99 | 119 | // .target = .{ |
| ... | ... | @@ -470,62 +490,123 @@ const test_targets = blk: { |
| 470 | 490 | }; |
| 471 | 491 | }; |
| 472 | 492 | |
| 473 | const c_abi_targets = [_]CrossTarget{ | |
| 493 | const CAbiTarget = struct { | |
| 494 | target: CrossTarget = .{}, | |
| 495 | use_llvm: ?bool = null, | |
| 496 | use_lld: ?bool = null, | |
| 497 | c_defines: []const []const u8 = &.{}, | |
| 498 | }; | |
| 499 | ||
| 500 | const c_abi_targets = [_]CAbiTarget{ | |
| 474 | 501 | .{}, |
| 475 | 502 | .{ |
| 476 | .cpu_arch = .x86_64, | |
| 477 | .os_tag = .linux, | |
| 478 | .abi = .musl, | |
| 503 | .target = .{ | |
| 504 | .cpu_arch = .x86_64, | |
| 505 | .os_tag = .linux, | |
| 506 | .abi = .musl, | |
| 507 | }, | |
| 479 | 508 | }, |
| 480 | 509 | .{ |
| 481 | .cpu_arch = .x86, | |
| 482 | .os_tag = .linux, | |
| 483 | .abi = .musl, | |
| 510 | .target = .{ | |
| 511 | .cpu_arch = .x86_64, | |
| 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, | |
| 487 | .os_tag = .linux, | |
| 488 | .abi = .musl, | |
| 520 | .target = .{ | |
| 521 | .cpu_arch = .x86_64, | |
| 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, | |
| 492 | .os_tag = .linux, | |
| 493 | .abi = .musleabihf, | |
| 531 | .target = .{ | |
| 532 | .cpu_arch = .x86_64, | |
| 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, | |
| 497 | .os_tag = .linux, | |
| 498 | .abi = .musl, | |
| 542 | .target = .{ | |
| 543 | .cpu_arch = .x86, | |
| 544 | .os_tag = .linux, | |
| 545 | .abi = .musl, | |
| 546 | }, | |
| 499 | 547 | }, |
| 500 | 548 | .{ |
| 501 | .cpu_arch = .riscv64, | |
| 502 | .os_tag = .linux, | |
| 503 | .abi = .musl, | |
| 549 | .target = .{ | |
| 550 | .cpu_arch = .aarch64, | |
| 551 | .os_tag = .linux, | |
| 552 | .abi = .musl, | |
| 553 | }, | |
| 504 | 554 | }, |
| 505 | 555 | .{ |
| 506 | .cpu_arch = .wasm32, | |
| 507 | .os_tag = .wasi, | |
| 508 | .abi = .musl, | |
| 556 | .target = .{ | |
| 557 | .cpu_arch = .arm, | |
| 558 | .os_tag = .linux, | |
| 559 | .abi = .musleabihf, | |
| 560 | }, | |
| 509 | 561 | }, |
| 510 | 562 | .{ |
| 511 | .cpu_arch = .powerpc, | |
| 512 | .os_tag = .linux, | |
| 513 | .abi = .musl, | |
| 563 | .target = .{ | |
| 564 | .cpu_arch = .mips, | |
| 565 | .os_tag = .linux, | |
| 566 | .abi = .musl, | |
| 567 | }, | |
| 514 | 568 | }, |
| 515 | 569 | .{ |
| 516 | .cpu_arch = .powerpc64le, | |
| 517 | .os_tag = .linux, | |
| 518 | .abi = .musl, | |
| 570 | .target = .{ | |
| 571 | .cpu_arch = .riscv64, | |
| 572 | .os_tag = .linux, | |
| 573 | .abi = .musl, | |
| 574 | }, | |
| 519 | 575 | }, |
| 520 | 576 | .{ |
| 521 | .cpu_arch = .x86, | |
| 522 | .os_tag = .windows, | |
| 523 | .abi = .gnu, | |
| 577 | .target = .{ | |
| 578 | .cpu_arch = .wasm32, | |
| 579 | .os_tag = .wasi, | |
| 580 | .abi = .musl, | |
| 581 | }, | |
| 524 | 582 | }, |
| 525 | 583 | .{ |
| 526 | .cpu_arch = .x86_64, | |
| 527 | .os_tag = .windows, | |
| 528 | .abi = .gnu, | |
| 584 | .target = .{ | |
| 585 | .cpu_arch = .powerpc, | |
| 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 | }; |
| 531 | 612 | |
| ... | ... | @@ -1017,6 +1098,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1017 | 1098 | |
| 1018 | 1099 | const libc_suffix = if (test_target.link_libc == true) "-libc" else ""; |
| 1019 | 1100 | const triple_txt = test_target.target.zigTriple(b.allocator) catch @panic("OOM"); |
| 1101 | const model_txt = test_target.target.getCpuModel().name; | |
| 1020 | 1102 | |
| 1021 | 1103 | // wasm32-wasi builds need more RAM, idk why |
| 1022 | 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 | 1136 | these_tests.stack_size = 2 * 1024 * 1024; |
| 1055 | 1137 | } |
| 1056 | 1138 | |
| 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 | 1140 | options.name, |
| 1059 | 1141 | triple_txt, |
| 1142 | model_txt, | |
| 1060 | 1143 | @tagName(test_target.optimize_mode), |
| 1061 | 1144 | libc_suffix, |
| 1062 | 1145 | single_threaded_suffix, |
| ... | ... | @@ -1144,33 +1227,50 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S |
| 1144 | 1227 | if (optimize_mode != .Debug and skip_release) continue; |
| 1145 | 1228 | |
| 1146 | 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; | |
| 1148 | 1231 | |
| 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 | 1233 | // https://github.com/ziglang/zig/issues/14908 |
| 1151 | 1234 | continue; |
| 1152 | 1235 | } |
| 1153 | 1236 | |
| 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 | } | |
| 1155 | 1241 | |
| 1156 | 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 | 1257 | .root_source_file = .{ .path = "test/c_abi/main.zig" }, |
| 1258 | .target = c_abi_target.target, | |
| 1158 | 1259 | .optimize = optimize_mode, |
| 1159 | .target = c_abi_target, | |
| 1160 | .name = b.fmt("test-c-abi-{s}-{s}", .{ | |
| 1161 | triple_prefix, @tagName(optimize_mode), | |
| 1162 | }), | |
| 1260 | .link_libc = true, | |
| 1261 | .use_llvm = c_abi_target.use_llvm, | |
| 1262 | .use_lld = c_abi_target.use_lld, | |
| 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 | 1265 | // TODO NativeTargetInfo insists on dynamically linking musl |
| 1166 | 1266 | // for some reason? |
| 1167 | 1267 | test_step.target_info.dynamic_linker.max_byte = null; |
| 1168 | 1268 | } |
| 1169 | test_step.linkLibC(); | |
| 1170 | 1269 | test_step.addCSourceFile(.{ |
| 1171 | 1270 | .file = .{ .path = "test/c_abi/cfuncs.c" }, |
| 1172 | 1271 | .flags = &.{"-std=c99"}, |
| 1173 | 1272 | }); |
| 1273 | for (c_abi_target.c_defines) |define| test_step.defineCMacro(define, null); | |
| 1174 | 1274 | |
| 1175 | 1275 | // This test is intentionally trying to check if the external ABI is |
| 1176 | 1276 | // done properly. LTO would be a hindrance to this. |