authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-24 05:34:13-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-10-24 05:34:13-04:00
logbb0419599aa93455f3ae0969f4bfd80204807596
treeedce35a16131dbe5ce31a62cbbf7ac8f2dfca0bc
parentb477279c37d1ca1c141a3e30589bd974687b85cc
parentf7482a5c95dd549eb3da103eab42bac881ba0498
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #17666 from jacobly0/x86_64-unicode

x86_64: pass more std tests

87 files changed, 1310 insertions(+), 1135 deletions(-)

lib/compiler_rt/addf3_test.zig-3
...@@ -76,9 +76,6 @@ fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {...@@ -76,9 +76,6 @@ fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
76}76}
7777
78test "subtf3" {78test "subtf3" {
79 if (builtin.zig_backend == .stage2_x86_64 and
80 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
81
82 // qNaN - any = qNaN79 // qNaN - any = qNaN
83 try test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);80 try test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
8481
lib/compiler_rt/divtf3_test.zig-4
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const math = std.math;2const math = std.math;
4const testing = std.testing;3const testing = std.testing;
54
...@@ -31,9 +30,6 @@ fn test__divtf3(a: f128, b: f128, expectedHi: u64, expectedLo: u64) !void {...@@ -31,9 +30,6 @@ fn test__divtf3(a: f128, b: f128, expectedHi: u64, expectedLo: u64) !void {
31}30}
3231
33test "divtf3" {32test "divtf3" {
34 if (builtin.zig_backend == .stage2_x86_64 and
35 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
36
37 // NaN / any = NaN33 // NaN / any = NaN
38 try test__divtf3(math.nan(f128), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0);34 try test__divtf3(math.nan(f128), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0);
39 // inf / any(except inf and nan) = inf35 // inf / any(except inf and nan) = inf
lib/compiler_rt/float_from_int_test.zig-22
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const testing = std.testing;2const testing = std.testing;
4const math = std.math;3const math = std.math;
54
...@@ -126,9 +125,6 @@ fn test__floatuntisf(a: u128, expected: f32) !void {...@@ -126,9 +125,6 @@ fn test__floatuntisf(a: u128, expected: f32) !void {
126}125}
127126
128test "floattisf" {127test "floattisf" {
129 if (builtin.zig_backend == .stage2_x86_64 and
130 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
131
132 try test__floattisf(0, 0.0);128 try test__floattisf(0, 0.0);
133129
134 try test__floattisf(1, 1.0);130 try test__floattisf(1, 1.0);
...@@ -175,9 +171,6 @@ test "floattisf" {...@@ -175,9 +171,6 @@ test "floattisf" {
175}171}
176172
177test "floatuntisf" {173test "floatuntisf" {
178 if (builtin.zig_backend == .stage2_x86_64 and
179 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
180
181 try test__floatuntisf(0, 0.0);174 try test__floatuntisf(0, 0.0);
182175
183 try test__floatuntisf(1, 1.0);176 try test__floatuntisf(1, 1.0);
...@@ -374,9 +367,6 @@ fn test__floatuntidf(a: u128, expected: f64) !void {...@@ -374,9 +367,6 @@ fn test__floatuntidf(a: u128, expected: f64) !void {
374}367}
375368
376test "floattidf" {369test "floattidf" {
377 if (builtin.zig_backend == .stage2_x86_64 and
378 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
379
380 try test__floattidf(0, 0.0);370 try test__floattidf(0, 0.0);
381371
382 try test__floattidf(1, 1.0);372 try test__floattidf(1, 1.0);
...@@ -447,9 +437,6 @@ test "floattidf" {...@@ -447,9 +437,6 @@ test "floattidf" {
447}437}
448438
449test "floatuntidf" {439test "floatuntidf" {
450 if (builtin.zig_backend == .stage2_x86_64 and
451 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
452
453 try test__floatuntidf(0, 0.0);440 try test__floatuntidf(0, 0.0);
454441
455 try test__floatuntidf(1, 1.0);442 try test__floatuntidf(1, 1.0);
...@@ -595,9 +582,6 @@ test "floatditf" {...@@ -595,9 +582,6 @@ test "floatditf" {
595}582}
596583
597test "floatunditf" {584test "floatunditf" {
598 if (builtin.zig_backend == .stage2_x86_64 and
599 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
600
601 try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000);585 try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000);
602 try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000);586 try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000);
603 try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0);587 try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0);
...@@ -619,9 +603,6 @@ fn test__floatuntitf(a: u128, expected: f128) !void {...@@ -619,9 +603,6 @@ fn test__floatuntitf(a: u128, expected: f128) !void {
619}603}
620604
621test "floattitf" {605test "floattitf" {
622 if (builtin.zig_backend == .stage2_x86_64 and
623 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
624
625 try test__floattitf(0, 0.0);606 try test__floattitf(0, 0.0);
626607
627 try test__floattitf(1, 1.0);608 try test__floattitf(1, 1.0);
...@@ -704,9 +685,6 @@ test "floattitf" {...@@ -704,9 +685,6 @@ test "floattitf" {
704}685}
705686
706test "floatuntitf" {687test "floatuntitf" {
707 if (builtin.zig_backend == .stage2_x86_64 and
708 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
709
710 try test__floatuntitf(0, 0.0);688 try test__floatuntitf(0, 0.0);
711689
712 try test__floatuntitf(1, 1.0);690 try test__floatuntitf(1, 1.0);
lib/compiler_rt/fma.zig-5
...@@ -6,10 +6,8 @@...@@ -6,10 +6,8 @@
6//! https://git.musl-libc.org/cgit/musl/tree/src/math/fma.c6//! https://git.musl-libc.org/cgit/musl/tree/src/math/fma.c
77
8const std = @import("std");8const std = @import("std");
9const builtin = @import("builtin");
10const math = std.math;9const math = std.math;
11const expect = std.testing.expect;10const expect = std.testing.expect;
12const arch = builtin.cpu.arch;
13const common = @import("common.zig");11const common = @import("common.zig");
1412
15pub const panic = common.panic;13pub const panic = common.panic;
...@@ -343,9 +341,6 @@ test "64" {...@@ -343,9 +341,6 @@ test "64" {
343}341}
344342
345test "128" {343test "128" {
346 if (builtin.zig_backend == .stage2_x86_64 and
347 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
348
349 const epsilon = 0.000001;344 const epsilon = 0.000001;
350345
351 try expect(math.approxEqAbs(f128, fmaq(0.0, 5.0, 9.124), 9.124, epsilon));346 try expect(math.approxEqAbs(f128, fmaq(0.0, 5.0, 9.124), 9.124, epsilon));
lib/compiler_rt/fmodx_test.zig+1-1
...@@ -24,7 +24,7 @@ fn test_fmodx_infs() !void {...@@ -24,7 +24,7 @@ fn test_fmodx_infs() !void {
2424
25test "fmodx" {25test "fmodx" {
26 if (builtin.zig_backend == .stage2_x86_64 and26 if (builtin.zig_backend == .stage2_x86_64 and
27 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;27 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .lzcnt)) return error.SkipZigTest;
2828
29 try test_fmodx(6.4, 4.0, 2.4);29 try test_fmodx(6.4, 4.0, 2.4);
30 try test_fmodx(6.4, -4.0, 2.4);30 try test_fmodx(6.4, -4.0, 2.4);
lib/compiler_rt/mulf3_test.zig-4
...@@ -3,7 +3,6 @@...@@ -3,7 +3,6 @@
3// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/test/builtins/Unit/multf3_test.c3// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/test/builtins/Unit/multf3_test.c
44
5const std = @import("std");5const std = @import("std");
6const builtin = @import("builtin");
7const math = std.math;6const math = std.math;
8const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);7const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);
9const inf128: f128 = @bitCast(@as(u128, 0x7fff000000000000) << 64);8const inf128: f128 = @bitCast(@as(u128, 0x7fff000000000000) << 64);
...@@ -49,9 +48,6 @@ fn makeNaN128(rand: u64) f128 {...@@ -49,9 +48,6 @@ fn makeNaN128(rand: u64) f128 {
49 return @bitCast(int_result);48 return @bitCast(int_result);
50}49}
51test "multf3" {50test "multf3" {
52 if (builtin.zig_backend == .stage2_x86_64 and
53 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
54
55 // qNaN * any = qNaN51 // qNaN * any = qNaN
56 try test__multf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);52 try test__multf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
5753
lib/compiler_rt/udivmodei4.zig+2-4
...@@ -129,10 +129,8 @@ pub fn __umodei4(r_p: [*]u32, u_p: [*]const u32, v_p: [*]const u32, bits: usize)...@@ -129,10 +129,8 @@ pub fn __umodei4(r_p: [*]u32, u_p: [*]const u32, v_p: [*]const u32, bits: usize)
129}129}
130130
131test "__udivei4/__umodei4" {131test "__udivei4/__umodei4" {
132 switch (builtin.zig_backend) {132 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
133 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,133 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
134 else => {},
135 }
136134
137 const RndGen = std.rand.DefaultPrng;135 const RndGen = std.rand.DefaultPrng;
138 var rnd = RndGen.init(42);136 var rnd = RndGen.init(42);
lib/std/Build.zig+1
...@@ -2156,5 +2156,6 @@ pub fn hex64(x: u64) [16]u8 {...@@ -2156,5 +2156,6 @@ pub fn hex64(x: u64) [16]u8 {
2156}2156}
21572157
2158test {2158test {
2159 _ = Cache;
2159 _ = Step;2160 _ = Step;
2160}2161}
lib/std/Build/Cache.zig-8
...@@ -1007,8 +1007,6 @@ test "cache file and then recall it" {...@@ -1007,8 +1007,6 @@ test "cache file and then recall it" {
1007 return error.SkipZigTest;1007 return error.SkipZigTest;
1008 }1008 }
10091009
1010 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1011
1012 var tmp = testing.tmpDir(.{});1010 var tmp = testing.tmpDir(.{});
1013 defer tmp.cleanup();1011 defer tmp.cleanup();
10141012
...@@ -1075,8 +1073,6 @@ test "check that changing a file makes cache fail" {...@@ -1075,8 +1073,6 @@ test "check that changing a file makes cache fail" {
1075 return error.SkipZigTest;1073 return error.SkipZigTest;
1076 }1074 }
10771075
1078 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1079
1080 var tmp = testing.tmpDir(.{});1076 var tmp = testing.tmpDir(.{});
1081 defer tmp.cleanup();1077 defer tmp.cleanup();
10821078
...@@ -1151,8 +1147,6 @@ test "no file inputs" {...@@ -1151,8 +1147,6 @@ test "no file inputs" {
1151 return error.SkipZigTest;1147 return error.SkipZigTest;
1152 }1148 }
11531149
1154 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1155
1156 var tmp = testing.tmpDir(.{});1150 var tmp = testing.tmpDir(.{});
1157 defer tmp.cleanup();1151 defer tmp.cleanup();
11581152
...@@ -1201,8 +1195,6 @@ test "Manifest with files added after initial hash work" {...@@ -1201,8 +1195,6 @@ test "Manifest with files added after initial hash work" {
1201 return error.SkipZigTest;1195 return error.SkipZigTest;
1202 }1196 }
12031197
1204 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1205
1206 var tmp = testing.tmpDir(.{});1198 var tmp = testing.tmpDir(.{});
1207 defer tmp.cleanup();1199 defer tmp.cleanup();
12081200
lib/std/Thread/Condition.zig+2-2
...@@ -324,6 +324,8 @@ test "Condition - wait and signal" {...@@ -324,6 +324,8 @@ test "Condition - wait and signal" {
324 return error.SkipZigTest;324 return error.SkipZigTest;
325 }325 }
326326
327 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
328
327 const num_threads = 4;329 const num_threads = 4;
328330
329 const MultiWait = struct {331 const MultiWait = struct {
...@@ -369,8 +371,6 @@ test "Condition - signal" {...@@ -369,8 +371,6 @@ test "Condition - signal" {
369 return error.SkipZigTest;371 return error.SkipZigTest;
370 }372 }
371373
372 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
373
374 const num_threads = 4;374 const num_threads = 4;
375375
376 const SignalTest = struct {376 const SignalTest = struct {
lib/std/Thread/Semaphore.zig+2
...@@ -39,6 +39,8 @@ test "Thread.Semaphore" {...@@ -39,6 +39,8 @@ test "Thread.Semaphore" {
39 return error.SkipZigTest;39 return error.SkipZigTest;
40 }40 }
4141
42 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
43
42 const TestContext = struct {44 const TestContext = struct {
43 sem: *Semaphore,45 sem: *Semaphore,
44 n: *i32,46 n: *i32,
lib/std/array_hash_map.zig+1-14
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const builtin = @import("builtin");
3const debug = std.debug;2const debug = std.debug;
4const assert = debug.assert;3const assert = debug.assert;
5const testing = std.testing;4const testing = std.testing;
...@@ -2138,8 +2137,6 @@ test "ensure capacity leak" {...@@ -2138,8 +2137,6 @@ test "ensure capacity leak" {
2138}2137}
21392138
2140test "big map" {2139test "big map" {
2141 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2142
2143 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2140 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2144 defer map.deinit();2141 defer map.deinit();
21452142
...@@ -2193,8 +2190,6 @@ test "big map" {...@@ -2193,8 +2190,6 @@ test "big map" {
2193}2190}
21942191
2195test "clone" {2192test "clone" {
2196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2197
2198 var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2193 var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2199 defer original.deinit();2194 defer original.deinit();
22002195
...@@ -2221,8 +2216,6 @@ test "clone" {...@@ -2221,8 +2216,6 @@ test "clone" {
2221}2216}
22222217
2223test "shrink" {2218test "shrink" {
2224 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2225
2226 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2219 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2227 defer map.deinit();2220 defer map.deinit();
22282221
...@@ -2263,8 +2256,6 @@ test "shrink" {...@@ -2263,8 +2256,6 @@ test "shrink" {
2263}2256}
22642257
2265test "pop" {2258test "pop" {
2266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2267
2268 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2259 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2269 defer map.deinit();2260 defer map.deinit();
22702261
...@@ -2283,8 +2274,6 @@ test "pop" {...@@ -2283,8 +2274,6 @@ test "pop" {
2283}2274}
22842275
2285test "popOrNull" {2276test "popOrNull" {
2286 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2287
2288 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2277 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2289 defer map.deinit();2278 defer map.deinit();
22902279
...@@ -2305,7 +2294,7 @@ test "popOrNull" {...@@ -2305,7 +2294,7 @@ test "popOrNull" {
2305}2294}
23062295
2307test "reIndex" {2296test "reIndex" {
2308 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;2297 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
23092298
2310 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);2299 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
2311 defer map.deinit();2300 defer map.deinit();
...@@ -2351,8 +2340,6 @@ test "auto store_hash" {...@@ -2351,8 +2340,6 @@ test "auto store_hash" {
2351}2340}
23522341
2353test "sort" {2342test "sort" {
2354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2355
2356 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2343 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2357 defer map.deinit();2344 defer map.deinit();
23582345
lib/std/array_list.zig-11
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const builtin = @import("builtin");
3const debug = std.debug;2const debug = std.debug;
4const assert = debug.assert;3const assert = debug.assert;
5const testing = std.testing;4const testing = std.testing;
...@@ -1184,8 +1183,6 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {...@@ -1184,8 +1183,6 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {
1184}1183}
11851184
1186test "std.ArrayList/ArrayListUnmanaged.clone" {1185test "std.ArrayList/ArrayListUnmanaged.clone" {
1187 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1188
1189 const a = testing.allocator;1186 const a = testing.allocator;
1190 {1187 {
1191 var array = ArrayList(i32).init(a);1188 var array = ArrayList(i32).init(a);
...@@ -1227,8 +1224,6 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {...@@ -1227,8 +1224,6 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {
1227}1224}
12281225
1229test "std.ArrayList/ArrayListUnmanaged.basic" {1226test "std.ArrayList/ArrayListUnmanaged.basic" {
1230 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1231
1232 const a = testing.allocator;1227 const a = testing.allocator;
1233 {1228 {
1234 var list = ArrayList(i32).init(a);1229 var list = ArrayList(i32).init(a);
...@@ -1513,8 +1508,6 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {...@@ -1513,8 +1508,6 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {
1513}1508}
15141509
1515test "std.ArrayList/ArrayListUnmanaged.insertSlice" {1510test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
1516 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1517
1518 const a = testing.allocator;1511 const a = testing.allocator;
1519 {1512 {
1520 var list = ArrayList(i32).init(a);1513 var list = ArrayList(i32).init(a);
...@@ -1561,8 +1554,6 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {...@@ -1561,8 +1554,6 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
1561}1554}
15621555
1563test "std.ArrayList/ArrayListUnmanaged.replaceRange" {1556test "std.ArrayList/ArrayListUnmanaged.replaceRange" {
1564 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1565
1566 var arena = std.heap.ArenaAllocator.init(testing.allocator);1557 var arena = std.heap.ArenaAllocator.init(testing.allocator);
1567 defer arena.deinit();1558 defer arena.deinit();
1568 const a = arena.allocator();1559 const a = arena.allocator();
...@@ -1734,8 +1725,6 @@ test "shrink still sets length when resizing is disabled" {...@@ -1734,8 +1725,6 @@ test "shrink still sets length when resizing is disabled" {
1734}1725}
17351726
1736test "shrinkAndFree with a copy" {1727test "shrinkAndFree with a copy" {
1737 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1738
1739 var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });1728 var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });
1740 const a = failing_allocator.allocator();1729 const a = failing_allocator.allocator();
17411730
lib/std/base64.zig-2
...@@ -363,8 +363,6 @@ test "base64" {...@@ -363,8 +363,6 @@ test "base64" {
363}363}
364364
365test "base64 padding dest overflow" {365test "base64 padding dest overflow" {
366 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
367
368 const input = "foo";366 const input = "foo";
369367
370 var expect: [128]u8 = undefined;368 var expect: [128]u8 = undefined;
lib/std/bit_set.zig+3-12
...@@ -1637,10 +1637,8 @@ fn testStaticBitSet(comptime Set: type) !void {...@@ -1637,10 +1637,8 @@ fn testStaticBitSet(comptime Set: type) !void {
1637}1637}
16381638
1639test "IntegerBitSet" {1639test "IntegerBitSet" {
1640 switch (builtin.zig_backend) {1640 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1641 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,1641 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1642 else => {},
1643 }
16441642
1645 try testStaticBitSet(IntegerBitSet(0));1643 try testStaticBitSet(IntegerBitSet(0));
1646 try testStaticBitSet(IntegerBitSet(1));1644 try testStaticBitSet(IntegerBitSet(1));
...@@ -1653,10 +1651,7 @@ test "IntegerBitSet" {...@@ -1653,10 +1651,7 @@ test "IntegerBitSet" {
1653}1651}
16541652
1655test "ArrayBitSet" {1653test "ArrayBitSet" {
1656 switch (builtin.zig_backend) {1654 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1657 .stage2_x86_64 => return error.SkipZigTest,
1658 else => {},
1659 }
16601655
1661 inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {1656 inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {
1662 try testStaticBitSet(ArrayBitSet(u8, size));1657 try testStaticBitSet(ArrayBitSet(u8, size));
...@@ -1668,8 +1663,6 @@ test "ArrayBitSet" {...@@ -1668,8 +1663,6 @@ test "ArrayBitSet" {
1668}1663}
16691664
1670test "DynamicBitSetUnmanaged" {1665test "DynamicBitSetUnmanaged" {
1671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1672
1673 const allocator = std.testing.allocator;1666 const allocator = std.testing.allocator;
1674 var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);1667 var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);
1675 try testing.expectEqual(@as(usize, 0), a.count());1668 try testing.expectEqual(@as(usize, 0), a.count());
...@@ -1723,8 +1716,6 @@ test "DynamicBitSetUnmanaged" {...@@ -1723,8 +1716,6 @@ test "DynamicBitSetUnmanaged" {
1723}1716}
17241717
1725test "DynamicBitSet" {1718test "DynamicBitSet" {
1726 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1727
1728 const allocator = std.testing.allocator;1719 const allocator = std.testing.allocator;
1729 var a = try DynamicBitSet.initEmpty(allocator, 300);1720 var a = try DynamicBitSet.initEmpty(allocator, 300);
1730 try testing.expectEqual(@as(usize, 0), a.count());1721 try testing.expectEqual(@as(usize, 0), a.count());
lib/std/compress/deflate/huffman_code.zig-2
...@@ -360,8 +360,6 @@ fn byFreq(context: void, a: LiteralNode, b: LiteralNode) bool {...@@ -360,8 +360,6 @@ fn byFreq(context: void, a: LiteralNode, b: LiteralNode) bool {
360}360}
361361
362test "generate a Huffman code from an array of frequencies" {362test "generate a Huffman code from an array of frequencies" {
363 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
364
365 var freqs: [19]u16 = [_]u16{363 var freqs: [19]u16 = [_]u16{
366 8, // 0364 8, // 0
367 1, // 1365 1, // 1
lib/std/compress/gzip.zig-2
...@@ -174,8 +174,6 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {...@@ -174,8 +174,6 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
174// https://tools.ietf.org/rfc/rfc1952.txt length=25037 bytes174// https://tools.ietf.org/rfc/rfc1952.txt length=25037 bytes
175// SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67175// SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67
176test "compressed data" {176test "compressed data" {
177 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
178
179 try testReader(177 try testReader(
180 @embedFile("testdata/rfc1952.txt.gz"),178 @embedFile("testdata/rfc1952.txt.gz"),
181 @embedFile("testdata/rfc1952.txt"),179 @embedFile("testdata/rfc1952.txt"),
lib/std/compress/zlib.zig-2
...@@ -199,8 +199,6 @@ fn testDecompress(data: []const u8, expected: []const u8) !void {...@@ -199,8 +199,6 @@ fn testDecompress(data: []const u8, expected: []const u8) !void {
199// https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes199// https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes
200// SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009200// SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009
201test "compressed data" {201test "compressed data" {
202 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
203
204 const rfc1951_txt = @embedFile("testdata/rfc1951.txt");202 const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
205203
206 // Compressed with compression level = 0204 // Compressed with compression level = 0
lib/std/crypto.zig-2
...@@ -314,8 +314,6 @@ test "CSPRNG" {...@@ -314,8 +314,6 @@ test "CSPRNG" {
314}314}
315315
316test "issue #4532: no index out of bounds" {316test "issue #4532: no index out of bounds" {
317 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
318
319 const types = [_]type{317 const types = [_]type{
320 hash.Md5,318 hash.Md5,
321 hash.Sha1,319 hash.Sha1,
lib/std/crypto/25519/x25519.zig-4
...@@ -137,8 +137,6 @@ test "x25519 rfc7748 one iteration" {...@@ -137,8 +137,6 @@ test "x25519 rfc7748 one iteration" {
137}137}
138138
139test "x25519 rfc7748 1,000 iterations" {139test "x25519 rfc7748 1,000 iterations" {
140 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
141
142 // These iteration tests are slow so we always skip them. Results have been verified.140 // These iteration tests are slow so we always skip them. Results have been verified.
143 if (true) {141 if (true) {
144 return error.SkipZigTest;142 return error.SkipZigTest;
...@@ -161,8 +159,6 @@ test "x25519 rfc7748 1,000 iterations" {...@@ -161,8 +159,6 @@ test "x25519 rfc7748 1,000 iterations" {
161}159}
162160
163test "x25519 rfc7748 1,000,000 iterations" {161test "x25519 rfc7748 1,000,000 iterations" {
164 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
165
166 if (true) {162 if (true) {
167 return error.SkipZigTest;163 return error.SkipZigTest;
168 }164 }
lib/std/crypto/aegis.zig-15
...@@ -17,7 +17,6 @@...@@ -17,7 +17,6 @@
17//! https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/17//! https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/
1818
19const std = @import("std");19const std = @import("std");
20const builtin = @import("builtin");
21const crypto = std.crypto;20const crypto = std.crypto;
22const mem = std.mem;21const mem = std.mem;
23const assert = std.debug.assert;22const assert = std.debug.assert;
...@@ -514,8 +513,6 @@ const htest = @import("test.zig");...@@ -514,8 +513,6 @@ const htest = @import("test.zig");
514const testing = std.testing;513const testing = std.testing;
515514
516test "Aegis128L test vector 1" {515test "Aegis128L test vector 1" {
517 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
518
519 const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 14;516 const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 14;
520 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 13;517 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 13;
521 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };518 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
...@@ -539,8 +536,6 @@ test "Aegis128L test vector 1" {...@@ -539,8 +536,6 @@ test "Aegis128L test vector 1" {
539}536}
540537
541test "Aegis128L test vector 2" {538test "Aegis128L test vector 2" {
542 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
543
544 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;539 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
545 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;540 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
546 const ad = [_]u8{};541 const ad = [_]u8{};
...@@ -558,8 +553,6 @@ test "Aegis128L test vector 2" {...@@ -558,8 +553,6 @@ test "Aegis128L test vector 2" {
558}553}
559554
560test "Aegis128L test vector 3" {555test "Aegis128L test vector 3" {
561 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
562
563 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;556 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
564 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;557 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
565 const ad = [_]u8{};558 const ad = [_]u8{};
...@@ -576,8 +569,6 @@ test "Aegis128L test vector 3" {...@@ -576,8 +569,6 @@ test "Aegis128L test vector 3" {
576}569}
577570
578test "Aegis256 test vector 1" {571test "Aegis256 test vector 1" {
579 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
580
581 const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 30;572 const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 30;
582 const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 29;573 const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 29;
583 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };574 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
...@@ -601,8 +592,6 @@ test "Aegis256 test vector 1" {...@@ -601,8 +592,6 @@ test "Aegis256 test vector 1" {
601}592}
602593
603test "Aegis256 test vector 2" {594test "Aegis256 test vector 2" {
604 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
605
606 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;595 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
607 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;596 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
608 const ad = [_]u8{};597 const ad = [_]u8{};
...@@ -620,8 +609,6 @@ test "Aegis256 test vector 2" {...@@ -620,8 +609,6 @@ test "Aegis256 test vector 2" {
620}609}
621610
622test "Aegis256 test vector 3" {611test "Aegis256 test vector 3" {
623 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
624
625 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;612 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
626 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;613 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
627 const ad = [_]u8{};614 const ad = [_]u8{};
...@@ -638,8 +625,6 @@ test "Aegis256 test vector 3" {...@@ -638,8 +625,6 @@ test "Aegis256 test vector 3" {
638}625}
639626
640test "Aegis MAC" {627test "Aegis MAC" {
641 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
642
643 const key = [_]u8{0x00} ** Aegis128LMac.key_length;628 const key = [_]u8{0x00} ** Aegis128LMac.key_length;
644 var msg: [64]u8 = undefined;629 var msg: [64]u8 = undefined;
645 for (&msg, 0..) |*m, i| {630 for (&msg, 0..) |*m, i| {
lib/std/crypto/aes.zig+1-9
...@@ -6,7 +6,7 @@ const has_aesni = std.Target.x86.featureSetHas(builtin.cpu.features, .aes);...@@ -6,7 +6,7 @@ const has_aesni = std.Target.x86.featureSetHas(builtin.cpu.features, .aes);
6const has_avx = std.Target.x86.featureSetHas(builtin.cpu.features, .avx);6const has_avx = std.Target.x86.featureSetHas(builtin.cpu.features, .avx);
7const has_armaes = std.Target.aarch64.featureSetHas(builtin.cpu.features, .aes);7const has_armaes = std.Target.aarch64.featureSetHas(builtin.cpu.features, .aes);
8// C backend doesn't currently support passing vectors to inline asm.8// C backend doesn't currently support passing vectors to inline asm.
9const impl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c and has_aesni and has_avx) impl: {9const impl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c and builtin.zig_backend != .stage2_x86_64 and has_aesni and has_avx) impl: {
10 break :impl @import("aes/aesni.zig");10 break :impl @import("aes/aesni.zig");
11} else if (builtin.cpu.arch == .aarch64 and builtin.zig_backend != .stage2_c and has_armaes)11} else if (builtin.cpu.arch == .aarch64 and builtin.zig_backend != .stage2_c and has_armaes)
12impl: {12impl: {
...@@ -55,8 +55,6 @@ test "ctr" {...@@ -55,8 +55,6 @@ test "ctr" {
55}55}
5656
57test "encrypt" {57test "encrypt" {
58 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
59
60 // Appendix B58 // Appendix B
61 {59 {
62 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };60 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
...@@ -86,8 +84,6 @@ test "encrypt" {...@@ -86,8 +84,6 @@ test "encrypt" {
86}84}
8785
88test "decrypt" {86test "decrypt" {
89 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
90
91 // Appendix B87 // Appendix B
92 {88 {
93 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };89 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
...@@ -117,8 +113,6 @@ test "decrypt" {...@@ -117,8 +113,6 @@ test "decrypt" {
117}113}
118114
119test "expand 128-bit key" {115test "expand 128-bit key" {
120 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
121
122 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };116 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
123 const exp_enc = [_]*const [32:0]u8{117 const exp_enc = [_]*const [32:0]u8{
124 "2b7e151628aed2a6abf7158809cf4f3c", "a0fafe1788542cb123a339392a6c7605", "f2c295f27a96b9435935807a7359f67f", "3d80477d4716fe3e1e237e446d7a883b", "ef44a541a8525b7fb671253bdb0bad00", "d4d1c6f87c839d87caf2b8bc11f915bc", "6d88a37a110b3efddbf98641ca0093fd", "4e54f70e5f5fc9f384a64fb24ea6dc4f", "ead27321b58dbad2312bf5607f8d292f", "ac7766f319fadc2128d12941575c006e", "d014f9a8c9ee2589e13f0cc8b6630ca6",118 "2b7e151628aed2a6abf7158809cf4f3c", "a0fafe1788542cb123a339392a6c7605", "f2c295f27a96b9435935807a7359f67f", "3d80477d4716fe3e1e237e446d7a883b", "ef44a541a8525b7fb671253bdb0bad00", "d4d1c6f87c839d87caf2b8bc11f915bc", "6d88a37a110b3efddbf98641ca0093fd", "4e54f70e5f5fc9f384a64fb24ea6dc4f", "ead27321b58dbad2312bf5607f8d292f", "ac7766f319fadc2128d12941575c006e", "d014f9a8c9ee2589e13f0cc8b6630ca6",
...@@ -141,8 +135,6 @@ test "expand 128-bit key" {...@@ -141,8 +135,6 @@ test "expand 128-bit key" {
141}135}
142136
143test "expand 256-bit key" {137test "expand 256-bit key" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
146 const key = [_]u8{138 const key = [_]u8{
147 0x60, 0x3d, 0xeb, 0x10,139 0x60, 0x3d, 0xeb, 0x10,
148 0x15, 0xca, 0x71, 0xbe,140 0x15, 0xca, 0x71, 0xbe,
lib/std/crypto/aes_ocb.zig+8-16
...@@ -261,10 +261,8 @@ inline fn xorWith(x: *Block, y: Block) void {...@@ -261,10 +261,8 @@ inline fn xorWith(x: *Block, y: Block) void {
261const hexToBytes = std.fmt.hexToBytes;261const hexToBytes = std.fmt.hexToBytes;
262262
263test "AesOcb test vector 1" {263test "AesOcb test vector 1" {
264 switch (builtin.zig_backend) {264 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
265 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,265 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
266 else => {},
267 }
268266
269 var k: [Aes128Ocb.key_length]u8 = undefined;267 var k: [Aes128Ocb.key_length]u8 = undefined;
270 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;268 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
...@@ -283,10 +281,8 @@ test "AesOcb test vector 1" {...@@ -283,10 +281,8 @@ test "AesOcb test vector 1" {
283}281}
284282
285test "AesOcb test vector 2" {283test "AesOcb test vector 2" {
286 switch (builtin.zig_backend) {284 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
287 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,285 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
288 else => {},
289 }
290286
291 var k: [Aes128Ocb.key_length]u8 = undefined;287 var k: [Aes128Ocb.key_length]u8 = undefined;
292 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;288 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
...@@ -307,10 +303,8 @@ test "AesOcb test vector 2" {...@@ -307,10 +303,8 @@ test "AesOcb test vector 2" {
307}303}
308304
309test "AesOcb test vector 3" {305test "AesOcb test vector 3" {
310 switch (builtin.zig_backend) {306 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
311 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,307 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
312 else => {},
313 }
314308
315 var k: [Aes128Ocb.key_length]u8 = undefined;309 var k: [Aes128Ocb.key_length]u8 = undefined;
316 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;310 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
...@@ -334,10 +328,8 @@ test "AesOcb test vector 3" {...@@ -334,10 +328,8 @@ test "AesOcb test vector 3" {
334}328}
335329
336test "AesOcb test vector 4" {330test "AesOcb test vector 4" {
337 switch (builtin.zig_backend) {331 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
338 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,332 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
339 else => {},
340 }
341333
342 var k: [Aes128Ocb.key_length]u8 = undefined;334 var k: [Aes128Ocb.key_length]u8 = undefined;
343 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;335 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
lib/std/crypto/argon2.zig-10
...@@ -622,8 +622,6 @@ pub fn strVerify(...@@ -622,8 +622,6 @@ pub fn strVerify(
622}622}
623623
624test "argon2d" {624test "argon2d" {
625 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
626
627 const password = [_]u8{0x01} ** 32;625 const password = [_]u8{0x01} ** 32;
628 const salt = [_]u8{0x02} ** 16;626 const salt = [_]u8{0x02} ** 16;
629 const secret = [_]u8{0x03} ** 8;627 const secret = [_]u8{0x03} ** 8;
...@@ -649,8 +647,6 @@ test "argon2d" {...@@ -649,8 +647,6 @@ test "argon2d" {
649}647}
650648
651test "argon2i" {649test "argon2i" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654 const password = [_]u8{0x01} ** 32;650 const password = [_]u8{0x01} ** 32;
655 const salt = [_]u8{0x02} ** 16;651 const salt = [_]u8{0x02} ** 16;
656 const secret = [_]u8{0x03} ** 8;652 const secret = [_]u8{0x03} ** 8;
...@@ -676,8 +672,6 @@ test "argon2i" {...@@ -676,8 +672,6 @@ test "argon2i" {
676}672}
677673
678test "argon2id" {674test "argon2id" {
679 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
680
681 const password = [_]u8{0x01} ** 32;675 const password = [_]u8{0x01} ** 32;
682 const salt = [_]u8{0x02} ** 16;676 const salt = [_]u8{0x02} ** 16;
683 const secret = [_]u8{0x03} ** 8;677 const secret = [_]u8{0x03} ** 8;
...@@ -703,8 +697,6 @@ test "argon2id" {...@@ -703,8 +697,6 @@ test "argon2id" {
703}697}
704698
705test "kdf" {699test "kdf" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
708 const password = "password";700 const password = "password";
709 const salt = "somesalt";701 const salt = "somesalt";
710702
...@@ -936,8 +928,6 @@ test "password hash and password verify" {...@@ -936,8 +928,6 @@ test "password hash and password verify" {
936}928}
937929
938test "kdf derived key length" {930test "kdf derived key length" {
939 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
940
941 const allocator = std.testing.allocator;931 const allocator = std.testing.allocator;
942932
943 const password = "testpass";933 const password = "testpass";
lib/std/crypto/blake3.zig-2
...@@ -682,8 +682,6 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void {...@@ -682,8 +682,6 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void {
682}682}
683683
684test "BLAKE3 reference test cases" {684test "BLAKE3 reference test cases" {
685 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
686
687 var hash_state = Blake3.init(.{});685 var hash_state = Blake3.init(.{});
688 const hash = &hash_state;686 const hash = &hash_state;
689 var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* });687 var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* });
lib/std/crypto/chacha20.zig-4
...@@ -759,8 +759,6 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type {...@@ -759,8 +759,6 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type {
759}759}
760760
761test "chacha20 AEAD API" {761test "chacha20 AEAD API" {
762 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
763
764 const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 };762 const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 };
765 const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.";763 const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.";
766 const ad = "Additional data";764 const ad = "Additional data";
...@@ -782,8 +780,6 @@ test "chacha20 AEAD API" {...@@ -782,8 +780,6 @@ test "chacha20 AEAD API" {
782780
783// https://tools.ietf.org/html/rfc7539#section-2.4.2781// https://tools.ietf.org/html/rfc7539#section-2.4.2
784test "crypto.chacha20 test vector sunscreen" {782test "crypto.chacha20 test vector sunscreen" {
785 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
786
787 const expected_result = [_]u8{783 const expected_result = [_]u8{
788 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,784 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,
789 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81,785 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81,
lib/std/crypto/ghash_polyval.zig-2
...@@ -476,8 +476,6 @@ test "ghash2" {...@@ -476,8 +476,6 @@ test "ghash2" {
476}476}
477477
478test "polyval" {478test "polyval" {
479 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
480
481 const key = [_]u8{0x42} ** 16;479 const key = [_]u8{0x42} ** 16;
482 const m = [_]u8{0x69} ** 256;480 const m = [_]u8{0x69} ** 256;
483481
lib/std/crypto/hash_composition.zig-2
...@@ -65,8 +65,6 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384);...@@ -65,8 +65,6 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384);
65pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);65pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);
6666
67test "Hash composition" {67test "Hash composition" {
68 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
70 const Sha256 = sha2.Sha256;68 const Sha256 = sha2.Sha256;
71 const msg = "test";69 const msg = "test";
7270
lib/std/crypto/hkdf.zig-2
...@@ -72,8 +72,6 @@ pub fn Hkdf(comptime Hmac: type) type {...@@ -72,8 +72,6 @@ pub fn Hkdf(comptime Hmac: type) type {
72const htest = @import("test.zig");72const htest = @import("test.zig");
7373
74test "Hkdf" {74test "Hkdf" {
75 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
76
77 const ikm = [_]u8{0x0b} ** 22;75 const ikm = [_]u8{0x0b} ** 22;
78 const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };76 const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };
79 const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 };77 const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 };
lib/std/crypto/kyber_d00.zig-28
...@@ -553,8 +553,6 @@ const inv_ntt_reductions = [_]i16{...@@ -553,8 +553,6 @@ const inv_ntt_reductions = [_]i16{
553};553};
554554
555test "invNTTReductions bounds" {555test "invNTTReductions bounds" {
556 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
557
558 // Checks whether the reductions proposed by invNTTReductions556 // Checks whether the reductions proposed by invNTTReductions
559 // don't overflow during invNTT().557 // don't overflow during invNTT().
560 var xs = [_]i32{1} ** 256; // start at |x| ≤ q558 var xs = [_]i32{1} ** 256; // start at |x| ≤ q
...@@ -658,8 +656,6 @@ fn montReduce(x: i32) i16 {...@@ -658,8 +656,6 @@ fn montReduce(x: i32) i16 {
658}656}
659657
660test "Test montReduce" {658test "Test montReduce" {
661 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
662
663 var rnd = RndGen.init(0);659 var rnd = RndGen.init(0);
664 for (0..1000) |_| {660 for (0..1000) |_| {
665 const bound = comptime @as(i32, Q) * (1 << 15);661 const bound = comptime @as(i32, Q) * (1 << 15);
...@@ -678,8 +674,6 @@ fn feToMont(x: i16) i16 {...@@ -678,8 +674,6 @@ fn feToMont(x: i16) i16 {
678}674}
679675
680test "Test feToMont" {676test "Test feToMont" {
681 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
682
683 var x: i32 = -(1 << 15);677 var x: i32 = -(1 << 15);
684 while (x < 1 << 15) : (x += 1) {678 while (x < 1 << 15) : (x += 1) {
685 const y = feToMont(@as(i16, @intCast(x)));679 const y = feToMont(@as(i16, @intCast(x)));
...@@ -713,8 +707,6 @@ fn feBarrettReduce(x: i16) i16 {...@@ -713,8 +707,6 @@ fn feBarrettReduce(x: i16) i16 {
713}707}
714708
715test "Test Barrett reduction" {709test "Test Barrett reduction" {
716 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
717
718 var x: i32 = -(1 << 15);710 var x: i32 = -(1 << 15);
719 while (x < 1 << 15) : (x += 1) {711 while (x < 1 << 15) : (x += 1) {
720 var y1 = feBarrettReduce(@as(i16, @intCast(x)));712 var y1 = feBarrettReduce(@as(i16, @intCast(x)));
...@@ -735,8 +727,6 @@ fn csubq(x: i16) i16 {...@@ -735,8 +727,6 @@ fn csubq(x: i16) i16 {
735}727}
736728
737test "Test csubq" {729test "Test csubq" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
740 var x: i32 = -29439;730 var x: i32 = -29439;
741 while (x < 1 << 15) : (x += 1) {731 while (x < 1 << 15) : (x += 1) {
742 const y1 = csubq(@as(i16, @intCast(x)));732 const y1 = csubq(@as(i16, @intCast(x)));
...@@ -1476,8 +1466,6 @@ fn cmov(comptime len: usize, dst: *[len]u8, src: [len]u8, b: u1) void {...@@ -1476,8 +1466,6 @@ fn cmov(comptime len: usize, dst: *[len]u8, src: [len]u8, b: u1) void {
1476}1466}
14771467
1478test "MulHat" {1468test "MulHat" {
1479 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1480
1481 var rnd = RndGen.init(0);1469 var rnd = RndGen.init(0);
14821470
1483 for (0..100) |_| {1471 for (0..100) |_| {
...@@ -1509,8 +1497,6 @@ test "MulHat" {...@@ -1509,8 +1497,6 @@ test "MulHat" {
1509}1497}
15101498
1511test "NTT" {1499test "NTT" {
1512 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1513
1514 var rnd = RndGen.init(0);1500 var rnd = RndGen.init(0);
15151501
1516 for (0..1000) |_| {1502 for (0..1000) |_| {
...@@ -1534,8 +1520,6 @@ test "NTT" {...@@ -1534,8 +1520,6 @@ test "NTT" {
1534}1520}
15351521
1536test "Compression" {1522test "Compression" {
1537 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1538
1539 var rnd = RndGen.init(0);1523 var rnd = RndGen.init(0);
1540 inline for (.{ 1, 4, 5, 10, 11 }) |d| {1524 inline for (.{ 1, 4, 5, 10, 11 }) |d| {
1541 for (0..1000) |_| {1525 for (0..1000) |_| {
...@@ -1548,8 +1532,6 @@ test "Compression" {...@@ -1548,8 +1532,6 @@ test "Compression" {
1548}1532}
15491533
1550test "noise" {1534test "noise" {
1551 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1552
1553 var seed: [32]u8 = undefined;1535 var seed: [32]u8 = undefined;
1554 for (&seed, 0..) |*s, i| {1536 for (&seed, 0..) |*s, i| {
1555 s.* = @as(u8, @intCast(i));1537 s.* = @as(u8, @intCast(i));
...@@ -1596,8 +1578,6 @@ test "noise" {...@@ -1596,8 +1578,6 @@ test "noise" {
1596}1578}
15971579
1598test "uniform sampling" {1580test "uniform sampling" {
1599 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1600
1601 var seed: [32]u8 = undefined;1581 var seed: [32]u8 = undefined;
1602 for (&seed, 0..) |*s, i| {1582 for (&seed, 0..) |*s, i| {
1603 s.* = @as(u8, @intCast(i));1583 s.* = @as(u8, @intCast(i));
...@@ -1631,8 +1611,6 @@ test "uniform sampling" {...@@ -1631,8 +1611,6 @@ test "uniform sampling" {
1631}1611}
16321612
1633test "Polynomial packing" {1613test "Polynomial packing" {
1634 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1635
1636 var rnd = RndGen.init(0);1614 var rnd = RndGen.init(0);
16371615
1638 for (0..1000) |_| {1616 for (0..1000) |_| {
...@@ -1642,8 +1620,6 @@ test "Polynomial packing" {...@@ -1642,8 +1620,6 @@ test "Polynomial packing" {
1642}1620}
16431621
1644test "Test inner PKE" {1622test "Test inner PKE" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
1647 var seed: [32]u8 = undefined;1623 var seed: [32]u8 = undefined;
1648 var pt: [32]u8 = undefined;1624 var pt: [32]u8 = undefined;
1649 for (&seed, &pt, 0..) |*s, *p, i| {1625 for (&seed, &pt, 0..) |*s, *p, i| {
...@@ -1665,8 +1641,6 @@ test "Test inner PKE" {...@@ -1665,8 +1641,6 @@ test "Test inner PKE" {
1665}1641}
16661642
1667test "Test happy flow" {1643test "Test happy flow" {
1668 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1669
1670 var seed: [64]u8 = undefined;1644 var seed: [64]u8 = undefined;
1671 for (&seed, 0..) |*s, i| {1645 for (&seed, 0..) |*s, i| {
1672 s.* = @as(u8, @intCast(i));1646 s.* = @as(u8, @intCast(i));
...@@ -1693,8 +1667,6 @@ test "Test happy flow" {...@@ -1693,8 +1667,6 @@ test "Test happy flow" {
1693const sha2 = crypto.hash.sha2;1667const sha2 = crypto.hash.sha2;
16941668
1695test "NIST KAT test" {1669test "NIST KAT test" {
1696 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1697
1698 inline for (.{1670 inline for (.{
1699 .{ Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547" },1671 .{ Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547" },
1700 .{ Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5" },1672 .{ Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5" },
lib/std/crypto/pbkdf2.zig-15
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const mem = std.mem;2const mem = std.mem;
4const maxInt = std.math.maxInt;3const maxInt = std.math.maxInt;
5const OutputTooLongError = std.crypto.errors.OutputTooLongError;4const OutputTooLongError = std.crypto.errors.OutputTooLongError;
...@@ -152,8 +151,6 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;...@@ -152,8 +151,6 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;
152// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors151// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors
153152
154test "RFC 6070 one iteration" {153test "RFC 6070 one iteration" {
155 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
156
157 const p = "password";154 const p = "password";
158 const s = "salt";155 const s = "salt";
159 const c = 1;156 const c = 1;
...@@ -169,8 +166,6 @@ test "RFC 6070 one iteration" {...@@ -169,8 +166,6 @@ test "RFC 6070 one iteration" {
169}166}
170167
171test "RFC 6070 two iterations" {168test "RFC 6070 two iterations" {
172 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
173
174 const p = "password";169 const p = "password";
175 const s = "salt";170 const s = "salt";
176 const c = 2;171 const c = 2;
...@@ -186,8 +181,6 @@ test "RFC 6070 two iterations" {...@@ -186,8 +181,6 @@ test "RFC 6070 two iterations" {
186}181}
187182
188test "RFC 6070 4096 iterations" {183test "RFC 6070 4096 iterations" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
191 const p = "password";184 const p = "password";
192 const s = "salt";185 const s = "salt";
193 const c = 4096;186 const c = 4096;
...@@ -203,8 +196,6 @@ test "RFC 6070 4096 iterations" {...@@ -203,8 +196,6 @@ test "RFC 6070 4096 iterations" {
203}196}
204197
205test "RFC 6070 16,777,216 iterations" {198test "RFC 6070 16,777,216 iterations" {
206 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
207
208 // These iteration tests are slow so we always skip them. Results have been verified.199 // These iteration tests are slow so we always skip them. Results have been verified.
209 if (true) {200 if (true) {
210 return error.SkipZigTest;201 return error.SkipZigTest;
...@@ -225,8 +216,6 @@ test "RFC 6070 16,777,216 iterations" {...@@ -225,8 +216,6 @@ test "RFC 6070 16,777,216 iterations" {
225}216}
226217
227test "RFC 6070 multi-block salt and password" {218test "RFC 6070 multi-block salt and password" {
228 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
229
230 const p = "passwordPASSWORDpassword";219 const p = "passwordPASSWORDpassword";
231 const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";220 const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";
232 const c = 4096;221 const c = 4096;
...@@ -242,8 +231,6 @@ test "RFC 6070 multi-block salt and password" {...@@ -242,8 +231,6 @@ test "RFC 6070 multi-block salt and password" {
242}231}
243232
244test "RFC 6070 embedded NUL" {233test "RFC 6070 embedded NUL" {
245 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
246
247 const p = "pass\x00word";234 const p = "pass\x00word";
248 const s = "sa\x00lt";235 const s = "sa\x00lt";
249 const c = 4096;236 const c = 4096;
...@@ -259,8 +246,6 @@ test "RFC 6070 embedded NUL" {...@@ -259,8 +246,6 @@ test "RFC 6070 embedded NUL" {
259}246}
260247
261test "Very large dk_len" {248test "Very large dk_len" {
262 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
263
264 // This test allocates 8GB of memory and is expected to take several hours to run.249 // This test allocates 8GB of memory and is expected to take several hours to run.
265 if (true) {250 if (true) {
266 return error.SkipZigTest;251 return error.SkipZigTest;
lib/std/crypto/phc_encoding.zig-4
...@@ -351,16 +351,12 @@ test "phc format - encoding/decoding" {...@@ -351,16 +351,12 @@ test "phc format - encoding/decoding" {
351}351}
352352
353test "phc format - empty input string" {353test "phc format - empty input string" {
354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
355
356 const s = "";354 const s = "";
357 const v = deserialize(struct { alg_id: []const u8 }, s);355 const v = deserialize(struct { alg_id: []const u8 }, s);
358 try std.testing.expectError(Error.InvalidEncoding, v);356 try std.testing.expectError(Error.InvalidEncoding, v);
359}357}
360358
361test "phc format - hash without salt" {359test "phc format - hash without salt" {
362 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
363
364 const s = "$scrypt";360 const s = "$scrypt";
365 const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);361 const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);
366 try std.testing.expectError(Error.InvalidEncoding, v);362 try std.testing.expectError(Error.InvalidEncoding, v);
lib/std/crypto/salsa20.zig+1-7
...@@ -302,7 +302,7 @@ fn SalsaNonVecImpl(comptime rounds: comptime_int) type {...@@ -302,7 +302,7 @@ fn SalsaNonVecImpl(comptime rounds: comptime_int) type {
302 };302 };
303}303}
304304
305const SalsaImpl = if (builtin.cpu.arch == .x86_64) SalsaVecImpl else SalsaNonVecImpl;305const SalsaImpl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64) SalsaVecImpl else SalsaNonVecImpl;
306306
307fn keyToWords(key: [32]u8) [8]u32 {307fn keyToWords(key: [32]u8) [8]u32 {
308 var k: [8]u32 = undefined;308 var k: [8]u32 = undefined;
...@@ -555,8 +555,6 @@ pub const SealedBox = struct {...@@ -555,8 +555,6 @@ pub const SealedBox = struct {
555const htest = @import("test.zig");555const htest = @import("test.zig");
556556
557test "(x)salsa20" {557test "(x)salsa20" {
558 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
559
560 const key = [_]u8{0x69} ** 32;558 const key = [_]u8{0x69} ** 32;
561 const nonce = [_]u8{0x42} ** 8;559 const nonce = [_]u8{0x42} ** 8;
562 const msg = [_]u8{0} ** 20;560 const msg = [_]u8{0} ** 20;
...@@ -571,8 +569,6 @@ test "(x)salsa20" {...@@ -571,8 +569,6 @@ test "(x)salsa20" {
571}569}
572570
573test "xsalsa20poly1305" {571test "xsalsa20poly1305" {
574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
575
576 var msg: [100]u8 = undefined;572 var msg: [100]u8 = undefined;
577 var msg2: [msg.len]u8 = undefined;573 var msg2: [msg.len]u8 = undefined;
578 var c: [msg.len]u8 = undefined;574 var c: [msg.len]u8 = undefined;
...@@ -588,8 +584,6 @@ test "xsalsa20poly1305" {...@@ -588,8 +584,6 @@ test "xsalsa20poly1305" {
588}584}
589585
590test "xsalsa20poly1305 secretbox" {586test "xsalsa20poly1305 secretbox" {
591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
592
593 var msg: [100]u8 = undefined;587 var msg: [100]u8 = undefined;
594 var msg2: [msg.len]u8 = undefined;588 var msg2: [msg.len]u8 = undefined;
595 var key: [XSalsa20Poly1305.key_length]u8 = undefined;589 var key: [XSalsa20Poly1305.key_length]u8 = undefined;
lib/std/crypto/scrypt.zig-5
...@@ -3,7 +3,6 @@...@@ -3,7 +3,6 @@
3// https://github.com/Tarsnap/scrypt3// https://github.com/Tarsnap/scrypt
44
5const std = @import("std");5const std = @import("std");
6const builtin = @import("builtin");
7const crypto = std.crypto;6const crypto = std.crypto;
8const fmt = std.fmt;7const fmt = std.fmt;
9const io = std.io;8const io = std.io;
...@@ -684,8 +683,6 @@ test "unix-scrypt" {...@@ -684,8 +683,6 @@ test "unix-scrypt" {
684}683}
685684
686test "crypt format" {685test "crypt format" {
687 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
688
689 const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";686 const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";
690 const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);687 const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);
691 var buf: [str.len]u8 = undefined;688 var buf: [str.len]u8 = undefined;
...@@ -694,8 +691,6 @@ test "crypt format" {...@@ -694,8 +691,6 @@ test "crypt format" {
694}691}
695692
696test "kdf fast" {693test "kdf fast" {
697 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
698
699 const TestVector = struct {694 const TestVector = struct {
700 password: []const u8,695 password: []const u8,
701 salt: []const u8,696 salt: []const u8,
lib/std/crypto/sha2.zig-10
...@@ -406,16 +406,12 @@ fn Sha2x32(comptime params: Sha2Params32) type {...@@ -406,16 +406,12 @@ fn Sha2x32(comptime params: Sha2Params32) type {
406}406}
407407
408test "sha224 single" {408test "sha224 single" {
409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
410
411 try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");409 try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");
412 try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");410 try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");
413 try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");411 try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
414}412}
415413
416test "sha224 streaming" {414test "sha224 streaming" {
417 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
418
419 var h = Sha224.init(.{});415 var h = Sha224.init(.{});
420 var out: [28]u8 = undefined;416 var out: [28]u8 = undefined;
421417
...@@ -436,16 +432,12 @@ test "sha224 streaming" {...@@ -436,16 +432,12 @@ test "sha224 streaming" {
436}432}
437433
438test "sha256 single" {434test "sha256 single" {
439 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
440
441 try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");435 try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");
442 try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");436 try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");
443 try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");437 try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
444}438}
445439
446test "sha256 streaming" {440test "sha256 streaming" {
447 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
448
449 var h = Sha256.init(.{});441 var h = Sha256.init(.{});
450 var out: [32]u8 = undefined;442 var out: [32]u8 = undefined;
451443
...@@ -466,8 +458,6 @@ test "sha256 streaming" {...@@ -466,8 +458,6 @@ test "sha256 streaming" {
466}458}
467459
468test "sha256 aligned final" {460test "sha256 aligned final" {
469 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
470
471 var block = [_]u8{0} ** Sha256.block_length;461 var block = [_]u8{0} ** Sha256.block_length;
472 var out: [Sha256.digest_length]u8 = undefined;462 var out: [Sha256.digest_length]u8 = undefined;
473463
lib/std/fifo.zig-2
...@@ -505,8 +505,6 @@ test "LinearFifo(u8, .Dynamic)" {...@@ -505,8 +505,6 @@ test "LinearFifo(u8, .Dynamic)" {
505}505}
506506
507test "LinearFifo" {507test "LinearFifo" {
508 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
509
510 inline for ([_]type{ u1, u8, u16, u64 }) |T| {508 inline for ([_]type{ u1, u8, u16, u64 }) |T| {
511 inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {509 inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {
512 const FifoType = LinearFifo(T, bt);510 const FifoType = LinearFifo(T, bt);
lib/std/fmt.zig-2
...@@ -2751,8 +2751,6 @@ test "formatType max_depth" {...@@ -2751,8 +2751,6 @@ test "formatType max_depth" {
2751}2751}
27522752
2753test "positional" {2753test "positional" {
2754 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2755
2756 try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });2754 try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
2757 try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });2755 try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
2758 try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});2756 try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});
lib/std/fs.zig+6-6
...@@ -3244,15 +3244,15 @@ fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError...@@ -3244,15 +3244,15 @@ fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError
3244}3244}
32453245
3246test {3246test {
3247 if (builtin.zig_backend != .stage2_x86_64) {3247 if (builtin.os.tag != .wasi) {
3248 if (builtin.os.tag != .wasi) {3248 _ = &makeDirAbsolute;
3249 _ = &makeDirAbsolute;3249 _ = &makeDirAbsoluteZ;
3250 _ = &makeDirAbsoluteZ;3250 _ = &copyFileAbsolute;
3251 _ = &copyFileAbsolute;3251 if (builtin.zig_backend != .stage2_x86_64) {
3252 _ = &updateFileAbsolute;3252 _ = &updateFileAbsolute;
3253 }3253 }
3254 _ = &Dir.copyFile;
3255 }3254 }
3255 _ = &Dir.copyFile;
3256 _ = @import("fs/test.zig");3256 _ = @import("fs/test.zig");
3257 _ = @import("fs/path.zig");3257 _ = @import("fs/path.zig");
3258 _ = @import("fs/file.zig");3258 _ = @import("fs/file.zig");
lib/std/fs/test.zig-98
...@@ -124,8 +124,6 @@ fn testWithAllSupportedPathTypes(test_func: anytype) !void {...@@ -124,8 +124,6 @@ fn testWithAllSupportedPathTypes(test_func: anytype) !void {
124}124}
125125
126test "Dir.readLink" {126test "Dir.readLink" {
127 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
128
129 try testWithAllSupportedPathTypes(struct {127 try testWithAllSupportedPathTypes(struct {
130 fn impl(ctx: *TestContext) !void {128 fn impl(ctx: *TestContext) !void {
131 // Create some targets129 // Create some targets
...@@ -163,8 +161,6 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo...@@ -163,8 +161,6 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo
163}161}
164162
165test "relative symlink to parent directory" {163test "relative symlink to parent directory" {
166 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
167
168 var tmp = tmpDir(.{});164 var tmp = tmpDir(.{});
169 defer tmp.cleanup();165 defer tmp.cleanup();
170166
...@@ -182,8 +178,6 @@ test "relative symlink to parent directory" {...@@ -182,8 +178,6 @@ test "relative symlink to parent directory" {
182}178}
183179
184test "openDir" {180test "openDir" {
185 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
186
187 try testWithAllSupportedPathTypes(struct {181 try testWithAllSupportedPathTypes(struct {
188 fn impl(ctx: *TestContext) !void {182 fn impl(ctx: *TestContext) !void {
189 const allocator = ctx.arena.allocator();183 const allocator = ctx.arena.allocator();
...@@ -202,8 +196,6 @@ test "openDir" {...@@ -202,8 +196,6 @@ test "openDir" {
202test "accessAbsolute" {196test "accessAbsolute" {
203 if (builtin.os.tag == .wasi) return error.SkipZigTest;197 if (builtin.os.tag == .wasi) return error.SkipZigTest;
204198
205 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
206
207 var tmp = tmpDir(.{});199 var tmp = tmpDir(.{});
208 defer tmp.cleanup();200 defer tmp.cleanup();
209201
...@@ -222,8 +214,6 @@ test "accessAbsolute" {...@@ -222,8 +214,6 @@ test "accessAbsolute" {
222test "openDirAbsolute" {214test "openDirAbsolute" {
223 if (builtin.os.tag == .wasi) return error.SkipZigTest;215 if (builtin.os.tag == .wasi) return error.SkipZigTest;
224216
225 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
226
227 var tmp = tmpDir(.{});217 var tmp = tmpDir(.{});
228 defer tmp.cleanup();218 defer tmp.cleanup();
229219
...@@ -262,8 +252,6 @@ test "openDir non-cwd parent .." {...@@ -262,8 +252,6 @@ test "openDir non-cwd parent .." {
262 else => {},252 else => {},
263 }253 }
264254
265 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
266
267 var tmp = tmpDir(.{});255 var tmp = tmpDir(.{});
268 defer tmp.cleanup();256 defer tmp.cleanup();
269257
...@@ -285,8 +273,6 @@ test "openDir non-cwd parent .." {...@@ -285,8 +273,6 @@ test "openDir non-cwd parent .." {
285test "readLinkAbsolute" {273test "readLinkAbsolute" {
286 if (builtin.os.tag == .wasi) return error.SkipZigTest;274 if (builtin.os.tag == .wasi) return error.SkipZigTest;
287275
288 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
289
290 var tmp = tmpDir(.{});276 var tmp = tmpDir(.{});
291 defer tmp.cleanup();277 defer tmp.cleanup();
292278
...@@ -337,8 +323,6 @@ fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void...@@ -337,8 +323,6 @@ fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void
337}323}
338324
339test "Dir.Iterator" {325test "Dir.Iterator" {
340 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
341
342 var tmp_dir = tmpIterableDir(.{});326 var tmp_dir = tmpIterableDir(.{});
343 defer tmp_dir.cleanup();327 defer tmp_dir.cleanup();
344328
...@@ -369,8 +353,6 @@ test "Dir.Iterator" {...@@ -369,8 +353,6 @@ test "Dir.Iterator" {
369}353}
370354
371test "Dir.Iterator many entries" {355test "Dir.Iterator many entries" {
372 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
373
374 var tmp_dir = tmpIterableDir(.{});356 var tmp_dir = tmpIterableDir(.{});
375 defer tmp_dir.cleanup();357 defer tmp_dir.cleanup();
376358
...@@ -406,8 +388,6 @@ test "Dir.Iterator many entries" {...@@ -406,8 +388,6 @@ test "Dir.Iterator many entries" {
406}388}
407389
408test "Dir.Iterator twice" {390test "Dir.Iterator twice" {
409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
410
411 var tmp_dir = tmpIterableDir(.{});391 var tmp_dir = tmpIterableDir(.{});
412 defer tmp_dir.cleanup();392 defer tmp_dir.cleanup();
413393
...@@ -441,8 +421,6 @@ test "Dir.Iterator twice" {...@@ -441,8 +421,6 @@ test "Dir.Iterator twice" {
441}421}
442422
443test "Dir.Iterator reset" {423test "Dir.Iterator reset" {
444 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
445
446 var tmp_dir = tmpIterableDir(.{});424 var tmp_dir = tmpIterableDir(.{});
447 defer tmp_dir.cleanup();425 defer tmp_dir.cleanup();
448426
...@@ -479,8 +457,6 @@ test "Dir.Iterator reset" {...@@ -479,8 +457,6 @@ test "Dir.Iterator reset" {
479}457}
480458
481test "Dir.Iterator but dir is deleted during iteration" {459test "Dir.Iterator but dir is deleted during iteration" {
482 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
483
484 var tmp = std.testing.tmpDir(.{});460 var tmp = std.testing.tmpDir(.{});
485 defer tmp.cleanup();461 defer tmp.cleanup();
486462
...@@ -523,8 +499,6 @@ fn contains(entries: *const std.ArrayList(IterableDir.Entry), el: IterableDir.En...@@ -523,8 +499,6 @@ fn contains(entries: *const std.ArrayList(IterableDir.Entry), el: IterableDir.En
523test "Dir.realpath smoke test" {499test "Dir.realpath smoke test" {
524 if (!comptime std.os.isGetFdPathSupportedOnTarget(builtin.os)) return error.SkipZigTest;500 if (!comptime std.os.isGetFdPathSupportedOnTarget(builtin.os)) return error.SkipZigTest;
525501
526 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
527
528 try testWithAllSupportedPathTypes(struct {502 try testWithAllSupportedPathTypes(struct {
529 fn impl(ctx: *TestContext) !void {503 fn impl(ctx: *TestContext) !void {
530 const allocator = ctx.arena.allocator();504 const allocator = ctx.arena.allocator();
...@@ -575,8 +549,6 @@ test "Dir.realpath smoke test" {...@@ -575,8 +549,6 @@ test "Dir.realpath smoke test" {
575}549}
576550
577test "readAllAlloc" {551test "readAllAlloc" {
578 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
579
580 var tmp_dir = tmpDir(.{});552 var tmp_dir = tmpDir(.{});
581 defer tmp_dir.cleanup();553 defer tmp_dir.cleanup();
582554
...@@ -613,8 +585,6 @@ test "Dir.statFile" {...@@ -613,8 +585,6 @@ test "Dir.statFile" {
613 // TODO: Re-enable once https://github.com/ziglang/zig/issues/17034 is solved585 // TODO: Re-enable once https://github.com/ziglang/zig/issues/17034 is solved
614 if (builtin.os.tag == .linux and builtin.link_libc and builtin.abi == .gnu) return error.SkipZigTest;586 if (builtin.os.tag == .linux and builtin.link_libc and builtin.abi == .gnu) return error.SkipZigTest;
615587
616 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
617
618 try testWithAllSupportedPathTypes(struct {588 try testWithAllSupportedPathTypes(struct {
619 fn impl(ctx: *TestContext) !void {589 fn impl(ctx: *TestContext) !void {
620 const test_file_name = try ctx.transformPath("test_file");590 const test_file_name = try ctx.transformPath("test_file");
...@@ -630,8 +600,6 @@ test "Dir.statFile" {...@@ -630,8 +600,6 @@ test "Dir.statFile" {
630}600}
631601
632test "directory operations on files" {602test "directory operations on files" {
633 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
634
635 try testWithAllSupportedPathTypes(struct {603 try testWithAllSupportedPathTypes(struct {
636 fn impl(ctx: *TestContext) !void {604 fn impl(ctx: *TestContext) !void {
637 const test_file_name = try ctx.transformPath("test_file");605 const test_file_name = try ctx.transformPath("test_file");
...@@ -661,8 +629,6 @@ test "file operations on directories" {...@@ -661,8 +629,6 @@ test "file operations on directories" {
661 // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759629 // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759
662 if (builtin.os.tag == .freebsd) return error.SkipZigTest;630 if (builtin.os.tag == .freebsd) return error.SkipZigTest;
663631
664 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
665
666 try testWithAllSupportedPathTypes(struct {632 try testWithAllSupportedPathTypes(struct {
667 fn impl(ctx: *TestContext) !void {633 fn impl(ctx: *TestContext) !void {
668 const test_dir_name = try ctx.transformPath("test_dir");634 const test_dir_name = try ctx.transformPath("test_dir");
...@@ -698,8 +664,6 @@ test "file operations on directories" {...@@ -698,8 +664,6 @@ test "file operations on directories" {
698}664}
699665
700test "makeOpenPath parent dirs do not exist" {666test "makeOpenPath parent dirs do not exist" {
701 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
702
703 var tmp_dir = tmpDir(.{});667 var tmp_dir = tmpDir(.{});
704 defer tmp_dir.cleanup();668 defer tmp_dir.cleanup();
705669
...@@ -712,8 +676,6 @@ test "makeOpenPath parent dirs do not exist" {...@@ -712,8 +676,6 @@ test "makeOpenPath parent dirs do not exist" {
712}676}
713677
714test "deleteDir" {678test "deleteDir" {
715 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
716
717 try testWithAllSupportedPathTypes(struct {679 try testWithAllSupportedPathTypes(struct {
718 fn impl(ctx: *TestContext) !void {680 fn impl(ctx: *TestContext) !void {
719 const test_dir_path = try ctx.transformPath("test_dir");681 const test_dir_path = try ctx.transformPath("test_dir");
...@@ -735,8 +697,6 @@ test "deleteDir" {...@@ -735,8 +697,6 @@ test "deleteDir" {
735}697}
736698
737test "Dir.rename files" {699test "Dir.rename files" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
740 try testWithAllSupportedPathTypes(struct {700 try testWithAllSupportedPathTypes(struct {
741 fn impl(ctx: *TestContext) !void {701 fn impl(ctx: *TestContext) !void {
742 // Rename on Windows can hit intermittent AccessDenied errors702 // Rename on Windows can hit intermittent AccessDenied errors
...@@ -779,8 +739,6 @@ test "Dir.rename files" {...@@ -779,8 +739,6 @@ test "Dir.rename files" {
779}739}
780740
781test "Dir.rename directories" {741test "Dir.rename directories" {
782 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
783
784 try testWithAllSupportedPathTypes(struct {742 try testWithAllSupportedPathTypes(struct {
785 fn impl(ctx: *TestContext) !void {743 fn impl(ctx: *TestContext) !void {
786 // Rename on Windows can hit intermittent AccessDenied errors744 // Rename on Windows can hit intermittent AccessDenied errors
...@@ -822,8 +780,6 @@ test "Dir.rename directory onto empty dir" {...@@ -822,8 +780,6 @@ test "Dir.rename directory onto empty dir" {
822 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364780 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
823 if (builtin.os.tag == .windows) return error.SkipZigTest;781 if (builtin.os.tag == .windows) return error.SkipZigTest;
824782
825 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
826
827 try testWithAllSupportedPathTypes(struct {783 try testWithAllSupportedPathTypes(struct {
828 fn impl(ctx: *TestContext) !void {784 fn impl(ctx: *TestContext) !void {
829 const test_dir_path = try ctx.transformPath("test_dir");785 const test_dir_path = try ctx.transformPath("test_dir");
...@@ -845,8 +801,6 @@ test "Dir.rename directory onto non-empty dir" {...@@ -845,8 +801,6 @@ test "Dir.rename directory onto non-empty dir" {
845 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364801 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
846 if (builtin.os.tag == .windows) return error.SkipZigTest;802 if (builtin.os.tag == .windows) return error.SkipZigTest;
847803
848 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
849
850 try testWithAllSupportedPathTypes(struct {804 try testWithAllSupportedPathTypes(struct {
851 fn impl(ctx: *TestContext) !void {805 fn impl(ctx: *TestContext) !void {
852 const test_dir_path = try ctx.transformPath("test_dir");806 const test_dir_path = try ctx.transformPath("test_dir");
...@@ -873,8 +827,6 @@ test "Dir.rename file <-> dir" {...@@ -873,8 +827,6 @@ test "Dir.rename file <-> dir" {
873 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364827 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
874 if (builtin.os.tag == .windows) return error.SkipZigTest;828 if (builtin.os.tag == .windows) return error.SkipZigTest;
875829
876 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
877
878 try testWithAllSupportedPathTypes(struct {830 try testWithAllSupportedPathTypes(struct {
879 fn impl(ctx: *TestContext) !void {831 fn impl(ctx: *TestContext) !void {
880 const test_file_path = try ctx.transformPath("test_file");832 const test_file_path = try ctx.transformPath("test_file");
...@@ -890,8 +842,6 @@ test "Dir.rename file <-> dir" {...@@ -890,8 +842,6 @@ test "Dir.rename file <-> dir" {
890}842}
891843
892test "rename" {844test "rename" {
893 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
894
895 var tmp_dir1 = tmpDir(.{});845 var tmp_dir1 = tmpDir(.{});
896 defer tmp_dir1.cleanup();846 defer tmp_dir1.cleanup();
897847
...@@ -914,8 +864,6 @@ test "rename" {...@@ -914,8 +864,6 @@ test "rename" {
914test "renameAbsolute" {864test "renameAbsolute" {
915 if (builtin.os.tag == .wasi) return error.SkipZigTest;865 if (builtin.os.tag == .wasi) return error.SkipZigTest;
916866
917 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
918
919 var tmp_dir = tmpDir(.{});867 var tmp_dir = tmpDir(.{});
920 defer tmp_dir.cleanup();868 defer tmp_dir.cleanup();
921869
...@@ -974,8 +922,6 @@ test "openSelfExe" {...@@ -974,8 +922,6 @@ test "openSelfExe" {
974}922}
975923
976test "makePath, put some files in it, deleteTree" {924test "makePath, put some files in it, deleteTree" {
977 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
978
979 try testWithAllSupportedPathTypes(struct {925 try testWithAllSupportedPathTypes(struct {
980 fn impl(ctx: *TestContext) !void {926 fn impl(ctx: *TestContext) !void {
981 const allocator = ctx.arena.allocator();927 const allocator = ctx.arena.allocator();
...@@ -992,8 +938,6 @@ test "makePath, put some files in it, deleteTree" {...@@ -992,8 +938,6 @@ test "makePath, put some files in it, deleteTree" {
992}938}
993939
994test "makePath, put some files in it, deleteTreeMinStackSize" {940test "makePath, put some files in it, deleteTreeMinStackSize" {
995 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
996
997 try testWithAllSupportedPathTypes(struct {941 try testWithAllSupportedPathTypes(struct {
998 fn impl(ctx: *TestContext) !void {942 fn impl(ctx: *TestContext) !void {
999 const allocator = ctx.arena.allocator();943 const allocator = ctx.arena.allocator();
...@@ -1012,8 +956,6 @@ test "makePath, put some files in it, deleteTreeMinStackSize" {...@@ -1012,8 +956,6 @@ test "makePath, put some files in it, deleteTreeMinStackSize" {
1012test "makePath in a directory that no longer exists" {956test "makePath in a directory that no longer exists" {
1013 if (builtin.os.tag == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir957 if (builtin.os.tag == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir
1014958
1015 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1016
1017 var tmp = tmpDir(.{});959 var tmp = tmpDir(.{});
1018 defer tmp.cleanup();960 defer tmp.cleanup();
1019 try tmp.parent_dir.deleteTree(&tmp.sub_path);961 try tmp.parent_dir.deleteTree(&tmp.sub_path);
...@@ -1045,8 +987,6 @@ fn testFilenameLimits(iterable_dir: IterableDir, maxed_filename: []const u8) !vo...@@ -1045,8 +987,6 @@ fn testFilenameLimits(iterable_dir: IterableDir, maxed_filename: []const u8) !vo
1045}987}
1046988
1047test "max file name component lengths" {989test "max file name component lengths" {
1048 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1049
1050 var tmp = tmpIterableDir(.{});990 var tmp = tmpIterableDir(.{});
1051 defer tmp.cleanup();991 defer tmp.cleanup();
1052992
...@@ -1068,8 +1008,6 @@ test "max file name component lengths" {...@@ -1068,8 +1008,6 @@ test "max file name component lengths" {
1068}1008}
10691009
1070test "writev, readv" {1010test "writev, readv" {
1071 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1072
1073 var tmp = tmpDir(.{});1011 var tmp = tmpDir(.{});
1074 defer tmp.cleanup();1012 defer tmp.cleanup();
10751013
...@@ -1112,8 +1050,6 @@ test "writev, readv" {...@@ -1112,8 +1050,6 @@ test "writev, readv" {
1112}1050}
11131051
1114test "pwritev, preadv" {1052test "pwritev, preadv" {
1115 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1116
1117 var tmp = tmpDir(.{});1053 var tmp = tmpDir(.{});
1118 defer tmp.cleanup();1054 defer tmp.cleanup();
11191055
...@@ -1155,8 +1091,6 @@ test "pwritev, preadv" {...@@ -1155,8 +1091,6 @@ test "pwritev, preadv" {
1155}1091}
11561092
1157test "access file" {1093test "access file" {
1158 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1159
1160 try testWithAllSupportedPathTypes(struct {1094 try testWithAllSupportedPathTypes(struct {
1161 fn impl(ctx: *TestContext) !void {1095 fn impl(ctx: *TestContext) !void {
1162 const dir_path = try ctx.transformPath("os_test_tmp");1096 const dir_path = try ctx.transformPath("os_test_tmp");
...@@ -1173,8 +1107,6 @@ test "access file" {...@@ -1173,8 +1107,6 @@ test "access file" {
1173}1107}
11741108
1175test "sendfile" {1109test "sendfile" {
1176 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1177
1178 var tmp = tmpDir(.{});1110 var tmp = tmpDir(.{});
1179 defer tmp.cleanup();1111 defer tmp.cleanup();
11801112
...@@ -1240,8 +1172,6 @@ test "sendfile" {...@@ -1240,8 +1172,6 @@ test "sendfile" {
1240}1172}
12411173
1242test "copyRangeAll" {1174test "copyRangeAll" {
1243 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1244
1245 var tmp = tmpDir(.{});1175 var tmp = tmpDir(.{});
1246 defer tmp.cleanup();1176 defer tmp.cleanup();
12471177
...@@ -1268,8 +1198,6 @@ test "copyRangeAll" {...@@ -1268,8 +1198,6 @@ test "copyRangeAll" {
1268}1198}
12691199
1270test "copyFile" {1200test "copyFile" {
1271 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1272
1273 try testWithAllSupportedPathTypes(struct {1201 try testWithAllSupportedPathTypes(struct {
1274 fn impl(ctx: *TestContext) !void {1202 fn impl(ctx: *TestContext) !void {
1275 const data = "u6wj+JmdF3qHsFPE BUlH2g4gJCmEz0PP";1203 const data = "u6wj+JmdF3qHsFPE BUlH2g4gJCmEz0PP";
...@@ -1300,8 +1228,6 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void {...@@ -1300,8 +1228,6 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void {
1300}1228}
13011229
1302test "AtomicFile" {1230test "AtomicFile" {
1303 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1304
1305 try testWithAllSupportedPathTypes(struct {1231 try testWithAllSupportedPathTypes(struct {
1306 fn impl(ctx: *TestContext) !void {1232 fn impl(ctx: *TestContext) !void {
1307 const allocator = ctx.arena.allocator();1233 const allocator = ctx.arena.allocator();
...@@ -1328,8 +1254,6 @@ test "AtomicFile" {...@@ -1328,8 +1254,6 @@ test "AtomicFile" {
1328test "open file with exclusive nonblocking lock twice" {1254test "open file with exclusive nonblocking lock twice" {
1329 if (builtin.os.tag == .wasi) return error.SkipZigTest;1255 if (builtin.os.tag == .wasi) return error.SkipZigTest;
13301256
1331 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1332
1333 try testWithAllSupportedPathTypes(struct {1257 try testWithAllSupportedPathTypes(struct {
1334 fn impl(ctx: *TestContext) !void {1258 fn impl(ctx: *TestContext) !void {
1335 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");1259 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
...@@ -1346,8 +1270,6 @@ test "open file with exclusive nonblocking lock twice" {...@@ -1346,8 +1270,6 @@ test "open file with exclusive nonblocking lock twice" {
1346test "open file with shared and exclusive nonblocking lock" {1270test "open file with shared and exclusive nonblocking lock" {
1347 if (builtin.os.tag == .wasi) return error.SkipZigTest;1271 if (builtin.os.tag == .wasi) return error.SkipZigTest;
13481272
1349 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1350
1351 try testWithAllSupportedPathTypes(struct {1273 try testWithAllSupportedPathTypes(struct {
1352 fn impl(ctx: *TestContext) !void {1274 fn impl(ctx: *TestContext) !void {
1353 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");1275 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
...@@ -1364,8 +1286,6 @@ test "open file with shared and exclusive nonblocking lock" {...@@ -1364,8 +1286,6 @@ test "open file with shared and exclusive nonblocking lock" {
1364test "open file with exclusive and shared nonblocking lock" {1286test "open file with exclusive and shared nonblocking lock" {
1365 if (builtin.os.tag == .wasi) return error.SkipZigTest;1287 if (builtin.os.tag == .wasi) return error.SkipZigTest;
13661288
1367 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1368
1369 try testWithAllSupportedPathTypes(struct {1289 try testWithAllSupportedPathTypes(struct {
1370 fn impl(ctx: *TestContext) !void {1290 fn impl(ctx: *TestContext) !void {
1371 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");1291 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
...@@ -1380,8 +1300,6 @@ test "open file with exclusive and shared nonblocking lock" {...@@ -1380,8 +1300,6 @@ test "open file with exclusive and shared nonblocking lock" {
1380}1300}
13811301
1382test "open file with exclusive lock twice, make sure second lock waits" {1302test "open file with exclusive lock twice, make sure second lock waits" {
1383 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1384
1385 if (builtin.single_threaded) return error.SkipZigTest;1303 if (builtin.single_threaded) return error.SkipZigTest;
13861304
1387 if (std.io.is_async) {1305 if (std.io.is_async) {
...@@ -1432,8 +1350,6 @@ test "open file with exclusive lock twice, make sure second lock waits" {...@@ -1432,8 +1350,6 @@ test "open file with exclusive lock twice, make sure second lock waits" {
1432test "open file with exclusive nonblocking lock twice (absolute paths)" {1350test "open file with exclusive nonblocking lock twice (absolute paths)" {
1433 if (builtin.os.tag == .wasi) return error.SkipZigTest;1351 if (builtin.os.tag == .wasi) return error.SkipZigTest;
14341352
1435 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1436
1437 var random_bytes: [12]u8 = undefined;1353 var random_bytes: [12]u8 = undefined;
1438 std.crypto.random.bytes(&random_bytes);1354 std.crypto.random.bytes(&random_bytes);
14391355
...@@ -1468,8 +1384,6 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" {...@@ -1468,8 +1384,6 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" {
1468test "walker" {1384test "walker" {
1469 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;1385 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
14701386
1471 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1472
1473 var tmp = tmpIterableDir(.{});1387 var tmp = tmpIterableDir(.{});
1474 defer tmp.cleanup();1388 defer tmp.cleanup();
14751389
...@@ -1523,8 +1437,6 @@ test "walker" {...@@ -1523,8 +1437,6 @@ test "walker" {
1523test "walker without fully iterating" {1437test "walker without fully iterating" {
1524 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;1438 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
15251439
1526 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1527
1528 var tmp = tmpIterableDir(.{});1440 var tmp = tmpIterableDir(.{});
1529 defer tmp.cleanup();1441 defer tmp.cleanup();
15301442
...@@ -1637,8 +1549,6 @@ test "chmod" {...@@ -1637,8 +1549,6 @@ test "chmod" {
1637 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)1549 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
1638 return error.SkipZigTest;1550 return error.SkipZigTest;
16391551
1640 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1641
1642 var tmp = tmpDir(.{});1552 var tmp = tmpDir(.{});
1643 defer tmp.cleanup();1553 defer tmp.cleanup();
16441554
...@@ -1661,8 +1571,6 @@ test "chown" {...@@ -1661,8 +1571,6 @@ test "chown" {
1661 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)1571 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
1662 return error.SkipZigTest;1572 return error.SkipZigTest;
16631573
1664 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1665
1666 var tmp = tmpDir(.{});1574 var tmp = tmpDir(.{});
1667 defer tmp.cleanup();1575 defer tmp.cleanup();
16681576
...@@ -1678,8 +1586,6 @@ test "chown" {...@@ -1678,8 +1586,6 @@ test "chown" {
1678}1586}
16791587
1680test "File.Metadata" {1588test "File.Metadata" {
1681 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1682
1683 var tmp = tmpDir(.{});1589 var tmp = tmpDir(.{});
1684 defer tmp.cleanup();1590 defer tmp.cleanup();
16851591
...@@ -1763,8 +1669,6 @@ test "delete a read-only file on windows" {...@@ -1763,8 +1669,6 @@ test "delete a read-only file on windows" {
1763 if (builtin.os.tag != .windows)1669 if (builtin.os.tag != .windows)
1764 return error.SkipZigTest;1670 return error.SkipZigTest;
17651671
1766 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1767
1768 var tmp = testing.tmpDir(.{});1672 var tmp = testing.tmpDir(.{});
1769 defer tmp.cleanup();1673 defer tmp.cleanup();
17701674
...@@ -1795,8 +1699,6 @@ test "delete a read-only file on windows" {...@@ -1795,8 +1699,6 @@ test "delete a read-only file on windows" {
1795test "delete a setAsCwd directory on Windows" {1699test "delete a setAsCwd directory on Windows" {
1796 if (builtin.os.tag != .windows) return error.SkipZigTest;1700 if (builtin.os.tag != .windows) return error.SkipZigTest;
17971701
1798 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1799
1800 var tmp = tmpDir(.{});1702 var tmp = tmpDir(.{});
1801 // Set tmp dir as current working directory.1703 // Set tmp dir as current working directory.
1802 try tmp.dir.setAsCwd();1704 try tmp.dir.setAsCwd();
lib/std/hash/xxhash.zig-12
...@@ -862,8 +862,6 @@ test "xxhash3 iterative api" {...@@ -862,8 +862,6 @@ test "xxhash3 iterative api" {
862}862}
863863
864test "xxhash64" {864test "xxhash64" {
865 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
866
867 const H = XxHash64;865 const H = XxHash64;
868 try testExpect(H, 0, "", 0xef46db3751d8e999);866 try testExpect(H, 0, "", 0xef46db3751d8e999);
869 try testExpect(H, 0, "a", 0xd24ec4f1a98c6e5b);867 try testExpect(H, 0, "a", 0xd24ec4f1a98c6e5b);
...@@ -875,8 +873,6 @@ test "xxhash64" {...@@ -875,8 +873,6 @@ test "xxhash64" {
875}873}
876874
877test "xxhash64 smhasher" {875test "xxhash64 smhasher" {
878 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
879
880 const Test = struct {876 const Test = struct {
881 fn do() !void {877 fn do() !void {
882 try expectEqual(verify.smhasher(XxHash64.hash), 0x024B7CF4);878 try expectEqual(verify.smhasher(XxHash64.hash), 0x024B7CF4);
...@@ -888,8 +884,6 @@ test "xxhash64 smhasher" {...@@ -888,8 +884,6 @@ test "xxhash64 smhasher" {
888}884}
889885
890test "xxhash64 iterative api" {886test "xxhash64 iterative api" {
891 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
892
893 const Test = struct {887 const Test = struct {
894 fn do() !void {888 fn do() !void {
895 try verify.iterativeApi(XxHash64);889 try verify.iterativeApi(XxHash64);
...@@ -901,8 +895,6 @@ test "xxhash64 iterative api" {...@@ -901,8 +895,6 @@ test "xxhash64 iterative api" {
901}895}
902896
903test "xxhash32" {897test "xxhash32" {
904 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
905
906 const H = XxHash32;898 const H = XxHash32;
907899
908 try testExpect(H, 0, "", 0x02cc5d05);900 try testExpect(H, 0, "", 0x02cc5d05);
...@@ -915,8 +907,6 @@ test "xxhash32" {...@@ -915,8 +907,6 @@ test "xxhash32" {
915}907}
916908
917test "xxhash32 smhasher" {909test "xxhash32 smhasher" {
918 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
919
920 const Test = struct {910 const Test = struct {
921 fn do() !void {911 fn do() !void {
922 try expectEqual(verify.smhasher(XxHash32.hash), 0xBA88B743);912 try expectEqual(verify.smhasher(XxHash32.hash), 0xBA88B743);
...@@ -928,8 +918,6 @@ test "xxhash32 smhasher" {...@@ -928,8 +918,6 @@ test "xxhash32 smhasher" {
928}918}
929919
930test "xxhash32 iterative api" {920test "xxhash32 iterative api" {
931 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
932
933 const Test = struct {921 const Test = struct {
934 fn do() !void {922 fn do() !void {
935 try verify.iterativeApi(XxHash32);923 try verify.iterativeApi(XxHash32);
lib/std/hash_map.zig-2
...@@ -1873,8 +1873,6 @@ test "std.hash_map multiple removes on same metadata" {...@@ -1873,8 +1873,6 @@ test "std.hash_map multiple removes on same metadata" {
1873}1873}
18741874
1875test "std.hash_map put and remove loop in random order" {1875test "std.hash_map put and remove loop in random order" {
1876 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1877
1878 var map = AutoHashMap(u32, u32).init(std.testing.allocator);1876 var map = AutoHashMap(u32, u32).init(std.testing.allocator);
1879 defer map.deinit();1877 defer map.deinit();
18801878
lib/std/heap/general_purpose_allocator.zig-4
...@@ -1042,8 +1042,6 @@ const TraceKind = enum {...@@ -1042,8 +1042,6 @@ const TraceKind = enum {
1042const test_config = Config{};1042const test_config = Config{};
10431043
1044test "small allocations - free in same order" {1044test "small allocations - free in same order" {
1045 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1046
1047 var gpa = GeneralPurposeAllocator(test_config){};1045 var gpa = GeneralPurposeAllocator(test_config){};
1048 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");1046 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
1049 const allocator = gpa.allocator();1047 const allocator = gpa.allocator();
...@@ -1063,8 +1061,6 @@ test "small allocations - free in same order" {...@@ -1063,8 +1061,6 @@ test "small allocations - free in same order" {
1063}1061}
10641062
1065test "small allocations - free in reverse order" {1063test "small allocations - free in reverse order" {
1066 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1067
1068 var gpa = GeneralPurposeAllocator(test_config){};1064 var gpa = GeneralPurposeAllocator(test_config){};
1069 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");1065 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
1070 const allocator = gpa.allocator();1066 const allocator = gpa.allocator();
lib/std/http/Client.zig-2
...@@ -491,8 +491,6 @@ pub const Response = struct {...@@ -491,8 +491,6 @@ pub const Response = struct {
491 }491 }
492492
493 test parseInt3 {493 test parseInt3 {
494 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
495
496 const expectEqual = testing.expectEqual;494 const expectEqual = testing.expectEqual;
497 try expectEqual(@as(u10, 0), parseInt3("000".*));495 try expectEqual(@as(u10, 0), parseInt3("000".*));
498 try expectEqual(@as(u10, 418), parseInt3("418".*));496 try expectEqual(@as(u10, 418), parseInt3("418".*));
lib/std/io/multi_writer.zig-1
...@@ -36,7 +36,6 @@ pub fn multiWriter(streams: anytype) MultiWriter(@TypeOf(streams)) {...@@ -36,7 +36,6 @@ pub fn multiWriter(streams: anytype) MultiWriter(@TypeOf(streams)) {
36const testing = std.testing;36const testing = std.testing;
3737
38test "MultiWriter" {38test "MultiWriter" {
39 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
40 var tmp = testing.tmpDir(.{});39 var tmp = testing.tmpDir(.{});
41 defer tmp.cleanup();40 defer tmp.cleanup();
42 var f = try tmp.dir.createFile("t.txt", .{});41 var f = try tmp.dir.createFile("t.txt", .{});
lib/std/io/test.zig-6
...@@ -15,8 +15,6 @@ const native_endian = builtin.target.cpu.arch.endian();...@@ -15,8 +15,6 @@ const native_endian = builtin.target.cpu.arch.endian();
15const tmpDir = std.testing.tmpDir;15const tmpDir = std.testing.tmpDir;
1616
17test "write a file, read it, then delete it" {17test "write a file, read it, then delete it" {
18 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
19
20 var tmp = tmpDir(.{});18 var tmp = tmpDir(.{});
21 defer tmp.cleanup();19 defer tmp.cleanup();
2220
...@@ -110,8 +108,6 @@ test "BitStreams with File Stream" {...@@ -110,8 +108,6 @@ test "BitStreams with File Stream" {
110}108}
111109
112test "File seek ops" {110test "File seek ops" {
113 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
114
115 var tmp = tmpDir(.{});111 var tmp = tmpDir(.{});
116 defer tmp.cleanup();112 defer tmp.cleanup();
117113
...@@ -139,8 +135,6 @@ test "File seek ops" {...@@ -139,8 +135,6 @@ test "File seek ops" {
139}135}
140136
141test "setEndPos" {137test "setEndPos" {
142 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
143
144 var tmp = tmpDir(.{});138 var tmp = tmpDir(.{});
145 defer tmp.cleanup();139 defer tmp.cleanup();
146140
lib/std/json.zig-4
...@@ -38,8 +38,6 @@ test parseFromSlice {...@@ -38,8 +38,6 @@ test parseFromSlice {
38}38}
3939
40test Value {40test Value {
41 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
42
43 var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});41 var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});
44 defer parsed.deinit();42 defer parsed.deinit();
45 try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);43 try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);
...@@ -65,8 +63,6 @@ test writeStream {...@@ -65,8 +63,6 @@ test writeStream {
65}63}
6664
67test stringify {65test stringify {
68 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
70 var out = ArrayList(u8).init(testing.allocator);66 var out = ArrayList(u8).init(testing.allocator);
71 defer out.deinit();67 defer out.deinit();
7268
lib/std/json/JSONTestSuite_test.zig-66
...@@ -104,8 +104,6 @@ test "i_string_utf16LE_no_BOM.json" {...@@ -104,8 +104,6 @@ test "i_string_utf16LE_no_BOM.json" {
104 try any("[\x00\"\x00\xe9\x00\"\x00]\x00");104 try any("[\x00\"\x00\xe9\x00\"\x00]\x00");
105}105}
106test "i_structure_500_nested_arrays.json" {106test "i_structure_500_nested_arrays.json" {
107 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
108
109 try any("[" ** 500 ++ "]" ** 500);107 try any("[" ** 500 ++ "]" ** 500);
110}108}
111test "i_structure_UTF-8_BOM_empty_object.json" {109test "i_structure_UTF-8_BOM_empty_object.json" {
...@@ -361,21 +359,15 @@ test "n_object_bracket_key.json" {...@@ -361,21 +359,15 @@ test "n_object_bracket_key.json" {
361 try err("{[: \"x\"}\n");359 try err("{[: \"x\"}\n");
362}360}
363test "n_object_comma_instead_of_colon.json" {361test "n_object_comma_instead_of_colon.json" {
364 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
365
366 try err("{\"x\", null}");362 try err("{\"x\", null}");
367}363}
368test "n_object_double_colon.json" {364test "n_object_double_colon.json" {
369 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
370
371 try err("{\"x\"::\"b\"}");365 try err("{\"x\"::\"b\"}");
372}366}
373test "n_object_emoji.json" {367test "n_object_emoji.json" {
374 try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");368 try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");
375}369}
376test "n_object_garbage_at_end.json" {370test "n_object_garbage_at_end.json" {
377 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
378
379 try err("{\"a\":\"a\" 123}");371 try err("{\"a\":\"a\" 123}");
380}372}
381test "n_object_key_with_single_quotes.json" {373test "n_object_key_with_single_quotes.json" {
...@@ -385,26 +377,18 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {...@@ -385,26 +377,18 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {
385 try err("{\"\xb9\":\"0\",}");377 try err("{\"\xb9\":\"0\",}");
386}378}
387test "n_object_missing_colon.json" {379test "n_object_missing_colon.json" {
388 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
390 try err("{\"a\" b}");380 try err("{\"a\" b}");
391}381}
392test "n_object_missing_key.json" {382test "n_object_missing_key.json" {
393 try err("{:\"b\"}");383 try err("{:\"b\"}");
394}384}
395test "n_object_missing_semicolon.json" {385test "n_object_missing_semicolon.json" {
396 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
397
398 try err("{\"a\" \"b\"}");386 try err("{\"a\" \"b\"}");
399}387}
400test "n_object_missing_value.json" {388test "n_object_missing_value.json" {
401 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
402
403 try err("{\"a\":");389 try err("{\"a\":");
404}390}
405test "n_object_no-colon.json" {391test "n_object_no-colon.json" {
406 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
407
408 try err("{\"a\"");392 try err("{\"a\"");
409}393}
410test "n_object_non_string_key.json" {394test "n_object_non_string_key.json" {
...@@ -417,59 +401,39 @@ test "n_object_repeated_null_null.json" {...@@ -417,59 +401,39 @@ test "n_object_repeated_null_null.json" {
417 try err("{null:null,null:null}");401 try err("{null:null,null:null}");
418}402}
419test "n_object_several_trailing_commas.json" {403test "n_object_several_trailing_commas.json" {
420 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
421
422 try err("{\"id\":0,,,,,}");404 try err("{\"id\":0,,,,,}");
423}405}
424test "n_object_single_quote.json" {406test "n_object_single_quote.json" {
425 try err("{'a':0}");407 try err("{'a':0}");
426}408}
427test "n_object_trailing_comma.json" {409test "n_object_trailing_comma.json" {
428 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
429
430 try err("{\"id\":0,}");410 try err("{\"id\":0,}");
431}411}
432test "n_object_trailing_comment.json" {412test "n_object_trailing_comment.json" {
433 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
434
435 try err("{\"a\":\"b\"}/**/");413 try err("{\"a\":\"b\"}/**/");
436}414}
437test "n_object_trailing_comment_open.json" {415test "n_object_trailing_comment_open.json" {
438 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
439
440 try err("{\"a\":\"b\"}/**//");416 try err("{\"a\":\"b\"}/**//");
441}417}
442test "n_object_trailing_comment_slash_open.json" {418test "n_object_trailing_comment_slash_open.json" {
443 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
444
445 try err("{\"a\":\"b\"}//");419 try err("{\"a\":\"b\"}//");
446}420}
447test "n_object_trailing_comment_slash_open_incomplete.json" {421test "n_object_trailing_comment_slash_open_incomplete.json" {
448 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
449
450 try err("{\"a\":\"b\"}/");422 try err("{\"a\":\"b\"}/");
451}423}
452test "n_object_two_commas_in_a_row.json" {424test "n_object_two_commas_in_a_row.json" {
453 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
454
455 try err("{\"a\":\"b\",,\"c\":\"d\"}");425 try err("{\"a\":\"b\",,\"c\":\"d\"}");
456}426}
457test "n_object_unquoted_key.json" {427test "n_object_unquoted_key.json" {
458 try err("{a: \"b\"}");428 try err("{a: \"b\"}");
459}429}
460test "n_object_unterminated-value.json" {430test "n_object_unterminated-value.json" {
461 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
462
463 try err("{\"a\":\"a");431 try err("{\"a\":\"a");
464}432}
465test "n_object_with_single_string.json" {433test "n_object_with_single_string.json" {
466 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
467
468 try err("{ \"foo\" : \"bar\", \"a\" }");434 try err("{ \"foo\" : \"bar\", \"a\" }");
469}435}
470test "n_object_with_trailing_garbage.json" {436test "n_object_with_trailing_garbage.json" {
471 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
472
473 try err("{\"a\":\"b\"}#");437 try err("{\"a\":\"b\"}#");
474}438}
475test "n_single_space.json" {439test "n_single_space.json" {
...@@ -596,8 +560,6 @@ test "n_structure_close_unopened_array.json" {...@@ -596,8 +560,6 @@ test "n_structure_close_unopened_array.json" {
596 try err("1]");560 try err("1]");
597}561}
598test "n_structure_comma_instead_of_closing_brace.json" {562test "n_structure_comma_instead_of_closing_brace.json" {
599 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
600
601 try err("{\"x\": true,");563 try err("{\"x\": true,");
602}564}
603test "n_structure_double_array.json" {565test "n_structure_double_array.json" {
...@@ -628,18 +590,12 @@ test "n_structure_object_followed_by_closing_object.json" {...@@ -628,18 +590,12 @@ test "n_structure_object_followed_by_closing_object.json" {
628 try err("{}}");590 try err("{}}");
629}591}
630test "n_structure_object_unclosed_no_value.json" {592test "n_structure_object_unclosed_no_value.json" {
631 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
632
633 try err("{\"\":");593 try err("{\"\":");
634}594}
635test "n_structure_object_with_comment.json" {595test "n_structure_object_with_comment.json" {
636 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
637
638 try err("{\"a\":/*comment*/\"b\"}");596 try err("{\"a\":/*comment*/\"b\"}");
639}597}
640test "n_structure_object_with_trailing_garbage.json" {598test "n_structure_object_with_trailing_garbage.json" {
641 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
642
643 try err("{\"a\": true} \"x\"");599 try err("{\"a\": true} \"x\"");
644}600}
645test "n_structure_open_array_apostrophe.json" {601test "n_structure_open_array_apostrophe.json" {
...@@ -649,8 +605,6 @@ test "n_structure_open_array_comma.json" {...@@ -649,8 +605,6 @@ test "n_structure_open_array_comma.json" {
649 try err("[,");605 try err("[,");
650}606}
651test "n_structure_open_array_object.json" {607test "n_structure_open_array_object.json" {
652 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654 try err("[{\"\":" ** 50000 ++ "\n");608 try err("[{\"\":" ** 50000 ++ "\n");
655}609}
656test "n_structure_open_array_open_object.json" {610test "n_structure_open_array_open_object.json" {
...@@ -690,8 +644,6 @@ test "n_structure_single_star.json" {...@@ -690,8 +644,6 @@ test "n_structure_single_star.json" {
690 try err("*");644 try err("*");
691}645}
692test "n_structure_trailing_#.json" {646test "n_structure_trailing_#.json" {
693 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
694
695 try err("{\"a\":\"b\"}#{}");647 try err("{\"a\":\"b\"}#{}");
696}648}
697test "n_structure_uescaped_LF_before_string.json" {649test "n_structure_uescaped_LF_before_string.json" {
...@@ -710,8 +662,6 @@ test "n_structure_unclosed_array_unfinished_true.json" {...@@ -710,8 +662,6 @@ test "n_structure_unclosed_array_unfinished_true.json" {
710 try err("[ false, tru");662 try err("[ false, tru");
711}663}
712test "n_structure_unclosed_object.json" {664test "n_structure_unclosed_object.json" {
713 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
714
715 try err("{\"asd\":\"asd\"");665 try err("{\"asd\":\"asd\"");
716}666}
717test "n_structure_unicode-identifier.json" {667test "n_structure_unicode-identifier.json" {
...@@ -819,31 +769,21 @@ test "y_object.json" {...@@ -819,31 +769,21 @@ test "y_object.json" {
819 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");769 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
820}770}
821test "y_object_basic.json" {771test "y_object_basic.json" {
822 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
823
824 try ok("{\"asd\":\"sdf\"}");772 try ok("{\"asd\":\"sdf\"}");
825}773}
826test "y_object_duplicated_key.json" {774test "y_object_duplicated_key.json" {
827 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
828
829 try ok("{\"a\":\"b\",\"a\":\"c\"}");775 try ok("{\"a\":\"b\",\"a\":\"c\"}");
830}776}
831test "y_object_duplicated_key_and_value.json" {777test "y_object_duplicated_key_and_value.json" {
832 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
833
834 try ok("{\"a\":\"b\",\"a\":\"b\"}");778 try ok("{\"a\":\"b\",\"a\":\"b\"}");
835}779}
836test "y_object_empty.json" {780test "y_object_empty.json" {
837 try ok("{}");781 try ok("{}");
838}782}
839test "y_object_empty_key.json" {783test "y_object_empty_key.json" {
840 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
841
842 try ok("{\"\":0}");784 try ok("{\"\":0}");
843}785}
844test "y_object_escaped_null_in_key.json" {786test "y_object_escaped_null_in_key.json" {
845 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
846
847 try ok("{\"foo\\u0000bar\": 42}");787 try ok("{\"foo\\u0000bar\": 42}");
848}788}
849test "y_object_extreme_numbers.json" {789test "y_object_extreme_numbers.json" {
...@@ -857,18 +797,12 @@ test "y_object_long_strings.json" {...@@ -857,18 +797,12 @@ test "y_object_long_strings.json" {
857 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");797 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
858}798}
859test "y_object_simple.json" {799test "y_object_simple.json" {
860 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
861
862 try ok("{\"a\":[]}");800 try ok("{\"a\":[]}");
863}801}
864test "y_object_string_unicode.json" {802test "y_object_string_unicode.json" {
865 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
866
867 try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");803 try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");
868}804}
869test "y_object_with_newlines.json" {805test "y_object_with_newlines.json" {
870 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
871
872 try ok("{\n\"a\": \"b\"\n}");806 try ok("{\n\"a\": \"b\"\n}");
873}807}
874test "y_string_1_2_3_bytes_UTF-8_sequences.json" {808test "y_string_1_2_3_bytes_UTF-8_sequences.json" {
lib/std/json/dynamic_test.zig-12
...@@ -125,16 +125,12 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value {...@@ -125,16 +125,12 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value {
125}125}
126126
127test "parsing empty string gives appropriate error" {127test "parsing empty string gives appropriate error" {
128 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
129
130 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);128 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
131 defer arena_allocator.deinit();129 defer arena_allocator.deinit();
132 try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));130 try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));
133}131}
134132
135test "Value.array allocator should still be usable after parsing" {133test "Value.array allocator should still be usable after parsing" {
136 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
137
138 var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});134 var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});
139 defer parsed.deinit();135 defer parsed.deinit();
140136
...@@ -195,8 +191,6 @@ test "escaped characters" {...@@ -195,8 +191,6 @@ test "escaped characters" {
195}191}
196192
197test "Value.jsonStringify" {193test "Value.jsonStringify" {
198 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
199
200 var vals = [_]Value{194 var vals = [_]Value{
201 .{ .integer = 1 },195 .{ .integer = 1 },
202 .{ .integer = 2 },196 .{ .integer = 2 },
...@@ -263,8 +257,6 @@ test "parseFromValue(std.json.Value,...)" {...@@ -263,8 +257,6 @@ test "parseFromValue(std.json.Value,...)" {
263}257}
264258
265test "polymorphic parsing" {259test "polymorphic parsing" {
266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
267
268 if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108260 if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108
269 const doc =261 const doc =
270 \\{ "type": "div",262 \\{ "type": "div",
...@@ -310,8 +302,6 @@ test "polymorphic parsing" {...@@ -310,8 +302,6 @@ test "polymorphic parsing" {
310}302}
311303
312test "long object value" {304test "long object value" {
313 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
314
315 const value = "01234567890123456789";305 const value = "01234567890123456789";
316 const doc = "{\"key\":\"" ++ value ++ "\"}";306 const doc = "{\"key\":\"" ++ value ++ "\"}";
317 var fbs = std.io.fixedBufferStream(doc);307 var fbs = std.io.fixedBufferStream(doc);
...@@ -324,8 +314,6 @@ test "long object value" {...@@ -324,8 +314,6 @@ test "long object value" {
324}314}
325315
326test "ParseOptions.max_value_len" {316test "ParseOptions.max_value_len" {
327 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
328
329 var arena = ArenaAllocator.init(testing.allocator);317 var arena = ArenaAllocator.init(testing.allocator);
330 defer arena.deinit();318 defer arena.deinit();
331319
lib/std/json/static_test.zig-6
...@@ -392,8 +392,6 @@ test "parse" {...@@ -392,8 +392,6 @@ test "parse" {
392}392}
393393
394test "parse into enum" {394test "parse into enum" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
397 const T = enum(u32) {395 const T = enum(u32) {
398 Foo = 42,396 Foo = 42,
399 Bar,397 Bar,
...@@ -478,8 +476,6 @@ test "parse into tagged union errors" {...@@ -478,8 +476,6 @@ test "parse into tagged union errors" {
478}476}
479477
480test "parse into struct with no fields" {478test "parse into struct with no fields" {
481 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
482
483 const T = struct {};479 const T = struct {};
484 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});480 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
485 defer parsed.deinit();481 defer parsed.deinit();
...@@ -949,8 +945,6 @@ test "json parse allocate when streaming" {...@@ -949,8 +945,6 @@ test "json parse allocate when streaming" {
949}945}
950946
951test "parse at comptime" {947test "parse at comptime" {
952 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
953
954 const doc =948 const doc =
955 \\{949 \\{
956 \\ "vals": {950 \\ "vals": {
lib/std/json/stringify_test.zig-36
...@@ -100,8 +100,6 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {...@@ -100,8 +100,6 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {
100}100}
101101
102test "stringify null optional fields" {102test "stringify null optional fields" {
103 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
104
105 const MyStruct = struct {103 const MyStruct = struct {
106 optional: ?[]const u8 = null,104 optional: ?[]const u8 = null,
107 required: []const u8 = "something",105 required: []const u8 = "something",
...@@ -123,8 +121,6 @@ test "stringify null optional fields" {...@@ -123,8 +121,6 @@ test "stringify null optional fields" {
123}121}
124122
125test "stringify basic types" {123test "stringify basic types" {
126 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
127
128 try testStringify("false", false, .{});124 try testStringify("false", false, .{});
129 try testStringify("true", true, .{});125 try testStringify("true", true, .{});
130 try testStringify("null", @as(?u8, null), .{});126 try testStringify("null", @as(?u8, null), .{});
...@@ -141,8 +137,6 @@ test "stringify basic types" {...@@ -141,8 +137,6 @@ test "stringify basic types" {
141}137}
142138
143test "stringify string" {139test "stringify string" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
146 try testStringify("\"hello\"", "hello", .{});140 try testStringify("\"hello\"", "hello", .{});
147 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});141 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});
148 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });142 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });
...@@ -167,16 +161,12 @@ test "stringify string" {...@@ -167,16 +161,12 @@ test "stringify string" {
167}161}
168162
169test "stringify many-item sentinel-terminated string" {163test "stringify many-item sentinel-terminated string" {
170 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
171
172 try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});164 try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});
173 try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });165 try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });
174 try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });166 try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });
175}167}
176168
177test "stringify enums" {169test "stringify enums" {
178 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
179
180 const E = enum {170 const E = enum {
181 foo,171 foo,
182 bar,172 bar,
...@@ -186,15 +176,11 @@ test "stringify enums" {...@@ -186,15 +176,11 @@ test "stringify enums" {
186}176}
187177
188test "stringify enum literals" {178test "stringify enum literals" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
191 try testStringify("\"foo\"", .foo, .{});179 try testStringify("\"foo\"", .foo, .{});
192 try testStringify("\"bar\"", .bar, .{});180 try testStringify("\"bar\"", .bar, .{});
193}181}
194182
195test "stringify tagged unions" {183test "stringify tagged unions" {
196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
197
198 const T = union(enum) {184 const T = union(enum) {
199 nothing,185 nothing,
200 foo: u32,186 foo: u32,
...@@ -206,8 +192,6 @@ test "stringify tagged unions" {...@@ -206,8 +192,6 @@ test "stringify tagged unions" {
206}192}
207193
208test "stringify struct" {194test "stringify struct" {
209 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
210
211 try testStringify("{\"foo\":42}", struct {195 try testStringify("{\"foo\":42}", struct {
212 foo: u32,196 foo: u32,
213 }{ .foo = 42 }, .{});197 }{ .foo = 42 }, .{});
...@@ -230,8 +214,6 @@ test "emit_strings_as_arrays" {...@@ -230,8 +214,6 @@ test "emit_strings_as_arrays" {
230}214}
231215
232test "stringify struct with indentation" {216test "stringify struct with indentation" {
233 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
234
235 try testStringify(217 try testStringify(
236 \\{218 \\{
237 \\ "foo": 42,219 \\ "foo": 42,
...@@ -277,8 +259,6 @@ test "stringify struct with indentation" {...@@ -277,8 +259,6 @@ test "stringify struct with indentation" {
277}259}
278260
279test "stringify struct with void field" {261test "stringify struct with void field" {
280 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
281
282 try testStringify("{\"foo\":42}", struct {262 try testStringify("{\"foo\":42}", struct {
283 foo: u32,263 foo: u32,
284 bar: void = {},264 bar: void = {},
...@@ -286,8 +266,6 @@ test "stringify struct with void field" {...@@ -286,8 +266,6 @@ test "stringify struct with void field" {
286}266}
287267
288test "stringify array of structs" {268test "stringify array of structs" {
289 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
290
291 const MyStruct = struct {269 const MyStruct = struct {
292 foo: u32,270 foo: u32,
293 };271 };
...@@ -299,8 +277,6 @@ test "stringify array of structs" {...@@ -299,8 +277,6 @@ test "stringify array of structs" {
299}277}
300278
301test "stringify struct with custom stringifier" {279test "stringify struct with custom stringifier" {
302 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
303
304 try testStringify("[\"something special\",42]", struct {280 try testStringify("[\"something special\",42]", struct {
305 foo: u32,281 foo: u32,
306 const Self = @This();282 const Self = @This();
...@@ -315,16 +291,12 @@ test "stringify struct with custom stringifier" {...@@ -315,16 +291,12 @@ test "stringify struct with custom stringifier" {
315}291}
316292
317test "stringify vector" {293test "stringify vector" {
318 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
319
320 try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});294 try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});
321 try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});295 try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});
322 try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });296 try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });
323}297}
324298
325test "stringify tuple" {299test "stringify tuple" {
326 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
327
328 try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});300 try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});
329}301}
330302
...@@ -411,8 +383,6 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St...@@ -411,8 +383,6 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St
411}383}
412384
413test "stringify alloc" {385test "stringify alloc" {
414 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
415
416 const allocator = std.testing.allocator;386 const allocator = std.testing.allocator;
417 const expected =387 const expected =
418 \\{"foo":"bar","answer":42,"my_friend":"sammy"}388 \\{"foo":"bar","answer":42,"my_friend":"sammy"}
...@@ -424,8 +394,6 @@ test "stringify alloc" {...@@ -424,8 +394,6 @@ test "stringify alloc" {
424}394}
425395
426test "comptime stringify" {396test "comptime stringify" {
427 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
428
429 comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;397 comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;
430 comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;398 comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;
431 comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;399 comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;
...@@ -446,8 +414,6 @@ test "comptime stringify" {...@@ -446,8 +414,6 @@ test "comptime stringify" {
446}414}
447415
448test "print" {416test "print" {
449 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
450
451 var out_buf: [1024]u8 = undefined;417 var out_buf: [1024]u8 = undefined;
452 var slice_stream = std.io.fixedBufferStream(&out_buf);418 var slice_stream = std.io.fixedBufferStream(&out_buf);
453 const out = slice_stream.writer();419 const out = slice_stream.writer();
...@@ -479,8 +445,6 @@ test "print" {...@@ -479,8 +445,6 @@ test "print" {
479}445}
480446
481test "nonportable numbers" {447test "nonportable numbers" {
482 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
483
484 try testStringify("9999999999999999", 9999999999999999, .{});448 try testStringify("9999999999999999", 9999999999999999, .{});
485 try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });449 try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });
486}450}
lib/std/json/test.zig+1-4
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const testing = std.testing;2const testing = std.testing;
4const parseFromSlice = @import("./static.zig").parseFromSlice;3const parseFromSlice = @import("./static.zig").parseFromSlice;
5const validate = @import("./scanner.zig").validate;4const validate = @import("./scanner.zig").validate;
...@@ -35,15 +34,13 @@ fn testHighLevelDynamicParser(s: []const u8) !void {...@@ -35,15 +34,13 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
3534
36// Additional tests not part of test JSONTestSuite.35// Additional tests not part of test JSONTestSuite.
37test "y_trailing_comma_after_empty" {36test "y_trailing_comma_after_empty" {
38 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;37 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3938
40 try roundTrip(39 try roundTrip(
41 \\{"1":[],"2":{},"3":"4"}40 \\{"1":[],"2":{},"3":"4"}
42 );41 );
43}42}
44test "n_object_closed_missing_value" {43test "n_object_closed_missing_value" {
45 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
46
47 try err(44 try err(
48 \\{"a":}45 \\{"a":}
49 );46 );
lib/std/math.zig+2-2
...@@ -903,12 +903,12 @@ pub fn mod(comptime T: type, numerator: T, denominator: T) !T {...@@ -903,12 +903,12 @@ pub fn mod(comptime T: type, numerator: T, denominator: T) !T {
903}903}
904904
905test "mod" {905test "mod" {
906 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
907
906 try testMod();908 try testMod();
907 try comptime testMod();909 try comptime testMod();
908}910}
909fn testMod() !void {911fn testMod() !void {
910 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
911
912 try testing.expect((mod(i32, -5, 3) catch unreachable) == 1);912 try testing.expect((mod(i32, -5, 3) catch unreachable) == 1);
913 try testing.expect((mod(i32, 5, 3) catch unreachable) == 2);913 try testing.expect((mod(i32, 5, 3) catch unreachable) == 2);
914 try testing.expectError(error.NegativeDenominator, mod(i32, 10, -1));914 try testing.expectError(error.NegativeDenominator, mod(i32, 10, -1));
lib/std/math/big/int_test.zig+5-51
...@@ -71,8 +71,6 @@ test "big.int set negative minimum" {...@@ -71,8 +71,6 @@ test "big.int set negative minimum" {
71}71}
7272
73test "big.int set double-width maximum then zero" {73test "big.int set double-width maximum then zero" {
74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
75
76 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));74 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
77 defer a.deinit();75 defer a.deinit();
78 try a.set(@as(DoubleLimb, 0));76 try a.set(@as(DoubleLimb, 0));
...@@ -246,8 +244,6 @@ test "big.int fits" {...@@ -246,8 +244,6 @@ test "big.int fits" {
246}244}
247245
248test "big.int string set" {246test "big.int string set" {
249 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
250
251 var a = try Managed.init(testing.allocator);247 var a = try Managed.init(testing.allocator);
252 defer a.deinit();248 defer a.deinit();
253249
...@@ -264,8 +260,6 @@ test "big.int string negative" {...@@ -264,8 +260,6 @@ test "big.int string negative" {
264}260}
265261
266test "big.int string set number with underscores" {262test "big.int string set number with underscores" {
267 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
269 var a = try Managed.init(testing.allocator);263 var a = try Managed.init(testing.allocator);
270 defer a.deinit();264 defer a.deinit();
271265
...@@ -274,8 +268,6 @@ test "big.int string set number with underscores" {...@@ -274,8 +268,6 @@ test "big.int string set number with underscores" {
274}268}
275269
276test "big.int string set case insensitive number" {270test "big.int string set case insensitive number" {
277 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
278
279 var a = try Managed.init(testing.allocator);271 var a = try Managed.init(testing.allocator);
280 defer a.deinit();272 defer a.deinit();
281273
...@@ -326,8 +318,6 @@ test "big.int twos complement limit set" {...@@ -326,8 +318,6 @@ test "big.int twos complement limit set" {
326}318}
327319
328test "big.int string to" {320test "big.int string to" {
329 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
330
331 var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124);321 var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124);
332 defer a.deinit();322 defer a.deinit();
333323
...@@ -368,8 +358,6 @@ test "big.int string to base 16" {...@@ -368,8 +358,6 @@ test "big.int string to base 16" {
368}358}
369359
370test "big.int neg string to" {360test "big.int neg string to" {
371 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
372
373 var a = try Managed.initSet(testing.allocator, -123907434);361 var a = try Managed.initSet(testing.allocator, -123907434);
374 defer a.deinit();362 defer a.deinit();
375363
...@@ -392,8 +380,6 @@ test "big.int zero string to" {...@@ -392,8 +380,6 @@ test "big.int zero string to" {
392}380}
393381
394test "big.int clone" {382test "big.int clone" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
397 var a = try Managed.initSet(testing.allocator, 1234);383 var a = try Managed.initSet(testing.allocator, 1234);
398 defer a.deinit();384 defer a.deinit();
399 var b = try a.clone();385 var b = try a.clone();
...@@ -634,8 +620,6 @@ test "big.int addWrap single-single, unsigned" {...@@ -634,8 +620,6 @@ test "big.int addWrap single-single, unsigned" {
634}620}
635621
636test "big.int subWrap single-single, unsigned" {622test "big.int subWrap single-single, unsigned" {
637 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
638
639 var a = try Managed.initSet(testing.allocator, 0);623 var a = try Managed.initSet(testing.allocator, 0);
640 defer a.deinit();624 defer a.deinit();
641625
...@@ -963,8 +947,6 @@ test "big.int mul multi-multi" {...@@ -963,8 +947,6 @@ test "big.int mul multi-multi" {
963}947}
964948
965test "big.int mul alias r with a" {949test "big.int mul alias r with a" {
966 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
967
968 var a = try Managed.initSet(testing.allocator, maxInt(Limb));950 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
969 defer a.deinit();951 defer a.deinit();
970 var b = try Managed.initSet(testing.allocator, 2);952 var b = try Managed.initSet(testing.allocator, 2);
...@@ -976,8 +958,6 @@ test "big.int mul alias r with a" {...@@ -976,8 +958,6 @@ test "big.int mul alias r with a" {
976}958}
977959
978test "big.int mul alias r with b" {960test "big.int mul alias r with b" {
979 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
980
981 var a = try Managed.initSet(testing.allocator, maxInt(Limb));961 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
982 defer a.deinit();962 defer a.deinit();
983 var b = try Managed.initSet(testing.allocator, 2);963 var b = try Managed.initSet(testing.allocator, 2);
...@@ -989,8 +969,6 @@ test "big.int mul alias r with b" {...@@ -989,8 +969,6 @@ test "big.int mul alias r with b" {
989}969}
990970
991test "big.int mul alias r with a and b" {971test "big.int mul alias r with a and b" {
992 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
993
994 var a = try Managed.initSet(testing.allocator, maxInt(Limb));972 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
995 defer a.deinit();973 defer a.deinit();
996974
...@@ -1096,7 +1074,7 @@ test "big.int mulWrap multi-multi unsigned" {...@@ -1096,7 +1074,7 @@ test "big.int mulWrap multi-multi unsigned" {
10961074
1097test "big.int mulWrap multi-multi signed" {1075test "big.int mulWrap multi-multi signed" {
1098 switch (builtin.zig_backend) {1076 switch (builtin.zig_backend) {
1099 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,1077 .stage2_c => return error.SkipZigTest,
1100 else => {},1078 else => {},
1101 }1079 }
11021080
...@@ -1171,8 +1149,6 @@ test "big.int div single-half with rem" {...@@ -1171,8 +1149,6 @@ test "big.int div single-half with rem" {
1171}1149}
11721150
1173test "big.int div single-single no rem" {1151test "big.int div single-single no rem" {
1174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1175
1176 // assumes usize is <= 64 bits.1152 // assumes usize is <= 64 bits.
1177 var a = try Managed.initSet(testing.allocator, 1 << 52);1153 var a = try Managed.initSet(testing.allocator, 1 << 52);
1178 defer a.deinit();1154 defer a.deinit();
...@@ -1190,8 +1166,6 @@ test "big.int div single-single no rem" {...@@ -1190,8 +1166,6 @@ test "big.int div single-single no rem" {
1190}1166}
11911167
1192test "big.int div single-single with rem" {1168test "big.int div single-single with rem" {
1193 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1194
1195 var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33));1169 var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33));
1196 defer a.deinit();1170 defer a.deinit();
1197 var b = try Managed.initSet(testing.allocator, (1 << 35));1171 var b = try Managed.initSet(testing.allocator, (1 << 35));
...@@ -1271,8 +1245,6 @@ test "big.int div multi>2-single" {...@@ -1271,8 +1245,6 @@ test "big.int div multi>2-single" {
1271}1245}
12721246
1273test "big.int div single-single q < r" {1247test "big.int div single-single q < r" {
1274 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1275
1276 var a = try Managed.initSet(testing.allocator, 0x0078f432);1248 var a = try Managed.initSet(testing.allocator, 0x0078f432);
1277 defer a.deinit();1249 defer a.deinit();
1278 var b = try Managed.initSet(testing.allocator, 0x01000000);1250 var b = try Managed.initSet(testing.allocator, 0x01000000);
...@@ -1317,10 +1289,7 @@ test "big.int div q=0 alias" {...@@ -1317,10 +1289,7 @@ test "big.int div q=0 alias" {
1317}1289}
13181290
1319test "big.int div multi-multi q < r" {1291test "big.int div multi-multi q < r" {
1320 switch (builtin.zig_backend) {1292 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1321 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1322 else => {},
1323 }
13241293
1325 const op1 = 0x1ffffffff0078f432;1294 const op1 = 0x1ffffffff0078f432;
1326 const op2 = 0x1ffffffff01000000;1295 const op2 = 0x1ffffffff01000000;
...@@ -1642,8 +1611,6 @@ test "big.int div floor single-single -/-" {...@@ -1642,8 +1611,6 @@ test "big.int div floor single-single -/-" {
1642}1611}
16431612
1644test "big.int div floor no remainder negative quotient" {1613test "big.int div floor no remainder negative quotient" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
1647 const u: i32 = -0x80000000;1614 const u: i32 = -0x80000000;
1648 const v: i32 = 1;1615 const v: i32 = 1;
16491616
...@@ -1743,10 +1710,7 @@ test "big.int div multi-multi no rem" {...@@ -1743,10 +1710,7 @@ test "big.int div multi-multi no rem" {
1743}1710}
17441711
1745test "big.int div multi-multi (2 branch)" {1712test "big.int div multi-multi (2 branch)" {
1746 switch (builtin.zig_backend) {1713 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1747 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1748 else => {},
1749 }
17501714
1751 var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111);1715 var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111);
1752 defer a.deinit();1716 defer a.deinit();
...@@ -1785,10 +1749,7 @@ test "big.int div multi-multi (3.1/3.3 branch)" {...@@ -1785,10 +1749,7 @@ test "big.int div multi-multi (3.1/3.3 branch)" {
1785}1749}
17861750
1787test "big.int div multi-single zero-limb trailing" {1751test "big.int div multi-single zero-limb trailing" {
1788 switch (builtin.zig_backend) {1752 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1789 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1790 else => {},
1791 }
17921753
1793 var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000);1754 var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000);
1794 defer a.deinit();1755 defer a.deinit();
...@@ -1808,10 +1769,7 @@ test "big.int div multi-single zero-limb trailing" {...@@ -1808,10 +1769,7 @@ test "big.int div multi-single zero-limb trailing" {
1808}1769}
18091770
1810test "big.int div multi-multi zero-limb trailing (with rem)" {1771test "big.int div multi-multi zero-limb trailing (with rem)" {
1811 switch (builtin.zig_backend) {1772 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1812 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1813 else => {},
1814 }
18151773
1816 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);1774 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
1817 defer a.deinit();1775 defer a.deinit();
...@@ -1908,8 +1866,6 @@ test "big.int div multi-multi fuzz case #1" {...@@ -1908,8 +1866,6 @@ test "big.int div multi-multi fuzz case #1" {
1908}1866}
19091867
1910test "big.int div multi-multi fuzz case #2" {1868test "big.int div multi-multi fuzz case #2" {
1911 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1912
1913 var a = try Managed.init(testing.allocator);1869 var a = try Managed.init(testing.allocator);
1914 defer a.deinit();1870 defer a.deinit();
1915 var b = try Managed.init(testing.allocator);1871 var b = try Managed.init(testing.allocator);
...@@ -2672,8 +2628,6 @@ test "big.int mutable to managed" {...@@ -2672,8 +2628,6 @@ test "big.int mutable to managed" {
2672}2628}
26732629
2674test "big.int const to managed" {2630test "big.int const to managed" {
2675 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2676
2677 var a = try Managed.initSet(testing.allocator, 123423453456);2631 var a = try Managed.initSet(testing.allocator, 123423453456);
2678 defer a.deinit();2632 defer a.deinit();
26792633
lib/std/math/big/rational.zig-6
...@@ -494,8 +494,6 @@ fn extractLowBits(a: Int, comptime T: type) T {...@@ -494,8 +494,6 @@ fn extractLowBits(a: Int, comptime T: type) T {
494}494}
495495
496test "big.rational extractLowBits" {496test "big.rational extractLowBits" {
497 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
498
499 var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321);497 var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321);
500 defer a.deinit();498 defer a.deinit();
501499
...@@ -649,8 +647,6 @@ test "big.rational copy" {...@@ -649,8 +647,6 @@ test "big.rational copy" {
649}647}
650648
651test "big.rational negate" {649test "big.rational negate" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
654 var a = try Rational.init(testing.allocator);650 var a = try Rational.init(testing.allocator);
655 defer a.deinit();651 defer a.deinit();
656652
...@@ -668,8 +664,6 @@ test "big.rational negate" {...@@ -668,8 +664,6 @@ test "big.rational negate" {
668}664}
669665
670test "big.rational abs" {666test "big.rational abs" {
671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
672
673 var a = try Rational.init(testing.allocator);667 var a = try Rational.init(testing.allocator);
674 defer a.deinit();668 defer a.deinit();
675669
lib/std/math/ilogb.zig-6
...@@ -125,8 +125,6 @@ test "80" {...@@ -125,8 +125,6 @@ test "80" {
125}125}
126126
127test "128" {127test "128" {
128 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
129
130 try expect(ilogbX(f128, 0.0) == fp_ilogb0);128 try expect(ilogbX(f128, 0.0) == fp_ilogb0);
131 try expect(ilogbX(f128, 0.5) == -1);129 try expect(ilogbX(f128, 0.5) == -1);
132 try expect(ilogbX(f128, 0.8923) == -1);130 try expect(ilogbX(f128, 0.8923) == -1);
...@@ -162,8 +160,6 @@ test "64 special" {...@@ -162,8 +160,6 @@ test "64 special" {
162}160}
163161
164test "80 special" {162test "80 special" {
165 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
166
167 try expect(ilogbX(f80, math.inf(f80)) == maxInt(i32));163 try expect(ilogbX(f80, math.inf(f80)) == maxInt(i32));
168 try expect(ilogbX(f80, -math.inf(f80)) == maxInt(i32));164 try expect(ilogbX(f80, -math.inf(f80)) == maxInt(i32));
169 try expect(ilogbX(f80, 0.0) == minInt(i32));165 try expect(ilogbX(f80, 0.0) == minInt(i32));
...@@ -171,8 +167,6 @@ test "80 special" {...@@ -171,8 +167,6 @@ test "80 special" {
171}167}
172168
173test "128 special" {169test "128 special" {
174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
175
176 try expect(ilogbX(f128, math.inf(f128)) == maxInt(i32));170 try expect(ilogbX(f128, math.inf(f128)) == maxInt(i32));
177 try expect(ilogbX(f128, -math.inf(f128)) == maxInt(i32));171 try expect(ilogbX(f128, -math.inf(f128)) == maxInt(i32));
178 try expect(ilogbX(f128, 0.0) == minInt(i32));172 try expect(ilogbX(f128, 0.0) == minInt(i32));
lib/std/math/log10.zig-1
...@@ -147,7 +147,6 @@ test "oldlog10 doesn't work" {...@@ -147,7 +147,6 @@ test "oldlog10 doesn't work" {
147test "log10_int vs old implementation" {147test "log10_int vs old implementation" {
148 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO148 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
149 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO149 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
151 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO150 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
152 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO151 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
153 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO152 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
lib/std/math/log_int.zig-2
...@@ -56,8 +56,6 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) {...@@ -56,8 +56,6 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) {
56}56}
5757
58test "math.log_int" {58test "math.log_int" {
59 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
60
61 // Test all unsigned integers with 2, 3, ..., 64 bits.59 // Test all unsigned integers with 2, 3, ..., 64 bits.
62 // We cannot test 0 or 1 bits since base must be > 1.60 // We cannot test 0 or 1 bits since base must be > 1.
63 inline for (2..64 + 1) |bits| {61 inline for (2..64 + 1) |bits| {
lib/std/math/nextafter.zig+1-2
...@@ -1,4 +1,3 @@...@@ -1,4 +1,3 @@
1const builtin = @import("builtin");
2const std = @import("../std.zig");1const std = @import("../std.zig");
3const math = std.math;2const math = std.math;
4const assert = std.debug.assert;3const assert = std.debug.assert;
...@@ -103,7 +102,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {...@@ -103,7 +102,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {
103}102}
104103
105test "math.nextAfter.int" {104test "math.nextAfter.int" {
106 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;105 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
107106
108 try expect(nextAfter(i0, 0, 0) == 0);107 try expect(nextAfter(i0, 0, 0) == 0);
109 try expect(nextAfter(u0, 0, 0) == 0);108 try expect(nextAfter(u0, 0, 0) == 0);
lib/std/math/scalbn.zig-2
...@@ -7,8 +7,6 @@ const expect = std.testing.expect;...@@ -7,8 +7,6 @@ const expect = std.testing.expect;
7pub const scalbn = @import("ldexp.zig").ldexp;7pub const scalbn = @import("ldexp.zig").ldexp;
88
9test "math.scalbn" {9test "math.scalbn" {
10 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
11
12 // Verify we are using base 2.10 // Verify we are using base 2.
13 try expect(scalbn(@as(f16, 1.5), 4) == 24.0);11 try expect(scalbn(@as(f16, 1.5), 4) == 24.0);
14 try expect(scalbn(@as(f32, 1.5), 4) == 24.0);12 try expect(scalbn(@as(f32, 1.5), 4) == 24.0);
lib/std/mem.zig+2-8
...@@ -1741,8 +1741,6 @@ pub fn readIntSlice(comptime T: type, bytes: []const u8, endian: Endian) T {...@@ -1741,8 +1741,6 @@ pub fn readIntSlice(comptime T: type, bytes: []const u8, endian: Endian) T {
1741}1741}
17421742
1743test "comptime read/write int" {1743test "comptime read/write int" {
1744 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1745
1746 comptime {1744 comptime {
1747 var bytes: [2]u8 = undefined;1745 var bytes: [2]u8 = undefined;
1748 writeIntLittle(u16, &bytes, 0x1234);1746 writeIntLittle(u16, &bytes, 0x1234);
...@@ -2062,10 +2060,7 @@ pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value...@@ -2062,10 +2060,7 @@ pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value
2062}2060}
20632061
2064test "writeIntBig and writeIntLittle" {2062test "writeIntBig and writeIntLittle" {
2065 switch (builtin.zig_backend) {2063 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
2066 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
2067 else => {},
2068 }
20692064
2070 var buf0: [0]u8 = undefined;2065 var buf0: [0]u8 = undefined;
2071 var buf1: [1]u8 = undefined;2066 var buf1: [1]u8 = undefined;
...@@ -3309,8 +3304,6 @@ test "testStringEquality" {...@@ -3309,8 +3304,6 @@ test "testStringEquality" {
3309}3304}
33103305
3311test "testReadInt" {3306test "testReadInt" {
3312 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3313
3314 try testReadIntImpl();3307 try testReadIntImpl();
3315 try comptime testReadIntImpl();3308 try comptime testReadIntImpl();
3316}3309}
...@@ -4668,6 +4661,7 @@ test "read/write(Var)PackedInt" {...@@ -4668,6 +4661,7 @@ test "read/write(Var)PackedInt" {
4668 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,4661 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
4669 else => {},4662 else => {},
4670 }4663 }
4664
4671 switch (builtin.cpu.arch) {4665 switch (builtin.cpu.arch) {
4672 // This test generates too much code to execute on WASI.4666 // This test generates too much code to execute on WASI.
4673 // LLVM backend fails with "too many locals: locals exceed maximum"4667 // LLVM backend fails with "too many locals: locals exceed maximum"
lib/std/multi_array_list.zig-16
...@@ -583,8 +583,6 @@ pub fn MultiArrayList(comptime T: type) type {...@@ -583,8 +583,6 @@ pub fn MultiArrayList(comptime T: type) type {
583}583}
584584
585test "basic usage" {585test "basic usage" {
586 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
587
588 const ally = testing.allocator;586 const ally = testing.allocator;
589587
590 const Foo = struct {588 const Foo = struct {
...@@ -679,8 +677,6 @@ test "basic usage" {...@@ -679,8 +677,6 @@ test "basic usage" {
679// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes677// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes
680// function used the @reduce code path.678// function used the @reduce code path.
681test "regression test for @reduce bug" {679test "regression test for @reduce bug" {
682 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
683
684 const ally = testing.allocator;680 const ally = testing.allocator;
685 var list = MultiArrayList(struct {681 var list = MultiArrayList(struct {
686 tag: std.zig.Token.Tag,682 tag: std.zig.Token.Tag,
...@@ -758,8 +754,6 @@ test "regression test for @reduce bug" {...@@ -758,8 +754,6 @@ test "regression test for @reduce bug" {
758}754}
759755
760test "ensure capacity on empty list" {756test "ensure capacity on empty list" {
761 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
762
763 const ally = testing.allocator;757 const ally = testing.allocator;
764758
765 const Foo = struct {759 const Foo = struct {
...@@ -795,8 +789,6 @@ test "ensure capacity on empty list" {...@@ -795,8 +789,6 @@ test "ensure capacity on empty list" {
795}789}
796790
797test "insert elements" {791test "insert elements" {
798 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
799
800 const ally = testing.allocator;792 const ally = testing.allocator;
801793
802 const Foo = struct {794 const Foo = struct {
...@@ -816,8 +808,6 @@ test "insert elements" {...@@ -816,8 +808,6 @@ test "insert elements" {
816}808}
817809
818test "union" {810test "union" {
819 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
820
821 const ally = testing.allocator;811 const ally = testing.allocator;
822812
823 const Foo = union(enum) {813 const Foo = union(enum) {
...@@ -873,8 +863,6 @@ test "union" {...@@ -873,8 +863,6 @@ test "union" {
873}863}
874864
875test "sorting a span" {865test "sorting a span" {
876 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
877
878 var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{};866 var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{};
879 defer list.deinit(testing.allocator);867 defer list.deinit(testing.allocator);
880868
...@@ -915,8 +903,6 @@ test "sorting a span" {...@@ -915,8 +903,6 @@ test "sorting a span" {
915}903}
916904
917test "0 sized struct field" {905test "0 sized struct field" {
918 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
919
920 const ally = testing.allocator;906 const ally = testing.allocator;
921907
922 const Foo = struct {908 const Foo = struct {
...@@ -944,8 +930,6 @@ test "0 sized struct field" {...@@ -944,8 +930,6 @@ test "0 sized struct field" {
944}930}
945931
946test "0 sized struct" {932test "0 sized struct" {
947 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
948
949 const ally = testing.allocator;933 const ally = testing.allocator;
950934
951 const Foo = struct {935 const Foo = struct {
lib/std/net/test.zig+1-4
...@@ -109,9 +109,8 @@ test "parse and render UNIX addresses" {...@@ -109,9 +109,8 @@ test "parse and render UNIX addresses" {
109}109}
110110
111test "resolve DNS" {111test "resolve DNS" {
112 if (builtin.os.tag == .wasi) return error.SkipZigTest;
113
114 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
113 if (builtin.os.tag == .wasi) return error.SkipZigTest;
115114
116 if (builtin.os.tag == .windows) {115 if (builtin.os.tag == .windows) {
117 _ = try std.os.windows.WSAStartup(2, 2);116 _ = try std.os.windows.WSAStartup(2, 2);
...@@ -295,8 +294,6 @@ test "listen on a unix socket, send bytes, receive bytes" {...@@ -295,8 +294,6 @@ test "listen on a unix socket, send bytes, receive bytes" {
295 if (builtin.single_threaded) return error.SkipZigTest;294 if (builtin.single_threaded) return error.SkipZigTest;
296 if (!net.has_unix_sockets) return error.SkipZigTest;295 if (!net.has_unix_sockets) return error.SkipZigTest;
297296
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
300 if (builtin.os.tag == .windows) {297 if (builtin.os.tag == .windows) {
301 _ = try std.os.windows.WSAStartup(2, 2);298 _ = try std.os.windows.WSAStartup(2, 2);
302 }299 }
lib/std/os/linux/io_uring.zig-26
...@@ -1741,8 +1741,6 @@ test "readv" {...@@ -1741,8 +1741,6 @@ test "readv" {
1741test "writev/fsync/readv" {1741test "writev/fsync/readv" {
1742 if (builtin.os.tag != .linux) return error.SkipZigTest;1742 if (builtin.os.tag != .linux) return error.SkipZigTest;
17431743
1744 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1745
1746 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {1744 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {
1747 error.SystemOutdated => return error.SkipZigTest,1745 error.SystemOutdated => return error.SkipZigTest,
1748 error.PermissionDenied => return error.SkipZigTest,1746 error.PermissionDenied => return error.SkipZigTest,
...@@ -1813,8 +1811,6 @@ test "writev/fsync/readv" {...@@ -1813,8 +1811,6 @@ test "writev/fsync/readv" {
1813test "write/read" {1811test "write/read" {
1814 if (builtin.os.tag != .linux) return error.SkipZigTest;1812 if (builtin.os.tag != .linux) return error.SkipZigTest;
18151813
1816 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1817
1818 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {1814 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
1819 error.SystemOutdated => return error.SkipZigTest,1815 error.SystemOutdated => return error.SkipZigTest,
1820 error.PermissionDenied => return error.SkipZigTest,1816 error.PermissionDenied => return error.SkipZigTest,
...@@ -1862,8 +1858,6 @@ test "write/read" {...@@ -1862,8 +1858,6 @@ test "write/read" {
1862test "splice/read" {1858test "splice/read" {
1863 if (builtin.os.tag != .linux) return error.SkipZigTest;1859 if (builtin.os.tag != .linux) return error.SkipZigTest;
18641860
1865 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1866
1867 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {1861 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {
1868 error.SystemOutdated => return error.SkipZigTest,1862 error.SystemOutdated => return error.SkipZigTest,
1869 error.PermissionDenied => return error.SkipZigTest,1863 error.PermissionDenied => return error.SkipZigTest,
...@@ -1935,8 +1929,6 @@ test "splice/read" {...@@ -1935,8 +1929,6 @@ test "splice/read" {
1935test "write_fixed/read_fixed" {1929test "write_fixed/read_fixed" {
1936 if (builtin.os.tag != .linux) return error.SkipZigTest;1930 if (builtin.os.tag != .linux) return error.SkipZigTest;
19371931
1938 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1939
1940 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {1932 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
1941 error.SystemOutdated => return error.SkipZigTest,1933 error.SystemOutdated => return error.SkipZigTest,
1942 error.PermissionDenied => return error.SkipZigTest,1934 error.PermissionDenied => return error.SkipZigTest,
...@@ -2002,8 +1994,6 @@ test "write_fixed/read_fixed" {...@@ -2002,8 +1994,6 @@ test "write_fixed/read_fixed" {
2002test "openat" {1994test "openat" {
2003 if (builtin.os.tag != .linux) return error.SkipZigTest;1995 if (builtin.os.tag != .linux) return error.SkipZigTest;
20041996
2005 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2006
2007 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {1997 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2008 error.SystemOutdated => return error.SkipZigTest,1998 error.SystemOutdated => return error.SkipZigTest,
2009 error.PermissionDenied => return error.SkipZigTest,1999 error.PermissionDenied => return error.SkipZigTest,
...@@ -2055,8 +2045,6 @@ test "openat" {...@@ -2055,8 +2045,6 @@ test "openat" {
2055test "close" {2045test "close" {
2056 if (builtin.os.tag != .linux) return error.SkipZigTest;2046 if (builtin.os.tag != .linux) return error.SkipZigTest;
20572047
2058 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2059
2060 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2048 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2061 error.SystemOutdated => return error.SkipZigTest,2049 error.SystemOutdated => return error.SkipZigTest,
2062 error.PermissionDenied => return error.SkipZigTest,2050 error.PermissionDenied => return error.SkipZigTest,
...@@ -2392,8 +2380,6 @@ test "accept/connect/recv/link_timeout" {...@@ -2392,8 +2380,6 @@ test "accept/connect/recv/link_timeout" {
2392test "fallocate" {2380test "fallocate" {
2393 if (builtin.os.tag != .linux) return error.SkipZigTest;2381 if (builtin.os.tag != .linux) return error.SkipZigTest;
23942382
2395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2396
2397 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2383 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2398 error.SystemOutdated => return error.SkipZigTest,2384 error.SystemOutdated => return error.SkipZigTest,
2399 error.PermissionDenied => return error.SkipZigTest,2385 error.PermissionDenied => return error.SkipZigTest,
...@@ -2440,8 +2426,6 @@ test "fallocate" {...@@ -2440,8 +2426,6 @@ test "fallocate" {
2440test "statx" {2426test "statx" {
2441 if (builtin.os.tag != .linux) return error.SkipZigTest;2427 if (builtin.os.tag != .linux) return error.SkipZigTest;
24422428
2443 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2444
2445 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2429 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2446 error.SystemOutdated => return error.SkipZigTest,2430 error.SystemOutdated => return error.SkipZigTest,
2447 error.PermissionDenied => return error.SkipZigTest,2431 error.PermissionDenied => return error.SkipZigTest,
...@@ -2698,8 +2682,6 @@ test "shutdown" {...@@ -2698,8 +2682,6 @@ test "shutdown" {
2698test "renameat" {2682test "renameat" {
2699 if (builtin.os.tag != .linux) return error.SkipZigTest;2683 if (builtin.os.tag != .linux) return error.SkipZigTest;
27002684
2701 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2702
2703 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2685 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2704 error.SystemOutdated => return error.SkipZigTest,2686 error.SystemOutdated => return error.SkipZigTest,
2705 error.PermissionDenied => return error.SkipZigTest,2687 error.PermissionDenied => return error.SkipZigTest,
...@@ -2769,8 +2751,6 @@ test "renameat" {...@@ -2769,8 +2751,6 @@ test "renameat" {
2769test "unlinkat" {2751test "unlinkat" {
2770 if (builtin.os.tag != .linux) return error.SkipZigTest;2752 if (builtin.os.tag != .linux) return error.SkipZigTest;
27712753
2772 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2773
2774 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2754 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2775 error.SystemOutdated => return error.SkipZigTest,2755 error.SystemOutdated => return error.SkipZigTest,
2776 error.PermissionDenied => return error.SkipZigTest,2756 error.PermissionDenied => return error.SkipZigTest,
...@@ -2823,8 +2803,6 @@ test "unlinkat" {...@@ -2823,8 +2803,6 @@ test "unlinkat" {
2823test "mkdirat" {2803test "mkdirat" {
2824 if (builtin.os.tag != .linux) return error.SkipZigTest;2804 if (builtin.os.tag != .linux) return error.SkipZigTest;
28252805
2826 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2827
2828 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2806 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2829 error.SystemOutdated => return error.SkipZigTest,2807 error.SystemOutdated => return error.SkipZigTest,
2830 error.PermissionDenied => return error.SkipZigTest,2808 error.PermissionDenied => return error.SkipZigTest,
...@@ -2869,8 +2847,6 @@ test "mkdirat" {...@@ -2869,8 +2847,6 @@ test "mkdirat" {
2869test "symlinkat" {2847test "symlinkat" {
2870 if (builtin.os.tag != .linux) return error.SkipZigTest;2848 if (builtin.os.tag != .linux) return error.SkipZigTest;
28712849
2872 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2873
2874 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2850 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2875 error.SystemOutdated => return error.SkipZigTest,2851 error.SystemOutdated => return error.SkipZigTest,
2876 error.PermissionDenied => return error.SkipZigTest,2852 error.PermissionDenied => return error.SkipZigTest,
...@@ -2919,8 +2895,6 @@ test "symlinkat" {...@@ -2919,8 +2895,6 @@ test "symlinkat" {
2919test "linkat" {2895test "linkat" {
2920 if (builtin.os.tag != .linux) return error.SkipZigTest;2896 if (builtin.os.tag != .linux) return error.SkipZigTest;
29212897
2922 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2923
2924 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2898 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2925 error.SystemOutdated => return error.SkipZigTest,2899 error.SystemOutdated => return error.SkipZigTest,
2926 error.PermissionDenied => return error.SkipZigTest,2900 error.PermissionDenied => return error.SkipZigTest,
lib/std/os/linux/test.zig-6
...@@ -8,8 +8,6 @@ const expectEqual = std.testing.expectEqual;...@@ -8,8 +8,6 @@ const expectEqual = std.testing.expectEqual;
8const fs = std.fs;8const fs = std.fs;
99
10test "fallocate" {10test "fallocate" {
11 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
12
13 var tmp = std.testing.tmpDir(.{});11 var tmp = std.testing.tmpDir(.{});
14 defer tmp.cleanup();12 defer tmp.cleanup();
1513
...@@ -71,8 +69,6 @@ test "timer" {...@@ -71,8 +69,6 @@ test "timer" {
71}69}
7270
73test "statx" {71test "statx" {
74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
75
76 var tmp = std.testing.tmpDir(.{});72 var tmp = std.testing.tmpDir(.{});
77 defer tmp.cleanup();73 defer tmp.cleanup();
7874
...@@ -111,8 +107,6 @@ test "user and group ids" {...@@ -111,8 +107,6 @@ test "user and group ids" {
111}107}
112108
113test "fadvise" {109test "fadvise" {
114 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
115
116 var tmp = std.testing.tmpDir(.{});110 var tmp = std.testing.tmpDir(.{});
117 defer tmp.cleanup();111 defer tmp.cleanup();
118112
lib/std/os/test.zig-42
...@@ -88,8 +88,6 @@ test "chdir smoke test" {...@@ -88,8 +88,6 @@ test "chdir smoke test" {
88test "open smoke test" {88test "open smoke test" {
89 if (native_os == .wasi) return error.SkipZigTest;89 if (native_os == .wasi) return error.SkipZigTest;
9090
91 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
92
93 // TODO verify file attributes using `fstat`91 // TODO verify file attributes using `fstat`
9492
95 var tmp = tmpDir(.{});93 var tmp = tmpDir(.{});
...@@ -144,8 +142,6 @@ test "open smoke test" {...@@ -144,8 +142,6 @@ test "open smoke test" {
144test "openat smoke test" {142test "openat smoke test" {
145 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;143 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
146144
147 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
148
149 // TODO verify file attributes using `fstatat`145 // TODO verify file attributes using `fstatat`
150146
151 var tmp = tmpDir(.{});147 var tmp = tmpDir(.{});
...@@ -280,8 +276,6 @@ test "link with relative paths" {...@@ -280,8 +276,6 @@ test "link with relative paths" {
280test "linkat with different directories" {276test "linkat with different directories" {
281 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;277 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
282278
283 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
284
285 switch (native_os) {279 switch (native_os) {
286 .wasi, .linux, .solaris, .illumos => {},280 .wasi, .linux, .solaris, .illumos => {},
287 else => return error.SkipZigTest,281 else => return error.SkipZigTest,
...@@ -327,8 +321,6 @@ test "fstatat" {...@@ -327,8 +321,6 @@ test "fstatat" {
327 // enable when `fstat` and `fstatat` are implemented on Windows321 // enable when `fstat` and `fstatat` are implemented on Windows
328 if (native_os == .windows) return error.SkipZigTest;322 if (native_os == .windows) return error.SkipZigTest;
329323
330 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
331
332 var tmp = tmpDir(.{});324 var tmp = tmpDir(.{});
333 defer tmp.cleanup();325 defer tmp.cleanup();
334326
...@@ -348,8 +340,6 @@ test "fstatat" {...@@ -348,8 +340,6 @@ test "fstatat" {
348}340}
349341
350test "readlinkat" {342test "readlinkat" {
351 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
352
353 var tmp = tmpDir(.{});343 var tmp = tmpDir(.{});
354 defer tmp.cleanup();344 defer tmp.cleanup();
355345
...@@ -583,8 +573,6 @@ test "mmap" {...@@ -583,8 +573,6 @@ test "mmap" {
583 if (native_os == .windows or native_os == .wasi)573 if (native_os == .windows or native_os == .wasi)
584 return error.SkipZigTest;574 return error.SkipZigTest;
585575
586 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
587
588 var tmp = tmpDir(.{});576 var tmp = tmpDir(.{});
589 defer tmp.cleanup();577 defer tmp.cleanup();
590578
...@@ -695,8 +683,6 @@ test "fcntl" {...@@ -695,8 +683,6 @@ test "fcntl" {
695 if (native_os == .windows or native_os == .wasi)683 if (native_os == .windows or native_os == .wasi)
696 return error.SkipZigTest;684 return error.SkipZigTest;
697685
698 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
699
700 var tmp = tmpDir(.{});686 var tmp = tmpDir(.{});
701 defer tmp.cleanup();687 defer tmp.cleanup();
702688
...@@ -737,8 +723,6 @@ test "sync" {...@@ -737,8 +723,6 @@ test "sync" {
737 if (native_os != .linux)723 if (native_os != .linux)
738 return error.SkipZigTest;724 return error.SkipZigTest;
739725
740 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
741
742 var tmp = tmpDir(.{});726 var tmp = tmpDir(.{});
743 defer tmp.cleanup();727 defer tmp.cleanup();
744728
...@@ -759,8 +743,6 @@ test "fsync" {...@@ -759,8 +743,6 @@ test "fsync" {
759 else => return error.SkipZigTest,743 else => return error.SkipZigTest,
760 }744 }
761745
762 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
763
764 var tmp = tmpDir(.{});746 var tmp = tmpDir(.{});
765 defer tmp.cleanup();747 defer tmp.cleanup();
766748
...@@ -780,8 +762,6 @@ test "getrlimit and setrlimit" {...@@ -780,8 +762,6 @@ test "getrlimit and setrlimit" {
780 return error.SkipZigTest;762 return error.SkipZigTest;
781 }763 }
782764
783 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
784
785 inline for (std.meta.fields(os.rlimit_resource)) |field| {765 inline for (std.meta.fields(os.rlimit_resource)) |field| {
786 const resource = @as(os.rlimit_resource, @enumFromInt(field.value));766 const resource = @as(os.rlimit_resource, @enumFromInt(field.value));
787 const limit = try os.getrlimit(resource);767 const limit = try os.getrlimit(resource);
...@@ -903,8 +883,6 @@ test "dup & dup2" {...@@ -903,8 +883,6 @@ test "dup & dup2" {
903 else => return error.SkipZigTest,883 else => return error.SkipZigTest,
904 }884 }
905885
906 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
907
908 var tmp = tmpDir(.{});886 var tmp = tmpDir(.{});
909 defer tmp.cleanup();887 defer tmp.cleanup();
910888
...@@ -934,8 +912,6 @@ test "dup & dup2" {...@@ -934,8 +912,6 @@ test "dup & dup2" {
934test "writev longer than IOV_MAX" {912test "writev longer than IOV_MAX" {
935 if (native_os == .windows or native_os == .wasi) return error.SkipZigTest;913 if (native_os == .windows or native_os == .wasi) return error.SkipZigTest;
936914
937 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
938
939 var tmp = tmpDir(.{});915 var tmp = tmpDir(.{});
940 defer tmp.cleanup();916 defer tmp.cleanup();
941917
...@@ -953,8 +929,6 @@ test "POSIX file locking with fcntl" {...@@ -953,8 +929,6 @@ test "POSIX file locking with fcntl" {
953 return error.SkipZigTest;929 return error.SkipZigTest;
954 }930 }
955931
956 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
957
958 if (true) {932 if (true) {
959 // https://github.com/ziglang/zig/issues/11074933 // https://github.com/ziglang/zig/issues/11074
960 return error.SkipZigTest;934 return error.SkipZigTest;
...@@ -1017,8 +991,6 @@ test "POSIX file locking with fcntl" {...@@ -1017,8 +991,6 @@ test "POSIX file locking with fcntl" {
1017test "rename smoke test" {991test "rename smoke test" {
1018 if (native_os == .wasi) return error.SkipZigTest;992 if (native_os == .wasi) return error.SkipZigTest;
1019993
1020 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1021
1022 var tmp = tmpDir(.{});994 var tmp = tmpDir(.{});
1023 defer tmp.cleanup();995 defer tmp.cleanup();
1024996
...@@ -1075,8 +1047,6 @@ test "rename smoke test" {...@@ -1075,8 +1047,6 @@ test "rename smoke test" {
1075test "access smoke test" {1047test "access smoke test" {
1076 if (native_os == .wasi) return error.SkipZigTest;1048 if (native_os == .wasi) return error.SkipZigTest;
10771049
1078 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1079
1080 var tmp = tmpDir(.{});1050 var tmp = tmpDir(.{});
1081 defer tmp.cleanup();1051 defer tmp.cleanup();
10821052
...@@ -1141,8 +1111,6 @@ test "timerfd" {...@@ -1141,8 +1111,6 @@ test "timerfd" {
1141}1111}
11421112
1143test "isatty" {1113test "isatty" {
1144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1145
1146 var tmp = tmpDir(.{});1114 var tmp = tmpDir(.{});
1147 defer tmp.cleanup();1115 defer tmp.cleanup();
11481116
...@@ -1155,8 +1123,6 @@ test "isatty" {...@@ -1155,8 +1123,6 @@ test "isatty" {
1155test "read with empty buffer" {1123test "read with empty buffer" {
1156 if (native_os == .wasi) return error.SkipZigTest;1124 if (native_os == .wasi) return error.SkipZigTest;
11571125
1158 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1159
1160 var tmp = tmpDir(.{});1126 var tmp = tmpDir(.{});
1161 defer tmp.cleanup();1127 defer tmp.cleanup();
11621128
...@@ -1182,8 +1148,6 @@ test "read with empty buffer" {...@@ -1182,8 +1148,6 @@ test "read with empty buffer" {
1182test "pread with empty buffer" {1148test "pread with empty buffer" {
1183 if (native_os == .wasi) return error.SkipZigTest;1149 if (native_os == .wasi) return error.SkipZigTest;
11841150
1185 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1186
1187 var tmp = tmpDir(.{});1151 var tmp = tmpDir(.{});
1188 defer tmp.cleanup();1152 defer tmp.cleanup();
11891153
...@@ -1209,8 +1173,6 @@ test "pread with empty buffer" {...@@ -1209,8 +1173,6 @@ test "pread with empty buffer" {
1209test "write with empty buffer" {1173test "write with empty buffer" {
1210 if (native_os == .wasi) return error.SkipZigTest;1174 if (native_os == .wasi) return error.SkipZigTest;
12111175
1212 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1213
1214 var tmp = tmpDir(.{});1176 var tmp = tmpDir(.{});
1215 defer tmp.cleanup();1177 defer tmp.cleanup();
12161178
...@@ -1236,8 +1198,6 @@ test "write with empty buffer" {...@@ -1236,8 +1198,6 @@ test "write with empty buffer" {
1236test "pwrite with empty buffer" {1198test "pwrite with empty buffer" {
1237 if (native_os == .wasi) return error.SkipZigTest;1199 if (native_os == .wasi) return error.SkipZigTest;
12381200
1239 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1240
1241 var tmp = tmpDir(.{});1201 var tmp = tmpDir(.{});
1242 defer tmp.cleanup();1202 defer tmp.cleanup();
12431203
...@@ -1263,8 +1223,6 @@ test "pwrite with empty buffer" {...@@ -1263,8 +1223,6 @@ test "pwrite with empty buffer" {
1263test "fchmodat smoke test" {1223test "fchmodat smoke test" {
1264 if (!std.fs.has_executable_bit) return error.SkipZigTest;1224 if (!std.fs.has_executable_bit) return error.SkipZigTest;
12651225
1266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1267
1268 var tmp = tmpDir(.{});1226 var tmp = tmpDir(.{});
1269 defer tmp.cleanup();1227 defer tmp.cleanup();
12701228
lib/std/os/windows.zig-2
...@@ -2491,8 +2491,6 @@ pub fn ntToWin32Namespace(path: []const u16) !PathSpace {...@@ -2491,8 +2491,6 @@ pub fn ntToWin32Namespace(path: []const u16) !PathSpace {
2491}2491}
24922492
2493test "ntToWin32Namespace" {2493test "ntToWin32Namespace" {
2494 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2495
2496 const L = std.unicode.utf8ToUtf16LeStringLiteral;2494 const L = std.unicode.utf8ToUtf16LeStringLiteral;
24972495
2498 try testNtToWin32Namespace(L("UNC"), L("\\??\\UNC"));2496 try testNtToWin32Namespace(L("UNC"), L("\\??\\UNC"));
lib/std/priority_dequeue.zig-2
...@@ -705,8 +705,6 @@ test "std.PriorityDequeue: fromOwnedSlice trivial case 1" {...@@ -705,8 +705,6 @@ test "std.PriorityDequeue: fromOwnedSlice trivial case 1" {
705}705}
706706
707test "std.PriorityDequeue: fromOwnedSlice" {707test "std.PriorityDequeue: fromOwnedSlice" {
708 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
709
710 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };708 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };
711 const queue_items = try testing.allocator.dupe(u32, items[0..]);709 const queue_items = try testing.allocator.dupe(u32, items[0..]);
712 var queue = PDQ.fromOwnedSlice(testing.allocator, queue_items[0..], {});710 var queue = PDQ.fromOwnedSlice(testing.allocator, queue_items[0..], {});
lib/std/priority_queue.zig-2
...@@ -385,8 +385,6 @@ test "std.PriorityQueue: fromOwnedSlice trivial case 1" {...@@ -385,8 +385,6 @@ test "std.PriorityQueue: fromOwnedSlice trivial case 1" {
385}385}
386386
387test "std.PriorityQueue: fromOwnedSlice" {387test "std.PriorityQueue: fromOwnedSlice" {
388 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
390 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };388 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };
391 const heap_items = try testing.allocator.dupe(u32, items[0..]);389 const heap_items = try testing.allocator.dupe(u32, items[0..]);
392 var queue = PQlt.fromOwnedSlice(testing.allocator, heap_items[0..], {});390 var queue = PQlt.fromOwnedSlice(testing.allocator, heap_items[0..], {});
lib/std/rand/test.zig-2
...@@ -443,8 +443,6 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void {...@@ -443,8 +443,6 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void {
443}443}
444444
445test "CSPRNG" {445test "CSPRNG" {
446 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
447
448 var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined;446 var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined;
449 std.crypto.random.bytes(&secret_seed);447 std.crypto.random.bytes(&secret_seed);
450 var csprng = DefaultCsprng.init(secret_seed);448 var csprng = DefaultCsprng.init(secret_seed);
lib/std/segmented_list.zig-2
...@@ -409,8 +409,6 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type...@@ -409,8 +409,6 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type
409}409}
410410
411test "SegmentedList basic usage" {411test "SegmentedList basic usage" {
412 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
413
414 try testSegmentedList(0);412 try testSegmentedList(0);
415 try testSegmentedList(1);413 try testSegmentedList(1);
416 try testSegmentedList(2);414 try testSegmentedList(2);
lib/std/simd.zig+8-3
...@@ -13,7 +13,7 @@ pub fn suggestVectorSizeForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ?...@@ -13,7 +13,7 @@ pub fn suggestVectorSizeForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ?
13 const vector_bit_size: u16 = blk: {13 const vector_bit_size: u16 = blk: {
14 if (cpu.arch.isX86()) {14 if (cpu.arch.isX86()) {
15 if (T == bool and std.Target.x86.featureSetHas(cpu.features, .prefer_mask_registers)) return 64;15 if (T == bool and std.Target.x86.featureSetHas(cpu.features, .prefer_mask_registers)) return 64;
16 if (std.Target.x86.featureSetHas(cpu.features, .avx512f) and !std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .prefer_128_bit })) break :blk 512;16 if (builtin.zig_backend != .stage2_x86_64 and std.Target.x86.featureSetHas(cpu.features, .avx512f) and !std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .prefer_128_bit })) break :blk 512;
17 if (std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .avx2 }) and !std.Target.x86.featureSetHas(cpu.features, .prefer_128_bit)) break :blk 256;17 if (std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .avx2 }) and !std.Target.x86.featureSetHas(cpu.features, .prefer_128_bit)) break :blk 256;
18 if (std.Target.x86.featureSetHas(cpu.features, .sse)) break :blk 128;18 if (std.Target.x86.featureSetHas(cpu.features, .sse)) break :blk 128;
19 if (std.Target.x86.featureSetHasAny(cpu.features, .{ .mmx, .@"3dnow" })) break :blk 64;19 if (std.Target.x86.featureSetHasAny(cpu.features, .{ .mmx, .@"3dnow" })) break :blk 64;
...@@ -62,10 +62,15 @@ pub fn suggestVectorSize(comptime T: type) ?comptime_int {...@@ -62,10 +62,15 @@ pub fn suggestVectorSize(comptime T: type) ?comptime_int {
62test "suggestVectorSizeForCpu works with signed and unsigned values" {62test "suggestVectorSizeForCpu works with signed and unsigned values" {
63 comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64);63 comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64);
64 comptime cpu.features.addFeature(@intFromEnum(std.Target.x86.Feature.avx512f));64 comptime cpu.features.addFeature(@intFromEnum(std.Target.x86.Feature.avx512f));
65 comptime cpu.features.populateDependencies(&std.Target.x86.all_features);
66 const expected_size: usize = switch (builtin.zig_backend) {
67 .stage2_x86_64 => 8,
68 else => 16,
69 };
65 const signed_integer_size = suggestVectorSizeForCpu(i32, cpu).?;70 const signed_integer_size = suggestVectorSizeForCpu(i32, cpu).?;
66 const unsigned_integer_size = suggestVectorSizeForCpu(u32, cpu).?;71 const unsigned_integer_size = suggestVectorSizeForCpu(u32, cpu).?;
67 try std.testing.expectEqual(@as(usize, 16), unsigned_integer_size);72 try std.testing.expectEqual(expected_size, unsigned_integer_size);
68 try std.testing.expectEqual(@as(usize, 16), signed_integer_size);73 try std.testing.expectEqual(expected_size, signed_integer_size);
69}74}
7075
71fn vectorLength(comptime VectorType: type) comptime_int {76fn vectorLength(comptime VectorType: type) comptime_int {
lib/std/sort.zig-11
...@@ -1,6 +1,5 @@...@@ -1,6 +1,5 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const builtin = @import("builtin");
4const testing = std.testing;3const testing = std.testing;
5const mem = std.mem;4const mem = std.mem;
6const math = std.math;5const math = std.math;
...@@ -177,8 +176,6 @@ const IdAndValue = struct {...@@ -177,8 +176,6 @@ const IdAndValue = struct {
177};176};
178177
179test "stable sort" {178test "stable sort" {
180 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
181
182 const expected = [_]IdAndValue{179 const expected = [_]IdAndValue{
183 IdAndValue{ .id = 0, .value = 0 },180 IdAndValue{ .id = 0, .value = 0 },
184 IdAndValue{ .id = 1, .value = 0 },181 IdAndValue{ .id = 1, .value = 0 },
...@@ -226,8 +223,6 @@ test "stable sort" {...@@ -226,8 +223,6 @@ test "stable sort" {
226}223}
227224
228test "sort" {225test "sort" {
229 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
230
231 const u8cases = [_][]const []const u8{226 const u8cases = [_][]const []const u8{
232 &[_][]const u8{227 &[_][]const u8{
233 "",228 "",
...@@ -306,8 +301,6 @@ test "sort" {...@@ -306,8 +301,6 @@ test "sort" {
306}301}
307302
308test "sort descending" {303test "sort descending" {
309 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
310
311 const rev_cases = [_][]const []const i32{304 const rev_cases = [_][]const []const i32{
312 &[_][]const i32{305 &[_][]const i32{
313 &[_]i32{},306 &[_]i32{},
...@@ -347,8 +340,6 @@ test "sort descending" {...@@ -347,8 +340,6 @@ test "sort descending" {
347}340}
348341
349test "sort with context in the middle of a slice" {342test "sort with context in the middle of a slice" {
350 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
351
352 const Context = struct {343 const Context = struct {
353 items: []i32,344 items: []i32,
354345
...@@ -388,8 +379,6 @@ test "sort with context in the middle of a slice" {...@@ -388,8 +379,6 @@ test "sort with context in the middle of a slice" {
388}379}
389380
390test "sort fuzz testing" {381test "sort fuzz testing" {
391 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
392
393 var prng = std.rand.DefaultPrng.init(0x12345678);382 var prng = std.rand.DefaultPrng.init(0x12345678);
394 const random = prng.random();383 const random = prng.random();
395 const test_case_count = 10;384 const test_case_count = 10;
lib/std/time.zig-2
...@@ -321,8 +321,6 @@ pub const Timer = struct {...@@ -321,8 +321,6 @@ pub const Timer = struct {
321};321};
322322
323test "Timer + Instant" {323test "Timer + Instant" {
324 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
325
326 const margin = ns_per_ms * 150;324 const margin = ns_per_ms * 150;
327325
328 var timer = try Timer.start();326 var timer = try Timer.start();
lib/std/unicode.zig-41
...@@ -1,6 +1,5 @@...@@ -1,6 +1,5 @@
1const std = @import("./std.zig");1const std = @import("./std.zig");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const builtin = @import("builtin");
4const testing = std.testing;3const testing = std.testing;
5const mem = std.mem;4const mem = std.mem;
65
...@@ -497,15 +496,11 @@ fn testUtf16CountCodepoints() !void {...@@ -497,15 +496,11 @@ fn testUtf16CountCodepoints() !void {
497}496}
498497
499test "utf16 count codepoints" {498test "utf16 count codepoints" {
500 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
501
502 try testUtf16CountCodepoints();499 try testUtf16CountCodepoints();
503 try comptime testUtf16CountCodepoints();500 try comptime testUtf16CountCodepoints();
504}501}
505502
506test "utf8 encode" {503test "utf8 encode" {
507 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
508
509 try comptime testUtf8Encode();504 try comptime testUtf8Encode();
510 try testUtf8Encode();505 try testUtf8Encode();
511}506}
...@@ -532,8 +527,6 @@ fn testUtf8Encode() !void {...@@ -532,8 +527,6 @@ fn testUtf8Encode() !void {
532}527}
533528
534test "utf8 encode error" {529test "utf8 encode error" {
535 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
536
537 try comptime testUtf8EncodeError();530 try comptime testUtf8EncodeError();
538 try testUtf8EncodeError();531 try testUtf8EncodeError();
539}532}
...@@ -550,8 +543,6 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {...@@ -550,8 +543,6 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {
550}543}
551544
552test "utf8 iterator on ascii" {545test "utf8 iterator on ascii" {
553 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
554
555 try comptime testUtf8IteratorOnAscii();546 try comptime testUtf8IteratorOnAscii();
556 try testUtf8IteratorOnAscii();547 try testUtf8IteratorOnAscii();
557}548}
...@@ -572,8 +563,6 @@ fn testUtf8IteratorOnAscii() !void {...@@ -572,8 +563,6 @@ fn testUtf8IteratorOnAscii() !void {
572}563}
573564
574test "utf8 view bad" {565test "utf8 view bad" {
575 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
576
577 try comptime testUtf8ViewBad();566 try comptime testUtf8ViewBad();
578 try testUtf8ViewBad();567 try testUtf8ViewBad();
579}568}
...@@ -584,8 +573,6 @@ fn testUtf8ViewBad() !void {...@@ -584,8 +573,6 @@ fn testUtf8ViewBad() !void {
584}573}
585574
586test "utf8 view ok" {575test "utf8 view ok" {
587 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
588
589 try comptime testUtf8ViewOk();576 try comptime testUtf8ViewOk();
590 try testUtf8ViewOk();577 try testUtf8ViewOk();
591}578}
...@@ -606,8 +593,6 @@ fn testUtf8ViewOk() !void {...@@ -606,8 +593,6 @@ fn testUtf8ViewOk() !void {
606}593}
607594
608test "validate slice" {595test "validate slice" {
609 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
610
611 try comptime testValidateSlice();596 try comptime testValidateSlice();
612 try testValidateSlice();597 try testValidateSlice();
613598
...@@ -648,8 +633,6 @@ fn testValidateSlice() !void {...@@ -648,8 +633,6 @@ fn testValidateSlice() !void {
648}633}
649634
650test "valid utf8" {635test "valid utf8" {
651 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
652
653 try comptime testValidUtf8();636 try comptime testValidUtf8();
654 try testValidUtf8();637 try testValidUtf8();
655}638}
...@@ -669,8 +652,6 @@ fn testValidUtf8() !void {...@@ -669,8 +652,6 @@ fn testValidUtf8() !void {
669}652}
670653
671test "invalid utf8 continuation bytes" {654test "invalid utf8 continuation bytes" {
672 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
673
674 try comptime testInvalidUtf8ContinuationBytes();655 try comptime testInvalidUtf8ContinuationBytes();
675 try testInvalidUtf8ContinuationBytes();656 try testInvalidUtf8ContinuationBytes();
676}657}
...@@ -703,8 +684,6 @@ fn testInvalidUtf8ContinuationBytes() !void {...@@ -703,8 +684,6 @@ fn testInvalidUtf8ContinuationBytes() !void {
703}684}
704685
705test "overlong utf8 codepoint" {686test "overlong utf8 codepoint" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
708 try comptime testOverlongUtf8Codepoint();687 try comptime testOverlongUtf8Codepoint();
709 try testOverlongUtf8Codepoint();688 try testOverlongUtf8Codepoint();
710}689}
...@@ -718,8 +697,6 @@ fn testOverlongUtf8Codepoint() !void {...@@ -718,8 +697,6 @@ fn testOverlongUtf8Codepoint() !void {
718}697}
719698
720test "misc invalid utf8" {699test "misc invalid utf8" {
721 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
722
723 try comptime testMiscInvalidUtf8();700 try comptime testMiscInvalidUtf8();
724 try testMiscInvalidUtf8();701 try testMiscInvalidUtf8();
725}702}
...@@ -735,8 +712,6 @@ fn testMiscInvalidUtf8() !void {...@@ -735,8 +712,6 @@ fn testMiscInvalidUtf8() !void {
735}712}
736713
737test "utf8 iterator peeking" {714test "utf8 iterator peeking" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
740 try comptime testUtf8Peeking();715 try comptime testUtf8Peeking();
741 try testUtf8Peeking();716 try testUtf8Peeking();
742}717}
...@@ -821,8 +796,6 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize {...@@ -821,8 +796,6 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize {
821}796}
822797
823test "utf16leToUtf8" {798test "utf16leToUtf8" {
824 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
825
826 var utf16le: [2]u16 = undefined;799 var utf16le: [2]u16 = undefined;
827 const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]);800 const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]);
828801
...@@ -935,8 +908,6 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize {...@@ -935,8 +908,6 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize {
935}908}
936909
937test "utf8ToUtf16Le" {910test "utf8ToUtf16Le" {
938 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
939
940 var utf16le: [2]u16 = [_]u16{0} ** 2;911 var utf16le: [2]u16 = [_]u16{0} ** 2;
941 {912 {
942 const length = try utf8ToUtf16Le(utf16le[0..], "𐐷");913 const length = try utf8ToUtf16Le(utf16le[0..], "𐐷");
...@@ -955,8 +926,6 @@ test "utf8ToUtf16Le" {...@@ -955,8 +926,6 @@ test "utf8ToUtf16Le" {
955}926}
956927
957test "utf8ToUtf16LeWithNull" {928test "utf8ToUtf16LeWithNull" {
958 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
959
960 {929 {
961 const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷");930 const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷");
962 defer testing.allocator.free(utf16);931 defer testing.allocator.free(utf16);
...@@ -1015,8 +984,6 @@ fn testCalcUtf16LeLen() !void {...@@ -1015,8 +984,6 @@ fn testCalcUtf16LeLen() !void {
1015}984}
1016985
1017test "calculate utf16 string length of given utf8 string in u16" {986test "calculate utf16 string length of given utf8 string in u16" {
1018 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1019
1020 try testCalcUtf16LeLen();987 try testCalcUtf16LeLen();
1021 try comptime testCalcUtf16LeLen();988 try comptime testCalcUtf16LeLen();
1022}989}
...@@ -1050,8 +1017,6 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) {...@@ -1050,8 +1017,6 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) {
1050}1017}
10511018
1052test "fmtUtf16le" {1019test "fmtUtf16le" {
1053 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1054
1055 const expectFmt = std.testing.expectFmt;1020 const expectFmt = std.testing.expectFmt;
1056 try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))});1021 try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))});
1057 try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))});1022 try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))});
...@@ -1065,8 +1030,6 @@ test "fmtUtf16le" {...@@ -1065,8 +1030,6 @@ test "fmtUtf16le" {
1065}1030}
10661031
1067test "utf8ToUtf16LeStringLiteral" {1032test "utf8ToUtf16LeStringLiteral" {
1068 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1069
1070 {1033 {
1071 const bytes = [_:0]u16{1034 const bytes = [_:0]u16{
1072 mem.nativeToLittle(u16, 0x41),1035 mem.nativeToLittle(u16, 0x41),
...@@ -1127,8 +1090,6 @@ fn testUtf8CountCodepoints() !void {...@@ -1127,8 +1090,6 @@ fn testUtf8CountCodepoints() !void {
1127}1090}
11281091
1129test "utf8 count codepoints" {1092test "utf8 count codepoints" {
1130 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1131
1132 try testUtf8CountCodepoints();1093 try testUtf8CountCodepoints();
1133 try comptime testUtf8CountCodepoints();1094 try comptime testUtf8CountCodepoints();
1134}1095}
...@@ -1145,8 +1106,6 @@ fn testUtf8ValidCodepoint() !void {...@@ -1145,8 +1106,6 @@ fn testUtf8ValidCodepoint() !void {
1145}1106}
11461107
1147test "utf8 valid codepoint" {1108test "utf8 valid codepoint" {
1148 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1149
1150 try testUtf8ValidCodepoint();1109 try testUtf8ValidCodepoint();
1151 try comptime testUtf8ValidCodepoint();1110 try comptime testUtf8ValidCodepoint();
1152}1111}
lib/std/zig/fmt.zig+1-2
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const mem = std.mem;2const mem = std.mem;
43
5/// Print the string as a Zig identifier escaping it with @"" syntax if needed.4/// Print the string as a Zig identifier escaping it with @"" syntax if needed.
...@@ -96,7 +95,7 @@ pub fn fmtEscapes(bytes: []const u8) std.fmt.Formatter(stringEscape) {...@@ -96,7 +95,7 @@ pub fn fmtEscapes(bytes: []const u8) std.fmt.Formatter(stringEscape) {
96}95}
9796
98test "escape invalid identifiers" {97test "escape invalid identifiers" {
99 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;98 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
10099
101 const expectFmt = std.testing.expectFmt;100 const expectFmt = std.testing.expectFmt;
102 try expectFmt("@\"while\"", "{}", .{fmtId("while")});101 try expectFmt("@\"while\"", "{}", .{fmtId("while")});
lib/std/zig/tokenizer.zig-2
...@@ -1481,8 +1481,6 @@ test "utf8" {...@@ -1481,8 +1481,6 @@ test "utf8" {
1481}1481}
14821482
1483test "invalid utf8" {1483test "invalid utf8" {
1484 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1485
1486 try testTokenize("//\x80", &.{1484 try testTokenize("//\x80", &.{
1487 .invalid,1485 .invalid,
1488 });1486 });
src/arch/x86_64/CodeGen.zig+880-305
...@@ -656,11 +656,14 @@ const InstTracking = struct {...@@ -656,11 +656,14 @@ const InstTracking = struct {
656 fn reuse(656 fn reuse(
657 self: *InstTracking,657 self: *InstTracking,
658 function: *Self,658 function: *Self,
659 new_inst: Air.Inst.Index,659 new_inst: ?Air.Inst.Index,
660 old_inst: Air.Inst.Index,660 old_inst: Air.Inst.Index,
661 ) void {661 ) void {
662 self.short = .{ .dead = function.scope_generation };662 self.short = .{ .dead = function.scope_generation };
663 tracking_log.debug("%{d} => {} (reuse %{d})", .{ new_inst, self.*, old_inst });663 if (new_inst) |inst|
664 tracking_log.debug("%{d} => {} (reuse %{d})", .{ inst, self.*, old_inst })
665 else
666 tracking_log.debug("tmp => {} (reuse %{d})", .{ self.*, old_inst });
664 }667 }
665668
666 fn liveOut(self: *InstTracking, function: *Self, inst: Air.Inst.Index) void {669 fn liveOut(self: *InstTracking, function: *Self, inst: Air.Inst.Index) void {
...@@ -1457,7 +1460,10 @@ fn asmRegisterRegisterRegisterImmediate(...@@ -1457,7 +1460,10 @@ fn asmRegisterRegisterRegisterImmediate(
1457 .r1 = reg1,1460 .r1 = reg1,
1458 .r2 = reg2,1461 .r2 = reg2,
1459 .r3 = reg3,1462 .r3 = reg3,
1460 .i = @as(u8, @intCast(imm.unsigned)),1463 .i = switch (imm) {
1464 .signed => |s| @bitCast(@as(i8, @intCast(s))),
1465 .unsigned => |u| @intCast(u),
1466 },
1461 } },1467 } },
1462 });1468 });
1463}1469}
...@@ -1560,24 +1566,58 @@ fn asmRegisterMemoryImmediate(...@@ -1560,24 +1566,58 @@ fn asmRegisterMemoryImmediate(
1560 m: Memory,1566 m: Memory,
1561 imm: Immediate,1567 imm: Immediate,
1562) !void {1568) !void {
1563 _ = try self.addInst(.{1569 if (switch (imm) {
1564 .tag = tag[1],1570 .signed => |s| if (math.cast(i16, s)) |x| @as(u16, @bitCast(x)) else null,
1565 .ops = switch (m) {1571 .unsigned => |u| math.cast(u16, u),
1566 .sib => .rmi_sib,1572 }) |small_imm| {
1567 .rip => .rmi_rip,1573 _ = try self.addInst(.{
1574 .tag = tag[1],
1575 .ops = switch (m) {
1576 .sib => .rmi_sib,
1577 .rip => .rmi_rip,
1578 else => unreachable,
1579 },
1580 .data = .{ .rix = .{
1581 .fixes = tag[0],
1582 .r1 = reg,
1583 .i = small_imm,
1584 .payload = switch (m) {
1585 .sib => try self.addExtra(Mir.MemorySib.encode(m)),
1586 .rip => try self.addExtra(Mir.MemoryRip.encode(m)),
1587 else => unreachable,
1588 },
1589 } },
1590 });
1591 } else {
1592 const payload = try self.addExtra(Mir.Imm32{ .imm = switch (imm) {
1593 .signed => |s| @bitCast(s),
1594 .unsigned => unreachable,
1595 } });
1596 assert(payload + 1 == switch (m) {
1597 .sib => try self.addExtra(Mir.MemorySib.encode(m)),
1598 .rip => try self.addExtra(Mir.MemoryRip.encode(m)),
1568 else => unreachable,1599 else => unreachable,
1569 },1600 });
1570 .data = .{ .rix = .{1601 _ = try self.addInst(.{
1571 .fixes = tag[0],1602 .tag = tag[1],
1572 .r1 = reg,1603 .ops = switch (m) {
1573 .i = @as(u8, @intCast(imm.unsigned)),1604 .sib => switch (imm) {
1574 .payload = switch (m) {1605 .signed => .rmi_sib_s,
1575 .sib => try self.addExtra(Mir.MemorySib.encode(m)),1606 .unsigned => .rmi_sib_u,
1576 .rip => try self.addExtra(Mir.MemoryRip.encode(m)),1607 },
1608 .rip => switch (imm) {
1609 .signed => .rmi_rip_s,
1610 .unsigned => .rmi_rip_u,
1611 },
1577 else => unreachable,1612 else => unreachable,
1578 },1613 },
1579 } },1614 .data = .{ .rx = .{
1580 });1615 .fixes = tag[0],
1616 .r1 = reg,
1617 .payload = payload,
1618 } },
1619 });
1620 }
1581}1621}
15821622
1583fn asmRegisterRegisterMemoryImmediate(1623fn asmRegisterRegisterMemoryImmediate(
...@@ -2047,7 +2087,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {...@@ -2047,7 +2087,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
2047 .get_union_tag => try self.airGetUnionTag(inst),2087 .get_union_tag => try self.airGetUnionTag(inst),
2048 .clz => try self.airClz(inst),2088 .clz => try self.airClz(inst),
2049 .ctz => try self.airCtz(inst),2089 .ctz => try self.airCtz(inst),
2050 .popcount => try self.airPopcount(inst),2090 .popcount => try self.airPopCount(inst),
2051 .byte_swap => try self.airByteSwap(inst),2091 .byte_swap => try self.airByteSwap(inst),
2052 .bit_reverse => try self.airBitReverse(inst),2092 .bit_reverse => try self.airBitReverse(inst),
2053 .tag_name => try self.airTagName(inst),2093 .tag_name => try self.airTagName(inst),
...@@ -2708,11 +2748,11 @@ fn airFptrunc(self: *Self, inst: Air.Inst.Index) !void {...@@ -2708,11 +2748,11 @@ fn airFptrunc(self: *Self, inst: Air.Inst.Index) !void {
2708 },2748 },
2709 else => unreachable,2749 else => unreachable,
2710 }) {2750 }) {
2711 var callee: ["__trunc?f?f2".len]u8 = undefined;2751 var callee_buf: ["__trunc?f?f2".len]u8 = undefined;
2712 break :result try self.genCall(.{ .lib = .{2752 break :result try self.genCall(.{ .lib = .{
2713 .return_type = self.floatCompilerRtAbiType(dst_ty, src_ty).toIntern(),2753 .return_type = self.floatCompilerRtAbiType(dst_ty, src_ty).toIntern(),
2714 .param_types = &.{self.floatCompilerRtAbiType(src_ty, dst_ty).toIntern()},2754 .param_types = &.{self.floatCompilerRtAbiType(src_ty, dst_ty).toIntern()},
2715 .callee = std.fmt.bufPrint(&callee, "__trunc{c}f{c}f2", .{2755 .callee = std.fmt.bufPrint(&callee_buf, "__trunc{c}f{c}f2", .{
2716 floatCompilerRtAbiName(src_bits),2756 floatCompilerRtAbiName(src_bits),
2717 floatCompilerRtAbiName(dst_bits),2757 floatCompilerRtAbiName(dst_bits),
2718 }) catch unreachable,2758 }) catch unreachable,
...@@ -2740,7 +2780,7 @@ fn airFptrunc(self: *Self, inst: Air.Inst.Index) !void {...@@ -2740,7 +2780,7 @@ fn airFptrunc(self: *Self, inst: Air.Inst.Index) !void {
2740 .{ .v_, .cvtps2ph },2780 .{ .v_, .cvtps2ph },
2741 dst_reg,2781 dst_reg,
2742 mat_src_reg.to128(),2782 mat_src_reg.to128(),
2743 Immediate.u(0b1_00),2783 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
2744 );2784 );
2745 },2785 },
2746 else => unreachable,2786 else => unreachable,
...@@ -2807,11 +2847,11 @@ fn airFpext(self: *Self, inst: Air.Inst.Index) !void {...@@ -2807,11 +2847,11 @@ fn airFpext(self: *Self, inst: Air.Inst.Index) !void {
2807 },2847 },
2808 else => unreachable,2848 else => unreachable,
2809 }) {2849 }) {
2810 var callee: ["__extend?f?f2".len]u8 = undefined;2850 var callee_buf: ["__extend?f?f2".len]u8 = undefined;
2811 break :result try self.genCall(.{ .lib = .{2851 break :result try self.genCall(.{ .lib = .{
2812 .return_type = self.floatCompilerRtAbiType(dst_ty, src_ty).toIntern(),2852 .return_type = self.floatCompilerRtAbiType(dst_ty, src_ty).toIntern(),
2813 .param_types = &.{self.floatCompilerRtAbiType(src_ty, dst_ty).toIntern()},2853 .param_types = &.{self.floatCompilerRtAbiType(src_ty, dst_ty).toIntern()},
2814 .callee = std.fmt.bufPrint(&callee, "__extend{c}f{c}f2", .{2854 .callee = std.fmt.bufPrint(&callee_buf, "__extend{c}f{c}f2", .{
2815 floatCompilerRtAbiName(src_bits),2855 floatCompilerRtAbiName(src_bits),
2816 floatCompilerRtAbiName(dst_bits),2856 floatCompilerRtAbiName(dst_bits),
2817 }) catch unreachable,2857 }) catch unreachable,
...@@ -2982,11 +3022,8 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {...@@ -2982,11 +3022,8 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
2982 else if (dst_abi_size <= 8)3022 else if (dst_abi_size <= 8)
2983 try self.copyToRegisterWithInstTracking(inst, dst_ty, src_mcv)3023 try self.copyToRegisterWithInstTracking(inst, dst_ty, src_mcv)
2984 else if (dst_abi_size <= 16) dst: {3024 else if (dst_abi_size <= 16) dst: {
2985 const dst_regs = try self.register_manager.allocRegs(3025 const dst_regs =
2986 2,3026 try self.register_manager.allocRegs(2, .{ inst, inst }, abi.RegisterClass.gp);
2987 .{ inst, inst },
2988 abi.RegisterClass.gp,
2989 );
2990 const dst_mcv: MCValue = .{ .register_pair = dst_regs };3027 const dst_mcv: MCValue = .{ .register_pair = dst_regs };
2991 const dst_locks = self.register_manager.lockRegsAssumeUnused(2, dst_regs);3028 const dst_locks = self.register_manager.lockRegsAssumeUnused(2, dst_regs);
2992 defer for (dst_locks) |lock| self.register_manager.unlockReg(lock);3029 defer for (dst_locks) |lock| self.register_manager.unlockReg(lock);
...@@ -3713,14 +3750,22 @@ fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue...@@ -3713,14 +3750,22 @@ fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue
3713 else => unreachable,3750 else => unreachable,
3714 .mul => {},3751 .mul => {},
3715 .div => switch (tag[0]) {3752 .div => switch (tag[0]) {
3716 ._ => try self.asmRegisterRegister(.{ ._, .xor }, .edx, .edx),3753 ._ => {
3717 .i_ => switch (self.regBitSize(ty)) {3754 const hi_reg: Register =
3718 8 => try self.asmOpOnly(.{ ._, .cbw }),3755 switch (self.regBitSize(ty)) {
3719 16 => try self.asmOpOnly(.{ ._, .cwd }),3756 8 => .ah,
3720 32 => try self.asmOpOnly(.{ ._, .cdq }),3757 16, 32, 64 => .edx,
3721 64 => try self.asmOpOnly(.{ ._, .cqo }),3758 else => unreachable,
3722 else => unreachable,3759 };
3760 try self.asmRegisterRegister(.{ ._, .xor }, hi_reg, hi_reg);
3723 },3761 },
3762 .i_ => try self.asmOpOnly(.{ ._, switch (self.regBitSize(ty)) {
3763 8 => .cbw,
3764 16 => .cwd,
3765 32 => .cdq,
3766 64 => .cqo,
3767 else => unreachable,
3768 } }),
3724 else => unreachable,3769 else => unreachable,
3725 },3770 },
3726 }3771 }
...@@ -4626,6 +4671,19 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {...@@ -4626,6 +4671,19 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {
4626 if (src_ty.zigTypeTag(mod) == .Vector) return self.fail("TODO implement airClz for {}", .{4671 if (src_ty.zigTypeTag(mod) == .Vector) return self.fail("TODO implement airClz for {}", .{
4627 src_ty.fmt(mod),4672 src_ty.fmt(mod),
4628 });4673 });
4674 const src_bits: u32 = @intCast(src_ty.bitSize(mod));
4675
4676 const has_lzcnt = self.hasFeature(.lzcnt);
4677 if (src_bits > 64 and !has_lzcnt) {
4678 var callee_buf: ["__clz?i2".len]u8 = undefined;
4679 break :result try self.genCall(.{ .lib = .{
4680 .return_type = .i32_type,
4681 .param_types = &.{src_ty.toIntern()},
4682 .callee = std.fmt.bufPrint(&callee_buf, "__clz{c}i2", .{
4683 intCompilerRtAbiName(src_bits),
4684 }) catch unreachable,
4685 } }, &.{src_ty}, &.{.{ .air_ref = ty_op.operand }});
4686 }
46294687
4630 const src_mcv = try self.resolveInst(ty_op.operand);4688 const src_mcv = try self.resolveInst(ty_op.operand);
4631 const mat_src_mcv = switch (src_mcv) {4689 const mat_src_mcv = switch (src_mcv) {
...@@ -4643,8 +4701,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {...@@ -4643,8 +4701,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {
4643 const dst_lock = self.register_manager.lockRegAssumeUnused(dst_reg);4701 const dst_lock = self.register_manager.lockRegAssumeUnused(dst_reg);
4644 defer self.register_manager.unlockReg(dst_lock);4702 defer self.register_manager.unlockReg(dst_lock);
46454703
4646 const src_bits = src_ty.bitSize(mod);4704 if (has_lzcnt) {
4647 if (self.hasFeature(.lzcnt)) {
4648 if (src_bits <= 8) {4705 if (src_bits <= 8) {
4649 const wide_reg = try self.copyToTmpRegister(src_ty, mat_src_mcv);4706 const wide_reg = try self.copyToTmpRegister(src_ty, mat_src_mcv);
4650 try self.truncateRegister(src_ty, wide_reg);4707 try self.truncateRegister(src_ty, wide_reg);
...@@ -4667,24 +4724,33 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {...@@ -4667,24 +4724,33 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {
4667 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);4724 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);
4668 defer self.register_manager.unlockReg(tmp_lock);4725 defer self.register_manager.unlockReg(tmp_lock);
46694726
4670 try self.genBinOpMir(.{ ._, .lzcnt }, Type.u64, dst_mcv, mat_src_mcv);4727 try self.genBinOpMir(
4728 .{ ._, .lzcnt },
4729 Type.u64,
4730 dst_mcv,
4731 if (mat_src_mcv.isMemory())
4732 mat_src_mcv
4733 else
4734 .{ .register = mat_src_mcv.register_pair[0] },
4735 );
4671 try self.genBinOpMir(.{ ._, .add }, dst_ty, dst_mcv, .{ .immediate = 64 });4736 try self.genBinOpMir(.{ ._, .add }, dst_ty, dst_mcv, .{ .immediate = 64 });
4672 try self.genBinOpMir(4737 try self.genBinOpMir(
4673 .{ ._, .lzcnt },4738 .{ ._, .lzcnt },
4674 Type.u64,4739 Type.u64,
4675 tmp_mcv,4740 tmp_mcv,
4676 mat_src_mcv.address().offset(8).deref(),4741 if (mat_src_mcv.isMemory())
4742 mat_src_mcv.address().offset(8).deref()
4743 else
4744 .{ .register = mat_src_mcv.register_pair[1] },
4677 );4745 );
4678 try self.asmCmovccRegisterRegister(.nc, dst_reg.to32(), tmp_reg.to32());4746 try self.asmCmovccRegisterRegister(.nc, dst_reg.to32(), tmp_reg.to32());
46794747
4680 if (src_bits < 128) {4748 if (src_bits < 128) try self.genBinOpMir(
4681 try self.genBinOpMir(4749 .{ ._, .sub },
4682 .{ ._, .sub },4750 dst_ty,
4683 dst_ty,4751 dst_mcv,
4684 dst_mcv,4752 .{ .immediate = 128 - src_bits },
4685 .{ .immediate = 128 - src_bits },4753 );
4686 );
4687 }
4688 } else return self.fail("TODO airClz of {}", .{src_ty.fmt(mod)});4754 } else return self.fail("TODO airClz of {}", .{src_ty.fmt(mod)});
4689 break :result dst_mcv;4755 break :result dst_mcv;
4690 }4756 }
...@@ -4755,7 +4821,22 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {...@@ -4755,7 +4821,22 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {
4755 const result = result: {4821 const result = result: {
4756 const dst_ty = self.typeOfIndex(inst);4822 const dst_ty = self.typeOfIndex(inst);
4757 const src_ty = self.typeOf(ty_op.operand);4823 const src_ty = self.typeOf(ty_op.operand);
4758 const src_bits = src_ty.bitSize(mod);4824 if (src_ty.zigTypeTag(mod) == .Vector) return self.fail("TODO implement airClz for {}", .{
4825 src_ty.fmt(mod),
4826 });
4827 const src_bits: u32 = @intCast(src_ty.bitSize(mod));
4828
4829 const has_bmi = self.hasFeature(.bmi);
4830 if (src_bits > 64 and !has_bmi) {
4831 var callee_buf: ["__ctz?i2".len]u8 = undefined;
4832 break :result try self.genCall(.{ .lib = .{
4833 .return_type = .i32_type,
4834 .param_types = &.{src_ty.toIntern()},
4835 .callee = std.fmt.bufPrint(&callee_buf, "__ctz{c}i2", .{
4836 intCompilerRtAbiName(src_bits),
4837 }) catch unreachable,
4838 } }, &.{src_ty}, &.{.{ .air_ref = ty_op.operand }});
4839 }
47594840
4760 const src_mcv = try self.resolveInst(ty_op.operand);4841 const src_mcv = try self.resolveInst(ty_op.operand);
4761 const mat_src_mcv = switch (src_mcv) {4842 const mat_src_mcv = switch (src_mcv) {
...@@ -4800,8 +4881,16 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {...@@ -4800,8 +4881,16 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {
4800 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);4881 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);
4801 defer self.register_manager.unlockReg(tmp_lock);4882 defer self.register_manager.unlockReg(tmp_lock);
48024883
4884 const lo_mat_src_mcv: MCValue = if (mat_src_mcv.isMemory())
4885 mat_src_mcv
4886 else
4887 .{ .register = mat_src_mcv.register_pair[0] };
4888 const hi_mat_src_mcv: MCValue = if (mat_src_mcv.isMemory())
4889 mat_src_mcv.address().offset(8).deref()
4890 else
4891 .{ .register = mat_src_mcv.register_pair[1] };
4803 const masked_mcv = if (src_bits < 128) masked: {4892 const masked_mcv = if (src_bits < 128) masked: {
4804 try self.genCopy(Type.u64, dst_mcv, mat_src_mcv.address().offset(8).deref());4893 try self.genCopy(Type.u64, dst_mcv, hi_mat_src_mcv);
4805 try self.genBinOpMir(4894 try self.genBinOpMir(
4806 .{ ._, .@"or" },4895 .{ ._, .@"or" },
4807 Type.u64,4896 Type.u64,
...@@ -4809,10 +4898,10 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {...@@ -4809,10 +4898,10 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {
4809 .{ .immediate = @as(u64, math.maxInt(u64)) << @intCast(src_bits - 64) },4898 .{ .immediate = @as(u64, math.maxInt(u64)) << @intCast(src_bits - 64) },
4810 );4899 );
4811 break :masked dst_mcv;4900 break :masked dst_mcv;
4812 } else mat_src_mcv.address().offset(8).deref();4901 } else hi_mat_src_mcv;
4813 try self.genBinOpMir(.{ ._, .tzcnt }, Type.u64, dst_mcv, masked_mcv);4902 try self.genBinOpMir(.{ ._, .tzcnt }, Type.u64, dst_mcv, masked_mcv);
4814 try self.genBinOpMir(.{ ._, .add }, dst_ty, dst_mcv, .{ .immediate = 64 });4903 try self.genBinOpMir(.{ ._, .add }, dst_ty, dst_mcv, .{ .immediate = 64 });
4815 try self.genBinOpMir(.{ ._, .tzcnt }, Type.u64, tmp_mcv, mat_src_mcv);4904 try self.genBinOpMir(.{ ._, .tzcnt }, Type.u64, tmp_mcv, lo_mat_src_mcv);
4816 try self.asmCmovccRegisterRegister(.nc, dst_reg.to32(), tmp_reg.to32());4905 try self.asmCmovccRegisterRegister(.nc, dst_reg.to32(), tmp_reg.to32());
4817 } else return self.fail("TODO airCtz of {}", .{src_ty.fmt(mod)});4906 } else return self.fail("TODO airCtz of {}", .{src_ty.fmt(mod)});
4818 break :result dst_mcv;4907 break :result dst_mcv;
...@@ -4844,155 +4933,216 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {...@@ -4844,155 +4933,216 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {
4844 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });4933 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
4845}4934}
48464935
4847fn airPopcount(self: *Self, inst: Air.Inst.Index) !void {4936fn airPopCount(self: *Self, inst: Air.Inst.Index) !void {
4848 const mod = self.bin_file.options.module.?;4937 const mod = self.bin_file.options.module.?;
4849 const ty_op = self.air.instructions.items(.data)[inst].ty_op;4938 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
4850 const result: MCValue = result: {4939 const result: MCValue = result: {
4940 try self.spillEflagsIfOccupied();
4941
4851 const src_ty = self.typeOf(ty_op.operand);4942 const src_ty = self.typeOf(ty_op.operand);
4852 const src_abi_size: u32 = @intCast(src_ty.abiSize(mod));4943 const src_abi_size: u32 = @intCast(src_ty.abiSize(mod));
4853 if (src_ty.zigTypeTag(mod) == .Vector or src_abi_size > 8)4944 if (src_ty.zigTypeTag(mod) == .Vector or src_abi_size > 16)
4854 return self.fail("TODO implement airPopcount for {}", .{src_ty.fmt(mod)});4945 return self.fail("TODO implement airPopCount for {}", .{src_ty.fmt(mod)});
4855 const src_mcv = try self.resolveInst(ty_op.operand);4946 const src_mcv = try self.resolveInst(ty_op.operand);
48564947
4857 if (self.hasFeature(.popcnt)) {4948 const mat_src_mcv = switch (src_mcv) {
4858 const mat_src_mcv = switch (src_mcv) {4949 .immediate => MCValue{ .register = try self.copyToTmpRegister(src_ty, src_mcv) },
4859 .immediate => MCValue{ .register = try self.copyToTmpRegister(src_ty, src_mcv) },4950 else => src_mcv,
4860 else => src_mcv,4951 };
4861 };4952 const mat_src_lock = switch (mat_src_mcv) {
4862 const mat_src_lock = switch (mat_src_mcv) {4953 .register => |reg| self.register_manager.lockReg(reg),
4863 .register => |reg| self.register_manager.lockReg(reg),4954 else => null,
4864 else => null,4955 };
4865 };4956 defer if (mat_src_lock) |lock| self.register_manager.unlockReg(lock);
4866 defer if (mat_src_lock) |lock| self.register_manager.unlockReg(lock);
48674957
4868 const dst_mcv: MCValue =4958 if (src_abi_size <= 8) {
4869 if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv))4959 const dst_contains_src =
4870 src_mcv4960 src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv);
4961 const dst_reg = if (dst_contains_src)
4962 src_mcv.getReg().?
4871 else4963 else
4872 .{ .register = try self.register_manager.allocReg(inst, abi.RegisterClass.gp) };4964 try self.register_manager.allocReg(inst, abi.RegisterClass.gp);
4965 const dst_lock = self.register_manager.lockReg(dst_reg);
4966 defer if (dst_lock) |lock| self.register_manager.unlockReg(lock);
48734967
4874 const popcnt_ty = if (src_abi_size > 1) src_ty else Type.u16;4968 try self.genPopCount(dst_reg, src_ty, mat_src_mcv, dst_contains_src);
4875 try self.genBinOpMir(.{ ._, .popcnt }, popcnt_ty, dst_mcv, mat_src_mcv);4969 break :result .{ .register = dst_reg };
4876 break :result dst_mcv;
4877 }4970 }
48784971
4879 const mask = @as(u64, math.maxInt(u64)) >> @intCast(64 - src_abi_size * 8);4972 assert(src_abi_size > 8 and src_abi_size <= 16);
4880 const imm_0_1 = Immediate.u(mask / 0b1_1);4973 const tmp_regs = try self.register_manager.allocRegs(2, .{ inst, null }, abi.RegisterClass.gp);
4881 const imm_00_11 = Immediate.u(mask / 0b01_01);4974 const tmp_locks = self.register_manager.lockRegsAssumeUnused(2, tmp_regs);
4882 const imm_0000_1111 = Immediate.u(mask / 0b0001_0001);4975 defer for (tmp_locks) |lock| self.register_manager.unlockReg(lock);
4883 const imm_0000_0001 = Immediate.u(mask / 0b1111_1111);
48844976
4885 const dst_mcv = if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv))4977 try self.genPopCount(tmp_regs[0], Type.usize, if (mat_src_mcv.isMemory())
4886 src_mcv4978 mat_src_mcv
4887 else4979 else
4888 try self.copyToRegisterWithInstTracking(inst, src_ty, src_mcv);4980 .{ .register = mat_src_mcv.register_pair[0] }, false);
4889 const dst_reg = dst_mcv.register;4981 try self.genPopCount(tmp_regs[1], Type.usize, if (mat_src_mcv.isMemory())
4890 const dst_lock = self.register_manager.lockRegAssumeUnused(dst_reg);4982 mat_src_mcv.address().offset(8).deref()
4891 defer self.register_manager.unlockReg(dst_lock);4983 else
4984 .{ .register = mat_src_mcv.register_pair[1] }, false);
4985 try self.asmRegisterRegister(.{ ._, .add }, tmp_regs[0].to8(), tmp_regs[1].to8());
4986 break :result .{ .register = tmp_regs[0] };
4987 };
4988 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
4989}
48924990
4893 const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);4991fn genPopCount(
4894 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);4992 self: *Self,
4895 defer self.register_manager.unlockReg(tmp_lock);4993 dst_reg: Register,
4994 src_ty: Type,
4995 src_mcv: MCValue,
4996 dst_contains_src: bool,
4997) !void {
4998 const mod = self.bin_file.options.module.?;
48964999
4897 {5000 const src_abi_size: u32 = @intCast(src_ty.abiSize(mod));
4898 const dst = registerAlias(dst_reg, src_abi_size);5001 if (self.hasFeature(.popcnt)) return self.genBinOpMir(
4899 const tmp = registerAlias(tmp_reg, src_abi_size);5002 .{ ._, .popcnt },
4900 const imm = if (src_abi_size > 4)5003 if (src_abi_size > 1) src_ty else Type.u16,
4901 try self.register_manager.allocReg(null, abi.RegisterClass.gp)5004 .{ .register = dst_reg },
4902 else5005 src_mcv,
4903 undefined;5006 );
49045007
4905 // dst = operand5008 const mask = @as(u64, math.maxInt(u64)) >> @intCast(64 - src_abi_size * 8);
4906 try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst);5009 const imm_0_1 = Immediate.u(mask / 0b1_1);
4907 // tmp = operand5010 const imm_00_11 = Immediate.u(mask / 0b01_01);
4908 try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(1));5011 const imm_0000_1111 = Immediate.u(mask / 0b0001_0001);
4909 // tmp = operand >> 15012 const imm_0000_0001 = Immediate.u(mask / 0b1111_1111);
4910 if (src_abi_size > 4) {5013
4911 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0_1);5014 const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);
4912 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);5015 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);
4913 } else try self.asmRegisterImmediate(.{ ._, .@"and" }, tmp, imm_0_1);5016 defer self.register_manager.unlockReg(tmp_lock);
4914 // tmp = (operand >> 1) & 0x55...555017
4915 try self.asmRegisterRegister(.{ ._, .sub }, dst, tmp);5018 const dst = registerAlias(dst_reg, src_abi_size);
4916 // dst = temp1 = operand - ((operand >> 1) & 0x55...55)5019 const tmp = registerAlias(tmp_reg, src_abi_size);
4917 try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst);5020 const imm = if (src_abi_size > 4)
4918 // tmp = temp15021 try self.register_manager.allocReg(null, abi.RegisterClass.gp)
4919 try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(2));5022 else
4920 // dst = temp1 >> 25023 undefined;
4921 if (src_abi_size > 4) {5024
4922 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_00_11);5025 if (!dst_contains_src) try self.genSetReg(dst, src_ty, src_mcv);
4923 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);5026 // dst = operand
4924 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);5027 try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst);
4925 } else {5028 // tmp = operand
4926 try self.asmRegisterImmediate(.{ ._, .@"and" }, tmp, imm_00_11);5029 try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(1));
4927 try self.asmRegisterImmediate(.{ ._, .@"and" }, dst, imm_00_11);5030 // tmp = operand >> 1
4928 }5031 if (src_abi_size > 4) {
4929 // tmp = temp1 & 0x33...335032 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0_1);
4930 // dst = (temp1 >> 2) & 0x33...335033 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);
4931 try self.asmRegisterRegister(.{ ._, .add }, tmp, dst);5034 } else try self.asmRegisterImmediate(.{ ._, .@"and" }, tmp, imm_0_1);
4932 // tmp = temp2 = (temp1 & 0x33...33) + ((temp1 >> 2) & 0x33...33)5035 // tmp = (operand >> 1) & 0x55...55
4933 try self.asmRegisterRegister(.{ ._, .mov }, dst, tmp);5036 try self.asmRegisterRegister(.{ ._, .sub }, dst, tmp);
4934 // dst = temp25037 // dst = temp1 = operand - ((operand >> 1) & 0x55...55)
4935 try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(4));5038 try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst);
4936 // tmp = temp2 >> 45039 // tmp = temp1
4937 try self.asmRegisterRegister(.{ ._, .add }, dst, tmp);5040 try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(2));
4938 // dst = temp2 + (temp2 >> 4)5041 // dst = temp1 >> 2
4939 if (src_abi_size > 4) {5042 if (src_abi_size > 4) {
4940 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0000_1111);5043 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_00_11);
4941 try self.asmRegisterImmediate(.{ ._, .mov }, tmp, imm_0000_0001);5044 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);
4942 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);5045 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);
4943 try self.asmRegisterRegister(.{ .i_, .mul }, dst, tmp);5046 } else {
4944 } else {5047 try self.asmRegisterImmediate(.{ ._, .@"and" }, tmp, imm_00_11);
4945 try self.asmRegisterImmediate(.{ ._, .@"and" }, dst, imm_0000_1111);5048 try self.asmRegisterImmediate(.{ ._, .@"and" }, dst, imm_00_11);
4946 if (src_abi_size > 1) {5049 }
4947 try self.asmRegisterRegisterImmediate(.{ .i_, .mul }, dst, dst, imm_0000_0001);5050 // tmp = temp1 & 0x33...33
4948 }5051 // dst = (temp1 >> 2) & 0x33...33
4949 }5052 try self.asmRegisterRegister(.{ ._, .add }, tmp, dst);
4950 // dst = temp3 = (temp2 + (temp2 >> 4)) & 0x0f...0f5053 // tmp = temp2 = (temp1 & 0x33...33) + ((temp1 >> 2) & 0x33...33)
4951 // dst = temp3 * 0x01...015054 try self.asmRegisterRegister(.{ ._, .mov }, dst, tmp);
4952 if (src_abi_size > 1) {5055 // dst = temp2
4953 try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u((src_abi_size - 1) * 8));5056 try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(4));
4954 }5057 // tmp = temp2 >> 4
4955 // dst = (temp3 * 0x01...01) >> (bits - 8)5058 try self.asmRegisterRegister(.{ ._, .add }, dst, tmp);
5059 // dst = temp2 + (temp2 >> 4)
5060 if (src_abi_size > 4) {
5061 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0000_1111);
5062 try self.asmRegisterImmediate(.{ ._, .mov }, tmp, imm_0000_0001);
5063 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);
5064 try self.asmRegisterRegister(.{ .i_, .mul }, dst, tmp);
5065 } else {
5066 try self.asmRegisterImmediate(.{ ._, .@"and" }, dst, imm_0000_1111);
5067 if (src_abi_size > 1) {
5068 try self.asmRegisterRegisterImmediate(.{ .i_, .mul }, dst, dst, imm_0000_0001);
4956 }5069 }
4957 break :result dst_mcv;5070 }
4958 };5071 // dst = temp3 = (temp2 + (temp2 >> 4)) & 0x0f...0f
4959 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });5072 // dst = temp3 * 0x01...01
5073 if (src_abi_size > 1) {
5074 try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u((src_abi_size - 1) * 8));
5075 }
5076 // dst = (temp3 * 0x01...01) >> (bits - 8)
4960}5077}
49615078
4962fn byteSwap(self: *Self, inst: Air.Inst.Index, src_ty: Type, src_mcv: MCValue, mem_ok: bool) !MCValue {5079fn genByteSwap(
5080 self: *Self,
5081 inst: Air.Inst.Index,
5082 src_ty: Type,
5083 src_mcv: MCValue,
5084 mem_ok: bool,
5085) !MCValue {
4963 const mod = self.bin_file.options.module.?;5086 const mod = self.bin_file.options.module.?;
4964 const ty_op = self.air.instructions.items(.data)[inst].ty_op;5087 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
49655088
4966 if (src_ty.zigTypeTag(mod) == .Vector) return self.fail(5089 if (src_ty.zigTypeTag(mod) == .Vector) return self.fail(
4967 "TODO implement byteSwap for {}",5090 "TODO implement genByteSwap for {}",
4968 .{src_ty.fmt(mod)},5091 .{src_ty.fmt(mod)},
4969 );5092 );
4970 const src_bits = self.regBitSize(src_ty);5093 const abi_size: u32 = @intCast(src_ty.abiSize(mod));
4971 const src_lock = switch (src_mcv) {5094 const src_lock = switch (src_mcv) {
4972 .register => |reg| self.register_manager.lockRegAssumeUnused(reg),5095 .register => |reg| self.register_manager.lockRegAssumeUnused(reg),
4973 else => null,5096 else => null,
4974 };5097 };
4975 defer if (src_lock) |lock| self.register_manager.unlockReg(lock);5098 defer if (src_lock) |lock| self.register_manager.unlockReg(lock);
49765099
4977 switch (src_bits) {5100 switch (abi_size) {
4978 else => return self.fail("TODO implement byteSwap for {}", .{5101 else => return self.fail("TODO implement genByteSwap for {}", .{
4979 src_ty.fmt(mod),5102 src_ty.fmt(mod),
4980 }),5103 }),
4981 8 => return if ((mem_ok or src_mcv.isRegister()) and5104 1 => return if ((mem_ok or src_mcv.isRegister()) and
4982 self.reuseOperand(inst, ty_op.operand, 0, src_mcv))5105 self.reuseOperand(inst, ty_op.operand, 0, src_mcv))
4983 src_mcv5106 src_mcv
4984 else5107 else
4985 try self.copyToRegisterWithInstTracking(inst, src_ty, src_mcv),5108 try self.copyToRegisterWithInstTracking(inst, src_ty, src_mcv),
4986 16 => if ((mem_ok or src_mcv.isRegister()) and5109 2 => if ((mem_ok or src_mcv.isRegister()) and
4987 self.reuseOperand(inst, ty_op.operand, 0, src_mcv))5110 self.reuseOperand(inst, ty_op.operand, 0, src_mcv))
4988 {5111 {
4989 try self.genBinOpMir(.{ ._l, .ro }, src_ty, src_mcv, .{ .immediate = 8 });5112 try self.genBinOpMir(.{ ._l, .ro }, src_ty, src_mcv, .{ .immediate = 8 });
4990 return src_mcv;5113 return src_mcv;
4991 },5114 },
4992 32, 64 => if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) {5115 3...8 => if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) {
4993 try self.genUnOpMir(.{ ._, .bswap }, src_ty, src_mcv);5116 try self.genUnOpMir(.{ ._, .bswap }, src_ty, src_mcv);
4994 return src_mcv;5117 return src_mcv;
4995 },5118 },
5119 9...16 => {
5120 switch (src_mcv) {
5121 .register_pair => |src_regs| if (self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) {
5122 for (src_regs) |src_reg| try self.asmRegister(.{ ._, .bswap }, src_reg.to64());
5123 return .{ .register_pair = .{ src_regs[1], src_regs[0] } };
5124 },
5125 else => {},
5126 }
5127
5128 const dst_regs =
5129 try self.register_manager.allocRegs(2, .{ inst, inst }, abi.RegisterClass.gp);
5130 const dst_locks = self.register_manager.lockRegsAssumeUnused(2, dst_regs);
5131 defer for (dst_locks) |lock| self.register_manager.unlockReg(lock);
5132
5133 if (src_mcv.isMemory()) {
5134 try self.asmRegisterMemory(
5135 .{ ._, .movbe },
5136 dst_regs[0],
5137 src_mcv.address().offset(8).deref().mem(.qword),
5138 );
5139 try self.asmRegisterMemory(.{ ._, .movbe }, dst_regs[1], src_mcv.mem(.qword));
5140 } else for (dst_regs, src_mcv.register_pair) |dst_reg, src_reg| {
5141 try self.asmRegisterRegister(.{ ._, .mov }, dst_reg.to64(), src_reg.to64());
5142 try self.asmRegister(.{ ._, .bswap }, dst_reg.to64());
5143 }
5144 return .{ .register_pair = dst_regs };
5145 },
4996 }5146 }
49975147
4998 if (src_mcv.isRegister()) {5148 if (src_mcv.isRegister()) {
...@@ -5005,10 +5155,10 @@ fn byteSwap(self: *Self, inst: Air.Inst.Index, src_ty: Type, src_mcv: MCValue, m...@@ -5005,10 +5155,10 @@ fn byteSwap(self: *Self, inst: Air.Inst.Index, src_ty: Type, src_mcv: MCValue, m
5005 defer self.register_manager.unlockReg(dst_lock);5155 defer self.register_manager.unlockReg(dst_lock);
50065156
5007 try self.genSetReg(dst_mcv.register, src_ty, src_mcv);5157 try self.genSetReg(dst_mcv.register, src_ty, src_mcv);
5008 switch (src_bits) {5158 switch (abi_size) {
5009 else => unreachable,5159 else => unreachable,
5010 16 => try self.genBinOpMir(.{ ._l, .ro }, src_ty, dst_mcv, .{ .immediate = 8 }),5160 2 => try self.genBinOpMir(.{ ._l, .ro }, src_ty, dst_mcv, .{ .immediate = 8 }),
5011 32, 64 => try self.genUnOpMir(.{ ._, .bswap }, src_ty, dst_mcv),5161 3...8 => try self.genUnOpMir(.{ ._, .bswap }, src_ty, dst_mcv),
5012 }5162 }
5013 } else try self.genBinOpMir(.{ ._, .movbe }, src_ty, dst_mcv, src_mcv);5163 } else try self.genBinOpMir(.{ ._, .movbe }, src_ty, dst_mcv, src_mcv);
5014 return dst_mcv;5164 return dst_mcv;
...@@ -5028,18 +5178,19 @@ fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void {...@@ -5028,18 +5178,19 @@ fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void {
5028 const ty_op = self.air.instructions.items(.data)[inst].ty_op;5178 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
50295179
5030 const src_ty = self.typeOf(ty_op.operand);5180 const src_ty = self.typeOf(ty_op.operand);
5181 const abi_size: u32 = @intCast(src_ty.abiSize(mod));
5182 const bit_size: u32 = @intCast(src_ty.bitSize(mod));
5031 const src_mcv = try self.resolveInst(ty_op.operand);5183 const src_mcv = try self.resolveInst(ty_op.operand);
50325184
5033 const dst_mcv = try self.byteSwap(inst, src_ty, src_mcv, true);5185 const dst_mcv = try self.genByteSwap(inst, src_ty, src_mcv, true);
5034 switch (self.regExtraBits(src_ty)) {5186
5035 0 => {},5187 const extra_bits = abi_size * 8 - bit_size;
5036 else => |extra| try self.genBinOpMir(5188 const signedness: std.builtin.Signedness =
5037 if (src_ty.isSignedInt(mod)) .{ ._r, .sa } else .{ ._r, .sh },5189 if (src_ty.isAbiInt(mod)) src_ty.intInfo(mod).signedness else .unsigned;
5038 src_ty,5190 if (extra_bits > 0) try self.genShiftBinOpMir(switch (signedness) {
5039 dst_mcv,5191 .signed => .{ ._r, .sa },
5040 .{ .immediate = extra },5192 .unsigned => .{ ._r, .sh },
5041 ),5193 }, src_ty, dst_mcv, .{ .immediate = extra_bits });
5042 }
50435194
5044 return self.finishAir(inst, dst_mcv, .{ ty_op.operand, .none, .none });5195 return self.finishAir(inst, dst_mcv, .{ ty_op.operand, .none, .none });
5045}5196}
...@@ -5049,37 +5200,43 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {...@@ -5049,37 +5200,43 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {
5049 const ty_op = self.air.instructions.items(.data)[inst].ty_op;5200 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
50505201
5051 const src_ty = self.typeOf(ty_op.operand);5202 const src_ty = self.typeOf(ty_op.operand);
5052 const src_abi_size: u32 = @intCast(src_ty.abiSize(mod));5203 const abi_size: u32 = @intCast(src_ty.abiSize(mod));
5204 const bit_size: u32 = @intCast(src_ty.bitSize(mod));
5053 const src_mcv = try self.resolveInst(ty_op.operand);5205 const src_mcv = try self.resolveInst(ty_op.operand);
50545206
5055 const dst_mcv = try self.byteSwap(inst, src_ty, src_mcv, false);5207 const dst_mcv = try self.genByteSwap(inst, src_ty, src_mcv, false);
5056 const dst_reg = dst_mcv.register;5208 const dst_locks: [2]?RegisterLock = switch (dst_mcv) {
5057 const dst_lock = self.register_manager.lockRegAssumeUnused(dst_reg);5209 .register => |dst_reg| .{ self.register_manager.lockReg(dst_reg), null },
5058 defer self.register_manager.unlockReg(dst_lock);5210 .register_pair => |dst_regs| self.register_manager.lockRegs(2, dst_regs),
5211 else => unreachable,
5212 };
5213 defer for (dst_locks) |dst_lock| if (dst_lock) |lock| self.register_manager.unlockReg(lock);
50595214
5060 const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);5215 const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);
5061 const tmp_lock = self.register_manager.lockReg(tmp_reg);5216 const tmp_lock = self.register_manager.lockReg(tmp_reg);
5062 defer if (tmp_lock) |lock| self.register_manager.unlockReg(lock);5217 defer if (tmp_lock) |lock| self.register_manager.unlockReg(lock);
50635218
5064 {5219 const limb_abi_size: u32 = @min(abi_size, 8);
5065 const dst = registerAlias(dst_reg, src_abi_size);5220 const tmp = registerAlias(tmp_reg, limb_abi_size);
5066 const tmp = registerAlias(tmp_reg, src_abi_size);5221 const imm = if (limb_abi_size > 4)
5067 const imm = if (src_abi_size > 4)5222 try self.register_manager.allocReg(null, abi.RegisterClass.gp)
5068 try self.register_manager.allocReg(null, abi.RegisterClass.gp)5223 else
5069 else5224 undefined;
5070 undefined;5225
5226 const mask = @as(u64, math.maxInt(u64)) >> @intCast(64 - limb_abi_size * 8);
5227 const imm_0000_1111 = Immediate.u(mask / 0b0001_0001);
5228 const imm_00_11 = Immediate.u(mask / 0b01_01);
5229 const imm_0_1 = Immediate.u(mask / 0b1_1);
50715230
5072 const mask = @as(u64, math.maxInt(u64)) >> @intCast(64 - src_abi_size * 8);5231 for (dst_mcv.getRegs()) |dst_reg| {
5073 const imm_0000_1111 = Immediate.u(mask / 0b0001_0001);5232 const dst = registerAlias(dst_reg, limb_abi_size);
5074 const imm_00_11 = Immediate.u(mask / 0b01_01);
5075 const imm_0_1 = Immediate.u(mask / 0b1_1);
50765233
5077 // dst = temp1 = bswap(operand)5234 // dst = temp1 = bswap(operand)
5078 try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst);5235 try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst);
5079 // tmp = temp15236 // tmp = temp1
5080 try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(4));5237 try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(4));
5081 // dst = temp1 >> 45238 // dst = temp1 >> 4
5082 if (src_abi_size > 4) {5239 if (limb_abi_size > 4) {
5083 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0000_1111);5240 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0000_1111);
5084 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);5241 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);
5085 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);5242 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);
...@@ -5097,7 +5254,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {...@@ -5097,7 +5254,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {
5097 // tmp = temp25254 // tmp = temp2
5098 try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(2));5255 try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(2));
5099 // dst = temp2 >> 25256 // dst = temp2 >> 2
5100 if (src_abi_size > 4) {5257 if (limb_abi_size > 4) {
5101 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_00_11);5258 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_00_11);
5102 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);5259 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);
5103 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);5260 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);
...@@ -5109,7 +5266,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {...@@ -5109,7 +5266,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {
5109 // dst = (temp2 >> 2) & 0x33...335266 // dst = (temp2 >> 2) & 0x33...33
5110 try self.asmRegisterMemory(5267 try self.asmRegisterMemory(
5111 .{ ._, .lea },5268 .{ ._, .lea },
5112 if (src_abi_size > 4) tmp.to64() else tmp.to32(),5269 if (limb_abi_size > 4) tmp.to64() else tmp.to32(),
5113 Memory.sib(.qword, .{5270 Memory.sib(.qword, .{
5114 .base = .{ .reg = dst.to64() },5271 .base = .{ .reg = dst.to64() },
5115 .scale_index = .{ .index = tmp.to64(), .scale = 1 << 2 },5272 .scale_index = .{ .index = tmp.to64(), .scale = 1 << 2 },
...@@ -5120,7 +5277,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {...@@ -5120,7 +5277,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {
5120 // dst = temp35277 // dst = temp3
5121 try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(1));5278 try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(1));
5122 // tmp = temp3 >> 15279 // tmp = temp3 >> 1
5123 if (src_abi_size > 4) {5280 if (limb_abi_size > 4) {
5124 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0_1);5281 try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0_1);
5125 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);5282 try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm);
5126 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);5283 try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm);
...@@ -5132,7 +5289,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {...@@ -5132,7 +5289,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {
5132 // tmp = (temp3 >> 1) & 0x55...555289 // tmp = (temp3 >> 1) & 0x55...55
5133 try self.asmRegisterMemory(5290 try self.asmRegisterMemory(
5134 .{ ._, .lea },5291 .{ ._, .lea },
5135 if (src_abi_size > 4) dst.to64() else dst.to32(),5292 if (limb_abi_size > 4) dst.to64() else dst.to32(),
5136 Memory.sib(.qword, .{5293 Memory.sib(.qword, .{
5137 .base = .{ .reg = tmp.to64() },5294 .base = .{ .reg = tmp.to64() },
5138 .scale_index = .{ .index = dst.to64(), .scale = 1 << 1 },5295 .scale_index = .{ .index = dst.to64(), .scale = 1 << 1 },
...@@ -5141,15 +5298,13 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {...@@ -5141,15 +5298,13 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {
5141 // dst = ((temp3 >> 1) & 0x55...55) + ((temp3 & 0x55...55) << 1)5298 // dst = ((temp3 >> 1) & 0x55...55) + ((temp3 & 0x55...55) << 1)
5142 }5299 }
51435300
5144 switch (self.regExtraBits(src_ty)) {5301 const extra_bits = abi_size * 8 - bit_size;
5145 0 => {},5302 const signedness: std.builtin.Signedness =
5146 else => |extra| try self.genBinOpMir(5303 if (src_ty.isAbiInt(mod)) src_ty.intInfo(mod).signedness else .unsigned;
5147 if (src_ty.isSignedInt(mod)) .{ ._r, .sa } else .{ ._r, .sh },5304 if (extra_bits > 0) try self.genShiftBinOpMir(switch (signedness) {
5148 src_ty,5305 .signed => .{ ._r, .sa },
5149 dst_mcv,5306 .unsigned => .{ ._r, .sh },
5150 .{ .immediate = extra },5307 }, src_ty, dst_mcv, .{ .immediate = extra_bits });
5151 ),
5152 }
51535308
5154 return self.finishAir(inst, dst_mcv, .{ ty_op.operand, .none, .none });5309 return self.finishAir(inst, dst_mcv, .{ ty_op.operand, .none, .none });
5155}5310}
...@@ -5210,13 +5365,11 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)...@@ -5210,13 +5365,11 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)
5210 .child = (try mod.intType(.signed, scalar_bits)).ip_index,5365 .child = (try mod.intType(.signed, scalar_bits)).ip_index,
5211 });5366 });
52125367
5213 const sign_val = switch (tag) {5368 const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = switch (tag) {
5214 .neg => try vec_ty.minInt(mod, vec_ty),5369 .neg => try vec_ty.minInt(mod, vec_ty),
5215 .abs => try vec_ty.maxInt(mod, vec_ty),5370 .abs => try vec_ty.maxInt(mod, vec_ty),
5216 else => unreachable,5371 else => unreachable,
5217 };5372 } });
5218
5219 const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = sign_val });
5220 const sign_mem = if (sign_mcv.isMemory())5373 const sign_mem = if (sign_mcv.isMemory())
5221 sign_mcv.mem(Memory.PtrSize.fromSize(abi_size))5374 sign_mcv.mem(Memory.PtrSize.fromSize(abi_size))
5222 else5375 else
...@@ -5285,7 +5438,6 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)...@@ -5285,7 +5438,6 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)
5285fn airFloatSign(self: *Self, inst: Air.Inst.Index) !void {5438fn airFloatSign(self: *Self, inst: Air.Inst.Index) !void {
5286 const un_op = self.air.instructions.items(.data)[inst].un_op;5439 const un_op = self.air.instructions.items(.data)[inst].un_op;
5287 const ty = self.typeOf(un_op);5440 const ty = self.typeOf(un_op);
5288
5289 return self.floatSign(inst, un_op, ty);5441 return self.floatSign(inst, un_op, ty);
5290}5442}
52915443
...@@ -5305,7 +5457,7 @@ const RoundMode = packed struct(u5) {...@@ -5305,7 +5457,7 @@ const RoundMode = packed struct(u5) {
5305 precision: enum(u1) {5457 precision: enum(u1) {
5306 normal = 0b0,5458 normal = 0b0,
5307 inexact = 0b1,5459 inexact = 0b1,
5308 },5460 } = .normal,
5309};5461};
53105462
5311fn airRound(self: *Self, inst: Air.Inst.Index, mode: RoundMode) !void {5463fn airRound(self: *Self, inst: Air.Inst.Index, mode: RoundMode) !void {
...@@ -5371,11 +5523,11 @@ fn genRoundLibcall(self: *Self, ty: Type, src_mcv: MCValue, mode: RoundMode) !MC...@@ -5371,11 +5523,11 @@ fn genRoundLibcall(self: *Self, ty: Type, src_mcv: MCValue, mode: RoundMode) !MC
5371 if (ty.zigTypeTag(mod) != .Float)5523 if (ty.zigTypeTag(mod) != .Float)
5372 return self.fail("TODO implement genRound for {}", .{ty.fmt(mod)});5524 return self.fail("TODO implement genRound for {}", .{ty.fmt(mod)});
53735525
5374 var callee: ["__trunc?".len]u8 = undefined;5526 var callee_buf: ["__trunc?".len]u8 = undefined;
5375 return try self.genCall(.{ .lib = .{5527 return try self.genCall(.{ .lib = .{
5376 .return_type = ty.toIntern(),5528 .return_type = ty.toIntern(),
5377 .param_types = &.{ty.toIntern()},5529 .param_types = &.{ty.toIntern()},
5378 .callee = std.fmt.bufPrint(&callee, "{s}{s}{s}", .{5530 .callee = std.fmt.bufPrint(&callee_buf, "{s}{s}{s}", .{
5379 floatLibcAbiPrefix(ty),5531 floatLibcAbiPrefix(ty),
5380 switch (mode.mode) {5532 switch (mode.mode) {
5381 .down => "floor",5533 .down => "floor",
...@@ -5586,11 +5738,11 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {...@@ -5586,11 +5738,11 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
5586 80, 128 => true,5738 80, 128 => true,
5587 else => unreachable,5739 else => unreachable,
5588 }) {5740 }) {
5589 var callee: ["__sqrt?".len]u8 = undefined;5741 var callee_buf: ["__sqrt?".len]u8 = undefined;
5590 break :result try self.genCall(.{ .lib = .{5742 break :result try self.genCall(.{ .lib = .{
5591 .return_type = ty.toIntern(),5743 .return_type = ty.toIntern(),
5592 .param_types = &.{ty.toIntern()},5744 .param_types = &.{ty.toIntern()},
5593 .callee = std.fmt.bufPrint(&callee, "{s}sqrt{s}", .{5745 .callee = std.fmt.bufPrint(&callee_buf, "{s}sqrt{s}", .{
5594 floatLibcAbiPrefix(ty),5746 floatLibcAbiPrefix(ty),
5595 floatLibcAbiSuffix(ty),5747 floatLibcAbiSuffix(ty),
5596 }) catch unreachable,5748 }) catch unreachable,
...@@ -5623,7 +5775,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {...@@ -5623,7 +5775,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
5623 .{ .v_, .cvtps2ph },5775 .{ .v_, .cvtps2ph },
5624 dst_reg,5776 dst_reg,
5625 dst_reg,5777 dst_reg,
5626 Immediate.u(0b1_00),5778 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
5627 );5779 );
5628 break :result dst_mcv;5780 break :result dst_mcv;
5629 },5781 },
...@@ -5653,7 +5805,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {...@@ -5653,7 +5805,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
5653 .{ .v_, .cvtps2ph },5805 .{ .v_, .cvtps2ph },
5654 dst_reg,5806 dst_reg,
5655 dst_reg,5807 dst_reg,
5656 Immediate.u(0b1_00),5808 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
5657 );5809 );
5658 break :result dst_mcv;5810 break :result dst_mcv;
5659 },5811 },
...@@ -5678,7 +5830,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {...@@ -5678,7 +5830,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
5678 .{ .v_, .cvtps2ph },5830 .{ .v_, .cvtps2ph },
5679 dst_reg,5831 dst_reg,
5680 wide_reg,5832 wide_reg,
5681 Immediate.u(0b1_00),5833 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
5682 );5834 );
5683 break :result dst_mcv;5835 break :result dst_mcv;
5684 },5836 },
...@@ -5741,11 +5893,11 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {...@@ -5741,11 +5893,11 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
5741fn airUnaryMath(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {5893fn airUnaryMath(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
5742 const un_op = self.air.instructions.items(.data)[inst].un_op;5894 const un_op = self.air.instructions.items(.data)[inst].un_op;
5743 const ty = self.typeOf(un_op);5895 const ty = self.typeOf(un_op);
5744 var callee: ["__round?".len]u8 = undefined;5896 var callee_buf: ["__round?".len]u8 = undefined;
5745 const result = try self.genCall(.{ .lib = .{5897 const result = try self.genCall(.{ .lib = .{
5746 .return_type = ty.toIntern(),5898 .return_type = ty.toIntern(),
5747 .param_types = &.{ty.toIntern()},5899 .param_types = &.{ty.toIntern()},
5748 .callee = std.fmt.bufPrint(&callee, "{s}{s}{s}", .{5900 .callee = std.fmt.bufPrint(&callee_buf, "{s}{s}{s}", .{
5749 floatLibcAbiPrefix(ty),5901 floatLibcAbiPrefix(ty),
5750 switch (tag) {5902 switch (tag) {
5751 .sin,5903 .sin,
...@@ -5782,7 +5934,7 @@ fn reuseOperandAdvanced(...@@ -5782,7 +5934,7 @@ fn reuseOperandAdvanced(
5782 operand: Air.Inst.Ref,5934 operand: Air.Inst.Ref,
5783 op_index: Liveness.OperandInt,5935 op_index: Liveness.OperandInt,
5784 mcv: MCValue,5936 mcv: MCValue,
5785 tracked_inst: Air.Inst.Index,5937 maybe_tracked_inst: ?Air.Inst.Index,
5786) bool {5938) bool {
5787 if (!self.liveness.operandDies(inst, op_index))5939 if (!self.liveness.operandDies(inst, op_index))
5788 return false;5940 return false;
...@@ -5791,11 +5943,13 @@ fn reuseOperandAdvanced(...@@ -5791,11 +5943,13 @@ fn reuseOperandAdvanced(
5791 .register, .register_pair => for (mcv.getRegs()) |reg| {5943 .register, .register_pair => for (mcv.getRegs()) |reg| {
5792 // If it's in the registers table, need to associate the register(s) with the5944 // If it's in the registers table, need to associate the register(s) with the
5793 // new instruction.5945 // new instruction.
5794 if (!self.register_manager.isRegFree(reg)) {5946 if (maybe_tracked_inst) |tracked_inst| {
5795 if (RegisterManager.indexOfRegIntoTracked(reg)) |index| {5947 if (!self.register_manager.isRegFree(reg)) {
5796 self.register_manager.registers[index] = tracked_inst;5948 if (RegisterManager.indexOfRegIntoTracked(reg)) |index| {
5949 self.register_manager.registers[index] = tracked_inst;
5950 }
5797 }5951 }
5798 }5952 } else self.register_manager.freeReg(reg);
5799 },5953 },
5800 .load_frame => |frame_addr| if (frame_addr.index.isNamed()) return false,5954 .load_frame => |frame_addr| if (frame_addr.index.isNamed()) return false,
5801 else => return false,5955 else => return false,
...@@ -5804,7 +5958,7 @@ fn reuseOperandAdvanced(...@@ -5804,7 +5958,7 @@ fn reuseOperandAdvanced(
5804 // Prevent the operand deaths processing code from deallocating it.5958 // Prevent the operand deaths processing code from deallocating it.
5805 self.liveness.clearOperandDeath(inst, op_index);5959 self.liveness.clearOperandDeath(inst, op_index);
5806 const op_inst = Air.refToIndex(operand).?;5960 const op_inst = Air.refToIndex(operand).?;
5807 self.getResolvedInstValue(op_inst).reuse(self, tracked_inst, op_inst);5961 self.getResolvedInstValue(op_inst).reuse(self, maybe_tracked_inst, op_inst);
58085962
5809 return true;5963 return true;
5810}5964}
...@@ -6934,11 +7088,11 @@ fn genMulDivBinOp(...@@ -6934,11 +7088,11 @@ fn genMulDivBinOp(
6934 ),7088 ),
6935 else => {},7089 else => {},
6936 };7090 };
6937 var callee: ["__udiv?i3".len]u8 = undefined;7091 var callee_buf: ["__udiv?i3".len]u8 = undefined;
6938 return try self.genCall(.{ .lib = .{7092 return try self.genCall(.{ .lib = .{
6939 .return_type = dst_ty.toIntern(),7093 .return_type = dst_ty.toIntern(),
6940 .param_types = &.{ src_ty.toIntern(), src_ty.toIntern() },7094 .param_types = &.{ src_ty.toIntern(), src_ty.toIntern() },
6941 .callee = std.fmt.bufPrint(&callee, "__{s}{s}{c}i3", .{7095 .callee = std.fmt.bufPrint(&callee_buf, "__{s}{s}{c}i3", .{
6942 if (signed) "" else "u",7096 if (signed) "" else "u",
6943 switch (tag) {7097 switch (tag) {
6944 .div_trunc, .div_exact => "div",7098 .div_trunc, .div_exact => "div",
...@@ -7161,43 +7315,163 @@ fn genBinOp(...@@ -7161,43 +7315,163 @@ fn genBinOp(
7161 const rhs_ty = self.typeOf(rhs_air);7315 const rhs_ty = self.typeOf(rhs_air);
7162 const abi_size: u32 = @intCast(lhs_ty.abiSize(mod));7316 const abi_size: u32 = @intCast(lhs_ty.abiSize(mod));
71637317
7164 if (lhs_ty.isRuntimeFloat() and (air_tag == .rem or switch (lhs_ty.floatBits(self.target.*)) {7318 if (lhs_ty.isRuntimeFloat()) libcall: {
7165 16 => !self.hasFeature(.f16c),7319 const float_bits = lhs_ty.floatBits(self.target.*);
7166 32, 64 => false,7320 const type_needs_libcall = switch (float_bits) {
7167 80, 128 => true,7321 16 => !self.hasFeature(.f16c),
7168 else => unreachable,7322 32, 64 => false,
7169 })) {7323 80, 128 => true,
7170 var callee: ["__mod?f3".len]u8 = undefined;7324 else => unreachable,
7325 };
7326 switch (air_tag) {
7327 .rem, .mod => {},
7328 else => if (!type_needs_libcall) break :libcall,
7329 }
7330 var callee_buf: ["__mod?f3".len]u8 = undefined;
7331 const callee = switch (air_tag) {
7332 .add,
7333 .sub,
7334 .mul,
7335 .div_float,
7336 .div_trunc,
7337 .div_floor,
7338 => std.fmt.bufPrint(&callee_buf, "__{s}{c}f3", .{
7339 @tagName(air_tag)[0..3],
7340 floatCompilerRtAbiName(float_bits),
7341 }),
7342 .rem, .mod, .min, .max => std.fmt.bufPrint(&callee_buf, "{s}f{s}{s}", .{
7343 floatLibcAbiPrefix(lhs_ty),
7344 switch (air_tag) {
7345 .rem, .mod => "mod",
7346 .min => "min",
7347 .max => "max",
7348 else => unreachable,
7349 },
7350 floatLibcAbiSuffix(lhs_ty),
7351 }),
7352 else => return self.fail("TODO implement genBinOp for {s} {}", .{
7353 @tagName(air_tag), lhs_ty.fmt(mod),
7354 }),
7355 } catch unreachable;
7171 const result = try self.genCall(.{ .lib = .{7356 const result = try self.genCall(.{ .lib = .{
7172 .return_type = lhs_ty.toIntern(),7357 .return_type = lhs_ty.toIntern(),
7173 .param_types = &.{ lhs_ty.toIntern(), rhs_ty.toIntern() },7358 .param_types = &.{ lhs_ty.toIntern(), rhs_ty.toIntern() },
7174 .callee = switch (air_tag) {7359 .callee = callee,
7175 .add,
7176 .sub,
7177 .mul,
7178 .div_float,
7179 .div_trunc,
7180 .div_floor,
7181 => std.fmt.bufPrint(&callee, "__{s}{c}f3", .{
7182 @tagName(air_tag)[0..3],
7183 floatCompilerRtAbiName(lhs_ty.floatBits(self.target.*)),
7184 }),
7185 .rem, .min, .max => std.fmt.bufPrint(&callee, "{s}f{s}{s}", .{
7186 floatLibcAbiPrefix(lhs_ty),
7187 switch (air_tag) {
7188 .rem => "mod",
7189 .min => "min",
7190 .max => "max",
7191 else => unreachable,
7192 },
7193 floatLibcAbiSuffix(lhs_ty),
7194 }),
7195 else => return self.fail("TODO implement genBinOp for {s} {}", .{
7196 @tagName(air_tag), lhs_ty.fmt(mod),
7197 }),
7198 } catch unreachable,
7199 } }, &.{ lhs_ty, rhs_ty }, &.{ .{ .air_ref = lhs_air }, .{ .air_ref = rhs_air } });7360 } }, &.{ lhs_ty, rhs_ty }, &.{ .{ .air_ref = lhs_air }, .{ .air_ref = rhs_air } });
7200 return switch (air_tag) {7361 return switch (air_tag) {
7362 .mod => result: {
7363 const adjusted: MCValue = if (type_needs_libcall) adjusted: {
7364 var add_callee_buf: ["__add?f3".len]u8 = undefined;
7365 break :adjusted try self.genCall(.{ .lib = .{
7366 .return_type = lhs_ty.toIntern(),
7367 .param_types = &.{
7368 lhs_ty.toIntern(),
7369 rhs_ty.toIntern(),
7370 },
7371 .callee = std.fmt.bufPrint(&add_callee_buf, "__add{c}f3", .{
7372 floatCompilerRtAbiName(float_bits),
7373 }) catch unreachable,
7374 } }, &.{ lhs_ty, rhs_ty }, &.{ result, .{ .air_ref = rhs_air } });
7375 } else switch (float_bits) {
7376 16, 32, 64 => adjusted: {
7377 const dst_reg = switch (result) {
7378 .register => |reg| reg,
7379 else => if (maybe_inst) |inst|
7380 (try self.copyToRegisterWithInstTracking(inst, lhs_ty, result)).register
7381 else
7382 try self.copyToTmpRegister(lhs_ty, result),
7383 };
7384 const dst_lock = self.register_manager.lockReg(dst_reg);
7385 defer if (dst_lock) |lock| self.register_manager.unlockReg(lock);
7386
7387 const rhs_mcv = try self.resolveInst(rhs_air);
7388 const src_mcv: MCValue = if (float_bits == 16) src: {
7389 assert(self.hasFeature(.f16c));
7390 const tmp_reg = (try self.register_manager.allocReg(
7391 null,
7392 abi.RegisterClass.sse,
7393 )).to128();
7394 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);
7395 defer self.register_manager.unlockReg(tmp_lock);
7396
7397 if (rhs_mcv.isMemory()) try self.asmRegisterRegisterMemoryImmediate(
7398 .{ .vp_w, .insr },
7399 dst_reg,
7400 dst_reg,
7401 rhs_mcv.mem(.word),
7402 Immediate.u(1),
7403 ) else try self.asmRegisterRegisterRegister(
7404 .{ .vp_, .unpcklwd },
7405 dst_reg,
7406 dst_reg,
7407 (if (rhs_mcv.isRegister())
7408 rhs_mcv.getReg().?
7409 else
7410 try self.copyToTmpRegister(rhs_ty, rhs_mcv)).to128(),
7411 );
7412 try self.asmRegisterRegister(.{ .v_ps, .cvtph2 }, dst_reg, dst_reg);
7413 break :src .{ .register = tmp_reg };
7414 } else rhs_mcv;
7415
7416 if (self.hasFeature(.avx)) {
7417 const mir_tag: Mir.Inst.FixedTag = switch (float_bits) {
7418 16, 32 => .{ .v_ss, .add },
7419 64 => .{ .v_sd, .add },
7420 else => unreachable,
7421 };
7422 if (src_mcv.isMemory()) try self.asmRegisterRegisterMemory(
7423 mir_tag,
7424 dst_reg,
7425 dst_reg,
7426 src_mcv.mem(Memory.PtrSize.fromBitSize(float_bits)),
7427 ) else try self.asmRegisterRegisterRegister(
7428 mir_tag,
7429 dst_reg,
7430 dst_reg,
7431 (if (src_mcv.isRegister())
7432 src_mcv.getReg().?
7433 else
7434 try self.copyToTmpRegister(rhs_ty, src_mcv)).to128(),
7435 );
7436 } else {
7437 const mir_tag: Mir.Inst.FixedTag = switch (float_bits) {
7438 32 => .{ ._ss, .add },
7439 64 => .{ ._sd, .add },
7440 else => unreachable,
7441 };
7442 if (src_mcv.isMemory()) try self.asmRegisterMemory(
7443 mir_tag,
7444 dst_reg,
7445 src_mcv.mem(Memory.PtrSize.fromBitSize(float_bits)),
7446 ) else try self.asmRegisterRegister(
7447 mir_tag,
7448 dst_reg,
7449 (if (src_mcv.isRegister())
7450 src_mcv.getReg().?
7451 else
7452 try self.copyToTmpRegister(rhs_ty, src_mcv)).to128(),
7453 );
7454 }
7455
7456 if (float_bits == 16) try self.asmRegisterRegisterImmediate(
7457 .{ .v_, .cvtps2ph },
7458 dst_reg,
7459 dst_reg,
7460 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
7461 );
7462 break :adjusted .{ .register = dst_reg };
7463 },
7464 80, 128 => return self.fail("TODO implement genBinOp for {s} of {}", .{
7465 @tagName(air_tag), lhs_ty.fmt(mod),
7466 }),
7467 else => unreachable,
7468 };
7469 break :result try self.genCall(.{ .lib = .{
7470 .return_type = lhs_ty.toIntern(),
7471 .param_types = &.{ lhs_ty.toIntern(), rhs_ty.toIntern() },
7472 .callee = callee,
7473 } }, &.{ lhs_ty, rhs_ty }, &.{ adjusted, .{ .air_ref = rhs_air } });
7474 },
7201 .div_trunc, .div_floor => try self.genRoundLibcall(lhs_ty, result, .{7475 .div_trunc, .div_floor => try self.genRoundLibcall(lhs_ty, result, .{
7202 .mode = switch (air_tag) {7476 .mode = switch (air_tag) {
7203 .div_trunc => .zero,7477 .div_trunc => .zero,
...@@ -7219,6 +7493,7 @@ fn genBinOp(...@@ -7219,6 +7493,7 @@ fn genBinOp(
72197493
7220 const maybe_mask_reg = switch (air_tag) {7494 const maybe_mask_reg = switch (air_tag) {
7221 else => null,7495 else => null,
7496 .rem, .mod => unreachable,
7222 .max, .min => if (lhs_ty.scalarType(mod).isRuntimeFloat()) registerAlias(7497 .max, .min => if (lhs_ty.scalarType(mod).isRuntimeFloat()) registerAlias(
7223 if (!self.hasFeature(.avx) and self.hasFeature(.sse4_1)) mask: {7498 if (!self.hasFeature(.avx) and self.hasFeature(.sse4_1)) mask: {
7224 try self.register_manager.getReg(.xmm0, null);7499 try self.register_manager.getReg(.xmm0, null);
...@@ -7226,20 +7501,23 @@ fn genBinOp(...@@ -7226,20 +7501,23 @@ fn genBinOp(
7226 } else try self.register_manager.allocReg(null, abi.RegisterClass.sse),7501 } else try self.register_manager.allocReg(null, abi.RegisterClass.sse),
7227 abi_size,7502 abi_size,
7228 ) else null,7503 ) else null,
7229 .rem, .mod => return self.fail("TODO implement genBinOp for {s} {}", .{
7230 @tagName(air_tag), lhs_ty.fmt(mod),
7231 }),
7232 };7504 };
7233 const mask_lock =7505 const mask_lock =
7234 if (maybe_mask_reg) |mask_reg| self.register_manager.lockRegAssumeUnused(mask_reg) else null;7506 if (maybe_mask_reg) |mask_reg| self.register_manager.lockRegAssumeUnused(mask_reg) else null;
7235 defer if (mask_lock) |lock| self.register_manager.unlockReg(lock);7507 defer if (mask_lock) |lock| self.register_manager.unlockReg(lock);
72367508
7237 const lhs_mcv = try self.resolveInst(lhs_air);7509 const ordered_air = if (lhs_ty.isVector(mod) and lhs_ty.childType(mod).isAbiInt(mod) and
7238 const rhs_mcv = try self.resolveInst(rhs_air);7510 switch (air_tag) {
7511 .cmp_lt, .cmp_gte => true,
7512 else => false,
7513 }) .{ .lhs = rhs_air, .rhs = lhs_air } else .{ .lhs = lhs_air, .rhs = rhs_air };
7514
7515 const lhs_mcv = try self.resolveInst(ordered_air.lhs);
7516 const rhs_mcv = try self.resolveInst(ordered_air.rhs);
7239 switch (lhs_mcv) {7517 switch (lhs_mcv) {
7240 .immediate => |imm| switch (imm) {7518 .immediate => |imm| switch (imm) {
7241 0 => switch (air_tag) {7519 0 => switch (air_tag) {
7242 .sub, .sub_wrap => return self.genUnOp(maybe_inst, .neg, rhs_air),7520 .sub, .sub_wrap => return self.genUnOp(maybe_inst, .neg, ordered_air.rhs),
7243 else => {},7521 else => {},
7244 },7522 },
7245 else => {},7523 else => {},
...@@ -7288,11 +7566,15 @@ fn genBinOp(...@@ -7288,11 +7566,15 @@ fn genBinOp(
7288 var copied_to_dst = true;7566 var copied_to_dst = true;
7289 const dst_mcv: MCValue = dst: {7567 const dst_mcv: MCValue = dst: {
7290 if (maybe_inst) |inst| {7568 if (maybe_inst) |inst| {
7291 if ((!vec_op or lhs_mcv.isRegister()) and self.reuseOperand(inst, lhs_air, 0, lhs_mcv)) {7569 const tracked_inst = switch (air_tag) {
7570 else => inst,
7571 .cmp_lt, .cmp_lte, .cmp_eq, .cmp_gte, .cmp_gt, .cmp_neq => null,
7572 };
7573 if ((!vec_op or lhs_mcv.isRegister()) and
7574 self.reuseOperandAdvanced(inst, ordered_air.lhs, 0, lhs_mcv, tracked_inst))
7292 break :dst lhs_mcv;7575 break :dst lhs_mcv;
7293 }
7294 if (is_commutative and (!vec_op or rhs_mcv.isRegister()) and7576 if (is_commutative and (!vec_op or rhs_mcv.isRegister()) and
7295 self.reuseOperand(inst, rhs_air, 1, rhs_mcv))7577 self.reuseOperandAdvanced(inst, ordered_air.rhs, 1, rhs_mcv, tracked_inst))
7296 {7578 {
7297 flipped = true;7579 flipped = true;
7298 break :dst rhs_mcv;7580 break :dst rhs_mcv;
...@@ -7613,7 +7895,7 @@ fn genBinOp(...@@ -7613,7 +7895,7 @@ fn genBinOp(
7613 .{ .v_, .cvtps2ph },7895 .{ .v_, .cvtps2ph },
7614 dst_reg,7896 dst_reg,
7615 dst_reg,7897 dst_reg,
7616 Immediate.u(0b1_00),7898 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
7617 );7899 );
7618 return dst_mcv;7900 return dst_mcv;
7619 },7901 },
...@@ -7657,7 +7939,10 @@ fn genBinOp(...@@ -7657,7 +7939,10 @@ fn genBinOp(
7657 .sub,7939 .sub,
7658 .sub_wrap,7940 .sub_wrap,
7659 => if (self.hasFeature(.avx)) .{ .vp_b, .sub } else .{ .p_b, .sub },7941 => if (self.hasFeature(.avx)) .{ .vp_b, .sub } else .{ .p_b, .sub },
7660 .bit_and => if (self.hasFeature(.avx)) .{ .vp_, .@"and" } else .{ .p_, .@"and" },7942 .bit_and => if (self.hasFeature(.avx))
7943 .{ .vp_, .@"and" }
7944 else
7945 .{ .p_, .@"and" },
7661 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },7946 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
7662 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },7947 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
7663 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {7948 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
...@@ -7688,6 +7973,20 @@ fn genBinOp(...@@ -7688,6 +7973,20 @@ fn genBinOp(
7688 else7973 else
7689 null,7974 null,
7690 },7975 },
7976 .cmp_lt,
7977 .cmp_lte,
7978 .cmp_gte,
7979 .cmp_gt,
7980 => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
7981 .signed => if (self.hasFeature(.avx))
7982 .{ .vp_b, .cmpgt }
7983 else
7984 .{ .p_b, .cmpgt },
7985 .unsigned => null,
7986 },
7987 .cmp_eq,
7988 .cmp_neq,
7989 => if (self.hasFeature(.avx)) .{ .vp_b, .cmpeq } else .{ .p_b, .cmpeq },
7691 else => null,7990 else => null,
7692 },7991 },
7693 17...32 => switch (air_tag) {7992 17...32 => switch (air_tag) {
...@@ -7708,6 +8007,17 @@ fn genBinOp(...@@ -7708,6 +8007,17 @@ fn genBinOp(
7708 .signed => if (self.hasFeature(.avx2)) .{ .vp_b, .maxs } else null,8007 .signed => if (self.hasFeature(.avx2)) .{ .vp_b, .maxs } else null,
7709 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_b, .maxu } else null,8008 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_b, .maxu } else null,
7710 },8009 },
8010 .cmp_lt,
8011 .cmp_lte,
8012 .cmp_gte,
8013 .cmp_gt,
8014 => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
8015 .signed => if (self.hasFeature(.avx)) .{ .vp_b, .cmpgt } else null,
8016 .unsigned => null,
8017 },
8018 .cmp_eq,
8019 .cmp_neq,
8020 => if (self.hasFeature(.avx)) .{ .vp_b, .cmpeq } else null,
7711 else => null,8021 else => null,
7712 },8022 },
7713 else => null,8023 else => null,
...@@ -7723,7 +8033,10 @@ fn genBinOp(...@@ -7723,7 +8033,10 @@ fn genBinOp(
7723 .mul,8033 .mul,
7724 .mul_wrap,8034 .mul_wrap,
7725 => if (self.hasFeature(.avx)) .{ .vp_w, .mull } else .{ .p_d, .mull },8035 => if (self.hasFeature(.avx)) .{ .vp_w, .mull } else .{ .p_d, .mull },
7726 .bit_and => if (self.hasFeature(.avx)) .{ .vp_, .@"and" } else .{ .p_, .@"and" },8036 .bit_and => if (self.hasFeature(.avx))
8037 .{ .vp_, .@"and" }
8038 else
8039 .{ .p_, .@"and" },
7727 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },8040 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
7728 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },8041 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
7729 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {8042 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
...@@ -7746,6 +8059,20 @@ fn genBinOp(...@@ -7746,6 +8059,20 @@ fn genBinOp(
7746 else8059 else
7747 .{ .p_w, .maxu },8060 .{ .p_w, .maxu },
7748 },8061 },
8062 .cmp_lt,
8063 .cmp_lte,
8064 .cmp_gte,
8065 .cmp_gt,
8066 => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
8067 .signed => if (self.hasFeature(.avx))
8068 .{ .vp_w, .cmpgt }
8069 else
8070 .{ .p_w, .cmpgt },
8071 .unsigned => null,
8072 },
8073 .cmp_eq,
8074 .cmp_neq,
8075 => if (self.hasFeature(.avx)) .{ .vp_w, .cmpeq } else .{ .p_w, .cmpeq },
7749 else => null,8076 else => null,
7750 },8077 },
7751 9...16 => switch (air_tag) {8078 9...16 => switch (air_tag) {
...@@ -7769,6 +8096,17 @@ fn genBinOp(...@@ -7769,6 +8096,17 @@ fn genBinOp(
7769 .signed => if (self.hasFeature(.avx2)) .{ .vp_w, .maxs } else null,8096 .signed => if (self.hasFeature(.avx2)) .{ .vp_w, .maxs } else null,
7770 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_w, .maxu } else null,8097 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_w, .maxu } else null,
7771 },8098 },
8099 .cmp_lt,
8100 .cmp_lte,
8101 .cmp_gte,
8102 .cmp_gt,
8103 => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
8104 .signed => if (self.hasFeature(.avx)) .{ .vp_w, .cmpgt } else null,
8105 .unsigned => null,
8106 },
8107 .cmp_eq,
8108 .cmp_neq,
8109 => if (self.hasFeature(.avx)) .{ .vp_w, .cmpeq } else null,
7772 else => null,8110 else => null,
7773 },8111 },
7774 else => null,8112 else => null,
...@@ -7789,7 +8127,10 @@ fn genBinOp(...@@ -7789,7 +8127,10 @@ fn genBinOp(
7789 .{ .p_d, .mull }8127 .{ .p_d, .mull }
7790 else8128 else
7791 null,8129 null,
7792 .bit_and => if (self.hasFeature(.avx)) .{ .vp_, .@"and" } else .{ .p_, .@"and" },8130 .bit_and => if (self.hasFeature(.avx))
8131 .{ .vp_, .@"and" }
8132 else
8133 .{ .p_, .@"and" },
7793 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },8134 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
7794 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },8135 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
7795 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {8136 .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
...@@ -7820,6 +8161,20 @@ fn genBinOp(...@@ -7820,6 +8161,20 @@ fn genBinOp(
7820 else8161 else
7821 null,8162 null,
7822 },8163 },
8164 .cmp_lt,
8165 .cmp_lte,
8166 .cmp_gte,
8167 .cmp_gt,
8168 => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
8169 .signed => if (self.hasFeature(.avx))
8170 .{ .vp_d, .cmpgt }
8171 else
8172 .{ .p_d, .cmpgt },
8173 .unsigned => null,
8174 },
8175 .cmp_eq,
8176 .cmp_neq,
8177 => if (self.hasFeature(.avx)) .{ .vp_d, .cmpeq } else .{ .p_d, .cmpeq },
7823 else => null,8178 else => null,
7824 },8179 },
7825 5...8 => switch (air_tag) {8180 5...8 => switch (air_tag) {
...@@ -7843,6 +8198,17 @@ fn genBinOp(...@@ -7843,6 +8198,17 @@ fn genBinOp(
7843 .signed => if (self.hasFeature(.avx2)) .{ .vp_d, .maxs } else null,8198 .signed => if (self.hasFeature(.avx2)) .{ .vp_d, .maxs } else null,
7844 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_d, .maxu } else null,8199 .unsigned => if (self.hasFeature(.avx2)) .{ .vp_d, .maxu } else null,
7845 },8200 },
8201 .cmp_lt,
8202 .cmp_lte,
8203 .cmp_gte,
8204 .cmp_gt,
8205 => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
8206 .signed => if (self.hasFeature(.avx)) .{ .vp_d, .cmpgt } else null,
8207 .unsigned => null,
8208 },
8209 .cmp_eq,
8210 .cmp_neq,
8211 => if (self.hasFeature(.avx)) .{ .vp_d, .cmpeq } else null,
7846 else => null,8212 else => null,
7847 },8213 },
7848 else => null,8214 else => null,
...@@ -7855,9 +8221,33 @@ fn genBinOp(...@@ -7855,9 +8221,33 @@ fn genBinOp(
7855 .sub,8221 .sub,
7856 .sub_wrap,8222 .sub_wrap,
7857 => if (self.hasFeature(.avx)) .{ .vp_q, .sub } else .{ .p_q, .sub },8223 => if (self.hasFeature(.avx)) .{ .vp_q, .sub } else .{ .p_q, .sub },
7858 .bit_and => if (self.hasFeature(.avx)) .{ .vp_, .@"and" } else .{ .p_, .@"and" },8224 .bit_and => if (self.hasFeature(.avx))
8225 .{ .vp_, .@"and" }
8226 else
8227 .{ .p_, .@"and" },
7859 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },8228 .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" },
7860 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },8229 .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor },
8230 .cmp_lt,
8231 .cmp_lte,
8232 .cmp_gte,
8233 .cmp_gt,
8234 => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
8235 .signed => if (self.hasFeature(.avx))
8236 .{ .vp_q, .cmpgt }
8237 else if (self.hasFeature(.sse4_2))
8238 .{ .p_q, .cmpgt }
8239 else
8240 null,
8241 .unsigned => null,
8242 },
8243 .cmp_eq,
8244 .cmp_neq,
8245 => if (self.hasFeature(.avx))
8246 .{ .vp_q, .cmpeq }
8247 else if (self.hasFeature(.sse4_1))
8248 .{ .p_q, .cmpeq }
8249 else
8250 null,
7861 else => null,8251 else => null,
7862 },8252 },
7863 3...4 => switch (air_tag) {8253 3...4 => switch (air_tag) {
...@@ -7870,6 +8260,17 @@ fn genBinOp(...@@ -7870,6 +8260,17 @@ fn genBinOp(
7870 .bit_and => if (self.hasFeature(.avx2)) .{ .vp_, .@"and" } else null,8260 .bit_and => if (self.hasFeature(.avx2)) .{ .vp_, .@"and" } else null,
7871 .bit_or => if (self.hasFeature(.avx2)) .{ .vp_, .@"or" } else null,8261 .bit_or => if (self.hasFeature(.avx2)) .{ .vp_, .@"or" } else null,
7872 .xor => if (self.hasFeature(.avx2)) .{ .vp_, .xor } else null,8262 .xor => if (self.hasFeature(.avx2)) .{ .vp_, .xor } else null,
8263 .cmp_eq,
8264 .cmp_neq,
8265 => if (self.hasFeature(.avx)) .{ .vp_d, .cmpeq } else null,
8266 .cmp_lt,
8267 .cmp_lte,
8268 .cmp_gt,
8269 .cmp_gte,
8270 => switch (lhs_ty.childType(mod).intInfo(mod).signedness) {
8271 .signed => if (self.hasFeature(.avx)) .{ .vp_d, .cmpgt } else null,
8272 .unsigned => null,
8273 },
7873 else => null,8274 else => null,
7874 },8275 },
7875 else => null,8276 else => null,
...@@ -7923,7 +8324,7 @@ fn genBinOp(...@@ -7923,7 +8324,7 @@ fn genBinOp(
7923 .{ .v_, .cvtps2ph },8324 .{ .v_, .cvtps2ph },
7924 dst_reg,8325 dst_reg,
7925 dst_reg,8326 dst_reg,
7926 Immediate.u(0b1_00),8327 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
7927 );8328 );
7928 return dst_mcv;8329 return dst_mcv;
7929 },8330 },
...@@ -7974,7 +8375,7 @@ fn genBinOp(...@@ -7974,7 +8375,7 @@ fn genBinOp(
7974 .{ .v_, .cvtps2ph },8375 .{ .v_, .cvtps2ph },
7975 dst_reg,8376 dst_reg,
7976 dst_reg,8377 dst_reg,
7977 Immediate.u(0b1_00),8378 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
7978 );8379 );
7979 return dst_mcv;8380 return dst_mcv;
7980 },8381 },
...@@ -8017,7 +8418,7 @@ fn genBinOp(...@@ -8017,7 +8418,7 @@ fn genBinOp(
8017 .{ .v_, .cvtps2ph },8418 .{ .v_, .cvtps2ph },
8018 dst_reg,8419 dst_reg,
8019 dst_reg,8420 dst_reg,
8020 Immediate.u(0b1_00),8421 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
8021 );8422 );
8022 return dst_mcv;8423 return dst_mcv;
8023 },8424 },
...@@ -8060,7 +8461,7 @@ fn genBinOp(...@@ -8060,7 +8461,7 @@ fn genBinOp(
8060 .{ .v_, .cvtps2ph },8461 .{ .v_, .cvtps2ph },
8061 dst_reg,8462 dst_reg,
8062 dst_reg.to256(),8463 dst_reg.to256(),
8063 Immediate.u(0b1_00),8464 Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))),
8064 );8465 );
8065 return dst_mcv;8466 return dst_mcv;
8066 },8467 },
...@@ -8435,6 +8836,62 @@ fn genBinOp(...@@ -8435,6 +8836,62 @@ fn genBinOp(
8435 );8836 );
8436 }8837 }
8437 },8838 },
8839 .cmp_lt,
8840 .cmp_lte,
8841 .cmp_eq,
8842 .cmp_gte,
8843 .cmp_gt,
8844 .cmp_neq,
8845 => {
8846 switch (air_tag) {
8847 .cmp_lt,
8848 .cmp_eq,
8849 .cmp_gt,
8850 => {},
8851 .cmp_lte,
8852 .cmp_gte,
8853 .cmp_neq,
8854 => {
8855 const unsigned_ty = try lhs_ty.toUnsigned(mod);
8856 const not_mcv = try self.genTypedValue(.{
8857 .ty = lhs_ty,
8858 .val = try unsigned_ty.maxInt(mod, unsigned_ty),
8859 });
8860 const not_mem = if (not_mcv.isMemory())
8861 not_mcv.mem(Memory.PtrSize.fromSize(abi_size))
8862 else
8863 Memory.sib(Memory.PtrSize.fromSize(abi_size), .{ .base = .{
8864 .reg = try self.copyToTmpRegister(Type.usize, not_mcv.address()),
8865 } });
8866 switch (mir_tag[0]) {
8867 .vp_b, .vp_d, .vp_q, .vp_w => try self.asmRegisterRegisterMemory(
8868 .{ .vp_, .xor },
8869 dst_reg,
8870 dst_reg,
8871 not_mem,
8872 ),
8873 .p_b, .p_d, .p_q, .p_w => try self.asmRegisterMemory(
8874 .{ .p_, .xor },
8875 dst_reg,
8876 not_mem,
8877 ),
8878 else => unreachable,
8879 }
8880 },
8881 else => unreachable,
8882 }
8883
8884 const gp_reg = try self.register_manager.allocReg(maybe_inst, abi.RegisterClass.gp);
8885 const gp_lock = self.register_manager.lockRegAssumeUnused(gp_reg);
8886 defer self.register_manager.unlockReg(gp_lock);
8887
8888 try self.asmRegisterRegister(switch (mir_tag[0]) {
8889 .vp_b, .vp_d, .vp_q, .vp_w => .{ .vp_b, .movmsk },
8890 .p_b, .p_d, .p_q, .p_w => .{ .p_b, .movmsk },
8891 else => unreachable,
8892 }, gp_reg.to32(), dst_reg);
8893 return .{ .register = gp_reg };
8894 },
8438 else => unreachable,8895 else => unreachable,
8439 }8896 }
84408897
...@@ -9378,11 +9835,11 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {...@@ -9378,11 +9835,11 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
9378 80, 128 => true,9835 80, 128 => true,
9379 else => unreachable,9836 else => unreachable,
9380 }) {9837 }) {
9381 var callee: ["__???f2".len]u8 = undefined;9838 var callee_buf: ["__???f2".len]u8 = undefined;
9382 const ret = try self.genCall(.{ .lib = .{9839 const ret = try self.genCall(.{ .lib = .{
9383 .return_type = .i32_type,9840 .return_type = .i32_type,
9384 .param_types = &.{ ty.toIntern(), ty.toIntern() },9841 .param_types = &.{ ty.toIntern(), ty.toIntern() },
9385 .callee = std.fmt.bufPrint(&callee, "__{s}{c}f2", .{9842 .callee = std.fmt.bufPrint(&callee_buf, "__{s}{c}f2", .{
9386 switch (op) {9843 switch (op) {
9387 .eq => "eq",9844 .eq => "eq",
9388 .neq => "ne",9845 .neq => "ne",
...@@ -9741,8 +10198,15 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {...@@ -9741,8 +10198,15 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
9741}10198}
974210199
9743fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void {10200fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void {
9744 _ = inst;10201 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
9745 return self.fail("TODO implement airCmpVector for {}", .{self.target.cpu.arch});10202 const extra = self.air.extraData(Air.VectorCmp, ty_pl.payload).data;
10203 const dst_mcv = try self.genBinOp(
10204 inst,
10205 Air.Inst.Tag.fromCmpOp(extra.compareOperator(), false),
10206 extra.lhs,
10207 extra.rhs,
10208 );
10209 return self.finishAir(inst, dst_mcv, .{ extra.lhs, extra.rhs, .none });
9746}10210}
974710211
9748fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void {10212fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void {
...@@ -10507,29 +10971,41 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -10507,29 +10971,41 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
10507 },10971 },
10508 else => return self.fail("invalid constraint: '{s}'", .{constraint}),10972 else => return self.fail("invalid constraint: '{s}'", .{constraint}),
10509 };10973 };
10974 const is_early_clobber = constraint[1] == '&';
10975 const rest = constraint[@as(usize, 1) + @intFromBool(is_early_clobber) ..];
10510 const arg_mcv: MCValue = arg_mcv: {10976 const arg_mcv: MCValue = arg_mcv: {
10511 const arg_maybe_reg: ?Register = if (mem.eql(u8, constraint[1..], "r"))10977 const arg_maybe_reg: ?Register = if (mem.eql(u8, rest, "r") or
10512 self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse10978 mem.eql(u8, rest, "f") or mem.eql(u8, rest, "x"))
10513 return self.fail("ran out of registers lowering inline asm", .{})10979 registerAlias(
10514 else if (mem.eql(u8, constraint[1..], "m"))10980 self.register_manager.tryAllocReg(maybe_inst, switch (rest[0]) {
10981 'r' => abi.RegisterClass.gp,
10982 'f' => abi.RegisterClass.x87,
10983 'x' => abi.RegisterClass.sse,
10984 else => unreachable,
10985 }) orelse return self.fail("ran out of registers lowering inline asm", .{}),
10986 @intCast(ty.abiSize(mod)),
10987 )
10988 else if (mem.eql(u8, rest, "m"))
10515 if (output != .none) null else return self.fail(10989 if (output != .none) null else return self.fail(
10516 "memory constraint unsupported for asm result: '{s}'",10990 "memory constraint unsupported for asm result: '{s}'",
10517 .{constraint},10991 .{constraint},
10518 )10992 )
10519 else if (mem.eql(u8, constraint[1..], "g") or10993 else if (mem.eql(u8, rest, "g") or
10520 mem.eql(u8, constraint[1..], "rm") or mem.eql(u8, constraint[1..], "mr") or10994 mem.eql(u8, rest, "rm") or mem.eql(u8, rest, "mr") or
10521 mem.eql(u8, constraint[1..], "r,m") or mem.eql(u8, constraint[1..], "m,r"))10995 mem.eql(u8, rest, "r,m") or mem.eql(u8, rest, "m,r"))
10522 self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse10996 self.register_manager.tryAllocReg(maybe_inst, abi.RegisterClass.gp) orelse
10523 if (output != .none)10997 if (output != .none)
10524 null10998 null
10525 else10999 else
10526 return self.fail("ran out of registers lowering inline asm", .{})11000 return self.fail("ran out of registers lowering inline asm", .{})
10527 else if (mem.startsWith(u8, constraint[1..], "{") and mem.endsWith(u8, constraint[1..], "}"))11001 else if (mem.startsWith(u8, rest, "{") and mem.endsWith(u8, rest, "}"))
10528 parseRegName(constraint[1 + "{".len .. constraint.len - "}".len]) orelse11002 parseRegName(rest["{".len .. rest.len - "}".len]) orelse
10529 return self.fail("invalid register constraint: '{s}'", .{constraint})11003 return self.fail("invalid register constraint: '{s}'", .{constraint})
10530 else if (constraint.len == 2 and std.ascii.isDigit(constraint[1])) {11004 else if (rest.len == 1 and std.ascii.isDigit(rest[0])) {
10531 const index = std.fmt.charToDigit(constraint[0], 10) catch unreachable;11005 const index = std.fmt.charToDigit(rest[0], 10) catch unreachable;
10532 if (index >= args.items.len) return self.fail("constraint out of bounds: '{s}'", .{constraint});11006 if (index >= args.items.len) return self.fail("constraint out of bounds: '{s}'", .{
11007 constraint,
11008 });
10533 break :arg_mcv args.items[index];11009 break :arg_mcv args.items[index];
10534 } else return self.fail("invalid constraint: '{s}'", .{constraint});11010 } else return self.fail("invalid constraint: '{s}'", .{constraint});
10535 break :arg_mcv if (arg_maybe_reg) |reg| .{ .register = reg } else arg: {11011 break :arg_mcv if (arg_maybe_reg) |reg| .{ .register = reg } else arg: {
...@@ -10563,10 +11039,29 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -10563,10 +11039,29 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
1056311039
10564 const ty = self.typeOf(input);11040 const ty = self.typeOf(input);
10565 const input_mcv = try self.resolveInst(input);11041 const input_mcv = try self.resolveInst(input);
10566 const arg_mcv: MCValue = if (mem.eql(u8, constraint, "r")) switch (input_mcv) {11042 const arg_mcv: MCValue = if (mem.eql(u8, constraint, "r") or
10567 .register => input_mcv,11043 mem.eql(u8, constraint, "f") or mem.eql(u8, constraint, "x"))
10568 else => .{ .register = try self.copyToTmpRegister(ty, input_mcv) },11044 arg: {
10569 } else if (mem.eql(u8, constraint, "m")) arg: {11045 const rc = switch (constraint[0]) {
11046 'r' => abi.RegisterClass.gp,
11047 'f' => abi.RegisterClass.x87,
11048 'x' => abi.RegisterClass.sse,
11049 else => unreachable,
11050 };
11051 if (input_mcv.isRegister() and
11052 rc.isSet(RegisterManager.indexOfRegIntoTracked(input_mcv.getReg().?).?))
11053 break :arg input_mcv;
11054 const reg = try self.register_manager.allocReg(null, rc);
11055 try self.genSetReg(reg, ty, input_mcv);
11056 break :arg .{ .register = registerAlias(reg, @intCast(ty.abiSize(mod))) };
11057 } else if (mem.eql(u8, constraint, "i") or mem.eql(u8, constraint, "n"))
11058 switch (input_mcv) {
11059 .immediate => |imm| .{ .immediate = imm },
11060 else => return self.fail("immediate operand requires comptime value: '{s}'", .{
11061 constraint,
11062 }),
11063 }
11064 else if (mem.eql(u8, constraint, "m")) arg: {
10570 switch (input_mcv) {11065 switch (input_mcv) {
10571 .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_|11066 .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_|
10572 break :arg input_mcv,11067 break :arg input_mcv,
...@@ -10790,6 +11285,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -10790,6 +11285,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
10790 arg_map.get(op_str["%[".len .. colon orelse op_str.len - "]".len]) orelse11285 arg_map.get(op_str["%[".len .. colon orelse op_str.len - "]".len]) orelse
10791 return self.fail("no matching constraint: '{s}'", .{op_str})11286 return self.fail("no matching constraint: '{s}'", .{op_str})
10792 ]) {11287 ]) {
11288 .immediate => |imm| if (mem.eql(u8, modifier, "") or mem.eql(u8, modifier, "c"))
11289 .{ .imm = Immediate.u(imm) }
11290 else
11291 return self.fail("invalid modifier: '{s}'", .{modifier}),
10793 .register => |reg| if (mem.eql(u8, modifier, ""))11292 .register => |reg| if (mem.eql(u8, modifier, ""))
10794 .{ .reg = reg }11293 .{ .reg = reg }
10795 else11294 else
...@@ -10816,6 +11315,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -10816,6 +11315,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
10816 ) }11315 ) }
10817 else11316 else
10818 return self.fail("invalid modifier: '{s}'", .{modifier}),11317 return self.fail("invalid modifier: '{s}'", .{modifier}),
11318 .lea_got => |sym_index| if (mem.eql(u8, modifier, "P"))
11319 .{ .reg = try self.copyToTmpRegister(Type.usize, .{ .lea_got = sym_index }) }
11320 else
11321 return self.fail("invalid modifier: '{s}'", .{modifier}),
10819 else => return self.fail("invalid constraint: '{s}'", .{op_str}),11322 else => return self.fail("invalid constraint: '{s}'", .{op_str}),
10820 };11323 };
10821 } else if (mem.startsWith(u8, op_str, "$")) {11324 } else if (mem.startsWith(u8, op_str, "$")) {
...@@ -10918,6 +11421,13 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -10918,6 +11421,13 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
10918 .none => self.asmRegisterImmediate(mnem_fixed_tag, reg1, imm0),11421 .none => self.asmRegisterImmediate(mnem_fixed_tag, reg1, imm0),
10919 .reg => |reg2| switch (ops[3]) {11422 .reg => |reg2| switch (ops[3]) {
10920 .none => self.asmRegisterRegisterImmediate(mnem_fixed_tag, reg2, reg1, imm0),11423 .none => self.asmRegisterRegisterImmediate(mnem_fixed_tag, reg2, reg1, imm0),
11424 .reg => |reg3| self.asmRegisterRegisterRegisterImmediate(
11425 mnem_fixed_tag,
11426 reg3,
11427 reg2,
11428 reg1,
11429 imm0,
11430 ),
10921 else => error.InvalidInstruction,11431 else => error.InvalidInstruction,
10922 },11432 },
10923 .mem => |mem2| switch (ops[3]) {11433 .mem => |mem2| switch (ops[3]) {
...@@ -11988,11 +12498,11 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {...@@ -11988,11 +12498,11 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
11988 src_ty.fmt(mod), dst_ty.fmt(mod),12498 src_ty.fmt(mod), dst_ty.fmt(mod),
11989 });12499 });
1199012500
11991 var callee: ["__floatun?i?f".len]u8 = undefined;12501 var callee_buf: ["__floatun?i?f".len]u8 = undefined;
11992 break :result try self.genCall(.{ .lib = .{12502 break :result try self.genCall(.{ .lib = .{
11993 .return_type = dst_ty.toIntern(),12503 .return_type = dst_ty.toIntern(),
11994 .param_types = &.{src_ty.toIntern()},12504 .param_types = &.{src_ty.toIntern()},
11995 .callee = std.fmt.bufPrint(&callee, "__float{s}{c}i{c}f", .{12505 .callee = std.fmt.bufPrint(&callee_buf, "__float{s}{c}i{c}f", .{
11996 switch (src_signedness) {12506 switch (src_signedness) {
11997 .signed => "",12507 .signed => "",
11998 .unsigned => "un",12508 .unsigned => "un",
...@@ -12067,11 +12577,11 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {...@@ -12067,11 +12577,11 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
12067 src_ty.fmt(mod), dst_ty.fmt(mod),12577 src_ty.fmt(mod), dst_ty.fmt(mod),
12068 });12578 });
1206912579
12070 var callee: ["__fixuns?f?i".len]u8 = undefined;12580 var callee_buf: ["__fixuns?f?i".len]u8 = undefined;
12071 break :result try self.genCall(.{ .lib = .{12581 break :result try self.genCall(.{ .lib = .{
12072 .return_type = dst_ty.toIntern(),12582 .return_type = dst_ty.toIntern(),
12073 .param_types = &.{src_ty.toIntern()},12583 .param_types = &.{src_ty.toIntern()},
12074 .callee = std.fmt.bufPrint(&callee, "__fix{s}{c}f{c}i", .{12584 .callee = std.fmt.bufPrint(&callee_buf, "__fix{s}{c}f{c}i", .{
12075 switch (dst_signedness) {12585 switch (dst_signedness) {
12076 .signed => "",12586 .signed => "",
12077 .unsigned => "uns",12587 .unsigned => "uns",
...@@ -12592,7 +13102,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {...@@ -12592,7 +13102,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
12592 .{ .i_, .mul },13102 .{ .i_, .mul },
12593 len_reg,13103 len_reg,
12594 len_reg,13104 len_reg,
12595 Immediate.u(elem_abi_size),13105 Immediate.s(elem_abi_size),
12596 );13106 );
12597 try self.genInlineMemcpy(second_elem_ptr_mcv, ptr, len_mcv);13107 try self.genInlineMemcpy(second_elem_ptr_mcv, ptr, len_mcv);
1259813108
...@@ -12645,8 +13155,23 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void {...@@ -12645,8 +13155,23 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void {
12645 defer if (src_ptr_lock) |lock| self.register_manager.unlockReg(lock);13155 defer if (src_ptr_lock) |lock| self.register_manager.unlockReg(lock);
1264613156
12647 const len: MCValue = switch (dst_ptr_ty.ptrSize(mod)) {13157 const len: MCValue = switch (dst_ptr_ty.ptrSize(mod)) {
12648 .Slice => dst_ptr.address().offset(8).deref(),13158 .Slice => len: {
12649 .One => .{ .immediate = dst_ptr_ty.childType(mod).arrayLen(mod) },13159 const len_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);
13160 const len_lock = self.register_manager.lockRegAssumeUnused(len_reg);
13161 defer self.register_manager.unlockReg(len_lock);
13162
13163 try self.asmRegisterMemoryImmediate(
13164 .{ .i_, .mul },
13165 len_reg,
13166 dst_ptr.address().offset(8).deref().mem(.qword),
13167 Immediate.s(@intCast(dst_ptr_ty.childType(mod).abiSize(mod))),
13168 );
13169 break :len .{ .register = len_reg };
13170 },
13171 .One => len: {
13172 const array_ty = dst_ptr_ty.childType(mod);
13173 break :len .{ .immediate = array_ty.arrayLen(mod) * array_ty.childType(mod).abiSize(mod) };
13174 },
12650 .C, .Many => unreachable,13175 .C, .Many => unreachable,
12651 };13176 };
12652 const len_lock: ?RegisterLock = switch (len) {13177 const len_lock: ?RegisterLock = switch (len) {
...@@ -12999,10 +13524,60 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {...@@ -12999,10 +13524,60 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {
12999}13524}
1300013525
13001fn airReduce(self: *Self, inst: Air.Inst.Index) !void {13526fn airReduce(self: *Self, inst: Air.Inst.Index) !void {
13527 const mod = self.bin_file.options.module.?;
13002 const reduce = self.air.instructions.items(.data)[inst].reduce;13528 const reduce = self.air.instructions.items(.data)[inst].reduce;
13003 _ = reduce;13529
13004 return self.fail("TODO implement airReduce for x86_64", .{});13530 const result: MCValue = result: {
13005 //return self.finishAir(inst, result, .{ reduce.operand, .none, .none });13531 const operand_ty = self.typeOf(reduce.operand);
13532 if (operand_ty.isVector(mod) and operand_ty.childType(mod).toIntern() == .bool_type) {
13533 try self.spillEflagsIfOccupied();
13534
13535 const operand_mcv = try self.resolveInst(reduce.operand);
13536 const mask_len = (std.math.cast(u6, operand_ty.vectorLen(mod)) orelse
13537 return self.fail("TODO implement airReduce for {}", .{operand_ty.fmt(mod)}));
13538 const mask = (@as(u64, 1) << mask_len) - 1;
13539 const abi_size: u32 = @intCast(operand_ty.abiSize(mod));
13540 switch (reduce.operation) {
13541 .Or => {
13542 if (operand_mcv.isMemory()) try self.asmMemoryImmediate(
13543 .{ ._, .@"test" },
13544 operand_mcv.mem(Memory.PtrSize.fromSize(abi_size)),
13545 Immediate.u(mask),
13546 ) else {
13547 const operand_reg = registerAlias(if (operand_mcv.isRegister())
13548 operand_mcv.getReg().?
13549 else
13550 try self.copyToTmpRegister(operand_ty, operand_mcv), abi_size);
13551 if (mask_len < abi_size * 8) try self.asmRegisterImmediate(
13552 .{ ._, .@"test" },
13553 operand_reg,
13554 Immediate.u(mask),
13555 ) else try self.asmRegisterRegister(
13556 .{ ._, .@"test" },
13557 operand_reg,
13558 operand_reg,
13559 );
13560 }
13561 break :result .{ .eflags = .nz };
13562 },
13563 .And => {
13564 const tmp_reg = try self.copyToTmpRegister(operand_ty, operand_mcv);
13565 const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg);
13566 defer self.register_manager.unlockReg(tmp_lock);
13567
13568 try self.asmRegister(.{ ._, .not }, tmp_reg);
13569 if (mask_len < abi_size * 8)
13570 try self.asmRegisterImmediate(.{ ._, .@"test" }, tmp_reg, Immediate.u(mask))
13571 else
13572 try self.asmRegisterRegister(.{ ._, .@"test" }, tmp_reg, tmp_reg);
13573 break :result .{ .eflags = .z };
13574 },
13575 else => return self.fail("TODO implement airReduce for {}", .{operand_ty.fmt(mod)}),
13576 }
13577 }
13578 return self.fail("TODO implement airReduce for {}", .{operand_ty.fmt(mod)});
13579 };
13580 return self.finishAir(inst, result, .{ reduce.operand, .none, .none });
13006}13581}
1300713582
13008fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {13583fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
...@@ -13215,11 +13790,11 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {...@@ -13215,11 +13790,11 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
13215 ty.fmt(mod),13790 ty.fmt(mod),
13216 });13791 });
1321713792
13218 var callee: ["__fma?".len]u8 = undefined;13793 var callee_buf: ["__fma?".len]u8 = undefined;
13219 break :result try self.genCall(.{ .lib = .{13794 break :result try self.genCall(.{ .lib = .{
13220 .return_type = ty.toIntern(),13795 .return_type = ty.toIntern(),
13221 .param_types = &.{ ty.toIntern(), ty.toIntern(), ty.toIntern() },13796 .param_types = &.{ ty.toIntern(), ty.toIntern(), ty.toIntern() },
13222 .callee = std.fmt.bufPrint(&callee, "{s}fma{s}", .{13797 .callee = std.fmt.bufPrint(&callee_buf, "{s}fma{s}", .{
13223 floatLibcAbiPrefix(ty),13798 floatLibcAbiPrefix(ty),
13224 floatLibcAbiSuffix(ty),13799 floatLibcAbiSuffix(ty),
13225 }) catch unreachable,13800 }) catch unreachable,
src/arch/x86_64/Emit.zig+6-6
...@@ -19,18 +19,18 @@ pub const Error = Lower.Error || error{...@@ -19,18 +19,18 @@ pub const Error = Lower.Error || error{
1919
20pub fn emitMir(emit: *Emit) Error!void {20pub fn emitMir(emit: *Emit) Error!void {
21 for (0..emit.lower.mir.instructions.len) |mir_i| {21 for (0..emit.lower.mir.instructions.len) |mir_i| {
22 const mir_index = @as(Mir.Inst.Index, @intCast(mir_i));22 const mir_index: Mir.Inst.Index = @intCast(mir_i);
23 try emit.code_offset_mapping.putNoClobber(23 try emit.code_offset_mapping.putNoClobber(
24 emit.lower.allocator,24 emit.lower.allocator,
25 mir_index,25 mir_index,
26 @as(u32, @intCast(emit.code.items.len)),26 @intCast(emit.code.items.len),
27 );27 );
28 const lowered = try emit.lower.lowerMir(mir_index);28 const lowered = try emit.lower.lowerMir(mir_index);
29 var lowered_relocs = lowered.relocs;29 var lowered_relocs = lowered.relocs;
30 for (lowered.insts, 0..) |lowered_inst, lowered_index| {30 for (lowered.insts, 0..) |lowered_inst, lowered_index| {
31 const start_offset = @as(u32, @intCast(emit.code.items.len));31 const start_offset: u32 = @intCast(emit.code.items.len);
32 try lowered_inst.encode(emit.code.writer(), .{});32 try lowered_inst.encode(emit.code.writer(), .{});
33 const end_offset = @as(u32, @intCast(emit.code.items.len));33 const end_offset: u32 = @intCast(emit.code.items.len);
34 while (lowered_relocs.len > 0 and34 while (lowered_relocs.len > 0 and
35 lowered_relocs[0].lowered_inst_index == lowered_index) : ({35 lowered_relocs[0].lowered_inst_index == lowered_index) : ({
36 lowered_relocs = lowered_relocs[1..];36 lowered_relocs = lowered_relocs[1..];
...@@ -39,7 +39,7 @@ pub fn emitMir(emit: *Emit) Error!void {...@@ -39,7 +39,7 @@ pub fn emitMir(emit: *Emit) Error!void {
39 .source = start_offset,39 .source = start_offset,
40 .target = target,40 .target = target,
41 .offset = end_offset - 4,41 .offset = end_offset - 4,
42 .length = @as(u5, @intCast(end_offset - start_offset)),42 .length = @intCast(end_offset - start_offset),
43 }),43 }),
44 .linker_extern_fn => |symbol| if (emit.bin_file.cast(link.File.Elf)) |elf_file| {44 .linker_extern_fn => |symbol| if (emit.bin_file.cast(link.File.Elf)) |elf_file| {
45 // Add relocation to the decl.45 // Add relocation to the decl.
...@@ -220,7 +220,7 @@ const Reloc = struct {...@@ -220,7 +220,7 @@ const Reloc = struct {
220 /// Target of the relocation.220 /// Target of the relocation.
221 target: Mir.Inst.Index,221 target: Mir.Inst.Index,
222 /// Offset of the relocation within the instruction.222 /// Offset of the relocation within the instruction.
223 offset: usize,223 offset: u32,
224 /// Length of the instruction.224 /// Length of the instruction.
225 length: u5,225 length: u5,
226};226};
src/arch/x86_64/Encoding.zig+39-8
...@@ -266,7 +266,12 @@ pub const Mnemonic = enum {...@@ -266,7 +266,12 @@ pub const Mnemonic = enum {
266 packssdw, packsswb, packuswb,266 packssdw, packsswb, packuswb,
267 paddb, paddd, paddq, paddsb, paddsw, paddusb, paddusw, paddw,267 paddb, paddd, paddq, paddsb, paddsw, paddusb, paddusw, paddw,
268 pand, pandn, por, pxor,268 pand, pandn, por, pxor,
269 pcmpeqb, pcmpeqd, pcmpeqw,
270 pcmpgtb, pcmpgtd, pcmpgtw,
269 pmulhw, pmullw,271 pmulhw, pmullw,
272 pslld, psllq, psllw,
273 psrad, psraw,
274 psrld, psrlq, psrlw,
270 psubb, psubd, psubq, psubsb, psubsw, psubusb, psubusw, psubw,275 psubb, psubd, psubq, psubsb, psubsw, psubusb, psubusw, psubw,
271 // SSE276 // SSE
272 addps, addss,277 addps, addss,
...@@ -278,11 +283,12 @@ pub const Mnemonic = enum {...@@ -278,11 +283,12 @@ pub const Mnemonic = enum {
278 maxps, maxss,283 maxps, maxss,
279 minps, minss,284 minps, minss,
280 movaps, movhlps, movlhps,285 movaps, movhlps, movlhps,
286 movmskps,
281 movss, movups,287 movss, movups,
282 mulps, mulss,288 mulps, mulss,
283 orps,289 orps,
284 pextrw, pinsrw,290 pextrw, pinsrw,
285 pmaxsw, pmaxub, pminsw, pminub,291 pmaxsw, pmaxub, pminsw, pminub, pmovmskb,
286 shufps,292 shufps,
287 sqrtps, sqrtss,293 sqrtps, sqrtss,
288 subps, subss,294 subps, subss,
...@@ -301,12 +307,13 @@ pub const Mnemonic = enum {...@@ -301,12 +307,13 @@ pub const Mnemonic = enum {
301 minpd, minsd,307 minpd, minsd,
302 movapd,308 movapd,
303 movdqa, movdqu,309 movdqa, movdqu,
310 movmskpd,
304 //movsd,311 //movsd,
305 movupd,312 movupd,
306 mulpd, mulsd,313 mulpd, mulsd,
307 orpd,314 orpd,
308 pshufhw, pshuflw,315 pshufd, pshufhw, pshuflw,
309 psrld, psrlq, psrlw,316 pslldq, psrldq,
310 punpckhbw, punpckhdq, punpckhqdq, punpckhwd,317 punpckhbw, punpckhdq, punpckhqdq, punpckhwd,
311 punpcklbw, punpckldq, punpcklqdq, punpcklwd,318 punpcklbw, punpckldq, punpcklqdq, punpcklwd,
312 shufpd,319 shufpd,
...@@ -317,19 +324,29 @@ pub const Mnemonic = enum {...@@ -317,19 +324,29 @@ pub const Mnemonic = enum {
317 // SSE3324 // SSE3
318 movddup, movshdup, movsldup,325 movddup, movshdup, movsldup,
319 // SSSE3326 // SSSE3
320 pabsb, pabsd, pabsw,327 pabsb, pabsd, pabsw, palignr,
321 // SSE4.1328 // SSE4.1
322 blendpd, blendps, blendvpd, blendvps,329 blendpd, blendps, blendvpd, blendvps,
323 extractps,330 extractps,
324 insertps,331 insertps,
325 packusdw,332 packusdw,
333 pcmpeqq,
326 pextrb, pextrd, pextrq,334 pextrb, pextrd, pextrq,
327 pinsrb, pinsrd, pinsrq,335 pinsrb, pinsrd, pinsrq,
328 pmaxsb, pmaxsd, pmaxud, pmaxuw, pminsb, pminsd, pminud, pminuw,336 pmaxsb, pmaxsd, pmaxud, pmaxuw, pminsb, pminsd, pminud, pminuw,
329 pmulld,337 pmulld,
330 roundpd, roundps, roundsd, roundss,338 roundpd, roundps, roundsd, roundss,
339 // SSE4.2
340 pcmpgtq,
341 // PCLMUL
342 pclmulqdq,
343 // AES
344 aesdec, aesdeclast, aesenc, aesenclast, aesimc, aeskeygenassist,
345 // SHA
346 sha256msg1, sha256msg2, sha256rnds2,
331 // AVX347 // AVX
332 vaddpd, vaddps, vaddsd, vaddss,348 vaddpd, vaddps, vaddsd, vaddss,
349 vaesdec, vaesdeclast, vaesenc, vaesenclast, vaesimc, vaeskeygenassist,
333 vandnpd, vandnps, vandpd, vandps,350 vandnpd, vandnps, vandpd, vandps,
334 vblendpd, vblendps, vblendvpd, vblendvps,351 vblendpd, vblendps, vblendvpd, vblendvps,
335 vbroadcastf128, vbroadcastsd, vbroadcastss,352 vbroadcastf128, vbroadcastsd, vbroadcastss,
...@@ -348,6 +365,7 @@ pub const Mnemonic = enum {...@@ -348,6 +365,7 @@ pub const Mnemonic = enum {
348 vmovddup,365 vmovddup,
349 vmovdqa, vmovdqu,366 vmovdqa, vmovdqu,
350 vmovhlps, vmovlhps,367 vmovhlps, vmovlhps,
368 vmovmskpd, vmovmskps,
351 vmovq,369 vmovq,
352 vmovsd,370 vmovsd,
353 vmovshdup, vmovsldup,371 vmovshdup, vmovsldup,
...@@ -358,15 +376,20 @@ pub const Mnemonic = enum {...@@ -358,15 +376,20 @@ pub const Mnemonic = enum {
358 vpabsb, vpabsd, vpabsw,376 vpabsb, vpabsd, vpabsw,
359 vpackssdw, vpacksswb, vpackusdw, vpackuswb,377 vpackssdw, vpacksswb, vpackusdw, vpackuswb,
360 vpaddb, vpaddd, vpaddq, vpaddsb, vpaddsw, vpaddusb, vpaddusw, vpaddw,378 vpaddb, vpaddd, vpaddq, vpaddsb, vpaddsw, vpaddusb, vpaddusw, vpaddw,
361 vpand, vpandn,379 vpalignr, vpand, vpandn, vpclmulqdq,
380 vpcmpeqb, vpcmpeqd, vpcmpeqq, vpcmpeqw,
381 vpcmpgtb, vpcmpgtd, vpcmpgtq, vpcmpgtw,
362 vpextrb, vpextrd, vpextrq, vpextrw,382 vpextrb, vpextrd, vpextrq, vpextrw,
363 vpinsrb, vpinsrd, vpinsrq, vpinsrw,383 vpinsrb, vpinsrd, vpinsrq, vpinsrw,
364 vpmaxsb, vpmaxsd, vpmaxsw, vpmaxub, vpmaxud, vpmaxuw,384 vpmaxsb, vpmaxsd, vpmaxsw, vpmaxub, vpmaxud, vpmaxuw,
365 vpminsb, vpminsd, vpminsw, vpminub, vpminud, vpminuw,385 vpminsb, vpminsd, vpminsw, vpminub, vpminud, vpminuw,
386 vpmovmskb,
366 vpmulhw, vpmulld, vpmullw,387 vpmulhw, vpmulld, vpmullw,
367 vpor,388 vpor,
368 vpshufhw, vpshuflw,389 vpshufd, vpshufhw, vpshuflw,
369 vpsrld, vpsrlq, vpsrlw,390 vpslld, vpslldq, vpsllq, vpsllw,
391 vpsrad, vpsraq, vpsraw,
392 vpsrld, vpsrldq, vpsrlq, vpsrlw,
370 vpsubb, vpsubd, vpsubq, vpsubsb, vpsubsw, vpsubusb, vpsubusw, vpsubw,393 vpsubb, vpsubd, vpsubq, vpsubsb, vpsubsw, vpsubusb, vpsubusw, vpsubw,
371 vpunpckhbw, vpunpckhdq, vpunpckhqdq, vpunpckhwd,394 vpunpckhbw, vpunpckhdq, vpunpckhqdq, vpunpckhwd,
372 vpunpcklbw, vpunpckldq, vpunpcklqdq, vpunpcklwd,395 vpunpcklbw, vpunpckldq, vpunpcklqdq, vpunpcklwd,
...@@ -742,6 +765,8 @@ pub const Mode = enum {...@@ -742,6 +765,8 @@ pub const Mode = enum {
742765
743pub const Feature = enum {766pub const Feature = enum {
744 none,767 none,
768 aes,
769 @"aes avx",
745 avx,770 avx,
746 avx2,771 avx2,
747 bmi,772 bmi,
...@@ -749,12 +774,18 @@ pub const Feature = enum {...@@ -749,12 +774,18 @@ pub const Feature = enum {
749 fma,774 fma,
750 lzcnt,775 lzcnt,
751 movbe,776 movbe,
777 pclmul,
778 @"pclmul avx",
752 popcnt,779 popcnt,
753 sse,780 sse,
754 sse2,781 sse2,
755 sse3,782 sse3,
756 sse4_1,783 sse4_1,
784 sse4_2,
757 ssse3,785 ssse3,
786 sha,
787 vaes,
788 vpclmulqdq,
758 x87,789 x87,
759};790};
760791
...@@ -772,7 +803,7 @@ fn estimateInstructionLength(prefix: Prefix, encoding: Encoding, ops: []const Op...@@ -772,7 +803,7 @@ fn estimateInstructionLength(prefix: Prefix, encoding: Encoding, ops: []const Op
772}803}
773804
774const mnemonic_to_encodings_map = init: {805const mnemonic_to_encodings_map = init: {
775 @setEvalBranchQuota(50_000);806 @setEvalBranchQuota(60_000);
776 const encodings = @import("encodings.zig");807 const encodings = @import("encodings.zig");
777 var entries = encodings.table;808 var entries = encodings.table;
778 std.mem.sort(encodings.Entry, &entries, {}, struct {809 std.mem.sort(encodings.Entry, &entries, {}, struct {
src/arch/x86_64/Lower.zig+39-7
...@@ -190,7 +190,7 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct {...@@ -190,7 +190,7 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct {
190 .pseudo_probe_align_ri_s => {190 .pseudo_probe_align_ri_s => {
191 try lower.emit(.none, .@"test", &.{191 try lower.emit(.none, .@"test", &.{
192 .{ .reg = inst.data.ri.r1 },192 .{ .reg = inst.data.ri.r1 },
193 .{ .imm = Immediate.s(@as(i32, @bitCast(inst.data.ri.i))) },193 .{ .imm = Immediate.s(@bitCast(inst.data.ri.i)) },
194 });194 });
195 try lower.emit(.none, .jz, &.{195 try lower.emit(.none, .jz, &.{
196 .{ .imm = lower.reloc(.{ .inst = index + 1 }) },196 .{ .imm = lower.reloc(.{ .inst = index + 1 }) },
...@@ -226,14 +226,14 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct {...@@ -226,14 +226,14 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct {
226 }226 }
227 try lower.emit(.none, .sub, &.{227 try lower.emit(.none, .sub, &.{
228 .{ .reg = inst.data.ri.r1 },228 .{ .reg = inst.data.ri.r1 },
229 .{ .imm = Immediate.s(@as(i32, @bitCast(inst.data.ri.i))) },229 .{ .imm = Immediate.s(@bitCast(inst.data.ri.i)) },
230 });230 });
231 assert(lower.result_insts_len <= pseudo_probe_adjust_unrolled_max_insts);231 assert(lower.result_insts_len <= pseudo_probe_adjust_unrolled_max_insts);
232 },232 },
233 .pseudo_probe_adjust_setup_rri_s => {233 .pseudo_probe_adjust_setup_rri_s => {
234 try lower.emit(.none, .mov, &.{234 try lower.emit(.none, .mov, &.{
235 .{ .reg = inst.data.rri.r2.to32() },235 .{ .reg = inst.data.rri.r2.to32() },
236 .{ .imm = Immediate.s(@as(i32, @bitCast(inst.data.rri.i))) },236 .{ .imm = Immediate.s(@bitCast(inst.data.rri.i)) },
237 });237 });
238 try lower.emit(.none, .sub, &.{238 try lower.emit(.none, .sub, &.{
239 .{ .reg = inst.data.rri.r1 },239 .{ .reg = inst.data.rri.r1 },
...@@ -291,7 +291,9 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {...@@ -291,7 +291,9 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {
291 .i_s,291 .i_s,
292 .mi_sib_s,292 .mi_sib_s,
293 .mi_rip_s,293 .mi_rip_s,
294 => Immediate.s(@as(i32, @bitCast(i))),294 .rmi_sib_s,
295 .rmi_rip_s,
296 => Immediate.s(@bitCast(i)),
295297
296 .rrri,298 .rrri,
297 .rri_u,299 .rri_u,
...@@ -301,6 +303,8 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {...@@ -301,6 +303,8 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate {
301 .mi_rip_u,303 .mi_rip_u,
302 .rmi_sib,304 .rmi_sib,
303 .rmi_rip,305 .rmi_rip,
306 .rmi_sib_u,
307 .rmi_rip_u,
304 .mri_sib,308 .mri_sib,
305 .mri_rip,309 .mri_rip,
306 .rrm_sib,310 .rrm_sib,
...@@ -319,6 +323,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {...@@ -319,6 +323,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {
319 return lower.mir.resolveFrameLoc(switch (ops) {323 return lower.mir.resolveFrameLoc(switch (ops) {
320 .rm_sib,324 .rm_sib,
321 .rmi_sib,325 .rmi_sib,
326 .rmi_sib_s,
327 .rmi_sib_u,
322 .m_sib,328 .m_sib,
323 .mi_sib_u,329 .mi_sib_u,
324 .mi_sib_s,330 .mi_sib_s,
...@@ -335,6 +341,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {...@@ -335,6 +341,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory {
335341
336 .rm_rip,342 .rm_rip,
337 .rmi_rip,343 .rmi_rip,
344 .rmi_rip_s,
345 .rmi_rip_u,
338 .m_rip,346 .m_rip,
339 .mi_rip_u,347 .mi_rip_u,
340 .mi_rip_s,348 .mi_rip_s,
...@@ -383,13 +391,29 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {...@@ -383,13 +391,29 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
383 .rrri => inst.data.rrri.fixes,391 .rrri => inst.data.rrri.fixes,
384 .rri_s, .rri_u => inst.data.rri.fixes,392 .rri_s, .rri_u => inst.data.rri.fixes,
385 .ri_s, .ri_u => inst.data.ri.fixes,393 .ri_s, .ri_u => inst.data.ri.fixes,
386 .ri64, .rm_sib, .rm_rip, .mr_sib, .mr_rip => inst.data.rx.fixes,394 .ri64,
395 .rm_sib,
396 .rm_rip,
397 .rmi_sib_s,
398 .rmi_sib_u,
399 .rmi_rip_s,
400 .rmi_rip_u,
401 .mr_sib,
402 .mr_rip,
403 => inst.data.rx.fixes,
387 .mrr_sib, .mrr_rip, .rrm_sib, .rrm_rip => inst.data.rrx.fixes,404 .mrr_sib, .mrr_rip, .rrm_sib, .rrm_rip => inst.data.rrx.fixes,
388 .rmi_sib, .rmi_rip, .mri_sib, .mri_rip => inst.data.rix.fixes,405 .rmi_sib, .rmi_rip, .mri_sib, .mri_rip => inst.data.rix.fixes,
389 .rrmi_sib, .rrmi_rip => inst.data.rrix.fixes,406 .rrmi_sib, .rrmi_rip => inst.data.rrix.fixes,
390 .mi_sib_u, .mi_rip_u, .mi_sib_s, .mi_rip_s => inst.data.x.fixes,407 .mi_sib_u, .mi_rip_u, .mi_sib_s, .mi_rip_s => inst.data.x.fixes,
391 .m_sib, .m_rip, .rax_moffs, .moffs_rax => inst.data.x.fixes,408 .m_sib, .m_rip, .rax_moffs, .moffs_rax => inst.data.x.fixes,
392 .extern_fn_reloc, .got_reloc, .extern_got_reloc, .direct_reloc, .direct_got_reloc, .import_reloc, .tlv_reloc => ._,409 .extern_fn_reloc,
410 .got_reloc,
411 .extern_got_reloc,
412 .direct_reloc,
413 .direct_got_reloc,
414 .import_reloc,
415 .tlv_reloc,
416 => ._,
393 else => return lower.fail("TODO lower .{s}", .{@tagName(inst.ops)}),417 else => return lower.fail("TODO lower .{s}", .{@tagName(inst.ops)}),
394 };418 };
395 try lower.emit(switch (fixes) {419 try lower.emit(switch (fixes) {
...@@ -461,7 +485,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {...@@ -461,7 +485,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
461 .m_sib, .m_rip => &.{485 .m_sib, .m_rip => &.{
462 .{ .mem = lower.mem(inst.ops, inst.data.x.payload) },486 .{ .mem = lower.mem(inst.ops, inst.data.x.payload) },
463 },487 },
464 .mi_sib_s, .mi_sib_u, .mi_rip_u, .mi_rip_s => &.{488 .mi_sib_s, .mi_sib_u, .mi_rip_s, .mi_rip_u => &.{
465 .{ .mem = lower.mem(inst.ops, inst.data.x.payload + 1) },489 .{ .mem = lower.mem(inst.ops, inst.data.x.payload + 1) },
466 .{ .imm = lower.imm(490 .{ .imm = lower.imm(
467 inst.ops,491 inst.ops,
...@@ -477,6 +501,14 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {...@@ -477,6 +501,14 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
477 .{ .mem = lower.mem(inst.ops, inst.data.rix.payload) },501 .{ .mem = lower.mem(inst.ops, inst.data.rix.payload) },
478 .{ .imm = lower.imm(inst.ops, inst.data.rix.i) },502 .{ .imm = lower.imm(inst.ops, inst.data.rix.i) },
479 },503 },
504 .rmi_sib_s, .rmi_sib_u, .rmi_rip_s, .rmi_rip_u => &.{
505 .{ .reg = inst.data.rx.r1 },
506 .{ .mem = lower.mem(inst.ops, inst.data.rx.payload + 1) },
507 .{ .imm = lower.imm(
508 inst.ops,
509 lower.mir.extraData(Mir.Imm32, inst.data.rx.payload).data.imm,
510 ) },
511 },
480 .mr_sib, .mr_rip => &.{512 .mr_sib, .mr_rip => &.{
481 .{ .mem = lower.mem(inst.ops, inst.data.rx.payload) },513 .{ .mem = lower.mem(inst.ops, inst.data.rx.payload) },
482 .{ .reg = inst.data.rx.r1 },514 .{ .reg = inst.data.rx.r1 },
src/arch/x86_64/Mir.zig+83-33
...@@ -474,6 +474,10 @@ pub const Inst = struct {...@@ -474,6 +474,10 @@ pub const Inst = struct {
474 /// Bitwise logical and not of packed single-precision floating-point values474 /// Bitwise logical and not of packed single-precision floating-point values
475 /// Bitwise logical and not of packed double-precision floating-point values475 /// Bitwise logical and not of packed double-precision floating-point values
476 andn,476 andn,
477 /// Compare packed data for equal
478 cmpeq,
479 /// Compare packed data for greater than
480 cmpgt,
477 /// Maximum of packed signed integers481 /// Maximum of packed signed integers
478 maxs,482 maxs,
479 /// Maximum of packed unsigned integers483 /// Maximum of packed unsigned integers
...@@ -482,10 +486,20 @@ pub const Inst = struct {...@@ -482,10 +486,20 @@ pub const Inst = struct {
482 mins,486 mins,
483 /// Minimum of packed unsigned integers487 /// Minimum of packed unsigned integers
484 minu,488 minu,
489 /// Move byte mask
490 /// Extract packed single precision floating-point sign mask
491 /// Extract packed double precision floating-point sign mask
492 movmsk,
485 /// Multiply packed signed integers and store low result493 /// Multiply packed signed integers and store low result
486 mull,494 mull,
487 /// Multiply packed signed integers and store high result495 /// Multiply packed signed integers and store high result
488 mulh,496 mulh,
497 /// Shift packed data left logical
498 sll,
499 /// Shift packed data right arithmetic
500 sra,
501 /// Shift packed data right logical
502 srl,
489 /// Subtract packed signed integers with signed saturation503 /// Subtract packed signed integers with signed saturation
490 subs,504 subs,
491 /// Subtract packed unsigned integers with unsigned saturation505 /// Subtract packed unsigned integers with unsigned saturation
...@@ -584,15 +598,13 @@ pub const Inst = struct {...@@ -584,15 +598,13 @@ pub const Inst = struct {
584 movdqu,598 movdqu,
585 /// Packed interleave shuffle of quadruplets of single-precision floating-point values599 /// Packed interleave shuffle of quadruplets of single-precision floating-point values
586 /// Packed interleave shuffle of pairs of double-precision floating-point values600 /// Packed interleave shuffle of pairs of double-precision floating-point values
601 /// Shuffle packed doublewords
602 /// Shuffle packed words
587 shuf,603 shuf,
588 /// Shuffle packed high words604 /// Shuffle packed high words
589 shufh,605 shufh,
590 /// Shuffle packed low words606 /// Shuffle packed low words
591 shufl,607 shufl,
592 /// Shift packed data right logical
593 /// Shift packed data right logical
594 /// Shift packed data right logical
595 srl,
596 /// Unpack high data608 /// Unpack high data
597 unpckhbw,609 unpckhbw,
598 /// Unpack high data610 /// Unpack high data
...@@ -617,6 +629,9 @@ pub const Inst = struct {...@@ -617,6 +629,9 @@ pub const Inst = struct {
617 /// Replicate single floating-point values629 /// Replicate single floating-point values
618 movsldup,630 movsldup,
619631
632 /// Packed align right
633 alignr,
634
620 /// Pack with unsigned saturation635 /// Pack with unsigned saturation
621 ackusd,636 ackusd,
622 /// Blend packed single-precision floating-point values637 /// Blend packed single-precision floating-point values
...@@ -640,6 +655,29 @@ pub const Inst = struct {...@@ -640,6 +655,29 @@ pub const Inst = struct {
640 /// Round scalar double-precision floating-point value655 /// Round scalar double-precision floating-point value
641 round,656 round,
642657
658 /// Carry-less multiplication quadword
659 clmulq,
660
661 /// Perform one round of an AES decryption flow
662 aesdec,
663 /// Perform last round of an AES decryption flow
664 aesdeclast,
665 /// Perform one round of an AES encryption flow
666 aesenc,
667 /// Perform last round of an AES encryption flow
668 aesenclast,
669 /// Perform the AES InvMixColumn transformation
670 aesimc,
671 /// AES round key generation assist
672 aeskeygenassist,
673
674 /// Perform an intermediate calculation for the next four SHA256 message dwords
675 sha256msg1,
676 /// Perform a final calculation for the next four SHA256 message dwords
677 sha256msg2,
678 /// Perform two rounds of SHA256 operation
679 sha256rnds2,
680
643 /// Load with broadcast floating-point data681 /// Load with broadcast floating-point data
644 broadcast,682 broadcast,
645683
...@@ -720,9 +758,24 @@ pub const Inst = struct {...@@ -720,9 +758,24 @@ pub const Inst = struct {
720 /// Register, memory (RIP) operands.758 /// Register, memory (RIP) operands.
721 /// Uses `rx` payload.759 /// Uses `rx` payload.
722 rm_rip,760 rm_rip,
723 /// Register, memory (SIB), immediate (byte) operands.761 /// Register, memory (SIB), immediate (word) operands.
724 /// Uses `rix` payload with extra data of type `MemorySib`.762 /// Uses `rix` payload with extra data of type `MemorySib`.
725 rmi_sib,763 rmi_sib,
764 /// Register, memory (RIP), immediate (word) operands.
765 /// Uses `rix` payload with extra data of type `MemoryRip`.
766 rmi_rip,
767 /// Register, memory (SIB), immediate (signed) operands.
768 /// Uses `rx` payload with extra data of type `Imm32` followed by `MemorySib`.
769 rmi_sib_s,
770 /// Register, memory (SIB), immediate (unsigned) operands.
771 /// Uses `rx` payload with extra data of type `Imm32` followed by `MemorySib`.
772 rmi_sib_u,
773 /// Register, memory (RIP), immediate (signed) operands.
774 /// Uses `rx` payload with extra data of type `Imm32` followed by `MemoryRip`.
775 rmi_rip_s,
776 /// Register, memory (RIP), immediate (unsigned) operands.
777 /// Uses `rx` payload with extra data of type `Imm32` followed by `MemoryRip`.
778 rmi_rip_u,
726 /// Register, register, memory (RIP).779 /// Register, register, memory (RIP).
727 /// Uses `rrix` payload with extra data of type `MemoryRip`.780 /// Uses `rrix` payload with extra data of type `MemoryRip`.
728 rrm_rip,781 rrm_rip,
...@@ -735,27 +788,24 @@ pub const Inst = struct {...@@ -735,27 +788,24 @@ pub const Inst = struct {
735 /// Register, register, memory (SIB), immediate (byte) operands.788 /// Register, register, memory (SIB), immediate (byte) operands.
736 /// Uses `rrix` payload with extra data of type `MemorySib`.789 /// Uses `rrix` payload with extra data of type `MemorySib`.
737 rrmi_sib,790 rrmi_sib,
738 /// Register, memory (RIP), immediate (byte) operands.
739 /// Uses `rix` payload with extra data of type `MemoryRip`.
740 rmi_rip,
741 /// Single memory (SIB) operand.791 /// Single memory (SIB) operand.
742 /// Uses `x` with extra data of type `MemorySib`.792 /// Uses `x` with extra data of type `MemorySib`.
743 m_sib,793 m_sib,
744 /// Single memory (RIP) operand.794 /// Single memory (RIP) operand.
745 /// Uses `x` with extra data of type `MemoryRip`.795 /// Uses `x` with extra data of type `MemoryRip`.
746 m_rip,796 m_rip,
747 /// Memory (SIB), immediate (unsigned) operands.
748 /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`.
749 mi_sib_u,
750 /// Memory (RIP), immediate (unsigned) operands.
751 /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`.
752 mi_rip_u,
753 /// Memory (SIB), immediate (sign-extend) operands.797 /// Memory (SIB), immediate (sign-extend) operands.
754 /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`.798 /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`.
755 mi_sib_s,799 mi_sib_s,
800 /// Memory (SIB), immediate (unsigned) operands.
801 /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`.
802 mi_sib_u,
756 /// Memory (RIP), immediate (sign-extend) operands.803 /// Memory (RIP), immediate (sign-extend) operands.
757 /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`.804 /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`.
758 mi_rip_s,805 mi_rip_s,
806 /// Memory (RIP), immediate (unsigned) operands.
807 /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`.
808 mi_rip_u,
759 /// Memory (SIB), register operands.809 /// Memory (SIB), register operands.
760 /// Uses `rx` payload with extra data of type `MemorySib`.810 /// Uses `rx` payload with extra data of type `MemorySib`.
761 mr_sib,811 mr_sib,
...@@ -768,10 +818,10 @@ pub const Inst = struct {...@@ -768,10 +818,10 @@ pub const Inst = struct {
768 /// Memory (RIP), register, register operands.818 /// Memory (RIP), register, register operands.
769 /// Uses `rrx` payload with extra data of type `MemoryRip`.819 /// Uses `rrx` payload with extra data of type `MemoryRip`.
770 mrr_rip,820 mrr_rip,
771 /// Memory (SIB), register, immediate (byte) operands.821 /// Memory (SIB), register, immediate (word) operands.
772 /// Uses `rix` payload with extra data of type `MemorySib`.822 /// Uses `rix` payload with extra data of type `MemorySib`.
773 mri_sib,823 mri_sib,
774 /// Memory (RIP), register, immediate (byte) operands.824 /// Memory (RIP), register, immediate (word) operands.
775 /// Uses `rix` payload with extra data of type `MemoryRip`.825 /// Uses `rix` payload with extra data of type `MemoryRip`.
776 mri_rip,826 mri_rip,
777 /// Rax, Memory moffs.827 /// Rax, Memory moffs.
...@@ -955,7 +1005,7 @@ pub const Inst = struct {...@@ -955,7 +1005,7 @@ pub const Inst = struct {
955 rix: struct {1005 rix: struct {
956 fixes: Fixes = ._,1006 fixes: Fixes = ._,
957 r1: Register,1007 r1: Register,
958 i: u8,1008 i: u16,
959 payload: u32,1009 payload: u32,
960 },1010 },
961 /// Register, register, byte immediate, followed by Custom payload found in extra.1011 /// Register, register, byte immediate, followed by Custom payload found in extra.
...@@ -1010,7 +1060,7 @@ pub const RegisterList = struct {...@@ -1010,7 +1060,7 @@ pub const RegisterList = struct {
10101060
1011 fn getIndexForReg(registers: []const Register, reg: Register) BitSet.MaskInt {1061 fn getIndexForReg(registers: []const Register, reg: Register) BitSet.MaskInt {
1012 for (registers, 0..) |cpreg, i| {1062 for (registers, 0..) |cpreg, i| {
1013 if (reg.id() == cpreg.id()) return @as(u32, @intCast(i));1063 if (reg.id() == cpreg.id()) return @intCast(i);
1014 }1064 }
1015 unreachable; // register not in input register list!1065 unreachable; // register not in input register list!
1016 }1066 }
...@@ -1030,7 +1080,7 @@ pub const RegisterList = struct {...@@ -1030,7 +1080,7 @@ pub const RegisterList = struct {
1030 }1080 }
10311081
1032 pub fn count(self: Self) u32 {1082 pub fn count(self: Self) u32 {
1033 return @as(u32, @intCast(self.bitset.count()));1083 return @intCast(self.bitset.count());
1034 }1084 }
1035};1085};
10361086
...@@ -1044,14 +1094,14 @@ pub const Imm64 = struct {...@@ -1044,14 +1094,14 @@ pub const Imm64 = struct {
10441094
1045 pub fn encode(v: u64) Imm64 {1095 pub fn encode(v: u64) Imm64 {
1046 return .{1096 return .{
1047 .msb = @as(u32, @truncate(v >> 32)),1097 .msb = @truncate(v >> 32),
1048 .lsb = @as(u32, @truncate(v)),1098 .lsb = @truncate(v),
1049 };1099 };
1050 }1100 }
10511101
1052 pub fn decode(imm: Imm64) u64 {1102 pub fn decode(imm: Imm64) u64 {
1053 var res: u64 = 0;1103 var res: u64 = 0;
1054 res |= (@as(u64, @intCast(imm.msb)) << 32);1104 res |= @as(u64, @intCast(imm.msb)) << 32;
1055 res |= @as(u64, @intCast(imm.lsb));1105 res |= @as(u64, @intCast(imm.lsb));
1056 return res;1106 return res;
1057 }1107 }
...@@ -1075,7 +1125,7 @@ pub const MemorySib = struct {...@@ -1075,7 +1125,7 @@ pub const MemorySib = struct {
1075 assert(sib.scale_index.scale == 0 or std.math.isPowerOfTwo(sib.scale_index.scale));1125 assert(sib.scale_index.scale == 0 or std.math.isPowerOfTwo(sib.scale_index.scale));
1076 return .{1126 return .{
1077 .ptr_size = @intFromEnum(sib.ptr_size),1127 .ptr_size = @intFromEnum(sib.ptr_size),
1078 .base_tag = @intFromEnum(@as(Memory.Base.Tag, sib.base)),1128 .base_tag = @intFromEnum(sib.base),
1079 .base = switch (sib.base) {1129 .base = switch (sib.base) {
1080 .none => undefined,1130 .none => undefined,
1081 .reg => |r| @intFromEnum(r),1131 .reg => |r| @intFromEnum(r),
...@@ -1091,18 +1141,18 @@ pub const MemorySib = struct {...@@ -1091,18 +1141,18 @@ pub const MemorySib = struct {
1091 }1141 }
10921142
1093 pub fn decode(msib: MemorySib) Memory {1143 pub fn decode(msib: MemorySib) Memory {
1094 const scale = @as(u4, @truncate(msib.scale_index));1144 const scale: u4 = @truncate(msib.scale_index);
1095 assert(scale == 0 or std.math.isPowerOfTwo(scale));1145 assert(scale == 0 or std.math.isPowerOfTwo(scale));
1096 return .{ .sib = .{1146 return .{ .sib = .{
1097 .ptr_size = @as(Memory.PtrSize, @enumFromInt(msib.ptr_size)),1147 .ptr_size = @enumFromInt(msib.ptr_size),
1098 .base = switch (@as(Memory.Base.Tag, @enumFromInt(msib.base_tag))) {1148 .base = switch (@as(Memory.Base.Tag, @enumFromInt(msib.base_tag))) {
1099 .none => .none,1149 .none => .none,
1100 .reg => .{ .reg = @as(Register, @enumFromInt(msib.base)) },1150 .reg => .{ .reg = @enumFromInt(msib.base) },
1101 .frame => .{ .frame = @as(bits.FrameIndex, @enumFromInt(msib.base)) },1151 .frame => .{ .frame = @enumFromInt(msib.base) },
1102 },1152 },
1103 .scale_index = .{1153 .scale_index = .{
1104 .scale = scale,1154 .scale = scale,
1105 .index = if (scale > 0) @as(Register, @enumFromInt(msib.scale_index >> 4)) else undefined,1155 .index = if (scale > 0) @enumFromInt(msib.scale_index >> 4) else undefined,
1106 },1156 },
1107 .disp = msib.disp,1157 .disp = msib.disp,
1108 } };1158 } };
...@@ -1124,7 +1174,7 @@ pub const MemoryRip = struct {...@@ -1124,7 +1174,7 @@ pub const MemoryRip = struct {
11241174
1125 pub fn decode(mrip: MemoryRip) Memory {1175 pub fn decode(mrip: MemoryRip) Memory {
1126 return .{ .rip = .{1176 return .{ .rip = .{
1127 .ptr_size = @as(Memory.PtrSize, @enumFromInt(mrip.ptr_size)),1177 .ptr_size = @enumFromInt(mrip.ptr_size),
1128 .disp = mrip.disp,1178 .disp = mrip.disp,
1129 } };1179 } };
1130 }1180 }
...@@ -1141,14 +1191,14 @@ pub const MemoryMoffs = struct {...@@ -1141,14 +1191,14 @@ pub const MemoryMoffs = struct {
1141 pub fn encode(seg: Register, offset: u64) MemoryMoffs {1191 pub fn encode(seg: Register, offset: u64) MemoryMoffs {
1142 return .{1192 return .{
1143 .seg = @intFromEnum(seg),1193 .seg = @intFromEnum(seg),
1144 .msb = @as(u32, @truncate(offset >> 32)),1194 .msb = @truncate(offset >> 32),
1145 .lsb = @as(u32, @truncate(offset >> 0)),1195 .lsb = @truncate(offset >> 0),
1146 };1196 };
1147 }1197 }
11481198
1149 pub fn decode(moffs: MemoryMoffs) Memory {1199 pub fn decode(moffs: MemoryMoffs) Memory {
1150 return .{ .moffs = .{1200 return .{ .moffs = .{
1151 .seg = @as(Register, @enumFromInt(moffs.seg)),1201 .seg = @enumFromInt(moffs.seg),
1152 .offset = @as(u64, moffs.msb) << 32 | @as(u64, moffs.lsb) << 0,1202 .offset = @as(u64, moffs.msb) << 32 | @as(u64, moffs.lsb) << 0,
1153 } };1203 } };
1154 }1204 }
...@@ -1168,7 +1218,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end:...@@ -1168,7 +1218,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end:
1168 inline for (fields) |field| {1218 inline for (fields) |field| {
1169 @field(result, field.name) = switch (field.type) {1219 @field(result, field.name) = switch (field.type) {
1170 u32 => mir.extra[i],1220 u32 => mir.extra[i],
1171 i32 => @as(i32, @bitCast(mir.extra[i])),1221 i32 => @bitCast(mir.extra[i]),
1172 else => @compileError("bad field type"),1222 else => @compileError("bad field type"),
1173 };1223 };
1174 i += 1;1224 i += 1;
src/arch/x86_64/bits.zig+10-10
...@@ -232,7 +232,7 @@ pub const Register = enum(u7) {...@@ -232,7 +232,7 @@ pub const Register = enum(u7) {
232 else => unreachable,232 else => unreachable,
233 // zig fmt: on233 // zig fmt: on
234 };234 };
235 return @as(u6, @intCast(@intFromEnum(reg) - base));235 return @intCast(@intFromEnum(reg) - base);
236 }236 }
237237
238 pub fn bitSize(reg: Register) u64 {238 pub fn bitSize(reg: Register) u64 {
...@@ -291,11 +291,11 @@ pub const Register = enum(u7) {...@@ -291,11 +291,11 @@ pub const Register = enum(u7) {
291 else => unreachable,291 else => unreachable,
292 // zig fmt: on292 // zig fmt: on
293 };293 };
294 return @as(u4, @truncate(@intFromEnum(reg) - base));294 return @truncate(@intFromEnum(reg) - base);
295 }295 }
296296
297 pub fn lowEnc(reg: Register) u3 {297 pub fn lowEnc(reg: Register) u3 {
298 return @as(u3, @truncate(reg.enc()));298 return @truncate(reg.enc());
299 }299 }
300300
301 pub fn toBitSize(reg: Register, bit_size: u64) Register {301 pub fn toBitSize(reg: Register, bit_size: u64) Register {
...@@ -325,19 +325,19 @@ pub const Register = enum(u7) {...@@ -325,19 +325,19 @@ pub const Register = enum(u7) {
325 }325 }
326326
327 pub fn to64(reg: Register) Register {327 pub fn to64(reg: Register) Register {
328 return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.rax)));328 return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.rax));
329 }329 }
330330
331 pub fn to32(reg: Register) Register {331 pub fn to32(reg: Register) Register {
332 return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.eax)));332 return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.eax));
333 }333 }
334334
335 pub fn to16(reg: Register) Register {335 pub fn to16(reg: Register) Register {
336 return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.ax)));336 return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.ax));
337 }337 }
338338
339 pub fn to8(reg: Register) Register {339 pub fn to8(reg: Register) Register {
340 return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.al)));340 return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.al));
341 }341 }
342342
343 fn sseBase(reg: Register) u7 {343 fn sseBase(reg: Register) u7 {
...@@ -350,11 +350,11 @@ pub const Register = enum(u7) {...@@ -350,11 +350,11 @@ pub const Register = enum(u7) {
350 }350 }
351351
352 pub fn to256(reg: Register) Register {352 pub fn to256(reg: Register) Register {
353 return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.ymm0)));353 return @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.ymm0));
354 }354 }
355355
356 pub fn to128(reg: Register) Register {356 pub fn to128(reg: Register) Register {
357 return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.xmm0)));357 return @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.xmm0));
358 }358 }
359359
360 /// DWARF register encoding360 /// DWARF register encoding
...@@ -619,7 +619,7 @@ pub const Immediate = union(enum) {...@@ -619,7 +619,7 @@ pub const Immediate = union(enum) {
619 1, 8 => @as(i8, @bitCast(@as(u8, @intCast(x)))),619 1, 8 => @as(i8, @bitCast(@as(u8, @intCast(x)))),
620 16 => @as(i16, @bitCast(@as(u16, @intCast(x)))),620 16 => @as(i16, @bitCast(@as(u16, @intCast(x)))),
621 32 => @as(i32, @bitCast(@as(u32, @intCast(x)))),621 32 => @as(i32, @bitCast(@as(u32, @intCast(x)))),
622 64 => @as(i64, @bitCast(x)),622 64 => @bitCast(x),
623 else => unreachable,623 else => unreachable,
624 },624 },
625 };625 };
src/arch/x86_64/encodings.zig+200-18
...@@ -905,6 +905,9 @@ pub const table = [_]Entry{...@@ -905,6 +905,9 @@ pub const table = [_]Entry{
905905
906 .{ .movlhps, .rm, &.{ .xmm, .xmm }, &.{ 0x0f, 0x16 }, 0, .none, .sse },906 .{ .movlhps, .rm, &.{ .xmm, .xmm }, &.{ 0x0f, 0x16 }, 0, .none, .sse },
907907
908 .{ .movmskps, .rm, &.{ .r32, .xmm }, &.{ 0x0f, 0x50 }, 0, .none, .sse },
909 .{ .movmskps, .rm, &.{ .r64, .xmm }, &.{ 0x0f, 0x50 }, 0, .none, .sse },
910
908 .{ .movss, .rm, &.{ .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x10 }, 0, .none, .sse },911 .{ .movss, .rm, &.{ .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x10 }, 0, .none, .sse },
909 .{ .movss, .mr, &.{ .xmm_m32, .xmm }, &.{ 0xf3, 0x0f, 0x11 }, 0, .none, .sse },912 .{ .movss, .mr, &.{ .xmm_m32, .xmm }, &.{ 0xf3, 0x0f, 0x11 }, 0, .none, .sse },
910913
...@@ -917,6 +920,9 @@ pub const table = [_]Entry{...@@ -917,6 +920,9 @@ pub const table = [_]Entry{
917920
918 .{ .orps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x56 }, 0, .none, .sse },921 .{ .orps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x56 }, 0, .none, .sse },
919922
923 .{ .pmovmskb, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .none, .sse },
924 .{ .pmovmskb, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .none, .sse },
925
920 .{ .shufps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x0f, 0xc6 }, 0, .none, .sse },926 .{ .shufps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x0f, 0xc6 }, 0, .none, .sse },
921927
922 .{ .sqrtps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x51 }, 0, .none, .sse },928 .{ .sqrtps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x51 }, 0, .none, .sse },
...@@ -1005,6 +1011,12 @@ pub const table = [_]Entry{...@@ -1005,6 +1011,12 @@ pub const table = [_]Entry{
1005 .{ .movdqu, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0xf3, 0x0f, 0x6f }, 0, .none, .sse2 },1011 .{ .movdqu, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0xf3, 0x0f, 0x6f }, 0, .none, .sse2 },
1006 .{ .movdqu, .mr, &.{ .xmm_m128, .xmm }, &.{ 0xf3, 0x0f, 0x7f }, 0, .none, .sse2 },1012 .{ .movdqu, .mr, &.{ .xmm_m128, .xmm }, &.{ 0xf3, 0x0f, 0x7f }, 0, .none, .sse2 },
10071013
1014 .{ .movmskpd, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .none, .sse2 },
1015 .{ .movmskpd, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .none, .sse2 },
1016
1017 .{ .movsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x10 }, 0, .none, .sse2 },
1018 .{ .movsd, .mr, &.{ .xmm_m64, .xmm }, &.{ 0xf2, 0x0f, 0x11 }, 0, .none, .sse2 },
1019
1008 .{ .movq, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf3, 0x0f, 0x7e }, 0, .none, .sse2 },1020 .{ .movq, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf3, 0x0f, 0x7e }, 0, .none, .sse2 },
1009 .{ .movq, .mr, &.{ .xmm_m64, .xmm }, &.{ 0x66, 0x0f, 0xd6 }, 0, .none, .sse2 },1021 .{ .movq, .mr, &.{ .xmm_m64, .xmm }, &.{ 0x66, 0x0f, 0xd6 }, 0, .none, .sse2 },
10101022
...@@ -1037,6 +1049,14 @@ pub const table = [_]Entry{...@@ -1037,6 +1049,14 @@ pub const table = [_]Entry{
10371049
1038 .{ .pandn, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .none, .sse2 },1050 .{ .pandn, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .none, .sse2 },
10391051
1052 .{ .pcmpeqb, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x74 }, 0, .none, .sse2 },
1053 .{ .pcmpeqw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x75 }, 0, .none, .sse2 },
1054 .{ .pcmpeqd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x76 }, 0, .none, .sse2 },
1055
1056 .{ .pcmpgtb, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x64 }, 0, .none, .sse2 },
1057 .{ .pcmpgtw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x65 }, 0, .none, .sse2 },
1058 .{ .pcmpgtd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x66 }, 0, .none, .sse2 },
1059
1040 .{ .pextrw, .rmi, &.{ .r32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0xc5 }, 0, .none, .sse2 },1060 .{ .pextrw, .rmi, &.{ .r32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0xc5 }, 0, .none, .sse2 },
10411061
1042 .{ .pinsrw, .rmi, &.{ .xmm, .r32_m16, .imm8 }, &.{ 0x66, 0x0f, 0xc4 }, 0, .none, .sse2 },1062 .{ .pinsrw, .rmi, &.{ .xmm, .r32_m16, .imm8 }, &.{ 0x66, 0x0f, 0xc4 }, 0, .none, .sse2 },
...@@ -1055,10 +1075,26 @@ pub const table = [_]Entry{...@@ -1055,10 +1075,26 @@ pub const table = [_]Entry{
10551075
1056 .{ .por, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xeb }, 0, .none, .sse2 },1076 .{ .por, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xeb }, 0, .none, .sse2 },
10571077
1078 .{ .pshufd, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x70 }, 0, .none, .sse2 },
1079
1058 .{ .pshufhw, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0xf3, 0x0f, 0x70 }, 0, .none, .sse2 },1080 .{ .pshufhw, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0xf3, 0x0f, 0x70 }, 0, .none, .sse2 },
10591081
1060 .{ .pshuflw, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0xf2, 0x0f, 0x70 }, 0, .none, .sse2 },1082 .{ .pshuflw, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0xf2, 0x0f, 0x70 }, 0, .none, .sse2 },
10611083
1084 .{ .psllw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf1 }, 0, .none, .sse2 },
1085 .{ .psllw, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 6, .none, .sse2 },
1086 .{ .pslld, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf2 }, 0, .none, .sse2 },
1087 .{ .pslld, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x72 }, 6, .none, .sse2 },
1088 .{ .psllq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf3 }, 0, .none, .sse2 },
1089 .{ .psllq, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 6, .none, .sse2 },
1090
1091 .{ .pslldq, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 7, .none, .sse2 },
1092
1093 .{ .psraw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe1 }, 0, .none, .sse2 },
1094 .{ .psraw, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 4, .none, .sse2 },
1095 .{ .psrad, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe2 }, 0, .none, .sse2 },
1096 .{ .psrad, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x72 }, 4, .none, .sse2 },
1097
1062 .{ .psrlw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd1 }, 0, .none, .sse2 },1098 .{ .psrlw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd1 }, 0, .none, .sse2 },
1063 .{ .psrlw, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 2, .none, .sse2 },1099 .{ .psrlw, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 2, .none, .sse2 },
1064 .{ .psrld, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd2 }, 0, .none, .sse2 },1100 .{ .psrld, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd2 }, 0, .none, .sse2 },
...@@ -1066,6 +1102,8 @@ pub const table = [_]Entry{...@@ -1066,6 +1102,8 @@ pub const table = [_]Entry{
1066 .{ .psrlq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd3 }, 0, .none, .sse2 },1102 .{ .psrlq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd3 }, 0, .none, .sse2 },
1067 .{ .psrlq, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 2, .none, .sse2 },1103 .{ .psrlq, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 2, .none, .sse2 },
10681104
1105 .{ .psrldq, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 3, .none, .sse2 },
1106
1069 .{ .psubb, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf8 }, 0, .none, .sse2 },1107 .{ .psubb, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf8 }, 0, .none, .sse2 },
1070 .{ .psubw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf9 }, 0, .none, .sse2 },1108 .{ .psubw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf9 }, 0, .none, .sse2 },
1071 .{ .psubd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xfa }, 0, .none, .sse2 },1109 .{ .psubd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xfa }, 0, .none, .sse2 },
...@@ -1100,9 +1138,6 @@ pub const table = [_]Entry{...@@ -1100,9 +1138,6 @@ pub const table = [_]Entry{
11001138
1101 .{ .subsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x5c }, 0, .none, .sse2 },1139 .{ .subsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x5c }, 0, .none, .sse2 },
11021140
1103 .{ .movsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x10 }, 0, .none, .sse2 },
1104 .{ .movsd, .mr, &.{ .xmm_m64, .xmm }, &.{ 0xf2, 0x0f, 0x11 }, 0, .none, .sse2 },
1105
1106 .{ .ucomisd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0x66, 0x0f, 0x2e }, 0, .none, .sse2 },1141 .{ .ucomisd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0x66, 0x0f, 0x2e }, 0, .none, .sse2 },
11071142
1108 .{ .xorpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x57 }, 0, .none, .sse2 },1143 .{ .xorpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x57 }, 0, .none, .sse2 },
...@@ -1122,13 +1157,17 @@ pub const table = [_]Entry{...@@ -1122,13 +1157,17 @@ pub const table = [_]Entry{
1122 .{ .pabsw, .rm, &.{ .mm, .mm_m64 }, &.{ 0x0f, 0x38, 0x1d }, 0, .none, .ssse3 },1157 .{ .pabsw, .rm, &.{ .mm, .mm_m64 }, &.{ 0x0f, 0x38, 0x1d }, 0, .none, .ssse3 },
1123 .{ .pabsw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x1d }, 0, .none, .ssse3 },1158 .{ .pabsw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x1d }, 0, .none, .ssse3 },
11241159
1160 .{ .palignr, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0f }, 0, .none, .ssse3 },
1161
1125 // SSE4.11162 // SSE4.1
1126 .{ .blendpd, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0d }, 0, .none, .sse4_1 },1163 .{ .blendpd, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0d }, 0, .none, .sse4_1 },
11271164
1128 .{ .blendps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0c }, 0, .none, .sse4_1 },1165 .{ .blendps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0c }, 0, .none, .sse4_1 },
11291166
1167 .{ .blendvpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x15 }, 0, .none, .sse4_1 },
1130 .{ .blendvpd, .rm0, &.{ .xmm, .xmm_m128, .xmm0 }, &.{ 0x66, 0x0f, 0x38, 0x15 }, 0, .none, .sse4_1 },1168 .{ .blendvpd, .rm0, &.{ .xmm, .xmm_m128, .xmm0 }, &.{ 0x66, 0x0f, 0x38, 0x15 }, 0, .none, .sse4_1 },
11311169
1170 .{ .blendvps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x14 }, 0, .none, .sse4_1 },
1132 .{ .blendvps, .rm0, &.{ .xmm, .xmm_m128, .xmm0 }, &.{ 0x66, 0x0f, 0x38, 0x14 }, 0, .none, .sse4_1 },1171 .{ .blendvps, .rm0, &.{ .xmm, .xmm_m128, .xmm0 }, &.{ 0x66, 0x0f, 0x38, 0x14 }, 0, .none, .sse4_1 },
11331172
1134 .{ .extractps, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x17 }, 0, .none, .sse4_1 },1173 .{ .extractps, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x17 }, 0, .none, .sse4_1 },
...@@ -1137,6 +1176,8 @@ pub const table = [_]Entry{...@@ -1137,6 +1176,8 @@ pub const table = [_]Entry{
11371176
1138 .{ .packusdw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x2b }, 0, .none, .sse4_1 },1177 .{ .packusdw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x2b }, 0, .none, .sse4_1 },
11391178
1179 .{ .pcmpeqq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x29 }, 0, .none, .sse4_1 },
1180
1140 .{ .pextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .none, .sse4_1 },1181 .{ .pextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .none, .sse4_1 },
1141 .{ .pextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .none, .sse4_1 },1182 .{ .pextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .none, .sse4_1 },
1142 .{ .pextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .long, .sse4_1 },1183 .{ .pextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .long, .sse4_1 },
...@@ -1171,6 +1212,33 @@ pub const table = [_]Entry{...@@ -1171,6 +1212,33 @@ pub const table = [_]Entry{
11711212
1172 .{ .roundss, .rmi, &.{ .xmm, .xmm_m32, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0a }, 0, .none, .sse4_1 },1213 .{ .roundss, .rmi, &.{ .xmm, .xmm_m32, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0a }, 0, .none, .sse4_1 },
11731214
1215 // SSE4.2
1216 .{ .pcmpgtq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x37 }, 0, .none, .sse4_2 },
1217
1218 // PCLMUL
1219 .{ .pclmulqdq, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x44 }, 0, .none, .pclmul },
1220
1221 // AES
1222 .{ .aesdec, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xde }, 0, .none, .aes },
1223
1224 .{ .aesdeclast, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xdf }, 0, .none, .aes },
1225
1226 .{ .aesenc, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xdc }, 0, .none, .aes },
1227
1228 .{ .aesenclast, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xdd }, 0, .none, .aes },
1229
1230 .{ .aesimc, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xdb }, 0, .none, .aes },
1231
1232 .{ .aeskeygenassist, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0xdf }, 0, .none, .aes },
1233
1234 // SHA
1235 .{ .sha256msg1, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x38, 0xcc }, 0, .none, .sha },
1236
1237 .{ .sha256msg2, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x38, 0xcd }, 0, .none, .sha },
1238
1239 .{ .sha256rnds2, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x38, 0xcb }, 0, .none, .sha },
1240 .{ .sha256rnds2, .rm0, &.{ .xmm, .xmm_m128, .xmm0 }, &.{ 0x0f, 0x38, 0xcb }, 0, .none, .sha },
1241
1174 // AVX1242 // AVX
1175 .{ .vaddpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_128_wig, .avx },1243 .{ .vaddpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_128_wig, .avx },
1176 .{ .vaddpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_256_wig, .avx },1244 .{ .vaddpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_256_wig, .avx },
...@@ -1182,6 +1250,18 @@ pub const table = [_]Entry{...@@ -1182,6 +1250,18 @@ pub const table = [_]Entry{
11821250
1183 .{ .vaddss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x58 }, 0, .vex_lig_wig, .avx },1251 .{ .vaddss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x58 }, 0, .vex_lig_wig, .avx },
11841252
1253 .{ .vaesdec, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xde }, 0, .vex_128_wig, .@"aes avx" },
1254
1255 .{ .vaesdeclast, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xdf }, 0, .vex_128_wig, .@"aes avx" },
1256
1257 .{ .vaesenc, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xdc }, 0, .vex_128_wig, .@"aes avx" },
1258
1259 .{ .vaesenclast, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xdd }, 0, .vex_128_wig, .@"aes avx" },
1260
1261 .{ .vaesimc, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0xdb }, 0, .vex_128_wig, .@"aes avx" },
1262
1263 .{ .vaeskeygenassist, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0xdf }, 0, .vex_128_wig, .@"aes avx" },
1264
1185 .{ .vandnpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x55 }, 0, .vex_128_wig, .avx },1265 .{ .vandnpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x55 }, 0, .vex_128_wig, .avx },
1186 .{ .vandnpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x55 }, 0, .vex_256_wig, .avx },1266 .{ .vandnpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x55 }, 0, .vex_256_wig, .avx },
11871267
...@@ -1295,6 +1375,16 @@ pub const table = [_]Entry{...@@ -1295,6 +1375,16 @@ pub const table = [_]Entry{
12951375
1296 .{ .vmaxss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x5f }, 0, .vex_lig_wig, .avx },1376 .{ .vmaxss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x5f }, 0, .vex_lig_wig, .avx },
12971377
1378 .{ .vmovmskps, .rm, &.{ .r32, .xmm }, &.{ 0x0f, 0x50 }, 0, .vex_128_wig, .avx },
1379 .{ .vmovmskps, .rm, &.{ .r64, .xmm }, &.{ 0x0f, 0x50 }, 0, .vex_128_wig, .avx },
1380 .{ .vmovmskps, .rm, &.{ .r32, .ymm }, &.{ 0x0f, 0x50 }, 0, .vex_256_wig, .avx },
1381 .{ .vmovmskps, .rm, &.{ .r64, .ymm }, &.{ 0x0f, 0x50 }, 0, .vex_256_wig, .avx },
1382
1383 .{ .vmovmskpd, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .vex_128_wig, .avx },
1384 .{ .vmovmskpd, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .vex_128_wig, .avx },
1385 .{ .vmovmskpd, .rm, &.{ .r32, .ymm }, &.{ 0x66, 0x0f, 0x50 }, 0, .vex_256_wig, .avx },
1386 .{ .vmovmskpd, .rm, &.{ .r64, .ymm }, &.{ 0x66, 0x0f, 0x50 }, 0, .vex_256_wig, .avx },
1387
1298 .{ .vminpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_128_wig, .avx },1388 .{ .vminpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_128_wig, .avx },
1299 .{ .vminpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_256_wig, .avx },1389 .{ .vminpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_256_wig, .avx },
13001390
...@@ -1404,10 +1494,26 @@ pub const table = [_]Entry{...@@ -1404,10 +1494,26 @@ pub const table = [_]Entry{
1404 .{ .vpaddusb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdc }, 0, .vex_128_wig, .avx },1494 .{ .vpaddusb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdc }, 0, .vex_128_wig, .avx },
1405 .{ .vpaddusw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdd }, 0, .vex_128_wig, .avx },1495 .{ .vpaddusw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdd }, 0, .vex_128_wig, .avx },
14061496
1497 .{ .vpalignr, .rvmi, &.{ .xmm, .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0f }, 0, .vex_128_wig, .avx },
1498
1407 .{ .vpand, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdb }, 0, .vex_128_wig, .avx },1499 .{ .vpand, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdb }, 0, .vex_128_wig, .avx },
14081500
1409 .{ .vpandn, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_128_wig, .avx },1501 .{ .vpandn, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_128_wig, .avx },
14101502
1503 .{ .vpclmulqdq, .rvmi, &.{ .xmm, .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x44 }, 0, .vex_128_wig, .@"pclmul avx" },
1504
1505 .{ .vpcmpeqb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x74 }, 0, .vex_128_wig, .avx },
1506 .{ .vpcmpeqw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x75 }, 0, .vex_128_wig, .avx },
1507 .{ .vpcmpeqd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x76 }, 0, .vex_128_wig, .avx },
1508
1509 .{ .vpcmpeqq, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x29 }, 0, .vex_128_wig, .avx },
1510
1511 .{ .vpcmpgtb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x64 }, 0, .vex_128_wig, .avx },
1512 .{ .vpcmpgtw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x65 }, 0, .vex_128_wig, .avx },
1513 .{ .vpcmpgtd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x66 }, 0, .vex_128_wig, .avx },
1514
1515 .{ .vpcmpgtq, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x37 }, 0, .vex_128_wig, .avx },
1516
1411 .{ .vpextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .vex_128_w0, .avx },1517 .{ .vpextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .vex_128_w0, .avx },
1412 .{ .vpextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w0, .avx },1518 .{ .vpextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w0, .avx },
1413 .{ .vpextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w1, .avx },1519 .{ .vpextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w1, .avx },
...@@ -1439,6 +1545,9 @@ pub const table = [_]Entry{...@@ -1439,6 +1545,9 @@ pub const table = [_]Entry{
14391545
1440 .{ .vpminud, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_128_wig, .avx },1546 .{ .vpminud, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_128_wig, .avx },
14411547
1548 .{ .vpmovmskb, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .vex_128_wig, .avx },
1549 .{ .vpmovmskb, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .vex_128_wig, .avx },
1550
1442 .{ .vpmulhw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_128_wig, .avx },1551 .{ .vpmulhw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_128_wig, .avx },
14431552
1444 .{ .vpmulld, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .vex_128_wig, .avx },1553 .{ .vpmulld, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .vex_128_wig, .avx },
...@@ -1447,6 +1556,26 @@ pub const table = [_]Entry{...@@ -1447,6 +1556,26 @@ pub const table = [_]Entry{
14471556
1448 .{ .vpor, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_128_wig, .avx },1557 .{ .vpor, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_128_wig, .avx },
14491558
1559 .{ .vpshufd, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x70 }, 0, .vex_128_wig, .avx },
1560
1561 .{ .vpshufhw, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0xf3, 0x0f, 0x70 }, 0, .vex_128_wig, .avx },
1562
1563 .{ .vpshuflw, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0xf2, 0x0f, 0x70 }, 0, .vex_128_wig, .avx },
1564
1565 .{ .vpsllw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf1 }, 0, .vex_128_wig, .avx },
1566 .{ .vpsllw, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 6, .vex_128_wig, .avx },
1567 .{ .vpslld, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf2 }, 0, .vex_128_wig, .avx },
1568 .{ .vpslld, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x72 }, 6, .vex_128_wig, .avx },
1569 .{ .vpsllq, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf3 }, 0, .vex_128_wig, .avx },
1570 .{ .vpsllq, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 6, .vex_128_wig, .avx },
1571
1572 .{ .vpslldq, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 7, .vex_128_wig, .avx },
1573
1574 .{ .vpsraw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe1 }, 0, .vex_128_wig, .avx },
1575 .{ .vpsraw, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 4, .vex_128_wig, .avx },
1576 .{ .vpsrad, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe2 }, 0, .vex_128_wig, .avx },
1577 .{ .vpsrad, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x72 }, 4, .vex_128_wig, .avx },
1578
1450 .{ .vpsrlw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd1 }, 0, .vex_128_wig, .avx },1579 .{ .vpsrlw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd1 }, 0, .vex_128_wig, .avx },
1451 .{ .vpsrlw, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 2, .vex_128_wig, .avx },1580 .{ .vpsrlw, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 2, .vex_128_wig, .avx },
1452 .{ .vpsrld, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd2 }, 0, .vex_128_wig, .avx },1581 .{ .vpsrld, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd2 }, 0, .vex_128_wig, .avx },
...@@ -1454,6 +1583,8 @@ pub const table = [_]Entry{...@@ -1454,6 +1583,8 @@ pub const table = [_]Entry{
1454 .{ .vpsrlq, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd3 }, 0, .vex_128_wig, .avx },1583 .{ .vpsrlq, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd3 }, 0, .vex_128_wig, .avx },
1455 .{ .vpsrlq, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 2, .vex_128_wig, .avx },1584 .{ .vpsrlq, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 2, .vex_128_wig, .avx },
14561585
1586 .{ .vpsrldq, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 3, .vex_128_wig, .avx },
1587
1457 .{ .vpsubb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf8 }, 0, .vex_128_wig, .avx },1588 .{ .vpsubb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf8 }, 0, .vex_128_wig, .avx },
1458 .{ .vpsubw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf9 }, 0, .vex_128_wig, .avx },1589 .{ .vpsubw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf9 }, 0, .vex_128_wig, .avx },
1459 .{ .vpsubd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xfa }, 0, .vex_128_wig, .avx },1590 .{ .vpsubd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xfa }, 0, .vex_128_wig, .avx },
...@@ -1550,6 +1681,18 @@ pub const table = [_]Entry{...@@ -1550,6 +1681,18 @@ pub const table = [_]Entry{
1550 .{ .vfmadd213ss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0x66, 0x0f, 0x38, 0xa9 }, 0, .vex_lig_w0, .fma },1681 .{ .vfmadd213ss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0x66, 0x0f, 0x38, 0xa9 }, 0, .vex_lig_w0, .fma },
1551 .{ .vfmadd231ss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0x66, 0x0f, 0x38, 0xb9 }, 0, .vex_lig_w0, .fma },1682 .{ .vfmadd231ss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0x66, 0x0f, 0x38, 0xb9 }, 0, .vex_lig_w0, .fma },
15521683
1684 // VPCLMULQDQ
1685 .{ .vpclmulqdq, .rvmi, &.{ .ymm, .ymm, .ymm_m256, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x44 }, 0, .vex_256_wig, .vpclmulqdq },
1686
1687 // VAES
1688 .{ .vaesdec, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0xde }, 0, .vex_256_wig, .vaes },
1689
1690 .{ .vaesdeclast, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0xdf }, 0, .vex_256_wig, .vaes },
1691
1692 .{ .vaesenc, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0xdc }, 0, .vex_256_wig, .vaes },
1693
1694 .{ .vaesenclast, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0xdd }, 0, .vex_256_wig, .vaes },
1695
1553 // AVX21696 // AVX2
1554 .{ .vbroadcastss, .rm, &.{ .xmm, .xmm }, &.{ 0x66, 0x0f, 0x38, 0x18 }, 0, .vex_128_w0, .avx2 },1697 .{ .vbroadcastss, .rm, &.{ .xmm, .xmm }, &.{ 0x66, 0x0f, 0x38, 0x18 }, 0, .vex_128_w0, .avx2 },
1555 .{ .vbroadcastss, .rm, &.{ .ymm, .xmm }, &.{ 0x66, 0x0f, 0x38, 0x18 }, 0, .vex_256_w0, .avx2 },1698 .{ .vbroadcastss, .rm, &.{ .ymm, .xmm }, &.{ 0x66, 0x0f, 0x38, 0x18 }, 0, .vex_256_w0, .avx2 },
...@@ -1577,36 +1720,73 @@ pub const table = [_]Entry{...@@ -1577,36 +1720,73 @@ pub const table = [_]Entry{
1577 .{ .vpaddusb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdc }, 0, .vex_256_wig, .avx2 },1720 .{ .vpaddusb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdc }, 0, .vex_256_wig, .avx2 },
1578 .{ .vpaddusw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdd }, 0, .vex_256_wig, .avx2 },1721 .{ .vpaddusw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdd }, 0, .vex_256_wig, .avx2 },
15791722
1723 .{ .vpalignr, .rvmi, &.{ .ymm, .ymm, .ymm_m256, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0f }, 0, .vex_256_wig, .avx2 },
1724
1580 .{ .vpand, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdb }, 0, .vex_256_wig, .avx2 },1725 .{ .vpand, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdb }, 0, .vex_256_wig, .avx2 },
15811726
1582 .{ .vpandn, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_256_wig, .avx2 },1727 .{ .vpandn, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_256_wig, .avx2 },
15831728
1584 .{ .vpmaxsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3c }, 0, .vex_256_wig, .avx },1729 .{ .vpcmpeqb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x74 }, 0, .vex_256_wig, .avx2 },
1585 .{ .vpmaxsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xee }, 0, .vex_256_wig, .avx },1730 .{ .vpcmpeqw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x75 }, 0, .vex_256_wig, .avx2 },
1586 .{ .vpmaxsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3d }, 0, .vex_256_wig, .avx },1731 .{ .vpcmpeqd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x76 }, 0, .vex_256_wig, .avx2 },
1732
1733 .{ .vpcmpeqq, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x29 }, 0, .vex_256_wig, .avx2 },
1734
1735 .{ .vpcmpgtb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x64 }, 0, .vex_256_wig, .avx2 },
1736 .{ .vpcmpgtw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x65 }, 0, .vex_256_wig, .avx2 },
1737 .{ .vpcmpgtd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x66 }, 0, .vex_256_wig, .avx2 },
1738
1739 .{ .vpcmpgtq, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x37 }, 0, .vex_256_wig, .avx2 },
1740
1741 .{ .vpmaxsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3c }, 0, .vex_256_wig, .avx2 },
1742 .{ .vpmaxsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xee }, 0, .vex_256_wig, .avx2 },
1743 .{ .vpmaxsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3d }, 0, .vex_256_wig, .avx2 },
15871744
1588 .{ .vpmaxub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xde }, 0, .vex_256_wig, .avx },1745 .{ .vpmaxub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xde }, 0, .vex_256_wig, .avx2 },
1589 .{ .vpmaxuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3e }, 0, .vex_256_wig, .avx },1746 .{ .vpmaxuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3e }, 0, .vex_256_wig, .avx2 },
15901747
1591 .{ .vpmaxud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3f }, 0, .vex_256_wig, .avx },1748 .{ .vpmaxud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3f }, 0, .vex_256_wig, .avx2 },
15921749
1593 .{ .vpminsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x38 }, 0, .vex_256_wig, .avx },1750 .{ .vpminsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x38 }, 0, .vex_256_wig, .avx2 },
1594 .{ .vpminsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xea }, 0, .vex_256_wig, .avx },1751 .{ .vpminsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xea }, 0, .vex_256_wig, .avx2 },
1595 .{ .vpminsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x39 }, 0, .vex_256_wig, .avx },1752 .{ .vpminsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x39 }, 0, .vex_256_wig, .avx2 },
15961753
1597 .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx },1754 .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx2 },
1598 .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx },1755 .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx2 },
15991756
1600 .{ .vpminud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_256_wig, .avx },1757 .{ .vpminud, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_256_wig, .avx2 },
16011758
1602 .{ .vpmulhw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_256_wig, .avx },1759 .{ .vpmovmskb, .rm, &.{ .r32, .ymm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .vex_256_wig, .avx2 },
1760 .{ .vpmovmskb, .rm, &.{ .r64, .ymm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .vex_256_wig, .avx2 },
16031761
1604 .{ .vpmulld, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .vex_256_wig, .avx },1762 .{ .vpmulhw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_256_wig, .avx2 },
16051763
1606 .{ .vpmullw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xd5 }, 0, .vex_256_wig, .avx },1764 .{ .vpmulld, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .vex_256_wig, .avx2 },
1765
1766 .{ .vpmullw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xd5 }, 0, .vex_256_wig, .avx2 },
16071767
1608 .{ .vpor, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_256_wig, .avx2 },1768 .{ .vpor, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_256_wig, .avx2 },
16091769
1770 .{ .vpshufd, .rmi, &.{ .ymm, .ymm_m256, .imm8 }, &.{ 0x66, 0x0f, 0x70 }, 0, .vex_256_wig, .avx2 },
1771
1772 .{ .vpshufhw, .rmi, &.{ .ymm, .ymm_m256, .imm8 }, &.{ 0xf3, 0x0f, 0x70 }, 0, .vex_256_wig, .avx2 },
1773
1774 .{ .vpshuflw, .rmi, &.{ .ymm, .ymm_m256, .imm8 }, &.{ 0xf2, 0x0f, 0x70 }, 0, .vex_256_wig, .avx2 },
1775
1776 .{ .vpsllw, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf1 }, 0, .vex_256_wig, .avx2 },
1777 .{ .vpsllw, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 6, .vex_256_wig, .avx2 },
1778 .{ .vpslld, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf2 }, 0, .vex_256_wig, .avx2 },
1779 .{ .vpslld, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x72 }, 6, .vex_256_wig, .avx2 },
1780 .{ .vpsllq, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf3 }, 0, .vex_256_wig, .avx2 },
1781 .{ .vpsllq, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 6, .vex_256_wig, .avx2 },
1782
1783 .{ .vpslldq, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 7, .vex_256_wig, .avx2 },
1784
1785 .{ .vpsraw, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe1 }, 0, .vex_256_wig, .avx2 },
1786 .{ .vpsraw, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 4, .vex_256_wig, .avx2 },
1787 .{ .vpsrad, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe2 }, 0, .vex_256_wig, .avx2 },
1788 .{ .vpsrad, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x72 }, 4, .vex_256_wig, .avx2 },
1789
1610 .{ .vpsrlw, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd1 }, 0, .vex_256_wig, .avx2 },1790 .{ .vpsrlw, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd1 }, 0, .vex_256_wig, .avx2 },
1611 .{ .vpsrlw, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 2, .vex_256_wig, .avx2 },1791 .{ .vpsrlw, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 2, .vex_256_wig, .avx2 },
1612 .{ .vpsrld, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd2 }, 0, .vex_256_wig, .avx2 },1792 .{ .vpsrld, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd2 }, 0, .vex_256_wig, .avx2 },
...@@ -1614,6 +1794,8 @@ pub const table = [_]Entry{...@@ -1614,6 +1794,8 @@ pub const table = [_]Entry{
1614 .{ .vpsrlq, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd3 }, 0, .vex_256_wig, .avx2 },1794 .{ .vpsrlq, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd3 }, 0, .vex_256_wig, .avx2 },
1615 .{ .vpsrlq, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 2, .vex_256_wig, .avx2 },1795 .{ .vpsrlq, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 2, .vex_256_wig, .avx2 },
16161796
1797 .{ .vpsrldq, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 3, .vex_128_wig, .avx2 },
1798
1617 .{ .vpsubb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xf8 }, 0, .vex_256_wig, .avx2 },1799 .{ .vpsubb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xf8 }, 0, .vex_256_wig, .avx2 },
1618 .{ .vpsubw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xf9 }, 0, .vex_256_wig, .avx2 },1800 .{ .vpsubw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xf9 }, 0, .vex_256_wig, .avx2 },
1619 .{ .vpsubd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xfa }, 0, .vex_256_wig, .avx2 },1801 .{ .vpsubd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xfa }, 0, .vex_256_wig, .avx2 },
test/behavior/bitreverse.zig+1-1
...@@ -11,11 +11,11 @@ test "@bitReverse large exotic integer" {...@@ -11,11 +11,11 @@ test "@bitReverse large exotic integer" {
1111
12test "@bitReverse" {12test "@bitReverse" {
13 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;13 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
14 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
15 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;14 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
16 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;15 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
17 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO16 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
18 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;17 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
18 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
1919
20 try comptime testBitReverse();20 try comptime testBitReverse();
21 try testBitReverse();21 try testBitReverse();
test/behavior/byteswap.zig+1-1
...@@ -4,11 +4,11 @@ const expect = std.testing.expect;...@@ -4,11 +4,11 @@ const expect = std.testing.expect;
44
5test "@byteSwap integers" {5test "@byteSwap integers" {
6 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;6 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
7 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
8 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;7 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
9 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;8 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
10 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;9 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
11 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;10 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
11 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
1212
13 const ByteSwapIntTest = struct {13 const ByteSwapIntTest = struct {
14 fn run() !void {14 fn run() !void {
test/behavior/math.zig+2-2
...@@ -1321,7 +1321,7 @@ test "remainder division" {...@@ -1321,7 +1321,7 @@ test "remainder division" {
1321 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO1321 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1322 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1322 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1323 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1323 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1324 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO1324 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
1325 if (builtin.zig_backend == .stage2_c and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;1325 if (builtin.zig_backend == .stage2_c and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
13261326
1327 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) {1327 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) {
...@@ -1401,9 +1401,9 @@ test "float modulo division using @mod" {...@@ -1401,9 +1401,9 @@ test "float modulo division using @mod" {
1401 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO1401 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
1402 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1402 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1403 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO1403 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1404 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
1405 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1404 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1406 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;1405 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1406 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
14071407
1408 try comptime fmod(f16);1408 try comptime fmod(f16);
1409 try comptime fmod(f32);1409 try comptime fmod(f32);
test/behavior/popcount.zig-1
...@@ -14,7 +14,6 @@ test "@popCount integers" {...@@ -14,7 +14,6 @@ test "@popCount integers" {
14}14}
1515
16test "@popCount 128bit integer" {16test "@popCount 128bit integer" {
17 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
18 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO17 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
19 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO18 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
20 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO19 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO