| author | |
| committer | |
| log | bb0419599aa93455f3ae0969f4bfd80204807596 |
| tree | edce35a16131dbe5ce31a62cbbf7ac8f2dfca0bc |
| parent | b477279c37d1ca1c141a3e30589bd974687b85cc |
| parent | f7482a5c95dd549eb3da103eab42bac881ba0498 |
| signature |
x86_64: pass more std tests87 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 | 76 | } |
| 77 | 77 | |
| 78 | 78 | test "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 | 79 | // qNaN - any = qNaN |
| 83 | 80 | try test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0); |
| 84 | 81 |
lib/compiler_rt/divtf3_test.zig-4| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const math = std.math; |
| 4 | 3 | const testing = std.testing; |
| 5 | 4 | |
| ... | ... | @@ -31,9 +30,6 @@ fn test__divtf3(a: f128, b: f128, expectedHi: u64, expectedLo: u64) !void { |
| 31 | 30 | } |
| 32 | 31 | |
| 33 | 32 | test "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 | 33 | // NaN / any = NaN |
| 38 | 34 | try test__divtf3(math.nan(f128), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0); |
| 39 | 35 | // inf / any(except inf and nan) = inf |
lib/compiler_rt/float_from_int_test.zig-22| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const testing = std.testing; |
| 4 | 3 | const math = std.math; |
| 5 | 4 | |
| ... | ... | @@ -126,9 +125,6 @@ fn test__floatuntisf(a: u128, expected: f32) !void { |
| 126 | 125 | } |
| 127 | 126 | |
| 128 | 127 | test "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 | 128 | try test__floattisf(0, 0.0); |
| 133 | 129 | |
| 134 | 130 | try test__floattisf(1, 1.0); |
| ... | ... | @@ -175,9 +171,6 @@ test "floattisf" { |
| 175 | 171 | } |
| 176 | 172 | |
| 177 | 173 | test "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 | 174 | try test__floatuntisf(0, 0.0); |
| 182 | 175 | |
| 183 | 176 | try test__floatuntisf(1, 1.0); |
| ... | ... | @@ -374,9 +367,6 @@ fn test__floatuntidf(a: u128, expected: f64) !void { |
| 374 | 367 | } |
| 375 | 368 | |
| 376 | 369 | test "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 | 370 | try test__floattidf(0, 0.0); |
| 381 | 371 | |
| 382 | 372 | try test__floattidf(1, 1.0); |
| ... | ... | @@ -447,9 +437,6 @@ test "floattidf" { |
| 447 | 437 | } |
| 448 | 438 | |
| 449 | 439 | test "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 | 440 | try test__floatuntidf(0, 0.0); |
| 454 | 441 | |
| 455 | 442 | try test__floatuntidf(1, 1.0); |
| ... | ... | @@ -595,9 +582,6 @@ test "floatditf" { |
| 595 | 582 | } |
| 596 | 583 | |
| 597 | 584 | test "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 | 585 | try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000); |
| 602 | 586 | try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000); |
| 603 | 587 | try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0); |
| ... | ... | @@ -619,9 +603,6 @@ fn test__floatuntitf(a: u128, expected: f128) !void { |
| 619 | 603 | } |
| 620 | 604 | |
| 621 | 605 | test "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 | 606 | try test__floattitf(0, 0.0); |
| 626 | 607 | |
| 627 | 608 | try test__floattitf(1, 1.0); |
| ... | ... | @@ -704,9 +685,6 @@ test "floattitf" { |
| 704 | 685 | } |
| 705 | 686 | |
| 706 | 687 | test "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 | 688 | try test__floatuntitf(0, 0.0); |
| 711 | 689 | |
| 712 | 690 | try test__floatuntitf(1, 1.0); |
lib/compiler_rt/fma.zig-5| ... | ... | @@ -6,10 +6,8 @@ |
| 6 | 6 | //! https://git.musl-libc.org/cgit/musl/tree/src/math/fma.c |
| 7 | 7 | |
| 8 | 8 | const std = @import("std"); |
| 9 | const builtin = @import("builtin"); | |
| 10 | 9 | const math = std.math; |
| 11 | 10 | const expect = std.testing.expect; |
| 12 | const arch = builtin.cpu.arch; | |
| 13 | 11 | const common = @import("common.zig"); |
| 14 | 12 | |
| 15 | 13 | pub const panic = common.panic; |
| ... | ... | @@ -343,9 +341,6 @@ test "64" { |
| 343 | 341 | } |
| 344 | 342 | |
| 345 | 343 | test "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 | 344 | const epsilon = 0.000001; |
| 350 | 345 | |
| 351 | 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 | 24 | |
| 25 | 25 | test "fmodx" { |
| 26 | 26 | 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; | |
| 28 | 28 | |
| 29 | 29 | try test_fmodx(6.4, 4.0, 2.4); |
| 30 | 30 | try test_fmodx(6.4, -4.0, 2.4); |
lib/compiler_rt/mulf3_test.zig-4| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | // https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/test/builtins/Unit/multf3_test.c |
| 4 | 4 | |
| 5 | 5 | const std = @import("std"); |
| 6 | const builtin = @import("builtin"); | |
| 7 | 6 | const math = std.math; |
| 8 | 7 | const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64); |
| 9 | 8 | const inf128: f128 = @bitCast(@as(u128, 0x7fff000000000000) << 64); |
| ... | ... | @@ -49,9 +48,6 @@ fn makeNaN128(rand: u64) f128 { |
| 49 | 48 | return @bitCast(int_result); |
| 50 | 49 | } |
| 51 | 50 | test "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 | 51 | // qNaN * any = qNaN |
| 56 | 52 | try test__multf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0); |
| 57 | 53 |
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 | 129 | } |
| 130 | 130 | |
| 131 | 131 | test "__udivei4/__umodei4" { |
| 132 | switch (builtin.zig_backend) { | |
| 133 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 134 | else => {}, | |
| 135 | } | |
| 132 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 133 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 136 | 134 | |
| 137 | 135 | const RndGen = std.rand.DefaultPrng; |
| 138 | 136 | var rnd = RndGen.init(42); |
lib/std/Build.zig+1| ... | ... | @@ -2156,5 +2156,6 @@ pub fn hex64(x: u64) [16]u8 { |
| 2156 | 2156 | } |
| 2157 | 2157 | |
| 2158 | 2158 | test { |
| 2159 | _ = Cache; | |
| 2159 | 2160 | _ = Step; |
| 2160 | 2161 | } |
lib/std/Build/Cache.zig-8| ... | ... | @@ -1007,8 +1007,6 @@ test "cache file and then recall it" { |
| 1007 | 1007 | return error.SkipZigTest; |
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1011 | ||
| 1012 | 1010 | var tmp = testing.tmpDir(.{}); |
| 1013 | 1011 | defer tmp.cleanup(); |
| 1014 | 1012 | |
| ... | ... | @@ -1075,8 +1073,6 @@ test "check that changing a file makes cache fail" { |
| 1075 | 1073 | return error.SkipZigTest; |
| 1076 | 1074 | } |
| 1077 | 1075 | |
| 1078 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1079 | ||
| 1080 | 1076 | var tmp = testing.tmpDir(.{}); |
| 1081 | 1077 | defer tmp.cleanup(); |
| 1082 | 1078 | |
| ... | ... | @@ -1151,8 +1147,6 @@ test "no file inputs" { |
| 1151 | 1147 | return error.SkipZigTest; |
| 1152 | 1148 | } |
| 1153 | 1149 | |
| 1154 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1155 | ||
| 1156 | 1150 | var tmp = testing.tmpDir(.{}); |
| 1157 | 1151 | defer tmp.cleanup(); |
| 1158 | 1152 | |
| ... | ... | @@ -1201,8 +1195,6 @@ test "Manifest with files added after initial hash work" { |
| 1201 | 1195 | return error.SkipZigTest; |
| 1202 | 1196 | } |
| 1203 | 1197 | |
| 1204 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1205 | ||
| 1206 | 1198 | var tmp = testing.tmpDir(.{}); |
| 1207 | 1199 | defer tmp.cleanup(); |
| 1208 | 1200 |
lib/std/Thread/Condition.zig+2-2| ... | ... | @@ -324,6 +324,8 @@ test "Condition - wait and signal" { |
| 324 | 324 | return error.SkipZigTest; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 328 | ||
| 327 | 329 | const num_threads = 4; |
| 328 | 330 | |
| 329 | 331 | const MultiWait = struct { |
| ... | ... | @@ -369,8 +371,6 @@ test "Condition - signal" { |
| 369 | 371 | return error.SkipZigTest; |
| 370 | 372 | } |
| 371 | 373 | |
| 372 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 373 | ||
| 374 | 374 | const num_threads = 4; |
| 375 | 375 | |
| 376 | 376 | const SignalTest = struct { |
lib/std/Thread/Semaphore.zig+2| ... | ... | @@ -39,6 +39,8 @@ test "Thread.Semaphore" { |
| 39 | 39 | return error.SkipZigTest; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 43 | ||
| 42 | 44 | const TestContext = struct { |
| 43 | 45 | sem: *Semaphore, |
| 44 | 46 | n: *i32, |
lib/std/array_hash_map.zig+1-14| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const debug = std.debug; |
| 4 | 3 | const assert = debug.assert; |
| 5 | 4 | const testing = std.testing; |
| ... | ... | @@ -2138,8 +2137,6 @@ test "ensure capacity leak" { |
| 2138 | 2137 | } |
| 2139 | 2138 | |
| 2140 | 2139 | test "big map" { |
| 2141 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2142 | ||
| 2143 | 2140 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2144 | 2141 | defer map.deinit(); |
| 2145 | 2142 | |
| ... | ... | @@ -2193,8 +2190,6 @@ test "big map" { |
| 2193 | 2190 | } |
| 2194 | 2191 | |
| 2195 | 2192 | test "clone" { |
| 2196 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2197 | ||
| 2198 | 2193 | var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2199 | 2194 | defer original.deinit(); |
| 2200 | 2195 | |
| ... | ... | @@ -2221,8 +2216,6 @@ test "clone" { |
| 2221 | 2216 | } |
| 2222 | 2217 | |
| 2223 | 2218 | test "shrink" { |
| 2224 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2225 | ||
| 2226 | 2219 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2227 | 2220 | defer map.deinit(); |
| 2228 | 2221 | |
| ... | ... | @@ -2263,8 +2256,6 @@ test "shrink" { |
| 2263 | 2256 | } |
| 2264 | 2257 | |
| 2265 | 2258 | test "pop" { |
| 2266 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2267 | ||
| 2268 | 2259 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2269 | 2260 | defer map.deinit(); |
| 2270 | 2261 | |
| ... | ... | @@ -2283,8 +2274,6 @@ test "pop" { |
| 2283 | 2274 | } |
| 2284 | 2275 | |
| 2285 | 2276 | test "popOrNull" { |
| 2286 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2287 | ||
| 2288 | 2277 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2289 | 2278 | defer map.deinit(); |
| 2290 | 2279 | |
| ... | ... | @@ -2305,7 +2294,7 @@ test "popOrNull" { |
| 2305 | 2294 | } |
| 2306 | 2295 | |
| 2307 | 2296 | test "reIndex" { |
| 2308 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2297 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2309 | 2298 | |
| 2310 | 2299 | var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator); |
| 2311 | 2300 | defer map.deinit(); |
| ... | ... | @@ -2351,8 +2340,6 @@ test "auto store_hash" { |
| 2351 | 2340 | } |
| 2352 | 2341 | |
| 2353 | 2342 | test "sort" { |
| 2354 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2355 | ||
| 2356 | 2343 | var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 2357 | 2344 | defer map.deinit(); |
| 2358 | 2345 |
lib/std/array_list.zig-11| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const debug = std.debug; |
| 4 | 3 | const assert = debug.assert; |
| 5 | 4 | const testing = std.testing; |
| ... | ... | @@ -1184,8 +1183,6 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" { |
| 1184 | 1183 | } |
| 1185 | 1184 | |
| 1186 | 1185 | test "std.ArrayList/ArrayListUnmanaged.clone" { |
| 1187 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1188 | ||
| 1189 | 1186 | const a = testing.allocator; |
| 1190 | 1187 | { |
| 1191 | 1188 | var array = ArrayList(i32).init(a); |
| ... | ... | @@ -1227,8 +1224,6 @@ test "std.ArrayList/ArrayListUnmanaged.clone" { |
| 1227 | 1224 | } |
| 1228 | 1225 | |
| 1229 | 1226 | test "std.ArrayList/ArrayListUnmanaged.basic" { |
| 1230 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1231 | ||
| 1232 | 1227 | const a = testing.allocator; |
| 1233 | 1228 | { |
| 1234 | 1229 | var list = ArrayList(i32).init(a); |
| ... | ... | @@ -1513,8 +1508,6 @@ test "std.ArrayList/ArrayListUnmanaged.insert" { |
| 1513 | 1508 | } |
| 1514 | 1509 | |
| 1515 | 1510 | test "std.ArrayList/ArrayListUnmanaged.insertSlice" { |
| 1516 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1517 | ||
| 1518 | 1511 | const a = testing.allocator; |
| 1519 | 1512 | { |
| 1520 | 1513 | var list = ArrayList(i32).init(a); |
| ... | ... | @@ -1561,8 +1554,6 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" { |
| 1561 | 1554 | } |
| 1562 | 1555 | |
| 1563 | 1556 | test "std.ArrayList/ArrayListUnmanaged.replaceRange" { |
| 1564 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1565 | ||
| 1566 | 1557 | var arena = std.heap.ArenaAllocator.init(testing.allocator); |
| 1567 | 1558 | defer arena.deinit(); |
| 1568 | 1559 | const a = arena.allocator(); |
| ... | ... | @@ -1734,8 +1725,6 @@ test "shrink still sets length when resizing is disabled" { |
| 1734 | 1725 | } |
| 1735 | 1726 | |
| 1736 | 1727 | test "shrinkAndFree with a copy" { |
| 1737 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1738 | ||
| 1739 | 1728 | var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 }); |
| 1740 | 1729 | const a = failing_allocator.allocator(); |
| 1741 | 1730 |
lib/std/base64.zig-2| ... | ... | @@ -363,8 +363,6 @@ test "base64" { |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | test "base64 padding dest overflow" { |
| 366 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 367 | ||
| 368 | 366 | const input = "foo"; |
| 369 | 367 | |
| 370 | 368 | var expect: [128]u8 = undefined; |
lib/std/bit_set.zig+3-12| ... | ... | @@ -1637,10 +1637,8 @@ fn testStaticBitSet(comptime Set: type) !void { |
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | 1639 | test "IntegerBitSet" { |
| 1640 | switch (builtin.zig_backend) { | |
| 1641 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1642 | else => {}, | |
| 1643 | } | |
| 1640 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1641 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1644 | 1642 | |
| 1645 | 1643 | try testStaticBitSet(IntegerBitSet(0)); |
| 1646 | 1644 | try testStaticBitSet(IntegerBitSet(1)); |
| ... | ... | @@ -1653,10 +1651,7 @@ test "IntegerBitSet" { |
| 1653 | 1651 | } |
| 1654 | 1652 | |
| 1655 | 1653 | test "ArrayBitSet" { |
| 1656 | switch (builtin.zig_backend) { | |
| 1657 | .stage2_x86_64 => return error.SkipZigTest, | |
| 1658 | else => {}, | |
| 1659 | } | |
| 1654 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1660 | 1655 | |
| 1661 | 1656 | inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| { |
| 1662 | 1657 | try testStaticBitSet(ArrayBitSet(u8, size)); |
| ... | ... | @@ -1668,8 +1663,6 @@ test "ArrayBitSet" { |
| 1668 | 1663 | } |
| 1669 | 1664 | |
| 1670 | 1665 | test "DynamicBitSetUnmanaged" { |
| 1671 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1672 | ||
| 1673 | 1666 | const allocator = std.testing.allocator; |
| 1674 | 1667 | var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300); |
| 1675 | 1668 | try testing.expectEqual(@as(usize, 0), a.count()); |
| ... | ... | @@ -1723,8 +1716,6 @@ test "DynamicBitSetUnmanaged" { |
| 1723 | 1716 | } |
| 1724 | 1717 | |
| 1725 | 1718 | test "DynamicBitSet" { |
| 1726 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1727 | ||
| 1728 | 1719 | const allocator = std.testing.allocator; |
| 1729 | 1720 | var a = try DynamicBitSet.initEmpty(allocator, 300); |
| 1730 | 1721 | try testing.expectEqual(@as(usize, 0), a.count()); |
lib/std/compress/deflate/huffman_code.zig-2| ... | ... | @@ -360,8 +360,6 @@ fn byFreq(context: void, a: LiteralNode, b: LiteralNode) bool { |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | test "generate a Huffman code from an array of frequencies" { |
| 363 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 364 | ||
| 365 | 363 | var freqs: [19]u16 = [_]u16{ |
| 366 | 364 | 8, // 0 |
| 367 | 365 | 1, // 1 |
lib/std/compress/gzip.zig-2| ... | ... | @@ -174,8 +174,6 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void { |
| 174 | 174 | // https://tools.ietf.org/rfc/rfc1952.txt length=25037 bytes |
| 175 | 175 | // SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67 |
| 176 | 176 | test "compressed data" { |
| 177 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 178 | ||
| 179 | 177 | try testReader( |
| 180 | 178 | @embedFile("testdata/rfc1952.txt.gz"), |
| 181 | 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 | 199 | // https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes |
| 200 | 200 | // SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009 |
| 201 | 201 | test "compressed data" { |
| 202 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 203 | ||
| 204 | 202 | const rfc1951_txt = @embedFile("testdata/rfc1951.txt"); |
| 205 | 203 | |
| 206 | 204 | // Compressed with compression level = 0 |
lib/std/crypto.zig-2| ... | ... | @@ -314,8 +314,6 @@ test "CSPRNG" { |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | test "issue #4532: no index out of bounds" { |
| 317 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 318 | ||
| 319 | 317 | const types = [_]type{ |
| 320 | 318 | hash.Md5, |
| 321 | 319 | hash.Sha1, |
lib/std/crypto/25519/x25519.zig-4| ... | ... | @@ -137,8 +137,6 @@ test "x25519 rfc7748 one iteration" { |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | test "x25519 rfc7748 1,000 iterations" { |
| 140 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 141 | ||
| 142 | 140 | // These iteration tests are slow so we always skip them. Results have been verified. |
| 143 | 141 | if (true) { |
| 144 | 142 | return error.SkipZigTest; |
| ... | ... | @@ -161,8 +159,6 @@ test "x25519 rfc7748 1,000 iterations" { |
| 161 | 159 | } |
| 162 | 160 | |
| 163 | 161 | test "x25519 rfc7748 1,000,000 iterations" { |
| 164 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 165 | ||
| 166 | 162 | if (true) { |
| 167 | 163 | return error.SkipZigTest; |
| 168 | 164 | } |
lib/std/crypto/aegis.zig-15| ... | ... | @@ -17,7 +17,6 @@ |
| 17 | 17 | //! https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/ |
| 18 | 18 | |
| 19 | 19 | const std = @import("std"); |
| 20 | const builtin = @import("builtin"); | |
| 21 | 20 | const crypto = std.crypto; |
| 22 | 21 | const mem = std.mem; |
| 23 | 22 | const assert = std.debug.assert; |
| ... | ... | @@ -514,8 +513,6 @@ const htest = @import("test.zig"); |
| 514 | 513 | const testing = std.testing; |
| 515 | 514 | |
| 516 | 515 | test "Aegis128L test vector 1" { |
| 517 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 518 | ||
| 519 | 516 | const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 14; |
| 520 | 517 | const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 13; |
| 521 | 518 | const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; |
| ... | ... | @@ -539,8 +536,6 @@ test "Aegis128L test vector 1" { |
| 539 | 536 | } |
| 540 | 537 | |
| 541 | 538 | test "Aegis128L test vector 2" { |
| 542 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 543 | ||
| 544 | 539 | const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16; |
| 545 | 540 | const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16; |
| 546 | 541 | const ad = [_]u8{}; |
| ... | ... | @@ -558,8 +553,6 @@ test "Aegis128L test vector 2" { |
| 558 | 553 | } |
| 559 | 554 | |
| 560 | 555 | test "Aegis128L test vector 3" { |
| 561 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 562 | ||
| 563 | 556 | const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16; |
| 564 | 557 | const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16; |
| 565 | 558 | const ad = [_]u8{}; |
| ... | ... | @@ -576,8 +569,6 @@ test "Aegis128L test vector 3" { |
| 576 | 569 | } |
| 577 | 570 | |
| 578 | 571 | test "Aegis256 test vector 1" { |
| 579 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 580 | ||
| 581 | 572 | const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 30; |
| 582 | 573 | const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 29; |
| 583 | 574 | const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; |
| ... | ... | @@ -601,8 +592,6 @@ test "Aegis256 test vector 1" { |
| 601 | 592 | } |
| 602 | 593 | |
| 603 | 594 | test "Aegis256 test vector 2" { |
| 604 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 605 | ||
| 606 | 595 | const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32; |
| 607 | 596 | const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32; |
| 608 | 597 | const ad = [_]u8{}; |
| ... | ... | @@ -620,8 +609,6 @@ test "Aegis256 test vector 2" { |
| 620 | 609 | } |
| 621 | 610 | |
| 622 | 611 | test "Aegis256 test vector 3" { |
| 623 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 624 | ||
| 625 | 612 | const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32; |
| 626 | 613 | const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32; |
| 627 | 614 | const ad = [_]u8{}; |
| ... | ... | @@ -638,8 +625,6 @@ test "Aegis256 test vector 3" { |
| 638 | 625 | } |
| 639 | 626 | |
| 640 | 627 | test "Aegis MAC" { |
| 641 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 642 | ||
| 643 | 628 | const key = [_]u8{0x00} ** Aegis128LMac.key_length; |
| 644 | 629 | var msg: [64]u8 = undefined; |
| 645 | 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 | 6 | const has_avx = std.Target.x86.featureSetHas(builtin.cpu.features, .avx); |
| 7 | 7 | const has_armaes = std.Target.aarch64.featureSetHas(builtin.cpu.features, .aes); |
| 8 | 8 | // C backend doesn't currently support passing vectors to inline asm. |
| 9 | const impl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c and has_aesni and has_avx) impl: { | |
| 9 | const 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 | 10 | break :impl @import("aes/aesni.zig"); |
| 11 | 11 | } else if (builtin.cpu.arch == .aarch64 and builtin.zig_backend != .stage2_c and has_armaes) |
| 12 | 12 | impl: { |
| ... | ... | @@ -55,8 +55,6 @@ test "ctr" { |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | test "encrypt" { |
| 58 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 59 | ||
| 60 | 58 | // Appendix B |
| 61 | 59 | { |
| 62 | 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 | 84 | } |
| 87 | 85 | |
| 88 | 86 | test "decrypt" { |
| 89 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 90 | ||
| 91 | 87 | // Appendix B |
| 92 | 88 | { |
| 93 | 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 | 113 | } |
| 118 | 114 | |
| 119 | 115 | test "expand 128-bit key" { |
| 120 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 121 | ||
| 122 | 116 | const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; |
| 123 | 117 | const exp_enc = [_]*const [32:0]u8{ |
| 124 | 118 | "2b7e151628aed2a6abf7158809cf4f3c", "a0fafe1788542cb123a339392a6c7605", "f2c295f27a96b9435935807a7359f67f", "3d80477d4716fe3e1e237e446d7a883b", "ef44a541a8525b7fb671253bdb0bad00", "d4d1c6f87c839d87caf2b8bc11f915bc", "6d88a37a110b3efddbf98641ca0093fd", "4e54f70e5f5fc9f384a64fb24ea6dc4f", "ead27321b58dbad2312bf5607f8d292f", "ac7766f319fadc2128d12941575c006e", "d014f9a8c9ee2589e13f0cc8b6630ca6", |
| ... | ... | @@ -141,8 +135,6 @@ test "expand 128-bit key" { |
| 141 | 135 | } |
| 142 | 136 | |
| 143 | 137 | test "expand 256-bit key" { |
| 144 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 145 | ||
| 146 | 138 | const key = [_]u8{ |
| 147 | 139 | 0x60, 0x3d, 0xeb, 0x10, |
| 148 | 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 | 261 | const hexToBytes = std.fmt.hexToBytes; |
| 262 | 262 | |
| 263 | 263 | test "AesOcb test vector 1" { |
| 264 | switch (builtin.zig_backend) { | |
| 265 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 266 | else => {}, | |
| 267 | } | |
| 264 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 265 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 268 | 266 | |
| 269 | 267 | var k: [Aes128Ocb.key_length]u8 = undefined; |
| 270 | 268 | var nonce: [Aes128Ocb.nonce_length]u8 = undefined; |
| ... | ... | @@ -283,10 +281,8 @@ test "AesOcb test vector 1" { |
| 283 | 281 | } |
| 284 | 282 | |
| 285 | 283 | test "AesOcb test vector 2" { |
| 286 | switch (builtin.zig_backend) { | |
| 287 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 288 | else => {}, | |
| 289 | } | |
| 284 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 285 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 290 | 286 | |
| 291 | 287 | var k: [Aes128Ocb.key_length]u8 = undefined; |
| 292 | 288 | var nonce: [Aes128Ocb.nonce_length]u8 = undefined; |
| ... | ... | @@ -307,10 +303,8 @@ test "AesOcb test vector 2" { |
| 307 | 303 | } |
| 308 | 304 | |
| 309 | 305 | test "AesOcb test vector 3" { |
| 310 | switch (builtin.zig_backend) { | |
| 311 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 312 | else => {}, | |
| 313 | } | |
| 306 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 307 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 314 | 308 | |
| 315 | 309 | var k: [Aes128Ocb.key_length]u8 = undefined; |
| 316 | 310 | var nonce: [Aes128Ocb.nonce_length]u8 = undefined; |
| ... | ... | @@ -334,10 +328,8 @@ test "AesOcb test vector 3" { |
| 334 | 328 | } |
| 335 | 329 | |
| 336 | 330 | test "AesOcb test vector 4" { |
| 337 | switch (builtin.zig_backend) { | |
| 338 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 339 | else => {}, | |
| 340 | } | |
| 331 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 332 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 341 | 333 | |
| 342 | 334 | var k: [Aes128Ocb.key_length]u8 = undefined; |
| 343 | 335 | var nonce: [Aes128Ocb.nonce_length]u8 = undefined; |
lib/std/crypto/argon2.zig-10| ... | ... | @@ -622,8 +622,6 @@ pub fn strVerify( |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | test "argon2d" { |
| 625 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 626 | ||
| 627 | 625 | const password = [_]u8{0x01} ** 32; |
| 628 | 626 | const salt = [_]u8{0x02} ** 16; |
| 629 | 627 | const secret = [_]u8{0x03} ** 8; |
| ... | ... | @@ -649,8 +647,6 @@ test "argon2d" { |
| 649 | 647 | } |
| 650 | 648 | |
| 651 | 649 | test "argon2i" { |
| 652 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 653 | ||
| 654 | 650 | const password = [_]u8{0x01} ** 32; |
| 655 | 651 | const salt = [_]u8{0x02} ** 16; |
| 656 | 652 | const secret = [_]u8{0x03} ** 8; |
| ... | ... | @@ -676,8 +672,6 @@ test "argon2i" { |
| 676 | 672 | } |
| 677 | 673 | |
| 678 | 674 | test "argon2id" { |
| 679 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 680 | ||
| 681 | 675 | const password = [_]u8{0x01} ** 32; |
| 682 | 676 | const salt = [_]u8{0x02} ** 16; |
| 683 | 677 | const secret = [_]u8{0x03} ** 8; |
| ... | ... | @@ -703,8 +697,6 @@ test "argon2id" { |
| 703 | 697 | } |
| 704 | 698 | |
| 705 | 699 | test "kdf" { |
| 706 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 707 | ||
| 708 | 700 | const password = "password"; |
| 709 | 701 | const salt = "somesalt"; |
| 710 | 702 | |
| ... | ... | @@ -936,8 +928,6 @@ test "password hash and password verify" { |
| 936 | 928 | } |
| 937 | 929 | |
| 938 | 930 | test "kdf derived key length" { |
| 939 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 940 | ||
| 941 | 931 | const allocator = std.testing.allocator; |
| 942 | 932 | |
| 943 | 933 | const password = "testpass"; |
lib/std/crypto/blake3.zig-2| ... | ... | @@ -682,8 +682,6 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void { |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | test "BLAKE3 reference test cases" { |
| 685 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 686 | ||
| 687 | 685 | var hash_state = Blake3.init(.{}); |
| 688 | 686 | const hash = &hash_state; |
| 689 | 687 | var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* }); |
lib/std/crypto/chacha20.zig-4| ... | ... | @@ -759,8 +759,6 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type { |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | test "chacha20 AEAD API" { |
| 762 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 763 | ||
| 764 | 762 | const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 }; |
| 765 | 763 | const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."; |
| 766 | 764 | const ad = "Additional data"; |
| ... | ... | @@ -782,8 +780,6 @@ test "chacha20 AEAD API" { |
| 782 | 780 | |
| 783 | 781 | // https://tools.ietf.org/html/rfc7539#section-2.4.2 |
| 784 | 782 | test "crypto.chacha20 test vector sunscreen" { |
| 785 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 786 | ||
| 787 | 783 | const expected_result = [_]u8{ |
| 788 | 784 | 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80, |
| 789 | 785 | 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81, |
lib/std/crypto/ghash_polyval.zig-2| ... | ... | @@ -476,8 +476,6 @@ test "ghash2" { |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | test "polyval" { |
| 479 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 480 | ||
| 481 | 479 | const key = [_]u8{0x42} ** 16; |
| 482 | 480 | const m = [_]u8{0x69} ** 256; |
| 483 | 481 |
lib/std/crypto/hash_composition.zig-2| ... | ... | @@ -65,8 +65,6 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384); |
| 65 | 65 | pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512); |
| 66 | 66 | |
| 67 | 67 | test "Hash composition" { |
| 68 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 69 | ||
| 70 | 68 | const Sha256 = sha2.Sha256; |
| 71 | 69 | const msg = "test"; |
| 72 | 70 |
lib/std/crypto/hkdf.zig-2| ... | ... | @@ -72,8 +72,6 @@ pub fn Hkdf(comptime Hmac: type) type { |
| 72 | 72 | const htest = @import("test.zig"); |
| 73 | 73 | |
| 74 | 74 | test "Hkdf" { |
| 75 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 76 | ||
| 77 | 75 | const ikm = [_]u8{0x0b} ** 22; |
| 78 | 76 | const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c }; |
| 79 | 77 | const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 }; |
lib/std/crypto/kyber_d00.zig-28| ... | ... | @@ -553,8 +553,6 @@ const inv_ntt_reductions = [_]i16{ |
| 553 | 553 | }; |
| 554 | 554 | |
| 555 | 555 | test "invNTTReductions bounds" { |
| 556 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 557 | ||
| 558 | 556 | // Checks whether the reductions proposed by invNTTReductions |
| 559 | 557 | // don't overflow during invNTT(). |
| 560 | 558 | var xs = [_]i32{1} ** 256; // start at |x| ≤ q |
| ... | ... | @@ -658,8 +656,6 @@ fn montReduce(x: i32) i16 { |
| 658 | 656 | } |
| 659 | 657 | |
| 660 | 658 | test "Test montReduce" { |
| 661 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 662 | ||
| 663 | 659 | var rnd = RndGen.init(0); |
| 664 | 660 | for (0..1000) |_| { |
| 665 | 661 | const bound = comptime @as(i32, Q) * (1 << 15); |
| ... | ... | @@ -678,8 +674,6 @@ fn feToMont(x: i16) i16 { |
| 678 | 674 | } |
| 679 | 675 | |
| 680 | 676 | test "Test feToMont" { |
| 681 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 682 | ||
| 683 | 677 | var x: i32 = -(1 << 15); |
| 684 | 678 | while (x < 1 << 15) : (x += 1) { |
| 685 | 679 | const y = feToMont(@as(i16, @intCast(x))); |
| ... | ... | @@ -713,8 +707,6 @@ fn feBarrettReduce(x: i16) i16 { |
| 713 | 707 | } |
| 714 | 708 | |
| 715 | 709 | test "Test Barrett reduction" { |
| 716 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 717 | ||
| 718 | 710 | var x: i32 = -(1 << 15); |
| 719 | 711 | while (x < 1 << 15) : (x += 1) { |
| 720 | 712 | var y1 = feBarrettReduce(@as(i16, @intCast(x))); |
| ... | ... | @@ -735,8 +727,6 @@ fn csubq(x: i16) i16 { |
| 735 | 727 | } |
| 736 | 728 | |
| 737 | 729 | test "Test csubq" { |
| 738 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 739 | ||
| 740 | 730 | var x: i32 = -29439; |
| 741 | 731 | while (x < 1 << 15) : (x += 1) { |
| 742 | 732 | const y1 = csubq(@as(i16, @intCast(x))); |
| ... | ... | @@ -1476,8 +1466,6 @@ fn cmov(comptime len: usize, dst: *[len]u8, src: [len]u8, b: u1) void { |
| 1476 | 1466 | } |
| 1477 | 1467 | |
| 1478 | 1468 | test "MulHat" { |
| 1479 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1480 | ||
| 1481 | 1469 | var rnd = RndGen.init(0); |
| 1482 | 1470 | |
| 1483 | 1471 | for (0..100) |_| { |
| ... | ... | @@ -1509,8 +1497,6 @@ test "MulHat" { |
| 1509 | 1497 | } |
| 1510 | 1498 | |
| 1511 | 1499 | test "NTT" { |
| 1512 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1513 | ||
| 1514 | 1500 | var rnd = RndGen.init(0); |
| 1515 | 1501 | |
| 1516 | 1502 | for (0..1000) |_| { |
| ... | ... | @@ -1534,8 +1520,6 @@ test "NTT" { |
| 1534 | 1520 | } |
| 1535 | 1521 | |
| 1536 | 1522 | test "Compression" { |
| 1537 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1538 | ||
| 1539 | 1523 | var rnd = RndGen.init(0); |
| 1540 | 1524 | inline for (.{ 1, 4, 5, 10, 11 }) |d| { |
| 1541 | 1525 | for (0..1000) |_| { |
| ... | ... | @@ -1548,8 +1532,6 @@ test "Compression" { |
| 1548 | 1532 | } |
| 1549 | 1533 | |
| 1550 | 1534 | test "noise" { |
| 1551 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1552 | ||
| 1553 | 1535 | var seed: [32]u8 = undefined; |
| 1554 | 1536 | for (&seed, 0..) |*s, i| { |
| 1555 | 1537 | s.* = @as(u8, @intCast(i)); |
| ... | ... | @@ -1596,8 +1578,6 @@ test "noise" { |
| 1596 | 1578 | } |
| 1597 | 1579 | |
| 1598 | 1580 | test "uniform sampling" { |
| 1599 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1600 | ||
| 1601 | 1581 | var seed: [32]u8 = undefined; |
| 1602 | 1582 | for (&seed, 0..) |*s, i| { |
| 1603 | 1583 | s.* = @as(u8, @intCast(i)); |
| ... | ... | @@ -1631,8 +1611,6 @@ test "uniform sampling" { |
| 1631 | 1611 | } |
| 1632 | 1612 | |
| 1633 | 1613 | test "Polynomial packing" { |
| 1634 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1635 | ||
| 1636 | 1614 | var rnd = RndGen.init(0); |
| 1637 | 1615 | |
| 1638 | 1616 | for (0..1000) |_| { |
| ... | ... | @@ -1642,8 +1620,6 @@ test "Polynomial packing" { |
| 1642 | 1620 | } |
| 1643 | 1621 | |
| 1644 | 1622 | test "Test inner PKE" { |
| 1645 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1646 | ||
| 1647 | 1623 | var seed: [32]u8 = undefined; |
| 1648 | 1624 | var pt: [32]u8 = undefined; |
| 1649 | 1625 | for (&seed, &pt, 0..) |*s, *p, i| { |
| ... | ... | @@ -1665,8 +1641,6 @@ test "Test inner PKE" { |
| 1665 | 1641 | } |
| 1666 | 1642 | |
| 1667 | 1643 | test "Test happy flow" { |
| 1668 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1669 | ||
| 1670 | 1644 | var seed: [64]u8 = undefined; |
| 1671 | 1645 | for (&seed, 0..) |*s, i| { |
| 1672 | 1646 | s.* = @as(u8, @intCast(i)); |
| ... | ... | @@ -1693,8 +1667,6 @@ test "Test happy flow" { |
| 1693 | 1667 | const sha2 = crypto.hash.sha2; |
| 1694 | 1668 | |
| 1695 | 1669 | test "NIST KAT test" { |
| 1696 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1697 | ||
| 1698 | 1670 | inline for (.{ |
| 1699 | 1671 | .{ Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547" }, |
| 1700 | 1672 | .{ Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5" }, |
lib/std/crypto/pbkdf2.zig-15| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const mem = std.mem; |
| 4 | 3 | const maxInt = std.math.maxInt; |
| 5 | 4 | const OutputTooLongError = std.crypto.errors.OutputTooLongError; |
| ... | ... | @@ -152,8 +151,6 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1; |
| 152 | 151 | // RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors |
| 153 | 152 | |
| 154 | 153 | test "RFC 6070 one iteration" { |
| 155 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 156 | ||
| 157 | 154 | const p = "password"; |
| 158 | 155 | const s = "salt"; |
| 159 | 156 | const c = 1; |
| ... | ... | @@ -169,8 +166,6 @@ test "RFC 6070 one iteration" { |
| 169 | 166 | } |
| 170 | 167 | |
| 171 | 168 | test "RFC 6070 two iterations" { |
| 172 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 173 | ||
| 174 | 169 | const p = "password"; |
| 175 | 170 | const s = "salt"; |
| 176 | 171 | const c = 2; |
| ... | ... | @@ -186,8 +181,6 @@ test "RFC 6070 two iterations" { |
| 186 | 181 | } |
| 187 | 182 | |
| 188 | 183 | test "RFC 6070 4096 iterations" { |
| 189 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 190 | ||
| 191 | 184 | const p = "password"; |
| 192 | 185 | const s = "salt"; |
| 193 | 186 | const c = 4096; |
| ... | ... | @@ -203,8 +196,6 @@ test "RFC 6070 4096 iterations" { |
| 203 | 196 | } |
| 204 | 197 | |
| 205 | 198 | test "RFC 6070 16,777,216 iterations" { |
| 206 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 207 | ||
| 208 | 199 | // These iteration tests are slow so we always skip them. Results have been verified. |
| 209 | 200 | if (true) { |
| 210 | 201 | return error.SkipZigTest; |
| ... | ... | @@ -225,8 +216,6 @@ test "RFC 6070 16,777,216 iterations" { |
| 225 | 216 | } |
| 226 | 217 | |
| 227 | 218 | test "RFC 6070 multi-block salt and password" { |
| 228 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 229 | ||
| 230 | 219 | const p = "passwordPASSWORDpassword"; |
| 231 | 220 | const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt"; |
| 232 | 221 | const c = 4096; |
| ... | ... | @@ -242,8 +231,6 @@ test "RFC 6070 multi-block salt and password" { |
| 242 | 231 | } |
| 243 | 232 | |
| 244 | 233 | test "RFC 6070 embedded NUL" { |
| 245 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 246 | ||
| 247 | 234 | const p = "pass\x00word"; |
| 248 | 235 | const s = "sa\x00lt"; |
| 249 | 236 | const c = 4096; |
| ... | ... | @@ -259,8 +246,6 @@ test "RFC 6070 embedded NUL" { |
| 259 | 246 | } |
| 260 | 247 | |
| 261 | 248 | test "Very large dk_len" { |
| 262 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 263 | ||
| 264 | 249 | // This test allocates 8GB of memory and is expected to take several hours to run. |
| 265 | 250 | if (true) { |
| 266 | 251 | return error.SkipZigTest; |
lib/std/crypto/phc_encoding.zig-4| ... | ... | @@ -351,16 +351,12 @@ test "phc format - encoding/decoding" { |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | test "phc format - empty input string" { |
| 354 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 355 | ||
| 356 | 354 | const s = ""; |
| 357 | 355 | const v = deserialize(struct { alg_id: []const u8 }, s); |
| 358 | 356 | try std.testing.expectError(Error.InvalidEncoding, v); |
| 359 | 357 | } |
| 360 | 358 | |
| 361 | 359 | test "phc format - hash without salt" { |
| 362 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 363 | ||
| 364 | 360 | const s = "$scrypt"; |
| 365 | 361 | const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s); |
| 366 | 362 | try std.testing.expectError(Error.InvalidEncoding, v); |
lib/std/crypto/salsa20.zig+1-7| ... | ... | @@ -302,7 +302,7 @@ fn SalsaNonVecImpl(comptime rounds: comptime_int) type { |
| 302 | 302 | }; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | const SalsaImpl = if (builtin.cpu.arch == .x86_64) SalsaVecImpl else SalsaNonVecImpl; | |
| 305 | const SalsaImpl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64) SalsaVecImpl else SalsaNonVecImpl; | |
| 306 | 306 | |
| 307 | 307 | fn keyToWords(key: [32]u8) [8]u32 { |
| 308 | 308 | var k: [8]u32 = undefined; |
| ... | ... | @@ -555,8 +555,6 @@ pub const SealedBox = struct { |
| 555 | 555 | const htest = @import("test.zig"); |
| 556 | 556 | |
| 557 | 557 | test "(x)salsa20" { |
| 558 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 559 | ||
| 560 | 558 | const key = [_]u8{0x69} ** 32; |
| 561 | 559 | const nonce = [_]u8{0x42} ** 8; |
| 562 | 560 | const msg = [_]u8{0} ** 20; |
| ... | ... | @@ -571,8 +569,6 @@ test "(x)salsa20" { |
| 571 | 569 | } |
| 572 | 570 | |
| 573 | 571 | test "xsalsa20poly1305" { |
| 574 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 575 | ||
| 576 | 572 | var msg: [100]u8 = undefined; |
| 577 | 573 | var msg2: [msg.len]u8 = undefined; |
| 578 | 574 | var c: [msg.len]u8 = undefined; |
| ... | ... | @@ -588,8 +584,6 @@ test "xsalsa20poly1305" { |
| 588 | 584 | } |
| 589 | 585 | |
| 590 | 586 | test "xsalsa20poly1305 secretbox" { |
| 591 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 592 | ||
| 593 | 587 | var msg: [100]u8 = undefined; |
| 594 | 588 | var msg2: [msg.len]u8 = undefined; |
| 595 | 589 | var key: [XSalsa20Poly1305.key_length]u8 = undefined; |
lib/std/crypto/scrypt.zig-5| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | // https://github.com/Tarsnap/scrypt |
| 4 | 4 | |
| 5 | 5 | const std = @import("std"); |
| 6 | const builtin = @import("builtin"); | |
| 7 | 6 | const crypto = std.crypto; |
| 8 | 7 | const fmt = std.fmt; |
| 9 | 8 | const io = std.io; |
| ... | ... | @@ -684,8 +683,6 @@ test "unix-scrypt" { |
| 684 | 683 | } |
| 685 | 684 | |
| 686 | 685 | test "crypt format" { |
| 687 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 688 | ||
| 689 | 686 | const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D"; |
| 690 | 687 | const params = try crypt_format.deserialize(crypt_format.HashResult(32), str); |
| 691 | 688 | var buf: [str.len]u8 = undefined; |
| ... | ... | @@ -694,8 +691,6 @@ test "crypt format" { |
| 694 | 691 | } |
| 695 | 692 | |
| 696 | 693 | test "kdf fast" { |
| 697 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 698 | ||
| 699 | 694 | const TestVector = struct { |
| 700 | 695 | password: []const u8, |
| 701 | 696 | salt: []const u8, |
lib/std/crypto/sha2.zig-10| ... | ... | @@ -406,16 +406,12 @@ fn Sha2x32(comptime params: Sha2Params32) type { |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | test "sha224 single" { |
| 409 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 410 | ||
| 411 | 409 | try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", ""); |
| 412 | 410 | try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc"); |
| 413 | 411 | try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"); |
| 414 | 412 | } |
| 415 | 413 | |
| 416 | 414 | test "sha224 streaming" { |
| 417 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 418 | ||
| 419 | 415 | var h = Sha224.init(.{}); |
| 420 | 416 | var out: [28]u8 = undefined; |
| 421 | 417 | |
| ... | ... | @@ -436,16 +432,12 @@ test "sha224 streaming" { |
| 436 | 432 | } |
| 437 | 433 | |
| 438 | 434 | test "sha256 single" { |
| 439 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 440 | ||
| 441 | 435 | try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ""); |
| 442 | 436 | try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc"); |
| 443 | 437 | try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"); |
| 444 | 438 | } |
| 445 | 439 | |
| 446 | 440 | test "sha256 streaming" { |
| 447 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 448 | ||
| 449 | 441 | var h = Sha256.init(.{}); |
| 450 | 442 | var out: [32]u8 = undefined; |
| 451 | 443 | |
| ... | ... | @@ -466,8 +458,6 @@ test "sha256 streaming" { |
| 466 | 458 | } |
| 467 | 459 | |
| 468 | 460 | test "sha256 aligned final" { |
| 469 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 470 | ||
| 471 | 461 | var block = [_]u8{0} ** Sha256.block_length; |
| 472 | 462 | var out: [Sha256.digest_length]u8 = undefined; |
| 473 | 463 |
lib/std/fifo.zig-2| ... | ... | @@ -505,8 +505,6 @@ test "LinearFifo(u8, .Dynamic)" { |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | test "LinearFifo" { |
| 508 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 509 | ||
| 510 | 508 | inline for ([_]type{ u1, u8, u16, u64 }) |T| { |
| 511 | 509 | inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| { |
| 512 | 510 | const FifoType = LinearFifo(T, bt); |
lib/std/fmt.zig-2| ... | ... | @@ -2751,8 +2751,6 @@ test "formatType max_depth" { |
| 2751 | 2751 | } |
| 2752 | 2752 | |
| 2753 | 2753 | test "positional" { |
| 2754 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2755 | ||
| 2756 | 2754 | try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) }); |
| 2757 | 2755 | try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) }); |
| 2758 | 2756 | try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)}); |
lib/std/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 | 3244 | } |
| 3245 | 3245 | |
| 3246 | 3246 | test { |
| 3247 | if (builtin.zig_backend != .stage2_x86_64) { | |
| 3248 | if (builtin.os.tag != .wasi) { | |
| 3249 | _ = &makeDirAbsolute; | |
| 3250 | _ = &makeDirAbsoluteZ; | |
| 3251 | _ = &copyFileAbsolute; | |
| 3247 | if (builtin.os.tag != .wasi) { | |
| 3248 | _ = &makeDirAbsolute; | |
| 3249 | _ = &makeDirAbsoluteZ; | |
| 3250 | _ = &copyFileAbsolute; | |
| 3251 | if (builtin.zig_backend != .stage2_x86_64) { | |
| 3252 | 3252 | _ = &updateFileAbsolute; |
| 3253 | 3253 | } |
| 3254 | _ = &Dir.copyFile; | |
| 3255 | 3254 | } |
| 3255 | _ = &Dir.copyFile; | |
| 3256 | 3256 | _ = @import("fs/test.zig"); |
| 3257 | 3257 | _ = @import("fs/path.zig"); |
| 3258 | 3258 | _ = @import("fs/file.zig"); |
lib/std/fs/test.zig-98| ... | ... | @@ -124,8 +124,6 @@ fn testWithAllSupportedPathTypes(test_func: anytype) !void { |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | test "Dir.readLink" { |
| 127 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 128 | ||
| 129 | 127 | try testWithAllSupportedPathTypes(struct { |
| 130 | 128 | fn impl(ctx: *TestContext) !void { |
| 131 | 129 | // Create some targets |
| ... | ... | @@ -163,8 +161,6 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo |
| 163 | 161 | } |
| 164 | 162 | |
| 165 | 163 | test "relative symlink to parent directory" { |
| 166 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 167 | ||
| 168 | 164 | var tmp = tmpDir(.{}); |
| 169 | 165 | defer tmp.cleanup(); |
| 170 | 166 | |
| ... | ... | @@ -182,8 +178,6 @@ test "relative symlink to parent directory" { |
| 182 | 178 | } |
| 183 | 179 | |
| 184 | 180 | test "openDir" { |
| 185 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 186 | ||
| 187 | 181 | try testWithAllSupportedPathTypes(struct { |
| 188 | 182 | fn impl(ctx: *TestContext) !void { |
| 189 | 183 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -202,8 +196,6 @@ test "openDir" { |
| 202 | 196 | test "accessAbsolute" { |
| 203 | 197 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 204 | 198 | |
| 205 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 206 | ||
| 207 | 199 | var tmp = tmpDir(.{}); |
| 208 | 200 | defer tmp.cleanup(); |
| 209 | 201 | |
| ... | ... | @@ -222,8 +214,6 @@ test "accessAbsolute" { |
| 222 | 214 | test "openDirAbsolute" { |
| 223 | 215 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 224 | 216 | |
| 225 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 226 | ||
| 227 | 217 | var tmp = tmpDir(.{}); |
| 228 | 218 | defer tmp.cleanup(); |
| 229 | 219 | |
| ... | ... | @@ -262,8 +252,6 @@ test "openDir non-cwd parent .." { |
| 262 | 252 | else => {}, |
| 263 | 253 | } |
| 264 | 254 | |
| 265 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 266 | ||
| 267 | 255 | var tmp = tmpDir(.{}); |
| 268 | 256 | defer tmp.cleanup(); |
| 269 | 257 | |
| ... | ... | @@ -285,8 +273,6 @@ test "openDir non-cwd parent .." { |
| 285 | 273 | test "readLinkAbsolute" { |
| 286 | 274 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 287 | 275 | |
| 288 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 289 | ||
| 290 | 276 | var tmp = tmpDir(.{}); |
| 291 | 277 | defer tmp.cleanup(); |
| 292 | 278 | |
| ... | ... | @@ -337,8 +323,6 @@ fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void |
| 337 | 323 | } |
| 338 | 324 | |
| 339 | 325 | test "Dir.Iterator" { |
| 340 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 341 | ||
| 342 | 326 | var tmp_dir = tmpIterableDir(.{}); |
| 343 | 327 | defer tmp_dir.cleanup(); |
| 344 | 328 | |
| ... | ... | @@ -369,8 +353,6 @@ test "Dir.Iterator" { |
| 369 | 353 | } |
| 370 | 354 | |
| 371 | 355 | test "Dir.Iterator many entries" { |
| 372 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 373 | ||
| 374 | 356 | var tmp_dir = tmpIterableDir(.{}); |
| 375 | 357 | defer tmp_dir.cleanup(); |
| 376 | 358 | |
| ... | ... | @@ -406,8 +388,6 @@ test "Dir.Iterator many entries" { |
| 406 | 388 | } |
| 407 | 389 | |
| 408 | 390 | test "Dir.Iterator twice" { |
| 409 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 410 | ||
| 411 | 391 | var tmp_dir = tmpIterableDir(.{}); |
| 412 | 392 | defer tmp_dir.cleanup(); |
| 413 | 393 | |
| ... | ... | @@ -441,8 +421,6 @@ test "Dir.Iterator twice" { |
| 441 | 421 | } |
| 442 | 422 | |
| 443 | 423 | test "Dir.Iterator reset" { |
| 444 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 445 | ||
| 446 | 424 | var tmp_dir = tmpIterableDir(.{}); |
| 447 | 425 | defer tmp_dir.cleanup(); |
| 448 | 426 | |
| ... | ... | @@ -479,8 +457,6 @@ test "Dir.Iterator reset" { |
| 479 | 457 | } |
| 480 | 458 | |
| 481 | 459 | test "Dir.Iterator but dir is deleted during iteration" { |
| 482 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 483 | ||
| 484 | 460 | var tmp = std.testing.tmpDir(.{}); |
| 485 | 461 | defer tmp.cleanup(); |
| 486 | 462 | |
| ... | ... | @@ -523,8 +499,6 @@ fn contains(entries: *const std.ArrayList(IterableDir.Entry), el: IterableDir.En |
| 523 | 499 | test "Dir.realpath smoke test" { |
| 524 | 500 | if (!comptime std.os.isGetFdPathSupportedOnTarget(builtin.os)) return error.SkipZigTest; |
| 525 | 501 | |
| 526 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 527 | ||
| 528 | 502 | try testWithAllSupportedPathTypes(struct { |
| 529 | 503 | fn impl(ctx: *TestContext) !void { |
| 530 | 504 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -575,8 +549,6 @@ test "Dir.realpath smoke test" { |
| 575 | 549 | } |
| 576 | 550 | |
| 577 | 551 | test "readAllAlloc" { |
| 578 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 579 | ||
| 580 | 552 | var tmp_dir = tmpDir(.{}); |
| 581 | 553 | defer tmp_dir.cleanup(); |
| 582 | 554 | |
| ... | ... | @@ -613,8 +585,6 @@ test "Dir.statFile" { |
| 613 | 585 | // TODO: Re-enable once https://github.com/ziglang/zig/issues/17034 is solved |
| 614 | 586 | if (builtin.os.tag == .linux and builtin.link_libc and builtin.abi == .gnu) return error.SkipZigTest; |
| 615 | 587 | |
| 616 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 617 | ||
| 618 | 588 | try testWithAllSupportedPathTypes(struct { |
| 619 | 589 | fn impl(ctx: *TestContext) !void { |
| 620 | 590 | const test_file_name = try ctx.transformPath("test_file"); |
| ... | ... | @@ -630,8 +600,6 @@ test "Dir.statFile" { |
| 630 | 600 | } |
| 631 | 601 | |
| 632 | 602 | test "directory operations on files" { |
| 633 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 634 | ||
| 635 | 603 | try testWithAllSupportedPathTypes(struct { |
| 636 | 604 | fn impl(ctx: *TestContext) !void { |
| 637 | 605 | const test_file_name = try ctx.transformPath("test_file"); |
| ... | ... | @@ -661,8 +629,6 @@ test "file operations on directories" { |
| 661 | 629 | // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759 |
| 662 | 630 | if (builtin.os.tag == .freebsd) return error.SkipZigTest; |
| 663 | 631 | |
| 664 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 665 | ||
| 666 | 632 | try testWithAllSupportedPathTypes(struct { |
| 667 | 633 | fn impl(ctx: *TestContext) !void { |
| 668 | 634 | const test_dir_name = try ctx.transformPath("test_dir"); |
| ... | ... | @@ -698,8 +664,6 @@ test "file operations on directories" { |
| 698 | 664 | } |
| 699 | 665 | |
| 700 | 666 | test "makeOpenPath parent dirs do not exist" { |
| 701 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 702 | ||
| 703 | 667 | var tmp_dir = tmpDir(.{}); |
| 704 | 668 | defer tmp_dir.cleanup(); |
| 705 | 669 | |
| ... | ... | @@ -712,8 +676,6 @@ test "makeOpenPath parent dirs do not exist" { |
| 712 | 676 | } |
| 713 | 677 | |
| 714 | 678 | test "deleteDir" { |
| 715 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 716 | ||
| 717 | 679 | try testWithAllSupportedPathTypes(struct { |
| 718 | 680 | fn impl(ctx: *TestContext) !void { |
| 719 | 681 | const test_dir_path = try ctx.transformPath("test_dir"); |
| ... | ... | @@ -735,8 +697,6 @@ test "deleteDir" { |
| 735 | 697 | } |
| 736 | 698 | |
| 737 | 699 | test "Dir.rename files" { |
| 738 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 739 | ||
| 740 | 700 | try testWithAllSupportedPathTypes(struct { |
| 741 | 701 | fn impl(ctx: *TestContext) !void { |
| 742 | 702 | // Rename on Windows can hit intermittent AccessDenied errors |
| ... | ... | @@ -779,8 +739,6 @@ test "Dir.rename files" { |
| 779 | 739 | } |
| 780 | 740 | |
| 781 | 741 | test "Dir.rename directories" { |
| 782 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 783 | ||
| 784 | 742 | try testWithAllSupportedPathTypes(struct { |
| 785 | 743 | fn impl(ctx: *TestContext) !void { |
| 786 | 744 | // Rename on Windows can hit intermittent AccessDenied errors |
| ... | ... | @@ -822,8 +780,6 @@ test "Dir.rename directory onto empty dir" { |
| 822 | 780 | // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364 |
| 823 | 781 | if (builtin.os.tag == .windows) return error.SkipZigTest; |
| 824 | 782 | |
| 825 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 826 | ||
| 827 | 783 | try testWithAllSupportedPathTypes(struct { |
| 828 | 784 | fn impl(ctx: *TestContext) !void { |
| 829 | 785 | const test_dir_path = try ctx.transformPath("test_dir"); |
| ... | ... | @@ -845,8 +801,6 @@ test "Dir.rename directory onto non-empty dir" { |
| 845 | 801 | // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364 |
| 846 | 802 | if (builtin.os.tag == .windows) return error.SkipZigTest; |
| 847 | 803 | |
| 848 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 849 | ||
| 850 | 804 | try testWithAllSupportedPathTypes(struct { |
| 851 | 805 | fn impl(ctx: *TestContext) !void { |
| 852 | 806 | const test_dir_path = try ctx.transformPath("test_dir"); |
| ... | ... | @@ -873,8 +827,6 @@ test "Dir.rename file <-> dir" { |
| 873 | 827 | // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364 |
| 874 | 828 | if (builtin.os.tag == .windows) return error.SkipZigTest; |
| 875 | 829 | |
| 876 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 877 | ||
| 878 | 830 | try testWithAllSupportedPathTypes(struct { |
| 879 | 831 | fn impl(ctx: *TestContext) !void { |
| 880 | 832 | const test_file_path = try ctx.transformPath("test_file"); |
| ... | ... | @@ -890,8 +842,6 @@ test "Dir.rename file <-> dir" { |
| 890 | 842 | } |
| 891 | 843 | |
| 892 | 844 | test "rename" { |
| 893 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 894 | ||
| 895 | 845 | var tmp_dir1 = tmpDir(.{}); |
| 896 | 846 | defer tmp_dir1.cleanup(); |
| 897 | 847 | |
| ... | ... | @@ -914,8 +864,6 @@ test "rename" { |
| 914 | 864 | test "renameAbsolute" { |
| 915 | 865 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 916 | 866 | |
| 917 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 918 | ||
| 919 | 867 | var tmp_dir = tmpDir(.{}); |
| 920 | 868 | defer tmp_dir.cleanup(); |
| 921 | 869 | |
| ... | ... | @@ -974,8 +922,6 @@ test "openSelfExe" { |
| 974 | 922 | } |
| 975 | 923 | |
| 976 | 924 | test "makePath, put some files in it, deleteTree" { |
| 977 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 978 | ||
| 979 | 925 | try testWithAllSupportedPathTypes(struct { |
| 980 | 926 | fn impl(ctx: *TestContext) !void { |
| 981 | 927 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -992,8 +938,6 @@ test "makePath, put some files in it, deleteTree" { |
| 992 | 938 | } |
| 993 | 939 | |
| 994 | 940 | test "makePath, put some files in it, deleteTreeMinStackSize" { |
| 995 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 996 | ||
| 997 | 941 | try testWithAllSupportedPathTypes(struct { |
| 998 | 942 | fn impl(ctx: *TestContext) !void { |
| 999 | 943 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -1012,8 +956,6 @@ test "makePath, put some files in it, deleteTreeMinStackSize" { |
| 1012 | 956 | test "makePath in a directory that no longer exists" { |
| 1013 | 957 | if (builtin.os.tag == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir |
| 1014 | 958 | |
| 1015 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1016 | ||
| 1017 | 959 | var tmp = tmpDir(.{}); |
| 1018 | 960 | defer tmp.cleanup(); |
| 1019 | 961 | try tmp.parent_dir.deleteTree(&tmp.sub_path); |
| ... | ... | @@ -1045,8 +987,6 @@ fn testFilenameLimits(iterable_dir: IterableDir, maxed_filename: []const u8) !vo |
| 1045 | 987 | } |
| 1046 | 988 | |
| 1047 | 989 | test "max file name component lengths" { |
| 1048 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1049 | ||
| 1050 | 990 | var tmp = tmpIterableDir(.{}); |
| 1051 | 991 | defer tmp.cleanup(); |
| 1052 | 992 | |
| ... | ... | @@ -1068,8 +1008,6 @@ test "max file name component lengths" { |
| 1068 | 1008 | } |
| 1069 | 1009 | |
| 1070 | 1010 | test "writev, readv" { |
| 1071 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1072 | ||
| 1073 | 1011 | var tmp = tmpDir(.{}); |
| 1074 | 1012 | defer tmp.cleanup(); |
| 1075 | 1013 | |
| ... | ... | @@ -1112,8 +1050,6 @@ test "writev, readv" { |
| 1112 | 1050 | } |
| 1113 | 1051 | |
| 1114 | 1052 | test "pwritev, preadv" { |
| 1115 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1116 | ||
| 1117 | 1053 | var tmp = tmpDir(.{}); |
| 1118 | 1054 | defer tmp.cleanup(); |
| 1119 | 1055 | |
| ... | ... | @@ -1155,8 +1091,6 @@ test "pwritev, preadv" { |
| 1155 | 1091 | } |
| 1156 | 1092 | |
| 1157 | 1093 | test "access file" { |
| 1158 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1159 | ||
| 1160 | 1094 | try testWithAllSupportedPathTypes(struct { |
| 1161 | 1095 | fn impl(ctx: *TestContext) !void { |
| 1162 | 1096 | const dir_path = try ctx.transformPath("os_test_tmp"); |
| ... | ... | @@ -1173,8 +1107,6 @@ test "access file" { |
| 1173 | 1107 | } |
| 1174 | 1108 | |
| 1175 | 1109 | test "sendfile" { |
| 1176 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1177 | ||
| 1178 | 1110 | var tmp = tmpDir(.{}); |
| 1179 | 1111 | defer tmp.cleanup(); |
| 1180 | 1112 | |
| ... | ... | @@ -1240,8 +1172,6 @@ test "sendfile" { |
| 1240 | 1172 | } |
| 1241 | 1173 | |
| 1242 | 1174 | test "copyRangeAll" { |
| 1243 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1244 | ||
| 1245 | 1175 | var tmp = tmpDir(.{}); |
| 1246 | 1176 | defer tmp.cleanup(); |
| 1247 | 1177 | |
| ... | ... | @@ -1268,8 +1198,6 @@ test "copyRangeAll" { |
| 1268 | 1198 | } |
| 1269 | 1199 | |
| 1270 | 1200 | test "copyFile" { |
| 1271 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1272 | ||
| 1273 | 1201 | try testWithAllSupportedPathTypes(struct { |
| 1274 | 1202 | fn impl(ctx: *TestContext) !void { |
| 1275 | 1203 | const data = "u6wj+JmdF3qHsFPE BUlH2g4gJCmEz0PP"; |
| ... | ... | @@ -1300,8 +1228,6 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void { |
| 1300 | 1228 | } |
| 1301 | 1229 | |
| 1302 | 1230 | test "AtomicFile" { |
| 1303 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1304 | ||
| 1305 | 1231 | try testWithAllSupportedPathTypes(struct { |
| 1306 | 1232 | fn impl(ctx: *TestContext) !void { |
| 1307 | 1233 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -1328,8 +1254,6 @@ test "AtomicFile" { |
| 1328 | 1254 | test "open file with exclusive nonblocking lock twice" { |
| 1329 | 1255 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1330 | 1256 | |
| 1331 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1332 | ||
| 1333 | 1257 | try testWithAllSupportedPathTypes(struct { |
| 1334 | 1258 | fn impl(ctx: *TestContext) !void { |
| 1335 | 1259 | const filename = try ctx.transformPath("file_nonblocking_lock_test.txt"); |
| ... | ... | @@ -1346,8 +1270,6 @@ test "open file with exclusive nonblocking lock twice" { |
| 1346 | 1270 | test "open file with shared and exclusive nonblocking lock" { |
| 1347 | 1271 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1348 | 1272 | |
| 1349 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1350 | ||
| 1351 | 1273 | try testWithAllSupportedPathTypes(struct { |
| 1352 | 1274 | fn impl(ctx: *TestContext) !void { |
| 1353 | 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 | 1286 | test "open file with exclusive and shared nonblocking lock" { |
| 1365 | 1287 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1366 | 1288 | |
| 1367 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1368 | ||
| 1369 | 1289 | try testWithAllSupportedPathTypes(struct { |
| 1370 | 1290 | fn impl(ctx: *TestContext) !void { |
| 1371 | 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 | 1300 | } |
| 1381 | 1301 | |
| 1382 | 1302 | test "open file with exclusive lock twice, make sure second lock waits" { |
| 1383 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1384 | ||
| 1385 | 1303 | if (builtin.single_threaded) return error.SkipZigTest; |
| 1386 | 1304 | |
| 1387 | 1305 | if (std.io.is_async) { |
| ... | ... | @@ -1432,8 +1350,6 @@ test "open file with exclusive lock twice, make sure second lock waits" { |
| 1432 | 1350 | test "open file with exclusive nonblocking lock twice (absolute paths)" { |
| 1433 | 1351 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1434 | 1352 | |
| 1435 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1436 | ||
| 1437 | 1353 | var random_bytes: [12]u8 = undefined; |
| 1438 | 1354 | std.crypto.random.bytes(&random_bytes); |
| 1439 | 1355 | |
| ... | ... | @@ -1468,8 +1384,6 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" { |
| 1468 | 1384 | test "walker" { |
| 1469 | 1385 | if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 1470 | 1386 | |
| 1471 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1472 | ||
| 1473 | 1387 | var tmp = tmpIterableDir(.{}); |
| 1474 | 1388 | defer tmp.cleanup(); |
| 1475 | 1389 | |
| ... | ... | @@ -1523,8 +1437,6 @@ test "walker" { |
| 1523 | 1437 | test "walker without fully iterating" { |
| 1524 | 1438 | if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 1525 | 1439 | |
| 1526 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1527 | ||
| 1528 | 1440 | var tmp = tmpIterableDir(.{}); |
| 1529 | 1441 | defer tmp.cleanup(); |
| 1530 | 1442 | |
| ... | ... | @@ -1637,8 +1549,6 @@ test "chmod" { |
| 1637 | 1549 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) |
| 1638 | 1550 | return error.SkipZigTest; |
| 1639 | 1551 | |
| 1640 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1641 | ||
| 1642 | 1552 | var tmp = tmpDir(.{}); |
| 1643 | 1553 | defer tmp.cleanup(); |
| 1644 | 1554 | |
| ... | ... | @@ -1661,8 +1571,6 @@ test "chown" { |
| 1661 | 1571 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) |
| 1662 | 1572 | return error.SkipZigTest; |
| 1663 | 1573 | |
| 1664 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1665 | ||
| 1666 | 1574 | var tmp = tmpDir(.{}); |
| 1667 | 1575 | defer tmp.cleanup(); |
| 1668 | 1576 | |
| ... | ... | @@ -1678,8 +1586,6 @@ test "chown" { |
| 1678 | 1586 | } |
| 1679 | 1587 | |
| 1680 | 1588 | test "File.Metadata" { |
| 1681 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1682 | ||
| 1683 | 1589 | var tmp = tmpDir(.{}); |
| 1684 | 1590 | defer tmp.cleanup(); |
| 1685 | 1591 | |
| ... | ... | @@ -1763,8 +1669,6 @@ test "delete a read-only file on windows" { |
| 1763 | 1669 | if (builtin.os.tag != .windows) |
| 1764 | 1670 | return error.SkipZigTest; |
| 1765 | 1671 | |
| 1766 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1767 | ||
| 1768 | 1672 | var tmp = testing.tmpDir(.{}); |
| 1769 | 1673 | defer tmp.cleanup(); |
| 1770 | 1674 | |
| ... | ... | @@ -1795,8 +1699,6 @@ test "delete a read-only file on windows" { |
| 1795 | 1699 | test "delete a setAsCwd directory on Windows" { |
| 1796 | 1700 | if (builtin.os.tag != .windows) return error.SkipZigTest; |
| 1797 | 1701 | |
| 1798 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1799 | ||
| 1800 | 1702 | var tmp = tmpDir(.{}); |
| 1801 | 1703 | // Set tmp dir as current working directory. |
| 1802 | 1704 | try tmp.dir.setAsCwd(); |
lib/std/hash/xxhash.zig-12| ... | ... | @@ -862,8 +862,6 @@ test "xxhash3 iterative api" { |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | 864 | test "xxhash64" { |
| 865 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 866 | ||
| 867 | 865 | const H = XxHash64; |
| 868 | 866 | try testExpect(H, 0, "", 0xef46db3751d8e999); |
| 869 | 867 | try testExpect(H, 0, "a", 0xd24ec4f1a98c6e5b); |
| ... | ... | @@ -875,8 +873,6 @@ test "xxhash64" { |
| 875 | 873 | } |
| 876 | 874 | |
| 877 | 875 | test "xxhash64 smhasher" { |
| 878 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 879 | ||
| 880 | 876 | const Test = struct { |
| 881 | 877 | fn do() !void { |
| 882 | 878 | try expectEqual(verify.smhasher(XxHash64.hash), 0x024B7CF4); |
| ... | ... | @@ -888,8 +884,6 @@ test "xxhash64 smhasher" { |
| 888 | 884 | } |
| 889 | 885 | |
| 890 | 886 | test "xxhash64 iterative api" { |
| 891 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 892 | ||
| 893 | 887 | const Test = struct { |
| 894 | 888 | fn do() !void { |
| 895 | 889 | try verify.iterativeApi(XxHash64); |
| ... | ... | @@ -901,8 +895,6 @@ test "xxhash64 iterative api" { |
| 901 | 895 | } |
| 902 | 896 | |
| 903 | 897 | test "xxhash32" { |
| 904 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 905 | ||
| 906 | 898 | const H = XxHash32; |
| 907 | 899 | |
| 908 | 900 | try testExpect(H, 0, "", 0x02cc5d05); |
| ... | ... | @@ -915,8 +907,6 @@ test "xxhash32" { |
| 915 | 907 | } |
| 916 | 908 | |
| 917 | 909 | test "xxhash32 smhasher" { |
| 918 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 919 | ||
| 920 | 910 | const Test = struct { |
| 921 | 911 | fn do() !void { |
| 922 | 912 | try expectEqual(verify.smhasher(XxHash32.hash), 0xBA88B743); |
| ... | ... | @@ -928,8 +918,6 @@ test "xxhash32 smhasher" { |
| 928 | 918 | } |
| 929 | 919 | |
| 930 | 920 | test "xxhash32 iterative api" { |
| 931 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 932 | ||
| 933 | 921 | const Test = struct { |
| 934 | 922 | fn do() !void { |
| 935 | 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 | 1873 | } |
| 1874 | 1874 | |
| 1875 | 1875 | test "std.hash_map put and remove loop in random order" { |
| 1876 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1877 | ||
| 1878 | 1876 | var map = AutoHashMap(u32, u32).init(std.testing.allocator); |
| 1879 | 1877 | defer map.deinit(); |
| 1880 | 1878 |
lib/std/heap/general_purpose_allocator.zig-4| ... | ... | @@ -1042,8 +1042,6 @@ const TraceKind = enum { |
| 1042 | 1042 | const test_config = Config{}; |
| 1043 | 1043 | |
| 1044 | 1044 | test "small allocations - free in same order" { |
| 1045 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1046 | ||
| 1047 | 1045 | var gpa = GeneralPurposeAllocator(test_config){}; |
| 1048 | 1046 | defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); |
| 1049 | 1047 | const allocator = gpa.allocator(); |
| ... | ... | @@ -1063,8 +1061,6 @@ test "small allocations - free in same order" { |
| 1063 | 1061 | } |
| 1064 | 1062 | |
| 1065 | 1063 | test "small allocations - free in reverse order" { |
| 1066 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1067 | ||
| 1068 | 1064 | var gpa = GeneralPurposeAllocator(test_config){}; |
| 1069 | 1065 | defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); |
| 1070 | 1066 | const allocator = gpa.allocator(); |
lib/std/http/Client.zig-2| ... | ... | @@ -491,8 +491,6 @@ pub const Response = struct { |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | test parseInt3 { |
| 494 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 495 | ||
| 496 | 494 | const expectEqual = testing.expectEqual; |
| 497 | 495 | try expectEqual(@as(u10, 0), parseInt3("000".*)); |
| 498 | 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 | 36 | const testing = std.testing; |
| 37 | 37 | |
| 38 | 38 | test "MultiWriter" { |
| 39 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 40 | 39 | var tmp = testing.tmpDir(.{}); |
| 41 | 40 | defer tmp.cleanup(); |
| 42 | 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 | 15 | const tmpDir = std.testing.tmpDir; |
| 16 | 16 | |
| 17 | 17 | test "write a file, read it, then delete it" { |
| 18 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 19 | ||
| 20 | 18 | var tmp = tmpDir(.{}); |
| 21 | 19 | defer tmp.cleanup(); |
| 22 | 20 | |
| ... | ... | @@ -110,8 +108,6 @@ test "BitStreams with File Stream" { |
| 110 | 108 | } |
| 111 | 109 | |
| 112 | 110 | test "File seek ops" { |
| 113 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 114 | ||
| 115 | 111 | var tmp = tmpDir(.{}); |
| 116 | 112 | defer tmp.cleanup(); |
| 117 | 113 | |
| ... | ... | @@ -139,8 +135,6 @@ test "File seek ops" { |
| 139 | 135 | } |
| 140 | 136 | |
| 141 | 137 | test "setEndPos" { |
| 142 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 143 | ||
| 144 | 138 | var tmp = tmpDir(.{}); |
| 145 | 139 | defer tmp.cleanup(); |
| 146 | 140 |
lib/std/json.zig-4| ... | ... | @@ -38,8 +38,6 @@ test parseFromSlice { |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | test Value { |
| 41 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 42 | ||
| 43 | 41 | var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{}); |
| 44 | 42 | defer parsed.deinit(); |
| 45 | 43 | try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string); |
| ... | ... | @@ -65,8 +63,6 @@ test writeStream { |
| 65 | 63 | } |
| 66 | 64 | |
| 67 | 65 | test stringify { |
| 68 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 69 | ||
| 70 | 66 | var out = ArrayList(u8).init(testing.allocator); |
| 71 | 67 | defer out.deinit(); |
| 72 | 68 |
lib/std/json/JSONTestSuite_test.zig-66| ... | ... | @@ -104,8 +104,6 @@ test "i_string_utf16LE_no_BOM.json" { |
| 104 | 104 | try any("[\x00\"\x00\xe9\x00\"\x00]\x00"); |
| 105 | 105 | } |
| 106 | 106 | test "i_structure_500_nested_arrays.json" { |
| 107 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 108 | ||
| 109 | 107 | try any("[" ** 500 ++ "]" ** 500); |
| 110 | 108 | } |
| 111 | 109 | test "i_structure_UTF-8_BOM_empty_object.json" { |
| ... | ... | @@ -361,21 +359,15 @@ test "n_object_bracket_key.json" { |
| 361 | 359 | try err("{[: \"x\"}\n"); |
| 362 | 360 | } |
| 363 | 361 | test "n_object_comma_instead_of_colon.json" { |
| 364 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 365 | ||
| 366 | 362 | try err("{\"x\", null}"); |
| 367 | 363 | } |
| 368 | 364 | test "n_object_double_colon.json" { |
| 369 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 370 | ||
| 371 | 365 | try err("{\"x\"::\"b\"}"); |
| 372 | 366 | } |
| 373 | 367 | test "n_object_emoji.json" { |
| 374 | 368 | try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}"); |
| 375 | 369 | } |
| 376 | 370 | test "n_object_garbage_at_end.json" { |
| 377 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 378 | ||
| 379 | 371 | try err("{\"a\":\"a\" 123}"); |
| 380 | 372 | } |
| 381 | 373 | test "n_object_key_with_single_quotes.json" { |
| ... | ... | @@ -385,26 +377,18 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" { |
| 385 | 377 | try err("{\"\xb9\":\"0\",}"); |
| 386 | 378 | } |
| 387 | 379 | test "n_object_missing_colon.json" { |
| 388 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 389 | ||
| 390 | 380 | try err("{\"a\" b}"); |
| 391 | 381 | } |
| 392 | 382 | test "n_object_missing_key.json" { |
| 393 | 383 | try err("{:\"b\"}"); |
| 394 | 384 | } |
| 395 | 385 | test "n_object_missing_semicolon.json" { |
| 396 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 397 | ||
| 398 | 386 | try err("{\"a\" \"b\"}"); |
| 399 | 387 | } |
| 400 | 388 | test "n_object_missing_value.json" { |
| 401 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 402 | ||
| 403 | 389 | try err("{\"a\":"); |
| 404 | 390 | } |
| 405 | 391 | test "n_object_no-colon.json" { |
| 406 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 407 | ||
| 408 | 392 | try err("{\"a\""); |
| 409 | 393 | } |
| 410 | 394 | test "n_object_non_string_key.json" { |
| ... | ... | @@ -417,59 +401,39 @@ test "n_object_repeated_null_null.json" { |
| 417 | 401 | try err("{null:null,null:null}"); |
| 418 | 402 | } |
| 419 | 403 | test "n_object_several_trailing_commas.json" { |
| 420 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 421 | ||
| 422 | 404 | try err("{\"id\":0,,,,,}"); |
| 423 | 405 | } |
| 424 | 406 | test "n_object_single_quote.json" { |
| 425 | 407 | try err("{'a':0}"); |
| 426 | 408 | } |
| 427 | 409 | test "n_object_trailing_comma.json" { |
| 428 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 429 | ||
| 430 | 410 | try err("{\"id\":0,}"); |
| 431 | 411 | } |
| 432 | 412 | test "n_object_trailing_comment.json" { |
| 433 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 434 | ||
| 435 | 413 | try err("{\"a\":\"b\"}/**/"); |
| 436 | 414 | } |
| 437 | 415 | test "n_object_trailing_comment_open.json" { |
| 438 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 439 | ||
| 440 | 416 | try err("{\"a\":\"b\"}/**//"); |
| 441 | 417 | } |
| 442 | 418 | test "n_object_trailing_comment_slash_open.json" { |
| 443 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 444 | ||
| 445 | 419 | try err("{\"a\":\"b\"}//"); |
| 446 | 420 | } |
| 447 | 421 | test "n_object_trailing_comment_slash_open_incomplete.json" { |
| 448 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 449 | ||
| 450 | 422 | try err("{\"a\":\"b\"}/"); |
| 451 | 423 | } |
| 452 | 424 | test "n_object_two_commas_in_a_row.json" { |
| 453 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 454 | ||
| 455 | 425 | try err("{\"a\":\"b\",,\"c\":\"d\"}"); |
| 456 | 426 | } |
| 457 | 427 | test "n_object_unquoted_key.json" { |
| 458 | 428 | try err("{a: \"b\"}"); |
| 459 | 429 | } |
| 460 | 430 | test "n_object_unterminated-value.json" { |
| 461 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 462 | ||
| 463 | 431 | try err("{\"a\":\"a"); |
| 464 | 432 | } |
| 465 | 433 | test "n_object_with_single_string.json" { |
| 466 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 467 | ||
| 468 | 434 | try err("{ \"foo\" : \"bar\", \"a\" }"); |
| 469 | 435 | } |
| 470 | 436 | test "n_object_with_trailing_garbage.json" { |
| 471 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 472 | ||
| 473 | 437 | try err("{\"a\":\"b\"}#"); |
| 474 | 438 | } |
| 475 | 439 | test "n_single_space.json" { |
| ... | ... | @@ -596,8 +560,6 @@ test "n_structure_close_unopened_array.json" { |
| 596 | 560 | try err("1]"); |
| 597 | 561 | } |
| 598 | 562 | test "n_structure_comma_instead_of_closing_brace.json" { |
| 599 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 600 | ||
| 601 | 563 | try err("{\"x\": true,"); |
| 602 | 564 | } |
| 603 | 565 | test "n_structure_double_array.json" { |
| ... | ... | @@ -628,18 +590,12 @@ test "n_structure_object_followed_by_closing_object.json" { |
| 628 | 590 | try err("{}}"); |
| 629 | 591 | } |
| 630 | 592 | test "n_structure_object_unclosed_no_value.json" { |
| 631 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 632 | ||
| 633 | 593 | try err("{\"\":"); |
| 634 | 594 | } |
| 635 | 595 | test "n_structure_object_with_comment.json" { |
| 636 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 637 | ||
| 638 | 596 | try err("{\"a\":/*comment*/\"b\"}"); |
| 639 | 597 | } |
| 640 | 598 | test "n_structure_object_with_trailing_garbage.json" { |
| 641 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 642 | ||
| 643 | 599 | try err("{\"a\": true} \"x\""); |
| 644 | 600 | } |
| 645 | 601 | test "n_structure_open_array_apostrophe.json" { |
| ... | ... | @@ -649,8 +605,6 @@ test "n_structure_open_array_comma.json" { |
| 649 | 605 | try err("[,"); |
| 650 | 606 | } |
| 651 | 607 | test "n_structure_open_array_object.json" { |
| 652 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 653 | ||
| 654 | 608 | try err("[{\"\":" ** 50000 ++ "\n"); |
| 655 | 609 | } |
| 656 | 610 | test "n_structure_open_array_open_object.json" { |
| ... | ... | @@ -690,8 +644,6 @@ test "n_structure_single_star.json" { |
| 690 | 644 | try err("*"); |
| 691 | 645 | } |
| 692 | 646 | test "n_structure_trailing_#.json" { |
| 693 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 694 | ||
| 695 | 647 | try err("{\"a\":\"b\"}#{}"); |
| 696 | 648 | } |
| 697 | 649 | test "n_structure_uescaped_LF_before_string.json" { |
| ... | ... | @@ -710,8 +662,6 @@ test "n_structure_unclosed_array_unfinished_true.json" { |
| 710 | 662 | try err("[ false, tru"); |
| 711 | 663 | } |
| 712 | 664 | test "n_structure_unclosed_object.json" { |
| 713 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 714 | ||
| 715 | 665 | try err("{\"asd\":\"asd\""); |
| 716 | 666 | } |
| 717 | 667 | test "n_structure_unicode-identifier.json" { |
| ... | ... | @@ -819,31 +769,21 @@ test "y_object.json" { |
| 819 | 769 | try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}"); |
| 820 | 770 | } |
| 821 | 771 | test "y_object_basic.json" { |
| 822 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 823 | ||
| 824 | 772 | try ok("{\"asd\":\"sdf\"}"); |
| 825 | 773 | } |
| 826 | 774 | test "y_object_duplicated_key.json" { |
| 827 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 828 | ||
| 829 | 775 | try ok("{\"a\":\"b\",\"a\":\"c\"}"); |
| 830 | 776 | } |
| 831 | 777 | test "y_object_duplicated_key_and_value.json" { |
| 832 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 833 | ||
| 834 | 778 | try ok("{\"a\":\"b\",\"a\":\"b\"}"); |
| 835 | 779 | } |
| 836 | 780 | test "y_object_empty.json" { |
| 837 | 781 | try ok("{}"); |
| 838 | 782 | } |
| 839 | 783 | test "y_object_empty_key.json" { |
| 840 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 841 | ||
| 842 | 784 | try ok("{\"\":0}"); |
| 843 | 785 | } |
| 844 | 786 | test "y_object_escaped_null_in_key.json" { |
| 845 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 846 | ||
| 847 | 787 | try ok("{\"foo\\u0000bar\": 42}"); |
| 848 | 788 | } |
| 849 | 789 | test "y_object_extreme_numbers.json" { |
| ... | ... | @@ -857,18 +797,12 @@ test "y_object_long_strings.json" { |
| 857 | 797 | try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}"); |
| 858 | 798 | } |
| 859 | 799 | test "y_object_simple.json" { |
| 860 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 861 | ||
| 862 | 800 | try ok("{\"a\":[]}"); |
| 863 | 801 | } |
| 864 | 802 | test "y_object_string_unicode.json" { |
| 865 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 866 | ||
| 867 | 803 | try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }"); |
| 868 | 804 | } |
| 869 | 805 | test "y_object_with_newlines.json" { |
| 870 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 871 | ||
| 872 | 806 | try ok("{\n\"a\": \"b\"\n}"); |
| 873 | 807 | } |
| 874 | 808 | test "y_string_1_2_3_bytes_UTF-8_sequences.json" { |
lib/std/json/dynamic_test.zig-12| ... | ... | @@ -125,16 +125,12 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value { |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | test "parsing empty string gives appropriate error" { |
| 128 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 129 | ||
| 130 | 128 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 131 | 129 | defer arena_allocator.deinit(); |
| 132 | 130 | try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), "")); |
| 133 | 131 | } |
| 134 | 132 | |
| 135 | 133 | test "Value.array allocator should still be usable after parsing" { |
| 136 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 137 | ||
| 138 | 134 | var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{}); |
| 139 | 135 | defer parsed.deinit(); |
| 140 | 136 | |
| ... | ... | @@ -195,8 +191,6 @@ test "escaped characters" { |
| 195 | 191 | } |
| 196 | 192 | |
| 197 | 193 | test "Value.jsonStringify" { |
| 198 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 199 | ||
| 200 | 194 | var vals = [_]Value{ |
| 201 | 195 | .{ .integer = 1 }, |
| 202 | 196 | .{ .integer = 2 }, |
| ... | ... | @@ -263,8 +257,6 @@ test "parseFromValue(std.json.Value,...)" { |
| 263 | 257 | } |
| 264 | 258 | |
| 265 | 259 | test "polymorphic parsing" { |
| 266 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 267 | ||
| 268 | 260 | if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108 |
| 269 | 261 | const doc = |
| 270 | 262 | \\{ "type": "div", |
| ... | ... | @@ -310,8 +302,6 @@ test "polymorphic parsing" { |
| 310 | 302 | } |
| 311 | 303 | |
| 312 | 304 | test "long object value" { |
| 313 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 314 | ||
| 315 | 305 | const value = "01234567890123456789"; |
| 316 | 306 | const doc = "{\"key\":\"" ++ value ++ "\"}"; |
| 317 | 307 | var fbs = std.io.fixedBufferStream(doc); |
| ... | ... | @@ -324,8 +314,6 @@ test "long object value" { |
| 324 | 314 | } |
| 325 | 315 | |
| 326 | 316 | test "ParseOptions.max_value_len" { |
| 327 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 328 | ||
| 329 | 317 | var arena = ArenaAllocator.init(testing.allocator); |
| 330 | 318 | defer arena.deinit(); |
| 331 | 319 |
lib/std/json/static_test.zig-6| ... | ... | @@ -392,8 +392,6 @@ test "parse" { |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | test "parse into enum" { |
| 395 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 396 | ||
| 397 | 395 | const T = enum(u32) { |
| 398 | 396 | Foo = 42, |
| 399 | 397 | Bar, |
| ... | ... | @@ -478,8 +476,6 @@ test "parse into tagged union errors" { |
| 478 | 476 | } |
| 479 | 477 | |
| 480 | 478 | test "parse into struct with no fields" { |
| 481 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 482 | ||
| 483 | 479 | const T = struct {}; |
| 484 | 480 | const parsed = try parseFromSlice(T, testing.allocator, "{}", .{}); |
| 485 | 481 | defer parsed.deinit(); |
| ... | ... | @@ -949,8 +945,6 @@ test "json parse allocate when streaming" { |
| 949 | 945 | } |
| 950 | 946 | |
| 951 | 947 | test "parse at comptime" { |
| 952 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 953 | ||
| 954 | 948 | const doc = |
| 955 | 949 | \\{ |
| 956 | 950 | \\ "vals": { |
lib/std/json/stringify_test.zig-36| ... | ... | @@ -100,8 +100,6 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value { |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | test "stringify null optional fields" { |
| 103 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 104 | ||
| 105 | 103 | const MyStruct = struct { |
| 106 | 104 | optional: ?[]const u8 = null, |
| 107 | 105 | required: []const u8 = "something", |
| ... | ... | @@ -123,8 +121,6 @@ test "stringify null optional fields" { |
| 123 | 121 | } |
| 124 | 122 | |
| 125 | 123 | test "stringify basic types" { |
| 126 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 127 | ||
| 128 | 124 | try testStringify("false", false, .{}); |
| 129 | 125 | try testStringify("true", true, .{}); |
| 130 | 126 | try testStringify("null", @as(?u8, null), .{}); |
| ... | ... | @@ -141,8 +137,6 @@ test "stringify basic types" { |
| 141 | 137 | } |
| 142 | 138 | |
| 143 | 139 | test "stringify string" { |
| 144 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 145 | ||
| 146 | 140 | try testStringify("\"hello\"", "hello", .{}); |
| 147 | 141 | try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{}); |
| 148 | 142 | try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true }); |
| ... | ... | @@ -167,16 +161,12 @@ test "stringify string" { |
| 167 | 161 | } |
| 168 | 162 | |
| 169 | 163 | test "stringify many-item sentinel-terminated string" { |
| 170 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 171 | ||
| 172 | 164 | try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{}); |
| 173 | 165 | try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true }); |
| 174 | 166 | try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true }); |
| 175 | 167 | } |
| 176 | 168 | |
| 177 | 169 | test "stringify enums" { |
| 178 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 179 | ||
| 180 | 170 | const E = enum { |
| 181 | 171 | foo, |
| 182 | 172 | bar, |
| ... | ... | @@ -186,15 +176,11 @@ test "stringify enums" { |
| 186 | 176 | } |
| 187 | 177 | |
| 188 | 178 | test "stringify enum literals" { |
| 189 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 190 | ||
| 191 | 179 | try testStringify("\"foo\"", .foo, .{}); |
| 192 | 180 | try testStringify("\"bar\"", .bar, .{}); |
| 193 | 181 | } |
| 194 | 182 | |
| 195 | 183 | test "stringify tagged unions" { |
| 196 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 197 | ||
| 198 | 184 | const T = union(enum) { |
| 199 | 185 | nothing, |
| 200 | 186 | foo: u32, |
| ... | ... | @@ -206,8 +192,6 @@ test "stringify tagged unions" { |
| 206 | 192 | } |
| 207 | 193 | |
| 208 | 194 | test "stringify struct" { |
| 209 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 210 | ||
| 211 | 195 | try testStringify("{\"foo\":42}", struct { |
| 212 | 196 | foo: u32, |
| 213 | 197 | }{ .foo = 42 }, .{}); |
| ... | ... | @@ -230,8 +214,6 @@ test "emit_strings_as_arrays" { |
| 230 | 214 | } |
| 231 | 215 | |
| 232 | 216 | test "stringify struct with indentation" { |
| 233 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 234 | ||
| 235 | 217 | try testStringify( |
| 236 | 218 | \\{ |
| 237 | 219 | \\ "foo": 42, |
| ... | ... | @@ -277,8 +259,6 @@ test "stringify struct with indentation" { |
| 277 | 259 | } |
| 278 | 260 | |
| 279 | 261 | test "stringify struct with void field" { |
| 280 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 281 | ||
| 282 | 262 | try testStringify("{\"foo\":42}", struct { |
| 283 | 263 | foo: u32, |
| 284 | 264 | bar: void = {}, |
| ... | ... | @@ -286,8 +266,6 @@ test "stringify struct with void field" { |
| 286 | 266 | } |
| 287 | 267 | |
| 288 | 268 | test "stringify array of structs" { |
| 289 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 290 | ||
| 291 | 269 | const MyStruct = struct { |
| 292 | 270 | foo: u32, |
| 293 | 271 | }; |
| ... | ... | @@ -299,8 +277,6 @@ test "stringify array of structs" { |
| 299 | 277 | } |
| 300 | 278 | |
| 301 | 279 | test "stringify struct with custom stringifier" { |
| 302 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 303 | ||
| 304 | 280 | try testStringify("[\"something special\",42]", struct { |
| 305 | 281 | foo: u32, |
| 306 | 282 | const Self = @This(); |
| ... | ... | @@ -315,16 +291,12 @@ test "stringify struct with custom stringifier" { |
| 315 | 291 | } |
| 316 | 292 | |
| 317 | 293 | test "stringify vector" { |
| 318 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 319 | ||
| 320 | 294 | try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{}); |
| 321 | 295 | try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{}); |
| 322 | 296 | try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true }); |
| 323 | 297 | } |
| 324 | 298 | |
| 325 | 299 | test "stringify tuple" { |
| 326 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 327 | ||
| 328 | 300 | try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{}); |
| 329 | 301 | } |
| 330 | 302 | |
| ... | ... | @@ -411,8 +383,6 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St |
| 411 | 383 | } |
| 412 | 384 | |
| 413 | 385 | test "stringify alloc" { |
| 414 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 415 | ||
| 416 | 386 | const allocator = std.testing.allocator; |
| 417 | 387 | const expected = |
| 418 | 388 | \\{"foo":"bar","answer":42,"my_friend":"sammy"} |
| ... | ... | @@ -424,8 +394,6 @@ test "stringify alloc" { |
| 424 | 394 | } |
| 425 | 395 | |
| 426 | 396 | test "comptime stringify" { |
| 427 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 428 | ||
| 429 | 397 | comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable; |
| 430 | 398 | comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable; |
| 431 | 399 | comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable; |
| ... | ... | @@ -446,8 +414,6 @@ test "comptime stringify" { |
| 446 | 414 | } |
| 447 | 415 | |
| 448 | 416 | test "print" { |
| 449 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 450 | ||
| 451 | 417 | var out_buf: [1024]u8 = undefined; |
| 452 | 418 | var slice_stream = std.io.fixedBufferStream(&out_buf); |
| 453 | 419 | const out = slice_stream.writer(); |
| ... | ... | @@ -479,8 +445,6 @@ test "print" { |
| 479 | 445 | } |
| 480 | 446 | |
| 481 | 447 | test "nonportable numbers" { |
| 482 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 483 | ||
| 484 | 448 | try testStringify("9999999999999999", 9999999999999999, .{}); |
| 485 | 449 | try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true }); |
| 486 | 450 | } |
lib/std/json/test.zig+1-4| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const testing = std.testing; |
| 4 | 3 | const parseFromSlice = @import("./static.zig").parseFromSlice; |
| 5 | 4 | const validate = @import("./scanner.zig").validate; |
| ... | ... | @@ -35,15 +34,13 @@ fn testHighLevelDynamicParser(s: []const u8) !void { |
| 35 | 34 | |
| 36 | 35 | // Additional tests not part of test JSONTestSuite. |
| 37 | 36 | test "y_trailing_comma_after_empty" { |
| 38 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 37 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 39 | 38 | |
| 40 | 39 | try roundTrip( |
| 41 | 40 | \\{"1":[],"2":{},"3":"4"} |
| 42 | 41 | ); |
| 43 | 42 | } |
| 44 | 43 | test "n_object_closed_missing_value" { |
| 45 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 46 | ||
| 47 | 44 | try err( |
| 48 | 45 | \\{"a":} |
| 49 | 46 | ); |
lib/std/math.zig+2-2| ... | ... | @@ -903,12 +903,12 @@ pub fn mod(comptime T: type, numerator: T, denominator: T) !T { |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | test "mod" { |
| 906 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 907 | ||
| 906 | 908 | try testMod(); |
| 907 | 909 | try comptime testMod(); |
| 908 | 910 | } |
| 909 | 911 | fn testMod() !void { |
| 910 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 911 | ||
| 912 | 912 | try testing.expect((mod(i32, -5, 3) catch unreachable) == 1); |
| 913 | 913 | try testing.expect((mod(i32, 5, 3) catch unreachable) == 2); |
| 914 | 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 | 71 | } |
| 72 | 72 | |
| 73 | 73 | test "big.int set double-width maximum then zero" { |
| 74 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 75 | ||
| 76 | 74 | var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb)); |
| 77 | 75 | defer a.deinit(); |
| 78 | 76 | try a.set(@as(DoubleLimb, 0)); |
| ... | ... | @@ -246,8 +244,6 @@ test "big.int fits" { |
| 246 | 244 | } |
| 247 | 245 | |
| 248 | 246 | test "big.int string set" { |
| 249 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 250 | ||
| 251 | 247 | var a = try Managed.init(testing.allocator); |
| 252 | 248 | defer a.deinit(); |
| 253 | 249 | |
| ... | ... | @@ -264,8 +260,6 @@ test "big.int string negative" { |
| 264 | 260 | } |
| 265 | 261 | |
| 266 | 262 | test "big.int string set number with underscores" { |
| 267 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 268 | ||
| 269 | 263 | var a = try Managed.init(testing.allocator); |
| 270 | 264 | defer a.deinit(); |
| 271 | 265 | |
| ... | ... | @@ -274,8 +268,6 @@ test "big.int string set number with underscores" { |
| 274 | 268 | } |
| 275 | 269 | |
| 276 | 270 | test "big.int string set case insensitive number" { |
| 277 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 278 | ||
| 279 | 271 | var a = try Managed.init(testing.allocator); |
| 280 | 272 | defer a.deinit(); |
| 281 | 273 | |
| ... | ... | @@ -326,8 +318,6 @@ test "big.int twos complement limit set" { |
| 326 | 318 | } |
| 327 | 319 | |
| 328 | 320 | test "big.int string to" { |
| 329 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 330 | ||
| 331 | 321 | var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124); |
| 332 | 322 | defer a.deinit(); |
| 333 | 323 | |
| ... | ... | @@ -368,8 +358,6 @@ test "big.int string to base 16" { |
| 368 | 358 | } |
| 369 | 359 | |
| 370 | 360 | test "big.int neg string to" { |
| 371 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 372 | ||
| 373 | 361 | var a = try Managed.initSet(testing.allocator, -123907434); |
| 374 | 362 | defer a.deinit(); |
| 375 | 363 | |
| ... | ... | @@ -392,8 +380,6 @@ test "big.int zero string to" { |
| 392 | 380 | } |
| 393 | 381 | |
| 394 | 382 | test "big.int clone" { |
| 395 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 396 | ||
| 397 | 383 | var a = try Managed.initSet(testing.allocator, 1234); |
| 398 | 384 | defer a.deinit(); |
| 399 | 385 | var b = try a.clone(); |
| ... | ... | @@ -634,8 +620,6 @@ test "big.int addWrap single-single, unsigned" { |
| 634 | 620 | } |
| 635 | 621 | |
| 636 | 622 | test "big.int subWrap single-single, unsigned" { |
| 637 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 638 | ||
| 639 | 623 | var a = try Managed.initSet(testing.allocator, 0); |
| 640 | 624 | defer a.deinit(); |
| 641 | 625 | |
| ... | ... | @@ -963,8 +947,6 @@ test "big.int mul multi-multi" { |
| 963 | 947 | } |
| 964 | 948 | |
| 965 | 949 | test "big.int mul alias r with a" { |
| 966 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 967 | ||
| 968 | 950 | var a = try Managed.initSet(testing.allocator, maxInt(Limb)); |
| 969 | 951 | defer a.deinit(); |
| 970 | 952 | var b = try Managed.initSet(testing.allocator, 2); |
| ... | ... | @@ -976,8 +958,6 @@ test "big.int mul alias r with a" { |
| 976 | 958 | } |
| 977 | 959 | |
| 978 | 960 | test "big.int mul alias r with b" { |
| 979 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 980 | ||
| 981 | 961 | var a = try Managed.initSet(testing.allocator, maxInt(Limb)); |
| 982 | 962 | defer a.deinit(); |
| 983 | 963 | var b = try Managed.initSet(testing.allocator, 2); |
| ... | ... | @@ -989,8 +969,6 @@ test "big.int mul alias r with b" { |
| 989 | 969 | } |
| 990 | 970 | |
| 991 | 971 | test "big.int mul alias r with a and b" { |
| 992 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 993 | ||
| 994 | 972 | var a = try Managed.initSet(testing.allocator, maxInt(Limb)); |
| 995 | 973 | defer a.deinit(); |
| 996 | 974 | |
| ... | ... | @@ -1096,7 +1074,7 @@ test "big.int mulWrap multi-multi unsigned" { |
| 1096 | 1074 | |
| 1097 | 1075 | test "big.int mulWrap multi-multi signed" { |
| 1098 | 1076 | switch (builtin.zig_backend) { |
| 1099 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1077 | .stage2_c => return error.SkipZigTest, | |
| 1100 | 1078 | else => {}, |
| 1101 | 1079 | } |
| 1102 | 1080 | |
| ... | ... | @@ -1171,8 +1149,6 @@ test "big.int div single-half with rem" { |
| 1171 | 1149 | } |
| 1172 | 1150 | |
| 1173 | 1151 | test "big.int div single-single no rem" { |
| 1174 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1175 | ||
| 1176 | 1152 | // assumes usize is <= 64 bits. |
| 1177 | 1153 | var a = try Managed.initSet(testing.allocator, 1 << 52); |
| 1178 | 1154 | defer a.deinit(); |
| ... | ... | @@ -1190,8 +1166,6 @@ test "big.int div single-single no rem" { |
| 1190 | 1166 | } |
| 1191 | 1167 | |
| 1192 | 1168 | test "big.int div single-single with rem" { |
| 1193 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1194 | ||
| 1195 | 1169 | var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33)); |
| 1196 | 1170 | defer a.deinit(); |
| 1197 | 1171 | var b = try Managed.initSet(testing.allocator, (1 << 35)); |
| ... | ... | @@ -1271,8 +1245,6 @@ test "big.int div multi>2-single" { |
| 1271 | 1245 | } |
| 1272 | 1246 | |
| 1273 | 1247 | test "big.int div single-single q < r" { |
| 1274 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1275 | ||
| 1276 | 1248 | var a = try Managed.initSet(testing.allocator, 0x0078f432); |
| 1277 | 1249 | defer a.deinit(); |
| 1278 | 1250 | var b = try Managed.initSet(testing.allocator, 0x01000000); |
| ... | ... | @@ -1317,10 +1289,7 @@ test "big.int div q=0 alias" { |
| 1317 | 1289 | } |
| 1318 | 1290 | |
| 1319 | 1291 | test "big.int div multi-multi q < r" { |
| 1320 | switch (builtin.zig_backend) { | |
| 1321 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1322 | else => {}, | |
| 1323 | } | |
| 1292 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1324 | 1293 | |
| 1325 | 1294 | const op1 = 0x1ffffffff0078f432; |
| 1326 | 1295 | const op2 = 0x1ffffffff01000000; |
| ... | ... | @@ -1642,8 +1611,6 @@ test "big.int div floor single-single -/-" { |
| 1642 | 1611 | } |
| 1643 | 1612 | |
| 1644 | 1613 | test "big.int div floor no remainder negative quotient" { |
| 1645 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1646 | ||
| 1647 | 1614 | const u: i32 = -0x80000000; |
| 1648 | 1615 | const v: i32 = 1; |
| 1649 | 1616 | |
| ... | ... | @@ -1743,10 +1710,7 @@ test "big.int div multi-multi no rem" { |
| 1743 | 1710 | } |
| 1744 | 1711 | |
| 1745 | 1712 | test "big.int div multi-multi (2 branch)" { |
| 1746 | switch (builtin.zig_backend) { | |
| 1747 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1748 | else => {}, | |
| 1749 | } | |
| 1713 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1750 | 1714 | |
| 1751 | 1715 | var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111); |
| 1752 | 1716 | defer a.deinit(); |
| ... | ... | @@ -1785,10 +1749,7 @@ test "big.int div multi-multi (3.1/3.3 branch)" { |
| 1785 | 1749 | } |
| 1786 | 1750 | |
| 1787 | 1751 | test "big.int div multi-single zero-limb trailing" { |
| 1788 | switch (builtin.zig_backend) { | |
| 1789 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1790 | else => {}, | |
| 1791 | } | |
| 1752 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1792 | 1753 | |
| 1793 | 1754 | var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000); |
| 1794 | 1755 | defer a.deinit(); |
| ... | ... | @@ -1808,10 +1769,7 @@ test "big.int div multi-single zero-limb trailing" { |
| 1808 | 1769 | } |
| 1809 | 1770 | |
| 1810 | 1771 | test "big.int div multi-multi zero-limb trailing (with rem)" { |
| 1811 | switch (builtin.zig_backend) { | |
| 1812 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1813 | else => {}, | |
| 1814 | } | |
| 1772 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1815 | 1773 | |
| 1816 | 1774 | var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000); |
| 1817 | 1775 | defer a.deinit(); |
| ... | ... | @@ -1908,8 +1866,6 @@ test "big.int div multi-multi fuzz case #1" { |
| 1908 | 1866 | } |
| 1909 | 1867 | |
| 1910 | 1868 | test "big.int div multi-multi fuzz case #2" { |
| 1911 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1912 | ||
| 1913 | 1869 | var a = try Managed.init(testing.allocator); |
| 1914 | 1870 | defer a.deinit(); |
| 1915 | 1871 | var b = try Managed.init(testing.allocator); |
| ... | ... | @@ -2672,8 +2628,6 @@ test "big.int mutable to managed" { |
| 2672 | 2628 | } |
| 2673 | 2629 | |
| 2674 | 2630 | test "big.int const to managed" { |
| 2675 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2676 | ||
| 2677 | 2631 | var a = try Managed.initSet(testing.allocator, 123423453456); |
| 2678 | 2632 | defer a.deinit(); |
| 2679 | 2633 |
lib/std/math/big/rational.zig-6| ... | ... | @@ -494,8 +494,6 @@ fn extractLowBits(a: Int, comptime T: type) T { |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | test "big.rational extractLowBits" { |
| 497 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 498 | ||
| 499 | 497 | var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321); |
| 500 | 498 | defer a.deinit(); |
| 501 | 499 | |
| ... | ... | @@ -649,8 +647,6 @@ test "big.rational copy" { |
| 649 | 647 | } |
| 650 | 648 | |
| 651 | 649 | test "big.rational negate" { |
| 652 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 653 | ||
| 654 | 650 | var a = try Rational.init(testing.allocator); |
| 655 | 651 | defer a.deinit(); |
| 656 | 652 | |
| ... | ... | @@ -668,8 +664,6 @@ test "big.rational negate" { |
| 668 | 664 | } |
| 669 | 665 | |
| 670 | 666 | test "big.rational abs" { |
| 671 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 672 | ||
| 673 | 667 | var a = try Rational.init(testing.allocator); |
| 674 | 668 | defer a.deinit(); |
| 675 | 669 |
lib/std/math/ilogb.zig-6| ... | ... | @@ -125,8 +125,6 @@ test "80" { |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | test "128" { |
| 128 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 129 | ||
| 130 | 128 | try expect(ilogbX(f128, 0.0) == fp_ilogb0); |
| 131 | 129 | try expect(ilogbX(f128, 0.5) == -1); |
| 132 | 130 | try expect(ilogbX(f128, 0.8923) == -1); |
| ... | ... | @@ -162,8 +160,6 @@ test "64 special" { |
| 162 | 160 | } |
| 163 | 161 | |
| 164 | 162 | test "80 special" { |
| 165 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 166 | ||
| 167 | 163 | try expect(ilogbX(f80, math.inf(f80)) == maxInt(i32)); |
| 168 | 164 | try expect(ilogbX(f80, -math.inf(f80)) == maxInt(i32)); |
| 169 | 165 | try expect(ilogbX(f80, 0.0) == minInt(i32)); |
| ... | ... | @@ -171,8 +167,6 @@ test "80 special" { |
| 171 | 167 | } |
| 172 | 168 | |
| 173 | 169 | test "128 special" { |
| 174 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 175 | ||
| 176 | 170 | try expect(ilogbX(f128, math.inf(f128)) == maxInt(i32)); |
| 177 | 171 | try expect(ilogbX(f128, -math.inf(f128)) == maxInt(i32)); |
| 178 | 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 | 147 | test "log10_int vs old implementation" { |
| 148 | 148 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 149 | 149 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 150 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 151 | 150 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 152 | 151 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 153 | 152 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
lib/std/math/log_int.zig-2| ... | ... | @@ -56,8 +56,6 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) { |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | test "math.log_int" { |
| 59 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 60 | ||
| 61 | 59 | // Test all unsigned integers with 2, 3, ..., 64 bits. |
| 62 | 60 | // We cannot test 0 or 1 bits since base must be > 1. |
| 63 | 61 | inline for (2..64 + 1) |bits| { |
lib/std/math/nextafter.zig+1-2| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | 1 | const std = @import("../std.zig"); |
| 3 | 2 | const math = std.math; |
| 4 | 3 | const assert = std.debug.assert; |
| ... | ... | @@ -103,7 +102,7 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T { |
| 103 | 102 | } |
| 104 | 103 | |
| 105 | 104 | test "math.nextAfter.int" { |
| 106 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 105 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 107 | 106 | |
| 108 | 107 | try expect(nextAfter(i0, 0, 0) == 0); |
| 109 | 108 | try expect(nextAfter(u0, 0, 0) == 0); |
lib/std/math/scalbn.zig-2| ... | ... | @@ -7,8 +7,6 @@ const expect = std.testing.expect; |
| 7 | 7 | pub const scalbn = @import("ldexp.zig").ldexp; |
| 8 | 8 | |
| 9 | 9 | test "math.scalbn" { |
| 10 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 11 | ||
| 12 | 10 | // Verify we are using base 2. |
| 13 | 11 | try expect(scalbn(@as(f16, 1.5), 4) == 24.0); |
| 14 | 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 | 1741 | } |
| 1742 | 1742 | |
| 1743 | 1743 | test "comptime read/write int" { |
| 1744 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1745 | ||
| 1746 | 1744 | comptime { |
| 1747 | 1745 | var bytes: [2]u8 = undefined; |
| 1748 | 1746 | writeIntLittle(u16, &bytes, 0x1234); |
| ... | ... | @@ -2062,10 +2060,7 @@ pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value |
| 2062 | 2060 | } |
| 2063 | 2061 | |
| 2064 | 2062 | test "writeIntBig and writeIntLittle" { |
| 2065 | switch (builtin.zig_backend) { | |
| 2066 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 2067 | else => {}, | |
| 2068 | } | |
| 2063 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 2069 | 2064 | |
| 2070 | 2065 | var buf0: [0]u8 = undefined; |
| 2071 | 2066 | var buf1: [1]u8 = undefined; |
| ... | ... | @@ -3309,8 +3304,6 @@ test "testStringEquality" { |
| 3309 | 3304 | } |
| 3310 | 3305 | |
| 3311 | 3306 | test "testReadInt" { |
| 3312 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 3313 | ||
| 3314 | 3307 | try testReadIntImpl(); |
| 3315 | 3308 | try comptime testReadIntImpl(); |
| 3316 | 3309 | } |
| ... | ... | @@ -4668,6 +4661,7 @@ test "read/write(Var)PackedInt" { |
| 4668 | 4661 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, |
| 4669 | 4662 | else => {}, |
| 4670 | 4663 | } |
| 4664 | ||
| 4671 | 4665 | switch (builtin.cpu.arch) { |
| 4672 | 4666 | // This test generates too much code to execute on WASI. |
| 4673 | 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 | 583 | } |
| 584 | 584 | |
| 585 | 585 | test "basic usage" { |
| 586 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 587 | ||
| 588 | 586 | const ally = testing.allocator; |
| 589 | 587 | |
| 590 | 588 | const Foo = struct { |
| ... | ... | @@ -679,8 +677,6 @@ test "basic usage" { |
| 679 | 677 | // This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes |
| 680 | 678 | // function used the @reduce code path. |
| 681 | 679 | test "regression test for @reduce bug" { |
| 682 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 683 | ||
| 684 | 680 | const ally = testing.allocator; |
| 685 | 681 | var list = MultiArrayList(struct { |
| 686 | 682 | tag: std.zig.Token.Tag, |
| ... | ... | @@ -758,8 +754,6 @@ test "regression test for @reduce bug" { |
| 758 | 754 | } |
| 759 | 755 | |
| 760 | 756 | test "ensure capacity on empty list" { |
| 761 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 762 | ||
| 763 | 757 | const ally = testing.allocator; |
| 764 | 758 | |
| 765 | 759 | const Foo = struct { |
| ... | ... | @@ -795,8 +789,6 @@ test "ensure capacity on empty list" { |
| 795 | 789 | } |
| 796 | 790 | |
| 797 | 791 | test "insert elements" { |
| 798 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 799 | ||
| 800 | 792 | const ally = testing.allocator; |
| 801 | 793 | |
| 802 | 794 | const Foo = struct { |
| ... | ... | @@ -816,8 +808,6 @@ test "insert elements" { |
| 816 | 808 | } |
| 817 | 809 | |
| 818 | 810 | test "union" { |
| 819 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 820 | ||
| 821 | 811 | const ally = testing.allocator; |
| 822 | 812 | |
| 823 | 813 | const Foo = union(enum) { |
| ... | ... | @@ -873,8 +863,6 @@ test "union" { |
| 873 | 863 | } |
| 874 | 864 | |
| 875 | 865 | test "sorting a span" { |
| 876 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 877 | ||
| 878 | 866 | var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{}; |
| 879 | 867 | defer list.deinit(testing.allocator); |
| 880 | 868 | |
| ... | ... | @@ -915,8 +903,6 @@ test "sorting a span" { |
| 915 | 903 | } |
| 916 | 904 | |
| 917 | 905 | test "0 sized struct field" { |
| 918 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 919 | ||
| 920 | 906 | const ally = testing.allocator; |
| 921 | 907 | |
| 922 | 908 | const Foo = struct { |
| ... | ... | @@ -944,8 +930,6 @@ test "0 sized struct field" { |
| 944 | 930 | } |
| 945 | 931 | |
| 946 | 932 | test "0 sized struct" { |
| 947 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 948 | ||
| 949 | 933 | const ally = testing.allocator; |
| 950 | 934 | |
| 951 | 935 | const Foo = struct { |
lib/std/net/test.zig+1-4| ... | ... | @@ -109,9 +109,8 @@ test "parse and render UNIX addresses" { |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | test "resolve DNS" { |
| 112 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 113 | ||
| 114 | 112 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 113 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 115 | 114 | |
| 116 | 115 | if (builtin.os.tag == .windows) { |
| 117 | 116 | _ = try std.os.windows.WSAStartup(2, 2); |
| ... | ... | @@ -295,8 +294,6 @@ test "listen on a unix socket, send bytes, receive bytes" { |
| 295 | 294 | if (builtin.single_threaded) return error.SkipZigTest; |
| 296 | 295 | if (!net.has_unix_sockets) return error.SkipZigTest; |
| 297 | 296 | |
| 298 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 299 | ||
| 300 | 297 | if (builtin.os.tag == .windows) { |
| 301 | 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 | 1741 | test "writev/fsync/readv" { |
| 1742 | 1742 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 1743 | 1743 | |
| 1744 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1745 | ||
| 1746 | 1744 | var ring = IO_Uring.init(4, 0) catch |err| switch (err) { |
| 1747 | 1745 | error.SystemOutdated => return error.SkipZigTest, |
| 1748 | 1746 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -1813,8 +1811,6 @@ test "writev/fsync/readv" { |
| 1813 | 1811 | test "write/read" { |
| 1814 | 1812 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 1815 | 1813 | |
| 1816 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1817 | ||
| 1818 | 1814 | var ring = IO_Uring.init(2, 0) catch |err| switch (err) { |
| 1819 | 1815 | error.SystemOutdated => return error.SkipZigTest, |
| 1820 | 1816 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -1862,8 +1858,6 @@ test "write/read" { |
| 1862 | 1858 | test "splice/read" { |
| 1863 | 1859 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 1864 | 1860 | |
| 1865 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1866 | ||
| 1867 | 1861 | var ring = IO_Uring.init(4, 0) catch |err| switch (err) { |
| 1868 | 1862 | error.SystemOutdated => return error.SkipZigTest, |
| 1869 | 1863 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -1935,8 +1929,6 @@ test "splice/read" { |
| 1935 | 1929 | test "write_fixed/read_fixed" { |
| 1936 | 1930 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 1937 | 1931 | |
| 1938 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1939 | ||
| 1940 | 1932 | var ring = IO_Uring.init(2, 0) catch |err| switch (err) { |
| 1941 | 1933 | error.SystemOutdated => return error.SkipZigTest, |
| 1942 | 1934 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2002,8 +1994,6 @@ test "write_fixed/read_fixed" { |
| 2002 | 1994 | test "openat" { |
| 2003 | 1995 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2004 | 1996 | |
| 2005 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2006 | ||
| 2007 | 1997 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2008 | 1998 | error.SystemOutdated => return error.SkipZigTest, |
| 2009 | 1999 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2055,8 +2045,6 @@ test "openat" { |
| 2055 | 2045 | test "close" { |
| 2056 | 2046 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2057 | 2047 | |
| 2058 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2059 | ||
| 2060 | 2048 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2061 | 2049 | error.SystemOutdated => return error.SkipZigTest, |
| 2062 | 2050 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2392,8 +2380,6 @@ test "accept/connect/recv/link_timeout" { |
| 2392 | 2380 | test "fallocate" { |
| 2393 | 2381 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2394 | 2382 | |
| 2395 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2396 | ||
| 2397 | 2383 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2398 | 2384 | error.SystemOutdated => return error.SkipZigTest, |
| 2399 | 2385 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2440,8 +2426,6 @@ test "fallocate" { |
| 2440 | 2426 | test "statx" { |
| 2441 | 2427 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2442 | 2428 | |
| 2443 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2444 | ||
| 2445 | 2429 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2446 | 2430 | error.SystemOutdated => return error.SkipZigTest, |
| 2447 | 2431 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2698,8 +2682,6 @@ test "shutdown" { |
| 2698 | 2682 | test "renameat" { |
| 2699 | 2683 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2700 | 2684 | |
| 2701 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2702 | ||
| 2703 | 2685 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2704 | 2686 | error.SystemOutdated => return error.SkipZigTest, |
| 2705 | 2687 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2769,8 +2751,6 @@ test "renameat" { |
| 2769 | 2751 | test "unlinkat" { |
| 2770 | 2752 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2771 | 2753 | |
| 2772 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2773 | ||
| 2774 | 2754 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2775 | 2755 | error.SystemOutdated => return error.SkipZigTest, |
| 2776 | 2756 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2823,8 +2803,6 @@ test "unlinkat" { |
| 2823 | 2803 | test "mkdirat" { |
| 2824 | 2804 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2825 | 2805 | |
| 2826 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2827 | ||
| 2828 | 2806 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2829 | 2807 | error.SystemOutdated => return error.SkipZigTest, |
| 2830 | 2808 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2869,8 +2847,6 @@ test "mkdirat" { |
| 2869 | 2847 | test "symlinkat" { |
| 2870 | 2848 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2871 | 2849 | |
| 2872 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2873 | ||
| 2874 | 2850 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2875 | 2851 | error.SystemOutdated => return error.SkipZigTest, |
| 2876 | 2852 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2919,8 +2895,6 @@ test "symlinkat" { |
| 2919 | 2895 | test "linkat" { |
| 2920 | 2896 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2921 | 2897 | |
| 2922 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2923 | ||
| 2924 | 2898 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2925 | 2899 | error.SystemOutdated => return error.SkipZigTest, |
| 2926 | 2900 | error.PermissionDenied => return error.SkipZigTest, |
lib/std/os/linux/test.zig-6| ... | ... | @@ -8,8 +8,6 @@ const expectEqual = std.testing.expectEqual; |
| 8 | 8 | const fs = std.fs; |
| 9 | 9 | |
| 10 | 10 | test "fallocate" { |
| 11 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 12 | ||
| 13 | 11 | var tmp = std.testing.tmpDir(.{}); |
| 14 | 12 | defer tmp.cleanup(); |
| 15 | 13 | |
| ... | ... | @@ -71,8 +69,6 @@ test "timer" { |
| 71 | 69 | } |
| 72 | 70 | |
| 73 | 71 | test "statx" { |
| 74 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 75 | ||
| 76 | 72 | var tmp = std.testing.tmpDir(.{}); |
| 77 | 73 | defer tmp.cleanup(); |
| 78 | 74 | |
| ... | ... | @@ -111,8 +107,6 @@ test "user and group ids" { |
| 111 | 107 | } |
| 112 | 108 | |
| 113 | 109 | test "fadvise" { |
| 114 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 115 | ||
| 116 | 110 | var tmp = std.testing.tmpDir(.{}); |
| 117 | 111 | defer tmp.cleanup(); |
| 118 | 112 |
lib/std/os/test.zig-42| ... | ... | @@ -88,8 +88,6 @@ test "chdir smoke test" { |
| 88 | 88 | test "open smoke test" { |
| 89 | 89 | if (native_os == .wasi) return error.SkipZigTest; |
| 90 | 90 | |
| 91 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 92 | ||
| 93 | 91 | // TODO verify file attributes using `fstat` |
| 94 | 92 | |
| 95 | 93 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -144,8 +142,6 @@ test "open smoke test" { |
| 144 | 142 | test "openat smoke test" { |
| 145 | 143 | if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 146 | 144 | |
| 147 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 148 | ||
| 149 | 145 | // TODO verify file attributes using `fstatat` |
| 150 | 146 | |
| 151 | 147 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -280,8 +276,6 @@ test "link with relative paths" { |
| 280 | 276 | test "linkat with different directories" { |
| 281 | 277 | if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 282 | 278 | |
| 283 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 284 | ||
| 285 | 279 | switch (native_os) { |
| 286 | 280 | .wasi, .linux, .solaris, .illumos => {}, |
| 287 | 281 | else => return error.SkipZigTest, |
| ... | ... | @@ -327,8 +321,6 @@ test "fstatat" { |
| 327 | 321 | // enable when `fstat` and `fstatat` are implemented on Windows |
| 328 | 322 | if (native_os == .windows) return error.SkipZigTest; |
| 329 | 323 | |
| 330 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 331 | ||
| 332 | 324 | var tmp = tmpDir(.{}); |
| 333 | 325 | defer tmp.cleanup(); |
| 334 | 326 | |
| ... | ... | @@ -348,8 +340,6 @@ test "fstatat" { |
| 348 | 340 | } |
| 349 | 341 | |
| 350 | 342 | test "readlinkat" { |
| 351 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 352 | ||
| 353 | 343 | var tmp = tmpDir(.{}); |
| 354 | 344 | defer tmp.cleanup(); |
| 355 | 345 | |
| ... | ... | @@ -583,8 +573,6 @@ test "mmap" { |
| 583 | 573 | if (native_os == .windows or native_os == .wasi) |
| 584 | 574 | return error.SkipZigTest; |
| 585 | 575 | |
| 586 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 587 | ||
| 588 | 576 | var tmp = tmpDir(.{}); |
| 589 | 577 | defer tmp.cleanup(); |
| 590 | 578 | |
| ... | ... | @@ -695,8 +683,6 @@ test "fcntl" { |
| 695 | 683 | if (native_os == .windows or native_os == .wasi) |
| 696 | 684 | return error.SkipZigTest; |
| 697 | 685 | |
| 698 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 699 | ||
| 700 | 686 | var tmp = tmpDir(.{}); |
| 701 | 687 | defer tmp.cleanup(); |
| 702 | 688 | |
| ... | ... | @@ -737,8 +723,6 @@ test "sync" { |
| 737 | 723 | if (native_os != .linux) |
| 738 | 724 | return error.SkipZigTest; |
| 739 | 725 | |
| 740 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 741 | ||
| 742 | 726 | var tmp = tmpDir(.{}); |
| 743 | 727 | defer tmp.cleanup(); |
| 744 | 728 | |
| ... | ... | @@ -759,8 +743,6 @@ test "fsync" { |
| 759 | 743 | else => return error.SkipZigTest, |
| 760 | 744 | } |
| 761 | 745 | |
| 762 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 763 | ||
| 764 | 746 | var tmp = tmpDir(.{}); |
| 765 | 747 | defer tmp.cleanup(); |
| 766 | 748 | |
| ... | ... | @@ -780,8 +762,6 @@ test "getrlimit and setrlimit" { |
| 780 | 762 | return error.SkipZigTest; |
| 781 | 763 | } |
| 782 | 764 | |
| 783 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 784 | ||
| 785 | 765 | inline for (std.meta.fields(os.rlimit_resource)) |field| { |
| 786 | 766 | const resource = @as(os.rlimit_resource, @enumFromInt(field.value)); |
| 787 | 767 | const limit = try os.getrlimit(resource); |
| ... | ... | @@ -903,8 +883,6 @@ test "dup & dup2" { |
| 903 | 883 | else => return error.SkipZigTest, |
| 904 | 884 | } |
| 905 | 885 | |
| 906 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 907 | ||
| 908 | 886 | var tmp = tmpDir(.{}); |
| 909 | 887 | defer tmp.cleanup(); |
| 910 | 888 | |
| ... | ... | @@ -934,8 +912,6 @@ test "dup & dup2" { |
| 934 | 912 | test "writev longer than IOV_MAX" { |
| 935 | 913 | if (native_os == .windows or native_os == .wasi) return error.SkipZigTest; |
| 936 | 914 | |
| 937 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 938 | ||
| 939 | 915 | var tmp = tmpDir(.{}); |
| 940 | 916 | defer tmp.cleanup(); |
| 941 | 917 | |
| ... | ... | @@ -953,8 +929,6 @@ test "POSIX file locking with fcntl" { |
| 953 | 929 | return error.SkipZigTest; |
| 954 | 930 | } |
| 955 | 931 | |
| 956 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 957 | ||
| 958 | 932 | if (true) { |
| 959 | 933 | // https://github.com/ziglang/zig/issues/11074 |
| 960 | 934 | return error.SkipZigTest; |
| ... | ... | @@ -1017,8 +991,6 @@ test "POSIX file locking with fcntl" { |
| 1017 | 991 | test "rename smoke test" { |
| 1018 | 992 | if (native_os == .wasi) return error.SkipZigTest; |
| 1019 | 993 | |
| 1020 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1021 | ||
| 1022 | 994 | var tmp = tmpDir(.{}); |
| 1023 | 995 | defer tmp.cleanup(); |
| 1024 | 996 | |
| ... | ... | @@ -1075,8 +1047,6 @@ test "rename smoke test" { |
| 1075 | 1047 | test "access smoke test" { |
| 1076 | 1048 | if (native_os == .wasi) return error.SkipZigTest; |
| 1077 | 1049 | |
| 1078 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1079 | ||
| 1080 | 1050 | var tmp = tmpDir(.{}); |
| 1081 | 1051 | defer tmp.cleanup(); |
| 1082 | 1052 | |
| ... | ... | @@ -1141,8 +1111,6 @@ test "timerfd" { |
| 1141 | 1111 | } |
| 1142 | 1112 | |
| 1143 | 1113 | test "isatty" { |
| 1144 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1145 | ||
| 1146 | 1114 | var tmp = tmpDir(.{}); |
| 1147 | 1115 | defer tmp.cleanup(); |
| 1148 | 1116 | |
| ... | ... | @@ -1155,8 +1123,6 @@ test "isatty" { |
| 1155 | 1123 | test "read with empty buffer" { |
| 1156 | 1124 | if (native_os == .wasi) return error.SkipZigTest; |
| 1157 | 1125 | |
| 1158 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1159 | ||
| 1160 | 1126 | var tmp = tmpDir(.{}); |
| 1161 | 1127 | defer tmp.cleanup(); |
| 1162 | 1128 | |
| ... | ... | @@ -1182,8 +1148,6 @@ test "read with empty buffer" { |
| 1182 | 1148 | test "pread with empty buffer" { |
| 1183 | 1149 | if (native_os == .wasi) return error.SkipZigTest; |
| 1184 | 1150 | |
| 1185 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1186 | ||
| 1187 | 1151 | var tmp = tmpDir(.{}); |
| 1188 | 1152 | defer tmp.cleanup(); |
| 1189 | 1153 | |
| ... | ... | @@ -1209,8 +1173,6 @@ test "pread with empty buffer" { |
| 1209 | 1173 | test "write with empty buffer" { |
| 1210 | 1174 | if (native_os == .wasi) return error.SkipZigTest; |
| 1211 | 1175 | |
| 1212 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1213 | ||
| 1214 | 1176 | var tmp = tmpDir(.{}); |
| 1215 | 1177 | defer tmp.cleanup(); |
| 1216 | 1178 | |
| ... | ... | @@ -1236,8 +1198,6 @@ test "write with empty buffer" { |
| 1236 | 1198 | test "pwrite with empty buffer" { |
| 1237 | 1199 | if (native_os == .wasi) return error.SkipZigTest; |
| 1238 | 1200 | |
| 1239 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1240 | ||
| 1241 | 1201 | var tmp = tmpDir(.{}); |
| 1242 | 1202 | defer tmp.cleanup(); |
| 1243 | 1203 | |
| ... | ... | @@ -1263,8 +1223,6 @@ test "pwrite with empty buffer" { |
| 1263 | 1223 | test "fchmodat smoke test" { |
| 1264 | 1224 | if (!std.fs.has_executable_bit) return error.SkipZigTest; |
| 1265 | 1225 | |
| 1266 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1267 | ||
| 1268 | 1226 | var tmp = tmpDir(.{}); |
| 1269 | 1227 | defer tmp.cleanup(); |
| 1270 | 1228 |
lib/std/os/windows.zig-2| ... | ... | @@ -2491,8 +2491,6 @@ pub fn ntToWin32Namespace(path: []const u16) !PathSpace { |
| 2491 | 2491 | } |
| 2492 | 2492 | |
| 2493 | 2493 | test "ntToWin32Namespace" { |
| 2494 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2495 | ||
| 2496 | 2494 | const L = std.unicode.utf8ToUtf16LeStringLiteral; |
| 2497 | 2495 | |
| 2498 | 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 | 705 | } |
| 706 | 706 | |
| 707 | 707 | test "std.PriorityDequeue: fromOwnedSlice" { |
| 708 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 709 | ||
| 710 | 708 | const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; |
| 711 | 709 | const queue_items = try testing.allocator.dupe(u32, items[0..]); |
| 712 | 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 | 385 | } |
| 386 | 386 | |
| 387 | 387 | test "std.PriorityQueue: fromOwnedSlice" { |
| 388 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 389 | ||
| 390 | 388 | const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 }; |
| 391 | 389 | const heap_items = try testing.allocator.dupe(u32, items[0..]); |
| 392 | 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 | 443 | } |
| 444 | 444 | |
| 445 | 445 | test "CSPRNG" { |
| 446 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 447 | ||
| 448 | 446 | var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined; |
| 449 | 447 | std.crypto.random.bytes(&secret_seed); |
| 450 | 448 | var csprng = DefaultCsprng.init(secret_seed); |
lib/std/segmented_list.zig-2| ... | ... | @@ -409,8 +409,6 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | test "SegmentedList basic usage" { |
| 412 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 413 | ||
| 414 | 412 | try testSegmentedList(0); |
| 415 | 413 | try testSegmentedList(1); |
| 416 | 414 | try testSegmentedList(2); |
lib/std/simd.zig+8-3| ... | ... | @@ -13,7 +13,7 @@ pub fn suggestVectorSizeForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ? |
| 13 | 13 | const vector_bit_size: u16 = blk: { |
| 14 | 14 | if (cpu.arch.isX86()) { |
| 15 | 15 | if (T == bool and std.Target.x86.featureSetHas(cpu.features, .prefer_mask_registers)) return 64; |
| 16 | if (std.Target.x86.featureSetHas(cpu.features, .avx512f) and !std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .prefer_128_bit })) break :blk 512; | |
| 16 | if (builtin.zig_backend != .stage2_x86_64 and std.Target.x86.featureSetHas(cpu.features, .avx512f) and !std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .prefer_128_bit })) break :blk 512; | |
| 17 | 17 | if (std.Target.x86.featureSetHasAny(cpu.features, .{ .prefer_256_bit, .avx2 }) and !std.Target.x86.featureSetHas(cpu.features, .prefer_128_bit)) break :blk 256; |
| 18 | 18 | if (std.Target.x86.featureSetHas(cpu.features, .sse)) break :blk 128; |
| 19 | 19 | if (std.Target.x86.featureSetHasAny(cpu.features, .{ .mmx, .@"3dnow" })) break :blk 64; |
| ... | ... | @@ -62,10 +62,15 @@ pub fn suggestVectorSize(comptime T: type) ?comptime_int { |
| 62 | 62 | test "suggestVectorSizeForCpu works with signed and unsigned values" { |
| 63 | 63 | comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64); |
| 64 | 64 | comptime cpu.features.addFeature(@intFromEnum(std.Target.x86.Feature.avx512f)); |
| 65 | comptime cpu.features.populateDependencies(&std.Target.x86.all_features); | |
| 66 | const expected_size: usize = switch (builtin.zig_backend) { | |
| 67 | .stage2_x86_64 => 8, | |
| 68 | else => 16, | |
| 69 | }; | |
| 65 | 70 | const signed_integer_size = suggestVectorSizeForCpu(i32, cpu).?; |
| 66 | 71 | const unsigned_integer_size = suggestVectorSizeForCpu(u32, cpu).?; |
| 67 | try std.testing.expectEqual(@as(usize, 16), unsigned_integer_size); | |
| 68 | try std.testing.expectEqual(@as(usize, 16), signed_integer_size); | |
| 72 | try std.testing.expectEqual(expected_size, unsigned_integer_size); | |
| 73 | try std.testing.expectEqual(expected_size, signed_integer_size); | |
| 69 | 74 | } |
| 70 | 75 | |
| 71 | 76 | fn vectorLength(comptime VectorType: type) comptime_int { |
lib/std/sort.zig-11| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | 2 | const assert = std.debug.assert; |
| 3 | const builtin = @import("builtin"); | |
| 4 | 3 | const testing = std.testing; |
| 5 | 4 | const mem = std.mem; |
| 6 | 5 | const math = std.math; |
| ... | ... | @@ -177,8 +176,6 @@ const IdAndValue = struct { |
| 177 | 176 | }; |
| 178 | 177 | |
| 179 | 178 | test "stable sort" { |
| 180 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 181 | ||
| 182 | 179 | const expected = [_]IdAndValue{ |
| 183 | 180 | IdAndValue{ .id = 0, .value = 0 }, |
| 184 | 181 | IdAndValue{ .id = 1, .value = 0 }, |
| ... | ... | @@ -226,8 +223,6 @@ test "stable sort" { |
| 226 | 223 | } |
| 227 | 224 | |
| 228 | 225 | test "sort" { |
| 229 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 230 | ||
| 231 | 226 | const u8cases = [_][]const []const u8{ |
| 232 | 227 | &[_][]const u8{ |
| 233 | 228 | "", |
| ... | ... | @@ -306,8 +301,6 @@ test "sort" { |
| 306 | 301 | } |
| 307 | 302 | |
| 308 | 303 | test "sort descending" { |
| 309 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 310 | ||
| 311 | 304 | const rev_cases = [_][]const []const i32{ |
| 312 | 305 | &[_][]const i32{ |
| 313 | 306 | &[_]i32{}, |
| ... | ... | @@ -347,8 +340,6 @@ test "sort descending" { |
| 347 | 340 | } |
| 348 | 341 | |
| 349 | 342 | test "sort with context in the middle of a slice" { |
| 350 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 351 | ||
| 352 | 343 | const Context = struct { |
| 353 | 344 | items: []i32, |
| 354 | 345 | |
| ... | ... | @@ -388,8 +379,6 @@ test "sort with context in the middle of a slice" { |
| 388 | 379 | } |
| 389 | 380 | |
| 390 | 381 | test "sort fuzz testing" { |
| 391 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 392 | ||
| 393 | 382 | var prng = std.rand.DefaultPrng.init(0x12345678); |
| 394 | 383 | const random = prng.random(); |
| 395 | 384 | const test_case_count = 10; |
lib/std/time.zig-2| ... | ... | @@ -321,8 +321,6 @@ pub const Timer = struct { |
| 321 | 321 | }; |
| 322 | 322 | |
| 323 | 323 | test "Timer + Instant" { |
| 324 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 325 | ||
| 326 | 324 | const margin = ns_per_ms * 150; |
| 327 | 325 | |
| 328 | 326 | var timer = try Timer.start(); |
lib/std/unicode.zig-41| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | const std = @import("./std.zig"); |
| 2 | 2 | const assert = std.debug.assert; |
| 3 | const builtin = @import("builtin"); | |
| 4 | 3 | const testing = std.testing; |
| 5 | 4 | const mem = std.mem; |
| 6 | 5 | |
| ... | ... | @@ -497,15 +496,11 @@ fn testUtf16CountCodepoints() !void { |
| 497 | 496 | } |
| 498 | 497 | |
| 499 | 498 | test "utf16 count codepoints" { |
| 500 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 501 | ||
| 502 | 499 | try testUtf16CountCodepoints(); |
| 503 | 500 | try comptime testUtf16CountCodepoints(); |
| 504 | 501 | } |
| 505 | 502 | |
| 506 | 503 | test "utf8 encode" { |
| 507 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 508 | ||
| 509 | 504 | try comptime testUtf8Encode(); |
| 510 | 505 | try testUtf8Encode(); |
| 511 | 506 | } |
| ... | ... | @@ -532,8 +527,6 @@ fn testUtf8Encode() !void { |
| 532 | 527 | } |
| 533 | 528 | |
| 534 | 529 | test "utf8 encode error" { |
| 535 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 536 | ||
| 537 | 530 | try comptime testUtf8EncodeError(); |
| 538 | 531 | try testUtf8EncodeError(); |
| 539 | 532 | } |
| ... | ... | @@ -550,8 +543,6 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void { |
| 550 | 543 | } |
| 551 | 544 | |
| 552 | 545 | test "utf8 iterator on ascii" { |
| 553 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 554 | ||
| 555 | 546 | try comptime testUtf8IteratorOnAscii(); |
| 556 | 547 | try testUtf8IteratorOnAscii(); |
| 557 | 548 | } |
| ... | ... | @@ -572,8 +563,6 @@ fn testUtf8IteratorOnAscii() !void { |
| 572 | 563 | } |
| 573 | 564 | |
| 574 | 565 | test "utf8 view bad" { |
| 575 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 576 | ||
| 577 | 566 | try comptime testUtf8ViewBad(); |
| 578 | 567 | try testUtf8ViewBad(); |
| 579 | 568 | } |
| ... | ... | @@ -584,8 +573,6 @@ fn testUtf8ViewBad() !void { |
| 584 | 573 | } |
| 585 | 574 | |
| 586 | 575 | test "utf8 view ok" { |
| 587 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 588 | ||
| 589 | 576 | try comptime testUtf8ViewOk(); |
| 590 | 577 | try testUtf8ViewOk(); |
| 591 | 578 | } |
| ... | ... | @@ -606,8 +593,6 @@ fn testUtf8ViewOk() !void { |
| 606 | 593 | } |
| 607 | 594 | |
| 608 | 595 | test "validate slice" { |
| 609 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 610 | ||
| 611 | 596 | try comptime testValidateSlice(); |
| 612 | 597 | try testValidateSlice(); |
| 613 | 598 | |
| ... | ... | @@ -648,8 +633,6 @@ fn testValidateSlice() !void { |
| 648 | 633 | } |
| 649 | 634 | |
| 650 | 635 | test "valid utf8" { |
| 651 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 652 | ||
| 653 | 636 | try comptime testValidUtf8(); |
| 654 | 637 | try testValidUtf8(); |
| 655 | 638 | } |
| ... | ... | @@ -669,8 +652,6 @@ fn testValidUtf8() !void { |
| 669 | 652 | } |
| 670 | 653 | |
| 671 | 654 | test "invalid utf8 continuation bytes" { |
| 672 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 673 | ||
| 674 | 655 | try comptime testInvalidUtf8ContinuationBytes(); |
| 675 | 656 | try testInvalidUtf8ContinuationBytes(); |
| 676 | 657 | } |
| ... | ... | @@ -703,8 +684,6 @@ fn testInvalidUtf8ContinuationBytes() !void { |
| 703 | 684 | } |
| 704 | 685 | |
| 705 | 686 | test "overlong utf8 codepoint" { |
| 706 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 707 | ||
| 708 | 687 | try comptime testOverlongUtf8Codepoint(); |
| 709 | 688 | try testOverlongUtf8Codepoint(); |
| 710 | 689 | } |
| ... | ... | @@ -718,8 +697,6 @@ fn testOverlongUtf8Codepoint() !void { |
| 718 | 697 | } |
| 719 | 698 | |
| 720 | 699 | test "misc invalid utf8" { |
| 721 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 722 | ||
| 723 | 700 | try comptime testMiscInvalidUtf8(); |
| 724 | 701 | try testMiscInvalidUtf8(); |
| 725 | 702 | } |
| ... | ... | @@ -735,8 +712,6 @@ fn testMiscInvalidUtf8() !void { |
| 735 | 712 | } |
| 736 | 713 | |
| 737 | 714 | test "utf8 iterator peeking" { |
| 738 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 739 | ||
| 740 | 715 | try comptime testUtf8Peeking(); |
| 741 | 716 | try testUtf8Peeking(); |
| 742 | 717 | } |
| ... | ... | @@ -821,8 +796,6 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize { |
| 821 | 796 | } |
| 822 | 797 | |
| 823 | 798 | test "utf16leToUtf8" { |
| 824 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 825 | ||
| 826 | 799 | var utf16le: [2]u16 = undefined; |
| 827 | 800 | const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]); |
| 828 | 801 | |
| ... | ... | @@ -935,8 +908,6 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize { |
| 935 | 908 | } |
| 936 | 909 | |
| 937 | 910 | test "utf8ToUtf16Le" { |
| 938 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 939 | ||
| 940 | 911 | var utf16le: [2]u16 = [_]u16{0} ** 2; |
| 941 | 912 | { |
| 942 | 913 | const length = try utf8ToUtf16Le(utf16le[0..], "𐐷"); |
| ... | ... | @@ -955,8 +926,6 @@ test "utf8ToUtf16Le" { |
| 955 | 926 | } |
| 956 | 927 | |
| 957 | 928 | test "utf8ToUtf16LeWithNull" { |
| 958 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 959 | ||
| 960 | 929 | { |
| 961 | 930 | const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷"); |
| 962 | 931 | defer testing.allocator.free(utf16); |
| ... | ... | @@ -1015,8 +984,6 @@ fn testCalcUtf16LeLen() !void { |
| 1015 | 984 | } |
| 1016 | 985 | |
| 1017 | 986 | test "calculate utf16 string length of given utf8 string in u16" { |
| 1018 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1019 | ||
| 1020 | 987 | try testCalcUtf16LeLen(); |
| 1021 | 988 | try comptime testCalcUtf16LeLen(); |
| 1022 | 989 | } |
| ... | ... | @@ -1050,8 +1017,6 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) { |
| 1050 | 1017 | } |
| 1051 | 1018 | |
| 1052 | 1019 | test "fmtUtf16le" { |
| 1053 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1054 | ||
| 1055 | 1020 | const expectFmt = std.testing.expectFmt; |
| 1056 | 1021 | try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))}); |
| 1057 | 1022 | try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))}); |
| ... | ... | @@ -1065,8 +1030,6 @@ test "fmtUtf16le" { |
| 1065 | 1030 | } |
| 1066 | 1031 | |
| 1067 | 1032 | test "utf8ToUtf16LeStringLiteral" { |
| 1068 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1069 | ||
| 1070 | 1033 | { |
| 1071 | 1034 | const bytes = [_:0]u16{ |
| 1072 | 1035 | mem.nativeToLittle(u16, 0x41), |
| ... | ... | @@ -1127,8 +1090,6 @@ fn testUtf8CountCodepoints() !void { |
| 1127 | 1090 | } |
| 1128 | 1091 | |
| 1129 | 1092 | test "utf8 count codepoints" { |
| 1130 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1131 | ||
| 1132 | 1093 | try testUtf8CountCodepoints(); |
| 1133 | 1094 | try comptime testUtf8CountCodepoints(); |
| 1134 | 1095 | } |
| ... | ... | @@ -1145,8 +1106,6 @@ fn testUtf8ValidCodepoint() !void { |
| 1145 | 1106 | } |
| 1146 | 1107 | |
| 1147 | 1108 | test "utf8 valid codepoint" { |
| 1148 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1149 | ||
| 1150 | 1109 | try testUtf8ValidCodepoint(); |
| 1151 | 1110 | try comptime testUtf8ValidCodepoint(); |
| 1152 | 1111 | } |
lib/std/zig/fmt.zig+1-2| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 2 | const mem = std.mem; |
| 4 | 3 | |
| 5 | 4 | /// Print the string as a Zig identifier escaping it with @"" syntax if needed. |
| ... | ... | @@ -96,7 +95,7 @@ pub fn fmtEscapes(bytes: []const u8) std.fmt.Formatter(stringEscape) { |
| 96 | 95 | } |
| 97 | 96 | |
| 98 | 97 | test "escape invalid identifiers" { |
| 99 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 98 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 100 | 99 | |
| 101 | 100 | const expectFmt = std.testing.expectFmt; |
| 102 | 101 | try expectFmt("@\"while\"", "{}", .{fmtId("while")}); |
lib/std/zig/tokenizer.zig-2| ... | ... | @@ -1481,8 +1481,6 @@ test "utf8" { |
| 1481 | 1481 | } |
| 1482 | 1482 | |
| 1483 | 1483 | test "invalid utf8" { |
| 1484 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1485 | ||
| 1486 | 1484 | try testTokenize("//\x80", &.{ |
| 1487 | 1485 | .invalid, |
| 1488 | 1486 | }); |
src/arch/x86_64/CodeGen.zig+880-305| ... | ... | @@ -656,11 +656,14 @@ const InstTracking = struct { |
| 656 | 656 | fn reuse( |
| 657 | 657 | self: *InstTracking, |
| 658 | 658 | function: *Self, |
| 659 | new_inst: Air.Inst.Index, | |
| 659 | new_inst: ?Air.Inst.Index, | |
| 660 | 660 | old_inst: Air.Inst.Index, |
| 661 | 661 | ) void { |
| 662 | 662 | self.short = .{ .dead = function.scope_generation }; |
| 663 | tracking_log.debug("%{d} => {} (reuse %{d})", .{ new_inst, self.*, old_inst }); | |
| 663 | if (new_inst) |inst| | |
| 664 | tracking_log.debug("%{d} => {} (reuse %{d})", .{ inst, self.*, old_inst }) | |
| 665 | else | |
| 666 | tracking_log.debug("tmp => {} (reuse %{d})", .{ self.*, old_inst }); | |
| 664 | 667 | } |
| 665 | 668 | |
| 666 | 669 | fn liveOut(self: *InstTracking, function: *Self, inst: Air.Inst.Index) void { |
| ... | ... | @@ -1457,7 +1460,10 @@ fn asmRegisterRegisterRegisterImmediate( |
| 1457 | 1460 | .r1 = reg1, |
| 1458 | 1461 | .r2 = reg2, |
| 1459 | 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 | 1566 | m: Memory, |
| 1561 | 1567 | imm: Immediate, |
| 1562 | 1568 | ) !void { |
| 1563 | _ = try self.addInst(.{ | |
| 1564 | .tag = tag[1], | |
| 1565 | .ops = switch (m) { | |
| 1566 | .sib => .rmi_sib, | |
| 1567 | .rip => .rmi_rip, | |
| 1569 | if (switch (imm) { | |
| 1570 | .signed => |s| if (math.cast(i16, s)) |x| @as(u16, @bitCast(x)) else null, | |
| 1571 | .unsigned => |u| math.cast(u16, u), | |
| 1572 | }) |small_imm| { | |
| 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 | 1599 | else => unreachable, |
| 1569 | }, | |
| 1570 | .data = .{ .rix = .{ | |
| 1571 | .fixes = tag[0], | |
| 1572 | .r1 = reg, | |
| 1573 | .i = @as(u8, @intCast(imm.unsigned)), | |
| 1574 | .payload = switch (m) { | |
| 1575 | .sib => try self.addExtra(Mir.MemorySib.encode(m)), | |
| 1576 | .rip => try self.addExtra(Mir.MemoryRip.encode(m)), | |
| 1600 | }); | |
| 1601 | _ = try self.addInst(.{ | |
| 1602 | .tag = tag[1], | |
| 1603 | .ops = switch (m) { | |
| 1604 | .sib => switch (imm) { | |
| 1605 | .signed => .rmi_sib_s, | |
| 1606 | .unsigned => .rmi_sib_u, | |
| 1607 | }, | |
| 1608 | .rip => switch (imm) { | |
| 1609 | .signed => .rmi_rip_s, | |
| 1610 | .unsigned => .rmi_rip_u, | |
| 1611 | }, | |
| 1577 | 1612 | else => unreachable, |
| 1578 | 1613 | }, |
| 1579 | } }, | |
| 1580 | }); | |
| 1614 | .data = .{ .rx = .{ | |
| 1615 | .fixes = tag[0], | |
| 1616 | .r1 = reg, | |
| 1617 | .payload = payload, | |
| 1618 | } }, | |
| 1619 | }); | |
| 1620 | } | |
| 1581 | 1621 | } |
| 1582 | 1622 | |
| 1583 | 1623 | fn asmRegisterRegisterMemoryImmediate( |
| ... | ... | @@ -2047,7 +2087,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 2047 | 2087 | .get_union_tag => try self.airGetUnionTag(inst), |
| 2048 | 2088 | .clz => try self.airClz(inst), |
| 2049 | 2089 | .ctz => try self.airCtz(inst), |
| 2050 | .popcount => try self.airPopcount(inst), | |
| 2090 | .popcount => try self.airPopCount(inst), | |
| 2051 | 2091 | .byte_swap => try self.airByteSwap(inst), |
| 2052 | 2092 | .bit_reverse => try self.airBitReverse(inst), |
| 2053 | 2093 | .tag_name => try self.airTagName(inst), |
| ... | ... | @@ -2708,11 +2748,11 @@ fn airFptrunc(self: *Self, inst: Air.Inst.Index) !void { |
| 2708 | 2748 | }, |
| 2709 | 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 | 2752 | break :result try self.genCall(.{ .lib = .{ |
| 2713 | 2753 | .return_type = self.floatCompilerRtAbiType(dst_ty, src_ty).toIntern(), |
| 2714 | 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 | 2756 | floatCompilerRtAbiName(src_bits), |
| 2717 | 2757 | floatCompilerRtAbiName(dst_bits), |
| 2718 | 2758 | }) catch unreachable, |
| ... | ... | @@ -2740,7 +2780,7 @@ fn airFptrunc(self: *Self, inst: Air.Inst.Index) !void { |
| 2740 | 2780 | .{ .v_, .cvtps2ph }, |
| 2741 | 2781 | dst_reg, |
| 2742 | 2782 | mat_src_reg.to128(), |
| 2743 | Immediate.u(0b1_00), | |
| 2783 | Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))), | |
| 2744 | 2784 | ); |
| 2745 | 2785 | }, |
| 2746 | 2786 | else => unreachable, |
| ... | ... | @@ -2807,11 +2847,11 @@ fn airFpext(self: *Self, inst: Air.Inst.Index) !void { |
| 2807 | 2847 | }, |
| 2808 | 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 | 2851 | break :result try self.genCall(.{ .lib = .{ |
| 2812 | 2852 | .return_type = self.floatCompilerRtAbiType(dst_ty, src_ty).toIntern(), |
| 2813 | 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 | 2855 | floatCompilerRtAbiName(src_bits), |
| 2816 | 2856 | floatCompilerRtAbiName(dst_bits), |
| 2817 | 2857 | }) catch unreachable, |
| ... | ... | @@ -2982,11 +3022,8 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void { |
| 2982 | 3022 | else if (dst_abi_size <= 8) |
| 2983 | 3023 | try self.copyToRegisterWithInstTracking(inst, dst_ty, src_mcv) |
| 2984 | 3024 | else if (dst_abi_size <= 16) dst: { |
| 2985 | const dst_regs = try self.register_manager.allocRegs( | |
| 2986 | 2, | |
| 2987 | .{ inst, inst }, | |
| 2988 | abi.RegisterClass.gp, | |
| 2989 | ); | |
| 3025 | const dst_regs = | |
| 3026 | try self.register_manager.allocRegs(2, .{ inst, inst }, abi.RegisterClass.gp); | |
| 2990 | 3027 | const dst_mcv: MCValue = .{ .register_pair = dst_regs }; |
| 2991 | 3028 | const dst_locks = self.register_manager.lockRegsAssumeUnused(2, dst_regs); |
| 2992 | 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 | 3750 | else => unreachable, |
| 3714 | 3751 | .mul => {}, |
| 3715 | 3752 | .div => switch (tag[0]) { |
| 3716 | ._ => try self.asmRegisterRegister(.{ ._, .xor }, .edx, .edx), | |
| 3717 | .i_ => switch (self.regBitSize(ty)) { | |
| 3718 | 8 => try self.asmOpOnly(.{ ._, .cbw }), | |
| 3719 | 16 => try self.asmOpOnly(.{ ._, .cwd }), | |
| 3720 | 32 => try self.asmOpOnly(.{ ._, .cdq }), | |
| 3721 | 64 => try self.asmOpOnly(.{ ._, .cqo }), | |
| 3722 | else => unreachable, | |
| 3753 | ._ => { | |
| 3754 | const hi_reg: Register = | |
| 3755 | switch (self.regBitSize(ty)) { | |
| 3756 | 8 => .ah, | |
| 3757 | 16, 32, 64 => .edx, | |
| 3758 | else => unreachable, | |
| 3759 | }; | |
| 3760 | try self.asmRegisterRegister(.{ ._, .xor }, hi_reg, hi_reg); | |
| 3723 | 3761 | }, |
| 3762 | .i_ => try self.asmOpOnly(.{ ._, switch (self.regBitSize(ty)) { | |
| 3763 | 8 => .cbw, | |
| 3764 | 16 => .cwd, | |
| 3765 | 32 => .cdq, | |
| 3766 | 64 => .cqo, | |
| 3767 | else => unreachable, | |
| 3768 | } }), | |
| 3724 | 3769 | else => unreachable, |
| 3725 | 3770 | }, |
| 3726 | 3771 | } |
| ... | ... | @@ -4626,6 +4671,19 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void { |
| 4626 | 4671 | if (src_ty.zigTypeTag(mod) == .Vector) return self.fail("TODO implement airClz for {}", .{ |
| 4627 | 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 | } | |
| 4629 | 4687 | |
| 4630 | 4688 | const src_mcv = try self.resolveInst(ty_op.operand); |
| 4631 | 4689 | const mat_src_mcv = switch (src_mcv) { |
| ... | ... | @@ -4643,8 +4701,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void { |
| 4643 | 4701 | const dst_lock = self.register_manager.lockRegAssumeUnused(dst_reg); |
| 4644 | 4702 | defer self.register_manager.unlockReg(dst_lock); |
| 4645 | 4703 | |
| 4646 | const src_bits = src_ty.bitSize(mod); | |
| 4647 | if (self.hasFeature(.lzcnt)) { | |
| 4704 | if (has_lzcnt) { | |
| 4648 | 4705 | if (src_bits <= 8) { |
| 4649 | 4706 | const wide_reg = try self.copyToTmpRegister(src_ty, mat_src_mcv); |
| 4650 | 4707 | try self.truncateRegister(src_ty, wide_reg); |
| ... | ... | @@ -4667,24 +4724,33 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void { |
| 4667 | 4724 | const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg); |
| 4668 | 4725 | defer self.register_manager.unlockReg(tmp_lock); |
| 4669 | 4726 | |
| 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 | 4736 | try self.genBinOpMir(.{ ._, .add }, dst_ty, dst_mcv, .{ .immediate = 64 }); |
| 4672 | 4737 | try self.genBinOpMir( |
| 4673 | 4738 | .{ ._, .lzcnt }, |
| 4674 | 4739 | Type.u64, |
| 4675 | 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 | 4746 | try self.asmCmovccRegisterRegister(.nc, dst_reg.to32(), tmp_reg.to32()); |
| 4679 | 4747 | |
| 4680 | if (src_bits < 128) { | |
| 4681 | try self.genBinOpMir( | |
| 4682 | .{ ._, .sub }, | |
| 4683 | dst_ty, | |
| 4684 | dst_mcv, | |
| 4685 | .{ .immediate = 128 - src_bits }, | |
| 4686 | ); | |
| 4687 | } | |
| 4748 | if (src_bits < 128) try self.genBinOpMir( | |
| 4749 | .{ ._, .sub }, | |
| 4750 | dst_ty, | |
| 4751 | dst_mcv, | |
| 4752 | .{ .immediate = 128 - src_bits }, | |
| 4753 | ); | |
| 4688 | 4754 | } else return self.fail("TODO airClz of {}", .{src_ty.fmt(mod)}); |
| 4689 | 4755 | break :result dst_mcv; |
| 4690 | 4756 | } |
| ... | ... | @@ -4755,7 +4821,22 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void { |
| 4755 | 4821 | const result = result: { |
| 4756 | 4822 | const dst_ty = self.typeOfIndex(inst); |
| 4757 | 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 | } | |
| 4759 | 4840 | |
| 4760 | 4841 | const src_mcv = try self.resolveInst(ty_op.operand); |
| 4761 | 4842 | const mat_src_mcv = switch (src_mcv) { |
| ... | ... | @@ -4800,8 +4881,16 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void { |
| 4800 | 4881 | const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg); |
| 4801 | 4882 | defer self.register_manager.unlockReg(tmp_lock); |
| 4802 | 4883 | |
| 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 | 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 | 4894 | try self.genBinOpMir( |
| 4806 | 4895 | .{ ._, .@"or" }, |
| 4807 | 4896 | Type.u64, |
| ... | ... | @@ -4809,10 +4898,10 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void { |
| 4809 | 4898 | .{ .immediate = @as(u64, math.maxInt(u64)) << @intCast(src_bits - 64) }, |
| 4810 | 4899 | ); |
| 4811 | 4900 | break :masked dst_mcv; |
| 4812 | } else mat_src_mcv.address().offset(8).deref(); | |
| 4901 | } else hi_mat_src_mcv; | |
| 4813 | 4902 | try self.genBinOpMir(.{ ._, .tzcnt }, Type.u64, dst_mcv, masked_mcv); |
| 4814 | 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 | 4905 | try self.asmCmovccRegisterRegister(.nc, dst_reg.to32(), tmp_reg.to32()); |
| 4817 | 4906 | } else return self.fail("TODO airCtz of {}", .{src_ty.fmt(mod)}); |
| 4818 | 4907 | break :result dst_mcv; |
| ... | ... | @@ -4844,155 +4933,216 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void { |
| 4844 | 4933 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 4845 | 4934 | } |
| 4846 | 4935 | |
| 4847 | fn airPopcount(self: *Self, inst: Air.Inst.Index) !void { | |
| 4936 | fn airPopCount(self: *Self, inst: Air.Inst.Index) !void { | |
| 4848 | 4937 | const mod = self.bin_file.options.module.?; |
| 4849 | 4938 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 4850 | 4939 | const result: MCValue = result: { |
| 4940 | try self.spillEflagsIfOccupied(); | |
| 4941 | ||
| 4851 | 4942 | const src_ty = self.typeOf(ty_op.operand); |
| 4852 | 4943 | const src_abi_size: u32 = @intCast(src_ty.abiSize(mod)); |
| 4853 | if (src_ty.zigTypeTag(mod) == .Vector or src_abi_size > 8) | |
| 4854 | return self.fail("TODO implement airPopcount for {}", .{src_ty.fmt(mod)}); | |
| 4944 | if (src_ty.zigTypeTag(mod) == .Vector or src_abi_size > 16) | |
| 4945 | return self.fail("TODO implement airPopCount for {}", .{src_ty.fmt(mod)}); | |
| 4855 | 4946 | const src_mcv = try self.resolveInst(ty_op.operand); |
| 4856 | 4947 | |
| 4857 | if (self.hasFeature(.popcnt)) { | |
| 4858 | const mat_src_mcv = switch (src_mcv) { | |
| 4859 | .immediate => MCValue{ .register = try self.copyToTmpRegister(src_ty, src_mcv) }, | |
| 4860 | else => src_mcv, | |
| 4861 | }; | |
| 4862 | const mat_src_lock = switch (mat_src_mcv) { | |
| 4863 | .register => |reg| self.register_manager.lockReg(reg), | |
| 4864 | else => null, | |
| 4865 | }; | |
| 4866 | defer if (mat_src_lock) |lock| self.register_manager.unlockReg(lock); | |
| 4948 | const mat_src_mcv = switch (src_mcv) { | |
| 4949 | .immediate => MCValue{ .register = try self.copyToTmpRegister(src_ty, src_mcv) }, | |
| 4950 | else => src_mcv, | |
| 4951 | }; | |
| 4952 | const mat_src_lock = switch (mat_src_mcv) { | |
| 4953 | .register => |reg| self.register_manager.lockReg(reg), | |
| 4954 | else => null, | |
| 4955 | }; | |
| 4956 | defer if (mat_src_lock) |lock| self.register_manager.unlockReg(lock); | |
| 4867 | 4957 | |
| 4868 | const dst_mcv: MCValue = | |
| 4869 | if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) | |
| 4870 | src_mcv | |
| 4958 | if (src_abi_size <= 8) { | |
| 4959 | const dst_contains_src = | |
| 4960 | 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 | 4963 | 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); | |
| 4873 | 4967 | |
| 4874 | const popcnt_ty = if (src_abi_size > 1) src_ty else Type.u16; | |
| 4875 | try self.genBinOpMir(.{ ._, .popcnt }, popcnt_ty, dst_mcv, mat_src_mcv); | |
| 4876 | break :result dst_mcv; | |
| 4968 | try self.genPopCount(dst_reg, src_ty, mat_src_mcv, dst_contains_src); | |
| 4969 | break :result .{ .register = dst_reg }; | |
| 4877 | 4970 | } |
| 4878 | 4971 | |
| 4879 | const mask = @as(u64, math.maxInt(u64)) >> @intCast(64 - src_abi_size * 8); | |
| 4880 | const imm_0_1 = Immediate.u(mask / 0b1_1); | |
| 4881 | const imm_00_11 = Immediate.u(mask / 0b01_01); | |
| 4882 | const imm_0000_1111 = Immediate.u(mask / 0b0001_0001); | |
| 4883 | const imm_0000_0001 = Immediate.u(mask / 0b1111_1111); | |
| 4972 | assert(src_abi_size > 8 and src_abi_size <= 16); | |
| 4973 | const tmp_regs = try self.register_manager.allocRegs(2, .{ inst, null }, abi.RegisterClass.gp); | |
| 4974 | const tmp_locks = self.register_manager.lockRegsAssumeUnused(2, tmp_regs); | |
| 4975 | defer for (tmp_locks) |lock| self.register_manager.unlockReg(lock); | |
| 4884 | 4976 | |
| 4885 | const dst_mcv = if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) | |
| 4886 | src_mcv | |
| 4977 | try self.genPopCount(tmp_regs[0], Type.usize, if (mat_src_mcv.isMemory()) | |
| 4978 | mat_src_mcv | |
| 4887 | 4979 | else |
| 4888 | try self.copyToRegisterWithInstTracking(inst, src_ty, src_mcv); | |
| 4889 | const dst_reg = dst_mcv.register; | |
| 4890 | const dst_lock = self.register_manager.lockRegAssumeUnused(dst_reg); | |
| 4891 | defer self.register_manager.unlockReg(dst_lock); | |
| 4980 | .{ .register = mat_src_mcv.register_pair[0] }, false); | |
| 4981 | try self.genPopCount(tmp_regs[1], Type.usize, if (mat_src_mcv.isMemory()) | |
| 4982 | mat_src_mcv.address().offset(8).deref() | |
| 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 | } | |
| 4892 | 4990 | |
| 4893 | const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp); | |
| 4894 | const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg); | |
| 4895 | defer self.register_manager.unlockReg(tmp_lock); | |
| 4991 | fn genPopCount( | |
| 4992 | self: *Self, | |
| 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.?; | |
| 4896 | 4999 | |
| 4897 | { | |
| 4898 | const dst = registerAlias(dst_reg, src_abi_size); | |
| 4899 | const tmp = registerAlias(tmp_reg, src_abi_size); | |
| 4900 | const imm = if (src_abi_size > 4) | |
| 4901 | try self.register_manager.allocReg(null, abi.RegisterClass.gp) | |
| 4902 | else | |
| 4903 | undefined; | |
| 4904 | ||
| 4905 | // dst = operand | |
| 4906 | try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst); | |
| 4907 | // tmp = operand | |
| 4908 | try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(1)); | |
| 4909 | // tmp = operand >> 1 | |
| 4910 | if (src_abi_size > 4) { | |
| 4911 | try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0_1); | |
| 4912 | try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm); | |
| 4913 | } else try self.asmRegisterImmediate(.{ ._, .@"and" }, tmp, imm_0_1); | |
| 4914 | // tmp = (operand >> 1) & 0x55...55 | |
| 4915 | try self.asmRegisterRegister(.{ ._, .sub }, dst, tmp); | |
| 4916 | // dst = temp1 = operand - ((operand >> 1) & 0x55...55) | |
| 4917 | try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst); | |
| 4918 | // tmp = temp1 | |
| 4919 | try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(2)); | |
| 4920 | // dst = temp1 >> 2 | |
| 4921 | if (src_abi_size > 4) { | |
| 4922 | try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_00_11); | |
| 4923 | try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm); | |
| 4924 | try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm); | |
| 4925 | } else { | |
| 4926 | try self.asmRegisterImmediate(.{ ._, .@"and" }, tmp, imm_00_11); | |
| 4927 | try self.asmRegisterImmediate(.{ ._, .@"and" }, dst, imm_00_11); | |
| 4928 | } | |
| 4929 | // tmp = temp1 & 0x33...33 | |
| 4930 | // dst = (temp1 >> 2) & 0x33...33 | |
| 4931 | try self.asmRegisterRegister(.{ ._, .add }, tmp, dst); | |
| 4932 | // tmp = temp2 = (temp1 & 0x33...33) + ((temp1 >> 2) & 0x33...33) | |
| 4933 | try self.asmRegisterRegister(.{ ._, .mov }, dst, tmp); | |
| 4934 | // dst = temp2 | |
| 4935 | try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(4)); | |
| 4936 | // tmp = temp2 >> 4 | |
| 4937 | try self.asmRegisterRegister(.{ ._, .add }, dst, tmp); | |
| 4938 | // dst = temp2 + (temp2 >> 4) | |
| 4939 | if (src_abi_size > 4) { | |
| 4940 | try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0000_1111); | |
| 4941 | try self.asmRegisterImmediate(.{ ._, .mov }, tmp, imm_0000_0001); | |
| 4942 | try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm); | |
| 4943 | try self.asmRegisterRegister(.{ .i_, .mul }, dst, tmp); | |
| 4944 | } else { | |
| 4945 | try self.asmRegisterImmediate(.{ ._, .@"and" }, dst, imm_0000_1111); | |
| 4946 | if (src_abi_size > 1) { | |
| 4947 | try self.asmRegisterRegisterImmediate(.{ .i_, .mul }, dst, dst, imm_0000_0001); | |
| 4948 | } | |
| 4949 | } | |
| 4950 | // dst = temp3 = (temp2 + (temp2 >> 4)) & 0x0f...0f | |
| 4951 | // dst = temp3 * 0x01...01 | |
| 4952 | if (src_abi_size > 1) { | |
| 4953 | try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u((src_abi_size - 1) * 8)); | |
| 4954 | } | |
| 4955 | // dst = (temp3 * 0x01...01) >> (bits - 8) | |
| 5000 | const src_abi_size: u32 = @intCast(src_ty.abiSize(mod)); | |
| 5001 | if (self.hasFeature(.popcnt)) return self.genBinOpMir( | |
| 5002 | .{ ._, .popcnt }, | |
| 5003 | if (src_abi_size > 1) src_ty else Type.u16, | |
| 5004 | .{ .register = dst_reg }, | |
| 5005 | src_mcv, | |
| 5006 | ); | |
| 5007 | ||
| 5008 | const mask = @as(u64, math.maxInt(u64)) >> @intCast(64 - src_abi_size * 8); | |
| 5009 | const imm_0_1 = Immediate.u(mask / 0b1_1); | |
| 5010 | const imm_00_11 = Immediate.u(mask / 0b01_01); | |
| 5011 | const imm_0000_1111 = Immediate.u(mask / 0b0001_0001); | |
| 5012 | const imm_0000_0001 = Immediate.u(mask / 0b1111_1111); | |
| 5013 | ||
| 5014 | const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp); | |
| 5015 | const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg); | |
| 5016 | defer self.register_manager.unlockReg(tmp_lock); | |
| 5017 | ||
| 5018 | const dst = registerAlias(dst_reg, src_abi_size); | |
| 5019 | const tmp = registerAlias(tmp_reg, src_abi_size); | |
| 5020 | const imm = if (src_abi_size > 4) | |
| 5021 | try self.register_manager.allocReg(null, abi.RegisterClass.gp) | |
| 5022 | else | |
| 5023 | undefined; | |
| 5024 | ||
| 5025 | if (!dst_contains_src) try self.genSetReg(dst, src_ty, src_mcv); | |
| 5026 | // dst = operand | |
| 5027 | try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst); | |
| 5028 | // tmp = operand | |
| 5029 | try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(1)); | |
| 5030 | // tmp = operand >> 1 | |
| 5031 | if (src_abi_size > 4) { | |
| 5032 | try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0_1); | |
| 5033 | try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm); | |
| 5034 | } else try self.asmRegisterImmediate(.{ ._, .@"and" }, tmp, imm_0_1); | |
| 5035 | // tmp = (operand >> 1) & 0x55...55 | |
| 5036 | try self.asmRegisterRegister(.{ ._, .sub }, dst, tmp); | |
| 5037 | // dst = temp1 = operand - ((operand >> 1) & 0x55...55) | |
| 5038 | try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst); | |
| 5039 | // tmp = temp1 | |
| 5040 | try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(2)); | |
| 5041 | // dst = temp1 >> 2 | |
| 5042 | if (src_abi_size > 4) { | |
| 5043 | try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_00_11); | |
| 5044 | try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm); | |
| 5045 | try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm); | |
| 5046 | } else { | |
| 5047 | try self.asmRegisterImmediate(.{ ._, .@"and" }, tmp, imm_00_11); | |
| 5048 | try self.asmRegisterImmediate(.{ ._, .@"and" }, dst, imm_00_11); | |
| 5049 | } | |
| 5050 | // tmp = temp1 & 0x33...33 | |
| 5051 | // dst = (temp1 >> 2) & 0x33...33 | |
| 5052 | try self.asmRegisterRegister(.{ ._, .add }, tmp, dst); | |
| 5053 | // tmp = temp2 = (temp1 & 0x33...33) + ((temp1 >> 2) & 0x33...33) | |
| 5054 | try self.asmRegisterRegister(.{ ._, .mov }, dst, tmp); | |
| 5055 | // dst = temp2 | |
| 5056 | try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(4)); | |
| 5057 | // tmp = temp2 >> 4 | |
| 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; | |
| 4958 | }; | |
| 4959 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | |
| 5070 | } | |
| 5071 | // dst = temp3 = (temp2 + (temp2 >> 4)) & 0x0f...0f | |
| 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 | } |
| 4961 | 5078 | |
| 4962 | fn byteSwap(self: *Self, inst: Air.Inst.Index, src_ty: Type, src_mcv: MCValue, mem_ok: bool) !MCValue { | |
| 5079 | fn genByteSwap( | |
| 5080 | self: *Self, | |
| 5081 | inst: Air.Inst.Index, | |
| 5082 | src_ty: Type, | |
| 5083 | src_mcv: MCValue, | |
| 5084 | mem_ok: bool, | |
| 5085 | ) !MCValue { | |
| 4963 | 5086 | const mod = self.bin_file.options.module.?; |
| 4964 | 5087 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 4965 | 5088 | |
| 4966 | 5089 | if (src_ty.zigTypeTag(mod) == .Vector) return self.fail( |
| 4967 | "TODO implement byteSwap for {}", | |
| 5090 | "TODO implement genByteSwap for {}", | |
| 4968 | 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 | 5094 | const src_lock = switch (src_mcv) { |
| 4972 | 5095 | .register => |reg| self.register_manager.lockRegAssumeUnused(reg), |
| 4973 | 5096 | else => null, |
| 4974 | 5097 | }; |
| 4975 | 5098 | defer if (src_lock) |lock| self.register_manager.unlockReg(lock); |
| 4976 | 5099 | |
| 4977 | switch (src_bits) { | |
| 4978 | else => return self.fail("TODO implement byteSwap for {}", .{ | |
| 5100 | switch (abi_size) { | |
| 5101 | else => return self.fail("TODO implement genByteSwap for {}", .{ | |
| 4979 | 5102 | src_ty.fmt(mod), |
| 4980 | 5103 | }), |
| 4981 | 8 => return if ((mem_ok or src_mcv.isRegister()) and | |
| 5104 | 1 => return if ((mem_ok or src_mcv.isRegister()) and | |
| 4982 | 5105 | self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) |
| 4983 | 5106 | src_mcv |
| 4984 | 5107 | else |
| 4985 | 5108 | try self.copyToRegisterWithInstTracking(inst, src_ty, src_mcv), |
| 4986 | 16 => if ((mem_ok or src_mcv.isRegister()) and | |
| 5109 | 2 => if ((mem_ok or src_mcv.isRegister()) and | |
| 4987 | 5110 | self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) |
| 4988 | 5111 | { |
| 4989 | 5112 | try self.genBinOpMir(.{ ._l, .ro }, src_ty, src_mcv, .{ .immediate = 8 }); |
| 4990 | 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 | 5116 | try self.genUnOpMir(.{ ._, .bswap }, src_ty, src_mcv); |
| 4994 | 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 | } |
| 4997 | 5147 | |
| 4998 | 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 | 5155 | defer self.register_manager.unlockReg(dst_lock); |
| 5006 | 5156 | |
| 5007 | 5157 | try self.genSetReg(dst_mcv.register, src_ty, src_mcv); |
| 5008 | switch (src_bits) { | |
| 5158 | switch (abi_size) { | |
| 5009 | 5159 | else => unreachable, |
| 5010 | 16 => try self.genBinOpMir(.{ ._l, .ro }, src_ty, dst_mcv, .{ .immediate = 8 }), | |
| 5011 | 32, 64 => try self.genUnOpMir(.{ ._, .bswap }, src_ty, dst_mcv), | |
| 5160 | 2 => try self.genBinOpMir(.{ ._l, .ro }, src_ty, dst_mcv, .{ .immediate = 8 }), | |
| 5161 | 3...8 => try self.genUnOpMir(.{ ._, .bswap }, src_ty, dst_mcv), | |
| 5012 | 5162 | } |
| 5013 | 5163 | } else try self.genBinOpMir(.{ ._, .movbe }, src_ty, dst_mcv, src_mcv); |
| 5014 | 5164 | return dst_mcv; |
| ... | ... | @@ -5028,18 +5178,19 @@ fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { |
| 5028 | 5178 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 5029 | 5179 | |
| 5030 | 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 | 5183 | const src_mcv = try self.resolveInst(ty_op.operand); |
| 5032 | 5184 | |
| 5033 | const dst_mcv = try self.byteSwap(inst, src_ty, src_mcv, true); | |
| 5034 | switch (self.regExtraBits(src_ty)) { | |
| 5035 | 0 => {}, | |
| 5036 | else => |extra| try self.genBinOpMir( | |
| 5037 | if (src_ty.isSignedInt(mod)) .{ ._r, .sa } else .{ ._r, .sh }, | |
| 5038 | src_ty, | |
| 5039 | dst_mcv, | |
| 5040 | .{ .immediate = extra }, | |
| 5041 | ), | |
| 5042 | } | |
| 5185 | const dst_mcv = try self.genByteSwap(inst, src_ty, src_mcv, true); | |
| 5186 | ||
| 5187 | const extra_bits = abi_size * 8 - bit_size; | |
| 5188 | const signedness: std.builtin.Signedness = | |
| 5189 | if (src_ty.isAbiInt(mod)) src_ty.intInfo(mod).signedness else .unsigned; | |
| 5190 | if (extra_bits > 0) try self.genShiftBinOpMir(switch (signedness) { | |
| 5191 | .signed => .{ ._r, .sa }, | |
| 5192 | .unsigned => .{ ._r, .sh }, | |
| 5193 | }, src_ty, dst_mcv, .{ .immediate = extra_bits }); | |
| 5043 | 5194 | |
| 5044 | 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 | 5200 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 5050 | 5201 | |
| 5051 | 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 | 5205 | const src_mcv = try self.resolveInst(ty_op.operand); |
| 5054 | 5206 | |
| 5055 | const dst_mcv = try self.byteSwap(inst, src_ty, src_mcv, false); | |
| 5056 | const dst_reg = dst_mcv.register; | |
| 5057 | const dst_lock = self.register_manager.lockRegAssumeUnused(dst_reg); | |
| 5058 | defer self.register_manager.unlockReg(dst_lock); | |
| 5207 | const dst_mcv = try self.genByteSwap(inst, src_ty, src_mcv, false); | |
| 5208 | const dst_locks: [2]?RegisterLock = switch (dst_mcv) { | |
| 5209 | .register => |dst_reg| .{ self.register_manager.lockReg(dst_reg), null }, | |
| 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); | |
| 5059 | 5214 | |
| 5060 | 5215 | const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp); |
| 5061 | 5216 | const tmp_lock = self.register_manager.lockReg(tmp_reg); |
| 5062 | 5217 | defer if (tmp_lock) |lock| self.register_manager.unlockReg(lock); |
| 5063 | 5218 | |
| 5064 | { | |
| 5065 | const dst = registerAlias(dst_reg, src_abi_size); | |
| 5066 | const tmp = registerAlias(tmp_reg, src_abi_size); | |
| 5067 | const imm = if (src_abi_size > 4) | |
| 5068 | try self.register_manager.allocReg(null, abi.RegisterClass.gp) | |
| 5069 | else | |
| 5070 | undefined; | |
| 5219 | const limb_abi_size: u32 = @min(abi_size, 8); | |
| 5220 | const tmp = registerAlias(tmp_reg, limb_abi_size); | |
| 5221 | const imm = if (limb_abi_size > 4) | |
| 5222 | try self.register_manager.allocReg(null, abi.RegisterClass.gp) | |
| 5223 | else | |
| 5224 | 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); | |
| 5071 | 5230 | |
| 5072 | const mask = @as(u64, math.maxInt(u64)) >> @intCast(64 - src_abi_size * 8); | |
| 5073 | const imm_0000_1111 = Immediate.u(mask / 0b0001_0001); | |
| 5074 | const imm_00_11 = Immediate.u(mask / 0b01_01); | |
| 5075 | const imm_0_1 = Immediate.u(mask / 0b1_1); | |
| 5231 | for (dst_mcv.getRegs()) |dst_reg| { | |
| 5232 | const dst = registerAlias(dst_reg, limb_abi_size); | |
| 5076 | 5233 | |
| 5077 | 5234 | // dst = temp1 = bswap(operand) |
| 5078 | 5235 | try self.asmRegisterRegister(.{ ._, .mov }, tmp, dst); |
| 5079 | 5236 | // tmp = temp1 |
| 5080 | 5237 | try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(4)); |
| 5081 | 5238 | // dst = temp1 >> 4 |
| 5082 | if (src_abi_size > 4) { | |
| 5239 | if (limb_abi_size > 4) { | |
| 5083 | 5240 | try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0000_1111); |
| 5084 | 5241 | try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm); |
| 5085 | 5242 | try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm); |
| ... | ... | @@ -5097,7 +5254,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { |
| 5097 | 5254 | // tmp = temp2 |
| 5098 | 5255 | try self.asmRegisterImmediate(.{ ._r, .sh }, dst, Immediate.u(2)); |
| 5099 | 5256 | // dst = temp2 >> 2 |
| 5100 | if (src_abi_size > 4) { | |
| 5257 | if (limb_abi_size > 4) { | |
| 5101 | 5258 | try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_00_11); |
| 5102 | 5259 | try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm); |
| 5103 | 5260 | try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm); |
| ... | ... | @@ -5109,7 +5266,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { |
| 5109 | 5266 | // dst = (temp2 >> 2) & 0x33...33 |
| 5110 | 5267 | try self.asmRegisterMemory( |
| 5111 | 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 | 5270 | Memory.sib(.qword, .{ |
| 5114 | 5271 | .base = .{ .reg = dst.to64() }, |
| 5115 | 5272 | .scale_index = .{ .index = tmp.to64(), .scale = 1 << 2 }, |
| ... | ... | @@ -5120,7 +5277,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { |
| 5120 | 5277 | // dst = temp3 |
| 5121 | 5278 | try self.asmRegisterImmediate(.{ ._r, .sh }, tmp, Immediate.u(1)); |
| 5122 | 5279 | // tmp = temp3 >> 1 |
| 5123 | if (src_abi_size > 4) { | |
| 5280 | if (limb_abi_size > 4) { | |
| 5124 | 5281 | try self.asmRegisterImmediate(.{ ._, .mov }, imm, imm_0_1); |
| 5125 | 5282 | try self.asmRegisterRegister(.{ ._, .@"and" }, dst, imm); |
| 5126 | 5283 | try self.asmRegisterRegister(.{ ._, .@"and" }, tmp, imm); |
| ... | ... | @@ -5132,7 +5289,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { |
| 5132 | 5289 | // tmp = (temp3 >> 1) & 0x55...55 |
| 5133 | 5290 | try self.asmRegisterMemory( |
| 5134 | 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 | 5293 | Memory.sib(.qword, .{ |
| 5137 | 5294 | .base = .{ .reg = tmp.to64() }, |
| 5138 | 5295 | .scale_index = .{ .index = dst.to64(), .scale = 1 << 1 }, |
| ... | ... | @@ -5141,15 +5298,13 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { |
| 5141 | 5298 | // dst = ((temp3 >> 1) & 0x55...55) + ((temp3 & 0x55...55) << 1) |
| 5142 | 5299 | } |
| 5143 | 5300 | |
| 5144 | switch (self.regExtraBits(src_ty)) { | |
| 5145 | 0 => {}, | |
| 5146 | else => |extra| try self.genBinOpMir( | |
| 5147 | if (src_ty.isSignedInt(mod)) .{ ._r, .sa } else .{ ._r, .sh }, | |
| 5148 | src_ty, | |
| 5149 | dst_mcv, | |
| 5150 | .{ .immediate = extra }, | |
| 5151 | ), | |
| 5152 | } | |
| 5301 | const extra_bits = abi_size * 8 - bit_size; | |
| 5302 | const signedness: std.builtin.Signedness = | |
| 5303 | if (src_ty.isAbiInt(mod)) src_ty.intInfo(mod).signedness else .unsigned; | |
| 5304 | if (extra_bits > 0) try self.genShiftBinOpMir(switch (signedness) { | |
| 5305 | .signed => .{ ._r, .sa }, | |
| 5306 | .unsigned => .{ ._r, .sh }, | |
| 5307 | }, src_ty, dst_mcv, .{ .immediate = extra_bits }); | |
| 5153 | 5308 | |
| 5154 | 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 | 5365 | .child = (try mod.intType(.signed, scalar_bits)).ip_index, |
| 5211 | 5366 | }); |
| 5212 | 5367 | |
| 5213 | const sign_val = switch (tag) { | |
| 5368 | const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = switch (tag) { | |
| 5214 | 5369 | .neg => try vec_ty.minInt(mod, vec_ty), |
| 5215 | 5370 | .abs => try vec_ty.maxInt(mod, vec_ty), |
| 5216 | 5371 | else => unreachable, |
| 5217 | }; | |
| 5218 | ||
| 5219 | const sign_mcv = try self.genTypedValue(.{ .ty = vec_ty, .val = sign_val }); | |
| 5372 | } }); | |
| 5220 | 5373 | const sign_mem = if (sign_mcv.isMemory()) |
| 5221 | 5374 | sign_mcv.mem(Memory.PtrSize.fromSize(abi_size)) |
| 5222 | 5375 | else |
| ... | ... | @@ -5285,7 +5438,6 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type) |
| 5285 | 5438 | fn airFloatSign(self: *Self, inst: Air.Inst.Index) !void { |
| 5286 | 5439 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 5287 | 5440 | const ty = self.typeOf(un_op); |
| 5288 | ||
| 5289 | 5441 | return self.floatSign(inst, un_op, ty); |
| 5290 | 5442 | } |
| 5291 | 5443 | |
| ... | ... | @@ -5305,7 +5457,7 @@ const RoundMode = packed struct(u5) { |
| 5305 | 5457 | precision: enum(u1) { |
| 5306 | 5458 | normal = 0b0, |
| 5307 | 5459 | inexact = 0b1, |
| 5308 | }, | |
| 5460 | } = .normal, | |
| 5309 | 5461 | }; |
| 5310 | 5462 | |
| 5311 | 5463 | fn 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 | 5523 | if (ty.zigTypeTag(mod) != .Float) |
| 5372 | 5524 | return self.fail("TODO implement genRound for {}", .{ty.fmt(mod)}); |
| 5373 | 5525 | |
| 5374 | var callee: ["__trunc?".len]u8 = undefined; | |
| 5526 | var callee_buf: ["__trunc?".len]u8 = undefined; | |
| 5375 | 5527 | return try self.genCall(.{ .lib = .{ |
| 5376 | 5528 | .return_type = ty.toIntern(), |
| 5377 | 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 | 5531 | floatLibcAbiPrefix(ty), |
| 5380 | 5532 | switch (mode.mode) { |
| 5381 | 5533 | .down => "floor", |
| ... | ... | @@ -5586,11 +5738,11 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void { |
| 5586 | 5738 | 80, 128 => true, |
| 5587 | 5739 | else => unreachable, |
| 5588 | 5740 | }) { |
| 5589 | var callee: ["__sqrt?".len]u8 = undefined; | |
| 5741 | var callee_buf: ["__sqrt?".len]u8 = undefined; | |
| 5590 | 5742 | break :result try self.genCall(.{ .lib = .{ |
| 5591 | 5743 | .return_type = ty.toIntern(), |
| 5592 | 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 | 5746 | floatLibcAbiPrefix(ty), |
| 5595 | 5747 | floatLibcAbiSuffix(ty), |
| 5596 | 5748 | }) catch unreachable, |
| ... | ... | @@ -5623,7 +5775,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void { |
| 5623 | 5775 | .{ .v_, .cvtps2ph }, |
| 5624 | 5776 | dst_reg, |
| 5625 | 5777 | dst_reg, |
| 5626 | Immediate.u(0b1_00), | |
| 5778 | Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))), | |
| 5627 | 5779 | ); |
| 5628 | 5780 | break :result dst_mcv; |
| 5629 | 5781 | }, |
| ... | ... | @@ -5653,7 +5805,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void { |
| 5653 | 5805 | .{ .v_, .cvtps2ph }, |
| 5654 | 5806 | dst_reg, |
| 5655 | 5807 | dst_reg, |
| 5656 | Immediate.u(0b1_00), | |
| 5808 | Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))), | |
| 5657 | 5809 | ); |
| 5658 | 5810 | break :result dst_mcv; |
| 5659 | 5811 | }, |
| ... | ... | @@ -5678,7 +5830,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void { |
| 5678 | 5830 | .{ .v_, .cvtps2ph }, |
| 5679 | 5831 | dst_reg, |
| 5680 | 5832 | wide_reg, |
| 5681 | Immediate.u(0b1_00), | |
| 5833 | Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))), | |
| 5682 | 5834 | ); |
| 5683 | 5835 | break :result dst_mcv; |
| 5684 | 5836 | }, |
| ... | ... | @@ -5741,11 +5893,11 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void { |
| 5741 | 5893 | fn airUnaryMath(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 5742 | 5894 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 5743 | 5895 | const ty = self.typeOf(un_op); |
| 5744 | var callee: ["__round?".len]u8 = undefined; | |
| 5896 | var callee_buf: ["__round?".len]u8 = undefined; | |
| 5745 | 5897 | const result = try self.genCall(.{ .lib = .{ |
| 5746 | 5898 | .return_type = ty.toIntern(), |
| 5747 | 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 | 5901 | floatLibcAbiPrefix(ty), |
| 5750 | 5902 | switch (tag) { |
| 5751 | 5903 | .sin, |
| ... | ... | @@ -5782,7 +5934,7 @@ fn reuseOperandAdvanced( |
| 5782 | 5934 | operand: Air.Inst.Ref, |
| 5783 | 5935 | op_index: Liveness.OperandInt, |
| 5784 | 5936 | mcv: MCValue, |
| 5785 | tracked_inst: Air.Inst.Index, | |
| 5937 | maybe_tracked_inst: ?Air.Inst.Index, | |
| 5786 | 5938 | ) bool { |
| 5787 | 5939 | if (!self.liveness.operandDies(inst, op_index)) |
| 5788 | 5940 | return false; |
| ... | ... | @@ -5791,11 +5943,13 @@ fn reuseOperandAdvanced( |
| 5791 | 5943 | .register, .register_pair => for (mcv.getRegs()) |reg| { |
| 5792 | 5944 | // If it's in the registers table, need to associate the register(s) with the |
| 5793 | 5945 | // new instruction. |
| 5794 | if (!self.register_manager.isRegFree(reg)) { | |
| 5795 | if (RegisterManager.indexOfRegIntoTracked(reg)) |index| { | |
| 5796 | self.register_manager.registers[index] = tracked_inst; | |
| 5946 | if (maybe_tracked_inst) |tracked_inst| { | |
| 5947 | if (!self.register_manager.isRegFree(reg)) { | |
| 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 | 5954 | .load_frame => |frame_addr| if (frame_addr.index.isNamed()) return false, |
| 5801 | 5955 | else => return false, |
| ... | ... | @@ -5804,7 +5958,7 @@ fn reuseOperandAdvanced( |
| 5804 | 5958 | // Prevent the operand deaths processing code from deallocating it. |
| 5805 | 5959 | self.liveness.clearOperandDeath(inst, op_index); |
| 5806 | 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); | |
| 5808 | 5962 | |
| 5809 | 5963 | return true; |
| 5810 | 5964 | } |
| ... | ... | @@ -6934,11 +7088,11 @@ fn genMulDivBinOp( |
| 6934 | 7088 | ), |
| 6935 | 7089 | else => {}, |
| 6936 | 7090 | }; |
| 6937 | var callee: ["__udiv?i3".len]u8 = undefined; | |
| 7091 | var callee_buf: ["__udiv?i3".len]u8 = undefined; | |
| 6938 | 7092 | return try self.genCall(.{ .lib = .{ |
| 6939 | 7093 | .return_type = dst_ty.toIntern(), |
| 6940 | 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 | 7096 | if (signed) "" else "u", |
| 6943 | 7097 | switch (tag) { |
| 6944 | 7098 | .div_trunc, .div_exact => "div", |
| ... | ... | @@ -7161,43 +7315,163 @@ fn genBinOp( |
| 7161 | 7315 | const rhs_ty = self.typeOf(rhs_air); |
| 7162 | 7316 | const abi_size: u32 = @intCast(lhs_ty.abiSize(mod)); |
| 7163 | 7317 | |
| 7164 | if (lhs_ty.isRuntimeFloat() and (air_tag == .rem or switch (lhs_ty.floatBits(self.target.*)) { | |
| 7165 | 16 => !self.hasFeature(.f16c), | |
| 7166 | 32, 64 => false, | |
| 7167 | 80, 128 => true, | |
| 7168 | else => unreachable, | |
| 7169 | })) { | |
| 7170 | var callee: ["__mod?f3".len]u8 = undefined; | |
| 7318 | if (lhs_ty.isRuntimeFloat()) libcall: { | |
| 7319 | const float_bits = lhs_ty.floatBits(self.target.*); | |
| 7320 | const type_needs_libcall = switch (float_bits) { | |
| 7321 | 16 => !self.hasFeature(.f16c), | |
| 7322 | 32, 64 => false, | |
| 7323 | 80, 128 => true, | |
| 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 | 7356 | const result = try self.genCall(.{ .lib = .{ |
| 7172 | 7357 | .return_type = lhs_ty.toIntern(), |
| 7173 | 7358 | .param_types = &.{ lhs_ty.toIntern(), rhs_ty.toIntern() }, |
| 7174 | .callee = switch (air_tag) { | |
| 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, | |
| 7359 | .callee = callee, | |
| 7199 | 7360 | } }, &.{ lhs_ty, rhs_ty }, &.{ .{ .air_ref = lhs_air }, .{ .air_ref = rhs_air } }); |
| 7200 | 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 | 7475 | .div_trunc, .div_floor => try self.genRoundLibcall(lhs_ty, result, .{ |
| 7202 | 7476 | .mode = switch (air_tag) { |
| 7203 | 7477 | .div_trunc => .zero, |
| ... | ... | @@ -7219,6 +7493,7 @@ fn genBinOp( |
| 7219 | 7493 | |
| 7220 | 7494 | const maybe_mask_reg = switch (air_tag) { |
| 7221 | 7495 | else => null, |
| 7496 | .rem, .mod => unreachable, | |
| 7222 | 7497 | .max, .min => if (lhs_ty.scalarType(mod).isRuntimeFloat()) registerAlias( |
| 7223 | 7498 | if (!self.hasFeature(.avx) and self.hasFeature(.sse4_1)) mask: { |
| 7224 | 7499 | try self.register_manager.getReg(.xmm0, null); |
| ... | ... | @@ -7226,20 +7501,23 @@ fn genBinOp( |
| 7226 | 7501 | } else try self.register_manager.allocReg(null, abi.RegisterClass.sse), |
| 7227 | 7502 | abi_size, |
| 7228 | 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 | 7505 | const mask_lock = |
| 7234 | 7506 | if (maybe_mask_reg) |mask_reg| self.register_manager.lockRegAssumeUnused(mask_reg) else null; |
| 7235 | 7507 | defer if (mask_lock) |lock| self.register_manager.unlockReg(lock); |
| 7236 | 7508 | |
| 7237 | const lhs_mcv = try self.resolveInst(lhs_air); | |
| 7238 | const rhs_mcv = try self.resolveInst(rhs_air); | |
| 7509 | const ordered_air = if (lhs_ty.isVector(mod) and lhs_ty.childType(mod).isAbiInt(mod) and | |
| 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 | 7517 | switch (lhs_mcv) { |
| 7240 | 7518 | .immediate => |imm| switch (imm) { |
| 7241 | 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 | 7521 | else => {}, |
| 7244 | 7522 | }, |
| 7245 | 7523 | else => {}, |
| ... | ... | @@ -7288,11 +7566,15 @@ fn genBinOp( |
| 7288 | 7566 | var copied_to_dst = true; |
| 7289 | 7567 | const dst_mcv: MCValue = dst: { |
| 7290 | 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 | 7575 | break :dst lhs_mcv; |
| 7293 | } | |
| 7294 | 7576 | 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 | 7579 | flipped = true; |
| 7298 | 7580 | break :dst rhs_mcv; |
| ... | ... | @@ -7613,7 +7895,7 @@ fn genBinOp( |
| 7613 | 7895 | .{ .v_, .cvtps2ph }, |
| 7614 | 7896 | dst_reg, |
| 7615 | 7897 | dst_reg, |
| 7616 | Immediate.u(0b1_00), | |
| 7898 | Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))), | |
| 7617 | 7899 | ); |
| 7618 | 7900 | return dst_mcv; |
| 7619 | 7901 | }, |
| ... | ... | @@ -7657,7 +7939,10 @@ fn genBinOp( |
| 7657 | 7939 | .sub, |
| 7658 | 7940 | .sub_wrap, |
| 7659 | 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 | 7946 | .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" }, |
| 7662 | 7947 | .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor }, |
| 7663 | 7948 | .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { |
| ... | ... | @@ -7688,6 +7973,20 @@ fn genBinOp( |
| 7688 | 7973 | else |
| 7689 | 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 | 7990 | else => null, |
| 7692 | 7991 | }, |
| 7693 | 7992 | 17...32 => switch (air_tag) { |
| ... | ... | @@ -7708,6 +8007,17 @@ fn genBinOp( |
| 7708 | 8007 | .signed => if (self.hasFeature(.avx2)) .{ .vp_b, .maxs } else null, |
| 7709 | 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 | 8021 | else => null, |
| 7712 | 8022 | }, |
| 7713 | 8023 | else => null, |
| ... | ... | @@ -7723,7 +8033,10 @@ fn genBinOp( |
| 7723 | 8033 | .mul, |
| 7724 | 8034 | .mul_wrap, |
| 7725 | 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 | 8040 | .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" }, |
| 7728 | 8041 | .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor }, |
| 7729 | 8042 | .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { |
| ... | ... | @@ -7746,6 +8059,20 @@ fn genBinOp( |
| 7746 | 8059 | else |
| 7747 | 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 | 8076 | else => null, |
| 7750 | 8077 | }, |
| 7751 | 8078 | 9...16 => switch (air_tag) { |
| ... | ... | @@ -7769,6 +8096,17 @@ fn genBinOp( |
| 7769 | 8096 | .signed => if (self.hasFeature(.avx2)) .{ .vp_w, .maxs } else null, |
| 7770 | 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 | 8110 | else => null, |
| 7773 | 8111 | }, |
| 7774 | 8112 | else => null, |
| ... | ... | @@ -7789,7 +8127,10 @@ fn genBinOp( |
| 7789 | 8127 | .{ .p_d, .mull } |
| 7790 | 8128 | else |
| 7791 | 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 | 8134 | .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" }, |
| 7794 | 8135 | .xor => if (self.hasFeature(.avx)) .{ .vp_, .xor } else .{ .p_, .xor }, |
| 7795 | 8136 | .min => switch (lhs_ty.childType(mod).intInfo(mod).signedness) { |
| ... | ... | @@ -7820,6 +8161,20 @@ fn genBinOp( |
| 7820 | 8161 | else |
| 7821 | 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 | 8178 | else => null, |
| 7824 | 8179 | }, |
| 7825 | 8180 | 5...8 => switch (air_tag) { |
| ... | ... | @@ -7843,6 +8198,17 @@ fn genBinOp( |
| 7843 | 8198 | .signed => if (self.hasFeature(.avx2)) .{ .vp_d, .maxs } else null, |
| 7844 | 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 | 8212 | else => null, |
| 7847 | 8213 | }, |
| 7848 | 8214 | else => null, |
| ... | ... | @@ -7855,9 +8221,33 @@ fn genBinOp( |
| 7855 | 8221 | .sub, |
| 7856 | 8222 | .sub_wrap, |
| 7857 | 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 | 8228 | .bit_or => if (self.hasFeature(.avx)) .{ .vp_, .@"or" } else .{ .p_, .@"or" }, |
| 7860 | 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 | 8251 | else => null, |
| 7862 | 8252 | }, |
| 7863 | 8253 | 3...4 => switch (air_tag) { |
| ... | ... | @@ -7870,6 +8260,17 @@ fn genBinOp( |
| 7870 | 8260 | .bit_and => if (self.hasFeature(.avx2)) .{ .vp_, .@"and" } else null, |
| 7871 | 8261 | .bit_or => if (self.hasFeature(.avx2)) .{ .vp_, .@"or" } else null, |
| 7872 | 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 | 8274 | else => null, |
| 7874 | 8275 | }, |
| 7875 | 8276 | else => null, |
| ... | ... | @@ -7923,7 +8324,7 @@ fn genBinOp( |
| 7923 | 8324 | .{ .v_, .cvtps2ph }, |
| 7924 | 8325 | dst_reg, |
| 7925 | 8326 | dst_reg, |
| 7926 | Immediate.u(0b1_00), | |
| 8327 | Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))), | |
| 7927 | 8328 | ); |
| 7928 | 8329 | return dst_mcv; |
| 7929 | 8330 | }, |
| ... | ... | @@ -7974,7 +8375,7 @@ fn genBinOp( |
| 7974 | 8375 | .{ .v_, .cvtps2ph }, |
| 7975 | 8376 | dst_reg, |
| 7976 | 8377 | dst_reg, |
| 7977 | Immediate.u(0b1_00), | |
| 8378 | Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))), | |
| 7978 | 8379 | ); |
| 7979 | 8380 | return dst_mcv; |
| 7980 | 8381 | }, |
| ... | ... | @@ -8017,7 +8418,7 @@ fn genBinOp( |
| 8017 | 8418 | .{ .v_, .cvtps2ph }, |
| 8018 | 8419 | dst_reg, |
| 8019 | 8420 | dst_reg, |
| 8020 | Immediate.u(0b1_00), | |
| 8421 | Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))), | |
| 8021 | 8422 | ); |
| 8022 | 8423 | return dst_mcv; |
| 8023 | 8424 | }, |
| ... | ... | @@ -8060,7 +8461,7 @@ fn genBinOp( |
| 8060 | 8461 | .{ .v_, .cvtps2ph }, |
| 8061 | 8462 | dst_reg, |
| 8062 | 8463 | dst_reg.to256(), |
| 8063 | Immediate.u(0b1_00), | |
| 8464 | Immediate.u(@as(u5, @bitCast(RoundMode{ .mode = .mxcsr }))), | |
| 8064 | 8465 | ); |
| 8065 | 8466 | return dst_mcv; |
| 8066 | 8467 | }, |
| ... | ... | @@ -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 | 8895 | else => unreachable, |
| 8439 | 8896 | } |
| 8440 | 8897 | |
| ... | ... | @@ -9378,11 +9835,11 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 9378 | 9835 | 80, 128 => true, |
| 9379 | 9836 | else => unreachable, |
| 9380 | 9837 | }) { |
| 9381 | var callee: ["__???f2".len]u8 = undefined; | |
| 9838 | var callee_buf: ["__???f2".len]u8 = undefined; | |
| 9382 | 9839 | const ret = try self.genCall(.{ .lib = .{ |
| 9383 | 9840 | .return_type = .i32_type, |
| 9384 | 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 | 9843 | switch (op) { |
| 9387 | 9844 | .eq => "eq", |
| 9388 | 9845 | .neq => "ne", |
| ... | ... | @@ -9741,8 +10198,15 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 9741 | 10198 | } |
| 9742 | 10199 | |
| 9743 | 10200 | fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void { |
| 9744 | _ = inst; | |
| 9745 | return self.fail("TODO implement airCmpVector for {}", .{self.target.cpu.arch}); | |
| 10201 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | |
| 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 | } |
| 9747 | 10211 | |
| 9748 | 10212 | fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void { |
| ... | ... | @@ -10507,29 +10971,41 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 10507 | 10971 | }, |
| 10508 | 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 | 10976 | const arg_mcv: MCValue = arg_mcv: { |
| 10511 | const arg_maybe_reg: ?Register = if (mem.eql(u8, constraint[1..], "r")) | |
| 10512 | self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse | |
| 10513 | return self.fail("ran out of registers lowering inline asm", .{}) | |
| 10514 | else if (mem.eql(u8, constraint[1..], "m")) | |
| 10977 | const arg_maybe_reg: ?Register = if (mem.eql(u8, rest, "r") or | |
| 10978 | mem.eql(u8, rest, "f") or mem.eql(u8, rest, "x")) | |
| 10979 | registerAlias( | |
| 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 | 10989 | if (output != .none) null else return self.fail( |
| 10516 | 10990 | "memory constraint unsupported for asm result: '{s}'", |
| 10517 | 10991 | .{constraint}, |
| 10518 | 10992 | ) |
| 10519 | else if (mem.eql(u8, constraint[1..], "g") or | |
| 10520 | mem.eql(u8, constraint[1..], "rm") or mem.eql(u8, constraint[1..], "mr") or | |
| 10521 | mem.eql(u8, constraint[1..], "r,m") or mem.eql(u8, constraint[1..], "m,r")) | |
| 10522 | self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse | |
| 10993 | else if (mem.eql(u8, rest, "g") or | |
| 10994 | mem.eql(u8, rest, "rm") or mem.eql(u8, rest, "mr") or | |
| 10995 | mem.eql(u8, rest, "r,m") or mem.eql(u8, rest, "m,r")) | |
| 10996 | self.register_manager.tryAllocReg(maybe_inst, abi.RegisterClass.gp) orelse | |
| 10523 | 10997 | if (output != .none) |
| 10524 | 10998 | null |
| 10525 | 10999 | else |
| 10526 | 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..], "}")) | |
| 10528 | parseRegName(constraint[1 + "{".len .. constraint.len - "}".len]) orelse | |
| 11001 | else if (mem.startsWith(u8, rest, "{") and mem.endsWith(u8, rest, "}")) | |
| 11002 | parseRegName(rest["{".len .. rest.len - "}".len]) orelse | |
| 10529 | 11003 | return self.fail("invalid register constraint: '{s}'", .{constraint}) |
| 10530 | else if (constraint.len == 2 and std.ascii.isDigit(constraint[1])) { | |
| 10531 | const index = std.fmt.charToDigit(constraint[0], 10) catch unreachable; | |
| 10532 | if (index >= args.items.len) return self.fail("constraint out of bounds: '{s}'", .{constraint}); | |
| 11004 | else if (rest.len == 1 and std.ascii.isDigit(rest[0])) { | |
| 11005 | const index = std.fmt.charToDigit(rest[0], 10) catch unreachable; | |
| 11006 | if (index >= args.items.len) return self.fail("constraint out of bounds: '{s}'", .{ | |
| 11007 | constraint, | |
| 11008 | }); | |
| 10533 | 11009 | break :arg_mcv args.items[index]; |
| 10534 | 11010 | } else return self.fail("invalid constraint: '{s}'", .{constraint}); |
| 10535 | 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 | 11039 | |
| 10564 | 11040 | const ty = self.typeOf(input); |
| 10565 | 11041 | const input_mcv = try self.resolveInst(input); |
| 10566 | const arg_mcv: MCValue = if (mem.eql(u8, constraint, "r")) switch (input_mcv) { | |
| 10567 | .register => input_mcv, | |
| 10568 | else => .{ .register = try self.copyToTmpRegister(ty, input_mcv) }, | |
| 10569 | } else if (mem.eql(u8, constraint, "m")) arg: { | |
| 11042 | const arg_mcv: MCValue = if (mem.eql(u8, constraint, "r") or | |
| 11043 | mem.eql(u8, constraint, "f") or mem.eql(u8, constraint, "x")) | |
| 11044 | 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 | 11065 | switch (input_mcv) { |
| 10571 | 11066 | .memory => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_| |
| 10572 | 11067 | break :arg input_mcv, |
| ... | ... | @@ -10790,6 +11285,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 10790 | 11285 | arg_map.get(op_str["%[".len .. colon orelse op_str.len - "]".len]) orelse |
| 10791 | 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 | 11292 | .register => |reg| if (mem.eql(u8, modifier, "")) |
| 10794 | 11293 | .{ .reg = reg } |
| 10795 | 11294 | else |
| ... | ... | @@ -10816,6 +11315,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 10816 | 11315 | ) } |
| 10817 | 11316 | else |
| 10818 | 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 | 11322 | else => return self.fail("invalid constraint: '{s}'", .{op_str}), |
| 10820 | 11323 | }; |
| 10821 | 11324 | } else if (mem.startsWith(u8, op_str, "$")) { |
| ... | ... | @@ -10918,6 +11421,13 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 10918 | 11421 | .none => self.asmRegisterImmediate(mnem_fixed_tag, reg1, imm0), |
| 10919 | 11422 | .reg => |reg2| switch (ops[3]) { |
| 10920 | 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 | 11431 | else => error.InvalidInstruction, |
| 10922 | 11432 | }, |
| 10923 | 11433 | .mem => |mem2| switch (ops[3]) { |
| ... | ... | @@ -11988,11 +12498,11 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { |
| 11988 | 12498 | src_ty.fmt(mod), dst_ty.fmt(mod), |
| 11989 | 12499 | }); |
| 11990 | 12500 | |
| 11991 | var callee: ["__floatun?i?f".len]u8 = undefined; | |
| 12501 | var callee_buf: ["__floatun?i?f".len]u8 = undefined; | |
| 11992 | 12502 | break :result try self.genCall(.{ .lib = .{ |
| 11993 | 12503 | .return_type = dst_ty.toIntern(), |
| 11994 | 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 | 12506 | switch (src_signedness) { |
| 11997 | 12507 | .signed => "", |
| 11998 | 12508 | .unsigned => "un", |
| ... | ... | @@ -12067,11 +12577,11 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { |
| 12067 | 12577 | src_ty.fmt(mod), dst_ty.fmt(mod), |
| 12068 | 12578 | }); |
| 12069 | 12579 | |
| 12070 | var callee: ["__fixuns?f?i".len]u8 = undefined; | |
| 12580 | var callee_buf: ["__fixuns?f?i".len]u8 = undefined; | |
| 12071 | 12581 | break :result try self.genCall(.{ .lib = .{ |
| 12072 | 12582 | .return_type = dst_ty.toIntern(), |
| 12073 | 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 | 12585 | switch (dst_signedness) { |
| 12076 | 12586 | .signed => "", |
| 12077 | 12587 | .unsigned => "uns", |
| ... | ... | @@ -12592,7 +13102,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 12592 | 13102 | .{ .i_, .mul }, |
| 12593 | 13103 | len_reg, |
| 12594 | 13104 | len_reg, |
| 12595 | Immediate.u(elem_abi_size), | |
| 13105 | Immediate.s(elem_abi_size), | |
| 12596 | 13106 | ); |
| 12597 | 13107 | try self.genInlineMemcpy(second_elem_ptr_mcv, ptr, len_mcv); |
| 12598 | 13108 | |
| ... | ... | @@ -12645,8 +13155,23 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void { |
| 12645 | 13155 | defer if (src_ptr_lock) |lock| self.register_manager.unlockReg(lock); |
| 12646 | 13156 | |
| 12647 | 13157 | const len: MCValue = switch (dst_ptr_ty.ptrSize(mod)) { |
| 12648 | .Slice => dst_ptr.address().offset(8).deref(), | |
| 12649 | .One => .{ .immediate = dst_ptr_ty.childType(mod).arrayLen(mod) }, | |
| 13158 | .Slice => len: { | |
| 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 | 13175 | .C, .Many => unreachable, |
| 12651 | 13176 | }; |
| 12652 | 13177 | const len_lock: ?RegisterLock = switch (len) { |
| ... | ... | @@ -12999,10 +13524,60 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void { |
| 12999 | 13524 | } |
| 13000 | 13525 | |
| 13001 | 13526 | fn airReduce(self: *Self, inst: Air.Inst.Index) !void { |
| 13527 | const mod = self.bin_file.options.module.?; | |
| 13002 | 13528 | const reduce = self.air.instructions.items(.data)[inst].reduce; |
| 13003 | _ = reduce; | |
| 13004 | return self.fail("TODO implement airReduce for x86_64", .{}); | |
| 13005 | //return self.finishAir(inst, result, .{ reduce.operand, .none, .none }); | |
| 13529 | ||
| 13530 | const result: MCValue = result: { | |
| 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 | } |
| 13007 | 13582 | |
| 13008 | 13583 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| ... | ... | @@ -13215,11 +13790,11 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void { |
| 13215 | 13790 | ty.fmt(mod), |
| 13216 | 13791 | }); |
| 13217 | 13792 | |
| 13218 | var callee: ["__fma?".len]u8 = undefined; | |
| 13793 | var callee_buf: ["__fma?".len]u8 = undefined; | |
| 13219 | 13794 | break :result try self.genCall(.{ .lib = .{ |
| 13220 | 13795 | .return_type = ty.toIntern(), |
| 13221 | 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 | 13798 | floatLibcAbiPrefix(ty), |
| 13224 | 13799 | floatLibcAbiSuffix(ty), |
| 13225 | 13800 | }) catch unreachable, |
src/arch/x86_64/Emit.zig+6-6| ... | ... | @@ -19,18 +19,18 @@ pub const Error = Lower.Error || error{ |
| 19 | 19 | |
| 20 | 20 | pub fn emitMir(emit: *Emit) Error!void { |
| 21 | 21 | for (0..emit.lower.mir.instructions.len) |mir_i| { |
| 22 | const mir_index = @as(Mir.Inst.Index, @intCast(mir_i)); | |
| 22 | const mir_index: Mir.Inst.Index = @intCast(mir_i); | |
| 23 | 23 | try emit.code_offset_mapping.putNoClobber( |
| 24 | 24 | emit.lower.allocator, |
| 25 | 25 | mir_index, |
| 26 | @as(u32, @intCast(emit.code.items.len)), | |
| 26 | @intCast(emit.code.items.len), | |
| 27 | 27 | ); |
| 28 | 28 | const lowered = try emit.lower.lowerMir(mir_index); |
| 29 | 29 | var lowered_relocs = lowered.relocs; |
| 30 | 30 | for (lowered.insts, 0..) |lowered_inst, lowered_index| { |
| 31 | const start_offset = @as(u32, @intCast(emit.code.items.len)); | |
| 31 | const start_offset: u32 = @intCast(emit.code.items.len); | |
| 32 | 32 | try lowered_inst.encode(emit.code.writer(), .{}); |
| 33 | const end_offset = @as(u32, @intCast(emit.code.items.len)); | |
| 33 | const end_offset: u32 = @intCast(emit.code.items.len); | |
| 34 | 34 | while (lowered_relocs.len > 0 and |
| 35 | 35 | lowered_relocs[0].lowered_inst_index == lowered_index) : ({ |
| 36 | 36 | lowered_relocs = lowered_relocs[1..]; |
| ... | ... | @@ -39,7 +39,7 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 39 | 39 | .source = start_offset, |
| 40 | 40 | .target = target, |
| 41 | 41 | .offset = end_offset - 4, |
| 42 | .length = @as(u5, @intCast(end_offset - start_offset)), | |
| 42 | .length = @intCast(end_offset - start_offset), | |
| 43 | 43 | }), |
| 44 | 44 | .linker_extern_fn => |symbol| if (emit.bin_file.cast(link.File.Elf)) |elf_file| { |
| 45 | 45 | // Add relocation to the decl. |
| ... | ... | @@ -220,7 +220,7 @@ const Reloc = struct { |
| 220 | 220 | /// Target of the relocation. |
| 221 | 221 | target: Mir.Inst.Index, |
| 222 | 222 | /// Offset of the relocation within the instruction. |
| 223 | offset: usize, | |
| 223 | offset: u32, | |
| 224 | 224 | /// Length of the instruction. |
| 225 | 225 | length: u5, |
| 226 | 226 | }; |
src/arch/x86_64/Encoding.zig+39-8| ... | ... | @@ -266,7 +266,12 @@ pub const Mnemonic = enum { |
| 266 | 266 | packssdw, packsswb, packuswb, |
| 267 | 267 | paddb, paddd, paddq, paddsb, paddsw, paddusb, paddusw, paddw, |
| 268 | 268 | pand, pandn, por, pxor, |
| 269 | pcmpeqb, pcmpeqd, pcmpeqw, | |
| 270 | pcmpgtb, pcmpgtd, pcmpgtw, | |
| 269 | 271 | pmulhw, pmullw, |
| 272 | pslld, psllq, psllw, | |
| 273 | psrad, psraw, | |
| 274 | psrld, psrlq, psrlw, | |
| 270 | 275 | psubb, psubd, psubq, psubsb, psubsw, psubusb, psubusw, psubw, |
| 271 | 276 | // SSE |
| 272 | 277 | addps, addss, |
| ... | ... | @@ -278,11 +283,12 @@ pub const Mnemonic = enum { |
| 278 | 283 | maxps, maxss, |
| 279 | 284 | minps, minss, |
| 280 | 285 | movaps, movhlps, movlhps, |
| 286 | movmskps, | |
| 281 | 287 | movss, movups, |
| 282 | 288 | mulps, mulss, |
| 283 | 289 | orps, |
| 284 | 290 | pextrw, pinsrw, |
| 285 | pmaxsw, pmaxub, pminsw, pminub, | |
| 291 | pmaxsw, pmaxub, pminsw, pminub, pmovmskb, | |
| 286 | 292 | shufps, |
| 287 | 293 | sqrtps, sqrtss, |
| 288 | 294 | subps, subss, |
| ... | ... | @@ -301,12 +307,13 @@ pub const Mnemonic = enum { |
| 301 | 307 | minpd, minsd, |
| 302 | 308 | movapd, |
| 303 | 309 | movdqa, movdqu, |
| 310 | movmskpd, | |
| 304 | 311 | //movsd, |
| 305 | 312 | movupd, |
| 306 | 313 | mulpd, mulsd, |
| 307 | 314 | orpd, |
| 308 | pshufhw, pshuflw, | |
| 309 | psrld, psrlq, psrlw, | |
| 315 | pshufd, pshufhw, pshuflw, | |
| 316 | pslldq, psrldq, | |
| 310 | 317 | punpckhbw, punpckhdq, punpckhqdq, punpckhwd, |
| 311 | 318 | punpcklbw, punpckldq, punpcklqdq, punpcklwd, |
| 312 | 319 | shufpd, |
| ... | ... | @@ -317,19 +324,29 @@ pub const Mnemonic = enum { |
| 317 | 324 | // SSE3 |
| 318 | 325 | movddup, movshdup, movsldup, |
| 319 | 326 | // SSSE3 |
| 320 | pabsb, pabsd, pabsw, | |
| 327 | pabsb, pabsd, pabsw, palignr, | |
| 321 | 328 | // SSE4.1 |
| 322 | 329 | blendpd, blendps, blendvpd, blendvps, |
| 323 | 330 | extractps, |
| 324 | 331 | insertps, |
| 325 | 332 | packusdw, |
| 333 | pcmpeqq, | |
| 326 | 334 | pextrb, pextrd, pextrq, |
| 327 | 335 | pinsrb, pinsrd, pinsrq, |
| 328 | 336 | pmaxsb, pmaxsd, pmaxud, pmaxuw, pminsb, pminsd, pminud, pminuw, |
| 329 | 337 | pmulld, |
| 330 | 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 | 347 | // AVX |
| 332 | 348 | vaddpd, vaddps, vaddsd, vaddss, |
| 349 | vaesdec, vaesdeclast, vaesenc, vaesenclast, vaesimc, vaeskeygenassist, | |
| 333 | 350 | vandnpd, vandnps, vandpd, vandps, |
| 334 | 351 | vblendpd, vblendps, vblendvpd, vblendvps, |
| 335 | 352 | vbroadcastf128, vbroadcastsd, vbroadcastss, |
| ... | ... | @@ -348,6 +365,7 @@ pub const Mnemonic = enum { |
| 348 | 365 | vmovddup, |
| 349 | 366 | vmovdqa, vmovdqu, |
| 350 | 367 | vmovhlps, vmovlhps, |
| 368 | vmovmskpd, vmovmskps, | |
| 351 | 369 | vmovq, |
| 352 | 370 | vmovsd, |
| 353 | 371 | vmovshdup, vmovsldup, |
| ... | ... | @@ -358,15 +376,20 @@ pub const Mnemonic = enum { |
| 358 | 376 | vpabsb, vpabsd, vpabsw, |
| 359 | 377 | vpackssdw, vpacksswb, vpackusdw, vpackuswb, |
| 360 | 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 | 382 | vpextrb, vpextrd, vpextrq, vpextrw, |
| 363 | 383 | vpinsrb, vpinsrd, vpinsrq, vpinsrw, |
| 364 | 384 | vpmaxsb, vpmaxsd, vpmaxsw, vpmaxub, vpmaxud, vpmaxuw, |
| 365 | 385 | vpminsb, vpminsd, vpminsw, vpminub, vpminud, vpminuw, |
| 386 | vpmovmskb, | |
| 366 | 387 | vpmulhw, vpmulld, vpmullw, |
| 367 | 388 | vpor, |
| 368 | vpshufhw, vpshuflw, | |
| 369 | vpsrld, vpsrlq, vpsrlw, | |
| 389 | vpshufd, vpshufhw, vpshuflw, | |
| 390 | vpslld, vpslldq, vpsllq, vpsllw, | |
| 391 | vpsrad, vpsraq, vpsraw, | |
| 392 | vpsrld, vpsrldq, vpsrlq, vpsrlw, | |
| 370 | 393 | vpsubb, vpsubd, vpsubq, vpsubsb, vpsubsw, vpsubusb, vpsubusw, vpsubw, |
| 371 | 394 | vpunpckhbw, vpunpckhdq, vpunpckhqdq, vpunpckhwd, |
| 372 | 395 | vpunpcklbw, vpunpckldq, vpunpcklqdq, vpunpcklwd, |
| ... | ... | @@ -742,6 +765,8 @@ pub const Mode = enum { |
| 742 | 765 | |
| 743 | 766 | pub const Feature = enum { |
| 744 | 767 | none, |
| 768 | aes, | |
| 769 | @"aes avx", | |
| 745 | 770 | avx, |
| 746 | 771 | avx2, |
| 747 | 772 | bmi, |
| ... | ... | @@ -749,12 +774,18 @@ pub const Feature = enum { |
| 749 | 774 | fma, |
| 750 | 775 | lzcnt, |
| 751 | 776 | movbe, |
| 777 | pclmul, | |
| 778 | @"pclmul avx", | |
| 752 | 779 | popcnt, |
| 753 | 780 | sse, |
| 754 | 781 | sse2, |
| 755 | 782 | sse3, |
| 756 | 783 | sse4_1, |
| 784 | sse4_2, | |
| 757 | 785 | ssse3, |
| 786 | sha, | |
| 787 | vaes, | |
| 788 | vpclmulqdq, | |
| 758 | 789 | x87, |
| 759 | 790 | }; |
| 760 | 791 | |
| ... | ... | @@ -772,7 +803,7 @@ fn estimateInstructionLength(prefix: Prefix, encoding: Encoding, ops: []const Op |
| 772 | 803 | } |
| 773 | 804 | |
| 774 | 805 | const mnemonic_to_encodings_map = init: { |
| 775 | @setEvalBranchQuota(50_000); | |
| 806 | @setEvalBranchQuota(60_000); | |
| 776 | 807 | const encodings = @import("encodings.zig"); |
| 777 | 808 | var entries = encodings.table; |
| 778 | 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 | 190 | .pseudo_probe_align_ri_s => { |
| 191 | 191 | try lower.emit(.none, .@"test", &.{ |
| 192 | 192 | .{ .reg = inst.data.ri.r1 }, |
| 193 | .{ .imm = Immediate.s(@as(i32, @bitCast(inst.data.ri.i))) }, | |
| 193 | .{ .imm = Immediate.s(@bitCast(inst.data.ri.i)) }, | |
| 194 | 194 | }); |
| 195 | 195 | try lower.emit(.none, .jz, &.{ |
| 196 | 196 | .{ .imm = lower.reloc(.{ .inst = index + 1 }) }, |
| ... | ... | @@ -226,14 +226,14 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { |
| 226 | 226 | } |
| 227 | 227 | try lower.emit(.none, .sub, &.{ |
| 228 | 228 | .{ .reg = inst.data.ri.r1 }, |
| 229 | .{ .imm = Immediate.s(@as(i32, @bitCast(inst.data.ri.i))) }, | |
| 229 | .{ .imm = Immediate.s(@bitCast(inst.data.ri.i)) }, | |
| 230 | 230 | }); |
| 231 | 231 | assert(lower.result_insts_len <= pseudo_probe_adjust_unrolled_max_insts); |
| 232 | 232 | }, |
| 233 | 233 | .pseudo_probe_adjust_setup_rri_s => { |
| 234 | 234 | try lower.emit(.none, .mov, &.{ |
| 235 | 235 | .{ .reg = inst.data.rri.r2.to32() }, |
| 236 | .{ .imm = Immediate.s(@as(i32, @bitCast(inst.data.rri.i))) }, | |
| 236 | .{ .imm = Immediate.s(@bitCast(inst.data.rri.i)) }, | |
| 237 | 237 | }); |
| 238 | 238 | try lower.emit(.none, .sub, &.{ |
| 239 | 239 | .{ .reg = inst.data.rri.r1 }, |
| ... | ... | @@ -291,7 +291,9 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate { |
| 291 | 291 | .i_s, |
| 292 | 292 | .mi_sib_s, |
| 293 | 293 | .mi_rip_s, |
| 294 | => Immediate.s(@as(i32, @bitCast(i))), | |
| 294 | .rmi_sib_s, | |
| 295 | .rmi_rip_s, | |
| 296 | => Immediate.s(@bitCast(i)), | |
| 295 | 297 | |
| 296 | 298 | .rrri, |
| 297 | 299 | .rri_u, |
| ... | ... | @@ -301,6 +303,8 @@ fn imm(lower: Lower, ops: Mir.Inst.Ops, i: u32) Immediate { |
| 301 | 303 | .mi_rip_u, |
| 302 | 304 | .rmi_sib, |
| 303 | 305 | .rmi_rip, |
| 306 | .rmi_sib_u, | |
| 307 | .rmi_rip_u, | |
| 304 | 308 | .mri_sib, |
| 305 | 309 | .mri_rip, |
| 306 | 310 | .rrm_sib, |
| ... | ... | @@ -319,6 +323,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory { |
| 319 | 323 | return lower.mir.resolveFrameLoc(switch (ops) { |
| 320 | 324 | .rm_sib, |
| 321 | 325 | .rmi_sib, |
| 326 | .rmi_sib_s, | |
| 327 | .rmi_sib_u, | |
| 322 | 328 | .m_sib, |
| 323 | 329 | .mi_sib_u, |
| 324 | 330 | .mi_sib_s, |
| ... | ... | @@ -335,6 +341,8 @@ fn mem(lower: Lower, ops: Mir.Inst.Ops, payload: u32) Memory { |
| 335 | 341 | |
| 336 | 342 | .rm_rip, |
| 337 | 343 | .rmi_rip, |
| 344 | .rmi_rip_s, | |
| 345 | .rmi_rip_u, | |
| 338 | 346 | .m_rip, |
| 339 | 347 | .mi_rip_u, |
| 340 | 348 | .mi_rip_s, |
| ... | ... | @@ -383,13 +391,29 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { |
| 383 | 391 | .rrri => inst.data.rrri.fixes, |
| 384 | 392 | .rri_s, .rri_u => inst.data.rri.fixes, |
| 385 | 393 | .ri_s, .ri_u => inst.data.ri.fixes, |
| 386 | .ri64, .rm_sib, .rm_rip, .mr_sib, .mr_rip => inst.data.rx.fixes, | |
| 394 | .ri64, | |
| 395 | .rm_sib, | |
| 396 | .rm_rip, | |
| 397 | .rmi_sib_s, | |
| 398 | .rmi_sib_u, | |
| 399 | .rmi_rip_s, | |
| 400 | .rmi_rip_u, | |
| 401 | .mr_sib, | |
| 402 | .mr_rip, | |
| 403 | => inst.data.rx.fixes, | |
| 387 | 404 | .mrr_sib, .mrr_rip, .rrm_sib, .rrm_rip => inst.data.rrx.fixes, |
| 388 | 405 | .rmi_sib, .rmi_rip, .mri_sib, .mri_rip => inst.data.rix.fixes, |
| 389 | 406 | .rrmi_sib, .rrmi_rip => inst.data.rrix.fixes, |
| 390 | 407 | .mi_sib_u, .mi_rip_u, .mi_sib_s, .mi_rip_s => inst.data.x.fixes, |
| 391 | 408 | .m_sib, .m_rip, .rax_moffs, .moffs_rax => inst.data.x.fixes, |
| 392 | .extern_fn_reloc, .got_reloc, .extern_got_reloc, .direct_reloc, .direct_got_reloc, .import_reloc, .tlv_reloc => ._, | |
| 409 | .extern_fn_reloc, | |
| 410 | .got_reloc, | |
| 411 | .extern_got_reloc, | |
| 412 | .direct_reloc, | |
| 413 | .direct_got_reloc, | |
| 414 | .import_reloc, | |
| 415 | .tlv_reloc, | |
| 416 | => ._, | |
| 393 | 417 | else => return lower.fail("TODO lower .{s}", .{@tagName(inst.ops)}), |
| 394 | 418 | }; |
| 395 | 419 | try lower.emit(switch (fixes) { |
| ... | ... | @@ -461,7 +485,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { |
| 461 | 485 | .m_sib, .m_rip => &.{ |
| 462 | 486 | .{ .mem = lower.mem(inst.ops, inst.data.x.payload) }, |
| 463 | 487 | }, |
| 464 | .mi_sib_s, .mi_sib_u, .mi_rip_u, .mi_rip_s => &.{ | |
| 488 | .mi_sib_s, .mi_sib_u, .mi_rip_s, .mi_rip_u => &.{ | |
| 465 | 489 | .{ .mem = lower.mem(inst.ops, inst.data.x.payload + 1) }, |
| 466 | 490 | .{ .imm = lower.imm( |
| 467 | 491 | inst.ops, |
| ... | ... | @@ -477,6 +501,14 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { |
| 477 | 501 | .{ .mem = lower.mem(inst.ops, inst.data.rix.payload) }, |
| 478 | 502 | .{ .imm = lower.imm(inst.ops, inst.data.rix.i) }, |
| 479 | 503 | }, |
| 504 | .rmi_sib_s, .rmi_sib_u, .rmi_rip_s, .rmi_rip_u => &.{ | |
| 505 | .{ .reg = inst.data.rx.r1 }, | |
| 506 | .{ .mem = lower.mem(inst.ops, inst.data.rx.payload + 1) }, | |
| 507 | .{ .imm = lower.imm( | |
| 508 | inst.ops, | |
| 509 | lower.mir.extraData(Mir.Imm32, inst.data.rx.payload).data.imm, | |
| 510 | ) }, | |
| 511 | }, | |
| 480 | 512 | .mr_sib, .mr_rip => &.{ |
| 481 | 513 | .{ .mem = lower.mem(inst.ops, inst.data.rx.payload) }, |
| 482 | 514 | .{ .reg = inst.data.rx.r1 }, |
src/arch/x86_64/Mir.zig+83-33| ... | ... | @@ -474,6 +474,10 @@ pub const Inst = struct { |
| 474 | 474 | /// Bitwise logical and not of packed single-precision floating-point values |
| 475 | 475 | /// Bitwise logical and not of packed double-precision floating-point values |
| 476 | 476 | andn, |
| 477 | /// Compare packed data for equal | |
| 478 | cmpeq, | |
| 479 | /// Compare packed data for greater than | |
| 480 | cmpgt, | |
| 477 | 481 | /// Maximum of packed signed integers |
| 478 | 482 | maxs, |
| 479 | 483 | /// Maximum of packed unsigned integers |
| ... | ... | @@ -482,10 +486,20 @@ pub const Inst = struct { |
| 482 | 486 | mins, |
| 483 | 487 | /// Minimum of packed unsigned integers |
| 484 | 488 | minu, |
| 489 | /// Move byte mask | |
| 490 | /// Extract packed single precision floating-point sign mask | |
| 491 | /// Extract packed double precision floating-point sign mask | |
| 492 | movmsk, | |
| 485 | 493 | /// Multiply packed signed integers and store low result |
| 486 | 494 | mull, |
| 487 | 495 | /// Multiply packed signed integers and store high result |
| 488 | 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 | 503 | /// Subtract packed signed integers with signed saturation |
| 490 | 504 | subs, |
| 491 | 505 | /// Subtract packed unsigned integers with unsigned saturation |
| ... | ... | @@ -584,15 +598,13 @@ pub const Inst = struct { |
| 584 | 598 | movdqu, |
| 585 | 599 | /// Packed interleave shuffle of quadruplets of single-precision floating-point values |
| 586 | 600 | /// Packed interleave shuffle of pairs of double-precision floating-point values |
| 601 | /// Shuffle packed doublewords | |
| 602 | /// Shuffle packed words | |
| 587 | 603 | shuf, |
| 588 | 604 | /// Shuffle packed high words |
| 589 | 605 | shufh, |
| 590 | 606 | /// Shuffle packed low words |
| 591 | 607 | shufl, |
| 592 | /// Shift packed data right logical | |
| 593 | /// Shift packed data right logical | |
| 594 | /// Shift packed data right logical | |
| 595 | srl, | |
| 596 | 608 | /// Unpack high data |
| 597 | 609 | unpckhbw, |
| 598 | 610 | /// Unpack high data |
| ... | ... | @@ -617,6 +629,9 @@ pub const Inst = struct { |
| 617 | 629 | /// Replicate single floating-point values |
| 618 | 630 | movsldup, |
| 619 | 631 | |
| 632 | /// Packed align right | |
| 633 | alignr, | |
| 634 | ||
| 620 | 635 | /// Pack with unsigned saturation |
| 621 | 636 | ackusd, |
| 622 | 637 | /// Blend packed single-precision floating-point values |
| ... | ... | @@ -640,6 +655,29 @@ pub const Inst = struct { |
| 640 | 655 | /// Round scalar double-precision floating-point value |
| 641 | 656 | round, |
| 642 | 657 | |
| 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 | 681 | /// Load with broadcast floating-point data |
| 644 | 682 | broadcast, |
| 645 | 683 | |
| ... | ... | @@ -720,9 +758,24 @@ pub const Inst = struct { |
| 720 | 758 | /// Register, memory (RIP) operands. |
| 721 | 759 | /// Uses `rx` payload. |
| 722 | 760 | rm_rip, |
| 723 | /// Register, memory (SIB), immediate (byte) operands. | |
| 761 | /// Register, memory (SIB), immediate (word) operands. | |
| 724 | 762 | /// Uses `rix` payload with extra data of type `MemorySib`. |
| 725 | 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 | 779 | /// Register, register, memory (RIP). |
| 727 | 780 | /// Uses `rrix` payload with extra data of type `MemoryRip`. |
| 728 | 781 | rrm_rip, |
| ... | ... | @@ -735,27 +788,24 @@ pub const Inst = struct { |
| 735 | 788 | /// Register, register, memory (SIB), immediate (byte) operands. |
| 736 | 789 | /// Uses `rrix` payload with extra data of type `MemorySib`. |
| 737 | 790 | rrmi_sib, |
| 738 | /// Register, memory (RIP), immediate (byte) operands. | |
| 739 | /// Uses `rix` payload with extra data of type `MemoryRip`. | |
| 740 | rmi_rip, | |
| 741 | 791 | /// Single memory (SIB) operand. |
| 742 | 792 | /// Uses `x` with extra data of type `MemorySib`. |
| 743 | 793 | m_sib, |
| 744 | 794 | /// Single memory (RIP) operand. |
| 745 | 795 | /// Uses `x` with extra data of type `MemoryRip`. |
| 746 | 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 | 797 | /// Memory (SIB), immediate (sign-extend) operands. |
| 754 | 798 | /// Uses `x` payload with extra data of type `Imm32` followed by `MemorySib`. |
| 755 | 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 | 803 | /// Memory (RIP), immediate (sign-extend) operands. |
| 757 | 804 | /// Uses `x` payload with extra data of type `Imm32` followed by `MemoryRip`. |
| 758 | 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 | 809 | /// Memory (SIB), register operands. |
| 760 | 810 | /// Uses `rx` payload with extra data of type `MemorySib`. |
| 761 | 811 | mr_sib, |
| ... | ... | @@ -768,10 +818,10 @@ pub const Inst = struct { |
| 768 | 818 | /// Memory (RIP), register, register operands. |
| 769 | 819 | /// Uses `rrx` payload with extra data of type `MemoryRip`. |
| 770 | 820 | mrr_rip, |
| 771 | /// Memory (SIB), register, immediate (byte) operands. | |
| 821 | /// Memory (SIB), register, immediate (word) operands. | |
| 772 | 822 | /// Uses `rix` payload with extra data of type `MemorySib`. |
| 773 | 823 | mri_sib, |
| 774 | /// Memory (RIP), register, immediate (byte) operands. | |
| 824 | /// Memory (RIP), register, immediate (word) operands. | |
| 775 | 825 | /// Uses `rix` payload with extra data of type `MemoryRip`. |
| 776 | 826 | mri_rip, |
| 777 | 827 | /// Rax, Memory moffs. |
| ... | ... | @@ -955,7 +1005,7 @@ pub const Inst = struct { |
| 955 | 1005 | rix: struct { |
| 956 | 1006 | fixes: Fixes = ._, |
| 957 | 1007 | r1: Register, |
| 958 | i: u8, | |
| 1008 | i: u16, | |
| 959 | 1009 | payload: u32, |
| 960 | 1010 | }, |
| 961 | 1011 | /// Register, register, byte immediate, followed by Custom payload found in extra. |
| ... | ... | @@ -1010,7 +1060,7 @@ pub const RegisterList = struct { |
| 1010 | 1060 | |
| 1011 | 1061 | fn getIndexForReg(registers: []const Register, reg: Register) BitSet.MaskInt { |
| 1012 | 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 | 1065 | unreachable; // register not in input register list! |
| 1016 | 1066 | } |
| ... | ... | @@ -1030,7 +1080,7 @@ pub const RegisterList = struct { |
| 1030 | 1080 | } |
| 1031 | 1081 | |
| 1032 | 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 | }; |
| 1036 | 1086 | |
| ... | ... | @@ -1044,14 +1094,14 @@ pub const Imm64 = struct { |
| 1044 | 1094 | |
| 1045 | 1095 | pub fn encode(v: u64) Imm64 { |
| 1046 | 1096 | return .{ |
| 1047 | .msb = @as(u32, @truncate(v >> 32)), | |
| 1048 | .lsb = @as(u32, @truncate(v)), | |
| 1097 | .msb = @truncate(v >> 32), | |
| 1098 | .lsb = @truncate(v), | |
| 1049 | 1099 | }; |
| 1050 | 1100 | } |
| 1051 | 1101 | |
| 1052 | 1102 | pub fn decode(imm: Imm64) u64 { |
| 1053 | 1103 | var res: u64 = 0; |
| 1054 | res |= (@as(u64, @intCast(imm.msb)) << 32); | |
| 1104 | res |= @as(u64, @intCast(imm.msb)) << 32; | |
| 1055 | 1105 | res |= @as(u64, @intCast(imm.lsb)); |
| 1056 | 1106 | return res; |
| 1057 | 1107 | } |
| ... | ... | @@ -1075,7 +1125,7 @@ pub const MemorySib = struct { |
| 1075 | 1125 | assert(sib.scale_index.scale == 0 or std.math.isPowerOfTwo(sib.scale_index.scale)); |
| 1076 | 1126 | return .{ |
| 1077 | 1127 | .ptr_size = @intFromEnum(sib.ptr_size), |
| 1078 | .base_tag = @intFromEnum(@as(Memory.Base.Tag, sib.base)), | |
| 1128 | .base_tag = @intFromEnum(sib.base), | |
| 1079 | 1129 | .base = switch (sib.base) { |
| 1080 | 1130 | .none => undefined, |
| 1081 | 1131 | .reg => |r| @intFromEnum(r), |
| ... | ... | @@ -1091,18 +1141,18 @@ pub const MemorySib = struct { |
| 1091 | 1141 | } |
| 1092 | 1142 | |
| 1093 | 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 | 1145 | assert(scale == 0 or std.math.isPowerOfTwo(scale)); |
| 1096 | 1146 | return .{ .sib = .{ |
| 1097 | .ptr_size = @as(Memory.PtrSize, @enumFromInt(msib.ptr_size)), | |
| 1147 | .ptr_size = @enumFromInt(msib.ptr_size), | |
| 1098 | 1148 | .base = switch (@as(Memory.Base.Tag, @enumFromInt(msib.base_tag))) { |
| 1099 | 1149 | .none => .none, |
| 1100 | .reg => .{ .reg = @as(Register, @enumFromInt(msib.base)) }, | |
| 1101 | .frame => .{ .frame = @as(bits.FrameIndex, @enumFromInt(msib.base)) }, | |
| 1150 | .reg => .{ .reg = @enumFromInt(msib.base) }, | |
| 1151 | .frame => .{ .frame = @enumFromInt(msib.base) }, | |
| 1102 | 1152 | }, |
| 1103 | 1153 | .scale_index = .{ |
| 1104 | 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 | 1157 | .disp = msib.disp, |
| 1108 | 1158 | } }; |
| ... | ... | @@ -1124,7 +1174,7 @@ pub const MemoryRip = struct { |
| 1124 | 1174 | |
| 1125 | 1175 | pub fn decode(mrip: MemoryRip) Memory { |
| 1126 | 1176 | return .{ .rip = .{ |
| 1127 | .ptr_size = @as(Memory.PtrSize, @enumFromInt(mrip.ptr_size)), | |
| 1177 | .ptr_size = @enumFromInt(mrip.ptr_size), | |
| 1128 | 1178 | .disp = mrip.disp, |
| 1129 | 1179 | } }; |
| 1130 | 1180 | } |
| ... | ... | @@ -1141,14 +1191,14 @@ pub const MemoryMoffs = struct { |
| 1141 | 1191 | pub fn encode(seg: Register, offset: u64) MemoryMoffs { |
| 1142 | 1192 | return .{ |
| 1143 | 1193 | .seg = @intFromEnum(seg), |
| 1144 | .msb = @as(u32, @truncate(offset >> 32)), | |
| 1145 | .lsb = @as(u32, @truncate(offset >> 0)), | |
| 1194 | .msb = @truncate(offset >> 32), | |
| 1195 | .lsb = @truncate(offset >> 0), | |
| 1146 | 1196 | }; |
| 1147 | 1197 | } |
| 1148 | 1198 | |
| 1149 | 1199 | pub fn decode(moffs: MemoryMoffs) Memory { |
| 1150 | 1200 | return .{ .moffs = .{ |
| 1151 | .seg = @as(Register, @enumFromInt(moffs.seg)), | |
| 1201 | .seg = @enumFromInt(moffs.seg), | |
| 1152 | 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 | 1218 | inline for (fields) |field| { |
| 1169 | 1219 | @field(result, field.name) = switch (field.type) { |
| 1170 | 1220 | u32 => mir.extra[i], |
| 1171 | i32 => @as(i32, @bitCast(mir.extra[i])), | |
| 1221 | i32 => @bitCast(mir.extra[i]), | |
| 1172 | 1222 | else => @compileError("bad field type"), |
| 1173 | 1223 | }; |
| 1174 | 1224 | i += 1; |
src/arch/x86_64/bits.zig+10-10| ... | ... | @@ -232,7 +232,7 @@ pub const Register = enum(u7) { |
| 232 | 232 | else => unreachable, |
| 233 | 233 | // zig fmt: on |
| 234 | 234 | }; |
| 235 | return @as(u6, @intCast(@intFromEnum(reg) - base)); | |
| 235 | return @intCast(@intFromEnum(reg) - base); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | pub fn bitSize(reg: Register) u64 { |
| ... | ... | @@ -291,11 +291,11 @@ pub const Register = enum(u7) { |
| 291 | 291 | else => unreachable, |
| 292 | 292 | // zig fmt: on |
| 293 | 293 | }; |
| 294 | return @as(u4, @truncate(@intFromEnum(reg) - base)); | |
| 294 | return @truncate(@intFromEnum(reg) - base); | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | pub fn lowEnc(reg: Register) u3 { |
| 298 | return @as(u3, @truncate(reg.enc())); | |
| 298 | return @truncate(reg.enc()); | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | pub fn toBitSize(reg: Register, bit_size: u64) Register { |
| ... | ... | @@ -325,19 +325,19 @@ pub const Register = enum(u7) { |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | pub fn to64(reg: Register) Register { |
| 328 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.rax))); | |
| 328 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.rax)); | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | pub fn to32(reg: Register) Register { |
| 332 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.eax))); | |
| 332 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.eax)); | |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | pub fn to16(reg: Register) Register { |
| 336 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.ax))); | |
| 336 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.ax)); | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | pub fn to8(reg: Register) Register { |
| 340 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.al))); | |
| 340 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.al)); | |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | fn sseBase(reg: Register) u7 { |
| ... | ... | @@ -350,11 +350,11 @@ pub const Register = enum(u7) { |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | pub fn to256(reg: Register) Register { |
| 353 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.ymm0))); | |
| 353 | return @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.ymm0)); | |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | pub fn to128(reg: Register) Register { |
| 357 | return @as(Register, @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.xmm0))); | |
| 357 | return @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.xmm0)); | |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /// DWARF register encoding |
| ... | ... | @@ -619,7 +619,7 @@ pub const Immediate = union(enum) { |
| 619 | 619 | 1, 8 => @as(i8, @bitCast(@as(u8, @intCast(x)))), |
| 620 | 620 | 16 => @as(i16, @bitCast(@as(u16, @intCast(x)))), |
| 621 | 621 | 32 => @as(i32, @bitCast(@as(u32, @intCast(x)))), |
| 622 | 64 => @as(i64, @bitCast(x)), | |
| 622 | 64 => @bitCast(x), | |
| 623 | 623 | else => unreachable, |
| 624 | 624 | }, |
| 625 | 625 | }; |
src/arch/x86_64/encodings.zig+200-18| ... | ... | @@ -905,6 +905,9 @@ pub const table = [_]Entry{ |
| 905 | 905 | |
| 906 | 906 | .{ .movlhps, .rm, &.{ .xmm, .xmm }, &.{ 0x0f, 0x16 }, 0, .none, .sse }, |
| 907 | 907 | |
| 908 | .{ .movmskps, .rm, &.{ .r32, .xmm }, &.{ 0x0f, 0x50 }, 0, .none, .sse }, | |
| 909 | .{ .movmskps, .rm, &.{ .r64, .xmm }, &.{ 0x0f, 0x50 }, 0, .none, .sse }, | |
| 910 | ||
| 908 | 911 | .{ .movss, .rm, &.{ .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x10 }, 0, .none, .sse }, |
| 909 | 912 | .{ .movss, .mr, &.{ .xmm_m32, .xmm }, &.{ 0xf3, 0x0f, 0x11 }, 0, .none, .sse }, |
| 910 | 913 | |
| ... | ... | @@ -917,6 +920,9 @@ pub const table = [_]Entry{ |
| 917 | 920 | |
| 918 | 921 | .{ .orps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x56 }, 0, .none, .sse }, |
| 919 | 922 | |
| 923 | .{ .pmovmskb, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .none, .sse }, | |
| 924 | .{ .pmovmskb, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0xd7 }, 0, .none, .sse }, | |
| 925 | ||
| 920 | 926 | .{ .shufps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x0f, 0xc6 }, 0, .none, .sse }, |
| 921 | 927 | |
| 922 | 928 | .{ .sqrtps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x0f, 0x51 }, 0, .none, .sse }, |
| ... | ... | @@ -1005,6 +1011,12 @@ pub const table = [_]Entry{ |
| 1005 | 1011 | .{ .movdqu, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0xf3, 0x0f, 0x6f }, 0, .none, .sse2 }, |
| 1006 | 1012 | .{ .movdqu, .mr, &.{ .xmm_m128, .xmm }, &.{ 0xf3, 0x0f, 0x7f }, 0, .none, .sse2 }, |
| 1007 | 1013 | |
| 1014 | .{ .movmskpd, .rm, &.{ .r32, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .none, .sse2 }, | |
| 1015 | .{ .movmskpd, .rm, &.{ .r64, .xmm }, &.{ 0x66, 0x0f, 0x50 }, 0, .none, .sse2 }, | |
| 1016 | ||
| 1017 | .{ .movsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x10 }, 0, .none, .sse2 }, | |
| 1018 | .{ .movsd, .mr, &.{ .xmm_m64, .xmm }, &.{ 0xf2, 0x0f, 0x11 }, 0, .none, .sse2 }, | |
| 1019 | ||
| 1008 | 1020 | .{ .movq, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf3, 0x0f, 0x7e }, 0, .none, .sse2 }, |
| 1009 | 1021 | .{ .movq, .mr, &.{ .xmm_m64, .xmm }, &.{ 0x66, 0x0f, 0xd6 }, 0, .none, .sse2 }, |
| 1010 | 1022 | |
| ... | ... | @@ -1037,6 +1049,14 @@ pub const table = [_]Entry{ |
| 1037 | 1049 | |
| 1038 | 1050 | .{ .pandn, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .none, .sse2 }, |
| 1039 | 1051 | |
| 1052 | .{ .pcmpeqb, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x74 }, 0, .none, .sse2 }, | |
| 1053 | .{ .pcmpeqw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x75 }, 0, .none, .sse2 }, | |
| 1054 | .{ .pcmpeqd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x76 }, 0, .none, .sse2 }, | |
| 1055 | ||
| 1056 | .{ .pcmpgtb, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x64 }, 0, .none, .sse2 }, | |
| 1057 | .{ .pcmpgtw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x65 }, 0, .none, .sse2 }, | |
| 1058 | .{ .pcmpgtd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x66 }, 0, .none, .sse2 }, | |
| 1059 | ||
| 1040 | 1060 | .{ .pextrw, .rmi, &.{ .r32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0xc5 }, 0, .none, .sse2 }, |
| 1041 | 1061 | |
| 1042 | 1062 | .{ .pinsrw, .rmi, &.{ .xmm, .r32_m16, .imm8 }, &.{ 0x66, 0x0f, 0xc4 }, 0, .none, .sse2 }, |
| ... | ... | @@ -1055,10 +1075,26 @@ pub const table = [_]Entry{ |
| 1055 | 1075 | |
| 1056 | 1076 | .{ .por, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xeb }, 0, .none, .sse2 }, |
| 1057 | 1077 | |
| 1078 | .{ .pshufd, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x70 }, 0, .none, .sse2 }, | |
| 1079 | ||
| 1058 | 1080 | .{ .pshufhw, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0xf3, 0x0f, 0x70 }, 0, .none, .sse2 }, |
| 1059 | 1081 | |
| 1060 | 1082 | .{ .pshuflw, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0xf2, 0x0f, 0x70 }, 0, .none, .sse2 }, |
| 1061 | 1083 | |
| 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 | 1098 | .{ .psrlw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd1 }, 0, .none, .sse2 }, |
| 1063 | 1099 | .{ .psrlw, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 2, .none, .sse2 }, |
| 1064 | 1100 | .{ .psrld, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd2 }, 0, .none, .sse2 }, |
| ... | ... | @@ -1066,6 +1102,8 @@ pub const table = [_]Entry{ |
| 1066 | 1102 | .{ .psrlq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd3 }, 0, .none, .sse2 }, |
| 1067 | 1103 | .{ .psrlq, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 2, .none, .sse2 }, |
| 1068 | 1104 | |
| 1105 | .{ .psrldq, .mi, &.{ .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 3, .none, .sse2 }, | |
| 1106 | ||
| 1069 | 1107 | .{ .psubb, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf8 }, 0, .none, .sse2 }, |
| 1070 | 1108 | .{ .psubw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf9 }, 0, .none, .sse2 }, |
| 1071 | 1109 | .{ .psubd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xfa }, 0, .none, .sse2 }, |
| ... | ... | @@ -1100,9 +1138,6 @@ pub const table = [_]Entry{ |
| 1100 | 1138 | |
| 1101 | 1139 | .{ .subsd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0xf2, 0x0f, 0x5c }, 0, .none, .sse2 }, |
| 1102 | 1140 | |
| 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 | 1141 | .{ .ucomisd, .rm, &.{ .xmm, .xmm_m64 }, &.{ 0x66, 0x0f, 0x2e }, 0, .none, .sse2 }, |
| 1107 | 1142 | |
| 1108 | 1143 | .{ .xorpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x57 }, 0, .none, .sse2 }, |
| ... | ... | @@ -1122,13 +1157,17 @@ pub const table = [_]Entry{ |
| 1122 | 1157 | .{ .pabsw, .rm, &.{ .mm, .mm_m64 }, &.{ 0x0f, 0x38, 0x1d }, 0, .none, .ssse3 }, |
| 1123 | 1158 | .{ .pabsw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x1d }, 0, .none, .ssse3 }, |
| 1124 | 1159 | |
| 1160 | .{ .palignr, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0f }, 0, .none, .ssse3 }, | |
| 1161 | ||
| 1125 | 1162 | // SSE4.1 |
| 1126 | 1163 | .{ .blendpd, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0d }, 0, .none, .sse4_1 }, |
| 1127 | 1164 | |
| 1128 | 1165 | .{ .blendps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0c }, 0, .none, .sse4_1 }, |
| 1129 | 1166 | |
| 1167 | .{ .blendvpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x15 }, 0, .none, .sse4_1 }, | |
| 1130 | 1168 | .{ .blendvpd, .rm0, &.{ .xmm, .xmm_m128, .xmm0 }, &.{ 0x66, 0x0f, 0x38, 0x15 }, 0, .none, .sse4_1 }, |
| 1131 | 1169 | |
| 1170 | .{ .blendvps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x14 }, 0, .none, .sse4_1 }, | |
| 1132 | 1171 | .{ .blendvps, .rm0, &.{ .xmm, .xmm_m128, .xmm0 }, &.{ 0x66, 0x0f, 0x38, 0x14 }, 0, .none, .sse4_1 }, |
| 1133 | 1172 | |
| 1134 | 1173 | .{ .extractps, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x17 }, 0, .none, .sse4_1 }, |
| ... | ... | @@ -1137,6 +1176,8 @@ pub const table = [_]Entry{ |
| 1137 | 1176 | |
| 1138 | 1177 | .{ .packusdw, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x2b }, 0, .none, .sse4_1 }, |
| 1139 | 1178 | |
| 1179 | .{ .pcmpeqq, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x29 }, 0, .none, .sse4_1 }, | |
| 1180 | ||
| 1140 | 1181 | .{ .pextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .none, .sse4_1 }, |
| 1141 | 1182 | .{ .pextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .none, .sse4_1 }, |
| 1142 | 1183 | .{ .pextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .long, .sse4_1 }, |
| ... | ... | @@ -1171,6 +1212,33 @@ pub const table = [_]Entry{ |
| 1171 | 1212 | |
| 1172 | 1213 | .{ .roundss, .rmi, &.{ .xmm, .xmm_m32, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0a }, 0, .none, .sse4_1 }, |
| 1173 | 1214 | |
| 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 | 1242 | // AVX |
| 1175 | 1243 | .{ .vaddpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_128_wig, .avx }, |
| 1176 | 1244 | .{ .vaddpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x58 }, 0, .vex_256_wig, .avx }, |
| ... | ... | @@ -1182,6 +1250,18 @@ pub const table = [_]Entry{ |
| 1182 | 1250 | |
| 1183 | 1251 | .{ .vaddss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x58 }, 0, .vex_lig_wig, .avx }, |
| 1184 | 1252 | |
| 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 | 1265 | .{ .vandnpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x55 }, 0, .vex_128_wig, .avx }, |
| 1186 | 1266 | .{ .vandnpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x55 }, 0, .vex_256_wig, .avx }, |
| 1187 | 1267 | |
| ... | ... | @@ -1295,6 +1375,16 @@ pub const table = [_]Entry{ |
| 1295 | 1375 | |
| 1296 | 1376 | .{ .vmaxss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x5f }, 0, .vex_lig_wig, .avx }, |
| 1297 | 1377 | |
| 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 | 1388 | .{ .vminpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_128_wig, .avx }, |
| 1299 | 1389 | .{ .vminpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x5d }, 0, .vex_256_wig, .avx }, |
| 1300 | 1390 | |
| ... | ... | @@ -1404,10 +1494,26 @@ pub const table = [_]Entry{ |
| 1404 | 1494 | .{ .vpaddusb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdc }, 0, .vex_128_wig, .avx }, |
| 1405 | 1495 | .{ .vpaddusw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdd }, 0, .vex_128_wig, .avx }, |
| 1406 | 1496 | |
| 1497 | .{ .vpalignr, .rvmi, &.{ .xmm, .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0f }, 0, .vex_128_wig, .avx }, | |
| 1498 | ||
| 1407 | 1499 | .{ .vpand, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdb }, 0, .vex_128_wig, .avx }, |
| 1408 | 1500 | |
| 1409 | 1501 | .{ .vpandn, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_128_wig, .avx }, |
| 1410 | 1502 | |
| 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 | 1517 | .{ .vpextrb, .mri, &.{ .r32_m8, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x14 }, 0, .vex_128_w0, .avx }, |
| 1412 | 1518 | .{ .vpextrd, .mri, &.{ .rm32, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w0, .avx }, |
| 1413 | 1519 | .{ .vpextrq, .mri, &.{ .rm64, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x16 }, 0, .vex_128_w1, .avx }, |
| ... | ... | @@ -1439,6 +1545,9 @@ pub const table = [_]Entry{ |
| 1439 | 1545 | |
| 1440 | 1546 | .{ .vpminud, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x3b }, 0, .vex_128_wig, .avx }, |
| 1441 | 1547 | |
| 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 | 1551 | .{ .vpmulhw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xe5 }, 0, .vex_128_wig, .avx }, |
| 1443 | 1552 | |
| 1444 | 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 | 1556 | |
| 1448 | 1557 | .{ .vpor, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_128_wig, .avx }, |
| 1449 | 1558 | |
| 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 | 1579 | .{ .vpsrlw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd1 }, 0, .vex_128_wig, .avx }, |
| 1451 | 1580 | .{ .vpsrlw, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 2, .vex_128_wig, .avx }, |
| 1452 | 1581 | .{ .vpsrld, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd2 }, 0, .vex_128_wig, .avx }, |
| ... | ... | @@ -1454,6 +1583,8 @@ pub const table = [_]Entry{ |
| 1454 | 1583 | .{ .vpsrlq, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd3 }, 0, .vex_128_wig, .avx }, |
| 1455 | 1584 | .{ .vpsrlq, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 2, .vex_128_wig, .avx }, |
| 1456 | 1585 | |
| 1586 | .{ .vpsrldq, .vmi, &.{ .xmm, .xmm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 3, .vex_128_wig, .avx }, | |
| 1587 | ||
| 1457 | 1588 | .{ .vpsubb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf8 }, 0, .vex_128_wig, .avx }, |
| 1458 | 1589 | .{ .vpsubw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xf9 }, 0, .vex_128_wig, .avx }, |
| 1459 | 1590 | .{ .vpsubd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xfa }, 0, .vex_128_wig, .avx }, |
| ... | ... | @@ -1550,6 +1681,18 @@ pub const table = [_]Entry{ |
| 1550 | 1681 | .{ .vfmadd213ss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0x66, 0x0f, 0x38, 0xa9 }, 0, .vex_lig_w0, .fma }, |
| 1551 | 1682 | .{ .vfmadd231ss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0x66, 0x0f, 0x38, 0xb9 }, 0, .vex_lig_w0, .fma }, |
| 1552 | 1683 | |
| 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 | 1696 | // AVX2 |
| 1554 | 1697 | .{ .vbroadcastss, .rm, &.{ .xmm, .xmm }, &.{ 0x66, 0x0f, 0x38, 0x18 }, 0, .vex_128_w0, .avx2 }, |
| 1555 | 1698 | .{ .vbroadcastss, .rm, &.{ .ymm, .xmm }, &.{ 0x66, 0x0f, 0x38, 0x18 }, 0, .vex_256_w0, .avx2 }, |
| ... | ... | @@ -1577,36 +1720,73 @@ pub const table = [_]Entry{ |
| 1577 | 1720 | .{ .vpaddusb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdc }, 0, .vex_256_wig, .avx2 }, |
| 1578 | 1721 | .{ .vpaddusw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdd }, 0, .vex_256_wig, .avx2 }, |
| 1579 | 1722 | |
| 1723 | .{ .vpalignr, .rvmi, &.{ .ymm, .ymm, .ymm_m256, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x0f }, 0, .vex_256_wig, .avx2 }, | |
| 1724 | ||
| 1580 | 1725 | .{ .vpand, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdb }, 0, .vex_256_wig, .avx2 }, |
| 1581 | 1726 | |
| 1582 | 1727 | .{ .vpandn, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xdf }, 0, .vex_256_wig, .avx2 }, |
| 1583 | 1728 | |
| 1584 | .{ .vpmaxsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3c }, 0, .vex_256_wig, .avx }, | |
| 1585 | .{ .vpmaxsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xee }, 0, .vex_256_wig, .avx }, | |
| 1586 | .{ .vpmaxsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3d }, 0, .vex_256_wig, .avx }, | |
| 1729 | .{ .vpcmpeqb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x74 }, 0, .vex_256_wig, .avx2 }, | |
| 1730 | .{ .vpcmpeqw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x75 }, 0, .vex_256_wig, .avx2 }, | |
| 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 }, | |
| 1587 | 1744 | |
| 1588 | .{ .vpmaxub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xde }, 0, .vex_256_wig, .avx }, | |
| 1589 | .{ .vpmaxuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3e }, 0, .vex_256_wig, .avx }, | |
| 1745 | .{ .vpmaxub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xde }, 0, .vex_256_wig, .avx2 }, | |
| 1746 | .{ .vpmaxuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3e }, 0, .vex_256_wig, .avx2 }, | |
| 1590 | 1747 | |
| 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 }, | |
| 1592 | 1749 | |
| 1593 | .{ .vpminsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x38 }, 0, .vex_256_wig, .avx }, | |
| 1594 | .{ .vpminsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xea }, 0, .vex_256_wig, .avx }, | |
| 1595 | .{ .vpminsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x39 }, 0, .vex_256_wig, .avx }, | |
| 1750 | .{ .vpminsb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x38 }, 0, .vex_256_wig, .avx2 }, | |
| 1751 | .{ .vpminsw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xea }, 0, .vex_256_wig, .avx2 }, | |
| 1752 | .{ .vpminsd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x39 }, 0, .vex_256_wig, .avx2 }, | |
| 1596 | 1753 | |
| 1597 | .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx }, | |
| 1598 | .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx }, | |
| 1754 | .{ .vpminub, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xda }, 0, .vex_256_wig, .avx2 }, | |
| 1755 | .{ .vpminuw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x3a }, 0, .vex_256_wig, .avx2 }, | |
| 1599 | 1756 | |
| 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 }, | |
| 1601 | 1758 | |
| 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 }, | |
| 1603 | 1761 | |
| 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 }, | |
| 1605 | 1763 | |
| 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 }, | |
| 1607 | 1767 | |
| 1608 | 1768 | .{ .vpor, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xeb }, 0, .vex_256_wig, .avx2 }, |
| 1609 | 1769 | |
| 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 | 1790 | .{ .vpsrlw, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd1 }, 0, .vex_256_wig, .avx2 }, |
| 1611 | 1791 | .{ .vpsrlw, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x71 }, 2, .vex_256_wig, .avx2 }, |
| 1612 | 1792 | .{ .vpsrld, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd2 }, 0, .vex_256_wig, .avx2 }, |
| ... | ... | @@ -1614,6 +1794,8 @@ pub const table = [_]Entry{ |
| 1614 | 1794 | .{ .vpsrlq, .rvm, &.{ .ymm, .ymm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd3 }, 0, .vex_256_wig, .avx2 }, |
| 1615 | 1795 | .{ .vpsrlq, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 2, .vex_256_wig, .avx2 }, |
| 1616 | 1796 | |
| 1797 | .{ .vpsrldq, .vmi, &.{ .ymm, .ymm, .imm8 }, &.{ 0x66, 0x0f, 0x73 }, 3, .vex_128_wig, .avx2 }, | |
| 1798 | ||
| 1617 | 1799 | .{ .vpsubb, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xf8 }, 0, .vex_256_wig, .avx2 }, |
| 1618 | 1800 | .{ .vpsubw, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0xf9 }, 0, .vex_256_wig, .avx2 }, |
| 1619 | 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 | |
| 12 | 12 | test "@bitReverse" { |
| 13 | 13 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 14 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 15 | 14 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 16 | 15 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 17 | 16 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 18 | 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; | |
| 19 | 19 | |
| 20 | 20 | try comptime testBitReverse(); |
| 21 | 21 | try testBitReverse(); |
test/behavior/byteswap.zig+1-1| ... | ... | @@ -4,11 +4,11 @@ const expect = std.testing.expect; |
| 4 | 4 | |
| 5 | 5 | test "@byteSwap integers" { |
| 6 | 6 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 7 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 8 | 7 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 9 | 8 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 10 | 9 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 11 | 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; | |
| 12 | 12 | |
| 13 | 13 | const ByteSwapIntTest = struct { |
| 14 | 14 | fn run() !void { |
test/behavior/math.zig+2-2| ... | ... | @@ -1321,7 +1321,7 @@ test "remainder division" { |
| 1321 | 1321 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1322 | 1322 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1323 | 1323 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1324 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1324 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 1325 | 1325 | if (builtin.zig_backend == .stage2_c and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest; |
| 1326 | 1326 | |
| 1327 | 1327 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { |
| ... | ... | @@ -1401,9 +1401,9 @@ test "float modulo division using @mod" { |
| 1401 | 1401 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1402 | 1402 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1403 | 1403 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1404 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1405 | 1404 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1406 | 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; | |
| 1407 | 1407 | |
| 1408 | 1408 | try comptime fmod(f16); |
| 1409 | 1409 | try comptime fmod(f32); |
test/behavior/popcount.zig-1| ... | ... | @@ -14,7 +14,6 @@ test "@popCount integers" { |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | test "@popCount 128bit integer" { |
| 17 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 18 | 17 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 19 | 18 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 20 | 19 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |