authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-21 19:30:45-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-23 22:42:18-04:00
logfe93332ba26b0cb8ca6ecce0b2c605d49a02ca87
tree54dc414f0ed33c259f717cdef5eeda7f136a7e81
parent794dc694b140908a9affc5b449cda09bbe971cfe

x86_64: implement enough to pass unicode tests

* implement vector comparison * implement reduce for bool vectors * fix `@memcpy` bug * enable passing std tests

45 files changed, 574 insertions(+), 525 deletions(-)

lib/std/Build.zig+1
...@@ -2156,5 +2156,6 @@ pub fn hex64(x: u64) [16]u8 {...@@ -2156,5 +2156,6 @@ pub fn hex64(x: u64) [16]u8 {
2156}2156}
21572157
2158test {2158test {
2159 _ = Cache;
2159 _ = Step;2160 _ = Step;
2160}2161}
lib/std/array_hash_map.zig+1-14
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const builtin = @import("builtin");
3const debug = std.debug;2const debug = std.debug;
4const assert = debug.assert;3const assert = debug.assert;
5const testing = std.testing;4const testing = std.testing;
...@@ -2138,8 +2137,6 @@ test "ensure capacity leak" {...@@ -2138,8 +2137,6 @@ test "ensure capacity leak" {
2138}2137}
21392138
2140test "big map" {2139test "big map" {
2141 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2142
2143 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2140 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2144 defer map.deinit();2141 defer map.deinit();
21452142
...@@ -2193,8 +2190,6 @@ test "big map" {...@@ -2193,8 +2190,6 @@ test "big map" {
2193}2190}
21942191
2195test "clone" {2192test "clone" {
2196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2197
2198 var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2193 var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2199 defer original.deinit();2194 defer original.deinit();
22002195
...@@ -2221,8 +2216,6 @@ test "clone" {...@@ -2221,8 +2216,6 @@ test "clone" {
2221}2216}
22222217
2223test "shrink" {2218test "shrink" {
2224 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2225
2226 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2219 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2227 defer map.deinit();2220 defer map.deinit();
22282221
...@@ -2263,8 +2256,6 @@ test "shrink" {...@@ -2263,8 +2256,6 @@ test "shrink" {
2263}2256}
22642257
2265test "pop" {2258test "pop" {
2266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2267
2268 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2259 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2269 defer map.deinit();2260 defer map.deinit();
22702261
...@@ -2283,8 +2274,6 @@ test "pop" {...@@ -2283,8 +2274,6 @@ test "pop" {
2283}2274}
22842275
2285test "popOrNull" {2276test "popOrNull" {
2286 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2287
2288 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2277 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2289 defer map.deinit();2278 defer map.deinit();
22902279
...@@ -2305,7 +2294,7 @@ test "popOrNull" {...@@ -2305,7 +2294,7 @@ test "popOrNull" {
2305}2294}
23062295
2307test "reIndex" {2296test "reIndex" {
2308 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;2297 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
23092298
2310 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);2299 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
2311 defer map.deinit();2300 defer map.deinit();
...@@ -2351,8 +2340,6 @@ test "auto store_hash" {...@@ -2351,8 +2340,6 @@ test "auto store_hash" {
2351}2340}
23522341
2353test "sort" {2342test "sort" {
2354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2355
2356 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2343 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2357 defer map.deinit();2344 defer map.deinit();
23582345
lib/std/array_list.zig-11
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const builtin = @import("builtin");
3const debug = std.debug;2const debug = std.debug;
4const assert = debug.assert;3const assert = debug.assert;
5const testing = std.testing;4const testing = std.testing;
...@@ -1184,8 +1183,6 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {...@@ -1184,8 +1183,6 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {
1184}1183}
11851184
1186test "std.ArrayList/ArrayListUnmanaged.clone" {1185test "std.ArrayList/ArrayListUnmanaged.clone" {
1187 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1188
1189 const a = testing.allocator;1186 const a = testing.allocator;
1190 {1187 {
1191 var array = ArrayList(i32).init(a);1188 var array = ArrayList(i32).init(a);
...@@ -1227,8 +1224,6 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {...@@ -1227,8 +1224,6 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {
1227}1224}
12281225
1229test "std.ArrayList/ArrayListUnmanaged.basic" {1226test "std.ArrayList/ArrayListUnmanaged.basic" {
1230 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1231
1232 const a = testing.allocator;1227 const a = testing.allocator;
1233 {1228 {
1234 var list = ArrayList(i32).init(a);1229 var list = ArrayList(i32).init(a);
...@@ -1513,8 +1508,6 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {...@@ -1513,8 +1508,6 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {
1513}1508}
15141509
1515test "std.ArrayList/ArrayListUnmanaged.insertSlice" {1510test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
1516 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1517
1518 const a = testing.allocator;1511 const a = testing.allocator;
1519 {1512 {
1520 var list = ArrayList(i32).init(a);1513 var list = ArrayList(i32).init(a);
...@@ -1561,8 +1554,6 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {...@@ -1561,8 +1554,6 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
1561}1554}
15621555
1563test "std.ArrayList/ArrayListUnmanaged.replaceRange" {1556test "std.ArrayList/ArrayListUnmanaged.replaceRange" {
1564 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1565
1566 var arena = std.heap.ArenaAllocator.init(testing.allocator);1557 var arena = std.heap.ArenaAllocator.init(testing.allocator);
1567 defer arena.deinit();1558 defer arena.deinit();
1568 const a = arena.allocator();1559 const a = arena.allocator();
...@@ -1734,8 +1725,6 @@ test "shrink still sets length when resizing is disabled" {...@@ -1734,8 +1725,6 @@ test "shrink still sets length when resizing is disabled" {
1734}1725}
17351726
1736test "shrinkAndFree with a copy" {1727test "shrinkAndFree with a copy" {
1737 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1738
1739 var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });1728 var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });
1740 const a = failing_allocator.allocator();1729 const a = failing_allocator.allocator();
17411730
lib/std/bit_set.zig+3-12
...@@ -1637,10 +1637,8 @@ fn testStaticBitSet(comptime Set: type) !void {...@@ -1637,10 +1637,8 @@ fn testStaticBitSet(comptime Set: type) !void {
1637}1637}
16381638
1639test "IntegerBitSet" {1639test "IntegerBitSet" {
1640 switch (builtin.zig_backend) {1640 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1641 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,1641 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1642 else => {},
1643 }
16441642
1645 try testStaticBitSet(IntegerBitSet(0));1643 try testStaticBitSet(IntegerBitSet(0));
1646 try testStaticBitSet(IntegerBitSet(1));1644 try testStaticBitSet(IntegerBitSet(1));
...@@ -1653,10 +1651,7 @@ test "IntegerBitSet" {...@@ -1653,10 +1651,7 @@ test "IntegerBitSet" {
1653}1651}
16541652
1655test "ArrayBitSet" {1653test "ArrayBitSet" {
1656 switch (builtin.zig_backend) {1654 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1657 .stage2_x86_64 => return error.SkipZigTest,
1658 else => {},
1659 }
16601655
1661 inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {1656 inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {
1662 try testStaticBitSet(ArrayBitSet(u8, size));1657 try testStaticBitSet(ArrayBitSet(u8, size));
...@@ -1668,8 +1663,6 @@ test "ArrayBitSet" {...@@ -1668,8 +1663,6 @@ test "ArrayBitSet" {
1668}1663}
16691664
1670test "DynamicBitSetUnmanaged" {1665test "DynamicBitSetUnmanaged" {
1671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1672
1673 const allocator = std.testing.allocator;1666 const allocator = std.testing.allocator;
1674 var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);1667 var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);
1675 try testing.expectEqual(@as(usize, 0), a.count());1668 try testing.expectEqual(@as(usize, 0), a.count());
...@@ -1723,8 +1716,6 @@ test "DynamicBitSetUnmanaged" {...@@ -1723,8 +1716,6 @@ test "DynamicBitSetUnmanaged" {
1723}1716}
17241717
1725test "DynamicBitSet" {1718test "DynamicBitSet" {
1726 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1727
1728 const allocator = std.testing.allocator;1719 const allocator = std.testing.allocator;
1729 var a = try DynamicBitSet.initEmpty(allocator, 300);1720 var a = try DynamicBitSet.initEmpty(allocator, 300);
1730 try testing.expectEqual(@as(usize, 0), a.count());1721 try testing.expectEqual(@as(usize, 0), a.count());
lib/std/crypto/argon2.zig-10
...@@ -622,8 +622,6 @@ pub fn strVerify(...@@ -622,8 +622,6 @@ pub fn strVerify(
622}622}
623623
624test "argon2d" {624test "argon2d" {
625 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
626
627 const password = [_]u8{0x01} ** 32;625 const password = [_]u8{0x01} ** 32;
628 const salt = [_]u8{0x02} ** 16;626 const salt = [_]u8{0x02} ** 16;
629 const secret = [_]u8{0x03} ** 8;627 const secret = [_]u8{0x03} ** 8;
...@@ -649,8 +647,6 @@ test "argon2d" {...@@ -649,8 +647,6 @@ test "argon2d" {
649}647}
650648
651test "argon2i" {649test "argon2i" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654 const password = [_]u8{0x01} ** 32;650 const password = [_]u8{0x01} ** 32;
655 const salt = [_]u8{0x02} ** 16;651 const salt = [_]u8{0x02} ** 16;
656 const secret = [_]u8{0x03} ** 8;652 const secret = [_]u8{0x03} ** 8;
...@@ -676,8 +672,6 @@ test "argon2i" {...@@ -676,8 +672,6 @@ test "argon2i" {
676}672}
677673
678test "argon2id" {674test "argon2id" {
679 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
680
681 const password = [_]u8{0x01} ** 32;675 const password = [_]u8{0x01} ** 32;
682 const salt = [_]u8{0x02} ** 16;676 const salt = [_]u8{0x02} ** 16;
683 const secret = [_]u8{0x03} ** 8;677 const secret = [_]u8{0x03} ** 8;
...@@ -703,8 +697,6 @@ test "argon2id" {...@@ -703,8 +697,6 @@ test "argon2id" {
703}697}
704698
705test "kdf" {699test "kdf" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
708 const password = "password";700 const password = "password";
709 const salt = "somesalt";701 const salt = "somesalt";
710702
...@@ -936,8 +928,6 @@ test "password hash and password verify" {...@@ -936,8 +928,6 @@ test "password hash and password verify" {
936}928}
937929
938test "kdf derived key length" {930test "kdf derived key length" {
939 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
940
941 const allocator = std.testing.allocator;931 const allocator = std.testing.allocator;
942932
943 const password = "testpass";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,8 +682,6 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void {
682}682}
683683
684test "BLAKE3 reference test cases" {684test "BLAKE3 reference test cases" {
685 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
686
687 var hash_state = Blake3.init(.{});685 var hash_state = Blake3.init(.{});
688 const hash = &hash_state;686 const hash = &hash_state;
689 var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* });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,8 +759,6 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type {
759}759}
760760
761test "chacha20 AEAD API" {761test "chacha20 AEAD API" {
762 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
763
764 const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 };762 const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 };
765 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.";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 const ad = "Additional data";764 const ad = "Additional data";
...@@ -782,8 +780,6 @@ test "chacha20 AEAD API" {...@@ -782,8 +780,6 @@ test "chacha20 AEAD API" {
782780
783// https://tools.ietf.org/html/rfc7539#section-2.4.2781// https://tools.ietf.org/html/rfc7539#section-2.4.2
784test "crypto.chacha20 test vector sunscreen" {782test "crypto.chacha20 test vector sunscreen" {
785 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
786
787 const expected_result = [_]u8{783 const expected_result = [_]u8{
788 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,784 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,
789 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81,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,8 +65,6 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384);
65pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);65pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);
6666
67test "Hash composition" {67test "Hash composition" {
68 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
70 const Sha256 = sha2.Sha256;68 const Sha256 = sha2.Sha256;
71 const msg = "test";69 const msg = "test";
7270
lib/std/crypto/hkdf.zig-2
...@@ -72,8 +72,6 @@ pub fn Hkdf(comptime Hmac: type) type {...@@ -72,8 +72,6 @@ pub fn Hkdf(comptime Hmac: type) type {
72const htest = @import("test.zig");72const htest = @import("test.zig");
7373
74test "Hkdf" {74test "Hkdf" {
75 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
76
77 const ikm = [_]u8{0x0b} ** 22;75 const ikm = [_]u8{0x0b} ** 22;
78 const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };76 const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };
79 const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 };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,8 +553,6 @@ const inv_ntt_reductions = [_]i16{
553};553};
554554
555test "invNTTReductions bounds" {555test "invNTTReductions bounds" {
556 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
557
558 // Checks whether the reductions proposed by invNTTReductions556 // Checks whether the reductions proposed by invNTTReductions
559 // don't overflow during invNTT().557 // don't overflow during invNTT().
560 var xs = [_]i32{1} ** 256; // start at |x| ≤ q558 var xs = [_]i32{1} ** 256; // start at |x| ≤ q
...@@ -658,8 +656,6 @@ fn montReduce(x: i32) i16 {...@@ -658,8 +656,6 @@ fn montReduce(x: i32) i16 {
658}656}
659657
660test "Test montReduce" {658test "Test montReduce" {
661 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
662
663 var rnd = RndGen.init(0);659 var rnd = RndGen.init(0);
664 for (0..1000) |_| {660 for (0..1000) |_| {
665 const bound = comptime @as(i32, Q) * (1 << 15);661 const bound = comptime @as(i32, Q) * (1 << 15);
...@@ -678,8 +674,6 @@ fn feToMont(x: i16) i16 {...@@ -678,8 +674,6 @@ fn feToMont(x: i16) i16 {
678}674}
679675
680test "Test feToMont" {676test "Test feToMont" {
681 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
682
683 var x: i32 = -(1 << 15);677 var x: i32 = -(1 << 15);
684 while (x < 1 << 15) : (x += 1) {678 while (x < 1 << 15) : (x += 1) {
685 const y = feToMont(@as(i16, @intCast(x)));679 const y = feToMont(@as(i16, @intCast(x)));
...@@ -713,8 +707,6 @@ fn feBarrettReduce(x: i16) i16 {...@@ -713,8 +707,6 @@ fn feBarrettReduce(x: i16) i16 {
713}707}
714708
715test "Test Barrett reduction" {709test "Test Barrett reduction" {
716 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
717
718 var x: i32 = -(1 << 15);710 var x: i32 = -(1 << 15);
719 while (x < 1 << 15) : (x += 1) {711 while (x < 1 << 15) : (x += 1) {
720 var y1 = feBarrettReduce(@as(i16, @intCast(x)));712 var y1 = feBarrettReduce(@as(i16, @intCast(x)));
...@@ -735,8 +727,6 @@ fn csubq(x: i16) i16 {...@@ -735,8 +727,6 @@ fn csubq(x: i16) i16 {
735}727}
736728
737test "Test csubq" {729test "Test csubq" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
740 var x: i32 = -29439;730 var x: i32 = -29439;
741 while (x < 1 << 15) : (x += 1) {731 while (x < 1 << 15) : (x += 1) {
742 const y1 = csubq(@as(i16, @intCast(x)));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,8 +1466,6 @@ fn cmov(comptime len: usize, dst: *[len]u8, src: [len]u8, b: u1) void {
1476}1466}
14771467
1478test "MulHat" {1468test "MulHat" {
1479 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1480
1481 var rnd = RndGen.init(0);1469 var rnd = RndGen.init(0);
14821470
1483 for (0..100) |_| {1471 for (0..100) |_| {
...@@ -1509,8 +1497,6 @@ test "MulHat" {...@@ -1509,8 +1497,6 @@ test "MulHat" {
1509}1497}
15101498
1511test "NTT" {1499test "NTT" {
1512 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1513
1514 var rnd = RndGen.init(0);1500 var rnd = RndGen.init(0);
15151501
1516 for (0..1000) |_| {1502 for (0..1000) |_| {
...@@ -1534,8 +1520,6 @@ test "NTT" {...@@ -1534,8 +1520,6 @@ test "NTT" {
1534}1520}
15351521
1536test "Compression" {1522test "Compression" {
1537 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1538
1539 var rnd = RndGen.init(0);1523 var rnd = RndGen.init(0);
1540 inline for (.{ 1, 4, 5, 10, 11 }) |d| {1524 inline for (.{ 1, 4, 5, 10, 11 }) |d| {
1541 for (0..1000) |_| {1525 for (0..1000) |_| {
...@@ -1548,8 +1532,6 @@ test "Compression" {...@@ -1548,8 +1532,6 @@ test "Compression" {
1548}1532}
15491533
1550test "noise" {1534test "noise" {
1551 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1552
1553 var seed: [32]u8 = undefined;1535 var seed: [32]u8 = undefined;
1554 for (&seed, 0..) |*s, i| {1536 for (&seed, 0..) |*s, i| {
1555 s.* = @as(u8, @intCast(i));1537 s.* = @as(u8, @intCast(i));
...@@ -1596,8 +1578,6 @@ test "noise" {...@@ -1596,8 +1578,6 @@ test "noise" {
1596}1578}
15971579
1598test "uniform sampling" {1580test "uniform sampling" {
1599 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1600
1601 var seed: [32]u8 = undefined;1581 var seed: [32]u8 = undefined;
1602 for (&seed, 0..) |*s, i| {1582 for (&seed, 0..) |*s, i| {
1603 s.* = @as(u8, @intCast(i));1583 s.* = @as(u8, @intCast(i));
...@@ -1631,8 +1611,6 @@ test "uniform sampling" {...@@ -1631,8 +1611,6 @@ test "uniform sampling" {
1631}1611}
16321612
1633test "Polynomial packing" {1613test "Polynomial packing" {
1634 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1635
1636 var rnd = RndGen.init(0);1614 var rnd = RndGen.init(0);
16371615
1638 for (0..1000) |_| {1616 for (0..1000) |_| {
...@@ -1642,8 +1620,6 @@ test "Polynomial packing" {...@@ -1642,8 +1620,6 @@ test "Polynomial packing" {
1642}1620}
16431621
1644test "Test inner PKE" {1622test "Test inner PKE" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
1647 var seed: [32]u8 = undefined;1623 var seed: [32]u8 = undefined;
1648 var pt: [32]u8 = undefined;1624 var pt: [32]u8 = undefined;
1649 for (&seed, &pt, 0..) |*s, *p, i| {1625 for (&seed, &pt, 0..) |*s, *p, i| {
...@@ -1665,8 +1641,6 @@ test "Test inner PKE" {...@@ -1665,8 +1641,6 @@ test "Test inner PKE" {
1665}1641}
16661642
1667test "Test happy flow" {1643test "Test happy flow" {
1668 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1669
1670 var seed: [64]u8 = undefined;1644 var seed: [64]u8 = undefined;
1671 for (&seed, 0..) |*s, i| {1645 for (&seed, 0..) |*s, i| {
1672 s.* = @as(u8, @intCast(i));1646 s.* = @as(u8, @intCast(i));
lib/std/crypto/pbkdf2.zig-15
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const mem = std.mem;2const mem = std.mem;
4const maxInt = std.math.maxInt;3const maxInt = std.math.maxInt;
5const OutputTooLongError = std.crypto.errors.OutputTooLongError;4const OutputTooLongError = std.crypto.errors.OutputTooLongError;
...@@ -152,8 +151,6 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;...@@ -152,8 +151,6 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;
152// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors151// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors
153152
154test "RFC 6070 one iteration" {153test "RFC 6070 one iteration" {
155 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
156
157 const p = "password";154 const p = "password";
158 const s = "salt";155 const s = "salt";
159 const c = 1;156 const c = 1;
...@@ -169,8 +166,6 @@ test "RFC 6070 one iteration" {...@@ -169,8 +166,6 @@ test "RFC 6070 one iteration" {
169}166}
170167
171test "RFC 6070 two iterations" {168test "RFC 6070 two iterations" {
172 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
173
174 const p = "password";169 const p = "password";
175 const s = "salt";170 const s = "salt";
176 const c = 2;171 const c = 2;
...@@ -186,8 +181,6 @@ test "RFC 6070 two iterations" {...@@ -186,8 +181,6 @@ test "RFC 6070 two iterations" {
186}181}
187182
188test "RFC 6070 4096 iterations" {183test "RFC 6070 4096 iterations" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
191 const p = "password";184 const p = "password";
192 const s = "salt";185 const s = "salt";
193 const c = 4096;186 const c = 4096;
...@@ -203,8 +196,6 @@ test "RFC 6070 4096 iterations" {...@@ -203,8 +196,6 @@ test "RFC 6070 4096 iterations" {
203}196}
204197
205test "RFC 6070 16,777,216 iterations" {198test "RFC 6070 16,777,216 iterations" {
206 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
207
208 // These iteration tests are slow so we always skip them. Results have been verified.199 // These iteration tests are slow so we always skip them. Results have been verified.
209 if (true) {200 if (true) {
210 return error.SkipZigTest;201 return error.SkipZigTest;
...@@ -225,8 +216,6 @@ test "RFC 6070 16,777,216 iterations" {...@@ -225,8 +216,6 @@ test "RFC 6070 16,777,216 iterations" {
225}216}
226217
227test "RFC 6070 multi-block salt and password" {218test "RFC 6070 multi-block salt and password" {
228 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
229
230 const p = "passwordPASSWORDpassword";219 const p = "passwordPASSWORDpassword";
231 const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";220 const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";
232 const c = 4096;221 const c = 4096;
...@@ -242,8 +231,6 @@ test "RFC 6070 multi-block salt and password" {...@@ -242,8 +231,6 @@ test "RFC 6070 multi-block salt and password" {
242}231}
243232
244test "RFC 6070 embedded NUL" {233test "RFC 6070 embedded NUL" {
245 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
246
247 const p = "pass\x00word";234 const p = "pass\x00word";
248 const s = "sa\x00lt";235 const s = "sa\x00lt";
249 const c = 4096;236 const c = 4096;
...@@ -259,8 +246,6 @@ test "RFC 6070 embedded NUL" {...@@ -259,8 +246,6 @@ test "RFC 6070 embedded NUL" {
259}246}
260247
261test "Very large dk_len" {248test "Very large dk_len" {
262 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
263
264 // This test allocates 8GB of memory and is expected to take several hours to run.249 // This test allocates 8GB of memory and is expected to take several hours to run.
265 if (true) {250 if (true) {
266 return error.SkipZigTest;251 return error.SkipZigTest;
lib/std/crypto/phc_encoding.zig-4
...@@ -351,16 +351,12 @@ test "phc format - encoding/decoding" {...@@ -351,16 +351,12 @@ test "phc format - encoding/decoding" {
351}351}
352352
353test "phc format - empty input string" {353test "phc format - empty input string" {
354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
355
356 const s = "";354 const s = "";
357 const v = deserialize(struct { alg_id: []const u8 }, s);355 const v = deserialize(struct { alg_id: []const u8 }, s);
358 try std.testing.expectError(Error.InvalidEncoding, v);356 try std.testing.expectError(Error.InvalidEncoding, v);
359}357}
360358
361test "phc format - hash without salt" {359test "phc format - hash without salt" {
362 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
363
364 const s = "$scrypt";360 const s = "$scrypt";
365 const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);361 const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);
366 try std.testing.expectError(Error.InvalidEncoding, v);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,7 +302,7 @@ fn SalsaNonVecImpl(comptime rounds: comptime_int) type {
302 };302 };
303}303}
304304
305const SalsaImpl = if (builtin.cpu.arch == .x86_64) SalsaVecImpl else SalsaNonVecImpl;305const SalsaImpl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64) SalsaVecImpl else SalsaNonVecImpl;
306306
307fn keyToWords(key: [32]u8) [8]u32 {307fn keyToWords(key: [32]u8) [8]u32 {
308 var k: [8]u32 = undefined;308 var k: [8]u32 = undefined;
...@@ -555,8 +555,6 @@ pub const SealedBox = struct {...@@ -555,8 +555,6 @@ pub const SealedBox = struct {
555const htest = @import("test.zig");555const htest = @import("test.zig");
556556
557test "(x)salsa20" {557test "(x)salsa20" {
558 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
559
560 const key = [_]u8{0x69} ** 32;558 const key = [_]u8{0x69} ** 32;
561 const nonce = [_]u8{0x42} ** 8;559 const nonce = [_]u8{0x42} ** 8;
562 const msg = [_]u8{0} ** 20;560 const msg = [_]u8{0} ** 20;
...@@ -571,8 +569,6 @@ test "(x)salsa20" {...@@ -571,8 +569,6 @@ test "(x)salsa20" {
571}569}
572570
573test "xsalsa20poly1305" {571test "xsalsa20poly1305" {
574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
575
576 var msg: [100]u8 = undefined;572 var msg: [100]u8 = undefined;
577 var msg2: [msg.len]u8 = undefined;573 var msg2: [msg.len]u8 = undefined;
578 var c: [msg.len]u8 = undefined;574 var c: [msg.len]u8 = undefined;
...@@ -588,8 +584,6 @@ test "xsalsa20poly1305" {...@@ -588,8 +584,6 @@ test "xsalsa20poly1305" {
588}584}
589585
590test "xsalsa20poly1305 secretbox" {586test "xsalsa20poly1305 secretbox" {
591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
592
593 var msg: [100]u8 = undefined;587 var msg: [100]u8 = undefined;
594 var msg2: [msg.len]u8 = undefined;588 var msg2: [msg.len]u8 = undefined;
595 var key: [XSalsa20Poly1305.key_length]u8 = undefined;589 var key: [XSalsa20Poly1305.key_length]u8 = undefined;
lib/std/crypto/scrypt.zig-5
...@@ -3,7 +3,6 @@...@@ -3,7 +3,6 @@
3// https://github.com/Tarsnap/scrypt3// https://github.com/Tarsnap/scrypt
44
5const std = @import("std");5const std = @import("std");
6const builtin = @import("builtin");
7const crypto = std.crypto;6const crypto = std.crypto;
8const fmt = std.fmt;7const fmt = std.fmt;
9const io = std.io;8const io = std.io;
...@@ -684,8 +683,6 @@ test "unix-scrypt" {...@@ -684,8 +683,6 @@ test "unix-scrypt" {
684}683}
685684
686test "crypt format" {685test "crypt format" {
687 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
688
689 const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";686 const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";
690 const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);687 const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);
691 var buf: [str.len]u8 = undefined;688 var buf: [str.len]u8 = undefined;
...@@ -694,8 +691,6 @@ test "crypt format" {...@@ -694,8 +691,6 @@ test "crypt format" {
694}691}
695692
696test "kdf fast" {693test "kdf fast" {
697 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
698
699 const TestVector = struct {694 const TestVector = struct {
700 password: []const u8,695 password: []const u8,
701 salt: []const u8,696 salt: []const u8,
lib/std/crypto/sha2.zig-10
...@@ -406,16 +406,12 @@ fn Sha2x32(comptime params: Sha2Params32) type {...@@ -406,16 +406,12 @@ fn Sha2x32(comptime params: Sha2Params32) type {
406}406}
407407
408test "sha224 single" {408test "sha224 single" {
409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
410
411 try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");409 try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");
412 try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");410 try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");
413 try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");411 try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
414}412}
415413
416test "sha224 streaming" {414test "sha224 streaming" {
417 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
418
419 var h = Sha224.init(.{});415 var h = Sha224.init(.{});
420 var out: [28]u8 = undefined;416 var out: [28]u8 = undefined;
421417
...@@ -436,16 +432,12 @@ test "sha224 streaming" {...@@ -436,16 +432,12 @@ test "sha224 streaming" {
436}432}
437433
438test "sha256 single" {434test "sha256 single" {
439 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
440
441 try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");435 try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");
442 try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");436 try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");
443 try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");437 try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
444}438}
445439
446test "sha256 streaming" {440test "sha256 streaming" {
447 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
448
449 var h = Sha256.init(.{});441 var h = Sha256.init(.{});
450 var out: [32]u8 = undefined;442 var out: [32]u8 = undefined;
451443
...@@ -466,8 +458,6 @@ test "sha256 streaming" {...@@ -466,8 +458,6 @@ test "sha256 streaming" {
466}458}
467459
468test "sha256 aligned final" {460test "sha256 aligned final" {
469 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
470
471 var block = [_]u8{0} ** Sha256.block_length;461 var block = [_]u8{0} ** Sha256.block_length;
472 var out: [Sha256.digest_length]u8 = undefined;462 var out: [Sha256.digest_length]u8 = undefined;
473463
lib/std/fifo.zig-2
...@@ -505,8 +505,6 @@ test "LinearFifo(u8, .Dynamic)" {...@@ -505,8 +505,6 @@ test "LinearFifo(u8, .Dynamic)" {
505}505}
506506
507test "LinearFifo" {507test "LinearFifo" {
508 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
509
510 inline for ([_]type{ u1, u8, u16, u64 }) |T| {508 inline for ([_]type{ u1, u8, u16, u64 }) |T| {
511 inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {509 inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {
512 const FifoType = LinearFifo(T, bt);510 const FifoType = LinearFifo(T, bt);
lib/std/fmt.zig-2
...@@ -2751,8 +2751,6 @@ test "formatType max_depth" {...@@ -2751,8 +2751,6 @@ test "formatType max_depth" {
2751}2751}
27522752
2753test "positional" {2753test "positional" {
2754 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2755
2756 try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });2754 try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
2757 try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });2755 try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
2758 try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});2756 try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});
lib/std/json.zig-4
...@@ -38,8 +38,6 @@ test parseFromSlice {...@@ -38,8 +38,6 @@ test parseFromSlice {
38}38}
3939
40test Value {40test Value {
41 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
42
43 var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});41 var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});
44 defer parsed.deinit();42 defer parsed.deinit();
45 try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);43 try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);
...@@ -65,8 +63,6 @@ test writeStream {...@@ -65,8 +63,6 @@ test writeStream {
65}63}
6664
67test stringify {65test stringify {
68 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
70 var out = ArrayList(u8).init(testing.allocator);66 var out = ArrayList(u8).init(testing.allocator);
71 defer out.deinit();67 defer out.deinit();
7268
lib/std/json/JSONTestSuite_test.zig-66
...@@ -104,8 +104,6 @@ test "i_string_utf16LE_no_BOM.json" {...@@ -104,8 +104,6 @@ test "i_string_utf16LE_no_BOM.json" {
104 try any("[\x00\"\x00\xe9\x00\"\x00]\x00");104 try any("[\x00\"\x00\xe9\x00\"\x00]\x00");
105}105}
106test "i_structure_500_nested_arrays.json" {106test "i_structure_500_nested_arrays.json" {
107 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
108
109 try any("[" ** 500 ++ "]" ** 500);107 try any("[" ** 500 ++ "]" ** 500);
110}108}
111test "i_structure_UTF-8_BOM_empty_object.json" {109test "i_structure_UTF-8_BOM_empty_object.json" {
...@@ -361,21 +359,15 @@ test "n_object_bracket_key.json" {...@@ -361,21 +359,15 @@ test "n_object_bracket_key.json" {
361 try err("{[: \"x\"}\n");359 try err("{[: \"x\"}\n");
362}360}
363test "n_object_comma_instead_of_colon.json" {361test "n_object_comma_instead_of_colon.json" {
364 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
365
366 try err("{\"x\", null}");362 try err("{\"x\", null}");
367}363}
368test "n_object_double_colon.json" {364test "n_object_double_colon.json" {
369 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
370
371 try err("{\"x\"::\"b\"}");365 try err("{\"x\"::\"b\"}");
372}366}
373test "n_object_emoji.json" {367test "n_object_emoji.json" {
374 try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");368 try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");
375}369}
376test "n_object_garbage_at_end.json" {370test "n_object_garbage_at_end.json" {
377 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
378
379 try err("{\"a\":\"a\" 123}");371 try err("{\"a\":\"a\" 123}");
380}372}
381test "n_object_key_with_single_quotes.json" {373test "n_object_key_with_single_quotes.json" {
...@@ -385,26 +377,18 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {...@@ -385,26 +377,18 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {
385 try err("{\"\xb9\":\"0\",}");377 try err("{\"\xb9\":\"0\",}");
386}378}
387test "n_object_missing_colon.json" {379test "n_object_missing_colon.json" {
388 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
390 try err("{\"a\" b}");380 try err("{\"a\" b}");
391}381}
392test "n_object_missing_key.json" {382test "n_object_missing_key.json" {
393 try err("{:\"b\"}");383 try err("{:\"b\"}");
394}384}
395test "n_object_missing_semicolon.json" {385test "n_object_missing_semicolon.json" {
396 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
397
398 try err("{\"a\" \"b\"}");386 try err("{\"a\" \"b\"}");
399}387}
400test "n_object_missing_value.json" {388test "n_object_missing_value.json" {
401 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
402
403 try err("{\"a\":");389 try err("{\"a\":");
404}390}
405test "n_object_no-colon.json" {391test "n_object_no-colon.json" {
406 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
407
408 try err("{\"a\"");392 try err("{\"a\"");
409}393}
410test "n_object_non_string_key.json" {394test "n_object_non_string_key.json" {
...@@ -417,59 +401,39 @@ test "n_object_repeated_null_null.json" {...@@ -417,59 +401,39 @@ test "n_object_repeated_null_null.json" {
417 try err("{null:null,null:null}");401 try err("{null:null,null:null}");
418}402}
419test "n_object_several_trailing_commas.json" {403test "n_object_several_trailing_commas.json" {
420 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
421
422 try err("{\"id\":0,,,,,}");404 try err("{\"id\":0,,,,,}");
423}405}
424test "n_object_single_quote.json" {406test "n_object_single_quote.json" {
425 try err("{'a':0}");407 try err("{'a':0}");
426}408}
427test "n_object_trailing_comma.json" {409test "n_object_trailing_comma.json" {
428 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
429
430 try err("{\"id\":0,}");410 try err("{\"id\":0,}");
431}411}
432test "n_object_trailing_comment.json" {412test "n_object_trailing_comment.json" {
433 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
434
435 try err("{\"a\":\"b\"}/**/");413 try err("{\"a\":\"b\"}/**/");
436}414}
437test "n_object_trailing_comment_open.json" {415test "n_object_trailing_comment_open.json" {
438 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
439
440 try err("{\"a\":\"b\"}/**//");416 try err("{\"a\":\"b\"}/**//");
441}417}
442test "n_object_trailing_comment_slash_open.json" {418test "n_object_trailing_comment_slash_open.json" {
443 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
444
445 try err("{\"a\":\"b\"}//");419 try err("{\"a\":\"b\"}//");
446}420}
447test "n_object_trailing_comment_slash_open_incomplete.json" {421test "n_object_trailing_comment_slash_open_incomplete.json" {
448 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
449
450 try err("{\"a\":\"b\"}/");422 try err("{\"a\":\"b\"}/");
451}423}
452test "n_object_two_commas_in_a_row.json" {424test "n_object_two_commas_in_a_row.json" {
453 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
454
455 try err("{\"a\":\"b\",,\"c\":\"d\"}");425 try err("{\"a\":\"b\",,\"c\":\"d\"}");
456}426}
457test "n_object_unquoted_key.json" {427test "n_object_unquoted_key.json" {
458 try err("{a: \"b\"}");428 try err("{a: \"b\"}");
459}429}
460test "n_object_unterminated-value.json" {430test "n_object_unterminated-value.json" {
461 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
462
463 try err("{\"a\":\"a");431 try err("{\"a\":\"a");
464}432}
465test "n_object_with_single_string.json" {433test "n_object_with_single_string.json" {
466 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
467
468 try err("{ \"foo\" : \"bar\", \"a\" }");434 try err("{ \"foo\" : \"bar\", \"a\" }");
469}435}
470test "n_object_with_trailing_garbage.json" {436test "n_object_with_trailing_garbage.json" {
471 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
472
473 try err("{\"a\":\"b\"}#");437 try err("{\"a\":\"b\"}#");
474}438}
475test "n_single_space.json" {439test "n_single_space.json" {
...@@ -596,8 +560,6 @@ test "n_structure_close_unopened_array.json" {...@@ -596,8 +560,6 @@ test "n_structure_close_unopened_array.json" {
596 try err("1]");560 try err("1]");
597}561}
598test "n_structure_comma_instead_of_closing_brace.json" {562test "n_structure_comma_instead_of_closing_brace.json" {
599 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
600
601 try err("{\"x\": true,");563 try err("{\"x\": true,");
602}564}
603test "n_structure_double_array.json" {565test "n_structure_double_array.json" {
...@@ -628,18 +590,12 @@ test "n_structure_object_followed_by_closing_object.json" {...@@ -628,18 +590,12 @@ test "n_structure_object_followed_by_closing_object.json" {
628 try err("{}}");590 try err("{}}");
629}591}
630test "n_structure_object_unclosed_no_value.json" {592test "n_structure_object_unclosed_no_value.json" {
631 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
632
633 try err("{\"\":");593 try err("{\"\":");
634}594}
635test "n_structure_object_with_comment.json" {595test "n_structure_object_with_comment.json" {
636 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
637
638 try err("{\"a\":/*comment*/\"b\"}");596 try err("{\"a\":/*comment*/\"b\"}");
639}597}
640test "n_structure_object_with_trailing_garbage.json" {598test "n_structure_object_with_trailing_garbage.json" {
641 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
642
643 try err("{\"a\": true} \"x\"");599 try err("{\"a\": true} \"x\"");
644}600}
645test "n_structure_open_array_apostrophe.json" {601test "n_structure_open_array_apostrophe.json" {
...@@ -649,8 +605,6 @@ test "n_structure_open_array_comma.json" {...@@ -649,8 +605,6 @@ test "n_structure_open_array_comma.json" {
649 try err("[,");605 try err("[,");
650}606}
651test "n_structure_open_array_object.json" {607test "n_structure_open_array_object.json" {
652 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654 try err("[{\"\":" ** 50000 ++ "\n");608 try err("[{\"\":" ** 50000 ++ "\n");
655}609}
656test "n_structure_open_array_open_object.json" {610test "n_structure_open_array_open_object.json" {
...@@ -690,8 +644,6 @@ test "n_structure_single_star.json" {...@@ -690,8 +644,6 @@ test "n_structure_single_star.json" {
690 try err("*");644 try err("*");
691}645}
692test "n_structure_trailing_#.json" {646test "n_structure_trailing_#.json" {
693 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
694
695 try err("{\"a\":\"b\"}#{}");647 try err("{\"a\":\"b\"}#{}");
696}648}
697test "n_structure_uescaped_LF_before_string.json" {649test "n_structure_uescaped_LF_before_string.json" {
...@@ -710,8 +662,6 @@ test "n_structure_unclosed_array_unfinished_true.json" {...@@ -710,8 +662,6 @@ test "n_structure_unclosed_array_unfinished_true.json" {
710 try err("[ false, tru");662 try err("[ false, tru");
711}663}
712test "n_structure_unclosed_object.json" {664test "n_structure_unclosed_object.json" {
713 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
714
715 try err("{\"asd\":\"asd\"");665 try err("{\"asd\":\"asd\"");
716}666}
717test "n_structure_unicode-identifier.json" {667test "n_structure_unicode-identifier.json" {
...@@ -819,31 +769,21 @@ test "y_object.json" {...@@ -819,31 +769,21 @@ test "y_object.json" {
819 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");769 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
820}770}
821test "y_object_basic.json" {771test "y_object_basic.json" {
822 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
823
824 try ok("{\"asd\":\"sdf\"}");772 try ok("{\"asd\":\"sdf\"}");
825}773}
826test "y_object_duplicated_key.json" {774test "y_object_duplicated_key.json" {
827 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
828
829 try ok("{\"a\":\"b\",\"a\":\"c\"}");775 try ok("{\"a\":\"b\",\"a\":\"c\"}");
830}776}
831test "y_object_duplicated_key_and_value.json" {777test "y_object_duplicated_key_and_value.json" {
832 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
833
834 try ok("{\"a\":\"b\",\"a\":\"b\"}");778 try ok("{\"a\":\"b\",\"a\":\"b\"}");
835}779}
836test "y_object_empty.json" {780test "y_object_empty.json" {
837 try ok("{}");781 try ok("{}");
838}782}
839test "y_object_empty_key.json" {783test "y_object_empty_key.json" {
840 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
841
842 try ok("{\"\":0}");784 try ok("{\"\":0}");
843}785}
844test "y_object_escaped_null_in_key.json" {786test "y_object_escaped_null_in_key.json" {
845 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
846
847 try ok("{\"foo\\u0000bar\": 42}");787 try ok("{\"foo\\u0000bar\": 42}");
848}788}
849test "y_object_extreme_numbers.json" {789test "y_object_extreme_numbers.json" {
...@@ -857,18 +797,12 @@ test "y_object_long_strings.json" {...@@ -857,18 +797,12 @@ test "y_object_long_strings.json" {
857 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");797 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
858}798}
859test "y_object_simple.json" {799test "y_object_simple.json" {
860 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
861
862 try ok("{\"a\":[]}");800 try ok("{\"a\":[]}");
863}801}
864test "y_object_string_unicode.json" {802test "y_object_string_unicode.json" {
865 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
866
867 try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");803 try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");
868}804}
869test "y_object_with_newlines.json" {805test "y_object_with_newlines.json" {
870 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
871
872 try ok("{\n\"a\": \"b\"\n}");806 try ok("{\n\"a\": \"b\"\n}");
873}807}
874test "y_string_1_2_3_bytes_UTF-8_sequences.json" {808test "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,16 +125,12 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value {
125}125}
126126
127test "parsing empty string gives appropriate error" {127test "parsing empty string gives appropriate error" {
128 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
129
130 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);128 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
131 defer arena_allocator.deinit();129 defer arena_allocator.deinit();
132 try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));130 try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));
133}131}
134132
135test "Value.array allocator should still be usable after parsing" {133test "Value.array allocator should still be usable after parsing" {
136 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
137
138 var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});134 var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});
139 defer parsed.deinit();135 defer parsed.deinit();
140136
...@@ -195,8 +191,6 @@ test "escaped characters" {...@@ -195,8 +191,6 @@ test "escaped characters" {
195}191}
196192
197test "Value.jsonStringify" {193test "Value.jsonStringify" {
198 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
199
200 var vals = [_]Value{194 var vals = [_]Value{
201 .{ .integer = 1 },195 .{ .integer = 1 },
202 .{ .integer = 2 },196 .{ .integer = 2 },
...@@ -263,8 +257,6 @@ test "parseFromValue(std.json.Value,...)" {...@@ -263,8 +257,6 @@ test "parseFromValue(std.json.Value,...)" {
263}257}
264258
265test "polymorphic parsing" {259test "polymorphic parsing" {
266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
267
268 if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108260 if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108
269 const doc =261 const doc =
270 \\{ "type": "div",262 \\{ "type": "div",
...@@ -310,8 +302,6 @@ test "polymorphic parsing" {...@@ -310,8 +302,6 @@ test "polymorphic parsing" {
310}302}
311303
312test "long object value" {304test "long object value" {
313 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
314
315 const value = "01234567890123456789";305 const value = "01234567890123456789";
316 const doc = "{\"key\":\"" ++ value ++ "\"}";306 const doc = "{\"key\":\"" ++ value ++ "\"}";
317 var fbs = std.io.fixedBufferStream(doc);307 var fbs = std.io.fixedBufferStream(doc);
...@@ -324,8 +314,6 @@ test "long object value" {...@@ -324,8 +314,6 @@ test "long object value" {
324}314}
325315
326test "ParseOptions.max_value_len" {316test "ParseOptions.max_value_len" {
327 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
328
329 var arena = ArenaAllocator.init(testing.allocator);317 var arena = ArenaAllocator.init(testing.allocator);
330 defer arena.deinit();318 defer arena.deinit();
331319
lib/std/json/static_test.zig-6
...@@ -392,8 +392,6 @@ test "parse" {...@@ -392,8 +392,6 @@ test "parse" {
392}392}
393393
394test "parse into enum" {394test "parse into enum" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
397 const T = enum(u32) {395 const T = enum(u32) {
398 Foo = 42,396 Foo = 42,
399 Bar,397 Bar,
...@@ -478,8 +476,6 @@ test "parse into tagged union errors" {...@@ -478,8 +476,6 @@ test "parse into tagged union errors" {
478}476}
479477
480test "parse into struct with no fields" {478test "parse into struct with no fields" {
481 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
482
483 const T = struct {};479 const T = struct {};
484 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});480 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
485 defer parsed.deinit();481 defer parsed.deinit();
...@@ -949,8 +945,6 @@ test "json parse allocate when streaming" {...@@ -949,8 +945,6 @@ test "json parse allocate when streaming" {
949}945}
950946
951test "parse at comptime" {947test "parse at comptime" {
952 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
953
954 const doc =948 const doc =
955 \\{949 \\{
956 \\ "vals": {950 \\ "vals": {
lib/std/json/stringify_test.zig-36
...@@ -100,8 +100,6 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {...@@ -100,8 +100,6 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {
100}100}
101101
102test "stringify null optional fields" {102test "stringify null optional fields" {
103 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
104
105 const MyStruct = struct {103 const MyStruct = struct {
106 optional: ?[]const u8 = null,104 optional: ?[]const u8 = null,
107 required: []const u8 = "something",105 required: []const u8 = "something",
...@@ -123,8 +121,6 @@ test "stringify null optional fields" {...@@ -123,8 +121,6 @@ test "stringify null optional fields" {
123}121}
124122
125test "stringify basic types" {123test "stringify basic types" {
126 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
127
128 try testStringify("false", false, .{});124 try testStringify("false", false, .{});
129 try testStringify("true", true, .{});125 try testStringify("true", true, .{});
130 try testStringify("null", @as(?u8, null), .{});126 try testStringify("null", @as(?u8, null), .{});
...@@ -141,8 +137,6 @@ test "stringify basic types" {...@@ -141,8 +137,6 @@ test "stringify basic types" {
141}137}
142138
143test "stringify string" {139test "stringify string" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
146 try testStringify("\"hello\"", "hello", .{});140 try testStringify("\"hello\"", "hello", .{});
147 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});141 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});
148 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });142 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });
...@@ -167,16 +161,12 @@ test "stringify string" {...@@ -167,16 +161,12 @@ test "stringify string" {
167}161}
168162
169test "stringify many-item sentinel-terminated string" {163test "stringify many-item sentinel-terminated string" {
170 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
171
172 try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});164 try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});
173 try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });165 try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });
174 try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });166 try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });
175}167}
176168
177test "stringify enums" {169test "stringify enums" {
178 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
179
180 const E = enum {170 const E = enum {
181 foo,171 foo,
182 bar,172 bar,
...@@ -186,15 +176,11 @@ test "stringify enums" {...@@ -186,15 +176,11 @@ test "stringify enums" {
186}176}
187177
188test "stringify enum literals" {178test "stringify enum literals" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
191 try testStringify("\"foo\"", .foo, .{});179 try testStringify("\"foo\"", .foo, .{});
192 try testStringify("\"bar\"", .bar, .{});180 try testStringify("\"bar\"", .bar, .{});
193}181}
194182
195test "stringify tagged unions" {183test "stringify tagged unions" {
196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
197
198 const T = union(enum) {184 const T = union(enum) {
199 nothing,185 nothing,
200 foo: u32,186 foo: u32,
...@@ -206,8 +192,6 @@ test "stringify tagged unions" {...@@ -206,8 +192,6 @@ test "stringify tagged unions" {
206}192}
207193
208test "stringify struct" {194test "stringify struct" {
209 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
210
211 try testStringify("{\"foo\":42}", struct {195 try testStringify("{\"foo\":42}", struct {
212 foo: u32,196 foo: u32,
213 }{ .foo = 42 }, .{});197 }{ .foo = 42 }, .{});
...@@ -230,8 +214,6 @@ test "emit_strings_as_arrays" {...@@ -230,8 +214,6 @@ test "emit_strings_as_arrays" {
230}214}
231215
232test "stringify struct with indentation" {216test "stringify struct with indentation" {
233 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
234
235 try testStringify(217 try testStringify(
236 \\{218 \\{
237 \\ "foo": 42,219 \\ "foo": 42,
...@@ -277,8 +259,6 @@ test "stringify struct with indentation" {...@@ -277,8 +259,6 @@ test "stringify struct with indentation" {
277}259}
278260
279test "stringify struct with void field" {261test "stringify struct with void field" {
280 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
281
282 try testStringify("{\"foo\":42}", struct {262 try testStringify("{\"foo\":42}", struct {
283 foo: u32,263 foo: u32,
284 bar: void = {},264 bar: void = {},
...@@ -286,8 +266,6 @@ test "stringify struct with void field" {...@@ -286,8 +266,6 @@ test "stringify struct with void field" {
286}266}
287267
288test "stringify array of structs" {268test "stringify array of structs" {
289 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
290
291 const MyStruct = struct {269 const MyStruct = struct {
292 foo: u32,270 foo: u32,
293 };271 };
...@@ -299,8 +277,6 @@ test "stringify array of structs" {...@@ -299,8 +277,6 @@ test "stringify array of structs" {
299}277}
300278
301test "stringify struct with custom stringifier" {279test "stringify struct with custom stringifier" {
302 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
303
304 try testStringify("[\"something special\",42]", struct {280 try testStringify("[\"something special\",42]", struct {
305 foo: u32,281 foo: u32,
306 const Self = @This();282 const Self = @This();
...@@ -315,16 +291,12 @@ test "stringify struct with custom stringifier" {...@@ -315,16 +291,12 @@ test "stringify struct with custom stringifier" {
315}291}
316292
317test "stringify vector" {293test "stringify vector" {
318 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
319
320 try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});294 try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});
321 try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});295 try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});
322 try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });296 try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });
323}297}
324298
325test "stringify tuple" {299test "stringify tuple" {
326 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
327
328 try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});300 try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});
329}301}
330302
...@@ -411,8 +383,6 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St...@@ -411,8 +383,6 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St
411}383}
412384
413test "stringify alloc" {385test "stringify alloc" {
414 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
415
416 const allocator = std.testing.allocator;386 const allocator = std.testing.allocator;
417 const expected =387 const expected =
418 \\{"foo":"bar","answer":42,"my_friend":"sammy"}388 \\{"foo":"bar","answer":42,"my_friend":"sammy"}
...@@ -424,8 +394,6 @@ test "stringify alloc" {...@@ -424,8 +394,6 @@ test "stringify alloc" {
424}394}
425395
426test "comptime stringify" {396test "comptime stringify" {
427 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
428
429 comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;397 comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;
430 comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;398 comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;
431 comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;399 comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;
...@@ -446,8 +414,6 @@ test "comptime stringify" {...@@ -446,8 +414,6 @@ test "comptime stringify" {
446}414}
447415
448test "print" {416test "print" {
449 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
450
451 var out_buf: [1024]u8 = undefined;417 var out_buf: [1024]u8 = undefined;
452 var slice_stream = std.io.fixedBufferStream(&out_buf);418 var slice_stream = std.io.fixedBufferStream(&out_buf);
453 const out = slice_stream.writer();419 const out = slice_stream.writer();
...@@ -479,8 +445,6 @@ test "print" {...@@ -479,8 +445,6 @@ test "print" {
479}445}
480446
481test "nonportable numbers" {447test "nonportable numbers" {
482 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
483
484 try testStringify("9999999999999999", 9999999999999999, .{});448 try testStringify("9999999999999999", 9999999999999999, .{});
485 try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });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,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const testing = std.testing;2const testing = std.testing;
4const parseFromSlice = @import("./static.zig").parseFromSlice;3const parseFromSlice = @import("./static.zig").parseFromSlice;
5const validate = @import("./scanner.zig").validate;4const validate = @import("./scanner.zig").validate;
...@@ -35,15 +34,13 @@ fn testHighLevelDynamicParser(s: []const u8) !void {...@@ -35,15 +34,13 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
3534
36// Additional tests not part of test JSONTestSuite.35// Additional tests not part of test JSONTestSuite.
37test "y_trailing_comma_after_empty" {36test "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;
3938
40 try roundTrip(39 try roundTrip(
41 \\{"1":[],"2":{},"3":"4"}40 \\{"1":[],"2":{},"3":"4"}
42 );41 );
43}42}
44test "n_object_closed_missing_value" {43test "n_object_closed_missing_value" {
45 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
46
47 try err(44 try err(
48 \\{"a":}45 \\{"a":}
49 );46 );
lib/std/math/big/int_test.zig+5-49
...@@ -246,8 +246,6 @@ test "big.int fits" {...@@ -246,8 +246,6 @@ test "big.int fits" {
246}246}
247247
248test "big.int string set" {248test "big.int string set" {
249 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
250
251 var a = try Managed.init(testing.allocator);249 var a = try Managed.init(testing.allocator);
252 defer a.deinit();250 defer a.deinit();
253251
...@@ -264,8 +262,6 @@ test "big.int string negative" {...@@ -264,8 +262,6 @@ test "big.int string negative" {
264}262}
265263
266test "big.int string set number with underscores" {264test "big.int string set number with underscores" {
267 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
269 var a = try Managed.init(testing.allocator);265 var a = try Managed.init(testing.allocator);
270 defer a.deinit();266 defer a.deinit();
271267
...@@ -274,8 +270,6 @@ test "big.int string set number with underscores" {...@@ -274,8 +270,6 @@ test "big.int string set number with underscores" {
274}270}
275271
276test "big.int string set case insensitive number" {272test "big.int string set case insensitive number" {
277 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
278
279 var a = try Managed.init(testing.allocator);273 var a = try Managed.init(testing.allocator);
280 defer a.deinit();274 defer a.deinit();
281275
...@@ -326,8 +320,6 @@ test "big.int twos complement limit set" {...@@ -326,8 +320,6 @@ test "big.int twos complement limit set" {
326}320}
327321
328test "big.int string to" {322test "big.int string to" {
329 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
330
331 var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124);323 var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124);
332 defer a.deinit();324 defer a.deinit();
333325
...@@ -368,8 +360,6 @@ test "big.int string to base 16" {...@@ -368,8 +360,6 @@ test "big.int string to base 16" {
368}360}
369361
370test "big.int neg string to" {362test "big.int neg string to" {
371 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
372
373 var a = try Managed.initSet(testing.allocator, -123907434);363 var a = try Managed.initSet(testing.allocator, -123907434);
374 defer a.deinit();364 defer a.deinit();
375365
...@@ -392,8 +382,6 @@ test "big.int zero string to" {...@@ -392,8 +382,6 @@ test "big.int zero string to" {
392}382}
393383
394test "big.int clone" {384test "big.int clone" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
397 var a = try Managed.initSet(testing.allocator, 1234);385 var a = try Managed.initSet(testing.allocator, 1234);
398 defer a.deinit();386 defer a.deinit();
399 var b = try a.clone();387 var b = try a.clone();
...@@ -634,8 +622,6 @@ test "big.int addWrap single-single, unsigned" {...@@ -634,8 +622,6 @@ test "big.int addWrap single-single, unsigned" {
634}622}
635623
636test "big.int subWrap single-single, unsigned" {624test "big.int subWrap single-single, unsigned" {
637 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
638
639 var a = try Managed.initSet(testing.allocator, 0);625 var a = try Managed.initSet(testing.allocator, 0);
640 defer a.deinit();626 defer a.deinit();
641627
...@@ -963,8 +949,6 @@ test "big.int mul multi-multi" {...@@ -963,8 +949,6 @@ test "big.int mul multi-multi" {
963}949}
964950
965test "big.int mul alias r with a" {951test "big.int mul alias r with a" {
966 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
967
968 var a = try Managed.initSet(testing.allocator, maxInt(Limb));952 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
969 defer a.deinit();953 defer a.deinit();
970 var b = try Managed.initSet(testing.allocator, 2);954 var b = try Managed.initSet(testing.allocator, 2);
...@@ -976,8 +960,6 @@ test "big.int mul alias r with a" {...@@ -976,8 +960,6 @@ test "big.int mul alias r with a" {
976}960}
977961
978test "big.int mul alias r with b" {962test "big.int mul alias r with b" {
979 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
980
981 var a = try Managed.initSet(testing.allocator, maxInt(Limb));963 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
982 defer a.deinit();964 defer a.deinit();
983 var b = try Managed.initSet(testing.allocator, 2);965 var b = try Managed.initSet(testing.allocator, 2);
...@@ -989,8 +971,6 @@ test "big.int mul alias r with b" {...@@ -989,8 +971,6 @@ test "big.int mul alias r with b" {
989}971}
990972
991test "big.int mul alias r with a and b" {973test "big.int mul alias r with a and b" {
992 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
993
994 var a = try Managed.initSet(testing.allocator, maxInt(Limb));974 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
995 defer a.deinit();975 defer a.deinit();
996976
...@@ -1096,7 +1076,7 @@ test "big.int mulWrap multi-multi unsigned" {...@@ -1096,7 +1076,7 @@ test "big.int mulWrap multi-multi unsigned" {
10961076
1097test "big.int mulWrap multi-multi signed" {1077test "big.int mulWrap multi-multi signed" {
1098 switch (builtin.zig_backend) {1078 switch (builtin.zig_backend) {
1099 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,1079 .stage2_c => return error.SkipZigTest,
1100 else => {},1080 else => {},
1101 }1081 }
11021082
...@@ -1171,8 +1151,6 @@ test "big.int div single-half with rem" {...@@ -1171,8 +1151,6 @@ test "big.int div single-half with rem" {
1171}1151}
11721152
1173test "big.int div single-single no rem" {1153test "big.int div single-single no rem" {
1174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1175
1176 // assumes usize is <= 64 bits.1154 // assumes usize is <= 64 bits.
1177 var a = try Managed.initSet(testing.allocator, 1 << 52);1155 var a = try Managed.initSet(testing.allocator, 1 << 52);
1178 defer a.deinit();1156 defer a.deinit();
...@@ -1190,8 +1168,6 @@ test "big.int div single-single no rem" {...@@ -1190,8 +1168,6 @@ test "big.int div single-single no rem" {
1190}1168}
11911169
1192test "big.int div single-single with rem" {1170test "big.int div single-single with rem" {
1193 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1194
1195 var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33));1171 var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33));
1196 defer a.deinit();1172 defer a.deinit();
1197 var b = try Managed.initSet(testing.allocator, (1 << 35));1173 var b = try Managed.initSet(testing.allocator, (1 << 35));
...@@ -1271,8 +1247,6 @@ test "big.int div multi>2-single" {...@@ -1271,8 +1247,6 @@ test "big.int div multi>2-single" {
1271}1247}
12721248
1273test "big.int div single-single q < r" {1249test "big.int div single-single q < r" {
1274 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1275
1276 var a = try Managed.initSet(testing.allocator, 0x0078f432);1250 var a = try Managed.initSet(testing.allocator, 0x0078f432);
1277 defer a.deinit();1251 defer a.deinit();
1278 var b = try Managed.initSet(testing.allocator, 0x01000000);1252 var b = try Managed.initSet(testing.allocator, 0x01000000);
...@@ -1317,10 +1291,7 @@ test "big.int div q=0 alias" {...@@ -1317,10 +1291,7 @@ test "big.int div q=0 alias" {
1317}1291}
13181292
1319test "big.int div multi-multi q < r" {1293test "big.int div multi-multi q < r" {
1320 switch (builtin.zig_backend) {1294 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1321 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1322 else => {},
1323 }
13241295
1325 const op1 = 0x1ffffffff0078f432;1296 const op1 = 0x1ffffffff0078f432;
1326 const op2 = 0x1ffffffff01000000;1297 const op2 = 0x1ffffffff01000000;
...@@ -1642,8 +1613,6 @@ test "big.int div floor single-single -/-" {...@@ -1642,8 +1613,6 @@ test "big.int div floor single-single -/-" {
1642}1613}
16431614
1644test "big.int div floor no remainder negative quotient" {1615test "big.int div floor no remainder negative quotient" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
1647 const u: i32 = -0x80000000;1616 const u: i32 = -0x80000000;
1648 const v: i32 = 1;1617 const v: i32 = 1;
16491618
...@@ -1743,10 +1712,7 @@ test "big.int div multi-multi no rem" {...@@ -1743,10 +1712,7 @@ test "big.int div multi-multi no rem" {
1743}1712}
17441713
1745test "big.int div multi-multi (2 branch)" {1714test "big.int div multi-multi (2 branch)" {
1746 switch (builtin.zig_backend) {1715 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1747 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1748 else => {},
1749 }
17501716
1751 var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111);1717 var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111);
1752 defer a.deinit();1718 defer a.deinit();
...@@ -1785,10 +1751,7 @@ test "big.int div multi-multi (3.1/3.3 branch)" {...@@ -1785,10 +1751,7 @@ test "big.int div multi-multi (3.1/3.3 branch)" {
1785}1751}
17861752
1787test "big.int div multi-single zero-limb trailing" {1753test "big.int div multi-single zero-limb trailing" {
1788 switch (builtin.zig_backend) {1754 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1789 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1790 else => {},
1791 }
17921755
1793 var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000);1756 var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000);
1794 defer a.deinit();1757 defer a.deinit();
...@@ -1808,10 +1771,7 @@ test "big.int div multi-single zero-limb trailing" {...@@ -1808,10 +1771,7 @@ test "big.int div multi-single zero-limb trailing" {
1808}1771}
18091772
1810test "big.int div multi-multi zero-limb trailing (with rem)" {1773test "big.int div multi-multi zero-limb trailing (with rem)" {
1811 switch (builtin.zig_backend) {1774 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1812 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1813 else => {},
1814 }
18151775
1816 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);1776 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
1817 defer a.deinit();1777 defer a.deinit();
...@@ -1908,8 +1868,6 @@ test "big.int div multi-multi fuzz case #1" {...@@ -1908,8 +1868,6 @@ test "big.int div multi-multi fuzz case #1" {
1908}1868}
19091869
1910test "big.int div multi-multi fuzz case #2" {1870test "big.int div multi-multi fuzz case #2" {
1911 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1912
1913 var a = try Managed.init(testing.allocator);1871 var a = try Managed.init(testing.allocator);
1914 defer a.deinit();1872 defer a.deinit();
1915 var b = try Managed.init(testing.allocator);1873 var b = try Managed.init(testing.allocator);
...@@ -2672,8 +2630,6 @@ test "big.int mutable to managed" {...@@ -2672,8 +2630,6 @@ test "big.int mutable to managed" {
2672}2630}
26732631
2674test "big.int const to managed" {2632test "big.int const to managed" {
2675 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2676
2677 var a = try Managed.initSet(testing.allocator, 123423453456);2633 var a = try Managed.initSet(testing.allocator, 123423453456);
2678 defer a.deinit();2634 defer a.deinit();
26792635
lib/std/math/big/rational.zig-6
...@@ -494,8 +494,6 @@ fn extractLowBits(a: Int, comptime T: type) T {...@@ -494,8 +494,6 @@ fn extractLowBits(a: Int, comptime T: type) T {
494}494}
495495
496test "big.rational extractLowBits" {496test "big.rational extractLowBits" {
497 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
498
499 var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321);497 var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321);
500 defer a.deinit();498 defer a.deinit();
501499
...@@ -649,8 +647,6 @@ test "big.rational copy" {...@@ -649,8 +647,6 @@ test "big.rational copy" {
649}647}
650648
651test "big.rational negate" {649test "big.rational negate" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654 var a = try Rational.init(testing.allocator);650 var a = try Rational.init(testing.allocator);
655 defer a.deinit();651 defer a.deinit();
656652
...@@ -668,8 +664,6 @@ test "big.rational negate" {...@@ -668,8 +664,6 @@ test "big.rational negate" {
668}664}
669665
670test "big.rational abs" {666test "big.rational abs" {
671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
672
673 var a = try Rational.init(testing.allocator);667 var a = try Rational.init(testing.allocator);
674 defer a.deinit();668 defer a.deinit();
675669
lib/std/math/log10.zig-1
...@@ -147,7 +147,6 @@ test "oldlog10 doesn't work" {...@@ -147,7 +147,6 @@ test "oldlog10 doesn't work" {
147test "log10_int vs old implementation" {147test "log10_int vs old implementation" {
148 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO148 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
149 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO149 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
151 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO150 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
152 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO151 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
153 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO152 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,8 +56,6 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) {
56}56}
5757
58test "math.log_int" {58test "math.log_int" {
59 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
60
61 // Test all unsigned integers with 2, 3, ..., 64 bits.59 // Test all unsigned integers with 2, 3, ..., 64 bits.
62 // We cannot test 0 or 1 bits since base must be > 1.60 // We cannot test 0 or 1 bits since base must be > 1.
63 inline for (2..64 + 1) |bits| {61 inline for (2..64 + 1) |bits| {
lib/std/math/nextafter.zig+1-2
...@@ -1,4 +1,3 @@...@@ -1,4 +1,3 @@
1const builtin = @import("builtin");
2const std = @import("../std.zig");1const std = @import("../std.zig");
3const math = std.math;2const math = std.math;
4const assert = std.debug.assert;3const assert = std.debug.assert;
...@@ -103,7 +102,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {...@@ -103,7 +102,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {
103}102}
104103
105test "math.nextAfter.int" {104test "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;
107106
108 try expect(nextAfter(i0, 0, 0) == 0);107 try expect(nextAfter(i0, 0, 0) == 0);
109 try expect(nextAfter(u0, 0, 0) == 0);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,8 +1741,6 @@ pub fn readIntSlice(comptime T: type, bytes: []const u8, endian: Endian) T {
1741}1741}
17421742
1743test "comptime read/write int" {1743test "comptime read/write int" {
1744 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1745
1746 comptime {1744 comptime {
1747 var bytes: [2]u8 = undefined;1745 var bytes: [2]u8 = undefined;
1748 writeIntLittle(u16, &bytes, 0x1234);1746 writeIntLittle(u16, &bytes, 0x1234);
...@@ -3309,8 +3307,6 @@ test "testStringEquality" {...@@ -3309,8 +3307,6 @@ test "testStringEquality" {
3309}3307}
33103308
3311test "testReadInt" {3309test "testReadInt" {
3312 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3313
3314 try testReadIntImpl();3310 try testReadIntImpl();
3315 try comptime testReadIntImpl();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,8 +583,6 @@ pub fn MultiArrayList(comptime T: type) type {
583}583}
584584
585test "basic usage" {585test "basic usage" {
586 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
587
588 const ally = testing.allocator;586 const ally = testing.allocator;
589587
590 const Foo = struct {588 const Foo = struct {
...@@ -679,8 +677,6 @@ test "basic usage" {...@@ -679,8 +677,6 @@ test "basic usage" {
679// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes677// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes
680// function used the @reduce code path.678// function used the @reduce code path.
681test "regression test for @reduce bug" {679test "regression test for @reduce bug" {
682 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
683
684 const ally = testing.allocator;680 const ally = testing.allocator;
685 var list = MultiArrayList(struct {681 var list = MultiArrayList(struct {
686 tag: std.zig.Token.Tag,682 tag: std.zig.Token.Tag,
...@@ -758,8 +754,6 @@ test "regression test for @reduce bug" {...@@ -758,8 +754,6 @@ test "regression test for @reduce bug" {
758}754}
759755
760test "ensure capacity on empty list" {756test "ensure capacity on empty list" {
761 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
762
763 const ally = testing.allocator;757 const ally = testing.allocator;
764758
765 const Foo = struct {759 const Foo = struct {
...@@ -795,8 +789,6 @@ test "ensure capacity on empty list" {...@@ -795,8 +789,6 @@ test "ensure capacity on empty list" {
795}789}
796790
797test "insert elements" {791test "insert elements" {
798 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
799
800 const ally = testing.allocator;792 const ally = testing.allocator;
801793
802 const Foo = struct {794 const Foo = struct {
...@@ -816,8 +808,6 @@ test "insert elements" {...@@ -816,8 +808,6 @@ test "insert elements" {
816}808}
817809
818test "union" {810test "union" {
819 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
820
821 const ally = testing.allocator;811 const ally = testing.allocator;
822812
823 const Foo = union(enum) {813 const Foo = union(enum) {
...@@ -873,8 +863,6 @@ test "union" {...@@ -873,8 +863,6 @@ test "union" {
873}863}
874864
875test "sorting a span" {865test "sorting a span" {
876 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
877
878 var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{};866 var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{};
879 defer list.deinit(testing.allocator);867 defer list.deinit(testing.allocator);
880868
...@@ -915,8 +903,6 @@ test "sorting a span" {...@@ -915,8 +903,6 @@ test "sorting a span" {
915}903}
916904
917test "0 sized struct field" {905test "0 sized struct field" {
918 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
919
920 const ally = testing.allocator;906 const ally = testing.allocator;
921907
922 const Foo = struct {908 const Foo = struct {
...@@ -944,8 +930,6 @@ test "0 sized struct field" {...@@ -944,8 +930,6 @@ test "0 sized struct field" {
944}930}
945931
946test "0 sized struct" {932test "0 sized struct" {
947 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
948
949 const ally = testing.allocator;933 const ally = testing.allocator;
950934
951 const Foo = struct {935 const Foo = struct {
lib/std/net/test.zig+1-2
...@@ -109,9 +109,8 @@ test "parse and render UNIX addresses" {...@@ -109,9 +109,8 @@ test "parse and render UNIX addresses" {
109}109}
110110
111test "resolve DNS" {111test "resolve DNS" {
112 if (builtin.os.tag == .wasi) return error.SkipZigTest;
113
114 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
113 if (builtin.os.tag == .wasi) return error.SkipZigTest;
115114
116 if (builtin.os.tag == .windows) {115 if (builtin.os.tag == .windows) {
117 _ = try std.os.windows.WSAStartup(2, 2);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,8 +443,6 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void {
443}443}
444444
445test "CSPRNG" {445test "CSPRNG" {
446 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
447
448 var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined;446 var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined;
449 std.crypto.random.bytes(&secret_seed);447 std.crypto.random.bytes(&secret_seed);
450 var csprng = DefaultCsprng.init(secret_seed);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,8 +409,6 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type
409}409}
410410
411test "SegmentedList basic usage" {411test "SegmentedList basic usage" {
412 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
413
414 try testSegmentedList(0);412 try testSegmentedList(0);
415 try testSegmentedList(1);413 try testSegmentedList(1);
416 try testSegmentedList(2);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,7 +13,7 @@ pub fn suggestVectorSizeForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ?
13 const vector_bit_size: u16 = blk: {13 const vector_bit_size: u16 = blk: {
14 if (cpu.arch.isX86()) {14 if (cpu.arch.isX86()) {
15 if (T == bool and std.Target.x86.featureSetHas(cpu.features, .prefer_mask_registers)) return 64;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 if (std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .avx2 }) and !std.Target.x86.featureSetHas(cpu.features, .prefer_128_bit)) break :blk 256;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 if (std.Target.x86.featureSetHas(cpu.features, .sse)) break :blk 128;18 if (std.Target.x86.featureSetHas(cpu.features, .sse)) break :blk 128;
19 if (std.Target.x86.featureSetHasAny(cpu.features, .{ .mmx, .@"3dnow" })) break :blk 64;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,10 +62,15 @@ pub fn suggestVectorSize(comptime T: type) ?comptime_int {
62test "suggestVectorSizeForCpu works with signed and unsigned values" {62test "suggestVectorSizeForCpu works with signed and unsigned values" {
63 comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64);63 comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64);
64 comptime cpu.features.addFeature(@intFromEnum(std.Target.x86.Feature.avx512f));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 const signed_integer_size = suggestVectorSizeForCpu(i32, cpu).?;70 const signed_integer_size = suggestVectorSizeForCpu(i32, cpu).?;
66 const unsigned_integer_size = suggestVectorSizeForCpu(u32, cpu).?;71 const unsigned_integer_size = suggestVectorSizeForCpu(u32, cpu).?;
67 try std.testing.expectEqual(@as(usize, 16), unsigned_integer_size);72 try std.testing.expectEqual(expected_size, unsigned_integer_size);
68 try std.testing.expectEqual(@as(usize, 16), signed_integer_size);73 try std.testing.expectEqual(expected_size, signed_integer_size);
69}74}
7075
71fn vectorLength(comptime VectorType: type) comptime_int {76fn vectorLength(comptime VectorType: type) comptime_int {
lib/std/sort.zig-11
...@@ -1,6 +1,5 @@...@@ -1,6 +1,5 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const builtin = @import("builtin");
4const testing = std.testing;3const testing = std.testing;
5const mem = std.mem;4const mem = std.mem;
6const math = std.math;5const math = std.math;
...@@ -177,8 +176,6 @@ const IdAndValue = struct {...@@ -177,8 +176,6 @@ const IdAndValue = struct {
177};176};
178177
179test "stable sort" {178test "stable sort" {
180 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
181
182 const expected = [_]IdAndValue{179 const expected = [_]IdAndValue{
183 IdAndValue{ .id = 0, .value = 0 },180 IdAndValue{ .id = 0, .value = 0 },
184 IdAndValue{ .id = 1, .value = 0 },181 IdAndValue{ .id = 1, .value = 0 },
...@@ -226,8 +223,6 @@ test "stable sort" {...@@ -226,8 +223,6 @@ test "stable sort" {
226}223}
227224
228test "sort" {225test "sort" {
229 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
230
231 const u8cases = [_][]const []const u8{226 const u8cases = [_][]const []const u8{
232 &[_][]const u8{227 &[_][]const u8{
233 "",228 "",
...@@ -306,8 +301,6 @@ test "sort" {...@@ -306,8 +301,6 @@ test "sort" {
306}301}
307302
308test "sort descending" {303test "sort descending" {
309 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
310
311 const rev_cases = [_][]const []const i32{304 const rev_cases = [_][]const []const i32{
312 &[_][]const i32{305 &[_][]const i32{
313 &[_]i32{},306 &[_]i32{},
...@@ -347,8 +340,6 @@ test "sort descending" {...@@ -347,8 +340,6 @@ test "sort descending" {
347}340}
348341
349test "sort with context in the middle of a slice" {342test "sort with context in the middle of a slice" {
350 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
351
352 const Context = struct {343 const Context = struct {
353 items: []i32,344 items: []i32,
354345
...@@ -388,8 +379,6 @@ test "sort with context in the middle of a slice" {...@@ -388,8 +379,6 @@ test "sort with context in the middle of a slice" {
388}379}
389380
390test "sort fuzz testing" {381test "sort fuzz testing" {
391 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
392
393 var prng = std.rand.DefaultPrng.init(0x12345678);382 var prng = std.rand.DefaultPrng.init(0x12345678);
394 const random = prng.random();383 const random = prng.random();
395 const test_case_count = 10;384 const test_case_count = 10;
lib/std/unicode.zig-41
...@@ -1,6 +1,5 @@...@@ -1,6 +1,5 @@
1const std = @import("./std.zig");1const std = @import("./std.zig");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const builtin = @import("builtin");
4const testing = std.testing;3const testing = std.testing;
5const mem = std.mem;4const mem = std.mem;
65
...@@ -497,15 +496,11 @@ fn testUtf16CountCodepoints() !void {...@@ -497,15 +496,11 @@ fn testUtf16CountCodepoints() !void {
497}496}
498497
499test "utf16 count codepoints" {498test "utf16 count codepoints" {
500 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
501
502 try testUtf16CountCodepoints();499 try testUtf16CountCodepoints();
503 try comptime testUtf16CountCodepoints();500 try comptime testUtf16CountCodepoints();
504}501}
505502
506test "utf8 encode" {503test "utf8 encode" {
507 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
508
509 try comptime testUtf8Encode();504 try comptime testUtf8Encode();
510 try testUtf8Encode();505 try testUtf8Encode();
511}506}
...@@ -532,8 +527,6 @@ fn testUtf8Encode() !void {...@@ -532,8 +527,6 @@ fn testUtf8Encode() !void {
532}527}
533528
534test "utf8 encode error" {529test "utf8 encode error" {
535 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
536
537 try comptime testUtf8EncodeError();530 try comptime testUtf8EncodeError();
538 try testUtf8EncodeError();531 try testUtf8EncodeError();
539}532}
...@@ -550,8 +543,6 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {...@@ -550,8 +543,6 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {
550}543}
551544
552test "utf8 iterator on ascii" {545test "utf8 iterator on ascii" {
553 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
554
555 try comptime testUtf8IteratorOnAscii();546 try comptime testUtf8IteratorOnAscii();
556 try testUtf8IteratorOnAscii();547 try testUtf8IteratorOnAscii();
557}548}
...@@ -572,8 +563,6 @@ fn testUtf8IteratorOnAscii() !void {...@@ -572,8 +563,6 @@ fn testUtf8IteratorOnAscii() !void {
572}563}
573564
574test "utf8 view bad" {565test "utf8 view bad" {
575 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
576
577 try comptime testUtf8ViewBad();566 try comptime testUtf8ViewBad();
578 try testUtf8ViewBad();567 try testUtf8ViewBad();
579}568}
...@@ -584,8 +573,6 @@ fn testUtf8ViewBad() !void {...@@ -584,8 +573,6 @@ fn testUtf8ViewBad() !void {
584}573}
585574
586test "utf8 view ok" {575test "utf8 view ok" {
587 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
588
589 try comptime testUtf8ViewOk();576 try comptime testUtf8ViewOk();
590 try testUtf8ViewOk();577 try testUtf8ViewOk();
591}578}
...@@ -606,8 +593,6 @@ fn testUtf8ViewOk() !void {...@@ -606,8 +593,6 @@ fn testUtf8ViewOk() !void {
606}593}
607594
608test "validate slice" {595test "validate slice" {
609 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
610
611 try comptime testValidateSlice();596 try comptime testValidateSlice();
612 try testValidateSlice();597 try testValidateSlice();
613598
...@@ -648,8 +633,6 @@ fn testValidateSlice() !void {...@@ -648,8 +633,6 @@ fn testValidateSlice() !void {
648}633}
649634
650test "valid utf8" {635test "valid utf8" {
651 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
652
653 try comptime testValidUtf8();636 try comptime testValidUtf8();
654 try testValidUtf8();637 try testValidUtf8();
655}638}
...@@ -669,8 +652,6 @@ fn testValidUtf8() !void {...@@ -669,8 +652,6 @@ fn testValidUtf8() !void {
669}652}
670653
671test "invalid utf8 continuation bytes" {654test "invalid utf8 continuation bytes" {
672 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
673
674 try comptime testInvalidUtf8ContinuationBytes();655 try comptime testInvalidUtf8ContinuationBytes();
675 try testInvalidUtf8ContinuationBytes();656 try testInvalidUtf8ContinuationBytes();
676}657}
...@@ -703,8 +684,6 @@ fn testInvalidUtf8ContinuationBytes() !void {...@@ -703,8 +684,6 @@ fn testInvalidUtf8ContinuationBytes() !void {
703}684}
704685
705test "overlong utf8 codepoint" {686test "overlong utf8 codepoint" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
708 try comptime testOverlongUtf8Codepoint();687 try comptime testOverlongUtf8Codepoint();
709 try testOverlongUtf8Codepoint();688 try testOverlongUtf8Codepoint();
710}689}
...@@ -718,8 +697,6 @@ fn testOverlongUtf8Codepoint() !void {...@@ -718,8 +697,6 @@ fn testOverlongUtf8Codepoint() !void {
718}697}
719698
720test "misc invalid utf8" {699test "misc invalid utf8" {
721 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
722
723 try comptime testMiscInvalidUtf8();700 try comptime testMiscInvalidUtf8();
724 try testMiscInvalidUtf8();701 try testMiscInvalidUtf8();
725}702}
...@@ -735,8 +712,6 @@ fn testMiscInvalidUtf8() !void {...@@ -735,8 +712,6 @@ fn testMiscInvalidUtf8() !void {
735}712}
736713
737test "utf8 iterator peeking" {714test "utf8 iterator peeking" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
740 try comptime testUtf8Peeking();715 try comptime testUtf8Peeking();
741 try testUtf8Peeking();716 try testUtf8Peeking();
742}717}
...@@ -821,8 +796,6 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize {...@@ -821,8 +796,6 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize {
821}796}
822797
823test "utf16leToUtf8" {798test "utf16leToUtf8" {
824 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
825
826 var utf16le: [2]u16 = undefined;799 var utf16le: [2]u16 = undefined;
827 const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]);800 const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]);
828801
...@@ -935,8 +908,6 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize {...@@ -935,8 +908,6 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize {
935}908}
936909
937test "utf8ToUtf16Le" {910test "utf8ToUtf16Le" {
938 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
939
940 var utf16le: [2]u16 = [_]u16{0} ** 2;911 var utf16le: [2]u16 = [_]u16{0} ** 2;
941 {912 {
942 const length = try utf8ToUtf16Le(utf16le[0..], "𐐷");913 const length = try utf8ToUtf16Le(utf16le[0..], "𐐷");
...@@ -955,8 +926,6 @@ test "utf8ToUtf16Le" {...@@ -955,8 +926,6 @@ test "utf8ToUtf16Le" {
955}926}
956927
957test "utf8ToUtf16LeWithNull" {928test "utf8ToUtf16LeWithNull" {
958 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
959
960 {929 {
961 const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷");930 const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷");
962 defer testing.allocator.free(utf16);931 defer testing.allocator.free(utf16);
...@@ -1015,8 +984,6 @@ fn testCalcUtf16LeLen() !void {...@@ -1015,8 +984,6 @@ fn testCalcUtf16LeLen() !void {
1015}984}
1016985
1017test "calculate utf16 string length of given utf8 string in u16" {986test "calculate utf16 string length of given utf8 string in u16" {
1018 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1019
1020 try testCalcUtf16LeLen();987 try testCalcUtf16LeLen();
1021 try comptime testCalcUtf16LeLen();988 try comptime testCalcUtf16LeLen();
1022}989}
...@@ -1050,8 +1017,6 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) {...@@ -1050,8 +1017,6 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) {
1050}1017}
10511018
1052test "fmtUtf16le" {1019test "fmtUtf16le" {
1053 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1054
1055 const expectFmt = std.testing.expectFmt;1020 const expectFmt = std.testing.expectFmt;
1056 try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))});1021 try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))});
1057 try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))});1022 try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))});
...@@ -1065,8 +1030,6 @@ test "fmtUtf16le" {...@@ -1065,8 +1030,6 @@ test "fmtUtf16le" {
1065}1030}
10661031
1067test "utf8ToUtf16LeStringLiteral" {1032test "utf8ToUtf16LeStringLiteral" {
1068 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1069
1070 {1033 {
1071 const bytes = [_:0]u16{1034 const bytes = [_:0]u16{
1072 mem.nativeToLittle(u16, 0x41),1035 mem.nativeToLittle(u16, 0x41),
...@@ -1127,8 +1090,6 @@ fn testUtf8CountCodepoints() !void {...@@ -1127,8 +1090,6 @@ fn testUtf8CountCodepoints() !void {
1127}1090}
11281091
1129test "utf8 count codepoints" {1092test "utf8 count codepoints" {
1130 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1131
1132 try testUtf8CountCodepoints();1093 try testUtf8CountCodepoints();
1133 try comptime testUtf8CountCodepoints();1094 try comptime testUtf8CountCodepoints();
1134}1095}
...@@ -1145,8 +1106,6 @@ fn testUtf8ValidCodepoint() !void {...@@ -1145,8 +1106,6 @@ fn testUtf8ValidCodepoint() !void {
1145}1106}
11461107
1147test "utf8 valid codepoint" {1108test "utf8 valid codepoint" {
1148 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1149
1150 try testUtf8ValidCodepoint();1109 try testUtf8ValidCodepoint();
1151 try comptime testUtf8ValidCodepoint();1110 try comptime testUtf8ValidCodepoint();
1152}1111}
lib/std/zig/fmt.zig+1-2
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const mem = std.mem;2const mem = std.mem;
43
5/// Print the string as a Zig identifier escaping it with @"" syntax if needed.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,7 +95,7 @@ pub fn fmtEscapes(bytes: []const u8) std.fmt.Formatter(stringEscape) {
96}95}
9796
98test "escape invalid identifiers" {97test "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;
10099
101 const expectFmt = std.testing.expectFmt;100 const expectFmt = std.testing.expectFmt;
102 try expectFmt("@\"while\"", "{}", .{fmtId("while")});101 try expectFmt("@\"while\"", "{}", .{fmtId("while")});
lib/std/zig/tokenizer.zig-2
...@@ -1481,8 +1481,6 @@ test "utf8" {...@@ -1481,8 +1481,6 @@ test "utf8" {
1481}1481}
14821482
1483test "invalid utf8" {1483test "invalid utf8" {
1484 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1485
1486 try testTokenize("//\x80", &.{1484 try testTokenize("//\x80", &.{
1487 .invalid,1485 .invalid,
1488 });1486 });
src/arch/x86_64/CodeGen.zig+354-53
...@@ -656,11 +656,14 @@ const InstTracking = struct {...@@ -656,11 +656,14 @@ const InstTracking = struct {
656 fn reuse(656 fn reuse(
657 self: *InstTracking,657 self: *InstTracking,
658 function: *Self,658 function: *Self,
659 new_inst: Air.Inst.Index,659 new_inst: ?Air.Inst.Index,
660 old_inst: Air.Inst.Index,660 old_inst: Air.Inst.Index,
661 ) void {661 ) void {
662 self.short = .{ .dead = function.scope_generation };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 }
665668
666 fn liveOut(self: *InstTracking, function: *Self, inst: Air.Inst.Index) void {669 fn liveOut(self: *InstTracking, function: *Self, inst: Air.Inst.Index) void {
...@@ -1560,24 +1563,58 @@ fn asmRegisterMemoryImmediate(...@@ -1560,24 +1563,58 @@ fn asmRegisterMemoryImmediate(
1560 m: Memory,1563 m: Memory,
1561 imm: Immediate,1564 imm: Immediate,
1562) !void {1565) !void {
1563 _ = try self.addInst(.{1566 if (switch (imm) {
1564 .tag = tag[1],1567 .signed => |s| if (math.cast(i16, s)) |x| @as(u16, @bitCast(x)) else null,
1565 .ops = switch (m) {1568 .unsigned => |u| math.cast(u16, u),
1566 .sib => .rmi_sib,1569 }) |small_imm| {
1567 .rip => .rmi_rip,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 else => unreachable,1596 else => unreachable,
1569 },1597 });
1570 .data = .{ .rix = .{1598 _ = try self.addInst(.{
1571 .fixes = tag[0],1599 .tag = tag[1],
1572 .r1 = reg,1600 .ops = switch (m) {
1573 .i = @as(u8, @intCast(imm.unsigned)),1601 .sib => switch (imm) {
1574 .payload = switch (m) {1602 .signed => .rmi_sib_s,
1575 .sib => try self.addExtra(Mir.MemorySib.encode(m)),1603 .unsigned => .rmi_sib_u,
1576 .rip => try self.addExtra(Mir.MemoryRip.encode(m)),1604 },
1605 .rip => switch (imm) {
1606 .signed => .rmi_rip_s,
1607 .unsigned => .rmi_rip_u,
1608 },
1577 else => unreachable,1609 else => unreachable,
1578 },1610 },
1579 } },1611 .data = .{ .rx = .{
1580 });1612 .fixes = tag[0],
1613 .r1 = reg,
1614 .payload = payload,
1615 } },
1616 });
1617 }
1581}1618}
15821619
1583fn asmRegisterRegisterMemoryImmediate(1620fn asmRegisterRegisterMemoryImmediate(
...@@ -3713,14 +3750,22 @@ fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue...@@ -3713,14 +3750,22 @@ fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue
3713 else => unreachable,3750 else => unreachable,
3714 .mul => {},3751 .mul => {},
3715 .div => switch (tag[0]) {3752 .div => switch (tag[0]) {
3716 ._ => try self.asmRegisterRegister(.{ ._, .xor }, .edx, .edx),3753 ._ => {
3717 .i_ => switch (self.regBitSize(ty)) {3754 const hi_reg: Register =
3718 8 => try self.asmOpOnly(.{ ._, .cbw }),3755 switch (self.regBitSize(ty)) {
3719 16 => try self.asmOpOnly(.{ ._, .cwd }),3756 8 => .ah,
3720 32 => try self.asmOpOnly(.{ ._, .cdq }),3757 16, 32, 64 => .edx,
3721 64 => try self.asmOpOnly(.{ ._, .cqo }),3758 else => unreachable,
3722 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 else => unreachable,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,13 +5255,11 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)
5210 .child = (try mod.intType(.signed, scalar_bits)).ip_index,5255 .child = (try mod.intType(.signed, scalar_bits)).ip_index,
5211 });5256 });
52125257
5213 const sign_val = switch (tag) {5258 const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = switch (tag) {
5214 .neg => try vec_ty.minInt(mod, vec_ty),5259 .neg => try vec_ty.minInt(mod, vec_ty),
5215 .abs => try vec_ty.maxInt(mod, vec_ty),5260 .abs => try vec_ty.maxInt(mod, vec_ty),
5216 else => unreachable,5261 else => unreachable,
5217 };5262 } });
5218
5219 const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = sign_val });
5220 const sign_mem = if (sign_mcv.isMemory())5263 const sign_mem = if (sign_mcv.isMemory())
5221 sign_mcv.mem(Memory.PtrSize.fromSize(abi_size))5264 sign_mcv.mem(Memory.PtrSize.fromSize(abi_size))
5222 else5265 else
...@@ -5285,7 +5328,6 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)...@@ -5285,7 +5328,6 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)
5285fn airFloatSign(self: *Self, inst: Air.Inst.Index) !void {5328fn airFloatSign(self: *Self, inst: Air.Inst.Index) !void {
5286 const un_op = self.air.instructions.items(.data)[inst].un_op;5329 const un_op = self.air.instructions.items(.data)[inst].un_op;
5287 const ty = self.typeOf(un_op);5330 const ty = self.typeOf(un_op);
5288
5289 return self.floatSign(inst, un_op, ty);5331 return self.floatSign(inst, un_op, ty);
5290}5332}
52915333
...@@ -5782,7 +5824,7 @@ fn reuseOperandAdvanced(...@@ -5782,7 +5824,7 @@ fn reuseOperandAdvanced(
5782 operand: Air.Inst.Ref,5824 operand: Air.Inst.Ref,
5783 op_index: Liveness.OperandInt,5825 op_index: Liveness.OperandInt,
5784 mcv: MCValue,5826 mcv: MCValue,
5785 tracked_inst: Air.Inst.Index,5827 maybe_tracked_inst: ?Air.Inst.Index,
5786) bool {5828) bool {
5787 if (!self.liveness.operandDies(inst, op_index))5829 if (!self.liveness.operandDies(inst, op_index))
5788 return false;5830 return false;
...@@ -5791,11 +5833,13 @@ fn reuseOperandAdvanced(...@@ -5791,11 +5833,13 @@ fn reuseOperandAdvanced(
5791 .register, .register_pair => for (mcv.getRegs()) |reg| {5833 .register, .register_pair => for (mcv.getRegs()) |reg| {
5792 // If it's in the registers table, need to associate the register(s) with the5834 // If it's in the registers table, need to associate the register(s) with the
5793 // new instruction.5835 // new instruction.
5794 if (!self.register_manager.isRegFree(reg)) {5836 if (maybe_tracked_inst) |tracked_inst| {
5795 if (RegisterManager.indexOfRegIntoTracked(reg)) |index| {5837 if (!self.register_manager.isRegFree(reg)) {
5796 self.register_manager.registers[index] = tracked_inst;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 .load_frame => |frame_addr| if (frame_addr.index.isNamed()) return false,5844 .load_frame => |frame_addr| if (frame_addr.index.isNamed()) return false,
5801 else => return false,5845 else => return false,
...@@ -5804,7 +5848,7 @@ fn reuseOperandAdvanced(...@@ -5804,7 +5848,7 @@ fn reuseOperandAdvanced(
5804 // Prevent the operand deaths processing code from deallocating it.5848 // Prevent the operand deaths processing code from deallocating it.
5805 self.liveness.clearOperandDeath(inst, op_index);5849 self.liveness.clearOperandDeath(inst, op_index);
5806 const op_inst = Air.refToIndex(operand).?;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);
58085852
5809 return true;5853 return true;
5810}5854}
...@@ -7234,12 +7278,18 @@ fn genBinOp(...@@ -7234,12 +7278,18 @@ fn genBinOp(
7234 if (maybe_mask_reg) |mask_reg| self.register_manager.lockRegAssumeUnused(mask_reg) else null;7278 if (maybe_mask_reg) |mask_reg| self.register_manager.lockRegAssumeUnused(mask_reg) else null;
7235 defer if (mask_lock) |lock| self.register_manager.unlockReg(lock);7279 defer if (mask_lock) |lock| self.register_manager.unlockReg(lock);
72367280
7237 const lhs_mcv = try self.resolveInst(lhs_air);7281 const ordered_air = if (lhs_ty.isVector(mod) and lhs_ty.childType(mod).isAbiInt(mod) and
7238 const rhs_mcv = try self.resolveInst(rhs_air);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 switch (lhs_mcv) {7289 switch (lhs_mcv) {
7240 .immediate => |imm| switch (imm) {7290 .immediate => |imm| switch (imm) {
7241 0 => switch (air_tag) {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 else => {},7293 else => {},
7244 },7294 },
7245 else => {},7295 else => {},
...@@ -7288,11 +7338,15 @@ fn genBinOp(...@@ -7288,11 +7338,15 @@ fn genBinOp(
7288 var copied_to_dst = true;7338 var copied_to_dst = true;
7289 const dst_mcv: MCValue = dst: {7339 const dst_mcv: MCValue = dst: {
7290 if (maybe_inst) |inst| {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 break :dst lhs_mcv;7347 break :dst lhs_mcv;
7293 }
7294 if (is_commutative and (!vec_op or rhs_mcv.isRegister()) and7348 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 flipped = true;7351 flipped = true;
7298 break :dst rhs_mcv;7352 break :dst rhs_mcv;
...@@ -7657,7 +7711,10 @@ fn genBinOp(...@@ -7657,7 +7711,10 @@ fn genBinOp(
7657 .sub,7711 .sub,
7658 .sub_wrap,7712 .sub_wrap,
7659 => if (self.hasFeature(.avx)) .{ .vp_b, .sub } else .{ .p_b, .sub },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 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },7718 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
7662 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },7719 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
7663 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {7720 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
...@@ -7688,6 +7745,20 @@ fn genBinOp(...@@ -7688,6 +7745,20 @@ fn genBinOp(
7688 else7745 else
7689 null,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 else => null,7762 else => null,
7692 },7763 },
7693 17...32 => switch (air_tag) {7764 17...32 => switch (air_tag) {
...@@ -7708,6 +7779,17 @@ fn genBinOp(...@@ -7708,6 +7779,17 @@ fn genBinOp(
7708 .signed => if (self.hasFeature(.avx2)) .{ .vp_b, .maxs } else null,7779 .signed => if (self.hasFeature(.avx2)) .{ .vp_b, .maxs } else null,
7709 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_b, .maxu } else null,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 else => null,7793 else => null,
7712 },7794 },
7713 else => null,7795 else => null,
...@@ -7723,7 +7805,10 @@ fn genBinOp(...@@ -7723,7 +7805,10 @@ fn genBinOp(
7723 .mul,7805 .mul,
7724 .mul_wrap,7806 .mul_wrap,
7725 => if (self.hasFeature(.avx)) .{ .vp_w, .mull } else .{ .p_d, .mull },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 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },7812 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
7728 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },7813 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
7729 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {7814 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
...@@ -7746,6 +7831,20 @@ fn genBinOp(...@@ -7746,6 +7831,20 @@ fn genBinOp(
7746 else7831 else
7747 .{ .p_w, .maxu },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 else => null,7848 else => null,
7750 },7849 },
7751 9...16 => switch (air_tag) {7850 9...16 => switch (air_tag) {
...@@ -7769,6 +7868,17 @@ fn genBinOp(...@@ -7769,6 +7868,17 @@ fn genBinOp(
7769 .signed => if (self.hasFeature(.avx2)) .{ .vp_w, .maxs } else null,7868 .signed => if (self.hasFeature(.avx2)) .{ .vp_w, .maxs } else null,
7770 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_w, .maxu } else null,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 else => null,7882 else => null,
7773 },7883 },
7774 else => null,7884 else => null,
...@@ -7789,7 +7899,10 @@ fn genBinOp(...@@ -7789,7 +7899,10 @@ fn genBinOp(
7789 .{ .p_d, .mull }7899 .{ .p_d, .mull }
7790 else7900 else
7791 null,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 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },7906 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
7794 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },7907 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
7795 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {7908 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
...@@ -7820,6 +7933,20 @@ fn genBinOp(...@@ -7820,6 +7933,20 @@ fn genBinOp(
7820 else7933 else
7821 null,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 else => null,7950 else => null,
7824 },7951 },
7825 5...8 => switch (air_tag) {7952 5...8 => switch (air_tag) {
...@@ -7843,6 +7970,17 @@ fn genBinOp(...@@ -7843,6 +7970,17 @@ fn genBinOp(
7843 .signed => if (self.hasFeature(.avx2)) .{ .vp_d, .maxs } else null,7970 .signed => if (self.hasFeature(.avx2)) .{ .vp_d, .maxs } else null,
7844 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_d, .maxu } else null,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 else => null,7984 else => null,
7847 },7985 },
7848 else => null,7986 else => null,
...@@ -7855,9 +7993,33 @@ fn genBinOp(...@@ -7855,9 +7993,33 @@ fn genBinOp(
7855 .sub,7993 .sub,
7856 .sub_wrap,7994 .sub_wrap,
7857 => if (self.hasFeature(.avx)) .{ .vp_q, .sub } else .{ .p_q, .sub },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 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },8000 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
7860 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },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 else => null,8023 else => null,
7862 },8024 },
7863 3...4 => switch (air_tag) {8025 3...4 => switch (air_tag) {
...@@ -7870,6 +8032,17 @@ fn genBinOp(...@@ -7870,6 +8032,17 @@ fn genBinOp(
7870 .bit_and => if (self.hasFeature(.avx2)) .{ .vp_, .@"and" } else null,8032 .bit_and => if (self.hasFeature(.avx2)) .{ .vp_, .@"and" } else null,
7871 .bit_or => if (self.hasFeature(.avx2)) .{ .vp_, .@"or" } else null,8033 .bit_or => if (self.hasFeature(.avx2)) .{ .vp_, .@"or" } else null,
7872 .xor => if (self.hasFeature(.avx2)) .{ .vp_, .xor } else null,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 else => null,8046 else => null,
7874 },8047 },
7875 else => null,8048 else => null,
...@@ -8435,6 +8608,62 @@ fn genBinOp(...@@ -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 else => unreachable,8667 else => unreachable,
8439 }8668 }
84408669
...@@ -9741,8 +9970,15 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {...@@ -9741,8 +9970,15 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
9741}9970}
97429971
9743fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void {9972fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void {
9744 _ = inst;9973 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
9745 return self.fail("TODO implement airCmpVector for {}", .{self.target.cpu.arch});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}
97479983
9748fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void {9984fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void {
...@@ -12592,7 +12828,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {...@@ -12592,7 +12828,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
12592 .{ .i_, .mul },12828 .{ .i_, .mul },
12593 len_reg,12829 len_reg,
12594 len_reg,12830 len_reg,
12595 Immediate.u(elem_abi_size),12831 Immediate.s(elem_abi_size),
12596 );12832 );
12597 try self.genInlineMemcpy(second_elem_ptr_mcv, ptr, len_mcv);12833 try self.genInlineMemcpy(second_elem_ptr_mcv, ptr, len_mcv);
1259812834
...@@ -12645,8 +12881,23 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void {...@@ -12645,8 +12881,23 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void {
12645 defer if (src_ptr_lock) |lock| self.register_manager.unlockReg(lock);12881 defer if (src_ptr_lock) |lock| self.register_manager.unlockReg(lock);
1264612882
12647 const len: MCValue = switch (dst_ptr_ty.ptrSize(mod)) {12883 const len: MCValue = switch (dst_ptr_ty.ptrSize(mod)) {
12648 .Slice => dst_ptr.address().offset(8).deref(),12884 .Slice => len: {
12649 .One => .{ .immediate = dst_ptr_ty.childType(mod).arrayLen(mod) },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 .C, .Many => unreachable,12901 .C, .Many => unreachable,
12651 };12902 };
12652 const len_lock: ?RegisterLock = switch (len) {12903 const len_lock: ?RegisterLock = switch (len) {
...@@ -12999,10 +13250,60 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {...@@ -12999,10 +13250,60 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {
12999}13250}
1300013251
13001fn airReduce(self: *Self, inst: Air.Inst.Index) !void {13252fn airReduce(self: *Self, inst: Air.Inst.Index) !void {
13253 const mod = self.bin_file.options.module.?;
13002 const reduce = self.air.instructions.items(.data)[inst].reduce;13254 const reduce = self.air.instructions.items(.data)[inst].reduce;
13003 _ = reduce;13255
13004 return self.fail("TODO implement airReduce for x86_64", .{});13256 const result: MCValue = result: {
13005 //return self.finishAir(inst, result, .{ reduce.operand, .none, .none });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}
1300713308
13008fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {13309fn 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,18 +19,18 @@ pub const Error = Lower.Error || error{
1919
20pub fn emitMir(emit: *Emit) Error!void {20pub fn emitMir(emit: *Emit) Error!void {
21 for (0..emit.lower.mir.instructions.len) |mir_i| {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 try emit.code_offset_mapping.putNoClobber(23 try emit.code_offset_mapping.putNoClobber(
24 emit.lower.allocator,24 emit.lower.allocator,
25 mir_index,25 mir_index,
26 @as(u32, @intCast(emit.code.items.len)),26 @intCast(emit.code.items.len),
27 );27 );
28 const lowered = try emit.lower.lowerMir(mir_index);28 const lowered = try emit.lower.lowerMir(mir_index);
29 var lowered_relocs = lowered.relocs;29 var lowered_relocs = lowered.relocs;
30 for (lowered.insts, 0..) |lowered_inst, lowered_index| {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 try lowered_inst.encode(emit.code.writer(), .{});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 while (lowered_relocs.len > 0 and34 while (lowered_relocs.len > 0 and
35 lowered_relocs[0].lowered_inst_index == lowered_index) : ({35 lowered_relocs[0].lowered_inst_index == lowered_index) : ({
36 lowered_relocs = lowered_relocs[1..];36 lowered_relocs = lowered_relocs[1..];
...@@ -39,7 +39,7 @@ pub fn emitMir(emit: *Emit) Error!void {...@@ -39,7 +39,7 @@ pub fn emitMir(emit: *Emit) Error!void {
39 .source = start_offset,39 .source = start_offset,
40 .target = target,40 .target = target,
41 .offset = end_offset - 4,41 .offset = end_offset - 4,
42 .length = @as(u5, @intCast(end_offset - start_offset)),42 .length = @intCast(end_offset - start_offset),
43 }),43 }),
44 .linker_extern_fn => |symbol| if (emit.bin_file.cast(link.File.Elf)) |elf_file| {44 .linker_extern_fn => |symbol| if (emit.bin_file.cast(link.File.Elf)) |elf_file| {
45 // Add relocation to the decl.45 // Add relocation to the decl.
...@@ -220,7 +220,7 @@ const Reloc = struct {...@@ -220,7 +220,7 @@ const Reloc = struct {
220 /// Target of the relocation.220 /// Target of the relocation.
221 target: Mir.Inst.Index,221 target: Mir.Inst.Index,
222 /// Offset of the relocation within the instruction.222 /// Offset of the relocation within the instruction.
223 offset: usize,223 offset: u32,
224 /// Length of the instruction.224 /// Length of the instruction.
225 length: u5,225 length: u5,
226};226};
src/arch/x86_64/Encoding.zig+13-1
...@@ -266,6 +266,8 @@ pub const Mnemonic = enum {...@@ -266,6 +266,8 @@ pub const Mnemonic = enum {
266 packssdw, packsswb, packuswb,266 packssdw, packsswb, packuswb,
267 paddb, paddd, paddq, paddsb, paddsw, paddusb, paddusw, paddw,267 paddb, paddd, paddq, paddsb, paddsw, paddusb, paddusw, paddw,
268 pand, pandn, por, pxor,268 pand, pandn, por, pxor,
269 pcmpeqb, pcmpeqd, pcmpeqw,
270 pcmpgtb, pcmpgtd, pcmpgtw,
269 pmulhw, pmullw,271 pmulhw, pmullw,
270 psubb, psubd, psubq, psubsb, psubsw, psubusb, psubusw, psubw,272 psubb, psubd, psubq, psubsb, psubsw, psubusb, psubusw, psubw,
271 // SSE273 // SSE
...@@ -278,11 +280,12 @@ pub const Mnemonic = enum {...@@ -278,11 +280,12 @@ pub const Mnemonic = enum {
278 maxps, maxss,280 maxps, maxss,
279 minps, minss,281 minps, minss,
280 movaps, movhlps, movlhps,282 movaps, movhlps, movlhps,
283 movmskps,
281 movss, movups,284 movss, movups,
282 mulps, mulss,285 mulps, mulss,
283 orps,286 orps,
284 pextrw, pinsrw,287 pextrw, pinsrw,
285 pmaxsw, pmaxub, pminsw, pminub,288 pmaxsw, pmaxub, pminsw, pminub, pmovmskb,
286 shufps,289 shufps,
287 sqrtps, sqrtss,290 sqrtps, sqrtss,
288 subps, subss,291 subps, subss,
...@@ -301,6 +304,7 @@ pub const Mnemonic = enum {...@@ -301,6 +304,7 @@ pub const Mnemonic = enum {
301 minpd, minsd,304 minpd, minsd,
302 movapd,305 movapd,
303 movdqa, movdqu,306 movdqa, movdqu,
307 movmskpd,
304 //movsd,308 //movsd,
305 movupd,309 movupd,
306 mulpd, mulsd,310 mulpd, mulsd,
...@@ -323,11 +327,14 @@ pub const Mnemonic = enum {...@@ -323,11 +327,14 @@ pub const Mnemonic = enum {
323 extractps,327 extractps,
324 insertps,328 insertps,
325 packusdw,329 packusdw,
330 pcmpeqq,
326 pextrb, pextrd, pextrq,331 pextrb, pextrd, pextrq,
327 pinsrb, pinsrd, pinsrq,332 pinsrb, pinsrd, pinsrq,
328 pmaxsb, pmaxsd, pmaxud, pmaxuw, pminsb, pminsd, pminud, pminuw,333 pmaxsb, pmaxsd, pmaxud, pmaxuw, pminsb, pminsd, pminud, pminuw,
329 pmulld,334 pmulld,
330 roundpd, roundps, roundsd, roundss,335 roundpd, roundps, roundsd, roundss,
336 // SSE4.2
337 pcmpgtq,
331 // AVX338 // AVX
332 vaddpd, vaddps, vaddsd, vaddss,339 vaddpd, vaddps, vaddsd, vaddss,
333 vandnpd, vandnps, vandpd, vandps,340 vandnpd, vandnps, vandpd, vandps,
...@@ -348,6 +355,7 @@ pub const Mnemonic = enum {...@@ -348,6 +355,7 @@ pub const Mnemonic = enum {
348 vmovddup,355 vmovddup,
349 vmovdqa, vmovdqu,356 vmovdqa, vmovdqu,
350 vmovhlps, vmovlhps,357 vmovhlps, vmovlhps,
358 vmovmskpd, vmovmskps,
351 vmovq,359 vmovq,
352 vmovsd,360 vmovsd,
353 vmovshdup, vmovsldup,361 vmovshdup, vmovsldup,
...@@ -359,10 +367,13 @@ pub const Mnemonic = enum {...@@ -359,10 +367,13 @@ pub const Mnemonic = enum {
359 vpackssdw, vpacksswb, vpackusdw, vpackuswb,367 vpackssdw, vpacksswb, vpackusdw, vpackuswb,
360 vpaddb, vpaddd, vpaddq, vpaddsb, vpaddsw, vpaddusb, vpaddusw, vpaddw,368 vpaddb, vpaddd, vpaddq, vpaddsb, vpaddsw, vpaddusb, vpaddusw, vpaddw,
361 vpand, vpandn,369 vpand, vpandn,
370 vpcmpeqb, vpcmpeqd, vpcmpeqq, vpcmpeqw,
371 vpcmpgtb, vpcmpgtd, vpcmpgtq, vpcmpgtw,
362 vpextrb, vpextrd, vpextrq, vpextrw,372 vpextrb, vpextrd, vpextrq, vpextrw,
363 vpinsrb, vpinsrd, vpinsrq, vpinsrw,373 vpinsrb, vpinsrd, vpinsrq, vpinsrw,
364 vpmaxsb, vpmaxsd, vpmaxsw, vpmaxub, vpmaxud, vpmaxuw,374 vpmaxsb, vpmaxsd, vpmaxsw, vpmaxub, vpmaxud, vpmaxuw,
365 vpminsb, vpminsd, vpminsw, vpminub, vpminud, vpminuw,375 vpminsb, vpminsd, vpminsw, vpminub, vpminud, vpminuw,
376 vpmovmskb,
366 vpmulhw, vpmulld, vpmullw,377 vpmulhw, vpmulld, vpmullw,
367 vpor,378 vpor,
368 vpshufhw, vpshuflw,379 vpshufhw, vpshuflw,
...@@ -754,6 +765,7 @@ pub const Feature = enum {...@@ -754,6 +765,7 @@ pub const Feature = enum {
754 sse2,765 sse2,
755 sse3,766 sse3,
756 sse4_1,767 sse4_1,
768 sse4_2,
757 ssse3,769 ssse3,
758 x87,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,7 +190,7 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct {
190 .pseudo_probe_align_ri_s => {190 .pseudo_probe_align_ri_s => {
191 try lower.emit(.none, .@"test", &.{191 try lower.emit(.none, .@"test", &.{
192 .{ .reg = inst.data.ri.r1 },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 try lower.emit(.none, .jz, &.{195 try lower.emit(.none, .jz, &.{
196 .{ .imm = lower.reloc(.{ .inst = index + 1 }) },196 .{ .imm = lower.reloc(.{ .inst = index + 1 }) },
...@@ -226,14 +226,14 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct {...@@ -226,14 +226,14 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct {
226 }226 }
227 try lower.emit(.none, .sub, &.{227 try lower.emit(.none, .sub, &.{
228 .{ .reg = inst.data.ri.r1 },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 assert(lower.result_insts_len <= pseudo_probe_adjust_unrolled_max_insts);231 assert(lower.result_insts_len <= pseudo_probe_adjust_unrolled_max_insts);
232 },232 },
233 .pseudo_probe_adjust_setup_rri_s => {233 .pseudo_probe_adjust_setup_rri_s => {
234 try lower.emit(.none, .mov, &.{234 try lower.emit(.none, .mov, &.{
235 .{ .reg = inst.data.rri.r2.to32() },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 try lower.emit(.none, .sub, &.{238 try lower.emit(.none, .sub, &.{
239 .{ .reg = inst.data.rri.r1 },239 .{ .reg = inst.data.rri.r1 },
...@@ -291,7 +291,9 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {...@@ -291,7 +291,9 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {
291 .i_s,291 .i_s,
292 .mi_sib_s,292 .mi_sib_s,
293 .mi_rip_s,293 .mi_rip_s,
294 => Immediate.s(@as(i32, @bitCast(i))),294 .rmi_sib_s,
295 .rmi_rip_s,
296 => Immediate.s(@bitCast(i)),
295297
296 .rrri,298 .rrri,
297 .rri_u,299 .rri_u,
...@@ -301,6 +303,8 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {...@@ -301,6 +303,8 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {
301 .mi_rip_u,303 .mi_rip_u,
302 .rmi_sib,304 .rmi_sib,
303 .rmi_rip,305 .rmi_rip,
306 .rmi_sib_u,
307 .rmi_rip_u,
304 .mri_sib,308 .mri_sib,
305 .mri_rip,309 .mri_rip,
306 .rrm_sib,310 .rrm_sib,
...@@ -319,6 +323,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {...@@ -319,6 +323,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {
319 return lower.mir.resolveFrameLoc(switch (ops) {323 return lower.mir.resolveFrameLoc(switch (ops) {
320 .rm_sib,324 .rm_sib,
321 .rmi_sib,325 .rmi_sib,
326 .rmi_sib_s,
327 .rmi_sib_u,
322 .m_sib,328 .m_sib,
323 .mi_sib_u,329 .mi_sib_u,
324 .mi_sib_s,330 .mi_sib_s,
...@@ -335,6 +341,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {...@@ -335,6 +341,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {
335341
336 .rm_rip,342 .rm_rip,
337 .rmi_rip,343 .rmi_rip,
344 .rmi_rip_s,
345 .rmi_rip_u,
338 .m_rip,346 .m_rip,
339 .mi_rip_u,347 .mi_rip_u,
340 .mi_rip_s,348 .mi_rip_s,
...@@ -383,13 +391,29 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {...@@ -383,13 +391,29 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
383 .rrri => inst.data.rrri.fixes,391 .rrri => inst.data.rrri.fixes,
384 .rri_s, .rri_u => inst.data.rri.fixes,392 .rri_s, .rri_u => inst.data.rri.fixes,
385 .ri_s, .ri_u => inst.data.ri.fixes,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 .mrr_sib, .mrr_rip, .rrm_sib, .rrm_rip => inst.data.rrx.fixes,404 .mrr_sib, .mrr_rip, .rrm_sib, .rrm_rip => inst.data.rrx.fixes,
388 .rmi_sib, .rmi_rip, .mri_sib, .mri_rip => inst.data.rix.fixes,405 .rmi_sib, .rmi_rip, .mri_sib, .mri_rip => inst.data.rix.fixes,
389 .rrmi_sib, .rrmi_rip => inst.data.rrix.fixes,406 .rrmi_sib, .rrmi_rip => inst.data.rrix.fixes,
390 .mi_sib_u, .mi_rip_u, .mi_sib_s, .mi_rip_s => inst.data.x.fixes,407 .mi_sib_u, .mi_rip_u, .mi_sib_s, .mi_rip_s => inst.data.x.fixes,
391 .m_sib, .m_rip, .rax_moffs, .moffs_rax => inst.data.x.fixes,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 else => return lower.fail("TODO lower .{s}", .{@tagName(inst.ops)}),417 else => return lower.fail("TODO lower .{s}", .{@tagName(inst.ops)}),
394 };418 };
395 try lower.emit(switch (fixes) {419 try lower.emit(switch (fixes) {
...@@ -461,7 +485,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {...@@ -461,7 +485,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
461 .m_sib, .m_rip => &.{485 .m_sib, .m_rip => &.{
462 .{ .mem = lower.mem(inst.ops, inst.data.x.payload) },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 .{ .mem = lower.mem(inst.ops, inst.data.x.payload + 1) },489 .{ .mem = lower.mem(inst.ops, inst.data.x.payload + 1) },
466 .{ .imm = lower.imm(490 .{ .imm = lower.imm(
467 inst.ops,491 inst.ops,
...@@ -477,6 +501,14 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {...@@ -477,6 +501,14 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
477 .{ .mem = lower.mem(inst.ops, inst.data.rix.payload) },501 .{ .mem = lower.mem(inst.ops, inst.data.rix.payload) },
478 .{ .imm = lower.imm(inst.ops, inst.data.rix.i) },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 .mr_sib, .mr_rip => &.{512 .mr_sib, .mr_rip => &.{
481 .{ .mem = lower.mem(inst.ops, inst.data.rx.payload) },513 .{ .mem = lower.mem(inst.ops, inst.data.rx.payload) },
482 .{ .reg = inst.data.rx.r1 },514 .{ .reg = inst.data.rx.r1 },
src/arch/x86_64/Mir.zig+49-29
...@@ -474,6 +474,10 @@ pub const Inst = struct {...@@ -474,6 +474,10 @@ pub const Inst = struct {
474 /// Bitwise logical and not of packed single-precision floating-point values474 /// Bitwise logical and not of packed single-precision floating-point values
475 /// Bitwise logical and not of packed double-precision floating-point values475 /// Bitwise logical and not of packed double-precision floating-point values
476 andn,476 andn,
477 /// Compare packed data for equal
478 cmpeq,
479 /// Compare packed data for greater than
480 cmpgt,
477 /// Maximum of packed signed integers481 /// Maximum of packed signed integers
478 maxs,482 maxs,
479 /// Maximum of packed unsigned integers483 /// Maximum of packed unsigned integers
...@@ -482,6 +486,10 @@ pub const Inst = struct {...@@ -482,6 +486,10 @@ pub const Inst = struct {
482 mins,486 mins,
483 /// Minimum of packed unsigned integers487 /// Minimum of packed unsigned integers
484 minu,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 /// Multiply packed signed integers and store low result493 /// Multiply packed signed integers and store low result
486 mull,494 mull,
487 /// Multiply packed signed integers and store high result495 /// Multiply packed signed integers and store high result
...@@ -720,9 +728,24 @@ pub const Inst = struct {...@@ -720,9 +728,24 @@ pub const Inst = struct {
720 /// Register, memory (RIP) operands.728 /// Register, memory (RIP) operands.
721 /// Uses `rx` payload.729 /// Uses `rx` payload.
722 rm_rip,730 rm_rip,
723 /// Register, memory (SIB), immediate (byte) operands.731 /// Register, memory (SIB), immediate (word) operands.
724 /// Uses `rix` payload with extra data of type `MemorySib`.732 /// Uses `rix` payload with extra data of type `MemorySib`.
725 rmi_sib,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 /// Register, register, memory (RIP).749 /// Register, register, memory (RIP).
727 /// Uses `rrix` payload with extra data of type `MemoryRip`.750 /// Uses `rrix` payload with extra data of type `MemoryRip`.
728 rrm_rip,751 rrm_rip,
...@@ -735,27 +758,24 @@ pub const Inst = struct {...@@ -735,27 +758,24 @@ pub const Inst = struct {
735 /// Register, register, memory (SIB), immediate (byte) operands.758 /// Register, register, memory (SIB), immediate (byte) operands.
736 /// Uses `rrix` payload with extra data of type `MemorySib`.759 /// Uses `rrix` payload with extra data of type `MemorySib`.
737 rrmi_sib,760 rrmi_sib,
738 /// Register, memory (RIP), immediate (byte) operands.
739 /// Uses `rix` payload with extra data of type `MemoryRip`.
740 rmi_rip,
741 /// Single memory (SIB) operand.761 /// Single memory (SIB) operand.
742 /// Uses `x` with extra data of type `MemorySib`.762 /// Uses `x` with extra data of type `MemorySib`.
743 m_sib,763 m_sib,
744 /// Single memory (RIP) operand.764 /// Single memory (RIP) operand.
745 /// Uses `x` with extra data of type `MemoryRip`.765 /// Uses `x` with extra data of type `MemoryRip`.
746 m_rip,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 /// Memory (SIB), immediate (sign-extend) operands.767 /// Memory (SIB), immediate (sign-extend) operands.
754 /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`.768 /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`.
755 mi_sib_s,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 /// Memory (RIP), immediate (sign-extend) operands.773 /// Memory (RIP), immediate (sign-extend) operands.
757 /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`.774 /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`.
758 mi_rip_s,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 /// Memory (SIB), register operands.779 /// Memory (SIB), register operands.
760 /// Uses `rx` payload with extra data of type `MemorySib`.780 /// Uses `rx` payload with extra data of type `MemorySib`.
761 mr_sib,781 mr_sib,
...@@ -768,10 +788,10 @@ pub const Inst = struct {...@@ -768,10 +788,10 @@ pub const Inst = struct {
768 /// Memory (RIP), register, register operands.788 /// Memory (RIP), register, register operands.
769 /// Uses `rrx` payload with extra data of type `MemoryRip`.789 /// Uses `rrx` payload with extra data of type `MemoryRip`.
770 mrr_rip,790 mrr_rip,
771 /// Memory (SIB), register, immediate (byte) operands.791 /// Memory (SIB), register, immediate (word) operands.
772 /// Uses `rix` payload with extra data of type `MemorySib`.792 /// Uses `rix` payload with extra data of type `MemorySib`.
773 mri_sib,793 mri_sib,
774 /// Memory (RIP), register, immediate (byte) operands.794 /// Memory (RIP), register, immediate (word) operands.
775 /// Uses `rix` payload with extra data of type `MemoryRip`.795 /// Uses `rix` payload with extra data of type `MemoryRip`.
776 mri_rip,796 mri_rip,
777 /// Rax, Memory moffs.797 /// Rax, Memory moffs.
...@@ -955,7 +975,7 @@ pub const Inst = struct {...@@ -955,7 +975,7 @@ pub const Inst = struct {
955 rix: struct {975 rix: struct {
956 fixes: Fixes = ._,976 fixes: Fixes = ._,
957 r1: Register,977 r1: Register,
958 i: u8,978 i: u16,
959 payload: u32,979 payload: u32,
960 },980 },
961 /// Register, register, byte immediate, followed by Custom payload found in extra.981 /// Register, register, byte immediate, followed by Custom payload found in extra.
...@@ -1010,7 +1030,7 @@ pub const RegisterList = struct {...@@ -1010,7 +1030,7 @@ pub const RegisterList = struct {
10101030
1011 fn getIndexForReg(registers: []const Register, reg: Register) BitSet.MaskInt {1031 fn getIndexForReg(registers: []const Register, reg: Register) BitSet.MaskInt {
1012 for (registers, 0..) |cpreg, i| {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 unreachable; // register not in input register list!1035 unreachable; // register not in input register list!
1016 }1036 }
...@@ -1030,7 +1050,7 @@ pub const RegisterList = struct {...@@ -1030,7 +1050,7 @@ pub const RegisterList = struct {
1030 }1050 }
10311051
1032 pub fn count(self: Self) u32 {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};
10361056
...@@ -1044,14 +1064,14 @@ pub const Imm64 = struct {...@@ -1044,14 +1064,14 @@ pub const Imm64 = struct {
10441064
1045 pub fn encode(v: u64) Imm64 {1065 pub fn encode(v: u64) Imm64 {
1046 return .{1066 return .{
1047 .msb = @as(u32, @truncate(v >> 32)),1067 .msb = @truncate(v >> 32),
1048 .lsb = @as(u32, @truncate(v)),1068 .lsb = @truncate(v),
1049 };1069 };
1050 }1070 }
10511071
1052 pub fn decode(imm: Imm64) u64 {1072 pub fn decode(imm: Imm64) u64 {
1053 var res: u64 = 0;1073 var res: u64 = 0;
1054 res |= (@as(u64, @intCast(imm.msb)) << 32);1074 res |= @as(u64, @intCast(imm.msb)) << 32;
1055 res |= @as(u64, @intCast(imm.lsb));1075 res |= @as(u64, @intCast(imm.lsb));
1056 return res;1076 return res;
1057 }1077 }
...@@ -1075,7 +1095,7 @@ pub const MemorySib = struct {...@@ -1075,7 +1095,7 @@ pub const MemorySib = struct {
1075 assert(sib.scale_index.scale == 0 or std.math.isPowerOfTwo(sib.scale_index.scale));1095 assert(sib.scale_index.scale == 0 or std.math.isPowerOfTwo(sib.scale_index.scale));
1076 return .{1096 return .{
1077 .ptr_size = @intFromEnum(sib.ptr_size),1097 .ptr_size = @intFromEnum(sib.ptr_size),
1078 .base_tag = @intFromEnum(@as(Memory.Base.Tag, sib.base)),1098 .base_tag = @intFromEnum(sib.base),
1079 .base = switch (sib.base) {1099 .base = switch (sib.base) {
1080 .none => undefined,1100 .none => undefined,
1081 .reg => |r| @intFromEnum(r),1101 .reg => |r| @intFromEnum(r),
...@@ -1091,18 +1111,18 @@ pub const MemorySib = struct {...@@ -1091,18 +1111,18 @@ pub const MemorySib = struct {
1091 }1111 }
10921112
1093 pub fn decode(msib: MemorySib) Memory {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 assert(scale == 0 or std.math.isPowerOfTwo(scale));1115 assert(scale == 0 or std.math.isPowerOfTwo(scale));
1096 return .{ .sib = .{1116 return .{ .sib = .{
1097 .ptr_size = @as(Memory.PtrSize, @enumFromInt(msib.ptr_size)),1117 .ptr_size = @enumFromInt(msib.ptr_size),
1098 .base = switch (@as(Memory.Base.Tag, @enumFromInt(msib.base_tag))) {1118 .base = switch (@as(Memory.Base.Tag, @enumFromInt(msib.base_tag))) {
1099 .none => .none,1119 .none => .none,
1100 .reg => .{ .reg = @as(Register, @enumFromInt(msib.base)) },1120 .reg => .{ .reg = @enumFromInt(msib.base) },
1101 .frame => .{ .frame = @as(bits.FrameIndex, @enumFromInt(msib.base)) },1121 .frame => .{ .frame = @enumFromInt(msib.base) },
1102 },1122 },
1103 .scale_index = .{1123 .scale_index = .{
1104 .scale = scale,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 .disp = msib.disp,1127 .disp = msib.disp,
1108 } };1128 } };
...@@ -1124,7 +1144,7 @@ pub const MemoryRip = struct {...@@ -1124,7 +1144,7 @@ pub const MemoryRip = struct {
11241144
1125 pub fn decode(mrip: MemoryRip) Memory {1145 pub fn decode(mrip: MemoryRip) Memory {
1126 return .{ .rip = .{1146 return .{ .rip = .{
1127 .ptr_size = @as(Memory.PtrSize, @enumFromInt(mrip.ptr_size)),1147 .ptr_size = @enumFromInt(mrip.ptr_size),
1128 .disp = mrip.disp,1148 .disp = mrip.disp,
1129 } };1149 } };
1130 }1150 }
...@@ -1141,14 +1161,14 @@ pub const MemoryMoffs = struct {...@@ -1141,14 +1161,14 @@ pub const MemoryMoffs = struct {
1141 pub fn encode(seg: Register, offset: u64) MemoryMoffs {1161 pub fn encode(seg: Register, offset: u64) MemoryMoffs {
1142 return .{1162 return .{
1143 .seg = @intFromEnum(seg),1163 .seg = @intFromEnum(seg),
1144 .msb = @as(u32, @truncate(offset >> 32)),1164 .msb = @truncate(offset >> 32),
1145 .lsb = @as(u32, @truncate(offset >> 0)),1165 .lsb = @truncate(offset >> 0),
1146 };1166 };
1147 }1167 }
11481168
1149 pub fn decode(moffs: MemoryMoffs) Memory {1169 pub fn decode(moffs: MemoryMoffs) Memory {
1150 return .{ .moffs = .{1170 return .{ .moffs = .{
1151 .seg = @as(Register, @enumFromInt(moffs.seg)),1171 .seg = @enumFromInt(moffs.seg),
1152 .offset = @as(u64, moffs.msb) << 32 | @as(u64, moffs.lsb) << 0,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,7 +1188,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end:
1168 inline for (fields) |field| {1188 inline for (fields) |field| {
1169 @field(result, field.name) = switch (field.type) {1189 @field(result, field.name) = switch (field.type) {
1170 u32 => mir.extra[i],1190 u32 => mir.extra[i],
1171 i32 => @as(i32, @bitCast(mir.extra[i])),1191 i32 => @bitCast(mir.extra[i]),
1172 else => @compileError("bad field type"),1192 else => @compileError("bad field type"),
1173 };1193 };
1174 i += 1;1194 i += 1;
src/arch/x86_64/bits.zig+10-10
...@@ -232,7 +232,7 @@ pub const Register = enum(u7) {...@@ -232,7 +232,7 @@ pub const Register = enum(u7) {
232 else => unreachable,232 else => unreachable,
233 // zig fmt: on233 // zig fmt: on
234 };234 };
235 return @as(u6, @intCast(@intFromEnum(reg) - base));235 return @intCast(@intFromEnum(reg) - base);
236 }236 }
237237
238 pub fn bitSize(reg: Register) u64 {238 pub fn bitSize(reg: Register) u64 {
...@@ -291,11 +291,11 @@ pub const Register = enum(u7) {...@@ -291,11 +291,11 @@ pub const Register = enum(u7) {
291 else => unreachable,291 else => unreachable,
292 // zig fmt: on292 // zig fmt: on
293 };293 };
294 return @as(u4, @truncate(@intFromEnum(reg) - base));294 return @truncate(@intFromEnum(reg) - base);
295 }295 }
296296
297 pub fn lowEnc(reg: Register) u3 {297 pub fn lowEnc(reg: Register) u3 {
298 return @as(u3, @truncate(reg.enc()));298 return @truncate(reg.enc());
299 }299 }
300300
301 pub fn toBitSize(reg: Register, bit_size: u64) Register {301 pub fn toBitSize(reg: Register, bit_size: u64) Register {
...@@ -325,19 +325,19 @@ pub const Register = enum(u7) {...@@ -325,19 +325,19 @@ pub const Register = enum(u7) {
325 }325 }
326326
327 pub fn to64(reg: Register) Register {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 }
330330
331 pub fn to32(reg: Register) Register {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 }
334334
335 pub fn to16(reg: Register) Register {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 }
338338
339 pub fn to8(reg: Register) Register {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 }
342342
343 fn sseBase(reg: Register) u7 {343 fn sseBase(reg: Register) u7 {
...@@ -350,11 +350,11 @@ pub const Register = enum(u7) {...@@ -350,11 +350,11 @@ pub const Register = enum(u7) {
350 }350 }
351351
352 pub fn to256(reg: Register) Register {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 }
355355
356 pub fn to128(reg: Register) Register {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 }
359359
360 /// DWARF register encoding360 /// DWARF register encoding
...@@ -619,7 +619,7 @@ pub const Immediate = union(enum) {...@@ -619,7 +619,7 @@ pub const Immediate = union(enum) {
619 1, 8 => @as(i8, @bitCast(@as(u8, @intCast(x)))),619 1, 8 => @as(i8, @bitCast(@as(u8, @intCast(x)))),
620 16 => @as(i16, @bitCast(@as(u16, @intCast(x)))),620 16 => @as(i16, @bitCast(@as(u16, @intCast(x)))),
621 32 => @as(i32, @bitCast(@as(u32, @intCast(x)))),621 32 => @as(i32, @bitCast(@as(u32, @intCast(x)))),
622 64 => @as(i64, @bitCast(x)),622 64 => @bitCast(x),
623 else => unreachable,623 else => unreachable,
624 },624 },
625 };625 };
src/arch/x86_64/encodings.zig+80-18
...@@ -905,6 +905,9 @@ pub const table = [_]Entry{...@@ -905,6 +905,9 @@ pub const table = [_]Entry{
905905
906 .{ .movlhps, .rm, &.{ .xmm, .xmm }, &.{ 0x0f, 0x16 }, 0, .none, .sse },906 .{ .movlhps, .rm, &.{ .xmm, .xmm }, &.{ 0x0f, 0x16 }, 0, .none, .sse },
907907
908 .{ .movmskps, .rm, &.{ .r32, .xmm }, &.{ 0x0f, 0x50 }, 0, .none, .sse },
909 .{ .movmskps, .rm, &.{ .r64, .xmm }, &.{ 0x0f, 0x50 }, 0, .none, .sse },
910
908 .{ .movss, .rm, &.{ .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x10 }, 0, .none, .sse },911 .{ .movss, .rm, &.{ .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x10 }, 0, .none, .sse },
909 .{ .movss, .mr, &.{ .xmm_m32, .xmm }, &.{ 0xf3, 0x0f, 0x11 }, 0, .none, .sse },912 .{ .movss, .mr, &.{ .xmm_m32, .xmm }, &.{ 0xf3, 0x0f, 0x11 }, 0, .none, .sse },
910913
...@@ -917,6 +920,9 @@ pub const table = [_]Entry{...@@ -917,6 +920,9 @@ pub const table = [_]Entry{
917920
918 .{ .orps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x56 }, 0, .none, .sse },921 .{ .orps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x56 }, 0, .none, .sse },
919922
923 .{ .pmovmskb, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .none, .sse },
924 .{ .pmovmskb, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .none, .sse },
925
920 .{ .shufps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x0f, 0xc6 }, 0, .none, .sse },926 .{ .shufps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x0f, 0xc6 }, 0, .none, .sse },
921927
922 .{ .sqrtps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x51 }, 0, .none, .sse },928 .{ .sqrtps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x51 }, 0, .none, .sse },
...@@ -1005,6 +1011,12 @@ pub const table = [_]Entry{...@@ -1005,6 +1011,12 @@ pub const table = [_]Entry{
1005 .{ .movdqu, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0xf3, 0x0f, 0x6f }, 0, .none, .sse2 },1011 .{ .movdqu, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0xf3, 0x0f, 0x6f }, 0, .none, .sse2 },
1006 .{ .movdqu, .mr, &.{ .xmm_m128, .xmm }, &.{ 0xf3, 0x0f, 0x7f }, 0, .none, .sse2 },1012 .{ .movdqu, .mr, &.{ .xmm_m128, .xmm }, &.{ 0xf3, 0x0f, 0x7f }, 0, .none, .sse2 },
10071013
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 .{ .movq, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf3, 0x0f, 0x7e }, 0, .none, .sse2 },1020 .{ .movq, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf3, 0x0f, 0x7e }, 0, .none, .sse2 },
1009 .{ .movq, .mr, &.{ .xmm_m64, .xmm }, &.{ 0x66, 0x0f, 0xd6 }, 0, .none, .sse2 },1021 .{ .movq, .mr, &.{ .xmm_m64, .xmm }, &.{ 0x66, 0x0f, 0xd6 }, 0, .none, .sse2 },
10101022
...@@ -1037,6 +1049,14 @@ pub const table = [_]Entry{...@@ -1037,6 +1049,14 @@ pub const table = [_]Entry{
10371049
1038 .{ .pandn, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .none, .sse2 },1050 .{ .pandn, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .none, .sse2 },
10391051
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 .{ .pextrw, .rmi, &.{ .r32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0xc5 }, 0, .none, .sse2 },1060 .{ .pextrw, .rmi, &.{ .r32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0xc5 }, 0, .none, .sse2 },
10411061
1042 .{ .pinsrw, .rmi, &.{ .xmm, .r32_m16, .imm8 }, &.{ 0x66, 0x0f, 0xc4 }, 0, .none, .sse2 },1062 .{ .pinsrw, .rmi, &.{ .xmm, .r32_m16, .imm8 }, &.{ 0x66, 0x0f, 0xc4 }, 0, .none, .sse2 },
...@@ -1100,9 +1120,6 @@ pub const table = [_]Entry{...@@ -1100,9 +1120,6 @@ pub const table = [_]Entry{
11001120
1101 .{ .subsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x5c }, 0, .none, .sse2 },1121 .{ .subsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x5c }, 0, .none, .sse2 },
11021122
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 .{ .ucomisd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0x66, 0x0f, 0x2e }, 0, .none, .sse2 },1123 .{ .ucomisd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0x66, 0x0f, 0x2e }, 0, .none, .sse2 },
11071124
1108 .{ .xorpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x57 }, 0, .none, .sse2 },1125 .{ .xorpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x57 }, 0, .none, .sse2 },
...@@ -1137,6 +1154,8 @@ pub const table = [_]Entry{...@@ -1137,6 +1154,8 @@ pub const table = [_]Entry{
11371154
1138 .{ .packusdw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x2b }, 0, .none, .sse4_1 },1155 .{ .packusdw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x2b }, 0, .none, .sse4_1 },
11391156
1157 .{ .pcmpeqq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x29 }, 0, .none, .sse4_1 },
1158
1140 .{ .pextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .none, .sse4_1 },1159 .{ .pextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .none, .sse4_1 },
1141 .{ .pextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .none, .sse4_1 },1160 .{ .pextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .none, .sse4_1 },
1142 .{ .pextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .long, .sse4_1 },1161 .{ .pextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .long, .sse4_1 },
...@@ -1171,6 +1190,9 @@ pub const table = [_]Entry{...@@ -1171,6 +1190,9 @@ pub const table = [_]Entry{
11711190
1172 .{ .roundss, .rmi, &.{ .xmm, .xmm_m32, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0a }, 0, .none, .sse4_1 },1191 .{ .roundss, .rmi, &.{ .xmm, .xmm_m32, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0a }, 0, .none, .sse4_1 },
11731192
1193 // SSE4.2
1194 .{ .pcmpgtq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x37 }, 0, .none, .sse4_2 },
1195
1174 // AVX1196 // AVX
1175 .{ .vaddpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_128_wig, .avx },1197 .{ .vaddpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_128_wig, .avx },
1176 .{ .vaddpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_256_wig, .avx },1198 .{ .vaddpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_256_wig, .avx },
...@@ -1295,6 +1317,16 @@ pub const table = [_]Entry{...@@ -1295,6 +1317,16 @@ pub const table = [_]Entry{
12951317
1296 .{ .vmaxss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x5f }, 0, .vex_lig_wig, .avx },1318 .{ .vmaxss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x5f }, 0, .vex_lig_wig, .avx },
12971319
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 .{ .vminpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_128_wig, .avx },1330 .{ .vminpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_128_wig, .avx },
1299 .{ .vminpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_256_wig, .avx },1331 .{ .vminpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_256_wig, .avx },
13001332
...@@ -1408,6 +1440,18 @@ pub const table = [_]Entry{...@@ -1408,6 +1440,18 @@ pub const table = [_]Entry{
14081440
1409 .{ .vpandn, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_128_wig, .avx },1441 .{ .vpandn, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_128_wig, .avx },
14101442
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 .{ .vpextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .vex_128_w0, .avx },1455 .{ .vpextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .vex_128_w0, .avx },
1412 .{ .vpextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w0, .avx },1456 .{ .vpextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w0, .avx },
1413 .{ .vpextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w1, .avx },1457 .{ .vpextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w1, .avx },
...@@ -1439,6 +1483,9 @@ pub const table = [_]Entry{...@@ -1439,6 +1483,9 @@ pub const table = [_]Entry{
14391483
1440 .{ .vpminud, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_128_wig, .avx },1484 .{ .vpminud, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_128_wig, .avx },
14411485
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 .{ .vpmulhw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_128_wig, .avx },1489 .{ .vpmulhw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_128_wig, .avx },
14431490
1444 .{ .vpmulld, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .vex_128_wig, .avx },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,29 +1628,44 @@ pub const table = [_]Entry{
15811628
1582 .{ .vpandn, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_256_wig, .avx2 },1629 .{ .vpandn, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_256_wig, .avx2 },
15831630
1584 .{ .vpmaxsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3c }, 0, .vex_256_wig, .avx },1631 .{ .vpcmpeqb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x74 }, 0, .vex_256_wig, .avx2 },
1585 .{ .vpmaxsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xee }, 0, .vex_256_wig, .avx },1632 .{ .vpcmpeqw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x75 }, 0, .vex_256_wig, .avx2 },
1586 .{ .vpmaxsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3d }, 0, .vex_256_wig, .avx },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 },
15871649
1588 .{ .vpmaxub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xde }, 0, .vex_256_wig, .avx },1650 .{ .vpmaxud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3f }, 0, .vex_256_wig, .avx2 },
1589 .{ .vpmaxuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3e }, 0, .vex_256_wig, .avx },
15901651
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 },
15921655
1593 .{ .vpminsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x38 }, 0, .vex_256_wig, .avx },1656 .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx2 },
1594 .{ .vpminsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xea }, 0, .vex_256_wig, .avx },1657 .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx2 },
1595 .{ .vpminsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x39 }, 0, .vex_256_wig, .avx },
15961658
1597 .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx },1659 .{ .vpminud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_256_wig, .avx2 },
1598 .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx },
15991660
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 },
16011663
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 },
16031665
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 },
16051667
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 },
16071669
1608 .{ .vpor, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_256_wig, .avx2 },1670 .{ .vpor, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_256_wig, .avx2 },
16091671