| author | |
| committer | |
| log | fe93332ba26b0cb8ca6ecce0b2c605d49a02ca87 |
| tree | 54dc414f0ed33c259f717cdef5eeda7f136a7e81 |
| parent | 794dc694b140908a9affc5b449cda09bbe971cfe |
* implement vector comparison
* implement reduce for bool vectors
* fix `@memcpy` bug
* enable passing std tests45 files changed, 574 insertions(+), 525 deletions(-)
lib/std/Build.zig+1| ... | ... | @@ -2156,5 +2156,6 @@ pub fn hex64(x: u64) [16]u8 { |
| 2156 | 2156 | } |
| 2157 | 2157 | |
| 2158 | 2158 | test { |
| 2159 | _ = Cache; | |
| 2159 | 2160 | _ = Step; |
| 2160 | 2161 | } |
lib/std/array_hash_map.zig+1-14| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const debug = std.debug; |
| 4 | 3 | const assert = debug.assert; |
| 5 | 4 | const testing = std.testing; |
| ... | ... | @@ -2138,8 +2137,6 @@ test "ensure capacity leak" { |
| 2138 | 2137 | } |
| 2139 | 2138 | |
| 2140 | 2139 | test "big map" { |
| 2141 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2142 | ||
| 2143 | 2140 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2144 | 2141 | defer map.deinit(); |
| 2145 | 2142 | |
| ... | ... | @@ -2193,8 +2190,6 @@ test "big map" { |
| 2193 | 2190 | } |
| 2194 | 2191 | |
| 2195 | 2192 | test "clone" { |
| 2196 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2197 | ||
| 2198 | 2193 | var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2199 | 2194 | defer original.deinit(); |
| 2200 | 2195 | |
| ... | ... | @@ -2221,8 +2216,6 @@ test "clone" { |
| 2221 | 2216 | } |
| 2222 | 2217 | |
| 2223 | 2218 | test "shrink" { |
| 2224 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2225 | ||
| 2226 | 2219 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2227 | 2220 | defer map.deinit(); |
| 2228 | 2221 | |
| ... | ... | @@ -2263,8 +2256,6 @@ test "shrink" { |
| 2263 | 2256 | } |
| 2264 | 2257 | |
| 2265 | 2258 | test "pop" { |
| 2266 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2267 | ||
| 2268 | 2259 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2269 | 2260 | defer map.deinit(); |
| 2270 | 2261 | |
| ... | ... | @@ -2283,8 +2274,6 @@ test "pop" { |
| 2283 | 2274 | } |
| 2284 | 2275 | |
| 2285 | 2276 | test "popOrNull" { |
| 2286 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2287 | ||
| 2288 | 2277 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2289 | 2278 | defer map.deinit(); |
| 2290 | 2279 | |
| ... | ... | @@ -2305,7 +2294,7 @@ test "popOrNull" { |
| 2305 | 2294 | } |
| 2306 | 2295 | |
| 2307 | 2296 | test "reIndex" { |
| 2308 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2297 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2309 | 2298 | |
| 2310 | 2299 | var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator); |
| 2311 | 2300 | defer map.deinit(); |
| ... | ... | @@ -2351,8 +2340,6 @@ test "auto store_hash" { |
| 2351 | 2340 | } |
| 2352 | 2341 | |
| 2353 | 2342 | test "sort" { |
| 2354 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2355 | ||
| 2356 | 2343 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2357 | 2344 | defer map.deinit(); |
| 2358 | 2345 |
lib/std/array_list.zig-11| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const debug = std.debug; |
| 4 | 3 | const assert = debug.assert; |
| 5 | 4 | const testing = std.testing; |
| ... | ... | @@ -1184,8 +1183,6 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" { |
| 1184 | 1183 | } |
| 1185 | 1184 | |
| 1186 | 1185 | test "std.ArrayList/ArrayListUnmanaged.clone" { |
| 1187 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1188 | ||
| 1189 | 1186 | const a = testing.allocator; |
| 1190 | 1187 | { |
| 1191 | 1188 | var array = ArrayList(i32).init(a); |
| ... | ... | @@ -1227,8 +1224,6 @@ test "std.ArrayList/ArrayListUnmanaged.clone" { |
| 1227 | 1224 | } |
| 1228 | 1225 | |
| 1229 | 1226 | test "std.ArrayList/ArrayListUnmanaged.basic" { |
| 1230 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1231 | ||
| 1232 | 1227 | const a = testing.allocator; |
| 1233 | 1228 | { |
| 1234 | 1229 | var list = ArrayList(i32).init(a); |
| ... | ... | @@ -1513,8 +1508,6 @@ test "std.ArrayList/ArrayListUnmanaged.insert" { |
| 1513 | 1508 | } |
| 1514 | 1509 | |
| 1515 | 1510 | test "std.ArrayList/ArrayListUnmanaged.insertSlice" { |
| 1516 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1517 | ||
| 1518 | 1511 | const a = testing.allocator; |
| 1519 | 1512 | { |
| 1520 | 1513 | var list = ArrayList(i32).init(a); |
| ... | ... | @@ -1561,8 +1554,6 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" { |
| 1561 | 1554 | } |
| 1562 | 1555 | |
| 1563 | 1556 | test "std.ArrayList/ArrayListUnmanaged.replaceRange" { |
| 1564 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1565 | ||
| 1566 | 1557 | var arena = std.heap.ArenaAllocator.init(testing.allocator); |
| 1567 | 1558 | defer arena.deinit(); |
| 1568 | 1559 | const a = arena.allocator(); |
| ... | ... | @@ -1734,8 +1725,6 @@ test "shrink still sets length when resizing is disabled" { |
| 1734 | 1725 | } |
| 1735 | 1726 | |
| 1736 | 1727 | test "shrinkAndFree with a copy" { |
| 1737 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1738 | ||
| 1739 | 1728 | var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 }); |
| 1740 | 1729 | const a = failing_allocator.allocator(); |
| 1741 | 1730 |
lib/std/bit_set.zig+3-12| ... | ... | @@ -1637,10 +1637,8 @@ fn testStaticBitSet(comptime Set: type) !void { |
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | 1639 | test "IntegerBitSet" { |
| 1640 | switch (builtin.zig_backend) { | |
| 1641 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1642 | else => {}, | |
| 1643 | } | |
| 1640 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1641 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1644 | 1642 | |
| 1645 | 1643 | try testStaticBitSet(IntegerBitSet(0)); |
| 1646 | 1644 | try testStaticBitSet(IntegerBitSet(1)); |
| ... | ... | @@ -1653,10 +1651,7 @@ test "IntegerBitSet" { |
| 1653 | 1651 | } |
| 1654 | 1652 | |
| 1655 | 1653 | test "ArrayBitSet" { |
| 1656 | switch (builtin.zig_backend) { | |
| 1657 | .stage2_x86_64 => return error.SkipZigTest, | |
| 1658 | else => {}, | |
| 1659 | } | |
| 1654 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1660 | 1655 | |
| 1661 | 1656 | inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| { |
| 1662 | 1657 | try testStaticBitSet(ArrayBitSet(u8, size)); |
| ... | ... | @@ -1668,8 +1663,6 @@ test "ArrayBitSet" { |
| 1668 | 1663 | } |
| 1669 | 1664 | |
| 1670 | 1665 | test "DynamicBitSetUnmanaged" { |
| 1671 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1672 | ||
| 1673 | 1666 | const allocator = std.testing.allocator; |
| 1674 | 1667 | var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300); |
| 1675 | 1668 | try testing.expectEqual(@as(usize, 0), a.count()); |
| ... | ... | @@ -1723,8 +1716,6 @@ test "DynamicBitSetUnmanaged" { |
| 1723 | 1716 | } |
| 1724 | 1717 | |
| 1725 | 1718 | test "DynamicBitSet" { |
| 1726 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1727 | ||
| 1728 | 1719 | const allocator = std.testing.allocator; |
| 1729 | 1720 | var a = try DynamicBitSet.initEmpty(allocator, 300); |
| 1730 | 1721 | try testing.expectEqual(@as(usize, 0), a.count()); |
lib/std/crypto/argon2.zig-10| ... | ... | @@ -622,8 +622,6 @@ pub fn strVerify( |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | test "argon2d" { |
| 625 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 626 | ||
| 627 | 625 | const password = [_]u8{0x01} ** 32; |
| 628 | 626 | const salt = [_]u8{0x02} ** 16; |
| 629 | 627 | const secret = [_]u8{0x03} ** 8; |
| ... | ... | @@ -649,8 +647,6 @@ test "argon2d" { |
| 649 | 647 | } |
| 650 | 648 | |
| 651 | 649 | test "argon2i" { |
| 652 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 653 | ||
| 654 | 650 | const password = [_]u8{0x01} ** 32; |
| 655 | 651 | const salt = [_]u8{0x02} ** 16; |
| 656 | 652 | const secret = [_]u8{0x03} ** 8; |
| ... | ... | @@ -676,8 +672,6 @@ test "argon2i" { |
| 676 | 672 | } |
| 677 | 673 | |
| 678 | 674 | test "argon2id" { |
| 679 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 680 | ||
| 681 | 675 | const password = [_]u8{0x01} ** 32; |
| 682 | 676 | const salt = [_]u8{0x02} ** 16; |
| 683 | 677 | const secret = [_]u8{0x03} ** 8; |
| ... | ... | @@ -703,8 +697,6 @@ test "argon2id" { |
| 703 | 697 | } |
| 704 | 698 | |
| 705 | 699 | test "kdf" { |
| 706 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 707 | ||
| 708 | 700 | const password = "password"; |
| 709 | 701 | const salt = "somesalt"; |
| 710 | 702 | |
| ... | ... | @@ -936,8 +928,6 @@ test "password hash and password verify" { |
| 936 | 928 | } |
| 937 | 929 | |
| 938 | 930 | test "kdf derived key length" { |
| 939 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 940 | ||
| 941 | 931 | const allocator = std.testing.allocator; |
| 942 | 932 | |
| 943 | 933 | const password = "testpass"; |
lib/std/crypto/blake3.zig-2| ... | ... | @@ -682,8 +682,6 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void { |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | test "BLAKE3 reference test cases" { |
| 685 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 686 | ||
| 687 | 685 | var hash_state = Blake3.init(.{}); |
| 688 | 686 | const hash = &hash_state; |
| 689 | 687 | var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* }); |
lib/std/crypto/chacha20.zig-4| ... | ... | @@ -759,8 +759,6 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type { |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | test "chacha20 AEAD API" { |
| 762 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 763 | ||
| 764 | 762 | const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 }; |
| 765 | 763 | 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."; |
| 766 | 764 | const ad = "Additional data"; |
| ... | ... | @@ -782,8 +780,6 @@ test "chacha20 AEAD API" { |
| 782 | 780 | |
| 783 | 781 | // https://tools.ietf.org/html/rfc7539#section-2.4.2 |
| 784 | 782 | test "crypto.chacha20 test vector sunscreen" { |
| 785 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 786 | ||
| 787 | 783 | const expected_result = [_]u8{ |
| 788 | 784 | 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80, |
| 789 | 785 | 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81, |
lib/std/crypto/hash_composition.zig-2| ... | ... | @@ -65,8 +65,6 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384); |
| 65 | 65 | pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512); |
| 66 | 66 | |
| 67 | 67 | test "Hash composition" { |
| 68 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 69 | ||
| 70 | 68 | const Sha256 = sha2.Sha256; |
| 71 | 69 | const msg = "test"; |
| 72 | 70 |
lib/std/crypto/hkdf.zig-2| ... | ... | @@ -72,8 +72,6 @@ pub fn Hkdf(comptime Hmac: type) type { |
| 72 | 72 | const htest = @import("test.zig"); |
| 73 | 73 | |
| 74 | 74 | test "Hkdf" { |
| 75 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 76 | ||
| 77 | 75 | const ikm = [_]u8{0x0b} ** 22; |
| 78 | 76 | const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c }; |
| 79 | 77 | const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 }; |
lib/std/crypto/kyber_d00.zig-26| ... | ... | @@ -553,8 +553,6 @@ const inv_ntt_reductions = [_]i16{ |
| 553 | 553 | }; |
| 554 | 554 | |
| 555 | 555 | test "invNTTReductions bounds" { |
| 556 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 557 | ||
| 558 | 556 | // Checks whether the reductions proposed by invNTTReductions |
| 559 | 557 | // don't overflow during invNTT(). |
| 560 | 558 | var xs = [_]i32{1} ** 256; // start at |x| ≤ q |
| ... | ... | @@ -658,8 +656,6 @@ fn montReduce(x: i32) i16 { |
| 658 | 656 | } |
| 659 | 657 | |
| 660 | 658 | test "Test montReduce" { |
| 661 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 662 | ||
| 663 | 659 | var rnd = RndGen.init(0); |
| 664 | 660 | for (0..1000) |_| { |
| 665 | 661 | const bound = comptime @as(i32, Q) * (1 << 15); |
| ... | ... | @@ -678,8 +674,6 @@ fn feToMont(x: i16) i16 { |
| 678 | 674 | } |
| 679 | 675 | |
| 680 | 676 | test "Test feToMont" { |
| 681 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 682 | ||
| 683 | 677 | var x: i32 = -(1 << 15); |
| 684 | 678 | while (x < 1 << 15) : (x += 1) { |
| 685 | 679 | const y = feToMont(@as(i16, @intCast(x))); |
| ... | ... | @@ -713,8 +707,6 @@ fn feBarrettReduce(x: i16) i16 { |
| 713 | 707 | } |
| 714 | 708 | |
| 715 | 709 | test "Test Barrett reduction" { |
| 716 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 717 | ||
| 718 | 710 | var x: i32 = -(1 << 15); |
| 719 | 711 | while (x < 1 << 15) : (x += 1) { |
| 720 | 712 | var y1 = feBarrettReduce(@as(i16, @intCast(x))); |
| ... | ... | @@ -735,8 +727,6 @@ fn csubq(x: i16) i16 { |
| 735 | 727 | } |
| 736 | 728 | |
| 737 | 729 | test "Test csubq" { |
| 738 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 739 | ||
| 740 | 730 | var x: i32 = -29439; |
| 741 | 731 | while (x < 1 << 15) : (x += 1) { |
| 742 | 732 | const y1 = csubq(@as(i16, @intCast(x))); |
| ... | ... | @@ -1476,8 +1466,6 @@ fn cmov(comptime len: usize, dst: *[len]u8, src: [len]u8, b: u1) void { |
| 1476 | 1466 | } |
| 1477 | 1467 | |
| 1478 | 1468 | test "MulHat" { |
| 1479 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1480 | ||
| 1481 | 1469 | var rnd = RndGen.init(0); |
| 1482 | 1470 | |
| 1483 | 1471 | for (0..100) |_| { |
| ... | ... | @@ -1509,8 +1497,6 @@ test "MulHat" { |
| 1509 | 1497 | } |
| 1510 | 1498 | |
| 1511 | 1499 | test "NTT" { |
| 1512 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1513 | ||
| 1514 | 1500 | var rnd = RndGen.init(0); |
| 1515 | 1501 | |
| 1516 | 1502 | for (0..1000) |_| { |
| ... | ... | @@ -1534,8 +1520,6 @@ test "NTT" { |
| 1534 | 1520 | } |
| 1535 | 1521 | |
| 1536 | 1522 | test "Compression" { |
| 1537 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1538 | ||
| 1539 | 1523 | var rnd = RndGen.init(0); |
| 1540 | 1524 | inline for (.{ 1, 4, 5, 10, 11 }) |d| { |
| 1541 | 1525 | for (0..1000) |_| { |
| ... | ... | @@ -1548,8 +1532,6 @@ test "Compression" { |
| 1548 | 1532 | } |
| 1549 | 1533 | |
| 1550 | 1534 | test "noise" { |
| 1551 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1552 | ||
| 1553 | 1535 | var seed: [32]u8 = undefined; |
| 1554 | 1536 | for (&seed, 0..) |*s, i| { |
| 1555 | 1537 | s.* = @as(u8, @intCast(i)); |
| ... | ... | @@ -1596,8 +1578,6 @@ test "noise" { |
| 1596 | 1578 | } |
| 1597 | 1579 | |
| 1598 | 1580 | test "uniform sampling" { |
| 1599 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1600 | ||
| 1601 | 1581 | var seed: [32]u8 = undefined; |
| 1602 | 1582 | for (&seed, 0..) |*s, i| { |
| 1603 | 1583 | s.* = @as(u8, @intCast(i)); |
| ... | ... | @@ -1631,8 +1611,6 @@ test "uniform sampling" { |
| 1631 | 1611 | } |
| 1632 | 1612 | |
| 1633 | 1613 | test "Polynomial packing" { |
| 1634 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1635 | ||
| 1636 | 1614 | var rnd = RndGen.init(0); |
| 1637 | 1615 | |
| 1638 | 1616 | for (0..1000) |_| { |
| ... | ... | @@ -1642,8 +1620,6 @@ test "Polynomial packing" { |
| 1642 | 1620 | } |
| 1643 | 1621 | |
| 1644 | 1622 | test "Test inner PKE" { |
| 1645 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1646 | ||
| 1647 | 1623 | var seed: [32]u8 = undefined; |
| 1648 | 1624 | var pt: [32]u8 = undefined; |
| 1649 | 1625 | for (&seed, &pt, 0..) |*s, *p, i| { |
| ... | ... | @@ -1665,8 +1641,6 @@ test "Test inner PKE" { |
| 1665 | 1641 | } |
| 1666 | 1642 | |
| 1667 | 1643 | test "Test happy flow" { |
| 1668 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1669 | ||
| 1670 | 1644 | var seed: [64]u8 = undefined; |
| 1671 | 1645 | for (&seed, 0..) |*s, i| { |
| 1672 | 1646 | s.* = @as(u8, @intCast(i)); |
lib/std/crypto/pbkdf2.zig-15| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const mem = std.mem; |
| 4 | 3 | const maxInt = std.math.maxInt; |
| 5 | 4 | const OutputTooLongError = std.crypto.errors.OutputTooLongError; |
| ... | ... | @@ -152,8 +151,6 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1; |
| 152 | 151 | // RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors |
| 153 | 152 | |
| 154 | 153 | test "RFC 6070 one iteration" { |
| 155 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 156 | ||
| 157 | 154 | const p = "password"; |
| 158 | 155 | const s = "salt"; |
| 159 | 156 | const c = 1; |
| ... | ... | @@ -169,8 +166,6 @@ test "RFC 6070 one iteration" { |
| 169 | 166 | } |
| 170 | 167 | |
| 171 | 168 | test "RFC 6070 two iterations" { |
| 172 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 173 | ||
| 174 | 169 | const p = "password"; |
| 175 | 170 | const s = "salt"; |
| 176 | 171 | const c = 2; |
| ... | ... | @@ -186,8 +181,6 @@ test "RFC 6070 two iterations" { |
| 186 | 181 | } |
| 187 | 182 | |
| 188 | 183 | test "RFC 6070 4096 iterations" { |
| 189 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 190 | ||
| 191 | 184 | const p = "password"; |
| 192 | 185 | const s = "salt"; |
| 193 | 186 | const c = 4096; |
| ... | ... | @@ -203,8 +196,6 @@ test "RFC 6070 4096 iterations" { |
| 203 | 196 | } |
| 204 | 197 | |
| 205 | 198 | test "RFC 6070 16,777,216 iterations" { |
| 206 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 207 | ||
| 208 | 199 | // These iteration tests are slow so we always skip them. Results have been verified. |
| 209 | 200 | if (true) { |
| 210 | 201 | return error.SkipZigTest; |
| ... | ... | @@ -225,8 +216,6 @@ test "RFC 6070 16,777,216 iterations" { |
| 225 | 216 | } |
| 226 | 217 | |
| 227 | 218 | test "RFC 6070 multi-block salt and password" { |
| 228 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 229 | ||
| 230 | 219 | const p = "passwordPASSWORDpassword"; |
| 231 | 220 | const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt"; |
| 232 | 221 | const c = 4096; |
| ... | ... | @@ -242,8 +231,6 @@ test "RFC 6070 multi-block salt and password" { |
| 242 | 231 | } |
| 243 | 232 | |
| 244 | 233 | test "RFC 6070 embedded NUL" { |
| 245 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 246 | ||
| 247 | 234 | const p = "pass\x00word"; |
| 248 | 235 | const s = "sa\x00lt"; |
| 249 | 236 | const c = 4096; |
| ... | ... | @@ -259,8 +246,6 @@ test "RFC 6070 embedded NUL" { |
| 259 | 246 | } |
| 260 | 247 | |
| 261 | 248 | test "Very large dk_len" { |
| 262 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 263 | ||
| 264 | 249 | // This test allocates 8GB of memory and is expected to take several hours to run. |
| 265 | 250 | if (true) { |
| 266 | 251 | return error.SkipZigTest; |
lib/std/crypto/phc_encoding.zig-4| ... | ... | @@ -351,16 +351,12 @@ test "phc format - encoding/decoding" { |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | test "phc format - empty input string" { |
| 354 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 355 | ||
| 356 | 354 | const s = ""; |
| 357 | 355 | const v = deserialize(struct { alg_id: []const u8 }, s); |
| 358 | 356 | try std.testing.expectError(Error.InvalidEncoding, v); |
| 359 | 357 | } |
| 360 | 358 | |
| 361 | 359 | test "phc format - hash without salt" { |
| 362 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 363 | ||
| 364 | 360 | const s = "$scrypt"; |
| 365 | 361 | const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s); |
| 366 | 362 | try std.testing.expectError(Error.InvalidEncoding, v); |
lib/std/crypto/salsa20.zig+1-7| ... | ... | @@ -302,7 +302,7 @@ fn SalsaNonVecImpl(comptime rounds: comptime_int) type { |
| 302 | 302 | }; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | const SalsaImpl = if (builtin.cpu.arch == .x86_64) SalsaVecImpl else SalsaNonVecImpl; | |
| 305 | const SalsaImpl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64) SalsaVecImpl else SalsaNonVecImpl; | |
| 306 | 306 | |
| 307 | 307 | fn keyToWords(key: [32]u8) [8]u32 { |
| 308 | 308 | var k: [8]u32 = undefined; |
| ... | ... | @@ -555,8 +555,6 @@ pub const SealedBox = struct { |
| 555 | 555 | const htest = @import("test.zig"); |
| 556 | 556 | |
| 557 | 557 | test "(x)salsa20" { |
| 558 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 559 | ||
| 560 | 558 | const key = [_]u8{0x69} ** 32; |
| 561 | 559 | const nonce = [_]u8{0x42} ** 8; |
| 562 | 560 | const msg = [_]u8{0} ** 20; |
| ... | ... | @@ -571,8 +569,6 @@ test "(x)salsa20" { |
| 571 | 569 | } |
| 572 | 570 | |
| 573 | 571 | test "xsalsa20poly1305" { |
| 574 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 575 | ||
| 576 | 572 | var msg: [100]u8 = undefined; |
| 577 | 573 | var msg2: [msg.len]u8 = undefined; |
| 578 | 574 | var c: [msg.len]u8 = undefined; |
| ... | ... | @@ -588,8 +584,6 @@ test "xsalsa20poly1305" { |
| 588 | 584 | } |
| 589 | 585 | |
| 590 | 586 | test "xsalsa20poly1305 secretbox" { |
| 591 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 592 | ||
| 593 | 587 | var msg: [100]u8 = undefined; |
| 594 | 588 | var msg2: [msg.len]u8 = undefined; |
| 595 | 589 | var key: [XSalsa20Poly1305.key_length]u8 = undefined; |
lib/std/crypto/scrypt.zig-5| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | // https://github.com/Tarsnap/scrypt |
| 4 | 4 | |
| 5 | 5 | const std = @import("std"); |
| 6 | const builtin = @import("builtin"); | |
| 7 | 6 | const crypto = std.crypto; |
| 8 | 7 | const fmt = std.fmt; |
| 9 | 8 | const io = std.io; |
| ... | ... | @@ -684,8 +683,6 @@ test "unix-scrypt" { |
| 684 | 683 | } |
| 685 | 684 | |
| 686 | 685 | test "crypt format" { |
| 687 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 688 | ||
| 689 | 686 | const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D"; |
| 690 | 687 | const params = try crypt_format.deserialize(crypt_format.HashResult(32), str); |
| 691 | 688 | var buf: [str.len]u8 = undefined; |
| ... | ... | @@ -694,8 +691,6 @@ test "crypt format" { |
| 694 | 691 | } |
| 695 | 692 | |
| 696 | 693 | test "kdf fast" { |
| 697 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 698 | ||
| 699 | 694 | const TestVector = struct { |
| 700 | 695 | password: []const u8, |
| 701 | 696 | salt: []const u8, |
lib/std/crypto/sha2.zig-10| ... | ... | @@ -406,16 +406,12 @@ fn Sha2x32(comptime params: Sha2Params32) type { |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | test "sha224 single" { |
| 409 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 410 | ||
| 411 | 409 | try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", ""); |
| 412 | 410 | try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc"); |
| 413 | 411 | try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"); |
| 414 | 412 | } |
| 415 | 413 | |
| 416 | 414 | test "sha224 streaming" { |
| 417 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 418 | ||
| 419 | 415 | var h = Sha224.init(.{}); |
| 420 | 416 | var out: [28]u8 = undefined; |
| 421 | 417 | |
| ... | ... | @@ -436,16 +432,12 @@ test "sha224 streaming" { |
| 436 | 432 | } |
| 437 | 433 | |
| 438 | 434 | test "sha256 single" { |
| 439 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 440 | ||
| 441 | 435 | try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ""); |
| 442 | 436 | try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc"); |
| 443 | 437 | try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"); |
| 444 | 438 | } |
| 445 | 439 | |
| 446 | 440 | test "sha256 streaming" { |
| 447 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 448 | ||
| 449 | 441 | var h = Sha256.init(.{}); |
| 450 | 442 | var out: [32]u8 = undefined; |
| 451 | 443 | |
| ... | ... | @@ -466,8 +458,6 @@ test "sha256 streaming" { |
| 466 | 458 | } |
| 467 | 459 | |
| 468 | 460 | test "sha256 aligned final" { |
| 469 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 470 | ||
| 471 | 461 | var block = [_]u8{0} ** Sha256.block_length; |
| 472 | 462 | var out: [Sha256.digest_length]u8 = undefined; |
| 473 | 463 |
lib/std/fifo.zig-2| ... | ... | @@ -505,8 +505,6 @@ test "LinearFifo(u8, .Dynamic)" { |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | test "LinearFifo" { |
| 508 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 509 | ||
| 510 | 508 | inline for ([_]type{ u1, u8, u16, u64 }) |T| { |
| 511 | 509 | inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| { |
| 512 | 510 | const FifoType = LinearFifo(T, bt); |
lib/std/fmt.zig-2| ... | ... | @@ -2751,8 +2751,6 @@ test "formatType max_depth" { |
| 2751 | 2751 | } |
| 2752 | 2752 | |
| 2753 | 2753 | test "positional" { |
| 2754 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2755 | ||
| 2756 | 2754 | try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) }); |
| 2757 | 2755 | try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) }); |
| 2758 | 2756 | try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)}); |
lib/std/json.zig-4| ... | ... | @@ -38,8 +38,6 @@ test parseFromSlice { |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | test Value { |
| 41 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 42 | ||
| 43 | 41 | var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{}); |
| 44 | 42 | defer parsed.deinit(); |
| 45 | 43 | try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string); |
| ... | ... | @@ -65,8 +63,6 @@ test writeStream { |
| 65 | 63 | } |
| 66 | 64 | |
| 67 | 65 | test stringify { |
| 68 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 69 | ||
| 70 | 66 | var out = ArrayList(u8).init(testing.allocator); |
| 71 | 67 | defer out.deinit(); |
| 72 | 68 |
lib/std/json/JSONTestSuite_test.zig-66| ... | ... | @@ -104,8 +104,6 @@ test "i_string_utf16LE_no_BOM.json" { |
| 104 | 104 | try any("[\x00\"\x00\xe9\x00\"\x00]\x00"); |
| 105 | 105 | } |
| 106 | 106 | test "i_structure_500_nested_arrays.json" { |
| 107 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 108 | ||
| 109 | 107 | try any("[" ** 500 ++ "]" ** 500); |
| 110 | 108 | } |
| 111 | 109 | test "i_structure_UTF-8_BOM_empty_object.json" { |
| ... | ... | @@ -361,21 +359,15 @@ test "n_object_bracket_key.json" { |
| 361 | 359 | try err("{[: \"x\"}\n"); |
| 362 | 360 | } |
| 363 | 361 | test "n_object_comma_instead_of_colon.json" { |
| 364 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 365 | ||
| 366 | 362 | try err("{\"x\", null}"); |
| 367 | 363 | } |
| 368 | 364 | test "n_object_double_colon.json" { |
| 369 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 370 | ||
| 371 | 365 | try err("{\"x\"::\"b\"}"); |
| 372 | 366 | } |
| 373 | 367 | test "n_object_emoji.json" { |
| 374 | 368 | try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}"); |
| 375 | 369 | } |
| 376 | 370 | test "n_object_garbage_at_end.json" { |
| 377 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 378 | ||
| 379 | 371 | try err("{\"a\":\"a\" 123}"); |
| 380 | 372 | } |
| 381 | 373 | test "n_object_key_with_single_quotes.json" { |
| ... | ... | @@ -385,26 +377,18 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" { |
| 385 | 377 | try err("{\"\xb9\":\"0\",}"); |
| 386 | 378 | } |
| 387 | 379 | test "n_object_missing_colon.json" { |
| 388 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 389 | ||
| 390 | 380 | try err("{\"a\" b}"); |
| 391 | 381 | } |
| 392 | 382 | test "n_object_missing_key.json" { |
| 393 | 383 | try err("{:\"b\"}"); |
| 394 | 384 | } |
| 395 | 385 | test "n_object_missing_semicolon.json" { |
| 396 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 397 | ||
| 398 | 386 | try err("{\"a\" \"b\"}"); |
| 399 | 387 | } |
| 400 | 388 | test "n_object_missing_value.json" { |
| 401 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 402 | ||
| 403 | 389 | try err("{\"a\":"); |
| 404 | 390 | } |
| 405 | 391 | test "n_object_no-colon.json" { |
| 406 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 407 | ||
| 408 | 392 | try err("{\"a\""); |
| 409 | 393 | } |
| 410 | 394 | test "n_object_non_string_key.json" { |
| ... | ... | @@ -417,59 +401,39 @@ test "n_object_repeated_null_null.json" { |
| 417 | 401 | try err("{null:null,null:null}"); |
| 418 | 402 | } |
| 419 | 403 | test "n_object_several_trailing_commas.json" { |
| 420 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 421 | ||
| 422 | 404 | try err("{\"id\":0,,,,,}"); |
| 423 | 405 | } |
| 424 | 406 | test "n_object_single_quote.json" { |
| 425 | 407 | try err("{'a':0}"); |
| 426 | 408 | } |
| 427 | 409 | test "n_object_trailing_comma.json" { |
| 428 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 429 | ||
| 430 | 410 | try err("{\"id\":0,}"); |
| 431 | 411 | } |
| 432 | 412 | test "n_object_trailing_comment.json" { |
| 433 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 434 | ||
| 435 | 413 | try err("{\"a\":\"b\"}/**/"); |
| 436 | 414 | } |
| 437 | 415 | test "n_object_trailing_comment_open.json" { |
| 438 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 439 | ||
| 440 | 416 | try err("{\"a\":\"b\"}/**//"); |
| 441 | 417 | } |
| 442 | 418 | test "n_object_trailing_comment_slash_open.json" { |
| 443 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 444 | ||
| 445 | 419 | try err("{\"a\":\"b\"}//"); |
| 446 | 420 | } |
| 447 | 421 | test "n_object_trailing_comment_slash_open_incomplete.json" { |
| 448 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 449 | ||
| 450 | 422 | try err("{\"a\":\"b\"}/"); |
| 451 | 423 | } |
| 452 | 424 | test "n_object_two_commas_in_a_row.json" { |
| 453 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 454 | ||
| 455 | 425 | try err("{\"a\":\"b\",,\"c\":\"d\"}"); |
| 456 | 426 | } |
| 457 | 427 | test "n_object_unquoted_key.json" { |
| 458 | 428 | try err("{a: \"b\"}"); |
| 459 | 429 | } |
| 460 | 430 | test "n_object_unterminated-value.json" { |
| 461 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 462 | ||
| 463 | 431 | try err("{\"a\":\"a"); |
| 464 | 432 | } |
| 465 | 433 | test "n_object_with_single_string.json" { |
| 466 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 467 | ||
| 468 | 434 | try err("{ \"foo\" : \"bar\", \"a\" }"); |
| 469 | 435 | } |
| 470 | 436 | test "n_object_with_trailing_garbage.json" { |
| 471 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 472 | ||
| 473 | 437 | try err("{\"a\":\"b\"}#"); |
| 474 | 438 | } |
| 475 | 439 | test "n_single_space.json" { |
| ... | ... | @@ -596,8 +560,6 @@ test "n_structure_close_unopened_array.json" { |
| 596 | 560 | try err("1]"); |
| 597 | 561 | } |
| 598 | 562 | test "n_structure_comma_instead_of_closing_brace.json" { |
| 599 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 600 | ||
| 601 | 563 | try err("{\"x\": true,"); |
| 602 | 564 | } |
| 603 | 565 | test "n_structure_double_array.json" { |
| ... | ... | @@ -628,18 +590,12 @@ test "n_structure_object_followed_by_closing_object.json" { |
| 628 | 590 | try err("{}}"); |
| 629 | 591 | } |
| 630 | 592 | test "n_structure_object_unclosed_no_value.json" { |
| 631 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 632 | ||
| 633 | 593 | try err("{\"\":"); |
| 634 | 594 | } |
| 635 | 595 | test "n_structure_object_with_comment.json" { |
| 636 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 637 | ||
| 638 | 596 | try err("{\"a\":/*comment*/\"b\"}"); |
| 639 | 597 | } |
| 640 | 598 | test "n_structure_object_with_trailing_garbage.json" { |
| 641 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 642 | ||
| 643 | 599 | try err("{\"a\": true} \"x\""); |
| 644 | 600 | } |
| 645 | 601 | test "n_structure_open_array_apostrophe.json" { |
| ... | ... | @@ -649,8 +605,6 @@ test "n_structure_open_array_comma.json" { |
| 649 | 605 | try err("[,"); |
| 650 | 606 | } |
| 651 | 607 | test "n_structure_open_array_object.json" { |
| 652 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 653 | ||
| 654 | 608 | try err("[{\"\":" ** 50000 ++ "\n"); |
| 655 | 609 | } |
| 656 | 610 | test "n_structure_open_array_open_object.json" { |
| ... | ... | @@ -690,8 +644,6 @@ test "n_structure_single_star.json" { |
| 690 | 644 | try err("*"); |
| 691 | 645 | } |
| 692 | 646 | test "n_structure_trailing_#.json" { |
| 693 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 694 | ||
| 695 | 647 | try err("{\"a\":\"b\"}#{}"); |
| 696 | 648 | } |
| 697 | 649 | test "n_structure_uescaped_LF_before_string.json" { |
| ... | ... | @@ -710,8 +662,6 @@ test "n_structure_unclosed_array_unfinished_true.json" { |
| 710 | 662 | try err("[ false, tru"); |
| 711 | 663 | } |
| 712 | 664 | test "n_structure_unclosed_object.json" { |
| 713 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 714 | ||
| 715 | 665 | try err("{\"asd\":\"asd\""); |
| 716 | 666 | } |
| 717 | 667 | test "n_structure_unicode-identifier.json" { |
| ... | ... | @@ -819,31 +769,21 @@ test "y_object.json" { |
| 819 | 769 | try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}"); |
| 820 | 770 | } |
| 821 | 771 | test "y_object_basic.json" { |
| 822 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 823 | ||
| 824 | 772 | try ok("{\"asd\":\"sdf\"}"); |
| 825 | 773 | } |
| 826 | 774 | test "y_object_duplicated_key.json" { |
| 827 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 828 | ||
| 829 | 775 | try ok("{\"a\":\"b\",\"a\":\"c\"}"); |
| 830 | 776 | } |
| 831 | 777 | test "y_object_duplicated_key_and_value.json" { |
| 832 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 833 | ||
| 834 | 778 | try ok("{\"a\":\"b\",\"a\":\"b\"}"); |
| 835 | 779 | } |
| 836 | 780 | test "y_object_empty.json" { |
| 837 | 781 | try ok("{}"); |
| 838 | 782 | } |
| 839 | 783 | test "y_object_empty_key.json" { |
| 840 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 841 | ||
| 842 | 784 | try ok("{\"\":0}"); |
| 843 | 785 | } |
| 844 | 786 | test "y_object_escaped_null_in_key.json" { |
| 845 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 846 | ||
| 847 | 787 | try ok("{\"foo\\u0000bar\": 42}"); |
| 848 | 788 | } |
| 849 | 789 | test "y_object_extreme_numbers.json" { |
| ... | ... | @@ -857,18 +797,12 @@ test "y_object_long_strings.json" { |
| 857 | 797 | try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}"); |
| 858 | 798 | } |
| 859 | 799 | test "y_object_simple.json" { |
| 860 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 861 | ||
| 862 | 800 | try ok("{\"a\":[]}"); |
| 863 | 801 | } |
| 864 | 802 | test "y_object_string_unicode.json" { |
| 865 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 866 | ||
| 867 | 803 | try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }"); |
| 868 | 804 | } |
| 869 | 805 | test "y_object_with_newlines.json" { |
| 870 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 871 | ||
| 872 | 806 | try ok("{\n\"a\": \"b\"\n}"); |
| 873 | 807 | } |
| 874 | 808 | test "y_string_1_2_3_bytes_UTF-8_sequences.json" { |
lib/std/json/dynamic_test.zig-12| ... | ... | @@ -125,16 +125,12 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value { |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | test "parsing empty string gives appropriate error" { |
| 128 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 129 | ||
| 130 | 128 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 131 | 129 | defer arena_allocator.deinit(); |
| 132 | 130 | try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), "")); |
| 133 | 131 | } |
| 134 | 132 | |
| 135 | 133 | test "Value.array allocator should still be usable after parsing" { |
| 136 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 137 | ||
| 138 | 134 | var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{}); |
| 139 | 135 | defer parsed.deinit(); |
| 140 | 136 | |
| ... | ... | @@ -195,8 +191,6 @@ test "escaped characters" { |
| 195 | 191 | } |
| 196 | 192 | |
| 197 | 193 | test "Value.jsonStringify" { |
| 198 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 199 | ||
| 200 | 194 | var vals = [_]Value{ |
| 201 | 195 | .{ .integer = 1 }, |
| 202 | 196 | .{ .integer = 2 }, |
| ... | ... | @@ -263,8 +257,6 @@ test "parseFromValue(std.json.Value,...)" { |
| 263 | 257 | } |
| 264 | 258 | |
| 265 | 259 | test "polymorphic parsing" { |
| 266 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 267 | ||
| 268 | 260 | if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108 |
| 269 | 261 | const doc = |
| 270 | 262 | \\{ "type": "div", |
| ... | ... | @@ -310,8 +302,6 @@ test "polymorphic parsing" { |
| 310 | 302 | } |
| 311 | 303 | |
| 312 | 304 | test "long object value" { |
| 313 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 314 | ||
| 315 | 305 | const value = "01234567890123456789"; |
| 316 | 306 | const doc = "{\"key\":\"" ++ value ++ "\"}"; |
| 317 | 307 | var fbs = std.io.fixedBufferStream(doc); |
| ... | ... | @@ -324,8 +314,6 @@ test "long object value" { |
| 324 | 314 | } |
| 325 | 315 | |
| 326 | 316 | test "ParseOptions.max_value_len" { |
| 327 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 328 | ||
| 329 | 317 | var arena = ArenaAllocator.init(testing.allocator); |
| 330 | 318 | defer arena.deinit(); |
| 331 | 319 |
lib/std/json/static_test.zig-6| ... | ... | @@ -392,8 +392,6 @@ test "parse" { |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | test "parse into enum" { |
| 395 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 396 | ||
| 397 | 395 | const T = enum(u32) { |
| 398 | 396 | Foo = 42, |
| 399 | 397 | Bar, |
| ... | ... | @@ -478,8 +476,6 @@ test "parse into tagged union errors" { |
| 478 | 476 | } |
| 479 | 477 | |
| 480 | 478 | test "parse into struct with no fields" { |
| 481 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 482 | ||
| 483 | 479 | const T = struct {}; |
| 484 | 480 | const parsed = try parseFromSlice(T, testing.allocator, "{}", .{}); |
| 485 | 481 | defer parsed.deinit(); |
| ... | ... | @@ -949,8 +945,6 @@ test "json parse allocate when streaming" { |
| 949 | 945 | } |
| 950 | 946 | |
| 951 | 947 | test "parse at comptime" { |
| 952 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 953 | ||
| 954 | 948 | const doc = |
| 955 | 949 | \\{ |
| 956 | 950 | \\ "vals": { |
lib/std/json/stringify_test.zig-36| ... | ... | @@ -100,8 +100,6 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value { |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | test "stringify null optional fields" { |
| 103 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 104 | ||
| 105 | 103 | const MyStruct = struct { |
| 106 | 104 | optional: ?[]const u8 = null, |
| 107 | 105 | required: []const u8 = "something", |
| ... | ... | @@ -123,8 +121,6 @@ test "stringify null optional fields" { |
| 123 | 121 | } |
| 124 | 122 | |
| 125 | 123 | test "stringify basic types" { |
| 126 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 127 | ||
| 128 | 124 | try testStringify("false", false, .{}); |
| 129 | 125 | try testStringify("true", true, .{}); |
| 130 | 126 | try testStringify("null", @as(?u8, null), .{}); |
| ... | ... | @@ -141,8 +137,6 @@ test "stringify basic types" { |
| 141 | 137 | } |
| 142 | 138 | |
| 143 | 139 | test "stringify string" { |
| 144 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 145 | ||
| 146 | 140 | try testStringify("\"hello\"", "hello", .{}); |
| 147 | 141 | try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{}); |
| 148 | 142 | try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true }); |
| ... | ... | @@ -167,16 +161,12 @@ test "stringify string" { |
| 167 | 161 | } |
| 168 | 162 | |
| 169 | 163 | test "stringify many-item sentinel-terminated string" { |
| 170 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 171 | ||
| 172 | 164 | try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{}); |
| 173 | 165 | try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true }); |
| 174 | 166 | try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true }); |
| 175 | 167 | } |
| 176 | 168 | |
| 177 | 169 | test "stringify enums" { |
| 178 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 179 | ||
| 180 | 170 | const E = enum { |
| 181 | 171 | foo, |
| 182 | 172 | bar, |
| ... | ... | @@ -186,15 +176,11 @@ test "stringify enums" { |
| 186 | 176 | } |
| 187 | 177 | |
| 188 | 178 | test "stringify enum literals" { |
| 189 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 190 | ||
| 191 | 179 | try testStringify("\"foo\"", .foo, .{}); |
| 192 | 180 | try testStringify("\"bar\"", .bar, .{}); |
| 193 | 181 | } |
| 194 | 182 | |
| 195 | 183 | test "stringify tagged unions" { |
| 196 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 197 | ||
| 198 | 184 | const T = union(enum) { |
| 199 | 185 | nothing, |
| 200 | 186 | foo: u32, |
| ... | ... | @@ -206,8 +192,6 @@ test "stringify tagged unions" { |
| 206 | 192 | } |
| 207 | 193 | |
| 208 | 194 | test "stringify struct" { |
| 209 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 210 | ||
| 211 | 195 | try testStringify("{\"foo\":42}", struct { |
| 212 | 196 | foo: u32, |
| 213 | 197 | }{ .foo = 42 }, .{}); |
| ... | ... | @@ -230,8 +214,6 @@ test "emit_strings_as_arrays" { |
| 230 | 214 | } |
| 231 | 215 | |
| 232 | 216 | test "stringify struct with indentation" { |
| 233 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 234 | ||
| 235 | 217 | try testStringify( |
| 236 | 218 | \\{ |
| 237 | 219 | \\ "foo": 42, |
| ... | ... | @@ -277,8 +259,6 @@ test "stringify struct with indentation" { |
| 277 | 259 | } |
| 278 | 260 | |
| 279 | 261 | test "stringify struct with void field" { |
| 280 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 281 | ||
| 282 | 262 | try testStringify("{\"foo\":42}", struct { |
| 283 | 263 | foo: u32, |
| 284 | 264 | bar: void = {}, |
| ... | ... | @@ -286,8 +266,6 @@ test "stringify struct with void field" { |
| 286 | 266 | } |
| 287 | 267 | |
| 288 | 268 | test "stringify array of structs" { |
| 289 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 290 | ||
| 291 | 269 | const MyStruct = struct { |
| 292 | 270 | foo: u32, |
| 293 | 271 | }; |
| ... | ... | @@ -299,8 +277,6 @@ test "stringify array of structs" { |
| 299 | 277 | } |
| 300 | 278 | |
| 301 | 279 | test "stringify struct with custom stringifier" { |
| 302 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 303 | ||
| 304 | 280 | try testStringify("[\"something special\",42]", struct { |
| 305 | 281 | foo: u32, |
| 306 | 282 | const Self = @This(); |
| ... | ... | @@ -315,16 +291,12 @@ test "stringify struct with custom stringifier" { |
| 315 | 291 | } |
| 316 | 292 | |
| 317 | 293 | test "stringify vector" { |
| 318 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 319 | ||
| 320 | 294 | try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{}); |
| 321 | 295 | try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{}); |
| 322 | 296 | try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true }); |
| 323 | 297 | } |
| 324 | 298 | |
| 325 | 299 | test "stringify tuple" { |
| 326 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 327 | ||
| 328 | 300 | try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{}); |
| 329 | 301 | } |
| 330 | 302 | |
| ... | ... | @@ -411,8 +383,6 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St |
| 411 | 383 | } |
| 412 | 384 | |
| 413 | 385 | test "stringify alloc" { |
| 414 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 415 | ||
| 416 | 386 | const allocator = std.testing.allocator; |
| 417 | 387 | const expected = |
| 418 | 388 | \\{"foo":"bar","answer":42,"my_friend":"sammy"} |
| ... | ... | @@ -424,8 +394,6 @@ test "stringify alloc" { |
| 424 | 394 | } |
| 425 | 395 | |
| 426 | 396 | test "comptime stringify" { |
| 427 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 428 | ||
| 429 | 397 | comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable; |
| 430 | 398 | comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable; |
| 431 | 399 | comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable; |
| ... | ... | @@ -446,8 +414,6 @@ test "comptime stringify" { |
| 446 | 414 | } |
| 447 | 415 | |
| 448 | 416 | test "print" { |
| 449 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 450 | ||
| 451 | 417 | var out_buf: [1024]u8 = undefined; |
| 452 | 418 | var slice_stream = std.io.fixedBufferStream(&out_buf); |
| 453 | 419 | const out = slice_stream.writer(); |
| ... | ... | @@ -479,8 +445,6 @@ test "print" { |
| 479 | 445 | } |
| 480 | 446 | |
| 481 | 447 | test "nonportable numbers" { |
| 482 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 483 | ||
| 484 | 448 | try testStringify("9999999999999999", 9999999999999999, .{}); |
| 485 | 449 | try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true }); |
| 486 | 450 | } |
lib/std/json/test.zig+1-4| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const testing = std.testing; |
| 4 | 3 | const parseFromSlice = @import("./static.zig").parseFromSlice; |
| 5 | 4 | const validate = @import("./scanner.zig").validate; |
| ... | ... | @@ -35,15 +34,13 @@ fn testHighLevelDynamicParser(s: []const u8) !void { |
| 35 | 34 | |
| 36 | 35 | // Additional tests not part of test JSONTestSuite. |
| 37 | 36 | test "y_trailing_comma_after_empty" { |
| 38 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 37 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 39 | 38 | |
| 40 | 39 | try roundTrip( |
| 41 | 40 | \\{"1":[],"2":{},"3":"4"} |
| 42 | 41 | ); |
| 43 | 42 | } |
| 44 | 43 | test "n_object_closed_missing_value" { |
| 45 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 46 | ||
| 47 | 44 | try err( |
| 48 | 45 | \\{"a":} |
| 49 | 46 | ); |
lib/std/math/big/int_test.zig+5-49| ... | ... | @@ -246,8 +246,6 @@ test "big.int fits" { |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | test "big.int string set" { |
| 249 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 250 | ||
| 251 | 249 | var a = try Managed.init(testing.allocator); |
| 252 | 250 | defer a.deinit(); |
| 253 | 251 | |
| ... | ... | @@ -264,8 +262,6 @@ test "big.int string negative" { |
| 264 | 262 | } |
| 265 | 263 | |
| 266 | 264 | test "big.int string set number with underscores" { |
| 267 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 268 | ||
| 269 | 265 | var a = try Managed.init(testing.allocator); |
| 270 | 266 | defer a.deinit(); |
| 271 | 267 | |
| ... | ... | @@ -274,8 +270,6 @@ test "big.int string set number with underscores" { |
| 274 | 270 | } |
| 275 | 271 | |
| 276 | 272 | test "big.int string set case insensitive number" { |
| 277 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 278 | ||
| 279 | 273 | var a = try Managed.init(testing.allocator); |
| 280 | 274 | defer a.deinit(); |
| 281 | 275 | |
| ... | ... | @@ -326,8 +320,6 @@ test "big.int twos complement limit set" { |
| 326 | 320 | } |
| 327 | 321 | |
| 328 | 322 | test "big.int string to" { |
| 329 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 330 | ||
| 331 | 323 | var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124); |
| 332 | 324 | defer a.deinit(); |
| 333 | 325 | |
| ... | ... | @@ -368,8 +360,6 @@ test "big.int string to base 16" { |
| 368 | 360 | } |
| 369 | 361 | |
| 370 | 362 | test "big.int neg string to" { |
| 371 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 372 | ||
| 373 | 363 | var a = try Managed.initSet(testing.allocator, -123907434); |
| 374 | 364 | defer a.deinit(); |
| 375 | 365 | |
| ... | ... | @@ -392,8 +382,6 @@ test "big.int zero string to" { |
| 392 | 382 | } |
| 393 | 383 | |
| 394 | 384 | test "big.int clone" { |
| 395 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 396 | ||
| 397 | 385 | var a = try Managed.initSet(testing.allocator, 1234); |
| 398 | 386 | defer a.deinit(); |
| 399 | 387 | var b = try a.clone(); |
| ... | ... | @@ -634,8 +622,6 @@ test "big.int addWrap single-single, unsigned" { |
| 634 | 622 | } |
| 635 | 623 | |
| 636 | 624 | test "big.int subWrap single-single, unsigned" { |
| 637 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 638 | ||
| 639 | 625 | var a = try Managed.initSet(testing.allocator, 0); |
| 640 | 626 | defer a.deinit(); |
| 641 | 627 | |
| ... | ... | @@ -963,8 +949,6 @@ test "big.int mul multi-multi" { |
| 963 | 949 | } |
| 964 | 950 | |
| 965 | 951 | test "big.int mul alias r with a" { |
| 966 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 967 | ||
| 968 | 952 | var a = try Managed.initSet(testing.allocator, maxInt(Limb)); |
| 969 | 953 | defer a.deinit(); |
| 970 | 954 | var b = try Managed.initSet(testing.allocator, 2); |
| ... | ... | @@ -976,8 +960,6 @@ test "big.int mul alias r with a" { |
| 976 | 960 | } |
| 977 | 961 | |
| 978 | 962 | test "big.int mul alias r with b" { |
| 979 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 980 | ||
| 981 | 963 | var a = try Managed.initSet(testing.allocator, maxInt(Limb)); |
| 982 | 964 | defer a.deinit(); |
| 983 | 965 | var b = try Managed.initSet(testing.allocator, 2); |
| ... | ... | @@ -989,8 +971,6 @@ test "big.int mul alias r with b" { |
| 989 | 971 | } |
| 990 | 972 | |
| 991 | 973 | test "big.int mul alias r with a and b" { |
| 992 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 993 | ||
| 994 | 974 | var a = try Managed.initSet(testing.allocator, maxInt(Limb)); |
| 995 | 975 | defer a.deinit(); |
| 996 | 976 | |
| ... | ... | @@ -1096,7 +1076,7 @@ test "big.int mulWrap multi-multi unsigned" { |
| 1096 | 1076 | |
| 1097 | 1077 | test "big.int mulWrap multi-multi signed" { |
| 1098 | 1078 | switch (builtin.zig_backend) { |
| 1099 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1079 | .stage2_c => return error.SkipZigTest, | |
| 1100 | 1080 | else => {}, |
| 1101 | 1081 | } |
| 1102 | 1082 | |
| ... | ... | @@ -1171,8 +1151,6 @@ test "big.int div single-half with rem" { |
| 1171 | 1151 | } |
| 1172 | 1152 | |
| 1173 | 1153 | test "big.int div single-single no rem" { |
| 1174 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1175 | ||
| 1176 | 1154 | // assumes usize is <= 64 bits. |
| 1177 | 1155 | var a = try Managed.initSet(testing.allocator, 1 << 52); |
| 1178 | 1156 | defer a.deinit(); |
| ... | ... | @@ -1190,8 +1168,6 @@ test "big.int div single-single no rem" { |
| 1190 | 1168 | } |
| 1191 | 1169 | |
| 1192 | 1170 | test "big.int div single-single with rem" { |
| 1193 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1194 | ||
| 1195 | 1171 | var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33)); |
| 1196 | 1172 | defer a.deinit(); |
| 1197 | 1173 | var b = try Managed.initSet(testing.allocator, (1 << 35)); |
| ... | ... | @@ -1271,8 +1247,6 @@ test "big.int div multi>2-single" { |
| 1271 | 1247 | } |
| 1272 | 1248 | |
| 1273 | 1249 | test "big.int div single-single q < r" { |
| 1274 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1275 | ||
| 1276 | 1250 | var a = try Managed.initSet(testing.allocator, 0x0078f432); |
| 1277 | 1251 | defer a.deinit(); |
| 1278 | 1252 | var b = try Managed.initSet(testing.allocator, 0x01000000); |
| ... | ... | @@ -1317,10 +1291,7 @@ test "big.int div q=0 alias" { |
| 1317 | 1291 | } |
| 1318 | 1292 | |
| 1319 | 1293 | test "big.int div multi-multi q < r" { |
| 1320 | switch (builtin.zig_backend) { | |
| 1321 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1322 | else => {}, | |
| 1323 | } | |
| 1294 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1324 | 1295 | |
| 1325 | 1296 | const op1 = 0x1ffffffff0078f432; |
| 1326 | 1297 | const op2 = 0x1ffffffff01000000; |
| ... | ... | @@ -1642,8 +1613,6 @@ test "big.int div floor single-single -/-" { |
| 1642 | 1613 | } |
| 1643 | 1614 | |
| 1644 | 1615 | test "big.int div floor no remainder negative quotient" { |
| 1645 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1646 | ||
| 1647 | 1616 | const u: i32 = -0x80000000; |
| 1648 | 1617 | const v: i32 = 1; |
| 1649 | 1618 | |
| ... | ... | @@ -1743,10 +1712,7 @@ test "big.int div multi-multi no rem" { |
| 1743 | 1712 | } |
| 1744 | 1713 | |
| 1745 | 1714 | test "big.int div multi-multi (2 branch)" { |
| 1746 | switch (builtin.zig_backend) { | |
| 1747 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1748 | else => {}, | |
| 1749 | } | |
| 1715 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1750 | 1716 | |
| 1751 | 1717 | var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111); |
| 1752 | 1718 | defer a.deinit(); |
| ... | ... | @@ -1785,10 +1751,7 @@ test "big.int div multi-multi (3.1/3.3 branch)" { |
| 1785 | 1751 | } |
| 1786 | 1752 | |
| 1787 | 1753 | test "big.int div multi-single zero-limb trailing" { |
| 1788 | switch (builtin.zig_backend) { | |
| 1789 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1790 | else => {}, | |
| 1791 | } | |
| 1754 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1792 | 1755 | |
| 1793 | 1756 | var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000); |
| 1794 | 1757 | defer a.deinit(); |
| ... | ... | @@ -1808,10 +1771,7 @@ test "big.int div multi-single zero-limb trailing" { |
| 1808 | 1771 | } |
| 1809 | 1772 | |
| 1810 | 1773 | test "big.int div multi-multi zero-limb trailing (with rem)" { |
| 1811 | switch (builtin.zig_backend) { | |
| 1812 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1813 | else => {}, | |
| 1814 | } | |
| 1774 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1815 | 1775 | |
| 1816 | 1776 | var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000); |
| 1817 | 1777 | defer a.deinit(); |
| ... | ... | @@ -1908,8 +1868,6 @@ test "big.int div multi-multi fuzz case #1" { |
| 1908 | 1868 | } |
| 1909 | 1869 | |
| 1910 | 1870 | test "big.int div multi-multi fuzz case #2" { |
| 1911 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1912 | ||
| 1913 | 1871 | var a = try Managed.init(testing.allocator); |
| 1914 | 1872 | defer a.deinit(); |
| 1915 | 1873 | var b = try Managed.init(testing.allocator); |
| ... | ... | @@ -2672,8 +2630,6 @@ test "big.int mutable to managed" { |
| 2672 | 2630 | } |
| 2673 | 2631 | |
| 2674 | 2632 | test "big.int const to managed" { |
| 2675 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2676 | ||
| 2677 | 2633 | var a = try Managed.initSet(testing.allocator, 123423453456); |
| 2678 | 2634 | defer a.deinit(); |
| 2679 | 2635 |
lib/std/math/big/rational.zig-6| ... | ... | @@ -494,8 +494,6 @@ fn extractLowBits(a: Int, comptime T: type) T { |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | test "big.rational extractLowBits" { |
| 497 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 498 | ||
| 499 | 497 | var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321); |
| 500 | 498 | defer a.deinit(); |
| 501 | 499 | |
| ... | ... | @@ -649,8 +647,6 @@ test "big.rational copy" { |
| 649 | 647 | } |
| 650 | 648 | |
| 651 | 649 | test "big.rational negate" { |
| 652 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 653 | ||
| 654 | 650 | var a = try Rational.init(testing.allocator); |
| 655 | 651 | defer a.deinit(); |
| 656 | 652 | |
| ... | ... | @@ -668,8 +664,6 @@ test "big.rational negate" { |
| 668 | 664 | } |
| 669 | 665 | |
| 670 | 666 | test "big.rational abs" { |
| 671 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 672 | ||
| 673 | 667 | var a = try Rational.init(testing.allocator); |
| 674 | 668 | defer a.deinit(); |
| 675 | 669 |
lib/std/math/log10.zig-1| ... | ... | @@ -147,7 +147,6 @@ test "oldlog10 doesn't work" { |
| 147 | 147 | test "log10_int vs old implementation" { |
| 148 | 148 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 149 | 149 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 150 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 151 | 150 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 152 | 151 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 153 | 152 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
lib/std/math/log_int.zig-2| ... | ... | @@ -56,8 +56,6 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) { |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | test "math.log_int" { |
| 59 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 60 | ||
| 61 | 59 | // Test all unsigned integers with 2, 3, ..., 64 bits. |
| 62 | 60 | // We cannot test 0 or 1 bits since base must be > 1. |
| 63 | 61 | inline for (2..64 + 1) |bits| { |
lib/std/math/nextafter.zig+1-2| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | 1 | const std = @import("../std.zig"); |
| 3 | 2 | const math = std.math; |
| 4 | 3 | const assert = std.debug.assert; |
| ... | ... | @@ -103,7 +102,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T { |
| 103 | 102 | } |
| 104 | 103 | |
| 105 | 104 | test "math.nextAfter.int" { |
| 106 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 105 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 107 | 106 | |
| 108 | 107 | try expect(nextAfter(i0, 0, 0) == 0); |
| 109 | 108 | try expect(nextAfter(u0, 0, 0) == 0); |
lib/std/mem.zig-4| ... | ... | @@ -1741,8 +1741,6 @@ pub fn readIntSlice(comptime T: type, bytes: []const u8, endian: Endian) T { |
| 1741 | 1741 | } |
| 1742 | 1742 | |
| 1743 | 1743 | test "comptime read/write int" { |
| 1744 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1745 | ||
| 1746 | 1744 | comptime { |
| 1747 | 1745 | var bytes: [2]u8 = undefined; |
| 1748 | 1746 | writeIntLittle(u16, &bytes, 0x1234); |
| ... | ... | @@ -3309,8 +3307,6 @@ test "testStringEquality" { |
| 3309 | 3307 | } |
| 3310 | 3308 | |
| 3311 | 3309 | test "testReadInt" { |
| 3312 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 3313 | ||
| 3314 | 3310 | try testReadIntImpl(); |
| 3315 | 3311 | try comptime testReadIntImpl(); |
| 3316 | 3312 | } |
lib/std/multi_array_list.zig-16| ... | ... | @@ -583,8 +583,6 @@ pub fn MultiArrayList(comptime T: type) type { |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | test "basic usage" { |
| 586 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 587 | ||
| 588 | 586 | const ally = testing.allocator; |
| 589 | 587 | |
| 590 | 588 | const Foo = struct { |
| ... | ... | @@ -679,8 +677,6 @@ test "basic usage" { |
| 679 | 677 | // This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes |
| 680 | 678 | // function used the @reduce code path. |
| 681 | 679 | test "regression test for @reduce bug" { |
| 682 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 683 | ||
| 684 | 680 | const ally = testing.allocator; |
| 685 | 681 | var list = MultiArrayList(struct { |
| 686 | 682 | tag: std.zig.Token.Tag, |
| ... | ... | @@ -758,8 +754,6 @@ test "regression test for @reduce bug" { |
| 758 | 754 | } |
| 759 | 755 | |
| 760 | 756 | test "ensure capacity on empty list" { |
| 761 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 762 | ||
| 763 | 757 | const ally = testing.allocator; |
| 764 | 758 | |
| 765 | 759 | const Foo = struct { |
| ... | ... | @@ -795,8 +789,6 @@ test "ensure capacity on empty list" { |
| 795 | 789 | } |
| 796 | 790 | |
| 797 | 791 | test "insert elements" { |
| 798 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 799 | ||
| 800 | 792 | const ally = testing.allocator; |
| 801 | 793 | |
| 802 | 794 | const Foo = struct { |
| ... | ... | @@ -816,8 +808,6 @@ test "insert elements" { |
| 816 | 808 | } |
| 817 | 809 | |
| 818 | 810 | test "union" { |
| 819 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 820 | ||
| 821 | 811 | const ally = testing.allocator; |
| 822 | 812 | |
| 823 | 813 | const Foo = union(enum) { |
| ... | ... | @@ -873,8 +863,6 @@ test "union" { |
| 873 | 863 | } |
| 874 | 864 | |
| 875 | 865 | test "sorting a span" { |
| 876 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 877 | ||
| 878 | 866 | var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{}; |
| 879 | 867 | defer list.deinit(testing.allocator); |
| 880 | 868 | |
| ... | ... | @@ -915,8 +903,6 @@ test "sorting a span" { |
| 915 | 903 | } |
| 916 | 904 | |
| 917 | 905 | test "0 sized struct field" { |
| 918 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 919 | ||
| 920 | 906 | const ally = testing.allocator; |
| 921 | 907 | |
| 922 | 908 | const Foo = struct { |
| ... | ... | @@ -944,8 +930,6 @@ test "0 sized struct field" { |
| 944 | 930 | } |
| 945 | 931 | |
| 946 | 932 | test "0 sized struct" { |
| 947 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 948 | ||
| 949 | 933 | const ally = testing.allocator; |
| 950 | 934 | |
| 951 | 935 | const Foo = struct { |
lib/std/net/test.zig+1-2| ... | ... | @@ -109,9 +109,8 @@ test "parse and render UNIX addresses" { |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | test "resolve DNS" { |
| 112 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 113 | ||
| 114 | 112 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 113 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 115 | 114 | |
| 116 | 115 | if (builtin.os.tag == .windows) { |
| 117 | 116 | _ = try std.os.windows.WSAStartup(2, 2); |
lib/std/rand/test.zig-2| ... | ... | @@ -443,8 +443,6 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void { |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | test "CSPRNG" { |
| 446 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 447 | ||
| 448 | 446 | var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined; |
| 449 | 447 | std.crypto.random.bytes(&secret_seed); |
| 450 | 448 | var csprng = DefaultCsprng.init(secret_seed); |
lib/std/segmented_list.zig-2| ... | ... | @@ -409,8 +409,6 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | test "SegmentedList basic usage" { |
| 412 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 413 | ||
| 414 | 412 | try testSegmentedList(0); |
| 415 | 413 | try testSegmentedList(1); |
| 416 | 414 | try testSegmentedList(2); |
lib/std/simd.zig+8-3| ... | ... | @@ -13,7 +13,7 @@ pub fn suggestVectorSizeForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ? |
| 13 | 13 | const vector_bit_size: u16 = blk: { |
| 14 | 14 | if (cpu.arch.isX86()) { |
| 15 | 15 | if (T == bool and std.Target.x86.featureSetHas(cpu.features, .prefer_mask_registers)) return 64; |
| 16 | if (std.Target.x86.featureSetHas(cpu.features, .avx512f) and !std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .prefer_128_bit })) break :blk 512; | |
| 16 | if (builtin.zig_backend != .stage2_x86_64 and std.Target.x86.featureSetHas(cpu.features, .avx512f) and !std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .prefer_128_bit })) break :blk 512; | |
| 17 | 17 | if (std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .avx2 }) and !std.Target.x86.featureSetHas(cpu.features, .prefer_128_bit)) break :blk 256; |
| 18 | 18 | if (std.Target.x86.featureSetHas(cpu.features, .sse)) break :blk 128; |
| 19 | 19 | if (std.Target.x86.featureSetHasAny(cpu.features, .{ .mmx, .@"3dnow" })) break :blk 64; |
| ... | ... | @@ -62,10 +62,15 @@ pub fn suggestVectorSize(comptime T: type) ?comptime_int { |
| 62 | 62 | test "suggestVectorSizeForCpu works with signed and unsigned values" { |
| 63 | 63 | comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64); |
| 64 | 64 | comptime cpu.features.addFeature(@intFromEnum(std.Target.x86.Feature.avx512f)); |
| 65 | comptime cpu.features.populateDependencies(&std.Target.x86.all_features); | |
| 66 | const expected_size: usize = switch (builtin.zig_backend) { | |
| 67 | .stage2_x86_64 => 8, | |
| 68 | else => 16, | |
| 69 | }; | |
| 65 | 70 | const signed_integer_size = suggestVectorSizeForCpu(i32, cpu).?; |
| 66 | 71 | const unsigned_integer_size = suggestVectorSizeForCpu(u32, cpu).?; |
| 67 | try std.testing.expectEqual(@as(usize, 16), unsigned_integer_size); | |
| 68 | try std.testing.expectEqual(@as(usize, 16), signed_integer_size); | |
| 72 | try std.testing.expectEqual(expected_size, unsigned_integer_size); | |
| 73 | try std.testing.expectEqual(expected_size, signed_integer_size); | |
| 69 | 74 | } |
| 70 | 75 | |
| 71 | 76 | fn vectorLength(comptime VectorType: type) comptime_int { |
lib/std/sort.zig-11| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | 2 | const assert = std.debug.assert; |
| 3 | const builtin = @import("builtin"); | |
| 4 | 3 | const testing = std.testing; |
| 5 | 4 | const mem = std.mem; |
| 6 | 5 | const math = std.math; |
| ... | ... | @@ -177,8 +176,6 @@ const IdAndValue = struct { |
| 177 | 176 | }; |
| 178 | 177 | |
| 179 | 178 | test "stable sort" { |
| 180 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 181 | ||
| 182 | 179 | const expected = [_]IdAndValue{ |
| 183 | 180 | IdAndValue{ .id = 0, .value = 0 }, |
| 184 | 181 | IdAndValue{ .id = 1, .value = 0 }, |
| ... | ... | @@ -226,8 +223,6 @@ test "stable sort" { |
| 226 | 223 | } |
| 227 | 224 | |
| 228 | 225 | test "sort" { |
| 229 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 230 | ||
| 231 | 226 | const u8cases = [_][]const []const u8{ |
| 232 | 227 | &[_][]const u8{ |
| 233 | 228 | "", |
| ... | ... | @@ -306,8 +301,6 @@ test "sort" { |
| 306 | 301 | } |
| 307 | 302 | |
| 308 | 303 | test "sort descending" { |
| 309 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 310 | ||
| 311 | 304 | const rev_cases = [_][]const []const i32{ |
| 312 | 305 | &[_][]const i32{ |
| 313 | 306 | &[_]i32{}, |
| ... | ... | @@ -347,8 +340,6 @@ test "sort descending" { |
| 347 | 340 | } |
| 348 | 341 | |
| 349 | 342 | test "sort with context in the middle of a slice" { |
| 350 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 351 | ||
| 352 | 343 | const Context = struct { |
| 353 | 344 | items: []i32, |
| 354 | 345 | |
| ... | ... | @@ -388,8 +379,6 @@ test "sort with context in the middle of a slice" { |
| 388 | 379 | } |
| 389 | 380 | |
| 390 | 381 | test "sort fuzz testing" { |
| 391 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 392 | ||
| 393 | 382 | var prng = std.rand.DefaultPrng.init(0x12345678); |
| 394 | 383 | const random = prng.random(); |
| 395 | 384 | const test_case_count = 10; |
lib/std/unicode.zig-41| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | const std = @import("./std.zig"); |
| 2 | 2 | const assert = std.debug.assert; |
| 3 | const builtin = @import("builtin"); | |
| 4 | 3 | const testing = std.testing; |
| 5 | 4 | const mem = std.mem; |
| 6 | 5 | |
| ... | ... | @@ -497,15 +496,11 @@ fn testUtf16CountCodepoints() !void { |
| 497 | 496 | } |
| 498 | 497 | |
| 499 | 498 | test "utf16 count codepoints" { |
| 500 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 501 | ||
| 502 | 499 | try testUtf16CountCodepoints(); |
| 503 | 500 | try comptime testUtf16CountCodepoints(); |
| 504 | 501 | } |
| 505 | 502 | |
| 506 | 503 | test "utf8 encode" { |
| 507 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 508 | ||
| 509 | 504 | try comptime testUtf8Encode(); |
| 510 | 505 | try testUtf8Encode(); |
| 511 | 506 | } |
| ... | ... | @@ -532,8 +527,6 @@ fn testUtf8Encode() !void { |
| 532 | 527 | } |
| 533 | 528 | |
| 534 | 529 | test "utf8 encode error" { |
| 535 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 536 | ||
| 537 | 530 | try comptime testUtf8EncodeError(); |
| 538 | 531 | try testUtf8EncodeError(); |
| 539 | 532 | } |
| ... | ... | @@ -550,8 +543,6 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void { |
| 550 | 543 | } |
| 551 | 544 | |
| 552 | 545 | test "utf8 iterator on ascii" { |
| 553 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 554 | ||
| 555 | 546 | try comptime testUtf8IteratorOnAscii(); |
| 556 | 547 | try testUtf8IteratorOnAscii(); |
| 557 | 548 | } |
| ... | ... | @@ -572,8 +563,6 @@ fn testUtf8IteratorOnAscii() !void { |
| 572 | 563 | } |
| 573 | 564 | |
| 574 | 565 | test "utf8 view bad" { |
| 575 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 576 | ||
| 577 | 566 | try comptime testUtf8ViewBad(); |
| 578 | 567 | try testUtf8ViewBad(); |
| 579 | 568 | } |
| ... | ... | @@ -584,8 +573,6 @@ fn testUtf8ViewBad() !void { |
| 584 | 573 | } |
| 585 | 574 | |
| 586 | 575 | test "utf8 view ok" { |
| 587 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 588 | ||
| 589 | 576 | try comptime testUtf8ViewOk(); |
| 590 | 577 | try testUtf8ViewOk(); |
| 591 | 578 | } |
| ... | ... | @@ -606,8 +593,6 @@ fn testUtf8ViewOk() !void { |
| 606 | 593 | } |
| 607 | 594 | |
| 608 | 595 | test "validate slice" { |
| 609 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 610 | ||
| 611 | 596 | try comptime testValidateSlice(); |
| 612 | 597 | try testValidateSlice(); |
| 613 | 598 | |
| ... | ... | @@ -648,8 +633,6 @@ fn testValidateSlice() !void { |
| 648 | 633 | } |
| 649 | 634 | |
| 650 | 635 | test "valid utf8" { |
| 651 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 652 | ||
| 653 | 636 | try comptime testValidUtf8(); |
| 654 | 637 | try testValidUtf8(); |
| 655 | 638 | } |
| ... | ... | @@ -669,8 +652,6 @@ fn testValidUtf8() !void { |
| 669 | 652 | } |
| 670 | 653 | |
| 671 | 654 | test "invalid utf8 continuation bytes" { |
| 672 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 673 | ||
| 674 | 655 | try comptime testInvalidUtf8ContinuationBytes(); |
| 675 | 656 | try testInvalidUtf8ContinuationBytes(); |
| 676 | 657 | } |
| ... | ... | @@ -703,8 +684,6 @@ fn testInvalidUtf8ContinuationBytes() !void { |
| 703 | 684 | } |
| 704 | 685 | |
| 705 | 686 | test "overlong utf8 codepoint" { |
| 706 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 707 | ||
| 708 | 687 | try comptime testOverlongUtf8Codepoint(); |
| 709 | 688 | try testOverlongUtf8Codepoint(); |
| 710 | 689 | } |
| ... | ... | @@ -718,8 +697,6 @@ fn testOverlongUtf8Codepoint() !void { |
| 718 | 697 | } |
| 719 | 698 | |
| 720 | 699 | test "misc invalid utf8" { |
| 721 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 722 | ||
| 723 | 700 | try comptime testMiscInvalidUtf8(); |
| 724 | 701 | try testMiscInvalidUtf8(); |
| 725 | 702 | } |
| ... | ... | @@ -735,8 +712,6 @@ fn testMiscInvalidUtf8() !void { |
| 735 | 712 | } |
| 736 | 713 | |
| 737 | 714 | test "utf8 iterator peeking" { |
| 738 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 739 | ||
| 740 | 715 | try comptime testUtf8Peeking(); |
| 741 | 716 | try testUtf8Peeking(); |
| 742 | 717 | } |
| ... | ... | @@ -821,8 +796,6 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize { |
| 821 | 796 | } |
| 822 | 797 | |
| 823 | 798 | test "utf16leToUtf8" { |
| 824 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 825 | ||
| 826 | 799 | var utf16le: [2]u16 = undefined; |
| 827 | 800 | const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]); |
| 828 | 801 | |
| ... | ... | @@ -935,8 +908,6 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize { |
| 935 | 908 | } |
| 936 | 909 | |
| 937 | 910 | test "utf8ToUtf16Le" { |
| 938 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 939 | ||
| 940 | 911 | var utf16le: [2]u16 = [_]u16{0} ** 2; |
| 941 | 912 | { |
| 942 | 913 | const length = try utf8ToUtf16Le(utf16le[0..], "𐐷"); |
| ... | ... | @@ -955,8 +926,6 @@ test "utf8ToUtf16Le" { |
| 955 | 926 | } |
| 956 | 927 | |
| 957 | 928 | test "utf8ToUtf16LeWithNull" { |
| 958 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 959 | ||
| 960 | 929 | { |
| 961 | 930 | const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷"); |
| 962 | 931 | defer testing.allocator.free(utf16); |
| ... | ... | @@ -1015,8 +984,6 @@ fn testCalcUtf16LeLen() !void { |
| 1015 | 984 | } |
| 1016 | 985 | |
| 1017 | 986 | test "calculate utf16 string length of given utf8 string in u16" { |
| 1018 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1019 | ||
| 1020 | 987 | try testCalcUtf16LeLen(); |
| 1021 | 988 | try comptime testCalcUtf16LeLen(); |
| 1022 | 989 | } |
| ... | ... | @@ -1050,8 +1017,6 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) { |
| 1050 | 1017 | } |
| 1051 | 1018 | |
| 1052 | 1019 | test "fmtUtf16le" { |
| 1053 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1054 | ||
| 1055 | 1020 | const expectFmt = std.testing.expectFmt; |
| 1056 | 1021 | try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))}); |
| 1057 | 1022 | try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))}); |
| ... | ... | @@ -1065,8 +1030,6 @@ test "fmtUtf16le" { |
| 1065 | 1030 | } |
| 1066 | 1031 | |
| 1067 | 1032 | test "utf8ToUtf16LeStringLiteral" { |
| 1068 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1069 | ||
| 1070 | 1033 | { |
| 1071 | 1034 | const bytes = [_:0]u16{ |
| 1072 | 1035 | mem.nativeToLittle(u16, 0x41), |
| ... | ... | @@ -1127,8 +1090,6 @@ fn testUtf8CountCodepoints() !void { |
| 1127 | 1090 | } |
| 1128 | 1091 | |
| 1129 | 1092 | test "utf8 count codepoints" { |
| 1130 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1131 | ||
| 1132 | 1093 | try testUtf8CountCodepoints(); |
| 1133 | 1094 | try comptime testUtf8CountCodepoints(); |
| 1134 | 1095 | } |
| ... | ... | @@ -1145,8 +1106,6 @@ fn testUtf8ValidCodepoint() !void { |
| 1145 | 1106 | } |
| 1146 | 1107 | |
| 1147 | 1108 | test "utf8 valid codepoint" { |
| 1148 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1149 | ||
| 1150 | 1109 | try testUtf8ValidCodepoint(); |
| 1151 | 1110 | try comptime testUtf8ValidCodepoint(); |
| 1152 | 1111 | } |
lib/std/zig/fmt.zig+1-2| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const mem = std.mem; |
| 4 | 3 | |
| 5 | 4 | /// Print the string as a Zig identifier escaping it with @"" syntax if needed. |
| ... | ... | @@ -96,7 +95,7 @@ pub fn fmtEscapes(bytes: []const u8) std.fmt.Formatter(stringEscape) { |
| 96 | 95 | } |
| 97 | 96 | |
| 98 | 97 | test "escape invalid identifiers" { |
| 99 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 98 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 100 | 99 | |
| 101 | 100 | const expectFmt = std.testing.expectFmt; |
| 102 | 101 | try expectFmt("@\"while\"", "{}", .{fmtId("while")}); |
lib/std/zig/tokenizer.zig-2| ... | ... | @@ -1481,8 +1481,6 @@ test "utf8" { |
| 1481 | 1481 | } |
| 1482 | 1482 | |
| 1483 | 1483 | test "invalid utf8" { |
| 1484 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1485 | ||
| 1486 | 1484 | try testTokenize("//\x80", &.{ |
| 1487 | 1485 | .invalid, |
| 1488 | 1486 | }); |
src/arch/x86_64/CodeGen.zig+354-53| ... | ... | @@ -656,11 +656,14 @@ const InstTracking = struct { |
| 656 | 656 | fn reuse( |
| 657 | 657 | self: *InstTracking, |
| 658 | 658 | function: *Self, |
| 659 | new_inst: Air.Inst.Index, | |
| 659 | new_inst: ?Air.Inst.Index, | |
| 660 | 660 | old_inst: Air.Inst.Index, |
| 661 | 661 | ) void { |
| 662 | 662 | self.short = .{ .dead = function.scope_generation }; |
| 663 | tracking_log.debug("%{d} => {} (reuse %{d})", .{ new_inst, self.*, old_inst }); | |
| 663 | if (new_inst) |inst| | |
| 664 | tracking_log.debug("%{d} => {} (reuse %{d})", .{ inst, self.*, old_inst }) | |
| 665 | else | |
| 666 | tracking_log.debug("tmp => {} (reuse %{d})", .{ self.*, old_inst }); | |
| 664 | 667 | } |
| 665 | 668 | |
| 666 | 669 | fn liveOut(self: *InstTracking, function: *Self, inst: Air.Inst.Index) void { |
| ... | ... | @@ -1560,24 +1563,58 @@ fn asmRegisterMemoryImmediate( |
| 1560 | 1563 | m: Memory, |
| 1561 | 1564 | imm: Immediate, |
| 1562 | 1565 | ) !void { |
| 1563 | _ = try self.addInst(.{ | |
| 1564 | .tag = tag[1], | |
| 1565 | .ops = switch (m) { | |
| 1566 | .sib => .rmi_sib, | |
| 1567 | .rip => .rmi_rip, | |
| 1566 | if (switch (imm) { | |
| 1567 | .signed => |s| if (math.cast(i16, s)) |x| @as(u16, @bitCast(x)) else null, | |
| 1568 | .unsigned => |u| math.cast(u16, u), | |
| 1569 | }) |small_imm| { | |
| 1570 | _ = try self.addInst(.{ | |
| 1571 | .tag = tag[1], | |
| 1572 | .ops = switch (m) { | |
| 1573 | .sib => .rmi_sib, | |
| 1574 | .rip => .rmi_rip, | |
| 1575 | else => unreachable, | |
| 1576 | }, | |
| 1577 | .data = .{ .rix = .{ | |
| 1578 | .fixes = tag[0], | |
| 1579 | .r1 = reg, | |
| 1580 | .i = small_imm, | |
| 1581 | .payload = switch (m) { | |
| 1582 | .sib => try self.addExtra(Mir.MemorySib.encode(m)), | |
| 1583 | .rip => try self.addExtra(Mir.MemoryRip.encode(m)), | |
| 1584 | else => unreachable, | |
| 1585 | }, | |
| 1586 | } }, | |
| 1587 | }); | |
| 1588 | } else { | |
| 1589 | const payload = try self.addExtra(Mir.Imm32{ .imm = switch (imm) { | |
| 1590 | .signed => |s| @bitCast(s), | |
| 1591 | .unsigned => unreachable, | |
| 1592 | } }); | |
| 1593 | assert(payload + 1 == switch (m) { | |
| 1594 | .sib => try self.addExtra(Mir.MemorySib.encode(m)), | |
| 1595 | .rip => try self.addExtra(Mir.MemoryRip.encode(m)), | |
| 1568 | 1596 | else => unreachable, |
| 1569 | }, | |
| 1570 | .data = .{ .rix = .{ | |
| 1571 | .fixes = tag[0], | |
| 1572 | .r1 = reg, | |
| 1573 | .i = @as(u8, @intCast(imm.unsigned)), | |
| 1574 | .payload = switch (m) { | |
| 1575 | .sib => try self.addExtra(Mir.MemorySib.encode(m)), | |
| 1576 | .rip => try self.addExtra(Mir.MemoryRip.encode(m)), | |
| 1597 | }); | |
| 1598 | _ = try self.addInst(.{ | |
| 1599 | .tag = tag[1], | |
| 1600 | .ops = switch (m) { | |
| 1601 | .sib => switch (imm) { | |
| 1602 | .signed => .rmi_sib_s, | |
| 1603 | .unsigned => .rmi_sib_u, | |
| 1604 | }, | |
| 1605 | .rip => switch (imm) { | |
| 1606 | .signed => .rmi_rip_s, | |
| 1607 | .unsigned => .rmi_rip_u, | |
| 1608 | }, | |
| 1577 | 1609 | else => unreachable, |
| 1578 | 1610 | }, |
| 1579 | } }, | |
| 1580 | }); | |
| 1611 | .data = .{ .rx = .{ | |
| 1612 | .fixes = tag[0], | |
| 1613 | .r1 = reg, | |
| 1614 | .payload = payload, | |
| 1615 | } }, | |
| 1616 | }); | |
| 1617 | } | |
| 1581 | 1618 | } |
| 1582 | 1619 | |
| 1583 | 1620 | fn asmRegisterRegisterMemoryImmediate( |
| ... | ... | @@ -3713,14 +3750,22 @@ fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue |
| 3713 | 3750 | else => unreachable, |
| 3714 | 3751 | .mul => {}, |
| 3715 | 3752 | .div => switch (tag[0]) { |
| 3716 | ._ => try self.asmRegisterRegister(.{ ._, .xor }, .edx, .edx), | |
| 3717 | .i_ => switch (self.regBitSize(ty)) { | |
| 3718 | 8 => try self.asmOpOnly(.{ ._, .cbw }), | |
| 3719 | 16 => try self.asmOpOnly(.{ ._, .cwd }), | |
| 3720 | 32 => try self.asmOpOnly(.{ ._, .cdq }), | |
| 3721 | 64 => try self.asmOpOnly(.{ ._, .cqo }), | |
| 3722 | else => unreachable, | |
| 3753 | ._ => { | |
| 3754 | const hi_reg: Register = | |
| 3755 | switch (self.regBitSize(ty)) { | |
| 3756 | 8 => .ah, | |
| 3757 | 16, 32, 64 => .edx, | |
| 3758 | else => unreachable, | |
| 3759 | }; | |
| 3760 | try self.asmRegisterRegister(.{ ._, .xor }, hi_reg, hi_reg); | |
| 3723 | 3761 | }, |
| 3762 | .i_ => try self.asmOpOnly(.{ ._, switch (self.regBitSize(ty)) { | |
| 3763 | 8 => .cbw, | |
| 3764 | 16 => .cwd, | |
| 3765 | 32 => .cdq, | |
| 3766 | 64 => .cqo, | |
| 3767 | else => unreachable, | |
| 3768 | } }), | |
| 3724 | 3769 | else => unreachable, |
| 3725 | 3770 | }, |
| 3726 | 3771 | } |
| ... | ... | @@ -5210,13 +5255,11 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type) |
| 5210 | 5255 | .child = (try mod.intType(.signed, scalar_bits)).ip_index, |
| 5211 | 5256 | }); |
| 5212 | 5257 | |
| 5213 | const sign_val = switch (tag) { | |
| 5258 | const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = switch (tag) { | |
| 5214 | 5259 | .neg => try vec_ty.minInt(mod, vec_ty), |
| 5215 | 5260 | .abs => try vec_ty.maxInt(mod, vec_ty), |
| 5216 | 5261 | else => unreachable, |
| 5217 | }; | |
| 5218 | ||
| 5219 | const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = sign_val }); | |
| 5262 | } }); | |
| 5220 | 5263 | const sign_mem = if (sign_mcv.isMemory()) |
| 5221 | 5264 | sign_mcv.mem(Memory.PtrSize.fromSize(abi_size)) |
| 5222 | 5265 | else |
| ... | ... | @@ -5285,7 +5328,6 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type) |
| 5285 | 5328 | fn airFloatSign(self: *Self, inst: Air.Inst.Index) !void { |
| 5286 | 5329 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 5287 | 5330 | const ty = self.typeOf(un_op); |
| 5288 | ||
| 5289 | 5331 | return self.floatSign(inst, un_op, ty); |
| 5290 | 5332 | } |
| 5291 | 5333 | |
| ... | ... | @@ -5782,7 +5824,7 @@ fn reuseOperandAdvanced( |
| 5782 | 5824 | operand: Air.Inst.Ref, |
| 5783 | 5825 | op_index: Liveness.OperandInt, |
| 5784 | 5826 | mcv: MCValue, |
| 5785 | tracked_inst: Air.Inst.Index, | |
| 5827 | maybe_tracked_inst: ?Air.Inst.Index, | |
| 5786 | 5828 | ) bool { |
| 5787 | 5829 | if (!self.liveness.operandDies(inst, op_index)) |
| 5788 | 5830 | return false; |
| ... | ... | @@ -5791,11 +5833,13 @@ fn reuseOperandAdvanced( |
| 5791 | 5833 | .register, .register_pair => for (mcv.getRegs()) |reg| { |
| 5792 | 5834 | // If it's in the registers table, need to associate the register(s) with the |
| 5793 | 5835 | // new instruction. |
| 5794 | if (!self.register_manager.isRegFree(reg)) { | |
| 5795 | if (RegisterManager.indexOfRegIntoTracked(reg)) |index| { | |
| 5796 | self.register_manager.registers[index] = tracked_inst; | |
| 5836 | if (maybe_tracked_inst) |tracked_inst| { | |
| 5837 | if (!self.register_manager.isRegFree(reg)) { | |
| 5838 | if (RegisterManager.indexOfRegIntoTracked(reg)) |index| { | |
| 5839 | self.register_manager.registers[index] = tracked_inst; | |
| 5840 | } | |
| 5797 | 5841 | } |
| 5798 | } | |
| 5842 | } else self.register_manager.freeReg(reg); | |
| 5799 | 5843 | }, |
| 5800 | 5844 | .load_frame => |frame_addr| if (frame_addr.index.isNamed()) return false, |
| 5801 | 5845 | else => return false, |
| ... | ... | @@ -5804,7 +5848,7 @@ fn reuseOperandAdvanced( |
| 5804 | 5848 | // Prevent the operand deaths processing code from deallocating it. |
| 5805 | 5849 | self.liveness.clearOperandDeath(inst, op_index); |
| 5806 | 5850 | const op_inst = Air.refToIndex(operand).?; |
| 5807 | self.getResolvedInstValue(op_inst).reuse(self, tracked_inst, op_inst); | |
| 5851 | self.getResolvedInstValue(op_inst).reuse(self, maybe_tracked_inst, op_inst); | |
| 5808 | 5852 | |
| 5809 | 5853 | return true; |
| 5810 | 5854 | } |
| ... | ... | @@ -7234,12 +7278,18 @@ fn genBinOp( |
| 7234 | 7278 | if (maybe_mask_reg) |mask_reg| self.register_manager.lockRegAssumeUnused(mask_reg) else null; |
| 7235 | 7279 | defer if (mask_lock) |lock| self.register_manager.unlockReg(lock); |
| 7236 | 7280 | |
| 7237 | const lhs_mcv = try self.resolveInst(lhs_air); | |
| 7238 | const rhs_mcv = try self.resolveInst(rhs_air); | |
| 7281 | const ordered_air = if (lhs_ty.isVector(mod) and lhs_ty.childType(mod).isAbiInt(mod) and | |
| 7282 | switch (air_tag) { | |
| 7283 | .cmp_lt, .cmp_gte => true, | |
| 7284 | else => false, | |
| 7285 | }) .{ .lhs = rhs_air, .rhs = lhs_air } else .{ .lhs = lhs_air, .rhs = rhs_air }; | |
| 7286 | ||
| 7287 | const lhs_mcv = try self.resolveInst(ordered_air.lhs); | |
| 7288 | const rhs_mcv = try self.resolveInst(ordered_air.rhs); | |
| 7239 | 7289 | switch (lhs_mcv) { |
| 7240 | 7290 | .immediate => |imm| switch (imm) { |
| 7241 | 7291 | 0 => switch (air_tag) { |
| 7242 | .sub, .sub_wrap => return self.genUnOp(maybe_inst, .neg, rhs_air), | |
| 7292 | .sub, .sub_wrap => return self.genUnOp(maybe_inst, .neg, ordered_air.rhs), | |
| 7243 | 7293 | else => {}, |
| 7244 | 7294 | }, |
| 7245 | 7295 | else => {}, |
| ... | ... | @@ -7288,11 +7338,15 @@ fn genBinOp( |
| 7288 | 7338 | var copied_to_dst = true; |
| 7289 | 7339 | const dst_mcv: MCValue = dst: { |
| 7290 | 7340 | if (maybe_inst) |inst| { |
| 7291 | if ((!vec_op or lhs_mcv.isRegister()) and self.reuseOperand(inst, lhs_air, 0, lhs_mcv)) { | |
| 7341 | const tracked_inst = switch (air_tag) { | |
| 7342 | else => inst, | |
| 7343 | .cmp_lt, .cmp_lte, .cmp_eq, .cmp_gte, .cmp_gt, .cmp_neq => null, | |
| 7344 | }; | |
| 7345 | if ((!vec_op or lhs_mcv.isRegister()) and | |
| 7346 | self.reuseOperandAdvanced(inst, ordered_air.lhs, 0, lhs_mcv, tracked_inst)) | |
| 7292 | 7347 | break :dst lhs_mcv; |
| 7293 | } | |
| 7294 | 7348 | if (is_commutative and (!vec_op or rhs_mcv.isRegister()) and |
| 7295 | self.reuseOperand(inst, rhs_air, 1, rhs_mcv)) | |
| 7349 | self.reuseOperandAdvanced(inst, ordered_air.rhs, 1, rhs_mcv, tracked_inst)) | |
| 7296 | 7350 | { |
| 7297 | 7351 | flipped = true; |
| 7298 | 7352 | break :dst rhs_mcv; |
| ... | ... | @@ -7657,7 +7711,10 @@ fn genBinOp( |
| 7657 | 7711 | .sub, |
| 7658 | 7712 | .sub_wrap, |
| 7659 | 7713 | => if (self.hasFeature(.avx)) .{ .vp_b, .sub } else .{ .p_b, .sub }, |
| 7660 | .bit_and => if (self.hasFeature(.avx)) .{ .vp_, .@"and" } else .{ .p_, .@"and" }, | |
| 7714 | .bit_and => if (self.hasFeature(.avx)) | |
| 7715 | .{ .vp_, .@"and" } | |
| 7716 | else | |
| 7717 | .{ .p_, .@"and" }, | |
| 7661 | 7718 | .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" }, |
| 7662 | 7719 | .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor }, |
| 7663 | 7720 | .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { |
| ... | ... | @@ -7688,6 +7745,20 @@ fn genBinOp( |
| 7688 | 7745 | else |
| 7689 | 7746 | null, |
| 7690 | 7747 | }, |
| 7748 | .cmp_lt, | |
| 7749 | .cmp_lte, | |
| 7750 | .cmp_gte, | |
| 7751 | .cmp_gt, | |
| 7752 | => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { | |
| 7753 | .signed => if (self.hasFeature(.avx)) | |
| 7754 | .{ .vp_b, .cmpgt } | |
| 7755 | else | |
| 7756 | .{ .p_b, .cmpgt }, | |
| 7757 | .unsigned => null, | |
| 7758 | }, | |
| 7759 | .cmp_eq, | |
| 7760 | .cmp_neq, | |
| 7761 | => if (self.hasFeature(.avx)) .{ .vp_b, .cmpeq } else .{ .p_b, .cmpeq }, | |
| 7691 | 7762 | else => null, |
| 7692 | 7763 | }, |
| 7693 | 7764 | 17...32 => switch (air_tag) { |
| ... | ... | @@ -7708,6 +7779,17 @@ fn genBinOp( |
| 7708 | 7779 | .signed => if (self.hasFeature(.avx2)) .{ .vp_b, .maxs } else null, |
| 7709 | 7780 | .unsigned => if (self.hasFeature(.avx2)) .{ .vp_b, .maxu } else null, |
| 7710 | 7781 | }, |
| 7782 | .cmp_lt, | |
| 7783 | .cmp_lte, | |
| 7784 | .cmp_gte, | |
| 7785 | .cmp_gt, | |
| 7786 | => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { | |
| 7787 | .signed => if (self.hasFeature(.avx)) .{ .vp_b, .cmpgt } else null, | |
| 7788 | .unsigned => null, | |
| 7789 | }, | |
| 7790 | .cmp_eq, | |
| 7791 | .cmp_neq, | |
| 7792 | => if (self.hasFeature(.avx)) .{ .vp_b, .cmpeq } else null, | |
| 7711 | 7793 | else => null, |
| 7712 | 7794 | }, |
| 7713 | 7795 | else => null, |
| ... | ... | @@ -7723,7 +7805,10 @@ fn genBinOp( |
| 7723 | 7805 | .mul, |
| 7724 | 7806 | .mul_wrap, |
| 7725 | 7807 | => if (self.hasFeature(.avx)) .{ .vp_w, .mull } else .{ .p_d, .mull }, |
| 7726 | .bit_and => if (self.hasFeature(.avx)) .{ .vp_, .@"and" } else .{ .p_, .@"and" }, | |
| 7808 | .bit_and => if (self.hasFeature(.avx)) | |
| 7809 | .{ .vp_, .@"and" } | |
| 7810 | else | |
| 7811 | .{ .p_, .@"and" }, | |
| 7727 | 7812 | .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" }, |
| 7728 | 7813 | .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor }, |
| 7729 | 7814 | .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { |
| ... | ... | @@ -7746,6 +7831,20 @@ fn genBinOp( |
| 7746 | 7831 | else |
| 7747 | 7832 | .{ .p_w, .maxu }, |
| 7748 | 7833 | }, |
| 7834 | .cmp_lt, | |
| 7835 | .cmp_lte, | |
| 7836 | .cmp_gte, | |
| 7837 | .cmp_gt, | |
| 7838 | => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { | |
| 7839 | .signed => if (self.hasFeature(.avx)) | |
| 7840 | .{ .vp_w, .cmpgt } | |
| 7841 | else | |
| 7842 | .{ .p_w, .cmpgt }, | |
| 7843 | .unsigned => null, | |
| 7844 | }, | |
| 7845 | .cmp_eq, | |
| 7846 | .cmp_neq, | |
| 7847 | => if (self.hasFeature(.avx)) .{ .vp_w, .cmpeq } else .{ .p_w, .cmpeq }, | |
| 7749 | 7848 | else => null, |
| 7750 | 7849 | }, |
| 7751 | 7850 | 9...16 => switch (air_tag) { |
| ... | ... | @@ -7769,6 +7868,17 @@ fn genBinOp( |
| 7769 | 7868 | .signed => if (self.hasFeature(.avx2)) .{ .vp_w, .maxs } else null, |
| 7770 | 7869 | .unsigned => if (self.hasFeature(.avx2)) .{ .vp_w, .maxu } else null, |
| 7771 | 7870 | }, |
| 7871 | .cmp_lt, | |
| 7872 | .cmp_lte, | |
| 7873 | .cmp_gte, | |
| 7874 | .cmp_gt, | |
| 7875 | => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { | |
| 7876 | .signed => if (self.hasFeature(.avx)) .{ .vp_w, .cmpgt } else null, | |
| 7877 | .unsigned => null, | |
| 7878 | }, | |
| 7879 | .cmp_eq, | |
| 7880 | .cmp_neq, | |
| 7881 | => if (self.hasFeature(.avx)) .{ .vp_w, .cmpeq } else null, | |
| 7772 | 7882 | else => null, |
| 7773 | 7883 | }, |
| 7774 | 7884 | else => null, |
| ... | ... | @@ -7789,7 +7899,10 @@ fn genBinOp( |
| 7789 | 7899 | .{ .p_d, .mull } |
| 7790 | 7900 | else |
| 7791 | 7901 | null, |
| 7792 | .bit_and => if (self.hasFeature(.avx)) .{ .vp_, .@"and" } else .{ .p_, .@"and" }, | |
| 7902 | .bit_and => if (self.hasFeature(.avx)) | |
| 7903 | .{ .vp_, .@"and" } | |
| 7904 | else | |
| 7905 | .{ .p_, .@"and" }, | |
| 7793 | 7906 | .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" }, |
| 7794 | 7907 | .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor }, |
| 7795 | 7908 | .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { |
| ... | ... | @@ -7820,6 +7933,20 @@ fn genBinOp( |
| 7820 | 7933 | else |
| 7821 | 7934 | null, |
| 7822 | 7935 | }, |
| 7936 | .cmp_lt, | |
| 7937 | .cmp_lte, | |
| 7938 | .cmp_gte, | |
| 7939 | .cmp_gt, | |
| 7940 | => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { | |
| 7941 | .signed => if (self.hasFeature(.avx)) | |
| 7942 | .{ .vp_d, .cmpgt } | |
| 7943 | else | |
| 7944 | .{ .p_d, .cmpgt }, | |
| 7945 | .unsigned => null, | |
| 7946 | }, | |
| 7947 | .cmp_eq, | |
| 7948 | .cmp_neq, | |
| 7949 | => if (self.hasFeature(.avx)) .{ .vp_d, .cmpeq } else .{ .p_d, .cmpeq }, | |
| 7823 | 7950 | else => null, |
| 7824 | 7951 | }, |
| 7825 | 7952 | 5...8 => switch (air_tag) { |
| ... | ... | @@ -7843,6 +7970,17 @@ fn genBinOp( |
| 7843 | 7970 | .signed => if (self.hasFeature(.avx2)) .{ .vp_d, .maxs } else null, |
| 7844 | 7971 | .unsigned => if (self.hasFeature(.avx2)) .{ .vp_d, .maxu } else null, |
| 7845 | 7972 | }, |
| 7973 | .cmp_lt, | |
| 7974 | .cmp_lte, | |
| 7975 | .cmp_gte, | |
| 7976 | .cmp_gt, | |
| 7977 | => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { | |
| 7978 | .signed => if (self.hasFeature(.avx)) .{ .vp_d, .cmpgt } else null, | |
| 7979 | .unsigned => null, | |
| 7980 | }, | |
| 7981 | .cmp_eq, | |
| 7982 | .cmp_neq, | |
| 7983 | => if (self.hasFeature(.avx)) .{ .vp_d, .cmpeq } else null, | |
| 7846 | 7984 | else => null, |
| 7847 | 7985 | }, |
| 7848 | 7986 | else => null, |
| ... | ... | @@ -7855,9 +7993,33 @@ fn genBinOp( |
| 7855 | 7993 | .sub, |
| 7856 | 7994 | .sub_wrap, |
| 7857 | 7995 | => if (self.hasFeature(.avx)) .{ .vp_q, .sub } else .{ .p_q, .sub }, |
| 7858 | .bit_and => if (self.hasFeature(.avx)) .{ .vp_, .@"and" } else .{ .p_, .@"and" }, | |
| 7996 | .bit_and => if (self.hasFeature(.avx)) | |
| 7997 | .{ .vp_, .@"and" } | |
| 7998 | else | |
| 7999 | .{ .p_, .@"and" }, | |
| 7859 | 8000 | .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" }, |
| 7860 | 8001 | .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor }, |
| 8002 | .cmp_lt, | |
| 8003 | .cmp_lte, | |
| 8004 | .cmp_gte, | |
| 8005 | .cmp_gt, | |
| 8006 | => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { | |
| 8007 | .signed => if (self.hasFeature(.avx)) | |
| 8008 | .{ .vp_q, .cmpgt } | |
| 8009 | else if (self.hasFeature(.sse4_2)) | |
| 8010 | .{ .p_q, .cmpgt } | |
| 8011 | else | |
| 8012 | null, | |
| 8013 | .unsigned => null, | |
| 8014 | }, | |
| 8015 | .cmp_eq, | |
| 8016 | .cmp_neq, | |
| 8017 | => if (self.hasFeature(.avx)) | |
| 8018 | .{ .vp_q, .cmpeq } | |
| 8019 | else if (self.hasFeature(.sse4_1)) | |
| 8020 | .{ .p_q, .cmpeq } | |
| 8021 | else | |
| 8022 | null, | |
| 7861 | 8023 | else => null, |
| 7862 | 8024 | }, |
| 7863 | 8025 | 3...4 => switch (air_tag) { |
| ... | ... | @@ -7870,6 +8032,17 @@ fn genBinOp( |
| 7870 | 8032 | .bit_and => if (self.hasFeature(.avx2)) .{ .vp_, .@"and" } else null, |
| 7871 | 8033 | .bit_or => if (self.hasFeature(.avx2)) .{ .vp_, .@"or" } else null, |
| 7872 | 8034 | .xor => if (self.hasFeature(.avx2)) .{ .vp_, .xor } else null, |
| 8035 | .cmp_eq, | |
| 8036 | .cmp_neq, | |
| 8037 | => if (self.hasFeature(.avx)) .{ .vp_d, .cmpeq } else null, | |
| 8038 | .cmp_lt, | |
| 8039 | .cmp_lte, | |
| 8040 | .cmp_gt, | |
| 8041 | .cmp_gte, | |
| 8042 | => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { | |
| 8043 | .signed => if (self.hasFeature(.avx)) .{ .vp_d, .cmpgt } else null, | |
| 8044 | .unsigned => null, | |
| 8045 | }, | |
| 7873 | 8046 | else => null, |
| 7874 | 8047 | }, |
| 7875 | 8048 | else => null, |
| ... | ... | @@ -8435,6 +8608,62 @@ fn genBinOp( |
| 8435 | 8608 | ); |
| 8436 | 8609 | } |
| 8437 | 8610 | }, |
| 8611 | .cmp_lt, | |
| 8612 | .cmp_lte, | |
| 8613 | .cmp_eq, | |
| 8614 | .cmp_gte, | |
| 8615 | .cmp_gt, | |
| 8616 | .cmp_neq, | |
| 8617 | => { | |
| 8618 | switch (air_tag) { | |
| 8619 | .cmp_lt, | |
| 8620 | .cmp_eq, | |
| 8621 | .cmp_gt, | |
| 8622 | => {}, | |
| 8623 | .cmp_lte, | |
| 8624 | .cmp_gte, | |
| 8625 | .cmp_neq, | |
| 8626 | => { | |
| 8627 | const unsigned_ty = try lhs_ty.toUnsigned(mod); | |
| 8628 | const not_mcv = try self.genTypedValue(.{ | |
| 8629 | .ty = lhs_ty, | |
| 8630 | .val = try unsigned_ty.maxInt(mod, unsigned_ty), | |
| 8631 | }); | |
| 8632 | const not_mem = if (not_mcv.isMemory()) | |
| 8633 | not_mcv.mem(Memory.PtrSize.fromSize(abi_size)) | |
| 8634 | else | |
| 8635 | Memory.sib(Memory.PtrSize.fromSize(abi_size), .{ .base = .{ | |
| 8636 | .reg = try self.copyToTmpRegister(Type.usize, not_mcv.address()), | |
| 8637 | } }); | |
| 8638 | switch (mir_tag[0]) { | |
| 8639 | .vp_b, .vp_d, .vp_q, .vp_w => try self.asmRegisterRegisterMemory( | |
| 8640 | .{ .vp_, .xor }, | |
| 8641 | dst_reg, | |
| 8642 | dst_reg, | |
| 8643 | not_mem, | |
| 8644 | ), | |
| 8645 | .p_b, .p_d, .p_q, .p_w => try self.asmRegisterMemory( | |
| 8646 | .{ .p_, .xor }, | |
| 8647 | dst_reg, | |
| 8648 | not_mem, | |
| 8649 | ), | |
| 8650 | else => unreachable, | |
| 8651 | } | |
| 8652 | }, | |
| 8653 | else => unreachable, | |
| 8654 | } | |
| 8655 | ||
| 8656 | const gp_reg = try self.register_manager.allocReg(maybe_inst, abi.RegisterClass.gp); | |
| 8657 | const gp_lock = self.register_manager.lockRegAssumeUnused(gp_reg); | |
| 8658 | defer self.register_manager.unlockReg(gp_lock); | |
| 8659 | ||
| 8660 | try self.asmRegisterRegister(switch (mir_tag[0]) { | |
| 8661 | .vp_b, .vp_d, .vp_q, .vp_w => .{ .vp_b, .movmsk }, | |
| 8662 | .p_b, .p_d, .p_q, .p_w => .{ .p_b, .movmsk }, | |
| 8663 | else => unreachable, | |
| 8664 | }, gp_reg.to32(), dst_reg); | |
| 8665 | return .{ .register = gp_reg }; | |
| 8666 | }, | |
| 8438 | 8667 | else => unreachable, |
| 8439 | 8668 | } |
| 8440 | 8669 | |
| ... | ... | @@ -9741,8 +9970,15 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 9741 | 9970 | } |
| 9742 | 9971 | |
| 9743 | 9972 | fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void { |
| 9744 | _ = inst; | |
| 9745 | return self.fail("TODO implement airCmpVector for {}", .{self.target.cpu.arch}); | |
| 9973 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | |
| 9974 | const extra = self.air.extraData(Air.VectorCmp, ty_pl.payload).data; | |
| 9975 | const dst_mcv = try self.genBinOp( | |
| 9976 | inst, | |
| 9977 | Air.Inst.Tag.fromCmpOp(extra.compareOperator(), false), | |
| 9978 | extra.lhs, | |
| 9979 | extra.rhs, | |
| 9980 | ); | |
| 9981 | return self.finishAir(inst, dst_mcv, .{ extra.lhs, extra.rhs, .none }); | |
| 9746 | 9982 | } |
| 9747 | 9983 | |
| 9748 | 9984 | fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void { |
| ... | ... | @@ -12592,7 +12828,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 12592 | 12828 | .{ .i_, .mul }, |
| 12593 | 12829 | len_reg, |
| 12594 | 12830 | len_reg, |
| 12595 | Immediate.u(elem_abi_size), | |
| 12831 | Immediate.s(elem_abi_size), | |
| 12596 | 12832 | ); |
| 12597 | 12833 | try self.genInlineMemcpy(second_elem_ptr_mcv, ptr, len_mcv); |
| 12598 | 12834 | |
| ... | ... | @@ -12645,8 +12881,23 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void { |
| 12645 | 12881 | defer if (src_ptr_lock) |lock| self.register_manager.unlockReg(lock); |
| 12646 | 12882 | |
| 12647 | 12883 | const len: MCValue = switch (dst_ptr_ty.ptrSize(mod)) { |
| 12648 | .Slice => dst_ptr.address().offset(8).deref(), | |
| 12649 | .One => .{ .immediate = dst_ptr_ty.childType(mod).arrayLen(mod) }, | |
| 12884 | .Slice => len: { | |
| 12885 | const len_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp); | |
| 12886 | const len_lock = self.register_manager.lockRegAssumeUnused(len_reg); | |
| 12887 | defer self.register_manager.unlockReg(len_lock); | |
| 12888 | ||
| 12889 | try self.asmRegisterMemoryImmediate( | |
| 12890 | .{ .i_, .mul }, | |
| 12891 | len_reg, | |
| 12892 | dst_ptr.address().offset(8).deref().mem(.qword), | |
| 12893 | Immediate.s(@intCast(dst_ptr_ty.childType(mod).abiSize(mod))), | |
| 12894 | ); | |
| 12895 | break :len .{ .register = len_reg }; | |
| 12896 | }, | |
| 12897 | .One => len: { | |
| 12898 | const array_ty = dst_ptr_ty.childType(mod); | |
| 12899 | break :len .{ .immediate = array_ty.arrayLen(mod) * array_ty.childType(mod).abiSize(mod) }; | |
| 12900 | }, | |
| 12650 | 12901 | .C, .Many => unreachable, |
| 12651 | 12902 | }; |
| 12652 | 12903 | const len_lock: ?RegisterLock = switch (len) { |
| ... | ... | @@ -12999,10 +13250,60 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void { |
| 12999 | 13250 | } |
| 13000 | 13251 | |
| 13001 | 13252 | fn airReduce(self: *Self, inst: Air.Inst.Index) !void { |
| 13253 | const mod = self.bin_file.options.module.?; | |
| 13002 | 13254 | const reduce = self.air.instructions.items(.data)[inst].reduce; |
| 13003 | _ = reduce; | |
| 13004 | return self.fail("TODO implement airReduce for x86_64", .{}); | |
| 13005 | //return self.finishAir(inst, result, .{ reduce.operand, .none, .none }); | |
| 13255 | ||
| 13256 | const result: MCValue = result: { | |
| 13257 | const operand_ty = self.typeOf(reduce.operand); | |
| 13258 | if (operand_ty.isVector(mod) and operand_ty.childType(mod).toIntern() == .bool_type) { | |
| 13259 | try self.spillEflagsIfOccupied(); | |
| 13260 | ||
| 13261 | const operand_mcv = try self.resolveInst(reduce.operand); | |
| 13262 | const mask_len = (std.math.cast(u6, operand_ty.vectorLen(mod)) orelse | |
| 13263 | return self.fail("TODO implement airReduce for {}", .{operand_ty.fmt(mod)})); | |
| 13264 | const mask = (@as(u64, 1) << mask_len) - 1; | |
| 13265 | const abi_size: u32 = @intCast(operand_ty.abiSize(mod)); | |
| 13266 | switch (reduce.operation) { | |
| 13267 | .Or => { | |
| 13268 | if (operand_mcv.isMemory()) try self.asmMemoryImmediate( | |
| 13269 | .{ ._, .@"test" }, | |
| 13270 | operand_mcv.mem(Memory.PtrSize.fromSize(abi_size)), | |
| 13271 | Immediate.u(mask), | |
| 13272 | ) else { | |
| 13273 | const operand_reg = registerAlias(if (operand_mcv.isRegister()) | |
| 13274 | operand_mcv.getReg().? | |
| 13275 | else | |
| 13276 | try self.copyToTmpRegister(operand_ty, operand_mcv), abi_size); | |
| 13277 | if (mask_len < abi_size * 8) try self.asmRegisterImmediate( | |
| 13278 | .{ ._, .@"test" }, | |
| 13279 | operand_reg, | |
| 13280 | Immediate.u(mask), | |
| 13281 | ) else try self.asmRegisterRegister( | |
| 13282 | .{ ._, .@"test" }, | |
| 13283 | operand_reg, | |
| 13284 | operand_reg, | |
| 13285 | ); | |
| 13286 | } | |
| 13287 | break :result .{ .eflags = .nz }; | |
| 13288 | }, | |
| 13289 | .And => { | |
| 13290 | const tmp_reg = try self.copyToTmpRegister(operand_ty, operand_mcv); | |
| 13291 | const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg); | |
| 13292 | defer self.register_manager.unlockReg(tmp_lock); | |
| 13293 | ||
| 13294 | try self.asmRegister(.{ ._, .not }, tmp_reg); | |
| 13295 | if (mask_len < abi_size * 8) | |
| 13296 | try self.asmRegisterImmediate(.{ ._, .@"test" }, tmp_reg, Immediate.u(mask)) | |
| 13297 | else | |
| 13298 | try self.asmRegisterRegister(.{ ._, .@"test" }, tmp_reg, tmp_reg); | |
| 13299 | break :result .{ .eflags = .z }; | |
| 13300 | }, | |
| 13301 | else => return self.fail("TODO implement airReduce for {}", .{operand_ty.fmt(mod)}), | |
| 13302 | } | |
| 13303 | } | |
| 13304 | return self.fail("TODO implement airReduce for {}", .{operand_ty.fmt(mod)}); | |
| 13305 | }; | |
| 13306 | return self.finishAir(inst, result, .{ reduce.operand, .none, .none }); | |
| 13006 | 13307 | } |
| 13007 | 13308 | |
| 13008 | 13309 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
src/arch/x86_64/Emit.zig+6-6| ... | ... | @@ -19,18 +19,18 @@ pub const Error = Lower.Error || error{ |
| 19 | 19 | |
| 20 | 20 | pub fn emitMir(emit: *Emit) Error!void { |
| 21 | 21 | for (0..emit.lower.mir.instructions.len) |mir_i| { |
| 22 | const mir_index = @as(Mir.Inst.Index, @intCast(mir_i)); | |
| 22 | const mir_index: Mir.Inst.Index = @intCast(mir_i); | |
| 23 | 23 | try emit.code_offset_mapping.putNoClobber( |
| 24 | 24 | emit.lower.allocator, |
| 25 | 25 | mir_index, |
| 26 | @as(u32, @intCast(emit.code.items.len)), | |
| 26 | @intCast(emit.code.items.len), | |
| 27 | 27 | ); |
| 28 | 28 | const lowered = try emit.lower.lowerMir(mir_index); |
| 29 | 29 | var lowered_relocs = lowered.relocs; |
| 30 | 30 | for (lowered.insts, 0..) |lowered_inst, lowered_index| { |
| 31 | const start_offset = @as(u32, @intCast(emit.code.items.len)); | |
| 31 | const start_offset: u32 = @intCast(emit.code.items.len); | |
| 32 | 32 | try lowered_inst.encode(emit.code.writer(), .{}); |
| 33 | const end_offset = @as(u32, @intCast(emit.code.items.len)); | |
| 33 | const end_offset: u32 = @intCast(emit.code.items.len); | |
| 34 | 34 | while (lowered_relocs.len > 0 and |
| 35 | 35 | lowered_relocs[0].lowered_inst_index == lowered_index) : ({ |
| 36 | 36 | lowered_relocs = lowered_relocs[1..]; |
| ... | ... | @@ -39,7 +39,7 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 39 | 39 | .source = start_offset, |
| 40 | 40 | .target = target, |
| 41 | 41 | .offset = end_offset - 4, |
| 42 | .length = @as(u5, @intCast(end_offset - start_offset)), | |
| 42 | .length = @intCast(end_offset - start_offset), | |
| 43 | 43 | }), |
| 44 | 44 | .linker_extern_fn => |symbol| if (emit.bin_file.cast(link.File.Elf)) |elf_file| { |
| 45 | 45 | // Add relocation to the decl. |
| ... | ... | @@ -220,7 +220,7 @@ const Reloc = struct { |
| 220 | 220 | /// Target of the relocation. |
| 221 | 221 | target: Mir.Inst.Index, |
| 222 | 222 | /// Offset of the relocation within the instruction. |
| 223 | offset: usize, | |
| 223 | offset: u32, | |
| 224 | 224 | /// Length of the instruction. |
| 225 | 225 | length: u5, |
| 226 | 226 | }; |
src/arch/x86_64/Encoding.zig+13-1| ... | ... | @@ -266,6 +266,8 @@ pub const Mnemonic = enum { |
| 266 | 266 | packssdw, packsswb, packuswb, |
| 267 | 267 | paddb, paddd, paddq, paddsb, paddsw, paddusb, paddusw, paddw, |
| 268 | 268 | pand, pandn, por, pxor, |
| 269 | pcmpeqb, pcmpeqd, pcmpeqw, | |
| 270 | pcmpgtb, pcmpgtd, pcmpgtw, | |
| 269 | 271 | pmulhw, pmullw, |
| 270 | 272 | psubb, psubd, psubq, psubsb, psubsw, psubusb, psubusw, psubw, |
| 271 | 273 | // SSE |
| ... | ... | @@ -278,11 +280,12 @@ pub const Mnemonic = enum { |
| 278 | 280 | maxps, maxss, |
| 279 | 281 | minps, minss, |
| 280 | 282 | movaps, movhlps, movlhps, |
| 283 | movmskps, | |
| 281 | 284 | movss, movups, |
| 282 | 285 | mulps, mulss, |
| 283 | 286 | orps, |
| 284 | 287 | pextrw, pinsrw, |
| 285 | pmaxsw, pmaxub, pminsw, pminub, | |
| 288 | pmaxsw, pmaxub, pminsw, pminub, pmovmskb, | |
| 286 | 289 | shufps, |
| 287 | 290 | sqrtps, sqrtss, |
| 288 | 291 | subps, subss, |
| ... | ... | @@ -301,6 +304,7 @@ pub const Mnemonic = enum { |
| 301 | 304 | minpd, minsd, |
| 302 | 305 | movapd, |
| 303 | 306 | movdqa, movdqu, |
| 307 | movmskpd, | |
| 304 | 308 | //movsd, |
| 305 | 309 | movupd, |
| 306 | 310 | mulpd, mulsd, |
| ... | ... | @@ -323,11 +327,14 @@ pub const Mnemonic = enum { |
| 323 | 327 | extractps, |
| 324 | 328 | insertps, |
| 325 | 329 | packusdw, |
| 330 | pcmpeqq, | |
| 326 | 331 | pextrb, pextrd, pextrq, |
| 327 | 332 | pinsrb, pinsrd, pinsrq, |
| 328 | 333 | pmaxsb, pmaxsd, pmaxud, pmaxuw, pminsb, pminsd, pminud, pminuw, |
| 329 | 334 | pmulld, |
| 330 | 335 | roundpd, roundps, roundsd, roundss, |
| 336 | // SSE4.2 | |
| 337 | pcmpgtq, | |
| 331 | 338 | // AVX |
| 332 | 339 | vaddpd, vaddps, vaddsd, vaddss, |
| 333 | 340 | vandnpd, vandnps, vandpd, vandps, |
| ... | ... | @@ -348,6 +355,7 @@ pub const Mnemonic = enum { |
| 348 | 355 | vmovddup, |
| 349 | 356 | vmovdqa, vmovdqu, |
| 350 | 357 | vmovhlps, vmovlhps, |
| 358 | vmovmskpd, vmovmskps, | |
| 351 | 359 | vmovq, |
| 352 | 360 | vmovsd, |
| 353 | 361 | vmovshdup, vmovsldup, |
| ... | ... | @@ -359,10 +367,13 @@ pub const Mnemonic = enum { |
| 359 | 367 | vpackssdw, vpacksswb, vpackusdw, vpackuswb, |
| 360 | 368 | vpaddb, vpaddd, vpaddq, vpaddsb, vpaddsw, vpaddusb, vpaddusw, vpaddw, |
| 361 | 369 | vpand, vpandn, |
| 370 | vpcmpeqb, vpcmpeqd, vpcmpeqq, vpcmpeqw, | |
| 371 | vpcmpgtb, vpcmpgtd, vpcmpgtq, vpcmpgtw, | |
| 362 | 372 | vpextrb, vpextrd, vpextrq, vpextrw, |
| 363 | 373 | vpinsrb, vpinsrd, vpinsrq, vpinsrw, |
| 364 | 374 | vpmaxsb, vpmaxsd, vpmaxsw, vpmaxub, vpmaxud, vpmaxuw, |
| 365 | 375 | vpminsb, vpminsd, vpminsw, vpminub, vpminud, vpminuw, |
| 376 | vpmovmskb, | |
| 366 | 377 | vpmulhw, vpmulld, vpmullw, |
| 367 | 378 | vpor, |
| 368 | 379 | vpshufhw, vpshuflw, |
| ... | ... | @@ -754,6 +765,7 @@ pub const Feature = enum { |
| 754 | 765 | sse2, |
| 755 | 766 | sse3, |
| 756 | 767 | sse4_1, |
| 768 | sse4_2, | |
| 757 | 769 | ssse3, |
| 758 | 770 | x87, |
| 759 | 771 | }; |
src/arch/x86_64/Lower.zig+39-7| ... | ... | @@ -190,7 +190,7 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { |
| 190 | 190 | .pseudo_probe_align_ri_s => { |
| 191 | 191 | try lower.emit(.none, .@"test", &.{ |
| 192 | 192 | .{ .reg = inst.data.ri.r1 }, |
| 193 | .{ .imm = Immediate.s(@as(i32, @bitCast(inst.data.ri.i))) }, | |
| 193 | .{ .imm = Immediate.s(@bitCast(inst.data.ri.i)) }, | |
| 194 | 194 | }); |
| 195 | 195 | try lower.emit(.none, .jz, &.{ |
| 196 | 196 | .{ .imm = lower.reloc(.{ .inst = index + 1 }) }, |
| ... | ... | @@ -226,14 +226,14 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { |
| 226 | 226 | } |
| 227 | 227 | try lower.emit(.none, .sub, &.{ |
| 228 | 228 | .{ .reg = inst.data.ri.r1 }, |
| 229 | .{ .imm = Immediate.s(@as(i32, @bitCast(inst.data.ri.i))) }, | |
| 229 | .{ .imm = Immediate.s(@bitCast(inst.data.ri.i)) }, | |
| 230 | 230 | }); |
| 231 | 231 | assert(lower.result_insts_len <= pseudo_probe_adjust_unrolled_max_insts); |
| 232 | 232 | }, |
| 233 | 233 | .pseudo_probe_adjust_setup_rri_s => { |
| 234 | 234 | try lower.emit(.none, .mov, &.{ |
| 235 | 235 | .{ .reg = inst.data.rri.r2.to32() }, |
| 236 | .{ .imm = Immediate.s(@as(i32, @bitCast(inst.data.rri.i))) }, | |
| 236 | .{ .imm = Immediate.s(@bitCast(inst.data.rri.i)) }, | |
| 237 | 237 | }); |
| 238 | 238 | try lower.emit(.none, .sub, &.{ |
| 239 | 239 | .{ .reg = inst.data.rri.r1 }, |
| ... | ... | @@ -291,7 +291,9 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate { |
| 291 | 291 | .i_s, |
| 292 | 292 | .mi_sib_s, |
| 293 | 293 | .mi_rip_s, |
| 294 | => Immediate.s(@as(i32, @bitCast(i))), | |
| 294 | .rmi_sib_s, | |
| 295 | .rmi_rip_s, | |
| 296 | => Immediate.s(@bitCast(i)), | |
| 295 | 297 | |
| 296 | 298 | .rrri, |
| 297 | 299 | .rri_u, |
| ... | ... | @@ -301,6 +303,8 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate { |
| 301 | 303 | .mi_rip_u, |
| 302 | 304 | .rmi_sib, |
| 303 | 305 | .rmi_rip, |
| 306 | .rmi_sib_u, | |
| 307 | .rmi_rip_u, | |
| 304 | 308 | .mri_sib, |
| 305 | 309 | .mri_rip, |
| 306 | 310 | .rrm_sib, |
| ... | ... | @@ -319,6 +323,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory { |
| 319 | 323 | return lower.mir.resolveFrameLoc(switch (ops) { |
| 320 | 324 | .rm_sib, |
| 321 | 325 | .rmi_sib, |
| 326 | .rmi_sib_s, | |
| 327 | .rmi_sib_u, | |
| 322 | 328 | .m_sib, |
| 323 | 329 | .mi_sib_u, |
| 324 | 330 | .mi_sib_s, |
| ... | ... | @@ -335,6 +341,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory { |
| 335 | 341 | |
| 336 | 342 | .rm_rip, |
| 337 | 343 | .rmi_rip, |
| 344 | .rmi_rip_s, | |
| 345 | .rmi_rip_u, | |
| 338 | 346 | .m_rip, |
| 339 | 347 | .mi_rip_u, |
| 340 | 348 | .mi_rip_s, |
| ... | ... | @@ -383,13 +391,29 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { |
| 383 | 391 | .rrri => inst.data.rrri.fixes, |
| 384 | 392 | .rri_s, .rri_u => inst.data.rri.fixes, |
| 385 | 393 | .ri_s, .ri_u => inst.data.ri.fixes, |
| 386 | .ri64, .rm_sib, .rm_rip, .mr_sib, .mr_rip => inst.data.rx.fixes, | |
| 394 | .ri64, | |
| 395 | .rm_sib, | |
| 396 | .rm_rip, | |
| 397 | .rmi_sib_s, | |
| 398 | .rmi_sib_u, | |
| 399 | .rmi_rip_s, | |
| 400 | .rmi_rip_u, | |
| 401 | .mr_sib, | |
| 402 | .mr_rip, | |
| 403 | => inst.data.rx.fixes, | |
| 387 | 404 | .mrr_sib, .mrr_rip, .rrm_sib, .rrm_rip => inst.data.rrx.fixes, |
| 388 | 405 | .rmi_sib, .rmi_rip, .mri_sib, .mri_rip => inst.data.rix.fixes, |
| 389 | 406 | .rrmi_sib, .rrmi_rip => inst.data.rrix.fixes, |
| 390 | 407 | .mi_sib_u, .mi_rip_u, .mi_sib_s, .mi_rip_s => inst.data.x.fixes, |
| 391 | 408 | .m_sib, .m_rip, .rax_moffs, .moffs_rax => inst.data.x.fixes, |
| 392 | .extern_fn_reloc, .got_reloc, .extern_got_reloc, .direct_reloc, .direct_got_reloc, .import_reloc, .tlv_reloc => ._, | |
| 409 | .extern_fn_reloc, | |
| 410 | .got_reloc, | |
| 411 | .extern_got_reloc, | |
| 412 | .direct_reloc, | |
| 413 | .direct_got_reloc, | |
| 414 | .import_reloc, | |
| 415 | .tlv_reloc, | |
| 416 | => ._, | |
| 393 | 417 | else => return lower.fail("TODO lower .{s}", .{@tagName(inst.ops)}), |
| 394 | 418 | }; |
| 395 | 419 | try lower.emit(switch (fixes) { |
| ... | ... | @@ -461,7 +485,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { |
| 461 | 485 | .m_sib, .m_rip => &.{ |
| 462 | 486 | .{ .mem = lower.mem(inst.ops, inst.data.x.payload) }, |
| 463 | 487 | }, |
| 464 | .mi_sib_s, .mi_sib_u, .mi_rip_u, .mi_rip_s => &.{ | |
| 488 | .mi_sib_s, .mi_sib_u, .mi_rip_s, .mi_rip_u => &.{ | |
| 465 | 489 | .{ .mem = lower.mem(inst.ops, inst.data.x.payload + 1) }, |
| 466 | 490 | .{ .imm = lower.imm( |
| 467 | 491 | inst.ops, |
| ... | ... | @@ -477,6 +501,14 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { |
| 477 | 501 | .{ .mem = lower.mem(inst.ops, inst.data.rix.payload) }, |
| 478 | 502 | .{ .imm = lower.imm(inst.ops, inst.data.rix.i) }, |
| 479 | 503 | }, |
| 504 | .rmi_sib_s, .rmi_sib_u, .rmi_rip_s, .rmi_rip_u => &.{ | |
| 505 | .{ .reg = inst.data.rx.r1 }, | |
| 506 | .{ .mem = lower.mem(inst.ops, inst.data.rx.payload + 1) }, | |
| 507 | .{ .imm = lower.imm( | |
| 508 | inst.ops, | |
| 509 | lower.mir.extraData(Mir.Imm32, inst.data.rx.payload).data.imm, | |
| 510 | ) }, | |
| 511 | }, | |
| 480 | 512 | .mr_sib, .mr_rip => &.{ |
| 481 | 513 | .{ .mem = lower.mem(inst.ops, inst.data.rx.payload) }, |
| 482 | 514 | .{ .reg = inst.data.rx.r1 }, |
src/arch/x86_64/Mir.zig+49-29| ... | ... | @@ -474,6 +474,10 @@ pub const Inst = struct { |
| 474 | 474 | /// Bitwise logical and not of packed single-precision floating-point values |
| 475 | 475 | /// Bitwise logical and not of packed double-precision floating-point values |
| 476 | 476 | andn, |
| 477 | /// Compare packed data for equal | |
| 478 | cmpeq, | |
| 479 | /// Compare packed data for greater than | |
| 480 | cmpgt, | |
| 477 | 481 | /// Maximum of packed signed integers |
| 478 | 482 | maxs, |
| 479 | 483 | /// Maximum of packed unsigned integers |
| ... | ... | @@ -482,6 +486,10 @@ pub const Inst = struct { |
| 482 | 486 | mins, |
| 483 | 487 | /// Minimum of packed unsigned integers |
| 484 | 488 | minu, |
| 489 | /// Move byte mask | |
| 490 | /// Extract packed single precision floating-point sign mask | |
| 491 | /// Extract packed double precision floating-point sign mask | |
| 492 | movmsk, | |
| 485 | 493 | /// Multiply packed signed integers and store low result |
| 486 | 494 | mull, |
| 487 | 495 | /// Multiply packed signed integers and store high result |
| ... | ... | @@ -720,9 +728,24 @@ pub const Inst = struct { |
| 720 | 728 | /// Register, memory (RIP) operands. |
| 721 | 729 | /// Uses `rx` payload. |
| 722 | 730 | rm_rip, |
| 723 | /// Register, memory (SIB), immediate (byte) operands. | |
| 731 | /// Register, memory (SIB), immediate (word) operands. | |
| 724 | 732 | /// Uses `rix` payload with extra data of type `MemorySib`. |
| 725 | 733 | rmi_sib, |
| 734 | /// Register, memory (RIP), immediate (word) operands. | |
| 735 | /// Uses `rix` payload with extra data of type `MemoryRip`. | |
| 736 | rmi_rip, | |
| 737 | /// Register, memory (SIB), immediate (signed) operands. | |
| 738 | /// Uses `rx` payload with extra data of type `Imm32` followed by `MemorySib`. | |
| 739 | rmi_sib_s, | |
| 740 | /// Register, memory (SIB), immediate (unsigned) operands. | |
| 741 | /// Uses `rx` payload with extra data of type `Imm32` followed by `MemorySib`. | |
| 742 | rmi_sib_u, | |
| 743 | /// Register, memory (RIP), immediate (signed) operands. | |
| 744 | /// Uses `rx` payload with extra data of type `Imm32` followed by `MemoryRip`. | |
| 745 | rmi_rip_s, | |
| 746 | /// Register, memory (RIP), immediate (unsigned) operands. | |
| 747 | /// Uses `rx` payload with extra data of type `Imm32` followed by `MemoryRip`. | |
| 748 | rmi_rip_u, | |
| 726 | 749 | /// Register, register, memory (RIP). |
| 727 | 750 | /// Uses `rrix` payload with extra data of type `MemoryRip`. |
| 728 | 751 | rrm_rip, |
| ... | ... | @@ -735,27 +758,24 @@ pub const Inst = struct { |
| 735 | 758 | /// Register, register, memory (SIB), immediate (byte) operands. |
| 736 | 759 | /// Uses `rrix` payload with extra data of type `MemorySib`. |
| 737 | 760 | rrmi_sib, |
| 738 | /// Register, memory (RIP), immediate (byte) operands. | |
| 739 | /// Uses `rix` payload with extra data of type `MemoryRip`. | |
| 740 | rmi_rip, | |
| 741 | 761 | /// Single memory (SIB) operand. |
| 742 | 762 | /// Uses `x` with extra data of type `MemorySib`. |
| 743 | 763 | m_sib, |
| 744 | 764 | /// Single memory (RIP) operand. |
| 745 | 765 | /// Uses `x` with extra data of type `MemoryRip`. |
| 746 | 766 | m_rip, |
| 747 | /// Memory (SIB), immediate (unsigned) operands. | |
| 748 | /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`. | |
| 749 | mi_sib_u, | |
| 750 | /// Memory (RIP), immediate (unsigned) operands. | |
| 751 | /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`. | |
| 752 | mi_rip_u, | |
| 753 | 767 | /// Memory (SIB), immediate (sign-extend) operands. |
| 754 | 768 | /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`. |
| 755 | 769 | mi_sib_s, |
| 770 | /// Memory (SIB), immediate (unsigned) operands. | |
| 771 | /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`. | |
| 772 | mi_sib_u, | |
| 756 | 773 | /// Memory (RIP), immediate (sign-extend) operands. |
| 757 | 774 | /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`. |
| 758 | 775 | mi_rip_s, |
| 776 | /// Memory (RIP), immediate (unsigned) operands. | |
| 777 | /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`. | |
| 778 | mi_rip_u, | |
| 759 | 779 | /// Memory (SIB), register operands. |
| 760 | 780 | /// Uses `rx` payload with extra data of type `MemorySib`. |
| 761 | 781 | mr_sib, |
| ... | ... | @@ -768,10 +788,10 @@ pub const Inst = struct { |
| 768 | 788 | /// Memory (RIP), register, register operands. |
| 769 | 789 | /// Uses `rrx` payload with extra data of type `MemoryRip`. |
| 770 | 790 | mrr_rip, |
| 771 | /// Memory (SIB), register, immediate (byte) operands. | |
| 791 | /// Memory (SIB), register, immediate (word) operands. | |
| 772 | 792 | /// Uses `rix` payload with extra data of type `MemorySib`. |
| 773 | 793 | mri_sib, |
| 774 | /// Memory (RIP), register, immediate (byte) operands. | |
| 794 | /// Memory (RIP), register, immediate (word) operands. | |
| 775 | 795 | /// Uses `rix` payload with extra data of type `MemoryRip`. |
| 776 | 796 | mri_rip, |
| 777 | 797 | /// Rax, Memory moffs. |
| ... | ... | @@ -955,7 +975,7 @@ pub const Inst = struct { |
| 955 | 975 | rix: struct { |
| 956 | 976 | fixes: Fixes = ._, |
| 957 | 977 | r1: Register, |
| 958 | i: u8, | |
| 978 | i: u16, | |
| 959 | 979 | payload: u32, |
| 960 | 980 | }, |
| 961 | 981 | /// Register, register, byte immediate, followed by Custom payload found in extra. |
| ... | ... | @@ -1010,7 +1030,7 @@ pub const RegisterList = struct { |
| 1010 | 1030 | |
| 1011 | 1031 | fn getIndexForReg(registers: []const Register, reg: Register) BitSet.MaskInt { |
| 1012 | 1032 | for (registers, 0..) |cpreg, i| { |
| 1013 | if (reg.id() == cpreg.id()) return @as(u32, @intCast(i)); | |
| 1033 | if (reg.id() == cpreg.id()) return @intCast(i); | |
| 1014 | 1034 | } |
| 1015 | 1035 | unreachable; // register not in input register list! |
| 1016 | 1036 | } |
| ... | ... | @@ -1030,7 +1050,7 @@ pub const RegisterList = struct { |
| 1030 | 1050 | } |
| 1031 | 1051 | |
| 1032 | 1052 | pub fn count(self: Self) u32 { |
| 1033 | return @as(u32, @intCast(self.bitset.count())); | |
| 1053 | return @intCast(self.bitset.count()); | |
| 1034 | 1054 | } |
| 1035 | 1055 | }; |
| 1036 | 1056 | |
| ... | ... | @@ -1044,14 +1064,14 @@ pub const Imm64 = struct { |
| 1044 | 1064 | |
| 1045 | 1065 | pub fn encode(v: u64) Imm64 { |
| 1046 | 1066 | return .{ |
| 1047 | .msb = @as(u32, @truncate(v >> 32)), | |
| 1048 | .lsb = @as(u32, @truncate(v)), | |
| 1067 | .msb = @truncate(v >> 32), | |
| 1068 | .lsb = @truncate(v), | |
| 1049 | 1069 | }; |
| 1050 | 1070 | } |
| 1051 | 1071 | |
| 1052 | 1072 | pub fn decode(imm: Imm64) u64 { |
| 1053 | 1073 | var res: u64 = 0; |
| 1054 | res |= (@as(u64, @intCast(imm.msb)) << 32); | |
| 1074 | res |= @as(u64, @intCast(imm.msb)) << 32; | |
| 1055 | 1075 | res |= @as(u64, @intCast(imm.lsb)); |
| 1056 | 1076 | return res; |
| 1057 | 1077 | } |
| ... | ... | @@ -1075,7 +1095,7 @@ pub const MemorySib = struct { |
| 1075 | 1095 | assert(sib.scale_index.scale == 0 or std.math.isPowerOfTwo(sib.scale_index.scale)); |
| 1076 | 1096 | return .{ |
| 1077 | 1097 | .ptr_size = @intFromEnum(sib.ptr_size), |
| 1078 | .base_tag = @intFromEnum(@as(Memory.Base.Tag, sib.base)), | |
| 1098 | .base_tag = @intFromEnum(sib.base), | |
| 1079 | 1099 | .base = switch (sib.base) { |
| 1080 | 1100 | .none => undefined, |
| 1081 | 1101 | .reg => |r| @intFromEnum(r), |
| ... | ... | @@ -1091,18 +1111,18 @@ pub const MemorySib = struct { |
| 1091 | 1111 | } |
| 1092 | 1112 | |
| 1093 | 1113 | pub fn decode(msib: MemorySib) Memory { |
| 1094 | const scale = @as(u4, @truncate(msib.scale_index)); | |
| 1114 | const scale: u4 = @truncate(msib.scale_index); | |
| 1095 | 1115 | assert(scale == 0 or std.math.isPowerOfTwo(scale)); |
| 1096 | 1116 | return .{ .sib = .{ |
| 1097 | .ptr_size = @as(Memory.PtrSize, @enumFromInt(msib.ptr_size)), | |
| 1117 | .ptr_size = @enumFromInt(msib.ptr_size), | |
| 1098 | 1118 | .base = switch (@as(Memory.Base.Tag, @enumFromInt(msib.base_tag))) { |
| 1099 | 1119 | .none => .none, |
| 1100 | .reg => .{ .reg = @as(Register, @enumFromInt(msib.base)) }, | |
| 1101 | .frame => .{ .frame = @as(bits.FrameIndex, @enumFromInt(msib.base)) }, | |
| 1120 | .reg => .{ .reg = @enumFromInt(msib.base) }, | |
| 1121 | .frame => .{ .frame = @enumFromInt(msib.base) }, | |
| 1102 | 1122 | }, |
| 1103 | 1123 | .scale_index = .{ |
| 1104 | 1124 | .scale = scale, |
| 1105 | .index = if (scale > 0) @as(Register, @enumFromInt(msib.scale_index >> 4)) else undefined, | |
| 1125 | .index = if (scale > 0) @enumFromInt(msib.scale_index >> 4) else undefined, | |
| 1106 | 1126 | }, |
| 1107 | 1127 | .disp = msib.disp, |
| 1108 | 1128 | } }; |
| ... | ... | @@ -1124,7 +1144,7 @@ pub const MemoryRip = struct { |
| 1124 | 1144 | |
| 1125 | 1145 | pub fn decode(mrip: MemoryRip) Memory { |
| 1126 | 1146 | return .{ .rip = .{ |
| 1127 | .ptr_size = @as(Memory.PtrSize, @enumFromInt(mrip.ptr_size)), | |
| 1147 | .ptr_size = @enumFromInt(mrip.ptr_size), | |
| 1128 | 1148 | .disp = mrip.disp, |
| 1129 | 1149 | } }; |
| 1130 | 1150 | } |
| ... | ... | @@ -1141,14 +1161,14 @@ pub const MemoryMoffs = struct { |
| 1141 | 1161 | pub fn encode(seg: Register, offset: u64) MemoryMoffs { |
| 1142 | 1162 | return .{ |
| 1143 | 1163 | .seg = @intFromEnum(seg), |
| 1144 | .msb = @as(u32, @truncate(offset >> 32)), | |
| 1145 | .lsb = @as(u32, @truncate(offset >> 0)), | |
| 1164 | .msb = @truncate(offset >> 32), | |
| 1165 | .lsb = @truncate(offset >> 0), | |
| 1146 | 1166 | }; |
| 1147 | 1167 | } |
| 1148 | 1168 | |
| 1149 | 1169 | pub fn decode(moffs: MemoryMoffs) Memory { |
| 1150 | 1170 | return .{ .moffs = .{ |
| 1151 | .seg = @as(Register, @enumFromInt(moffs.seg)), | |
| 1171 | .seg = @enumFromInt(moffs.seg), | |
| 1152 | 1172 | .offset = @as(u64, moffs.msb) << 32 | @as(u64, moffs.lsb) << 0, |
| 1153 | 1173 | } }; |
| 1154 | 1174 | } |
| ... | ... | @@ -1168,7 +1188,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end: |
| 1168 | 1188 | inline for (fields) |field| { |
| 1169 | 1189 | @field(result, field.name) = switch (field.type) { |
| 1170 | 1190 | u32 => mir.extra[i], |
| 1171 | i32 => @as(i32, @bitCast(mir.extra[i])), | |
| 1191 | i32 => @bitCast(mir.extra[i]), | |
| 1172 | 1192 | else => @compileError("bad field type"), |
| 1173 | 1193 | }; |
| 1174 | 1194 | i += 1; |
src/arch/x86_64/bits.zig+10-10| ... | ... | @@ -232,7 +232,7 @@ pub const Register = enum(u7) { |
| 232 | 232 | else => unreachable, |
| 233 | 233 | // zig fmt: on |
| 234 | 234 | }; |
| 235 | return @as(u6, @intCast(@intFromEnum(reg) - base)); | |
| 235 | return @intCast(@intFromEnum(reg) - base); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | pub fn bitSize(reg: Register) u64 { |
| ... | ... | @@ -291,11 +291,11 @@ pub const Register = enum(u7) { |
| 291 | 291 | else => unreachable, |
| 292 | 292 | // zig fmt: on |
| 293 | 293 | }; |
| 294 | return @as(u4, @truncate(@intFromEnum(reg) - base)); | |
| 294 | return @truncate(@intFromEnum(reg) - base); | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | pub fn lowEnc(reg: Register) u3 { |
| 298 | return @as(u3, @truncate(reg.enc())); | |
| 298 | return @truncate(reg.enc()); | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | pub fn toBitSize(reg: Register, bit_size: u64) Register { |
| ... | ... | @@ -325,19 +325,19 @@ pub const Register = enum(u7) { |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | pub fn to64(reg: Register) Register { |
| 328 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.rax))); | |
| 328 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.rax)); | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | pub fn to32(reg: Register) Register { |
| 332 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.eax))); | |
| 332 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.eax)); | |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | pub fn to16(reg: Register) Register { |
| 336 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.ax))); | |
| 336 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.ax)); | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | pub fn to8(reg: Register) Register { |
| 340 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.al))); | |
| 340 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.al)); | |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | fn sseBase(reg: Register) u7 { |
| ... | ... | @@ -350,11 +350,11 @@ pub const Register = enum(u7) { |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | pub fn to256(reg: Register) Register { |
| 353 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.ymm0))); | |
| 353 | return @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.ymm0)); | |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | pub fn to128(reg: Register) Register { |
| 357 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.xmm0))); | |
| 357 | return @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.xmm0)); | |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /// DWARF register encoding |
| ... | ... | @@ -619,7 +619,7 @@ pub const Immediate = union(enum) { |
| 619 | 619 | 1, 8 => @as(i8, @bitCast(@as(u8, @intCast(x)))), |
| 620 | 620 | 16 => @as(i16, @bitCast(@as(u16, @intCast(x)))), |
| 621 | 621 | 32 => @as(i32, @bitCast(@as(u32, @intCast(x)))), |
| 622 | 64 => @as(i64, @bitCast(x)), | |
| 622 | 64 => @bitCast(x), | |
| 623 | 623 | else => unreachable, |
| 624 | 624 | }, |
| 625 | 625 | }; |
src/arch/x86_64/encodings.zig+80-18| ... | ... | @@ -905,6 +905,9 @@ pub const table = [_]Entry{ |
| 905 | 905 | |
| 906 | 906 | .{ .movlhps, .rm, &.{ .xmm, .xmm }, &.{ 0x0f, 0x16 }, 0, .none, .sse }, |
| 907 | 907 | |
| 908 | .{ .movmskps, .rm, &.{ .r32, .xmm }, &.{ 0x0f, 0x50 }, 0, .none, .sse }, | |
| 909 | .{ .movmskps, .rm, &.{ .r64, .xmm }, &.{ 0x0f, 0x50 }, 0, .none, .sse }, | |
| 910 | ||
| 908 | 911 | .{ .movss, .rm, &.{ .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x10 }, 0, .none, .sse }, |
| 909 | 912 | .{ .movss, .mr, &.{ .xmm_m32, .xmm }, &.{ 0xf3, 0x0f, 0x11 }, 0, .none, .sse }, |
| 910 | 913 | |
| ... | ... | @@ -917,6 +920,9 @@ pub const table = [_]Entry{ |
| 917 | 920 | |
| 918 | 921 | .{ .orps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x56 }, 0, .none, .sse }, |
| 919 | 922 | |
| 923 | .{ .pmovmskb, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .none, .sse }, | |
| 924 | .{ .pmovmskb, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .none, .sse }, | |
| 925 | ||
| 920 | 926 | .{ .shufps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x0f, 0xc6 }, 0, .none, .sse }, |
| 921 | 927 | |
| 922 | 928 | .{ .sqrtps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x51 }, 0, .none, .sse }, |
| ... | ... | @@ -1005,6 +1011,12 @@ pub const table = [_]Entry{ |
| 1005 | 1011 | .{ .movdqu, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0xf3, 0x0f, 0x6f }, 0, .none, .sse2 }, |
| 1006 | 1012 | .{ .movdqu, .mr, &.{ .xmm_m128, .xmm }, &.{ 0xf3, 0x0f, 0x7f }, 0, .none, .sse2 }, |
| 1007 | 1013 | |
| 1014 | .{ .movmskpd, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .none, .sse2 }, | |
| 1015 | .{ .movmskpd, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .none, .sse2 }, | |
| 1016 | ||
| 1017 | .{ .movsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x10 }, 0, .none, .sse2 }, | |
| 1018 | .{ .movsd, .mr, &.{ .xmm_m64, .xmm }, &.{ 0xf2, 0x0f, 0x11 }, 0, .none, .sse2 }, | |
| 1019 | ||
| 1008 | 1020 | .{ .movq, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf3, 0x0f, 0x7e }, 0, .none, .sse2 }, |
| 1009 | 1021 | .{ .movq, .mr, &.{ .xmm_m64, .xmm }, &.{ 0x66, 0x0f, 0xd6 }, 0, .none, .sse2 }, |
| 1010 | 1022 | |
| ... | ... | @@ -1037,6 +1049,14 @@ pub const table = [_]Entry{ |
| 1037 | 1049 | |
| 1038 | 1050 | .{ .pandn, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .none, .sse2 }, |
| 1039 | 1051 | |
| 1052 | .{ .pcmpeqb, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x74 }, 0, .none, .sse2 }, | |
| 1053 | .{ .pcmpeqw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x75 }, 0, .none, .sse2 }, | |
| 1054 | .{ .pcmpeqd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x76 }, 0, .none, .sse2 }, | |
| 1055 | ||
| 1056 | .{ .pcmpgtb, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x64 }, 0, .none, .sse2 }, | |
| 1057 | .{ .pcmpgtw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x65 }, 0, .none, .sse2 }, | |
| 1058 | .{ .pcmpgtd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x66 }, 0, .none, .sse2 }, | |
| 1059 | ||
| 1040 | 1060 | .{ .pextrw, .rmi, &.{ .r32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0xc5 }, 0, .none, .sse2 }, |
| 1041 | 1061 | |
| 1042 | 1062 | .{ .pinsrw, .rmi, &.{ .xmm, .r32_m16, .imm8 }, &.{ 0x66, 0x0f, 0xc4 }, 0, .none, .sse2 }, |
| ... | ... | @@ -1100,9 +1120,6 @@ pub const table = [_]Entry{ |
| 1100 | 1120 | |
| 1101 | 1121 | .{ .subsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x5c }, 0, .none, .sse2 }, |
| 1102 | 1122 | |
| 1103 | .{ .movsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x10 }, 0, .none, .sse2 }, | |
| 1104 | .{ .movsd, .mr, &.{ .xmm_m64, .xmm }, &.{ 0xf2, 0x0f, 0x11 }, 0, .none, .sse2 }, | |
| 1105 | ||
| 1106 | 1123 | .{ .ucomisd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0x66, 0x0f, 0x2e }, 0, .none, .sse2 }, |
| 1107 | 1124 | |
| 1108 | 1125 | .{ .xorpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x57 }, 0, .none, .sse2 }, |
| ... | ... | @@ -1137,6 +1154,8 @@ pub const table = [_]Entry{ |
| 1137 | 1154 | |
| 1138 | 1155 | .{ .packusdw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x2b }, 0, .none, .sse4_1 }, |
| 1139 | 1156 | |
| 1157 | .{ .pcmpeqq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x29 }, 0, .none, .sse4_1 }, | |
| 1158 | ||
| 1140 | 1159 | .{ .pextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .none, .sse4_1 }, |
| 1141 | 1160 | .{ .pextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .none, .sse4_1 }, |
| 1142 | 1161 | .{ .pextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .long, .sse4_1 }, |
| ... | ... | @@ -1171,6 +1190,9 @@ pub const table = [_]Entry{ |
| 1171 | 1190 | |
| 1172 | 1191 | .{ .roundss, .rmi, &.{ .xmm, .xmm_m32, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0a }, 0, .none, .sse4_1 }, |
| 1173 | 1192 | |
| 1193 | // SSE4.2 | |
| 1194 | .{ .pcmpgtq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x37 }, 0, .none, .sse4_2 }, | |
| 1195 | ||
| 1174 | 1196 | // AVX |
| 1175 | 1197 | .{ .vaddpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_128_wig, .avx }, |
| 1176 | 1198 | .{ .vaddpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_256_wig, .avx }, |
| ... | ... | @@ -1295,6 +1317,16 @@ pub const table = [_]Entry{ |
| 1295 | 1317 | |
| 1296 | 1318 | .{ .vmaxss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x5f }, 0, .vex_lig_wig, .avx }, |
| 1297 | 1319 | |
| 1320 | .{ .vmovmskps, .rm, &.{ .r32, .xmm }, &.{ 0x0f, 0x50 }, 0, .vex_128_wig, .avx }, | |
| 1321 | .{ .vmovmskps, .rm, &.{ .r64, .xmm }, &.{ 0x0f, 0x50 }, 0, .vex_128_wig, .avx }, | |
| 1322 | .{ .vmovmskps, .rm, &.{ .r32, .ymm }, &.{ 0x0f, 0x50 }, 0, .vex_256_wig, .avx }, | |
| 1323 | .{ .vmovmskps, .rm, &.{ .r64, .ymm }, &.{ 0x0f, 0x50 }, 0, .vex_256_wig, .avx }, | |
| 1324 | ||
| 1325 | .{ .vmovmskpd, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .vex_128_wig, .avx }, | |
| 1326 | .{ .vmovmskpd, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .vex_128_wig, .avx }, | |
| 1327 | .{ .vmovmskpd, .rm, &.{ .r32, .ymm }, &.{ 0x66, 0x0f, 0x50 }, 0, .vex_256_wig, .avx }, | |
| 1328 | .{ .vmovmskpd, .rm, &.{ .r64, .ymm }, &.{ 0x66, 0x0f, 0x50 }, 0, .vex_256_wig, .avx }, | |
| 1329 | ||
| 1298 | 1330 | .{ .vminpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_128_wig, .avx }, |
| 1299 | 1331 | .{ .vminpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_256_wig, .avx }, |
| 1300 | 1332 | |
| ... | ... | @@ -1408,6 +1440,18 @@ pub const table = [_]Entry{ |
| 1408 | 1440 | |
| 1409 | 1441 | .{ .vpandn, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_128_wig, .avx }, |
| 1410 | 1442 | |
| 1443 | .{ .vpcmpeqb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x74 }, 0, .vex_128_wig, .avx }, | |
| 1444 | .{ .vpcmpeqw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x75 }, 0, .vex_128_wig, .avx }, | |
| 1445 | .{ .vpcmpeqd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x76 }, 0, .vex_128_wig, .avx }, | |
| 1446 | ||
| 1447 | .{ .vpcmpeqq, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x29 }, 0, .vex_128_wig, .avx }, | |
| 1448 | ||
| 1449 | .{ .vpcmpgtb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x64 }, 0, .vex_128_wig, .avx }, | |
| 1450 | .{ .vpcmpgtw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x65 }, 0, .vex_128_wig, .avx }, | |
| 1451 | .{ .vpcmpgtd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x66 }, 0, .vex_128_wig, .avx }, | |
| 1452 | ||
| 1453 | .{ .vpcmpgtq, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x37 }, 0, .vex_128_wig, .avx }, | |
| 1454 | ||
| 1411 | 1455 | .{ .vpextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .vex_128_w0, .avx }, |
| 1412 | 1456 | .{ .vpextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w0, .avx }, |
| 1413 | 1457 | .{ .vpextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w1, .avx }, |
| ... | ... | @@ -1439,6 +1483,9 @@ pub const table = [_]Entry{ |
| 1439 | 1483 | |
| 1440 | 1484 | .{ .vpminud, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_128_wig, .avx }, |
| 1441 | 1485 | |
| 1486 | .{ .vpmovmskb, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .vex_128_wig, .avx }, | |
| 1487 | .{ .vpmovmskb, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .vex_128_wig, .avx }, | |
| 1488 | ||
| 1442 | 1489 | .{ .vpmulhw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_128_wig, .avx }, |
| 1443 | 1490 | |
| 1444 | 1491 | .{ .vpmulld, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .vex_128_wig, .avx }, |
| ... | ... | @@ -1581,29 +1628,44 @@ pub const table = [_]Entry{ |
| 1581 | 1628 | |
| 1582 | 1629 | .{ .vpandn, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_256_wig, .avx2 }, |
| 1583 | 1630 | |
| 1584 | .{ .vpmaxsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3c }, 0, .vex_256_wig, .avx }, | |
| 1585 | .{ .vpmaxsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xee }, 0, .vex_256_wig, .avx }, | |
| 1586 | .{ .vpmaxsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3d }, 0, .vex_256_wig, .avx }, | |
| 1631 | .{ .vpcmpeqb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x74 }, 0, .vex_256_wig, .avx2 }, | |
| 1632 | .{ .vpcmpeqw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x75 }, 0, .vex_256_wig, .avx2 }, | |
| 1633 | .{ .vpcmpeqd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x76 }, 0, .vex_256_wig, .avx2 }, | |
| 1634 | ||
| 1635 | .{ .vpcmpeqq, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x29 }, 0, .vex_256_wig, .avx2 }, | |
| 1636 | ||
| 1637 | .{ .vpcmpgtb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x64 }, 0, .vex_256_wig, .avx2 }, | |
| 1638 | .{ .vpcmpgtw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x65 }, 0, .vex_256_wig, .avx2 }, | |
| 1639 | .{ .vpcmpgtd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x66 }, 0, .vex_256_wig, .avx2 }, | |
| 1640 | ||
| 1641 | .{ .vpcmpgtq, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x37 }, 0, .vex_256_wig, .avx2 }, | |
| 1642 | ||
| 1643 | .{ .vpmaxsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3c }, 0, .vex_256_wig, .avx2 }, | |
| 1644 | .{ .vpmaxsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xee }, 0, .vex_256_wig, .avx2 }, | |
| 1645 | .{ .vpmaxsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3d }, 0, .vex_256_wig, .avx2 }, | |
| 1646 | ||
| 1647 | .{ .vpmaxub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xde }, 0, .vex_256_wig, .avx2 }, | |
| 1648 | .{ .vpmaxuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3e }, 0, .vex_256_wig, .avx2 }, | |
| 1587 | 1649 | |
| 1588 | .{ .vpmaxub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xde }, 0, .vex_256_wig, .avx }, | |
| 1589 | .{ .vpmaxuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3e }, 0, .vex_256_wig, .avx }, | |
| 1650 | .{ .vpmaxud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3f }, 0, .vex_256_wig, .avx2 }, | |
| 1590 | 1651 | |
| 1591 | .{ .vpmaxud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3f }, 0, .vex_256_wig, .avx }, | |
| 1652 | .{ .vpminsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x38 }, 0, .vex_256_wig, .avx2 }, | |
| 1653 | .{ .vpminsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xea }, 0, .vex_256_wig, .avx2 }, | |
| 1654 | .{ .vpminsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x39 }, 0, .vex_256_wig, .avx2 }, | |
| 1592 | 1655 | |
| 1593 | .{ .vpminsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x38 }, 0, .vex_256_wig, .avx }, | |
| 1594 | .{ .vpminsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xea }, 0, .vex_256_wig, .avx }, | |
| 1595 | .{ .vpminsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x39 }, 0, .vex_256_wig, .avx }, | |
| 1656 | .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx2 }, | |
| 1657 | .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx2 }, | |
| 1596 | 1658 | |
| 1597 | .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx }, | |
| 1598 | .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx }, | |
| 1659 | .{ .vpminud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_256_wig, .avx2 }, | |
| 1599 | 1660 | |
| 1600 | .{ .vpminud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_256_wig, .avx }, | |
| 1661 | .{ .vpmovmskb, .rm, &.{ .r32, .ymm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .vex_256_wig, .avx2 }, | |
| 1662 | .{ .vpmovmskb, .rm, &.{ .r64, .ymm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .vex_256_wig, .avx2 }, | |
| 1601 | 1663 | |
| 1602 | .{ .vpmulhw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_256_wig, .avx }, | |
| 1664 | .{ .vpmulhw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_256_wig, .avx2 }, | |
| 1603 | 1665 | |
| 1604 | .{ .vpmulld, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .vex_256_wig, .avx }, | |
| 1666 | .{ .vpmulld, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .vex_256_wig, .avx2 }, | |
| 1605 | 1667 | |
| 1606 | .{ .vpmullw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xd5 }, 0, .vex_256_wig, .avx }, | |
| 1668 | .{ .vpmullw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xd5 }, 0, .vex_256_wig, .avx2 }, | |
| 1607 | 1669 | |
| 1608 | 1670 | .{ .vpor, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_256_wig, .avx2 }, |
| 1609 | 1671 |