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 {
21562156}
21572157
21582158test {
2159 _ = Cache;
21592160 _ = Step;
21602161}
lib/std/array_hash_map.zig+1-14
......@@ -1,5 +1,4 @@
11const std = @import("std.zig");
2const builtin = @import("builtin");
32const debug = std.debug;
43const assert = debug.assert;
54const testing = std.testing;
......@@ -2138,8 +2137,6 @@ test "ensure capacity leak" {
21382137}
21392138
21402139test "big map" {
2141 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2142
21432140 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
21442141 defer map.deinit();
21452142
......@@ -2193,8 +2190,6 @@ test "big map" {
21932190}
21942191
21952192test "clone" {
2196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2197
21982193 var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
21992194 defer original.deinit();
22002195
......@@ -2221,8 +2216,6 @@ test "clone" {
22212216}
22222217
22232218test "shrink" {
2224 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2225
22262219 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
22272220 defer map.deinit();
22282221
......@@ -2263,8 +2256,6 @@ test "shrink" {
22632256}
22642257
22652258test "pop" {
2266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2267
22682259 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
22692260 defer map.deinit();
22702261
......@@ -2283,8 +2274,6 @@ test "pop" {
22832274}
22842275
22852276test "popOrNull" {
2286 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2287
22882277 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
22892278 defer map.deinit();
22902279
......@@ -2305,7 +2294,7 @@ test "popOrNull" {
23052294}
23062295
23072296test "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
23102299 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
23112300 defer map.deinit();
......@@ -2351,8 +2340,6 @@ test "auto store_hash" {
23512340}
23522341
23532342test "sort" {
2354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2355
23562343 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
23572344 defer map.deinit();
23582345
lib/std/array_list.zig-11
......@@ -1,5 +1,4 @@
11const std = @import("std.zig");
2const builtin = @import("builtin");
32const debug = std.debug;
43const assert = debug.assert;
54const testing = std.testing;
......@@ -1184,8 +1183,6 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {
11841183}
11851184
11861185test "std.ArrayList/ArrayListUnmanaged.clone" {
1187 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1188
11891186 const a = testing.allocator;
11901187 {
11911188 var array = ArrayList(i32).init(a);
......@@ -1227,8 +1224,6 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {
12271224}
12281225
12291226test "std.ArrayList/ArrayListUnmanaged.basic" {
1230 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1231
12321227 const a = testing.allocator;
12331228 {
12341229 var list = ArrayList(i32).init(a);
......@@ -1513,8 +1508,6 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {
15131508}
15141509
15151510test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
1516 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1517
15181511 const a = testing.allocator;
15191512 {
15201513 var list = ArrayList(i32).init(a);
......@@ -1561,8 +1554,6 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
15611554}
15621555
15631556test "std.ArrayList/ArrayListUnmanaged.replaceRange" {
1564 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1565
15661557 var arena = std.heap.ArenaAllocator.init(testing.allocator);
15671558 defer arena.deinit();
15681559 const a = arena.allocator();
......@@ -1734,8 +1725,6 @@ test "shrink still sets length when resizing is disabled" {
17341725}
17351726
17361727test "shrinkAndFree with a copy" {
1737 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1738
17391728 var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });
17401729 const a = failing_allocator.allocator();
17411730
lib/std/bit_set.zig+3-12
......@@ -1637,10 +1637,8 @@ fn testStaticBitSet(comptime Set: type) !void {
16371637}
16381638
16391639test "IntegerBitSet" {
1640 switch (builtin.zig_backend) {
1641 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1642 else => {},
1643 }
1640 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1641 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
16441642
16451643 try testStaticBitSet(IntegerBitSet(0));
16461644 try testStaticBitSet(IntegerBitSet(1));
......@@ -1653,10 +1651,7 @@ test "IntegerBitSet" {
16531651}
16541652
16551653test "ArrayBitSet" {
1656 switch (builtin.zig_backend) {
1657 .stage2_x86_64 => return error.SkipZigTest,
1658 else => {},
1659 }
1654 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
16601655
16611656 inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {
16621657 try testStaticBitSet(ArrayBitSet(u8, size));
......@@ -1668,8 +1663,6 @@ test "ArrayBitSet" {
16681663}
16691664
16701665test "DynamicBitSetUnmanaged" {
1671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1672
16731666 const allocator = std.testing.allocator;
16741667 var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);
16751668 try testing.expectEqual(@as(usize, 0), a.count());
......@@ -1723,8 +1716,6 @@ test "DynamicBitSetUnmanaged" {
17231716}
17241717
17251718test "DynamicBitSet" {
1726 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1727
17281719 const allocator = std.testing.allocator;
17291720 var a = try DynamicBitSet.initEmpty(allocator, 300);
17301721 try testing.expectEqual(@as(usize, 0), a.count());
lib/std/crypto/argon2.zig-10
......@@ -622,8 +622,6 @@ pub fn strVerify(
622622}
623623
624624test "argon2d" {
625 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
626
627625 const password = [_]u8{0x01} ** 32;
628626 const salt = [_]u8{0x02} ** 16;
629627 const secret = [_]u8{0x03} ** 8;
......@@ -649,8 +647,6 @@ test "argon2d" {
649647}
650648
651649test "argon2i" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654650 const password = [_]u8{0x01} ** 32;
655651 const salt = [_]u8{0x02} ** 16;
656652 const secret = [_]u8{0x03} ** 8;
......@@ -676,8 +672,6 @@ test "argon2i" {
676672}
677673
678674test "argon2id" {
679 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
680
681675 const password = [_]u8{0x01} ** 32;
682676 const salt = [_]u8{0x02} ** 16;
683677 const secret = [_]u8{0x03} ** 8;
......@@ -703,8 +697,6 @@ test "argon2id" {
703697}
704698
705699test "kdf" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
708700 const password = "password";
709701 const salt = "somesalt";
710702
......@@ -936,8 +928,6 @@ test "password hash and password verify" {
936928}
937929
938930test "kdf derived key length" {
939 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
940
941931 const allocator = std.testing.allocator;
942932
943933 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 {
682682}
683683
684684test "BLAKE3 reference test cases" {
685 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
686
687685 var hash_state = Blake3.init(.{});
688686 const hash = &hash_state;
689687 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 {
759759}
760760
761761test "chacha20 AEAD API" {
762 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
763
764762 const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 };
765763 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.";
766764 const ad = "Additional data";
......@@ -782,8 +780,6 @@ test "chacha20 AEAD API" {
782780
783781// https://tools.ietf.org/html/rfc7539#section-2.4.2
784782test "crypto.chacha20 test vector sunscreen" {
785 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
786
787783 const expected_result = [_]u8{
788784 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,
789785 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);
6565pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);
6666
6767test "Hash composition" {
68 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
7068 const Sha256 = sha2.Sha256;
7169 const msg = "test";
7270
lib/std/crypto/hkdf.zig-2
......@@ -72,8 +72,6 @@ pub fn Hkdf(comptime Hmac: type) type {
7272const htest = @import("test.zig");
7373
7474test "Hkdf" {
75 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
76
7775 const ikm = [_]u8{0x0b} ** 22;
7876 const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };
7977 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{
553553};
554554
555555test "invNTTReductions bounds" {
556 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
557
558556 // Checks whether the reductions proposed by invNTTReductions
559557 // don't overflow during invNTT().
560558 var xs = [_]i32{1} ** 256; // start at |x| ≤ q
......@@ -658,8 +656,6 @@ fn montReduce(x: i32) i16 {
658656}
659657
660658test "Test montReduce" {
661 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
662
663659 var rnd = RndGen.init(0);
664660 for (0..1000) |_| {
665661 const bound = comptime @as(i32, Q) * (1 << 15);
......@@ -678,8 +674,6 @@ fn feToMont(x: i16) i16 {
678674}
679675
680676test "Test feToMont" {
681 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
682
683677 var x: i32 = -(1 << 15);
684678 while (x < 1 << 15) : (x += 1) {
685679 const y = feToMont(@as(i16, @intCast(x)));
......@@ -713,8 +707,6 @@ fn feBarrettReduce(x: i16) i16 {
713707}
714708
715709test "Test Barrett reduction" {
716 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
717
718710 var x: i32 = -(1 << 15);
719711 while (x < 1 << 15) : (x += 1) {
720712 var y1 = feBarrettReduce(@as(i16, @intCast(x)));
......@@ -735,8 +727,6 @@ fn csubq(x: i16) i16 {
735727}
736728
737729test "Test csubq" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
740730 var x: i32 = -29439;
741731 while (x < 1 << 15) : (x += 1) {
742732 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 {
14761466}
14771467
14781468test "MulHat" {
1479 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1480
14811469 var rnd = RndGen.init(0);
14821470
14831471 for (0..100) |_| {
......@@ -1509,8 +1497,6 @@ test "MulHat" {
15091497}
15101498
15111499test "NTT" {
1512 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1513
15141500 var rnd = RndGen.init(0);
15151501
15161502 for (0..1000) |_| {
......@@ -1534,8 +1520,6 @@ test "NTT" {
15341520}
15351521
15361522test "Compression" {
1537 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1538
15391523 var rnd = RndGen.init(0);
15401524 inline for (.{ 1, 4, 5, 10, 11 }) |d| {
15411525 for (0..1000) |_| {
......@@ -1548,8 +1532,6 @@ test "Compression" {
15481532}
15491533
15501534test "noise" {
1551 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1552
15531535 var seed: [32]u8 = undefined;
15541536 for (&seed, 0..) |*s, i| {
15551537 s.* = @as(u8, @intCast(i));
......@@ -1596,8 +1578,6 @@ test "noise" {
15961578}
15971579
15981580test "uniform sampling" {
1599 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1600
16011581 var seed: [32]u8 = undefined;
16021582 for (&seed, 0..) |*s, i| {
16031583 s.* = @as(u8, @intCast(i));
......@@ -1631,8 +1611,6 @@ test "uniform sampling" {
16311611}
16321612
16331613test "Polynomial packing" {
1634 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1635
16361614 var rnd = RndGen.init(0);
16371615
16381616 for (0..1000) |_| {
......@@ -1642,8 +1620,6 @@ test "Polynomial packing" {
16421620}
16431621
16441622test "Test inner PKE" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
16471623 var seed: [32]u8 = undefined;
16481624 var pt: [32]u8 = undefined;
16491625 for (&seed, &pt, 0..) |*s, *p, i| {
......@@ -1665,8 +1641,6 @@ test "Test inner PKE" {
16651641}
16661642
16671643test "Test happy flow" {
1668 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1669
16701644 var seed: [64]u8 = undefined;
16711645 for (&seed, 0..) |*s, i| {
16721646 s.* = @as(u8, @intCast(i));
lib/std/crypto/pbkdf2.zig-15
......@@ -1,5 +1,4 @@
11const std = @import("std");
2const builtin = @import("builtin");
32const mem = std.mem;
43const maxInt = std.math.maxInt;
54const OutputTooLongError = std.crypto.errors.OutputTooLongError;
......@@ -152,8 +151,6 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;
152151// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors
153152
154153test "RFC 6070 one iteration" {
155 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
156
157154 const p = "password";
158155 const s = "salt";
159156 const c = 1;
......@@ -169,8 +166,6 @@ test "RFC 6070 one iteration" {
169166}
170167
171168test "RFC 6070 two iterations" {
172 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
173
174169 const p = "password";
175170 const s = "salt";
176171 const c = 2;
......@@ -186,8 +181,6 @@ test "RFC 6070 two iterations" {
186181}
187182
188183test "RFC 6070 4096 iterations" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
191184 const p = "password";
192185 const s = "salt";
193186 const c = 4096;
......@@ -203,8 +196,6 @@ test "RFC 6070 4096 iterations" {
203196}
204197
205198test "RFC 6070 16,777,216 iterations" {
206 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
207
208199 // These iteration tests are slow so we always skip them. Results have been verified.
209200 if (true) {
210201 return error.SkipZigTest;
......@@ -225,8 +216,6 @@ test "RFC 6070 16,777,216 iterations" {
225216}
226217
227218test "RFC 6070 multi-block salt and password" {
228 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
229
230219 const p = "passwordPASSWORDpassword";
231220 const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";
232221 const c = 4096;
......@@ -242,8 +231,6 @@ test "RFC 6070 multi-block salt and password" {
242231}
243232
244233test "RFC 6070 embedded NUL" {
245 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
246
247234 const p = "pass\x00word";
248235 const s = "sa\x00lt";
249236 const c = 4096;
......@@ -259,8 +246,6 @@ test "RFC 6070 embedded NUL" {
259246}
260247
261248test "Very large dk_len" {
262 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
263
264249 // This test allocates 8GB of memory and is expected to take several hours to run.
265250 if (true) {
266251 return error.SkipZigTest;
lib/std/crypto/phc_encoding.zig-4
......@@ -351,16 +351,12 @@ test "phc format - encoding/decoding" {
351351}
352352
353353test "phc format - empty input string" {
354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
355
356354 const s = "";
357355 const v = deserialize(struct { alg_id: []const u8 }, s);
358356 try std.testing.expectError(Error.InvalidEncoding, v);
359357}
360358
361359test "phc format - hash without salt" {
362 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
363
364360 const s = "$scrypt";
365361 const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);
366362 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 {
302302 };
303303}
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
307307fn keyToWords(key: [32]u8) [8]u32 {
308308 var k: [8]u32 = undefined;
......@@ -555,8 +555,6 @@ pub const SealedBox = struct {
555555const htest = @import("test.zig");
556556
557557test "(x)salsa20" {
558 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
559
560558 const key = [_]u8{0x69} ** 32;
561559 const nonce = [_]u8{0x42} ** 8;
562560 const msg = [_]u8{0} ** 20;
......@@ -571,8 +569,6 @@ test "(x)salsa20" {
571569}
572570
573571test "xsalsa20poly1305" {
574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
575
576572 var msg: [100]u8 = undefined;
577573 var msg2: [msg.len]u8 = undefined;
578574 var c: [msg.len]u8 = undefined;
......@@ -588,8 +584,6 @@ test "xsalsa20poly1305" {
588584}
589585
590586test "xsalsa20poly1305 secretbox" {
591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
592
593587 var msg: [100]u8 = undefined;
594588 var msg2: [msg.len]u8 = undefined;
595589 var key: [XSalsa20Poly1305.key_length]u8 = undefined;
lib/std/crypto/scrypt.zig-5
......@@ -3,7 +3,6 @@
33// https://github.com/Tarsnap/scrypt
44
55const std = @import("std");
6const builtin = @import("builtin");
76const crypto = std.crypto;
87const fmt = std.fmt;
98const io = std.io;
......@@ -684,8 +683,6 @@ test "unix-scrypt" {
684683}
685684
686685test "crypt format" {
687 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
688
689686 const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";
690687 const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);
691688 var buf: [str.len]u8 = undefined;
......@@ -694,8 +691,6 @@ test "crypt format" {
694691}
695692
696693test "kdf fast" {
697 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
698
699694 const TestVector = struct {
700695 password: []const u8,
701696 salt: []const u8,
lib/std/crypto/sha2.zig-10
......@@ -406,16 +406,12 @@ fn Sha2x32(comptime params: Sha2Params32) type {
406406}
407407
408408test "sha224 single" {
409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
410
411409 try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");
412410 try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");
413411 try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
414412}
415413
416414test "sha224 streaming" {
417 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
418
419415 var h = Sha224.init(.{});
420416 var out: [28]u8 = undefined;
421417
......@@ -436,16 +432,12 @@ test "sha224 streaming" {
436432}
437433
438434test "sha256 single" {
439 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
440
441435 try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");
442436 try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");
443437 try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
444438}
445439
446440test "sha256 streaming" {
447 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
448
449441 var h = Sha256.init(.{});
450442 var out: [32]u8 = undefined;
451443
......@@ -466,8 +458,6 @@ test "sha256 streaming" {
466458}
467459
468460test "sha256 aligned final" {
469 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
470
471461 var block = [_]u8{0} ** Sha256.block_length;
472462 var out: [Sha256.digest_length]u8 = undefined;
473463
lib/std/fifo.zig-2
......@@ -505,8 +505,6 @@ test "LinearFifo(u8, .Dynamic)" {
505505}
506506
507507test "LinearFifo" {
508 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
509
510508 inline for ([_]type{ u1, u8, u16, u64 }) |T| {
511509 inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {
512510 const FifoType = LinearFifo(T, bt);
lib/std/fmt.zig-2
......@@ -2751,8 +2751,6 @@ test "formatType max_depth" {
27512751}
27522752
27532753test "positional" {
2754 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2755
27562754 try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
27572755 try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
27582756 try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});
lib/std/json.zig-4
......@@ -38,8 +38,6 @@ test parseFromSlice {
3838}
3939
4040test Value {
41 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
42
4341 var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});
4442 defer parsed.deinit();
4543 try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);
......@@ -65,8 +63,6 @@ test writeStream {
6563}
6664
6765test stringify {
68 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
7066 var out = ArrayList(u8).init(testing.allocator);
7167 defer out.deinit();
7268
lib/std/json/JSONTestSuite_test.zig-66
......@@ -104,8 +104,6 @@ test "i_string_utf16LE_no_BOM.json" {
104104 try any("[\x00\"\x00\xe9\x00\"\x00]\x00");
105105}
106106test "i_structure_500_nested_arrays.json" {
107 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
108
109107 try any("[" ** 500 ++ "]" ** 500);
110108}
111109test "i_structure_UTF-8_BOM_empty_object.json" {
......@@ -361,21 +359,15 @@ test "n_object_bracket_key.json" {
361359 try err("{[: \"x\"}\n");
362360}
363361test "n_object_comma_instead_of_colon.json" {
364 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
365
366362 try err("{\"x\", null}");
367363}
368364test "n_object_double_colon.json" {
369 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
370
371365 try err("{\"x\"::\"b\"}");
372366}
373367test "n_object_emoji.json" {
374368 try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");
375369}
376370test "n_object_garbage_at_end.json" {
377 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
378
379371 try err("{\"a\":\"a\" 123}");
380372}
381373test "n_object_key_with_single_quotes.json" {
......@@ -385,26 +377,18 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {
385377 try err("{\"\xb9\":\"0\",}");
386378}
387379test "n_object_missing_colon.json" {
388 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
390380 try err("{\"a\" b}");
391381}
392382test "n_object_missing_key.json" {
393383 try err("{:\"b\"}");
394384}
395385test "n_object_missing_semicolon.json" {
396 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
397
398386 try err("{\"a\" \"b\"}");
399387}
400388test "n_object_missing_value.json" {
401 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
402
403389 try err("{\"a\":");
404390}
405391test "n_object_no-colon.json" {
406 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
407
408392 try err("{\"a\"");
409393}
410394test "n_object_non_string_key.json" {
......@@ -417,59 +401,39 @@ test "n_object_repeated_null_null.json" {
417401 try err("{null:null,null:null}");
418402}
419403test "n_object_several_trailing_commas.json" {
420 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
421
422404 try err("{\"id\":0,,,,,}");
423405}
424406test "n_object_single_quote.json" {
425407 try err("{'a':0}");
426408}
427409test "n_object_trailing_comma.json" {
428 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
429
430410 try err("{\"id\":0,}");
431411}
432412test "n_object_trailing_comment.json" {
433 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
434
435413 try err("{\"a\":\"b\"}/**/");
436414}
437415test "n_object_trailing_comment_open.json" {
438 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
439
440416 try err("{\"a\":\"b\"}/**//");
441417}
442418test "n_object_trailing_comment_slash_open.json" {
443 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
444
445419 try err("{\"a\":\"b\"}//");
446420}
447421test "n_object_trailing_comment_slash_open_incomplete.json" {
448 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
449
450422 try err("{\"a\":\"b\"}/");
451423}
452424test "n_object_two_commas_in_a_row.json" {
453 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
454
455425 try err("{\"a\":\"b\",,\"c\":\"d\"}");
456426}
457427test "n_object_unquoted_key.json" {
458428 try err("{a: \"b\"}");
459429}
460430test "n_object_unterminated-value.json" {
461 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
462
463431 try err("{\"a\":\"a");
464432}
465433test "n_object_with_single_string.json" {
466 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
467
468434 try err("{ \"foo\" : \"bar\", \"a\" }");
469435}
470436test "n_object_with_trailing_garbage.json" {
471 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
472
473437 try err("{\"a\":\"b\"}#");
474438}
475439test "n_single_space.json" {
......@@ -596,8 +560,6 @@ test "n_structure_close_unopened_array.json" {
596560 try err("1]");
597561}
598562test "n_structure_comma_instead_of_closing_brace.json" {
599 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
600
601563 try err("{\"x\": true,");
602564}
603565test "n_structure_double_array.json" {
......@@ -628,18 +590,12 @@ test "n_structure_object_followed_by_closing_object.json" {
628590 try err("{}}");
629591}
630592test "n_structure_object_unclosed_no_value.json" {
631 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
632
633593 try err("{\"\":");
634594}
635595test "n_structure_object_with_comment.json" {
636 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
637
638596 try err("{\"a\":/*comment*/\"b\"}");
639597}
640598test "n_structure_object_with_trailing_garbage.json" {
641 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
642
643599 try err("{\"a\": true} \"x\"");
644600}
645601test "n_structure_open_array_apostrophe.json" {
......@@ -649,8 +605,6 @@ test "n_structure_open_array_comma.json" {
649605 try err("[,");
650606}
651607test "n_structure_open_array_object.json" {
652 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654608 try err("[{\"\":" ** 50000 ++ "\n");
655609}
656610test "n_structure_open_array_open_object.json" {
......@@ -690,8 +644,6 @@ test "n_structure_single_star.json" {
690644 try err("*");
691645}
692646test "n_structure_trailing_#.json" {
693 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
694
695647 try err("{\"a\":\"b\"}#{}");
696648}
697649test "n_structure_uescaped_LF_before_string.json" {
......@@ -710,8 +662,6 @@ test "n_structure_unclosed_array_unfinished_true.json" {
710662 try err("[ false, tru");
711663}
712664test "n_structure_unclosed_object.json" {
713 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
714
715665 try err("{\"asd\":\"asd\"");
716666}
717667test "n_structure_unicode-identifier.json" {
......@@ -819,31 +769,21 @@ test "y_object.json" {
819769 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
820770}
821771test "y_object_basic.json" {
822 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
823
824772 try ok("{\"asd\":\"sdf\"}");
825773}
826774test "y_object_duplicated_key.json" {
827 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
828
829775 try ok("{\"a\":\"b\",\"a\":\"c\"}");
830776}
831777test "y_object_duplicated_key_and_value.json" {
832 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
833
834778 try ok("{\"a\":\"b\",\"a\":\"b\"}");
835779}
836780test "y_object_empty.json" {
837781 try ok("{}");
838782}
839783test "y_object_empty_key.json" {
840 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
841
842784 try ok("{\"\":0}");
843785}
844786test "y_object_escaped_null_in_key.json" {
845 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
846
847787 try ok("{\"foo\\u0000bar\": 42}");
848788}
849789test "y_object_extreme_numbers.json" {
......@@ -857,18 +797,12 @@ test "y_object_long_strings.json" {
857797 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
858798}
859799test "y_object_simple.json" {
860 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
861
862800 try ok("{\"a\":[]}");
863801}
864802test "y_object_string_unicode.json" {
865 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
866
867803 try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");
868804}
869805test "y_object_with_newlines.json" {
870 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
871
872806 try ok("{\n\"a\": \"b\"\n}");
873807}
874808test "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 {
125125}
126126
127127test "parsing empty string gives appropriate error" {
128 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
129
130128 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
131129 defer arena_allocator.deinit();
132130 try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));
133131}
134132
135133test "Value.array allocator should still be usable after parsing" {
136 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
137
138134 var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});
139135 defer parsed.deinit();
140136
......@@ -195,8 +191,6 @@ test "escaped characters" {
195191}
196192
197193test "Value.jsonStringify" {
198 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
199
200194 var vals = [_]Value{
201195 .{ .integer = 1 },
202196 .{ .integer = 2 },
......@@ -263,8 +257,6 @@ test "parseFromValue(std.json.Value,...)" {
263257}
264258
265259test "polymorphic parsing" {
266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
267
268260 if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108
269261 const doc =
270262 \\{ "type": "div",
......@@ -310,8 +302,6 @@ test "polymorphic parsing" {
310302}
311303
312304test "long object value" {
313 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
314
315305 const value = "01234567890123456789";
316306 const doc = "{\"key\":\"" ++ value ++ "\"}";
317307 var fbs = std.io.fixedBufferStream(doc);
......@@ -324,8 +314,6 @@ test "long object value" {
324314}
325315
326316test "ParseOptions.max_value_len" {
327 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
328
329317 var arena = ArenaAllocator.init(testing.allocator);
330318 defer arena.deinit();
331319
lib/std/json/static_test.zig-6
......@@ -392,8 +392,6 @@ test "parse" {
392392}
393393
394394test "parse into enum" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
397395 const T = enum(u32) {
398396 Foo = 42,
399397 Bar,
......@@ -478,8 +476,6 @@ test "parse into tagged union errors" {
478476}
479477
480478test "parse into struct with no fields" {
481 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
482
483479 const T = struct {};
484480 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
485481 defer parsed.deinit();
......@@ -949,8 +945,6 @@ test "json parse allocate when streaming" {
949945}
950946
951947test "parse at comptime" {
952 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
953
954948 const doc =
955949 \\{
956950 \\ "vals": {
lib/std/json/stringify_test.zig-36
......@@ -100,8 +100,6 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {
100100}
101101
102102test "stringify null optional fields" {
103 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
104
105103 const MyStruct = struct {
106104 optional: ?[]const u8 = null,
107105 required: []const u8 = "something",
......@@ -123,8 +121,6 @@ test "stringify null optional fields" {
123121}
124122
125123test "stringify basic types" {
126 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
127
128124 try testStringify("false", false, .{});
129125 try testStringify("true", true, .{});
130126 try testStringify("null", @as(?u8, null), .{});
......@@ -141,8 +137,6 @@ test "stringify basic types" {
141137}
142138
143139test "stringify string" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
146140 try testStringify("\"hello\"", "hello", .{});
147141 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});
148142 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });
......@@ -167,16 +161,12 @@ test "stringify string" {
167161}
168162
169163test "stringify many-item sentinel-terminated string" {
170 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
171
172164 try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});
173165 try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });
174166 try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });
175167}
176168
177169test "stringify enums" {
178 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
179
180170 const E = enum {
181171 foo,
182172 bar,
......@@ -186,15 +176,11 @@ test "stringify enums" {
186176}
187177
188178test "stringify enum literals" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
191179 try testStringify("\"foo\"", .foo, .{});
192180 try testStringify("\"bar\"", .bar, .{});
193181}
194182
195183test "stringify tagged unions" {
196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
197
198184 const T = union(enum) {
199185 nothing,
200186 foo: u32,
......@@ -206,8 +192,6 @@ test "stringify tagged unions" {
206192}
207193
208194test "stringify struct" {
209 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
210
211195 try testStringify("{\"foo\":42}", struct {
212196 foo: u32,
213197 }{ .foo = 42 }, .{});
......@@ -230,8 +214,6 @@ test "emit_strings_as_arrays" {
230214}
231215
232216test "stringify struct with indentation" {
233 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
234
235217 try testStringify(
236218 \\{
237219 \\ "foo": 42,
......@@ -277,8 +259,6 @@ test "stringify struct with indentation" {
277259}
278260
279261test "stringify struct with void field" {
280 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
281
282262 try testStringify("{\"foo\":42}", struct {
283263 foo: u32,
284264 bar: void = {},
......@@ -286,8 +266,6 @@ test "stringify struct with void field" {
286266}
287267
288268test "stringify array of structs" {
289 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
290
291269 const MyStruct = struct {
292270 foo: u32,
293271 };
......@@ -299,8 +277,6 @@ test "stringify array of structs" {
299277}
300278
301279test "stringify struct with custom stringifier" {
302 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
303
304280 try testStringify("[\"something special\",42]", struct {
305281 foo: u32,
306282 const Self = @This();
......@@ -315,16 +291,12 @@ test "stringify struct with custom stringifier" {
315291}
316292
317293test "stringify vector" {
318 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
319
320294 try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});
321295 try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});
322296 try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });
323297}
324298
325299test "stringify tuple" {
326 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
327
328300 try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});
329301}
330302
......@@ -411,8 +383,6 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St
411383}
412384
413385test "stringify alloc" {
414 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
415
416386 const allocator = std.testing.allocator;
417387 const expected =
418388 \\{"foo":"bar","answer":42,"my_friend":"sammy"}
......@@ -424,8 +394,6 @@ test "stringify alloc" {
424394}
425395
426396test "comptime stringify" {
427 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
428
429397 comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;
430398 comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;
431399 comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;
......@@ -446,8 +414,6 @@ test "comptime stringify" {
446414}
447415
448416test "print" {
449 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
450
451417 var out_buf: [1024]u8 = undefined;
452418 var slice_stream = std.io.fixedBufferStream(&out_buf);
453419 const out = slice_stream.writer();
......@@ -479,8 +445,6 @@ test "print" {
479445}
480446
481447test "nonportable numbers" {
482 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
483
484448 try testStringify("9999999999999999", 9999999999999999, .{});
485449 try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });
486450}
lib/std/json/test.zig+1-4
......@@ -1,5 +1,4 @@
11const std = @import("std");
2const builtin = @import("builtin");
32const testing = std.testing;
43const parseFromSlice = @import("./static.zig").parseFromSlice;
54const validate = @import("./scanner.zig").validate;
......@@ -35,15 +34,13 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
3534
3635// Additional tests not part of test JSONTestSuite.
3736test "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
4039 try roundTrip(
4140 \\{"1":[],"2":{},"3":"4"}
4241 );
4342}
4443test "n_object_closed_missing_value" {
45 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
46
4744 try err(
4845 \\{"a":}
4946 );
lib/std/math/big/int_test.zig+5-49
......@@ -246,8 +246,6 @@ test "big.int fits" {
246246}
247247
248248test "big.int string set" {
249 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
250
251249 var a = try Managed.init(testing.allocator);
252250 defer a.deinit();
253251
......@@ -264,8 +262,6 @@ test "big.int string negative" {
264262}
265263
266264test "big.int string set number with underscores" {
267 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
269265 var a = try Managed.init(testing.allocator);
270266 defer a.deinit();
271267
......@@ -274,8 +270,6 @@ test "big.int string set number with underscores" {
274270}
275271
276272test "big.int string set case insensitive number" {
277 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
278
279273 var a = try Managed.init(testing.allocator);
280274 defer a.deinit();
281275
......@@ -326,8 +320,6 @@ test "big.int twos complement limit set" {
326320}
327321
328322test "big.int string to" {
329 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
330
331323 var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124);
332324 defer a.deinit();
333325
......@@ -368,8 +360,6 @@ test "big.int string to base 16" {
368360}
369361
370362test "big.int neg string to" {
371 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
372
373363 var a = try Managed.initSet(testing.allocator, -123907434);
374364 defer a.deinit();
375365
......@@ -392,8 +382,6 @@ test "big.int zero string to" {
392382}
393383
394384test "big.int clone" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
397385 var a = try Managed.initSet(testing.allocator, 1234);
398386 defer a.deinit();
399387 var b = try a.clone();
......@@ -634,8 +622,6 @@ test "big.int addWrap single-single, unsigned" {
634622}
635623
636624test "big.int subWrap single-single, unsigned" {
637 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
638
639625 var a = try Managed.initSet(testing.allocator, 0);
640626 defer a.deinit();
641627
......@@ -963,8 +949,6 @@ test "big.int mul multi-multi" {
963949}
964950
965951test "big.int mul alias r with a" {
966 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
967
968952 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
969953 defer a.deinit();
970954 var b = try Managed.initSet(testing.allocator, 2);
......@@ -976,8 +960,6 @@ test "big.int mul alias r with a" {
976960}
977961
978962test "big.int mul alias r with b" {
979 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
980
981963 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
982964 defer a.deinit();
983965 var b = try Managed.initSet(testing.allocator, 2);
......@@ -989,8 +971,6 @@ test "big.int mul alias r with b" {
989971}
990972
991973test "big.int mul alias r with a and b" {
992 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
993
994974 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
995975 defer a.deinit();
996976
......@@ -1096,7 +1076,7 @@ test "big.int mulWrap multi-multi unsigned" {
10961076
10971077test "big.int mulWrap multi-multi signed" {
10981078 switch (builtin.zig_backend) {
1099 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1079 .stage2_c => return error.SkipZigTest,
11001080 else => {},
11011081 }
11021082
......@@ -1171,8 +1151,6 @@ test "big.int div single-half with rem" {
11711151}
11721152
11731153test "big.int div single-single no rem" {
1174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1175
11761154 // assumes usize is <= 64 bits.
11771155 var a = try Managed.initSet(testing.allocator, 1 << 52);
11781156 defer a.deinit();
......@@ -1190,8 +1168,6 @@ test "big.int div single-single no rem" {
11901168}
11911169
11921170test "big.int div single-single with rem" {
1193 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1194
11951171 var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33));
11961172 defer a.deinit();
11971173 var b = try Managed.initSet(testing.allocator, (1 << 35));
......@@ -1271,8 +1247,6 @@ test "big.int div multi>2-single" {
12711247}
12721248
12731249test "big.int div single-single q < r" {
1274 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1275
12761250 var a = try Managed.initSet(testing.allocator, 0x0078f432);
12771251 defer a.deinit();
12781252 var b = try Managed.initSet(testing.allocator, 0x01000000);
......@@ -1317,10 +1291,7 @@ test "big.int div q=0 alias" {
13171291}
13181292
13191293test "big.int div multi-multi q < r" {
1320 switch (builtin.zig_backend) {
1321 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1322 else => {},
1323 }
1294 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
13241295
13251296 const op1 = 0x1ffffffff0078f432;
13261297 const op2 = 0x1ffffffff01000000;
......@@ -1642,8 +1613,6 @@ test "big.int div floor single-single -/-" {
16421613}
16431614
16441615test "big.int div floor no remainder negative quotient" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
16471616 const u: i32 = -0x80000000;
16481617 const v: i32 = 1;
16491618
......@@ -1743,10 +1712,7 @@ test "big.int div multi-multi no rem" {
17431712}
17441713
17451714test "big.int div multi-multi (2 branch)" {
1746 switch (builtin.zig_backend) {
1747 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1748 else => {},
1749 }
1715 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
17501716
17511717 var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111);
17521718 defer a.deinit();
......@@ -1785,10 +1751,7 @@ test "big.int div multi-multi (3.1/3.3 branch)" {
17851751}
17861752
17871753test "big.int div multi-single zero-limb trailing" {
1788 switch (builtin.zig_backend) {
1789 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1790 else => {},
1791 }
1754 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
17921755
17931756 var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000);
17941757 defer a.deinit();
......@@ -1808,10 +1771,7 @@ test "big.int div multi-single zero-limb trailing" {
18081771}
18091772
18101773test "big.int div multi-multi zero-limb trailing (with rem)" {
1811 switch (builtin.zig_backend) {
1812 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1813 else => {},
1814 }
1774 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
18151775
18161776 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
18171777 defer a.deinit();
......@@ -1908,8 +1868,6 @@ test "big.int div multi-multi fuzz case #1" {
19081868}
19091869
19101870test "big.int div multi-multi fuzz case #2" {
1911 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1912
19131871 var a = try Managed.init(testing.allocator);
19141872 defer a.deinit();
19151873 var b = try Managed.init(testing.allocator);
......@@ -2672,8 +2630,6 @@ test "big.int mutable to managed" {
26722630}
26732631
26742632test "big.int const to managed" {
2675 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2676
26772633 var a = try Managed.initSet(testing.allocator, 123423453456);
26782634 defer a.deinit();
26792635
lib/std/math/big/rational.zig-6
......@@ -494,8 +494,6 @@ fn extractLowBits(a: Int, comptime T: type) T {
494494}
495495
496496test "big.rational extractLowBits" {
497 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
498
499497 var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321);
500498 defer a.deinit();
501499
......@@ -649,8 +647,6 @@ test "big.rational copy" {
649647}
650648
651649test "big.rational negate" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654650 var a = try Rational.init(testing.allocator);
655651 defer a.deinit();
656652
......@@ -668,8 +664,6 @@ test "big.rational negate" {
668664}
669665
670666test "big.rational abs" {
671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
672
673667 var a = try Rational.init(testing.allocator);
674668 defer a.deinit();
675669
lib/std/math/log10.zig-1
......@@ -147,7 +147,6 @@ test "oldlog10 doesn't work" {
147147test "log10_int vs old implementation" {
148148 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
149149 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
151150 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
152151 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
153152 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) {
5656}
5757
5858test "math.log_int" {
59 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
60
6159 // Test all unsigned integers with 2, 3, ..., 64 bits.
6260 // We cannot test 0 or 1 bits since base must be > 1.
6361 inline for (2..64 + 1) |bits| {
lib/std/math/nextafter.zig+1-2
......@@ -1,4 +1,3 @@
1const builtin = @import("builtin");
21const std = @import("../std.zig");
32const math = std.math;
43const assert = std.debug.assert;
......@@ -103,7 +102,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {
103102}
104103
105104test "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
108107 try expect(nextAfter(i0, 0, 0) == 0);
109108 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 {
17411741}
17421742
17431743test "comptime read/write int" {
1744 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1745
17461744 comptime {
17471745 var bytes: [2]u8 = undefined;
17481746 writeIntLittle(u16, &bytes, 0x1234);
......@@ -3309,8 +3307,6 @@ test "testStringEquality" {
33093307}
33103308
33113309test "testReadInt" {
3312 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3313
33143310 try testReadIntImpl();
33153311 try comptime testReadIntImpl();
33163312}
lib/std/multi_array_list.zig-16
......@@ -583,8 +583,6 @@ pub fn MultiArrayList(comptime T: type) type {
583583}
584584
585585test "basic usage" {
586 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
587
588586 const ally = testing.allocator;
589587
590588 const Foo = struct {
......@@ -679,8 +677,6 @@ test "basic usage" {
679677// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes
680678// function used the @reduce code path.
681679test "regression test for @reduce bug" {
682 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
683
684680 const ally = testing.allocator;
685681 var list = MultiArrayList(struct {
686682 tag: std.zig.Token.Tag,
......@@ -758,8 +754,6 @@ test "regression test for @reduce bug" {
758754}
759755
760756test "ensure capacity on empty list" {
761 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
762
763757 const ally = testing.allocator;
764758
765759 const Foo = struct {
......@@ -795,8 +789,6 @@ test "ensure capacity on empty list" {
795789}
796790
797791test "insert elements" {
798 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
799
800792 const ally = testing.allocator;
801793
802794 const Foo = struct {
......@@ -816,8 +808,6 @@ test "insert elements" {
816808}
817809
818810test "union" {
819 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
820
821811 const ally = testing.allocator;
822812
823813 const Foo = union(enum) {
......@@ -873,8 +863,6 @@ test "union" {
873863}
874864
875865test "sorting a span" {
876 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
877
878866 var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{};
879867 defer list.deinit(testing.allocator);
880868
......@@ -915,8 +903,6 @@ test "sorting a span" {
915903}
916904
917905test "0 sized struct field" {
918 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
919
920906 const ally = testing.allocator;
921907
922908 const Foo = struct {
......@@ -944,8 +930,6 @@ test "0 sized struct field" {
944930}
945931
946932test "0 sized struct" {
947 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
948
949933 const ally = testing.allocator;
950934
951935 const Foo = struct {
lib/std/net/test.zig+1-2
......@@ -109,9 +109,8 @@ test "parse and render UNIX addresses" {
109109}
110110
111111test "resolve DNS" {
112 if (builtin.os.tag == .wasi) return error.SkipZigTest;
113
114112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
113 if (builtin.os.tag == .wasi) return error.SkipZigTest;
115114
116115 if (builtin.os.tag == .windows) {
117116 _ = 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 {
443443}
444444
445445test "CSPRNG" {
446 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
447
448446 var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined;
449447 std.crypto.random.bytes(&secret_seed);
450448 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
409409}
410410
411411test "SegmentedList basic usage" {
412 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
413
414412 try testSegmentedList(0);
415413 try testSegmentedList(1);
416414 try testSegmentedList(2);
lib/std/simd.zig+8-3
......@@ -13,7 +13,7 @@ pub fn suggestVectorSizeForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ?
1313 const vector_bit_size: u16 = blk: {
1414 if (cpu.arch.isX86()) {
1515 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;
1717 if (std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .avx2 }) and !std.Target.x86.featureSetHas(cpu.features, .prefer_128_bit)) break :blk 256;
1818 if (std.Target.x86.featureSetHas(cpu.features, .sse)) break :blk 128;
1919 if (std.Target.x86.featureSetHasAny(cpu.features, .{ .mmx, .@"3dnow" })) break :blk 64;
......@@ -62,10 +62,15 @@ pub fn suggestVectorSize(comptime T: type) ?comptime_int {
6262test "suggestVectorSizeForCpu works with signed and unsigned values" {
6363 comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64);
6464 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 };
6570 const signed_integer_size = suggestVectorSizeForCpu(i32, cpu).?;
6671 const unsigned_integer_size = suggestVectorSizeForCpu(u32, cpu).?;
67 try std.testing.expectEqual(@as(usize, 16), unsigned_integer_size);
68 try std.testing.expectEqual(@as(usize, 16), signed_integer_size);
72 try std.testing.expectEqual(expected_size, unsigned_integer_size);
73 try std.testing.expectEqual(expected_size, signed_integer_size);
6974}
7075
7176fn vectorLength(comptime VectorType: type) comptime_int {
lib/std/sort.zig-11
......@@ -1,6 +1,5 @@
11const std = @import("std.zig");
22const assert = std.debug.assert;
3const builtin = @import("builtin");
43const testing = std.testing;
54const mem = std.mem;
65const math = std.math;
......@@ -177,8 +176,6 @@ const IdAndValue = struct {
177176};
178177
179178test "stable sort" {
180 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
181
182179 const expected = [_]IdAndValue{
183180 IdAndValue{ .id = 0, .value = 0 },
184181 IdAndValue{ .id = 1, .value = 0 },
......@@ -226,8 +223,6 @@ test "stable sort" {
226223}
227224
228225test "sort" {
229 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
230
231226 const u8cases = [_][]const []const u8{
232227 &[_][]const u8{
233228 "",
......@@ -306,8 +301,6 @@ test "sort" {
306301}
307302
308303test "sort descending" {
309 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
310
311304 const rev_cases = [_][]const []const i32{
312305 &[_][]const i32{
313306 &[_]i32{},
......@@ -347,8 +340,6 @@ test "sort descending" {
347340}
348341
349342test "sort with context in the middle of a slice" {
350 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
351
352343 const Context = struct {
353344 items: []i32,
354345
......@@ -388,8 +379,6 @@ test "sort with context in the middle of a slice" {
388379}
389380
390381test "sort fuzz testing" {
391 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
392
393382 var prng = std.rand.DefaultPrng.init(0x12345678);
394383 const random = prng.random();
395384 const test_case_count = 10;
lib/std/unicode.zig-41
......@@ -1,6 +1,5 @@
11const std = @import("./std.zig");
22const assert = std.debug.assert;
3const builtin = @import("builtin");
43const testing = std.testing;
54const mem = std.mem;
65
......@@ -497,15 +496,11 @@ fn testUtf16CountCodepoints() !void {
497496}
498497
499498test "utf16 count codepoints" {
500 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
501
502499 try testUtf16CountCodepoints();
503500 try comptime testUtf16CountCodepoints();
504501}
505502
506503test "utf8 encode" {
507 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
508
509504 try comptime testUtf8Encode();
510505 try testUtf8Encode();
511506}
......@@ -532,8 +527,6 @@ fn testUtf8Encode() !void {
532527}
533528
534529test "utf8 encode error" {
535 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
536
537530 try comptime testUtf8EncodeError();
538531 try testUtf8EncodeError();
539532}
......@@ -550,8 +543,6 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {
550543}
551544
552545test "utf8 iterator on ascii" {
553 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
554
555546 try comptime testUtf8IteratorOnAscii();
556547 try testUtf8IteratorOnAscii();
557548}
......@@ -572,8 +563,6 @@ fn testUtf8IteratorOnAscii() !void {
572563}
573564
574565test "utf8 view bad" {
575 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
576
577566 try comptime testUtf8ViewBad();
578567 try testUtf8ViewBad();
579568}
......@@ -584,8 +573,6 @@ fn testUtf8ViewBad() !void {
584573}
585574
586575test "utf8 view ok" {
587 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
588
589576 try comptime testUtf8ViewOk();
590577 try testUtf8ViewOk();
591578}
......@@ -606,8 +593,6 @@ fn testUtf8ViewOk() !void {
606593}
607594
608595test "validate slice" {
609 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
610
611596 try comptime testValidateSlice();
612597 try testValidateSlice();
613598
......@@ -648,8 +633,6 @@ fn testValidateSlice() !void {
648633}
649634
650635test "valid utf8" {
651 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
652
653636 try comptime testValidUtf8();
654637 try testValidUtf8();
655638}
......@@ -669,8 +652,6 @@ fn testValidUtf8() !void {
669652}
670653
671654test "invalid utf8 continuation bytes" {
672 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
673
674655 try comptime testInvalidUtf8ContinuationBytes();
675656 try testInvalidUtf8ContinuationBytes();
676657}
......@@ -703,8 +684,6 @@ fn testInvalidUtf8ContinuationBytes() !void {
703684}
704685
705686test "overlong utf8 codepoint" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
708687 try comptime testOverlongUtf8Codepoint();
709688 try testOverlongUtf8Codepoint();
710689}
......@@ -718,8 +697,6 @@ fn testOverlongUtf8Codepoint() !void {
718697}
719698
720699test "misc invalid utf8" {
721 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
722
723700 try comptime testMiscInvalidUtf8();
724701 try testMiscInvalidUtf8();
725702}
......@@ -735,8 +712,6 @@ fn testMiscInvalidUtf8() !void {
735712}
736713
737714test "utf8 iterator peeking" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
740715 try comptime testUtf8Peeking();
741716 try testUtf8Peeking();
742717}
......@@ -821,8 +796,6 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize {
821796}
822797
823798test "utf16leToUtf8" {
824 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
825
826799 var utf16le: [2]u16 = undefined;
827800 const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]);
828801
......@@ -935,8 +908,6 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize {
935908}
936909
937910test "utf8ToUtf16Le" {
938 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
939
940911 var utf16le: [2]u16 = [_]u16{0} ** 2;
941912 {
942913 const length = try utf8ToUtf16Le(utf16le[0..], "𐐷");
......@@ -955,8 +926,6 @@ test "utf8ToUtf16Le" {
955926}
956927
957928test "utf8ToUtf16LeWithNull" {
958 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
959
960929 {
961930 const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷");
962931 defer testing.allocator.free(utf16);
......@@ -1015,8 +984,6 @@ fn testCalcUtf16LeLen() !void {
1015984}
1016985
1017986test "calculate utf16 string length of given utf8 string in u16" {
1018 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1019
1020987 try testCalcUtf16LeLen();
1021988 try comptime testCalcUtf16LeLen();
1022989}
......@@ -1050,8 +1017,6 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) {
10501017}
10511018
10521019test "fmtUtf16le" {
1053 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1054
10551020 const expectFmt = std.testing.expectFmt;
10561021 try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))});
10571022 try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))});
......@@ -1065,8 +1030,6 @@ test "fmtUtf16le" {
10651030}
10661031
10671032test "utf8ToUtf16LeStringLiteral" {
1068 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1069
10701033 {
10711034 const bytes = [_:0]u16{
10721035 mem.nativeToLittle(u16, 0x41),
......@@ -1127,8 +1090,6 @@ fn testUtf8CountCodepoints() !void {
11271090}
11281091
11291092test "utf8 count codepoints" {
1130 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1131
11321093 try testUtf8CountCodepoints();
11331094 try comptime testUtf8CountCodepoints();
11341095}
......@@ -1145,8 +1106,6 @@ fn testUtf8ValidCodepoint() !void {
11451106}
11461107
11471108test "utf8 valid codepoint" {
1148 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1149
11501109 try testUtf8ValidCodepoint();
11511110 try comptime testUtf8ValidCodepoint();
11521111}
lib/std/zig/fmt.zig+1-2
......@@ -1,5 +1,4 @@
11const std = @import("std");
2const builtin = @import("builtin");
32const mem = std.mem;
43
54/// 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) {
9695}
9796
9897test "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
101100 const expectFmt = std.testing.expectFmt;
102101 try expectFmt("@\"while\"", "{}", .{fmtId("while")});
lib/std/zig/tokenizer.zig-2
......@@ -1481,8 +1481,6 @@ test "utf8" {
14811481}
14821482
14831483test "invalid utf8" {
1484 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1485
14861484 try testTokenize("//\x80", &.{
14871485 .invalid,
14881486 });
src/arch/x86_64/CodeGen.zig+354-53
......@@ -656,11 +656,14 @@ const InstTracking = struct {
656656 fn reuse(
657657 self: *InstTracking,
658658 function: *Self,
659 new_inst: Air.Inst.Index,
659 new_inst: ?Air.Inst.Index,
660660 old_inst: Air.Inst.Index,
661661 ) void {
662662 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 });
664667 }
665668
666669 fn liveOut(self: *InstTracking, function: *Self, inst: Air.Inst.Index) void {
......@@ -1560,24 +1563,58 @@ fn asmRegisterMemoryImmediate(
15601563 m: Memory,
15611564 imm: Immediate,
15621565) !void {
1563 _ = try self.addInst(.{
1564 .tag = tag[1],
1565 .ops = switch (m) {
1566 .sib => .rmi_sib,
1567 .rip => .rmi_rip,
1566 if (switch (imm) {
1567 .signed => |s| if (math.cast(i16, s)) |x| @as(u16, @bitCast(x)) else null,
1568 .unsigned => |u| math.cast(u16, u),
1569 }) |small_imm| {
1570 _ = try self.addInst(.{
1571 .tag = tag[1],
1572 .ops = switch (m) {
1573 .sib => .rmi_sib,
1574 .rip => .rmi_rip,
1575 else => unreachable,
1576 },
1577 .data = .{ .rix = .{
1578 .fixes = tag[0],
1579 .r1 = reg,
1580 .i = small_imm,
1581 .payload = switch (m) {
1582 .sib => try self.addExtra(Mir.MemorySib.encode(m)),
1583 .rip => try self.addExtra(Mir.MemoryRip.encode(m)),
1584 else => unreachable,
1585 },
1586 } },
1587 });
1588 } else {
1589 const payload = try self.addExtra(Mir.Imm32{ .imm = switch (imm) {
1590 .signed => |s| @bitCast(s),
1591 .unsigned => unreachable,
1592 } });
1593 assert(payload + 1 == switch (m) {
1594 .sib => try self.addExtra(Mir.MemorySib.encode(m)),
1595 .rip => try self.addExtra(Mir.MemoryRip.encode(m)),
15681596 else => unreachable,
1569 },
1570 .data = .{ .rix = .{
1571 .fixes = tag[0],
1572 .r1 = reg,
1573 .i = @as(u8, @intCast(imm.unsigned)),
1574 .payload = switch (m) {
1575 .sib => try self.addExtra(Mir.MemorySib.encode(m)),
1576 .rip => try self.addExtra(Mir.MemoryRip.encode(m)),
1597 });
1598 _ = try self.addInst(.{
1599 .tag = tag[1],
1600 .ops = switch (m) {
1601 .sib => switch (imm) {
1602 .signed => .rmi_sib_s,
1603 .unsigned => .rmi_sib_u,
1604 },
1605 .rip => switch (imm) {
1606 .signed => .rmi_rip_s,
1607 .unsigned => .rmi_rip_u,
1608 },
15771609 else => unreachable,
15781610 },
1579 } },
1580 });
1611 .data = .{ .rx = .{
1612 .fixes = tag[0],
1613 .r1 = reg,
1614 .payload = payload,
1615 } },
1616 });
1617 }
15811618}
15821619
15831620fn asmRegisterRegisterMemoryImmediate(
......@@ -3713,14 +3750,22 @@ fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue
37133750 else => unreachable,
37143751 .mul => {},
37153752 .div => switch (tag[0]) {
3716 ._ => try self.asmRegisterRegister(.{ ._, .xor }, .edx, .edx),
3717 .i_ => switch (self.regBitSize(ty)) {
3718 8 => try self.asmOpOnly(.{ ._, .cbw }),
3719 16 => try self.asmOpOnly(.{ ._, .cwd }),
3720 32 => try self.asmOpOnly(.{ ._, .cdq }),
3721 64 => try self.asmOpOnly(.{ ._, .cqo }),
3722 else => unreachable,
3753 ._ => {
3754 const hi_reg: Register =
3755 switch (self.regBitSize(ty)) {
3756 8 => .ah,
3757 16, 32, 64 => .edx,
3758 else => unreachable,
3759 };
3760 try self.asmRegisterRegister(.{ ._, .xor }, hi_reg, hi_reg);
37233761 },
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 } }),
37243769 else => unreachable,
37253770 },
37263771 }
......@@ -5210,13 +5255,11 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)
52105255 .child = (try mod.intType(.signed, scalar_bits)).ip_index,
52115256 });
52125257
5213 const sign_val = switch (tag) {
5258 const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = switch (tag) {
52145259 .neg => try vec_ty.minInt(mod, vec_ty),
52155260 .abs => try vec_ty.maxInt(mod, vec_ty),
52165261 else => unreachable,
5217 };
5218
5219 const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = sign_val });
5262 } });
52205263 const sign_mem = if (sign_mcv.isMemory())
52215264 sign_mcv.mem(Memory.PtrSize.fromSize(abi_size))
52225265 else
......@@ -5285,7 +5328,6 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)
52855328fn airFloatSign(self: *Self, inst: Air.Inst.Index) !void {
52865329 const un_op = self.air.instructions.items(.data)[inst].un_op;
52875330 const ty = self.typeOf(un_op);
5288
52895331 return self.floatSign(inst, un_op, ty);
52905332}
52915333
......@@ -5782,7 +5824,7 @@ fn reuseOperandAdvanced(
57825824 operand: Air.Inst.Ref,
57835825 op_index: Liveness.OperandInt,
57845826 mcv: MCValue,
5785 tracked_inst: Air.Inst.Index,
5827 maybe_tracked_inst: ?Air.Inst.Index,
57865828) bool {
57875829 if (!self.liveness.operandDies(inst, op_index))
57885830 return false;
......@@ -5791,11 +5833,13 @@ fn reuseOperandAdvanced(
57915833 .register, .register_pair => for (mcv.getRegs()) |reg| {
57925834 // If it's in the registers table, need to associate the register(s) with the
57935835 // new instruction.
5794 if (!self.register_manager.isRegFree(reg)) {
5795 if (RegisterManager.indexOfRegIntoTracked(reg)) |index| {
5796 self.register_manager.registers[index] = tracked_inst;
5836 if (maybe_tracked_inst) |tracked_inst| {
5837 if (!self.register_manager.isRegFree(reg)) {
5838 if (RegisterManager.indexOfRegIntoTracked(reg)) |index| {
5839 self.register_manager.registers[index] = tracked_inst;
5840 }
57975841 }
5798 }
5842 } else self.register_manager.freeReg(reg);
57995843 },
58005844 .load_frame => |frame_addr| if (frame_addr.index.isNamed()) return false,
58015845 else => return false,
......@@ -5804,7 +5848,7 @@ fn reuseOperandAdvanced(
58045848 // Prevent the operand deaths processing code from deallocating it.
58055849 self.liveness.clearOperandDeath(inst, op_index);
58065850 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
58095853 return true;
58105854}
......@@ -7234,12 +7278,18 @@ fn genBinOp(
72347278 if (maybe_mask_reg) |mask_reg| self.register_manager.lockRegAssumeUnused(mask_reg) else null;
72357279 defer if (mask_lock) |lock| self.register_manager.unlockReg(lock);
72367280
7237 const lhs_mcv = try self.resolveInst(lhs_air);
7238 const rhs_mcv = try self.resolveInst(rhs_air);
7281 const ordered_air = if (lhs_ty.isVector(mod) and lhs_ty.childType(mod).isAbiInt(mod) and
7282 switch (air_tag) {
7283 .cmp_lt, .cmp_gte => true,
7284 else => false,
7285 }) .{ .lhs = rhs_air, .rhs = lhs_air } else .{ .lhs = lhs_air, .rhs = rhs_air };
7286
7287 const lhs_mcv = try self.resolveInst(ordered_air.lhs);
7288 const rhs_mcv = try self.resolveInst(ordered_air.rhs);
72397289 switch (lhs_mcv) {
72407290 .immediate => |imm| switch (imm) {
72417291 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),
72437293 else => {},
72447294 },
72457295 else => {},
......@@ -7288,11 +7338,15 @@ fn genBinOp(
72887338 var copied_to_dst = true;
72897339 const dst_mcv: MCValue = dst: {
72907340 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))
72927347 break :dst lhs_mcv;
7293 }
72947348 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))
72967350 {
72977351 flipped = true;
72987352 break :dst rhs_mcv;
......@@ -7657,7 +7711,10 @@ fn genBinOp(
76577711 .sub,
76587712 .sub_wrap,
76597713 => 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" },
76617718 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
76627719 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
76637720 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
......@@ -7688,6 +7745,20 @@ fn genBinOp(
76887745 else
76897746 null,
76907747 },
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 },
76917762 else => null,
76927763 },
76937764 17...32 => switch (air_tag) {
......@@ -7708,6 +7779,17 @@ fn genBinOp(
77087779 .signed => if (self.hasFeature(.avx2)) .{ .vp_b, .maxs } else null,
77097780 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_b, .maxu } else null,
77107781 },
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,
77117793 else => null,
77127794 },
77137795 else => null,
......@@ -7723,7 +7805,10 @@ fn genBinOp(
77237805 .mul,
77247806 .mul_wrap,
77257807 => 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" },
77277812 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
77287813 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
77297814 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
......@@ -7746,6 +7831,20 @@ fn genBinOp(
77467831 else
77477832 .{ .p_w, .maxu },
77487833 },
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 },
77497848 else => null,
77507849 },
77517850 9...16 => switch (air_tag) {
......@@ -7769,6 +7868,17 @@ fn genBinOp(
77697868 .signed => if (self.hasFeature(.avx2)) .{ .vp_w, .maxs } else null,
77707869 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_w, .maxu } else null,
77717870 },
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,
77727882 else => null,
77737883 },
77747884 else => null,
......@@ -7789,7 +7899,10 @@ fn genBinOp(
77897899 .{ .p_d, .mull }
77907900 else
77917901 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" },
77937906 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
77947907 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
77957908 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
......@@ -7820,6 +7933,20 @@ fn genBinOp(
78207933 else
78217934 null,
78227935 },
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 },
78237950 else => null,
78247951 },
78257952 5...8 => switch (air_tag) {
......@@ -7843,6 +7970,17 @@ fn genBinOp(
78437970 .signed => if (self.hasFeature(.avx2)) .{ .vp_d, .maxs } else null,
78447971 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_d, .maxu } else null,
78457972 },
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,
78467984 else => null,
78477985 },
78487986 else => null,
......@@ -7855,9 +7993,33 @@ fn genBinOp(
78557993 .sub,
78567994 .sub_wrap,
78577995 => 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" },
78598000 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
78608001 .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,
78618023 else => null,
78628024 },
78638025 3...4 => switch (air_tag) {
......@@ -7870,6 +8032,17 @@ fn genBinOp(
78708032 .bit_and => if (self.hasFeature(.avx2)) .{ .vp_, .@"and" } else null,
78718033 .bit_or => if (self.hasFeature(.avx2)) .{ .vp_, .@"or" } else null,
78728034 .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 },
78738046 else => null,
78748047 },
78758048 else => null,
......@@ -8435,6 +8608,62 @@ fn genBinOp(
84358608 );
84368609 }
84378610 },
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 },
84388667 else => unreachable,
84398668 }
84408669
......@@ -9741,8 +9970,15 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
97419970}
97429971
97439972fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void {
9744 _ = inst;
9745 return self.fail("TODO implement airCmpVector for {}", .{self.target.cpu.arch});
9973 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
9974 const extra = self.air.extraData(Air.VectorCmp, ty_pl.payload).data;
9975 const dst_mcv = try self.genBinOp(
9976 inst,
9977 Air.Inst.Tag.fromCmpOp(extra.compareOperator(), false),
9978 extra.lhs,
9979 extra.rhs,
9980 );
9981 return self.finishAir(inst, dst_mcv, .{ extra.lhs, extra.rhs, .none });
97469982}
97479983
97489984fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void {
......@@ -12592,7 +12828,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
1259212828 .{ .i_, .mul },
1259312829 len_reg,
1259412830 len_reg,
12595 Immediate.u(elem_abi_size),
12831 Immediate.s(elem_abi_size),
1259612832 );
1259712833 try self.genInlineMemcpy(second_elem_ptr_mcv, ptr, len_mcv);
1259812834
......@@ -12645,8 +12881,23 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void {
1264512881 defer if (src_ptr_lock) |lock| self.register_manager.unlockReg(lock);
1264612882
1264712883 const len: MCValue = switch (dst_ptr_ty.ptrSize(mod)) {
12648 .Slice => dst_ptr.address().offset(8).deref(),
12649 .One => .{ .immediate = dst_ptr_ty.childType(mod).arrayLen(mod) },
12884 .Slice => len: {
12885 const len_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);
12886 const len_lock = self.register_manager.lockRegAssumeUnused(len_reg);
12887 defer self.register_manager.unlockReg(len_lock);
12888
12889 try self.asmRegisterMemoryImmediate(
12890 .{ .i_, .mul },
12891 len_reg,
12892 dst_ptr.address().offset(8).deref().mem(.qword),
12893 Immediate.s(@intCast(dst_ptr_ty.childType(mod).abiSize(mod))),
12894 );
12895 break :len .{ .register = len_reg };
12896 },
12897 .One => len: {
12898 const array_ty = dst_ptr_ty.childType(mod);
12899 break :len .{ .immediate = array_ty.arrayLen(mod) * array_ty.childType(mod).abiSize(mod) };
12900 },
1265012901 .C, .Many => unreachable,
1265112902 };
1265212903 const len_lock: ?RegisterLock = switch (len) {
......@@ -12999,10 +13250,60 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {
1299913250}
1300013251
1300113252fn airReduce(self: *Self, inst: Air.Inst.Index) !void {
13253 const mod = self.bin_file.options.module.?;
1300213254 const reduce = self.air.instructions.items(.data)[inst].reduce;
13003 _ = reduce;
13004 return self.fail("TODO implement airReduce for x86_64", .{});
13005 //return self.finishAir(inst, result, .{ reduce.operand, .none, .none });
13255
13256 const result: MCValue = result: {
13257 const operand_ty = self.typeOf(reduce.operand);
13258 if (operand_ty.isVector(mod) and operand_ty.childType(mod).toIntern() == .bool_type) {
13259 try self.spillEflagsIfOccupied();
13260
13261 const operand_mcv = try self.resolveInst(reduce.operand);
13262 const mask_len = (std.math.cast(u6, operand_ty.vectorLen(mod)) orelse
13263 return self.fail("TODO implement airReduce for {}", .{operand_ty.fmt(mod)}));
13264 const mask = (@as(u64, 1) << mask_len) - 1;
13265 const abi_size: u32 = @intCast(operand_ty.abiSize(mod));
13266 switch (reduce.operation) {
13267 .Or => {
13268 if (operand_mcv.isMemory()) try self.asmMemoryImmediate(
13269 .{ ._, .@"test" },
13270 operand_mcv.mem(Memory.PtrSize.fromSize(abi_size)),
13271 Immediate.u(mask),
13272 ) else {
13273 const operand_reg = registerAlias(if (operand_mcv.isRegister())
13274 operand_mcv.getReg().?
13275 else
13276 try self.copyToTmpRegister(operand_ty, operand_mcv), abi_size);
13277 if (mask_len < abi_size * 8) try self.asmRegisterImmediate(
13278 .{ ._, .@"test" },
13279 operand_reg,
13280 Immediate.u(mask),
13281 ) else try self.asmRegisterRegister(
13282 .{ ._, .@"test" },
13283 operand_reg,
13284 operand_reg,
13285 );
13286 }
13287 break :result .{ .eflags = .nz };
13288 },
13289 .And => {
13290 const tmp_reg = try self.copyToTmpRegister(operand_ty, operand_mcv);
13291 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);
13292 defer self.register_manager.unlockReg(tmp_lock);
13293
13294 try self.asmRegister(.{ ._, .not }, tmp_reg);
13295 if (mask_len < abi_size * 8)
13296 try self.asmRegisterImmediate(.{ ._, .@"test" }, tmp_reg, Immediate.u(mask))
13297 else
13298 try self.asmRegisterRegister(.{ ._, .@"test" }, tmp_reg, tmp_reg);
13299 break :result .{ .eflags = .z };
13300 },
13301 else => return self.fail("TODO implement airReduce for {}", .{operand_ty.fmt(mod)}),
13302 }
13303 }
13304 return self.fail("TODO implement airReduce for {}", .{operand_ty.fmt(mod)});
13305 };
13306 return self.finishAir(inst, result, .{ reduce.operand, .none, .none });
1300613307}
1300713308
1300813309fn 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{
1919
2020pub fn emitMir(emit: *Emit) Error!void {
2121 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);
2323 try emit.code_offset_mapping.putNoClobber(
2424 emit.lower.allocator,
2525 mir_index,
26 @as(u32, @intCast(emit.code.items.len)),
26 @intCast(emit.code.items.len),
2727 );
2828 const lowered = try emit.lower.lowerMir(mir_index);
2929 var lowered_relocs = lowered.relocs;
3030 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);
3232 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);
3434 while (lowered_relocs.len > 0 and
3535 lowered_relocs[0].lowered_inst_index == lowered_index) : ({
3636 lowered_relocs = lowered_relocs[1..];
......@@ -39,7 +39,7 @@ pub fn emitMir(emit: *Emit) Error!void {
3939 .source = start_offset,
4040 .target = target,
4141 .offset = end_offset - 4,
42 .length = @as(u5, @intCast(end_offset - start_offset)),
42 .length = @intCast(end_offset - start_offset),
4343 }),
4444 .linker_extern_fn => |symbol| if (emit.bin_file.cast(link.File.Elf)) |elf_file| {
4545 // Add relocation to the decl.
......@@ -220,7 +220,7 @@ const Reloc = struct {
220220 /// Target of the relocation.
221221 target: Mir.Inst.Index,
222222 /// Offset of the relocation within the instruction.
223 offset: usize,
223 offset: u32,
224224 /// Length of the instruction.
225225 length: u5,
226226};
src/arch/x86_64/Encoding.zig+13-1
......@@ -266,6 +266,8 @@ pub const Mnemonic = enum {
266266 packssdw, packsswb, packuswb,
267267 paddb, paddd, paddq, paddsb, paddsw, paddusb, paddusw, paddw,
268268 pand, pandn, por, pxor,
269 pcmpeqb, pcmpeqd, pcmpeqw,
270 pcmpgtb, pcmpgtd, pcmpgtw,
269271 pmulhw, pmullw,
270272 psubb, psubd, psubq, psubsb, psubsw, psubusb, psubusw, psubw,
271273 // SSE
......@@ -278,11 +280,12 @@ pub const Mnemonic = enum {
278280 maxps, maxss,
279281 minps, minss,
280282 movaps, movhlps, movlhps,
283 movmskps,
281284 movss, movups,
282285 mulps, mulss,
283286 orps,
284287 pextrw, pinsrw,
285 pmaxsw, pmaxub, pminsw, pminub,
288 pmaxsw, pmaxub, pminsw, pminub, pmovmskb,
286289 shufps,
287290 sqrtps, sqrtss,
288291 subps, subss,
......@@ -301,6 +304,7 @@ pub const Mnemonic = enum {
301304 minpd, minsd,
302305 movapd,
303306 movdqa, movdqu,
307 movmskpd,
304308 //movsd,
305309 movupd,
306310 mulpd, mulsd,
......@@ -323,11 +327,14 @@ pub const Mnemonic = enum {
323327 extractps,
324328 insertps,
325329 packusdw,
330 pcmpeqq,
326331 pextrb, pextrd, pextrq,
327332 pinsrb, pinsrd, pinsrq,
328333 pmaxsb, pmaxsd, pmaxud, pmaxuw, pminsb, pminsd, pminud, pminuw,
329334 pmulld,
330335 roundpd, roundps, roundsd, roundss,
336 // SSE4.2
337 pcmpgtq,
331338 // AVX
332339 vaddpd, vaddps, vaddsd, vaddss,
333340 vandnpd, vandnps, vandpd, vandps,
......@@ -348,6 +355,7 @@ pub const Mnemonic = enum {
348355 vmovddup,
349356 vmovdqa, vmovdqu,
350357 vmovhlps, vmovlhps,
358 vmovmskpd, vmovmskps,
351359 vmovq,
352360 vmovsd,
353361 vmovshdup, vmovsldup,
......@@ -359,10 +367,13 @@ pub const Mnemonic = enum {
359367 vpackssdw, vpacksswb, vpackusdw, vpackuswb,
360368 vpaddb, vpaddd, vpaddq, vpaddsb, vpaddsw, vpaddusb, vpaddusw, vpaddw,
361369 vpand, vpandn,
370 vpcmpeqb, vpcmpeqd, vpcmpeqq, vpcmpeqw,
371 vpcmpgtb, vpcmpgtd, vpcmpgtq, vpcmpgtw,
362372 vpextrb, vpextrd, vpextrq, vpextrw,
363373 vpinsrb, vpinsrd, vpinsrq, vpinsrw,
364374 vpmaxsb, vpmaxsd, vpmaxsw, vpmaxub, vpmaxud, vpmaxuw,
365375 vpminsb, vpminsd, vpminsw, vpminub, vpminud, vpminuw,
376 vpmovmskb,
366377 vpmulhw, vpmulld, vpmullw,
367378 vpor,
368379 vpshufhw, vpshuflw,
......@@ -754,6 +765,7 @@ pub const Feature = enum {
754765 sse2,
755766 sse3,
756767 sse4_1,
768 sse4_2,
757769 ssse3,
758770 x87,
759771};
src/arch/x86_64/Lower.zig+39-7
......@@ -190,7 +190,7 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct {
190190 .pseudo_probe_align_ri_s => {
191191 try lower.emit(.none, .@"test", &.{
192192 .{ .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)) },
194194 });
195195 try lower.emit(.none, .jz, &.{
196196 .{ .imm = lower.reloc(.{ .inst = index + 1 }) },
......@@ -226,14 +226,14 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct {
226226 }
227227 try lower.emit(.none, .sub, &.{
228228 .{ .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)) },
230230 });
231231 assert(lower.result_insts_len <= pseudo_probe_adjust_unrolled_max_insts);
232232 },
233233 .pseudo_probe_adjust_setup_rri_s => {
234234 try lower.emit(.none, .mov, &.{
235235 .{ .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)) },
237237 });
238238 try lower.emit(.none, .sub, &.{
239239 .{ .reg = inst.data.rri.r1 },
......@@ -291,7 +291,9 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {
291291 .i_s,
292292 .mi_sib_s,
293293 .mi_rip_s,
294 => Immediate.s(@as(i32, @bitCast(i))),
294 .rmi_sib_s,
295 .rmi_rip_s,
296 => Immediate.s(@bitCast(i)),
295297
296298 .rrri,
297299 .rri_u,
......@@ -301,6 +303,8 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {
301303 .mi_rip_u,
302304 .rmi_sib,
303305 .rmi_rip,
306 .rmi_sib_u,
307 .rmi_rip_u,
304308 .mri_sib,
305309 .mri_rip,
306310 .rrm_sib,
......@@ -319,6 +323,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {
319323 return lower.mir.resolveFrameLoc(switch (ops) {
320324 .rm_sib,
321325 .rmi_sib,
326 .rmi_sib_s,
327 .rmi_sib_u,
322328 .m_sib,
323329 .mi_sib_u,
324330 .mi_sib_s,
......@@ -335,6 +341,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {
335341
336342 .rm_rip,
337343 .rmi_rip,
344 .rmi_rip_s,
345 .rmi_rip_u,
338346 .m_rip,
339347 .mi_rip_u,
340348 .mi_rip_s,
......@@ -383,13 +391,29 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
383391 .rrri => inst.data.rrri.fixes,
384392 .rri_s, .rri_u => inst.data.rri.fixes,
385393 .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,
387404 .mrr_sib, .mrr_rip, .rrm_sib, .rrm_rip => inst.data.rrx.fixes,
388405 .rmi_sib, .rmi_rip, .mri_sib, .mri_rip => inst.data.rix.fixes,
389406 .rrmi_sib, .rrmi_rip => inst.data.rrix.fixes,
390407 .mi_sib_u, .mi_rip_u, .mi_sib_s, .mi_rip_s => inst.data.x.fixes,
391408 .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 => ._,
393417 else => return lower.fail("TODO lower .{s}", .{@tagName(inst.ops)}),
394418 };
395419 try lower.emit(switch (fixes) {
......@@ -461,7 +485,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
461485 .m_sib, .m_rip => &.{
462486 .{ .mem = lower.mem(inst.ops, inst.data.x.payload) },
463487 },
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 => &.{
465489 .{ .mem = lower.mem(inst.ops, inst.data.x.payload + 1) },
466490 .{ .imm = lower.imm(
467491 inst.ops,
......@@ -477,6 +501,14 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
477501 .{ .mem = lower.mem(inst.ops, inst.data.rix.payload) },
478502 .{ .imm = lower.imm(inst.ops, inst.data.rix.i) },
479503 },
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 },
480512 .mr_sib, .mr_rip => &.{
481513 .{ .mem = lower.mem(inst.ops, inst.data.rx.payload) },
482514 .{ .reg = inst.data.rx.r1 },
src/arch/x86_64/Mir.zig+49-29
......@@ -474,6 +474,10 @@ pub const Inst = struct {
474474 /// Bitwise logical and not of packed single-precision floating-point values
475475 /// Bitwise logical and not of packed double-precision floating-point values
476476 andn,
477 /// Compare packed data for equal
478 cmpeq,
479 /// Compare packed data for greater than
480 cmpgt,
477481 /// Maximum of packed signed integers
478482 maxs,
479483 /// Maximum of packed unsigned integers
......@@ -482,6 +486,10 @@ pub const Inst = struct {
482486 mins,
483487 /// Minimum of packed unsigned integers
484488 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,
485493 /// Multiply packed signed integers and store low result
486494 mull,
487495 /// Multiply packed signed integers and store high result
......@@ -720,9 +728,24 @@ pub const Inst = struct {
720728 /// Register, memory (RIP) operands.
721729 /// Uses `rx` payload.
722730 rm_rip,
723 /// Register, memory (SIB), immediate (byte) operands.
731 /// Register, memory (SIB), immediate (word) operands.
724732 /// Uses `rix` payload with extra data of type `MemorySib`.
725733 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,
726749 /// Register, register, memory (RIP).
727750 /// Uses `rrix` payload with extra data of type `MemoryRip`.
728751 rrm_rip,
......@@ -735,27 +758,24 @@ pub const Inst = struct {
735758 /// Register, register, memory (SIB), immediate (byte) operands.
736759 /// Uses `rrix` payload with extra data of type `MemorySib`.
737760 rrmi_sib,
738 /// Register, memory (RIP), immediate (byte) operands.
739 /// Uses `rix` payload with extra data of type `MemoryRip`.
740 rmi_rip,
741761 /// Single memory (SIB) operand.
742762 /// Uses `x` with extra data of type `MemorySib`.
743763 m_sib,
744764 /// Single memory (RIP) operand.
745765 /// Uses `x` with extra data of type `MemoryRip`.
746766 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,
753767 /// Memory (SIB), immediate (sign-extend) operands.
754768 /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`.
755769 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,
756773 /// Memory (RIP), immediate (sign-extend) operands.
757774 /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`.
758775 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,
759779 /// Memory (SIB), register operands.
760780 /// Uses `rx` payload with extra data of type `MemorySib`.
761781 mr_sib,
......@@ -768,10 +788,10 @@ pub const Inst = struct {
768788 /// Memory (RIP), register, register operands.
769789 /// Uses `rrx` payload with extra data of type `MemoryRip`.
770790 mrr_rip,
771 /// Memory (SIB), register, immediate (byte) operands.
791 /// Memory (SIB), register, immediate (word) operands.
772792 /// Uses `rix` payload with extra data of type `MemorySib`.
773793 mri_sib,
774 /// Memory (RIP), register, immediate (byte) operands.
794 /// Memory (RIP), register, immediate (word) operands.
775795 /// Uses `rix` payload with extra data of type `MemoryRip`.
776796 mri_rip,
777797 /// Rax, Memory moffs.
......@@ -955,7 +975,7 @@ pub const Inst = struct {
955975 rix: struct {
956976 fixes: Fixes = ._,
957977 r1: Register,
958 i: u8,
978 i: u16,
959979 payload: u32,
960980 },
961981 /// Register, register, byte immediate, followed by Custom payload found in extra.
......@@ -1010,7 +1030,7 @@ pub const RegisterList = struct {
10101030
10111031 fn getIndexForReg(registers: []const Register, reg: Register) BitSet.MaskInt {
10121032 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);
10141034 }
10151035 unreachable; // register not in input register list!
10161036 }
......@@ -1030,7 +1050,7 @@ pub const RegisterList = struct {
10301050 }
10311051
10321052 pub fn count(self: Self) u32 {
1033 return @as(u32, @intCast(self.bitset.count()));
1053 return @intCast(self.bitset.count());
10341054 }
10351055};
10361056
......@@ -1044,14 +1064,14 @@ pub const Imm64 = struct {
10441064
10451065 pub fn encode(v: u64) Imm64 {
10461066 return .{
1047 .msb = @as(u32, @truncate(v >> 32)),
1048 .lsb = @as(u32, @truncate(v)),
1067 .msb = @truncate(v >> 32),
1068 .lsb = @truncate(v),
10491069 };
10501070 }
10511071
10521072 pub fn decode(imm: Imm64) u64 {
10531073 var res: u64 = 0;
1054 res |= (@as(u64, @intCast(imm.msb)) << 32);
1074 res |= @as(u64, @intCast(imm.msb)) << 32;
10551075 res |= @as(u64, @intCast(imm.lsb));
10561076 return res;
10571077 }
......@@ -1075,7 +1095,7 @@ pub const MemorySib = struct {
10751095 assert(sib.scale_index.scale == 0 or std.math.isPowerOfTwo(sib.scale_index.scale));
10761096 return .{
10771097 .ptr_size = @intFromEnum(sib.ptr_size),
1078 .base_tag = @intFromEnum(@as(Memory.Base.Tag, sib.base)),
1098 .base_tag = @intFromEnum(sib.base),
10791099 .base = switch (sib.base) {
10801100 .none => undefined,
10811101 .reg => |r| @intFromEnum(r),
......@@ -1091,18 +1111,18 @@ pub const MemorySib = struct {
10911111 }
10921112
10931113 pub fn decode(msib: MemorySib) Memory {
1094 const scale = @as(u4, @truncate(msib.scale_index));
1114 const scale: u4 = @truncate(msib.scale_index);
10951115 assert(scale == 0 or std.math.isPowerOfTwo(scale));
10961116 return .{ .sib = .{
1097 .ptr_size = @as(Memory.PtrSize, @enumFromInt(msib.ptr_size)),
1117 .ptr_size = @enumFromInt(msib.ptr_size),
10981118 .base = switch (@as(Memory.Base.Tag, @enumFromInt(msib.base_tag))) {
10991119 .none => .none,
1100 .reg => .{ .reg = @as(Register, @enumFromInt(msib.base)) },
1101 .frame => .{ .frame = @as(bits.FrameIndex, @enumFromInt(msib.base)) },
1120 .reg => .{ .reg = @enumFromInt(msib.base) },
1121 .frame => .{ .frame = @enumFromInt(msib.base) },
11021122 },
11031123 .scale_index = .{
11041124 .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,
11061126 },
11071127 .disp = msib.disp,
11081128 } };
......@@ -1124,7 +1144,7 @@ pub const MemoryRip = struct {
11241144
11251145 pub fn decode(mrip: MemoryRip) Memory {
11261146 return .{ .rip = .{
1127 .ptr_size = @as(Memory.PtrSize, @enumFromInt(mrip.ptr_size)),
1147 .ptr_size = @enumFromInt(mrip.ptr_size),
11281148 .disp = mrip.disp,
11291149 } };
11301150 }
......@@ -1141,14 +1161,14 @@ pub const MemoryMoffs = struct {
11411161 pub fn encode(seg: Register, offset: u64) MemoryMoffs {
11421162 return .{
11431163 .seg = @intFromEnum(seg),
1144 .msb = @as(u32, @truncate(offset >> 32)),
1145 .lsb = @as(u32, @truncate(offset >> 0)),
1164 .msb = @truncate(offset >> 32),
1165 .lsb = @truncate(offset >> 0),
11461166 };
11471167 }
11481168
11491169 pub fn decode(moffs: MemoryMoffs) Memory {
11501170 return .{ .moffs = .{
1151 .seg = @as(Register, @enumFromInt(moffs.seg)),
1171 .seg = @enumFromInt(moffs.seg),
11521172 .offset = @as(u64, moffs.msb) << 32 | @as(u64, moffs.lsb) << 0,
11531173 } };
11541174 }
......@@ -1168,7 +1188,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end:
11681188 inline for (fields) |field| {
11691189 @field(result, field.name) = switch (field.type) {
11701190 u32 => mir.extra[i],
1171 i32 => @as(i32, @bitCast(mir.extra[i])),
1191 i32 => @bitCast(mir.extra[i]),
11721192 else => @compileError("bad field type"),
11731193 };
11741194 i += 1;
src/arch/x86_64/bits.zig+10-10
......@@ -232,7 +232,7 @@ pub const Register = enum(u7) {
232232 else => unreachable,
233233 // zig fmt: on
234234 };
235 return @as(u6, @intCast(@intFromEnum(reg) - base));
235 return @intCast(@intFromEnum(reg) - base);
236236 }
237237
238238 pub fn bitSize(reg: Register) u64 {
......@@ -291,11 +291,11 @@ pub const Register = enum(u7) {
291291 else => unreachable,
292292 // zig fmt: on
293293 };
294 return @as(u4, @truncate(@intFromEnum(reg) - base));
294 return @truncate(@intFromEnum(reg) - base);
295295 }
296296
297297 pub fn lowEnc(reg: Register) u3 {
298 return @as(u3, @truncate(reg.enc()));
298 return @truncate(reg.enc());
299299 }
300300
301301 pub fn toBitSize(reg: Register, bit_size: u64) Register {
......@@ -325,19 +325,19 @@ pub const Register = enum(u7) {
325325 }
326326
327327 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));
329329 }
330330
331331 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));
333333 }
334334
335335 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));
337337 }
338338
339339 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));
341341 }
342342
343343 fn sseBase(reg: Register) u7 {
......@@ -350,11 +350,11 @@ pub const Register = enum(u7) {
350350 }
351351
352352 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));
354354 }
355355
356356 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));
358358 }
359359
360360 /// DWARF register encoding
......@@ -619,7 +619,7 @@ pub const Immediate = union(enum) {
619619 1, 8 => @as(i8, @bitCast(@as(u8, @intCast(x)))),
620620 16 => @as(i16, @bitCast(@as(u16, @intCast(x)))),
621621 32 => @as(i32, @bitCast(@as(u32, @intCast(x)))),
622 64 => @as(i64, @bitCast(x)),
622 64 => @bitCast(x),
623623 else => unreachable,
624624 },
625625 };
src/arch/x86_64/encodings.zig+80-18
......@@ -905,6 +905,9 @@ pub const table = [_]Entry{
905905
906906 .{ .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
908911 .{ .movss, .rm, &.{ .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x10 }, 0, .none, .sse },
909912 .{ .movss, .mr, &.{ .xmm_m32, .xmm }, &.{ 0xf3, 0x0f, 0x11 }, 0, .none, .sse },
910913
......@@ -917,6 +920,9 @@ pub const table = [_]Entry{
917920
918921 .{ .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
920926 .{ .shufps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x0f, 0xc6 }, 0, .none, .sse },
921927
922928 .{ .sqrtps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x51 }, 0, .none, .sse },
......@@ -1005,6 +1011,12 @@ pub const table = [_]Entry{
10051011 .{ .movdqu, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0xf3, 0x0f, 0x6f }, 0, .none, .sse2 },
10061012 .{ .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
10081020 .{ .movq, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf3, 0x0f, 0x7e }, 0, .none, .sse2 },
10091021 .{ .movq, .mr, &.{ .xmm_m64, .xmm }, &.{ 0x66, 0x0f, 0xd6 }, 0, .none, .sse2 },
10101022
......@@ -1037,6 +1049,14 @@ pub const table = [_]Entry{
10371049
10381050 .{ .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
10401060 .{ .pextrw, .rmi, &.{ .r32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0xc5 }, 0, .none, .sse2 },
10411061
10421062 .{ .pinsrw, .rmi, &.{ .xmm, .r32_m16, .imm8 }, &.{ 0x66, 0x0f, 0xc4 }, 0, .none, .sse2 },
......@@ -1100,9 +1120,6 @@ pub const table = [_]Entry{
11001120
11011121 .{ .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
11061123 .{ .ucomisd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0x66, 0x0f, 0x2e }, 0, .none, .sse2 },
11071124
11081125 .{ .xorpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x57 }, 0, .none, .sse2 },
......@@ -1137,6 +1154,8 @@ pub const table = [_]Entry{
11371154
11381155 .{ .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
11401159 .{ .pextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .none, .sse4_1 },
11411160 .{ .pextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .none, .sse4_1 },
11421161 .{ .pextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .long, .sse4_1 },
......@@ -1171,6 +1190,9 @@ pub const table = [_]Entry{
11711190
11721191 .{ .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
11741196 // AVX
11751197 .{ .vaddpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_128_wig, .avx },
11761198 .{ .vaddpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_256_wig, .avx },
......@@ -1295,6 +1317,16 @@ pub const table = [_]Entry{
12951317
12961318 .{ .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
12981330 .{ .vminpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_128_wig, .avx },
12991331 .{ .vminpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_256_wig, .avx },
13001332
......@@ -1408,6 +1440,18 @@ pub const table = [_]Entry{
14081440
14091441 .{ .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
14111455 .{ .vpextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .vex_128_w0, .avx },
14121456 .{ .vpextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w0, .avx },
14131457 .{ .vpextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w1, .avx },
......@@ -1439,6 +1483,9 @@ pub const table = [_]Entry{
14391483
14401484 .{ .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
14421489 .{ .vpmulhw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_128_wig, .avx },
14431490
14441491 .{ .vpmulld, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .vex_128_wig, .avx },
......@@ -1581,29 +1628,44 @@ pub const table = [_]Entry{
15811628
15821629 .{ .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 },
1585 .{ .vpmaxsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xee }, 0, .vex_256_wig, .avx },
1586 .{ .vpmaxsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3d }, 0, .vex_256_wig, .avx },
1631 .{ .vpcmpeqb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x74 }, 0, .vex_256_wig, .avx2 },
1632 .{ .vpcmpeqw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x75 }, 0, .vex_256_wig, .avx2 },
1633 .{ .vpcmpeqd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x76 }, 0, .vex_256_wig, .avx2 },
1634
1635 .{ .vpcmpeqq, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x29 }, 0, .vex_256_wig, .avx2 },
1636
1637 .{ .vpcmpgtb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x64 }, 0, .vex_256_wig, .avx2 },
1638 .{ .vpcmpgtw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x65 }, 0, .vex_256_wig, .avx2 },
1639 .{ .vpcmpgtd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x66 }, 0, .vex_256_wig, .avx2 },
1640
1641 .{ .vpcmpgtq, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x37 }, 0, .vex_256_wig, .avx2 },
1642
1643 .{ .vpmaxsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3c }, 0, .vex_256_wig, .avx2 },
1644 .{ .vpmaxsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xee }, 0, .vex_256_wig, .avx2 },
1645 .{ .vpmaxsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3d }, 0, .vex_256_wig, .avx2 },
1646
1647 .{ .vpmaxub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xde }, 0, .vex_256_wig, .avx2 },
1648 .{ .vpmaxuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3e }, 0, .vex_256_wig, .avx2 },
15871649
1588 .{ .vpmaxub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xde }, 0, .vex_256_wig, .avx },
1589 .{ .vpmaxuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3e }, 0, .vex_256_wig, .avx },
1650 .{ .vpmaxud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3f }, 0, .vex_256_wig, .avx2 },
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 },
1594 .{ .vpminsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xea }, 0, .vex_256_wig, .avx },
1595 .{ .vpminsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x39 }, 0, .vex_256_wig, .avx },
1656 .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx2 },
1657 .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx2 },
15961658
1597 .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx },
1598 .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx },
1659 .{ .vpminud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_256_wig, .avx2 },
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
16081670 .{ .vpor, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_256_wig, .avx2 },
16091671