authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-04-14 05:07:11-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-04-24 11:08:01-04:00
log453df509b889c9b855cd0eeccc53a0363092403f
tree7f71d093b28cacfa762906d681e0999babf350bd
parent24bf4387088cb2bee7329642c169a09dc48a7af0

change runtime representation of restricted values


17 files changed, 1582 insertions(+), 825 deletions(-)

src/Compilation/Config.zig+5-1
...@@ -501,7 +501,11 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -501,7 +501,11 @@ pub fn resolve(options: Options) ResolveError!Config {
501 };501 };
502 };502 };
503503
504 const backend_supports_error_tracing = target_util.backendSupportsFeature(backend, options.incremental, .error_return_trace);504 const backend_supports_error_tracing = target_util.backendSupportsFeature(.error_return_trace, .{
505 .backend = backend,
506 .incremental = options.incremental,
507 .use_new_linker = use_new_linker,
508 });
505509
506 const root_error_tracing = b: {510 const root_error_tracing = b: {
507 if (options.root_error_tracing) |x| break :b x;511 if (options.root_error_tracing) |x| break :b x;
src/Type.zig+22-65
...@@ -1017,10 +1017,10 @@ pub fn abiAlignment(ty: Type, zcu: *const Zcu) Alignment {...@@ -1017,10 +1017,10 @@ pub fn abiAlignment(ty: Type, zcu: *const Zcu) Alignment {
10171017
1018 .generic_poison => unreachable,1018 .generic_poison => unreachable,
1019 },1019 },
1020 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {1020 .restricted_type => |restricted_type| if (zcu.backendSupportsFeature(.restricted_types))
1021 .indirect => ptrAbiAlignment(target),1021 .fromByteUnits(std.zig.target.intAlignment(target, 32))
1022 .direct => return abiAlignment(.fromInterned(restricted_type.unrestricted_type), zcu),1022 else
1023 },1023 abiAlignment(.fromInterned(restricted_type.unrestricted_type), zcu),
1024 .tuple_type => |tuple| {1024 .tuple_type => |tuple| {
1025 var big_align: Alignment = .@"1";1025 var big_align: Alignment = .@"1";
1026 for (tuple.types.get(ip), tuple.values.get(ip)) |field_ty, val| {1026 for (tuple.types.get(ip), tuple.values.get(ip)) |field_ty, val| {
...@@ -1171,10 +1171,10 @@ pub fn abiSize(ty: Type, zcu: *const Zcu) u64 {...@@ -1171,10 +1171,10 @@ pub fn abiSize(ty: Type, zcu: *const Zcu) u64 {
1171 .anyopaque => unreachable,1171 .anyopaque => unreachable,
1172 .generic_poison => unreachable,1172 .generic_poison => unreachable,
1173 },1173 },
1174 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {1174 .restricted_type => |restricted_type| if (zcu.backendSupportsFeature(.restricted_types))
1175 .indirect => ptrAbiSize(target),1175 std.zig.target.intByteSize(target, 32)
1176 .direct => return abiSize(.fromInterned(restricted_type.unrestricted_type), zcu),1176 else
1177 },1177 abiSize(.fromInterned(restricted_type.unrestricted_type), zcu),
1178 .tuple_type => |tuple| switch (ty.classify(zcu)) {1178 .tuple_type => |tuple| switch (ty.classify(zcu)) {
1179 // `structFieldOffset` is bogus on NPV tuples, because there may be some fields with1179 // `structFieldOffset` is bogus on NPV tuples, because there may be some fields with
1180 // non-zero size.1180 // non-zero size.
...@@ -1301,10 +1301,10 @@ pub fn bitSize(ty: Type, zcu: *const Zcu) u64 {...@@ -1301,10 +1301,10 @@ pub fn bitSize(ty: Type, zcu: *const Zcu) u64 {
1301 .generic_poison => unreachable,1301 .generic_poison => unreachable,
1302 },1302 },
13031303
1304 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {1304 .restricted_type => |restricted_type| if (zcu.backendSupportsFeature(.restricted_types))
1305 .indirect => target.ptrBitWidth(),1305 32
1306 .direct => return bitSize(.fromInterned(restricted_type.unrestricted_type), zcu),1306 else
1307 },1307 bitSize(.fromInterned(restricted_type.unrestricted_type), zcu),
1308 .struct_type => {1308 .struct_type => {
1309 const struct_obj = ip.loadStructType(ty.toIntern());1309 const struct_obj = ip.loadStructType(ty.toIntern());
1310 switch (struct_obj.layout) {1310 switch (struct_obj.layout) {
...@@ -1362,17 +1362,6 @@ pub fn unrestrictedType(ty: Type, zcu: *const Zcu) ?Type {...@@ -1362,17 +1362,6 @@ pub fn unrestrictedType(ty: Type, zcu: *const Zcu) ?Type {
1362 };1362 };
1363}1363}
13641364
1365const RestrictedRepr = enum { indirect, direct };
1366pub fn restrictedRepr(ty: Type, zcu: *const Zcu) RestrictedRepr {
1367 return restrictedReprByTrackedInst(zcu.intern_pool.indexToKey(ty.toIntern()).restricted_type.zir_index, zcu);
1368}
1369pub fn restrictedReprByTrackedInst(zir_index: InternPool.TrackedInst.Index, zcu: *const Zcu) RestrictedRepr {
1370 return switch (zcu.fileByIndex(zir_index.resolveFile(&zcu.intern_pool)).mod.?.optimize_mode) {
1371 .Debug, .ReleaseSafe => if (zcu.backendSupportsFeature(.restricted_types)) .indirect else .direct,
1372 .ReleaseFast, .ReleaseSmall => .direct,
1373 };
1374}
1375
1376pub fn isSinglePointer(ty: Type, zcu: *const Zcu) bool {1365pub fn isSinglePointer(ty: Type, zcu: *const Zcu) bool {
1377 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {1366 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
1378 .ptr_type => |ptr_info| ptr_info.flags.size == .one,1367 .ptr_type => |ptr_info| ptr_info.flags.size == .one,
...@@ -1450,24 +1439,16 @@ pub fn isCPtr(ty: Type, zcu: *const Zcu) bool {...@@ -1450,24 +1439,16 @@ pub fn isCPtr(ty: Type, zcu: *const Zcu) bool {
14501439
1451pub fn isPtrAtRuntime(ty: Type, zcu: *const Zcu) bool {1440pub fn isPtrAtRuntime(ty: Type, zcu: *const Zcu) bool {
1452 const ip = &zcu.intern_pool;1441 const ip = &zcu.intern_pool;
1453 return ty: switch (ip.indexToKey(ty.toIntern())) {1442 return switch (ip.indexToKey(ty.toIntern())) {
1454 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {1443 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
1455 .slice => false,1444 .slice => false,
1456 .one, .many, .c => true,1445 .one, .many, .c => true,
1457 },1446 },
1458 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {1447 .opt_type => |child| switch (ip.indexToKey(child)) {
1459 .indirect => true,
1460 .direct => continue :ty ip.indexToKey(restricted_type.unrestricted_type),
1461 },
1462 .opt_type => |child| opt_child: switch (ip.indexToKey(child)) {
1463 .ptr_type => |p| switch (p.flags.size) {1448 .ptr_type => |p| switch (p.flags.size) {
1464 .slice, .c => false,1449 .slice, .c => false,
1465 .many, .one => !p.flags.is_allowzero,1450 .many, .one => !p.flags.is_allowzero,
1466 },1451 },
1467 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {
1468 .indirect => true,
1469 .direct => continue :opt_child ip.indexToKey(restricted_type.unrestricted_type),
1470 },
1471 else => false,1452 else => false,
1472 },1453 },
1473 else => false,1454 else => false,
...@@ -1483,21 +1464,13 @@ pub fn ptrAllowsZero(ty: Type, zcu: *const Zcu) bool {...@@ -1483,21 +1464,13 @@ pub fn ptrAllowsZero(ty: Type, zcu: *const Zcu) bool {
1483/// See also `isPtrLikeOptional`.1464/// See also `isPtrLikeOptional`.
1484pub fn optionalReprIsPayload(ty: Type, zcu: *const Zcu) bool {1465pub fn optionalReprIsPayload(ty: Type, zcu: *const Zcu) bool {
1485 const ip = &zcu.intern_pool;1466 const ip = &zcu.intern_pool;
1486 return ty: switch (ip.indexToKey(ty.toIntern())) {1467 return switch (ip.indexToKey(ty.toIntern())) {
1487 .ptr_type => |ptr_type| ptr_type.flags.size == .c,1468 .ptr_type => |ptr_type| ptr_type.flags.size == .c,
1488 .opt_type => |opt_child_type| opt_child_type == .anyerror_type or opt_child: switch (ip.indexToKey(opt_child_type)) {1469 .opt_type => |opt_child_type| opt_child_type == .anyerror_type or switch (ip.indexToKey(opt_child_type)) {
1489 .ptr_type => |ptr_type| ptr_type.flags.size != .c and !ptr_type.flags.is_allowzero,1470 .ptr_type => |ptr_type| ptr_type.flags.size != .c and !ptr_type.flags.is_allowzero,
1490 .error_set_type, .inferred_error_set_type => true,1471 .error_set_type, .inferred_error_set_type => true,
1491 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {
1492 .indirect => true,
1493 .direct => continue :opt_child ip.indexToKey(restricted_type.unrestricted_type),
1494 },
1495 else => false,1472 else => false,
1496 },1473 },
1497 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {
1498 .indirect => false,
1499 .direct => continue :ty ip.indexToKey(restricted_type.unrestricted_type),
1500 },
1501 else => false,1474 else => false,
1502 };1475 };
1503}1476}
...@@ -1506,23 +1479,15 @@ pub fn optionalReprIsPayload(ty: Type, zcu: *const Zcu) bool {...@@ -1506,23 +1479,15 @@ pub fn optionalReprIsPayload(ty: Type, zcu: *const Zcu) bool {
1506/// address value, using 0 for null. Note that this returns true for C pointers.1479/// address value, using 0 for null. Note that this returns true for C pointers.
1507pub fn isPtrLikeOptional(ty: Type, zcu: *const Zcu) bool {1480pub fn isPtrLikeOptional(ty: Type, zcu: *const Zcu) bool {
1508 const ip = &zcu.intern_pool;1481 const ip = &zcu.intern_pool;
1509 return ty: switch (ip.indexToKey(ty.toIntern())) {1482 return switch (ip.indexToKey(ty.toIntern())) {
1510 .ptr_type => |ptr_type| ptr_type.flags.size == .c,1483 .ptr_type => |ptr_type| ptr_type.flags.size == .c,
1511 .opt_type => |opt_child_type| opt_child: switch (ip.indexToKey(opt_child_type)) {1484 .opt_type => |opt_child_type| switch (ip.indexToKey(opt_child_type)) {
1512 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {1485 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
1513 .slice, .c => false,1486 .slice, .c => false,
1514 .many, .one => !ptr_type.flags.is_allowzero,1487 .many, .one => !ptr_type.flags.is_allowzero,
1515 },1488 },
1516 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {
1517 .indirect => true,
1518 .direct => continue :opt_child ip.indexToKey(restricted_type.unrestricted_type),
1519 },
1520 else => false,1489 else => false,
1521 },1490 },
1522 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {
1523 .indirect => false,
1524 .direct => continue :ty ip.indexToKey(restricted_type.unrestricted_type),
1525 },
1526 else => false,1491 else => false,
1527 };1492 };
1528}1493}
...@@ -2056,20 +2021,12 @@ pub fn fnCallingConvention(ty: Type, zcu: *const Zcu) std.builtin.CallingConvent...@@ -2056,20 +2021,12 @@ pub fn fnCallingConvention(ty: Type, zcu: *const Zcu) std.builtin.CallingConvent
2056 return zcu.intern_pool.indexToKey(ty.toIntern()).func_type.cc;2021 return zcu.intern_pool.indexToKey(ty.toIntern()).func_type.cc;
2057}2022}
20582023
2059pub fn isValidParamType(self: Type, zcu: *const Zcu) bool {2024pub fn isValidParamType(ty: Type, zcu: *const Zcu) bool {
2060 if (self.toIntern() == .generic_poison_type) return true;2025 return ty.toIntern() == .noreturn_type or ty.isValidReturnType(zcu);
2061 return switch (self.zigTypeTag(zcu)) {
2062 .@"opaque", .noreturn => false,
2063 else => true,
2064 };
2065}2026}
20662027
2067pub fn isValidReturnType(self: Type, zcu: *const Zcu) bool {2028pub fn isValidReturnType(ty: Type, zcu: *const Zcu) bool {
2068 if (self.toIntern() == .generic_poison_type) return true;2029 return ty.toIntern() == .generic_poison_type or !zcu.intern_pool.isOpaqueType(ty.toIntern());
2069 return switch (self.zigTypeTag(zcu)) {
2070 .@"opaque" => false,
2071 else => true,
2072 };
2073}2030}
20742031
2075/// Asserts the type is a function.2032/// Asserts the type is a function.
src/Zcu.zig+5-1
...@@ -4001,7 +4001,11 @@ pub const Feature = enum {...@@ -4001,7 +4001,11 @@ pub const Feature = enum {
40014001
4002pub fn backendSupportsFeature(zcu: *const Zcu, comptime feature: Feature) bool {4002pub fn backendSupportsFeature(zcu: *const Zcu, comptime feature: Feature) bool {
4003 const backend = target_util.zigBackend(&zcu.root_mod.resolved_target.result, zcu.comp.config.use_llvm);4003 const backend = target_util.zigBackend(&zcu.root_mod.resolved_target.result, zcu.comp.config.use_llvm);
4004 return target_util.backendSupportsFeature(backend, zcu.comp.config.incremental, feature);4004 return target_util.backendSupportsFeature(feature, .{
4005 .backend = backend,
4006 .incremental = zcu.comp.config.incremental,
4007 .use_new_linker = zcu.comp.config.use_new_linker,
4008 });
4005}4009}
40064010
4007pub const AtomicPtrAlignmentError = error{4011pub const AtomicPtrAlignmentError = error{
src/codegen.zig+40-52
...@@ -233,6 +233,7 @@ const LazySymbolStructure = struct {...@@ -233,6 +233,7 @@ const LazySymbolStructure = struct {
233233
234 pub const Operation = enum {234 pub const Operation = enum {
235 end_ptr_inc,235 end_ptr_inc,
236 append_restricted,
236237
237 pub fn apply(operation: Operation, slice: []u8, target_opts: struct {238 pub fn apply(operation: Operation, slice: []u8, target_opts: struct {
238 ptr_bit_width: u16,239 ptr_bit_width: u16,
...@@ -253,6 +254,7 @@ const LazySymbolStructure = struct {...@@ -253,6 +254,7 @@ const LazySymbolStructure = struct {
253 );254 );
254 },255 },
255 },256 },
257 .append_restricted => unreachable,
256 }258 }
257 }259 }
258 };260 };
...@@ -290,16 +292,6 @@ pub fn getLazySymbolInfo(...@@ -290,16 +292,6 @@ pub fn getLazySymbolInfo(
290 .structure => .{},292 .structure => .{},
291 .attributes => .{ .required_alignment = .@"1" },293 .attributes => .{ .required_alignment = .@"1" },
292 },294 },
293 .restricted_type => |restricted_type| switch (kind) {
294 .structure => .{},
295 .attributes => {
296 const restricted_ty: Type = .fromInterned(lazy_sym.key);
297 const unrestricted_ty: Type =
298 .fromInterned(restricted_type.unrestricted_type);
299 return .{ .required_alignment = restricted_ty.abiAlignment(zcu)
300 .maxStrict(unrestricted_ty.abiAlignment(zcu)) };
301 },
302 },
303 },295 },
304 .deferred_const_data => switch (lazy_sym.key) {296 .deferred_const_data => switch (lazy_sym.key) {
305 else => unreachable,297 else => unreachable,
...@@ -309,33 +301,14 @@ pub fn getLazySymbolInfo(...@@ -309,33 +301,14 @@ pub fn getLazySymbolInfo(
309 },301 },
310 _ => switch (ip.indexToKey(lazy_sym.key)) {302 _ => switch (ip.indexToKey(lazy_sym.key)) {
311 else => unreachable,303 else => unreachable,
312 .restricted_value => |restricted_value| switch (kind) {304 .restricted_type => |restricted_type| switch (kind) {
313 .structure => .{ .parent = .{ .kind = .const_data, .key = restricted_value.ty }, .modify = .{305 .structure => .{},
314 .lazy_sym = .{ .kind = .deferred_const_data, .key = restricted_value.ty },
315 .operation = .end_ptr_inc,
316 } },
317 .attributes => {
318 const unrestricted_ty: Type = .fromInterned(
319 ip.indexToKey(restricted_value.ty).restricted_type.unrestricted_type,
320 );
321 return .{
322 .required_alignment = unrestricted_ty.abiAlignment(zcu),
323 .size = unrestricted_ty.abiSize(zcu),
324 };
325 },
326 },
327 .restricted_type => switch (kind) {
328 .structure => .{ .parent = .{ .kind = .const_data, .key = lazy_sym.key } },
329 .attributes => {306 .attributes => {
330 const restricted_ty: Type = .fromInterned(lazy_sym.key);307 const restricted_ty: Type = .fromInterned(lazy_sym.key);
331 const unrestricted_ty: Type = .fromInterned(308 const unrestricted_ty: Type =
332 ip.indexToKey(lazy_sym.key).restricted_type.unrestricted_type,309 .fromInterned(restricted_type.unrestricted_type);
333 );310 return .{ .required_alignment = restricted_ty.abiAlignment(zcu)
334 return .{311 .maxStrict(unrestricted_ty.abiAlignment(zcu)) };
335 .header = true,
336 .required_alignment = restricted_ty.abiAlignment(zcu),
337 .size = unrestricted_ty.abiAlignment(zcu).forward(restricted_ty.abiSize(zcu)),
338 };
339 },312 },
340 },313 },
341 },314 },
...@@ -379,7 +352,6 @@ pub fn generateLazySymbol(...@@ -379,7 +352,6 @@ pub fn generateLazySymbol(
379 }352 }
380 return;353 return;
381 },354 },
382 .restricted_type => return,
383 else => {},355 else => {},
384 },356 },
385 .deferred_const_data => switch (lazy_sym.key) {357 .deferred_const_data => switch (lazy_sym.key) {
...@@ -404,10 +376,22 @@ pub fn generateLazySymbol(...@@ -404,10 +376,22 @@ pub fn generateLazySymbol(
404 return;376 return;
405 },377 },
406 _ => switch (ip.indexToKey(lazy_sym.key)) {378 _ => switch (ip.indexToKey(lazy_sym.key)) {
407 .restricted_value => |restricted_value| return generateSymbol(bin_file, pt, src_loc, .fromInterned(379 .restricted_type => |restricted_type| {
408 restricted_value.unrestricted_value,380 const restricted_ty: Type = .fromInterned(lazy_sym.key);
409 ), w, reloc_parent),381 const unrestricted_ty: Type = .fromInterned(restricted_type.unrestricted_type);
410 .restricted_type => return w.splatByteAll(0, @divExact(zcu.getTarget().ptrBitWidth(), 8)),382 const values: *const std.array_hash_map.Auto(InternPool.Index, void) =
383 bin_file.restricted.getPtr(lazy_sym.key) orelse &.empty;
384 const values_len = values.count();
385 const len_size = restricted_ty.abiSize(zcu);
386 const array_start = unrestricted_ty.abiAlignment(zcu).forward(len_size);
387 try w.rebase(w.end, array_start + unrestricted_ty.abiSize(zcu) * values_len);
388 w.writeInt(u32, @intCast(values_len), endian) catch unreachable;
389 w.splatByteAll(0, array_start - len_size) catch unreachable;
390 for (values.keys()) |value| try generateSymbol(bin_file, pt, src_loc, .fromInterned(
391 ip.indexToKey(value).restricted_value.unrestricted_value,
392 ), w, reloc_parent);
393 return;
394 },
411 else => {},395 else => {},
412 },396 },
413 else => {},397 else => {},
...@@ -782,10 +766,13 @@ pub fn generateSymbol(...@@ -782,10 +766,13 @@ pub fn generateSymbol(
782 }766 }
783 },767 },
784 .bitpack => |bitpack| try generateSymbol(bin_file, pt, src_loc, .fromInterned(bitpack.backing_int_val), w, reloc_parent),768 .bitpack => |bitpack| try generateSymbol(bin_file, pt, src_loc, .fromInterned(bitpack.backing_int_val), w, reloc_parent),
785 .restricted_value => |restricted_value| switch (ty.restrictedRepr(zcu)) {769 .restricted_value => |restricted_value| if (zcu.backendSupportsFeature(.restricted_types)) {
786 .indirect => try lowerLazySymbolRef(bin_file, pt, .{ .kind = .deferred_const_data, .key = val.toIntern() }, w, reloc_parent, 0),770 const gpa = zcu.gpa;
787 .direct => try generateSymbol(bin_file, pt, src_loc, .fromInterned(restricted_value.unrestricted_value), w, reloc_parent),771 const type_gop = try bin_file.restricted.getOrPut(gpa, restricted_value.ty);
788 },772 if (!type_gop.found_existing) type_gop.value_ptr.* = .empty;
773 const value_gop = try type_gop.value_ptr.getOrPut(gpa, val.toIntern());
774 try w.writeInt(u32, @intCast(value_gop.index), endian);
775 } else try generateSymbol(bin_file, pt, src_loc, .fromInterned(restricted_value.unrestricted_value), w, reloc_parent),
789 .memoized_call => unreachable,776 .memoized_call => unreachable,
790 }777 }
791}778}
...@@ -1167,7 +1154,6 @@ pub fn genTypedValue(...@@ -1167,7 +1154,6 @@ pub fn genTypedValue(
1167 } },1154 } },
1168 .fail => |em| .{ .fail = em },1155 .fail => |em| .{ .fail = em },
1169 },1156 },
1170 .lea_lazy_sym => unreachable, // `Zcu.Feature.restricted_types` is not supported by this code path
1171 };1157 };
1172}1158}
11731159
...@@ -1180,7 +1166,6 @@ const LowerResult = union(enum) {...@@ -1180,7 +1166,6 @@ const LowerResult = union(enum) {
1180 lea_nav: InternPool.Nav.Index,1166 lea_nav: InternPool.Nav.Index,
1181 load_uav: InternPool.Key.Ptr.BaseAddr.Uav,1167 load_uav: InternPool.Key.Ptr.BaseAddr.Uav,
1182 lea_uav: InternPool.Key.Ptr.BaseAddr.Uav,1168 lea_uav: InternPool.Key.Ptr.BaseAddr.Uav,
1183 lea_lazy_sym: link.File.LazySymbol,
1184};1169};
11851170
1186pub fn lowerValue(pt: Zcu.PerThread, start_val: Value, target: *const std.Target) Allocator.Error!LowerResult {1171pub fn lowerValue(pt: Zcu.PerThread, start_val: Value, target: *const std.Target) Allocator.Error!LowerResult {
...@@ -1192,12 +1177,15 @@ pub fn lowerValue(pt: Zcu.PerThread, start_val: Value, target: *const std.Target...@@ -1192,12 +1177,15 @@ pub fn lowerValue(pt: Zcu.PerThread, start_val: Value, target: *const std.Target
11921177
1193 if (start_val.isUndef(zcu)) return .undef;1178 if (start_val.isUndef(zcu)) return .undef;
11941179
1195 const ty, const val: Value = if (start_ty.unrestrictedType(zcu)) |unrestricted_ty| switch (start_ty.restrictedRepr(zcu)) {1180 const ty, const val: Value, const use_uav = if (start_ty.unrestrictedType(zcu)) |unrestricted_ty|
1196 .indirect => return .{ .lea_lazy_sym = .{ .kind = .deferred_const_data, .key = start_val.toIntern() } },1181 if (zcu.backendSupportsFeature(.restricted_types))
1197 .direct => .{ unrestricted_ty, .fromInterned(ip.indexToKey(start_val.toIntern()).restricted_value.unrestricted_value) },1182 .{ start_ty, start_val, true }
1198 } else .{ start_ty, start_val };1183 else
1184 .{ unrestricted_ty, .fromInterned(ip.indexToKey(start_val.toIntern()).restricted_value.unrestricted_value), false }
1185 else
1186 .{ start_ty, start_val, false };
11991187
1200 switch (ty.zigTypeTag(zcu)) {1188 if (!use_uav) switch (ty.zigTypeTag(zcu)) {
1201 .void => return .none,1189 .void => return .none,
1202 .bool => return .{ .immediate = @intFromBool(val.toBool()) },1190 .bool => return .{ .immediate = @intFromBool(val.toBool()) },
1203 .pointer => switch (ty.ptrSize(zcu)) {1191 .pointer => switch (ty.ptrSize(zcu)) {
...@@ -1308,7 +1296,7 @@ pub fn lowerValue(pt: Zcu.PerThread, start_val: Value, target: *const std.Target...@@ -1308,7 +1296,7 @@ pub fn lowerValue(pt: Zcu.PerThread, start_val: Value, target: *const std.Target
1308 .@"opaque" => unreachable,1296 .@"opaque" => unreachable,
13091297
1310 else => {},1298 else => {},
1311 }1299 };
13121300
1313 return .{ .load_uav = .{1301 return .{ .load_uav = .{
1314 .val = val.toIntern(),1302 .val = val.toIntern(),
src/codegen/aarch64/Select.zig+4-38
...@@ -305,6 +305,8 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {...@@ -305,6 +305,8 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
305 .errunion_payload_ptr_set,305 .errunion_payload_ptr_set,
306 .wrap_errunion_payload,306 .wrap_errunion_payload,
307 .wrap_errunion_err,307 .wrap_errunion_err,
308 .unwrap_restricted,
309 .unwrap_restricted_safe,
308 .struct_field_ptr_index_0,310 .struct_field_ptr_index_0,
309 .struct_field_ptr_index_1,311 .struct_field_ptr_index_1,
310 .struct_field_ptr_index_2,312 .struct_field_ptr_index_2,
...@@ -658,28 +660,6 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {...@@ -658,28 +660,6 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
658 air_inst_index = air_body[air_body_index];660 air_inst_index = air_body[air_body_index];
659 continue :air_tag air_tags[@intFromEnum(air_inst_index)];661 continue :air_tag air_tags[@intFromEnum(air_inst_index)];
660 },662 },
661 .unwrap_restricted, .unwrap_restricted_safe => {
662 const ty_op = air_data[@intFromEnum(air_inst_index)].ty_op;
663
664 maybe_noop: {
665 switch (isel.air.typeOf(ty_op.operand, ip).restrictedRepr(zcu)) {
666 .indirect => break :maybe_noop,
667 .direct => {},
668 }
669 if (true) break :maybe_noop;
670 if (ty_op.operand.toIndex()) |src_air_inst_index| {
671 if (isel.hints.get(src_air_inst_index)) |hint_vpsi| {
672 try isel.hints.putNoClobber(gpa, air_inst_index, hint_vpsi);
673 }
674 }
675 }
676 try isel.analyzeUse(ty_op.operand);
677 try isel.def_order.putNoClobber(gpa, air_inst_index, {});
678
679 air_body_index += 1;
680 air_inst_index = air_body[air_body_index];
681 continue :air_tag air_tags[@intFromEnum(air_inst_index)];
682 },
683 .struct_field_ptr, .struct_field_val => {663 .struct_field_ptr, .struct_field_val => {
684 const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl;664 const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl;
685 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;665 const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data;
...@@ -5763,22 +5743,8 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,...@@ -5763,22 +5743,8 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory,
5763 if (isel.live_values.fetchRemove(air.inst_index)) |dst_vi| {5743 if (isel.live_values.fetchRemove(air.inst_index)) |dst_vi| {
5764 defer dst_vi.value.deref(isel);5744 defer dst_vi.value.deref(isel);
5765 const ty_op = air.data(air.inst_index).ty_op;5745 const ty_op = air.data(air.inst_index).ty_op;
5766 const unrestricted_ty = ty_op.ty.toType();5746 _ = air_tag; // TODO
5767 const restricted_ty = isel.air.typeOf(ty_op.operand, ip);5747 try dst_vi.value.move(isel, ty_op.operand);
5768 switch (restricted_ty.restrictedRepr(zcu)) {
5769 .indirect => {
5770 switch (air_tag) {
5771 else => unreachable,
5772 .unwrap_restricted => {},
5773 .unwrap_restricted_safe => {}, // TODO
5774 }
5775 const ptr_vi = try isel.use(ty_op.operand);
5776 const ptr_mat = try ptr_vi.matReg(isel);
5777 _ = try dst_vi.value.load(isel, unrestricted_ty, ptr_mat.ra, .{});
5778 try ptr_mat.finish(isel);
5779 },
5780 .direct => try dst_vi.value.move(isel, ty_op.operand),
5781 }
5782 }5748 }
5783 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;5749 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
5784 },5750 },
src/codegen/c.zig+37-104
...@@ -1306,20 +1306,15 @@ pub const DeclGen = struct {...@@ -1306,20 +1306,15 @@ pub const DeclGen = struct {
1306 if (loaded_union.layout == .auto) try w.writeByte('}');1306 if (loaded_union.layout == .auto) try w.writeByte('}');
1307 }1307 }
1308 },1308 },
1309 .restricted_value => |restricted_value| switch (ty.restrictedRepr(zcu)) {1309 .restricted_value => {
1310 .indirect => {1310 const loaded_restricted = ip.loadRestrictedType(ty.toIntern());
1311 const loaded_restricted = ip.loadRestrictedType(ty.toIntern());1311 // Explicitly add the restricted decl dependency on the unrestricted type
1312 // Explicitly add the restricted decl dependency on the unrestricted type1312 _ = try CType.lower(.fromInterned(loaded_restricted.unrestricted_type), &dg.ctype_deps, dg.arena, zcu);
1313 _ = try CType.lower(.fromInterned(loaded_restricted.unrestricted_type), &dg.ctype_deps, dg.arena, zcu);1313 try dg.need_restricted.put(zcu.gpa, val.toIntern(), {});
1314 try dg.need_restricted.put(zcu.gpa, val.toIntern(), {});1314
13151315 try w.print("zig_restricted_value_{f}__{d}", .{
1316 const restricted_ty_name = loaded_restricted.name.toSlice(ip);1316 fmtIdentUnsolo(loaded_restricted.name.toSlice(ip)), val.toIntern(),
1317 try w.print("&zig_restricted_{f}__{d}[zig_restricted_index_{f}__{d}]", .{1317 });
1318 fmtIdentUnsolo(restricted_ty_name), ty.toIntern(),
1319 fmtIdentUnsolo(restricted_ty_name), val.toIntern(),
1320 });
1321 },
1322 .direct => try dg.renderValue(w, .fromInterned(restricted_value.unrestricted_value), initializer_type),
1323 },1318 },
1324 }1319 }
1325 }1320 }
...@@ -1327,7 +1322,7 @@ pub const DeclGen = struct {...@@ -1327,7 +1322,7 @@ pub const DeclGen = struct {
1327 fn renderUndefValue(1322 fn renderUndefValue(
1328 dg: *DeclGen,1323 dg: *DeclGen,
1329 w: *Writer,1324 w: *Writer,
1330 start_ty: Type,1325 ty: Type,
1331 location: ValueRenderLocation,1326 location: ValueRenderLocation,
1332 ) Error!void {1327 ) Error!void {
1333 const pt = dg.pt;1328 const pt = dg.pt;
...@@ -1345,8 +1340,7 @@ pub const DeclGen = struct {...@@ -1345,8 +1340,7 @@ pub const DeclGen = struct {
1345 .ReleaseFast, .ReleaseSmall => false,1340 .ReleaseFast, .ReleaseSmall => false,
1346 };1341 };
13471342
1348 var ty = start_ty;1343 switch (ty.toIntern()) {
1349 ty: switch (start_ty.toIntern()) {
1350 .c_longdouble_type,1344 .c_longdouble_type,
1351 .f16_type,1345 .f16_type,
1352 .f32_type,1346 .f32_type,
...@@ -1374,12 +1368,13 @@ pub const DeclGen = struct {...@@ -1374,12 +1368,13 @@ pub const DeclGen = struct {
1374 return w.writeByte(')');1368 return w.writeByte(')');
1375 },1369 },
1376 .bool_type => try w.writeAll(if (safety_on) "0xaa" else "false"),1370 .bool_type => try w.writeAll(if (safety_on) "0xaa" else "false"),
1377 else => ty_key: switch (ip.indexToKey(ty.toIntern())) {1371 else => switch (ip.indexToKey(ty.toIntern())) {
1378 .simple_type, // anyerror, c_char (etc), usize, isize1372 .simple_type, // anyerror, c_char (etc), usize, isize
1379 .int_type,1373 .int_type,
1380 .enum_type,1374 .enum_type,
1381 .error_set_type,1375 .error_set_type,
1382 .inferred_error_set_type,1376 .inferred_error_set_type,
1377 .restricted_type,
1383 => switch (CType.classifyInt(ty, zcu)) {1378 => switch (CType.classifyInt(ty, zcu)) {
1384 .void => unreachable, // opv1379 .void => unreachable, // opv
1385 .small => |s| {1380 .small => |s| {
...@@ -1475,16 +1470,6 @@ pub const DeclGen = struct {...@@ -1475,16 +1470,6 @@ pub const DeclGen = struct {
1475 try w.writeAll(" }");1470 try w.writeAll(" }");
1476 },1471 },
1477 },1472 },
1478 .restricted_type => |restricted_type| switch (ty.restrictedRepr(zcu)) {
1479 .indirect => continue :ty_key .{ .ptr_type = .{
1480 .child = restricted_type.unrestricted_type,
1481 .flags = .{ .is_const = true },
1482 } },
1483 .direct => {
1484 ty = .fromInterned(restricted_type.unrestricted_type);
1485 continue :ty restricted_type.unrestricted_type;
1486 },
1487 },
1488 .struct_type => {1473 .struct_type => {
1489 const loaded_struct = ip.loadStructType(ty.toIntern());1474 const loaded_struct = ip.loadStructType(ty.toIntern());
1490 switch (loaded_struct.layout) {1475 switch (loaded_struct.layout) {
...@@ -2138,8 +2123,8 @@ pub fn genRestricted(...@@ -2138,8 +2123,8 @@ pub fn genRestricted(
2138 });2123 });
2139 for (restricted_vals.keys(), 0..) |restricted_val, restricted_index| {2124 for (restricted_vals.keys(), 0..) |restricted_val, restricted_index| {
2140 try w.print(2125 try w.print(
2141 \\#define zig_restricted_index_{f}__{d} {d}u2126 \\#define zig_restricted_value_{f}__{d} {d}u
2142 \\ [zig_restricted_index_{f}__{d}] = 2127 \\ [zig_restricted_value_{f}__{d}] =
2143 , .{2128 , .{
2144 fmtIdentUnsolo(restricted_ty_name),2129 fmtIdentUnsolo(restricted_ty_name),
2145 restricted_val,2130 restricted_val,
...@@ -5641,81 +5626,29 @@ fn airUnwrapRestricted(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue...@@ -5641,81 +5626,29 @@ fn airUnwrapRestricted(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue
5641 // Implicitly adds the restricted decl dependency on the unrestricted type5626 // Implicitly adds the restricted decl dependency on the unrestricted type
5642 const local = try f.allocLocal(inst, unrestricted_ty);5627 const local = try f.allocLocal(inst, unrestricted_ty);
56435628
5644 switch (restricted_ty.restrictedRepr(zcu)) {5629 try f.dg.need_restricted.put(zcu.gpa, restricted_ty.toIntern(), {});
5645 .indirect => {5630 const restricted_ty_name = ip.loadRestrictedType(restricted_ty.toIntern()).name.toSlice(ip);
5646 if (safety) {5631 if (safety) {
5647 const target = &f.dg.mod.resolved_target.result;5632 try w.writeAll("if (");
5648 const ptr_bits = target.ptrBitWidth();5633 try f.writeCValue(w, operand, .other);
56495634 try w.print(" >= zig_restricted_len_{f}__{d}) {{", .{
5650 try f.dg.need_restricted.put(zcu.gpa, restricted_ty.toIntern(), {});5635 fmtIdentUnsolo(restricted_ty_name),
5651 const unrestricted_size = unrestricted_ty.abiSize(zcu);5636 restricted_ty.toIntern(),
5652 assert(unrestricted_size > 0);5637 });
5653 const restricted_ty_name = ip.loadRestrictedType(restricted_ty.toIntern()).name.toSlice(ip);5638 f.indent();
56545639 try f.newline();
5655 const ptr_diff = try f.allocLocal(inst, .usize);5640 try f.writePanic(.corrupt_restricted_value, w);
5656 try f.writeCValue(w, ptr_diff, .other);5641 try f.outdent();
5657 try w.print(" = zig_subw_u{d}(({f})", .{5642 try w.writeByte('}');
5658 ptr_bits,5643 try f.newline();
5659 CType.fmtTypeName(.{ .int = .uintptr_t }, zcu),
5660 });
5661 try f.writeCValue(w, operand, .other);
5662 try w.print(", ({f})zig_restricted_{f}__{d}, {f});", .{
5663 CType.fmtTypeName(.{ .int = .uintptr_t }, zcu),
5664 fmtIdentUnsolo(restricted_ty_name),
5665 restricted_ty.toIntern(),
5666 fmtUnsignedIntLiteralSmall(target, .uint8_t, ptr_bits, false, 10, .lower),
5667 });
5668 try f.newline();
5669
5670 try w.writeAll("if (");
5671 if (unrestricted_size == 1) {
5672 try f.writeCValue(w, ptr_diff, .other);
5673 } else if (std.math.isPowerOfTwo(unrestricted_size)) {
5674 const rotate_amount = std.math.log2_int(u64, unrestricted_size);
5675 try w.print("(zig_shr_u{d}(", .{ptr_bits});
5676 try f.writeCValue(w, ptr_diff, .other);
5677 try w.print(", {f}) | zig_shlw_u{d}(", .{
5678 fmtUnsignedIntLiteralSmall(target, .uint8_t, rotate_amount, false, 10, .lower),
5679 ptr_bits,
5680 });
5681 try f.writeCValue(w, ptr_diff, .other);
5682 try w.print(", {f}, {f}))", .{
5683 fmtUnsignedIntLiteralSmall(target, .uint8_t, ptr_bits - rotate_amount, false, 10, .lower),
5684 fmtUnsignedIntLiteralSmall(target, .uint8_t, ptr_bits, false, 10, .lower),
5685 });
5686 } else {
5687 try f.writeCValue(w, ptr_diff, .other);
5688 try w.print(" % {f} != {f} || ", .{
5689 fmtUnsignedIntLiteralSmall(target, .uintptr_t, unrestricted_size, false, 10, .lower),
5690 fmtUnsignedIntLiteralSmall(target, .uintptr_t, 0, false, 10, .lower),
5691 });
5692 try f.writeCValue(w, ptr_diff, .other);
5693 try w.print(" / {f}", .{
5694 fmtUnsignedIntLiteralSmall(target, .uintptr_t, unrestricted_size, false, 10, .lower),
5695 });
5696 }
5697 try w.print(" >= zig_restricted_len_{f}__{d}) {{", .{
5698 fmtIdentUnsolo(restricted_ty_name),
5699 restricted_ty.toIntern(),
5700 });
5701 f.indent();
5702 try f.newline();
5703 try f.writePanic(.corrupt_restricted_value, w);
5704 try f.outdent();
5705 try w.writeByte('}');
5706 try f.newline();
5707 }
5708 try f.writeCValue(w, local, .other);
5709 try w.writeAll(" = ");
5710 try f.writeCValueDeref(w, operand);
5711 },
5712 .direct => {
5713 try f.writeCValue(w, local, .other);
5714 try w.writeAll(" = ");
5715 try f.writeCValue(w, operand, .other);
5716 },
5717 }5644 }
5718 try w.writeByte(';');5645 try f.writeCValue(w, local, .other);
5646 try w.print(" = zig_restricted_{f}__{d}[", .{
5647 fmtIdentUnsolo(restricted_ty_name),
5648 restricted_ty.toIntern(),
5649 });
5650 try f.writeCValue(w, operand, .other);
5651 try w.writeAll("];");
5719 try f.newline();5652 try f.newline();
57205653
5721 return local;5654 return local;
src/codegen/c/type.zig+38-53
...@@ -129,29 +129,27 @@ pub const CType = union(enum) {...@@ -129,29 +129,27 @@ pub const CType = union(enum) {
129129
130 pub fn bits(int: Int, target: *const std.Target) u16 {130 pub fn bits(int: Int, target: *const std.Target) u16 {
131 return switch (int) {131 return switch (int) {
132 // zig fmt: off132 .char => target.cTypeBitSize(.char),
133 .char => target.cTypeBitSize(.char),133
134134 .@"unsigned short" => target.cTypeBitSize(.ushort),
135 .@"unsigned short" => target.cTypeBitSize(.ushort),135 .@"unsigned int" => target.cTypeBitSize(.uint),
136 .@"unsigned int" => target.cTypeBitSize(.uint),136 .@"unsigned long" => target.cTypeBitSize(.ulong),
137 .@"unsigned long" => target.cTypeBitSize(.ulong),137 .@"unsigned long long" => target.cTypeBitSize(.ulonglong),
138 .@"unsigned long long" => target.cTypeBitSize(.ulonglong),138
139139 .@"signed short" => target.cTypeBitSize(.short),
140 .@"signed short" => target.cTypeBitSize(.short),140 .@"signed int" => target.cTypeBitSize(.int),
141 .@"signed int" => target.cTypeBitSize(.int),141 .@"signed long" => target.cTypeBitSize(.long),
142 .@"signed long" => target.cTypeBitSize(.long),142 .@"signed long long" => target.cTypeBitSize(.longlong),
143 .@"signed long long" => target.cTypeBitSize(.longlong),143
144144 .uintptr_t, .intptr_t => target.ptrBitWidth(),
145 .uintptr_t, .intptr_t => target.ptrBitWidth(),145
146146 .uint8_t, .int8_t => 8,
147 .uint8_t, .int8_t => 8,147 .uint16_t, .int16_t => 16,
148 .uint16_t, .int16_t => 16,148 .uint24_t, .int24_t => 24,
149 .uint24_t, .int24_t => 24,149 .uint32_t, .int32_t => 32,
150 .uint32_t, .int32_t => 32,150 .uint48_t, .int48_t => 48,
151 .uint48_t, .int48_t => 48,151 .uint64_t, .int64_t => 64,
152 .uint64_t, .int64_t => 64,152 .zig_u128, .zig_i128 => 128,
153 .zig_u128, .zig_i128 => 128,
154 // zig fmt: on
155 };153 };
156 }154 }
157 };155 };
...@@ -239,20 +237,8 @@ pub const CType = union(enum) {...@@ -239,20 +237,8 @@ pub const CType = union(enum) {
239 ) Allocator.Error!CType {237 ) Allocator.Error!CType {
240 const gpa = zcu.comp.gpa;238 const gpa = zcu.comp.gpa;
241 const ip = &zcu.intern_pool;239 const ip = &zcu.intern_pool;
242 var cur_ty: Type = if (start_ty.unrestrictedType(zcu)) |unrestricted_ty| switch (start_ty.restrictedRepr(zcu)) {240 if (ip.isRestrictedType(start_ty.toIntern())) return .{ .int = .uint32_t };
243 .indirect => {241 var cur_ty = start_ty;
244 const unrestricted_cty = try lowerInner(unrestricted_ty, true, deps, arena, zcu);
245 const unrestricted_cty_buf = try arena.create(CType);
246 unrestricted_cty_buf.* = unrestricted_cty;
247 return .{ .pointer = .{
248 .@"const" = true,
249 .@"volatile" = false,
250 .elem_ty = unrestricted_cty_buf,
251 .nonstring = unrestricted_cty.isStringElem(),
252 } };
253 },
254 .direct => unrestricted_ty,
255 } else start_ty;
256 while (true) {242 while (true) {
257 switch (cur_ty.zigTypeTag(zcu)) {243 switch (cur_ty.zigTypeTag(zcu)) {
258 .type,244 .type,
...@@ -494,6 +480,7 @@ pub const CType = union(enum) {...@@ -494,6 +480,7 @@ pub const CType = union(enum) {
494480
495 /// Asserts that `ty` is an integer, enum, bitpack, or error set.481 /// Asserts that `ty` is an integer, enum, bitpack, or error set.
496 pub fn classifyInt(ty: Type, zcu: *const Zcu) IntClass {482 pub fn classifyInt(ty: Type, zcu: *const Zcu) IntClass {
483 if (zcu.intern_pool.isRestrictedType(ty.toIntern())) return classifyBitInt(.unsigned, 32, zcu);
497 const int_ty: Type = switch (ty.zigTypeTag(zcu)) {484 const int_ty: Type = switch (ty.zigTypeTag(zcu)) {
498 .error_set => return classifyBitInt(.unsigned, zcu.errorSetBits(), zcu),485 .error_set => return classifyBitInt(.unsigned, zcu.errorSetBits(), zcu),
499 .@"enum" => ty.intTagType(zcu),486 .@"enum" => ty.intTagType(zcu),
...@@ -502,22 +489,20 @@ pub const CType = union(enum) {...@@ -502,22 +489,20 @@ pub const CType = union(enum) {
502 else => unreachable,489 else => unreachable,
503 };490 };
504 switch (int_ty.toIntern()) {491 switch (int_ty.toIntern()) {
505 // zig fmt: off492 .usize_type => return .{ .small = .uintptr_t },
506 .usize_type => return .{ .small = .uintptr_t },493 .isize_type => return .{ .small = .intptr_t },
507 .isize_type => return .{ .small = .intptr_t },494
508495 .c_char_type => return .{ .small = .char },
509 .c_char_type => return .{ .small = .char },496
510497 .c_short_type => return .{ .small = .@"signed short" },
511 .c_short_type => return .{ .small = .@"signed short" },498 .c_int_type => return .{ .small = .@"signed int" },
512 .c_int_type => return .{ .small = .@"signed int" },499 .c_long_type => return .{ .small = .@"signed long" },
513 .c_long_type => return .{ .small = .@"signed long" },500 .c_longlong_type => return .{ .small = .@"signed long long" },
514 .c_longlong_type => return .{ .small = .@"signed long long" },501
515502 .c_ushort_type => return .{ .small = .@"unsigned short" },
516 .c_ushort_type => return .{ .small = .@"unsigned short" },503 .c_uint_type => return .{ .small = .@"unsigned int" },
517 .c_uint_type => return .{ .small = .@"unsigned int" },504 .c_ulong_type => return .{ .small = .@"unsigned long" },
518 .c_ulong_type => return .{ .small = .@"unsigned long" },505 .c_ulonglong_type => return .{ .small = .@"unsigned long long" },
519 .c_ulonglong_type => return .{ .small = .@"unsigned long long" },
520 // zig fmt: on
521506
522 else => {507 else => {
523 const int = ty.intInfo(zcu);508 const int = ty.intInfo(zcu);
src/codegen/llvm.zig+22-44
...@@ -722,7 +722,7 @@ pub const Object = struct {...@@ -722,7 +722,7 @@ pub const Object = struct {
722 gop.value_ptr.* = .{722 gop.value_ptr.* = .{
723 .len = try o.builder.addVariable(723 .len = try o.builder.addVariable(
724 try o.builder.strtabStringFmt("{s}.len", .{ty_name}),724 try o.builder.strtabStringFmt("{s}.len", .{ty_name}),
725 try o.lowerType(.usize),725 .i32,
726 .default,726 .default,
727 ),727 ),
728 .array = try o.builder.addVariable(728 .array = try o.builder.addVariable(
...@@ -734,7 +734,7 @@ pub const Object = struct {...@@ -734,7 +734,7 @@ pub const Object = struct {
734 };734 };
735 gop.value_ptr.len.setLinkage(.private, &o.builder);735 gop.value_ptr.len.setLinkage(.private, &o.builder);
736 gop.value_ptr.len.setMutability(.constant, &o.builder);736 gop.value_ptr.len.setMutability(.constant, &o.builder);
737 gop.value_ptr.len.setAlignment(Type.ptrAbiAlignment(target).toLlvm(), &o.builder);737 gop.value_ptr.len.setAlignment(.fromByteUnits(std.zig.target.intAlignment(target, 32)), &o.builder);
738 gop.value_ptr.len.setUnnamedAddr(.unnamed_addr, &o.builder);738 gop.value_ptr.len.setUnnamedAddr(.unnamed_addr, &o.builder);
739 gop.value_ptr.array.setLinkage(.private, &o.builder);739 gop.value_ptr.array.setLinkage(.private, &o.builder);
740 gop.value_ptr.array.setMutability(.constant, &o.builder);740 gop.value_ptr.array.setMutability(.constant, &o.builder);
...@@ -747,12 +747,9 @@ pub const Object = struct {...@@ -747,12 +747,9 @@ pub const Object = struct {
747 fn genRestrictedDecls(o: *Object) Allocator.Error!void {747 fn genRestrictedDecls(o: *Object) Allocator.Error!void {
748 for (o.restricted_map.values()) |restricted_decls| {748 for (o.restricted_map.values()) |restricted_decls| {
749 const len = restricted_decls.values.count();749 const len = restricted_decls.values.count();
750 try restricted_decls.len.setInitializer(750 try restricted_decls.len.setInitializer(try o.builder.intConst(.i32, len), &o.builder);
751 try o.builder.intConst(restricted_decls.len.typeOf(&o.builder), len),
752 &o.builder,
753 );
754 try restricted_decls.array.setInitializer(switch (len) {751 try restricted_decls.array.setInitializer(switch (len) {
755 0 => try o.builder.structConst(try o.builder.structType(.normal, &.{}), &.{}),752 0 => try o.builder.zeroInitConst(.i8), // ensure unique address
756 else => try o.builder.arrayConst(753 else => try o.builder.arrayConst(
757 try o.builder.arrayType(len, restricted_decls.values.values()[0].typeOf(&o.builder)),754 try o.builder.arrayType(len, restricted_decls.values.values()[0].typeOf(&o.builder)),
758 restricted_decls.values.values(),755 restricted_decls.values.values(),
...@@ -2027,7 +2024,7 @@ pub const Object = struct {...@@ -2027,7 +2024,7 @@ pub const Object = struct {
2027 fn lowerDebugType(2024 fn lowerDebugType(
2028 o: *Object,2025 o: *Object,
2029 pt: Zcu.PerThread,2026 pt: Zcu.PerThread,
2030 start_ty: Type,2027 ty: Type,
2031 ty_fwd_ref: Builder.Metadata,2028 ty_fwd_ref: Builder.Metadata,
2032 ) Allocator.Error!Builder.Metadata {2029 ) Allocator.Error!Builder.Metadata {
2033 assert(!o.builder.strip);2030 assert(!o.builder.strip);
...@@ -2037,7 +2034,7 @@ pub const Object = struct {...@@ -2037,7 +2034,7 @@ pub const Object = struct {
2037 const target = zcu.getTarget();2034 const target = zcu.getTarget();
2038 const ip = &zcu.intern_pool;2035 const ip = &zcu.intern_pool;
20392036
2040 const name = try o.builder.metadataStringFmt("{f}", .{start_ty.fmt(pt)});2037 const name = try o.builder.metadataStringFmt("{f}", .{ty.fmt(pt)});
20412038
2042 // lldb cannot handle non-byte-sized types, so in the logic below, bit sizes are padded up.2039 // lldb cannot handle non-byte-sized types, so in the logic below, bit sizes are padded up.
2043 // For instance, `bool` is considered to be 8 bits, and `u60` is considered to be 64 bits.2040 // For instance, `bool` is considered to be 8 bits, and `u60` is considered to be 64 bits.
...@@ -2048,23 +2045,16 @@ pub const Object = struct {...@@ -2048,23 +2045,16 @@ pub const Object = struct {
2048 // handling for variants at all, and will never print fields in them, so I opted not to use2045 // handling for variants at all, and will never print fields in them, so I opted not to use
2049 // them for now.2046 // them for now.
20502047
2051 const ty = if (start_ty.unrestrictedType(zcu)) |unrestricted_ty| switch (start_ty.restrictedRepr(zcu)) {2048 if (ip.isRestrictedType(ty.toIntern())) return o.builder.debugTypedefType(
2052 .indirect => {2049 name,
2053 const ptr_size = Type.ptrAbiSize(zcu.getTarget());2050 null, // file
2054 const ptr_align = Type.ptrAbiAlignment(zcu.getTarget());2051 o.debug_compile_unit.unwrap().?, // scope
2055 return o.builder.debugPointerType(2052 0, // line
2056 name,2053 try o.getDebugType(pt, .u32),
2057 null, // file2054 ty.abiSize(zcu) * 8,
2058 o.debug_compile_unit.unwrap().?, // scope2055 ty.abiAlignment(zcu).toByteUnits().? * 8,
2059 0, // line2056 0, // offset
2060 try o.getDebugType(pt, unrestricted_ty),2057 );
2061 ptr_size * 8,
2062 ptr_align.toByteUnits().? * 8,
2063 0, // offset
2064 );
2065 },
2066 .direct => unrestricted_ty,
2067 } else start_ty;
20682058
2069 switch (ty.zigTypeTag(zcu)) {2059 switch (ty.zigTypeTag(zcu)) {
2070 .void,2060 .void,
...@@ -3223,10 +3213,7 @@ pub const Object = struct {...@@ -3223,10 +3213,7 @@ pub const Object = struct {
3223 return o.builder.structType(.normal, fields[0..fields_len]);3213 return o.builder.structType(.normal, fields[0..fields_len]);
3224 },3214 },
3225 .simple_type => unreachable,3215 .simple_type => unreachable,
3226 .restricted_type => |restricted_type| switch (t.restrictedRepr(zcu)) {3216 .restricted_type => .i32,
3227 .indirect => .ptr,
3228 .direct => try o.lowerType(.fromInterned(restricted_type.unrestricted_type)),
3229 },
3230 .struct_type => {3217 .struct_type => {
3231 if (o.type_map.get(t.toIntern())) |value| return value;3218 if (o.type_map.get(t.toIntern())) |value| return value;
32323219
...@@ -3997,20 +3984,11 @@ pub const Object = struct {...@@ -3997,20 +3984,11 @@ pub const Object = struct {
3997 else3984 else
3998 union_ty, vals[0..len]);3985 union_ty, vals[0..len]);
3999 },3986 },
4000 .restricted_value => |restricted_value| switch (ty.restrictedRepr(zcu)) {3987 .restricted_value => |restricted_value| {
4001 .indirect => {3988 const restricted_decls = try o.getRestrictedDecls(ty);
4002 const restricted_decls = try o.getRestrictedDecls(ty);3989 const gop = try restricted_decls.values.getOrPut(o.gpa, arg_val);
4003 const gop = try restricted_decls.values.getOrPut(o.gpa, arg_val);3990 if (!gop.found_existing) gop.value_ptr.* = try o.lowerValue(restricted_value.unrestricted_value);
4004 if (!gop.found_existing) gop.value_ptr.* = try o.lowerValue(restricted_value.unrestricted_value);3991 return o.builder.intConst(.i32, gop.index);
4005 return o.builder.gepConst(
4006 .inbounds,
4007 gop.value_ptr.typeOf(&o.builder),
4008 restricted_decls.array.toConst(&o.builder),
4009 null,
4010 &.{try o.builder.intConst(.i64, gop.index)},
4011 );
4012 },
4013 .direct => try o.lowerValue(restricted_value.unrestricted_value),
4014 },3992 },
4015 .memoized_call => unreachable,3993 .memoized_call => unreachable,
4016 };3994 };
src/codegen/llvm/FuncGen.zig+30-68
...@@ -3258,65 +3258,30 @@ fn airUnwrapRestricted(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocat...@@ -3258,65 +3258,30 @@ fn airUnwrapRestricted(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocat
3258 const zcu = o.zcu;3258 const zcu = o.zcu;
3259 const target = zcu.getTarget();3259 const target = zcu.getTarget();
3260 const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;3260 const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
3261 const unrestricted_ty = ty_op.ty.toType();
3261 const restricted_ty = fg.typeOf(ty_op.operand);3262 const restricted_ty = fg.typeOf(ty_op.operand);
3262 const operand = try fg.resolveInst(ty_op.operand);3263 const operand = try fg.resolveInst(ty_op.operand);
3263 switch (restricted_ty.restrictedRepr(zcu)) {3264 const restricted_decls = try o.getRestrictedDecls(restricted_ty);
3264 .indirect => {3265 if (safety) {
3265 const unrestricted_ty = ty_op.ty.toType();3266 const len = try fg.wip.load(
3266 if (safety) {3267 .normal,
3267 const restricted_decls = try o.getRestrictedDecls(restricted_ty);3268 .i32,
3268 const llvm_usize_ty = restricted_decls.len.typeOf(&o.builder);3269 restricted_decls.len.toValue(&o.builder),
3269 const unrestricted_size = unrestricted_ty.abiSize(zcu);3270 .fromByteUnits(std.zig.target.intAlignment(target, 32)),
3270 assert(unrestricted_size > 0);3271 "unwrap_restricted.len",
3271 const array = try o.builder.castConst(.ptrtoint, restricted_decls.array.toConst(&o.builder), llvm_usize_ty);3272 );
3272 const ptr_diff = try fg.wip.bin(3273 const ok = try fg.wip.icmp(.ult, operand, len, "unwrap_restricted.ok");
3273 .sub,3274 const invalid_block = try fg.wip.block(1, "unwrap_restricted.invalid");
3274 try fg.wip.cast(.ptrtoint, operand, llvm_usize_ty, "unwrap_restricted.operand_int"),3275 const valid_block = try fg.wip.block(1, "unwrap_restricted.valid");
3275 array.toValue(),3276 _ = try fg.wip.brCond(ok, valid_block, invalid_block, .none);
3276 "unwrap_restricted.ptr_diff",
3277 );
3278 const len = try fg.wip.load(
3279 .normal,
3280 llvm_usize_ty,
3281 restricted_decls.len.toValue(&o.builder),
3282 Type.ptrAbiAlignment(target).toLlvm(),
3283 "unwrap_restricted.len",
3284 );
3285 const is_po2_unrestricted_size = std.math.isPowerOfTwo(unrestricted_size);
3286 const check_block = if (is_po2_unrestricted_size) undefined else try fg.wip.block(1, "unwrap_restricted.check");
3287 const invalid_block = try fg.wip.block(if (is_po2_unrestricted_size) 1 else 2, "unwrap_restricted.invalid");
3288 const valid_block = try fg.wip.block(1, "unwrap_restricted.valid");
3289 if (is_po2_unrestricted_size) {
3290 const index = if (unrestricted_size == 1)
3291 ptr_diff
3292 else
3293 try fg.wip.callIntrinsic(.normal, .none, .fshr, &.{llvm_usize_ty}, &.{
3294 ptr_diff,
3295 ptr_diff,
3296 try o.builder.intValue(llvm_usize_ty, std.math.log2_int(u64, unrestricted_size)),
3297 }, "unwrap_restricted.index");
3298 const ok = try fg.wip.icmp(.ult, index, len, "unwrap_restricted.ok");
3299 _ = try fg.wip.brCond(ok, valid_block, invalid_block, .none);
3300 } else {
3301 const unrestricted_size_value = try o.builder.intValue(llvm_usize_ty, unrestricted_size);
3302 const misalignment = try fg.wip.bin(.urem, ptr_diff, unrestricted_size_value, "unwrap_restricted.misalignment");
3303 const misaligned = try fg.wip.icmp(.ne, misalignment, try o.builder.intValue(llvm_usize_ty, 0), "unwrap_restricted.misaligned");
3304 _ = try fg.wip.brCond(misaligned, invalid_block, check_block, .none);
3305
3306 fg.wip.cursor = .{ .block = check_block };
3307 const index = try fg.wip.bin(.@"udiv exact", ptr_diff, unrestricted_size_value, "unwrap_restricted.index");
3308 const ok = try fg.wip.icmp(.ult, index, len, "unwrap_restricted.ok");
3309 _ = try fg.wip.brCond(ok, valid_block, invalid_block, .none);
3310 }
3311 fg.wip.cursor = .{ .block = invalid_block };
3312 try fg.buildSimplePanic(.corrupt_restricted_value);
33133277
3314 fg.wip.cursor = .{ .block = valid_block };3278 fg.wip.cursor = .{ .block = invalid_block };
3315 }3279 try fg.buildSimplePanic(.corrupt_restricted_value);
3316 return fg.load(operand, unrestricted_ty, unrestricted_ty.abiAlignment(zcu).toLlvm(), .normal);3280
3317 },3281 fg.wip.cursor = .{ .block = valid_block };
3318 .direct => return operand,
3319 }3282 }
3283 const ptr = try fg.ptraddScaled(restricted_decls.array.toValue(&o.builder), operand, unrestricted_ty.abiSize(zcu));
3284 return fg.load(ptr, unrestricted_ty, unrestricted_ty.abiAlignment(zcu).toLlvm(), .normal);
3320}3285}
33213286
3322fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {3287fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {
...@@ -6701,7 +6666,7 @@ const ParamTypeIterator = struct {...@@ -6701,7 +6666,7 @@ const ParamTypeIterator = struct {
6701 it.zig_index += 1;6666 it.zig_index += 1;
6702 it.llvm_index += 1;6667 it.llvm_index += 1;
6703 if (ty.isSlice(zcu) or6668 if (ty.isSlice(zcu) or
6704 (ty.zigTypeTag(zcu) == .optional and ty.optionalChild(zcu).isSlice(zcu) and !ty.ptrAllowsZero(zcu)))6669 (zcu.intern_pool.isOptionalType(ty.toIntern()) and ty.optionalChild(zcu).isSlice(zcu) and !ty.ptrAllowsZero(zcu)))
6705 {6670 {
6706 it.llvm_index += 1;6671 it.llvm_index += 1;
6707 return .slice;6672 return .slice;
...@@ -7292,11 +7257,8 @@ pub fn buildAllocaInner(...@@ -7292,11 +7257,8 @@ pub fn buildAllocaInner(
7292/// This is the one source of truth for whether a type is passed around as an LLVM pointer,7257/// This is the one source of truth for whether a type is passed around as an LLVM pointer,
7293/// or as an LLVM value.7258/// or as an LLVM value.
7294pub fn isByRef(ty: Type, zcu: *const Zcu) bool {7259pub fn isByRef(ty: Type, zcu: *const Zcu) bool {
7295 const unrestricted_ty = if (ty.unrestrictedType(zcu)) |unrestricted_ty| switch (ty.restrictedRepr(zcu)) {7260 if (zcu.intern_pool.isRestrictedType(ty.toIntern())) return false;
7296 .indirect => return false,7261 return switch (ty.zigTypeTag(zcu)) {
7297 .direct => unrestricted_ty,
7298 } else ty;
7299 return switch (unrestricted_ty.zigTypeTag(zcu)) {
7300 .type,7262 .type,
7301 .comptime_int,7263 .comptime_int,
7302 .comptime_float,7264 .comptime_float,
...@@ -7321,19 +7283,19 @@ pub fn isByRef(ty: Type, zcu: *const Zcu) bool {...@@ -7321,19 +7283,19 @@ pub fn isByRef(ty: Type, zcu: *const Zcu) bool {
73217283
7322 .array,7284 .array,
7323 .frame,7285 .frame,
7324 => unrestricted_ty.hasRuntimeBits(zcu),7286 => ty.hasRuntimeBits(zcu),
73257287
7326 .error_union => unrestricted_ty.errorUnionPayload(zcu).hasRuntimeBits(zcu),7288 .error_union => ty.errorUnionPayload(zcu).hasRuntimeBits(zcu),
73277289
7328 .optional => !unrestricted_ty.optionalReprIsPayload(zcu) and unrestricted_ty.optionalChild(zcu).hasRuntimeBits(zcu),7290 .optional => !ty.optionalReprIsPayload(zcu) and ty.optionalChild(zcu).hasRuntimeBits(zcu),
73297291
7330 .@"struct" => switch (unrestricted_ty.containerLayout(zcu)) {7292 .@"struct" => switch (ty.containerLayout(zcu)) {
7331 .@"packed" => false,7293 .@"packed" => false,
7332 .auto, .@"extern" => unrestricted_ty.hasRuntimeBits(zcu),7294 .auto, .@"extern" => ty.hasRuntimeBits(zcu),
7333 },7295 },
7334 .@"union" => switch (unrestricted_ty.containerLayout(zcu)) {7296 .@"union" => switch (ty.containerLayout(zcu)) {
7335 .@"packed" => false,7297 .@"packed" => false,
7336 else => unrestricted_ty.hasRuntimeBits(zcu) and !unrestricted_ty.unionHasAllZeroBitFieldTypes(zcu),7298 else => ty.hasRuntimeBits(zcu) and !ty.unionHasAllZeroBitFieldTypes(zcu),
7337 },7299 },
7338 };7300 };
7339}7301}
src/codegen/wasm/CodeGen.zig+2-10
...@@ -6725,18 +6725,10 @@ fn airErrUnionPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void...@@ -6725,18 +6725,10 @@ fn airErrUnionPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void
6725}6725}
67266726
6727fn airUnwrapRestricted(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void {6727fn airUnwrapRestricted(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void {
6728 const zcu = cg.pt.zcu;
6729 const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;6728 const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
6730 const operand = try cg.resolveInst(ty_op.operand);6729 const operand = try cg.resolveInst(ty_op.operand);
6731 const unrestricted_ty = ty_op.ty.toType();6730 _ = safety; // TODO
6732 const restricted_ty = cg.typeOf(ty_op.operand);6731 const result = cg.reuseOperand(ty_op.operand, operand); // TODO
6733 const result = result: switch (restricted_ty.restrictedRepr(zcu)) {
6734 .indirect => {
6735 _ = safety; // TODO
6736 break :result try cg.load(operand, unrestricted_ty, 0);
6737 },
6738 .direct => cg.reuseOperand(ty_op.operand, operand),
6739 };
6740 return cg.finishAir(inst, result, &.{ty_op.operand});6732 return cg.finishAir(inst, result, &.{ty_op.operand});
6741}6733}
67426734
src/codegen/x86_64/CodeGen.zig+1315-339
...@@ -103826,314 +103826,1260 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -103826,314 +103826,1260 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103826 const ty_op = air_datas[@intFromEnum(inst)].ty_op;103826 const ty_op = air_datas[@intFromEnum(inst)].ty_op;
103827 const unrestricted_ty = ty_op.ty.toType();103827 const unrestricted_ty = ty_op.ty.toType();
103828 const restricted_ty = cg.typeOf(ty_op.operand);103828 const restricted_ty = cg.typeOf(ty_op.operand);
103829 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}) ++ .{try cg.tempInit(ty_op.ty.toType(), .none)};103829 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}) ++ .{
103830 const res = res: switch (restricted_ty.restrictedRepr(zcu)) {103830 try cg.tempInit(.usize, .{ .immediate = unrestricted_ty.abiAlignment(zcu).forward(restricted_ty.abiSize(zcu)) }),
103831 .indirect => {103831 };
103832 if (zcu.comp.config.use_new_linker) switch (air_tag) {103832 var res: [1]Temp = undefined;
103833 else => unreachable,103833 cg.select(&res, &.{unrestricted_ty}, &ops, switch (air_tag) {
103834 .unwrap_restricted => {},103834 else => unreachable,
103835 .unwrap_restricted_safe => cg.select(&.{}, &.{}, &ops, &.{ .{103835 .unwrap_restricted => &.{ .{
103836 .required_features = .{ .avx, .bmi2, null, null },103836 .required_features = .{ .@"64bit", null, null, null },
103837 .src_constraints = .{ .any, .po2_any, .any },103837 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
103838 .patterns = &.{103838 .patterns = &.{
103839 .{ .src = .{ .mem, .none, .none } },103839 .{ .src = .{ .to_gpr, .simm32, .none } },
103840 .{ .src = .{ .to_gpr, .none, .none } },103840 },
103841 },103841 .extra_temps = .{
103842 .call_frame = .{ .alignment = .@"32" },103842 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103843 .extra_temps = .{103843 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103844 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103844 .unused,
103845 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },103845 .unused,
103846 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103846 .unused,
103847 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },103847 .unused,
103848 .unused,103848 .unused,
103849 .unused,103849 .unused,
103850 .unused,103850 .unused,
103851 .unused,103851 .unused,
103852 .unused,103852 .unused,
103853 .unused,103853 },
103854 .unused,103854 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103855 },103855 .each = .{ .once = &.{
103856 .clobbers = .{ .eflags = true },103856 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103857 .each = .{ .once = &.{103857 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103858 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },103858 .{ ._, ._, .movzx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
103859 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },103859 } },
103860 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },103860 }, .{
103861 .{ ._, ._rx, .ro, .tmp2p, .tmp2p, .sa(.src1, .add_log2_size), ._ },103861 .required_features = .{ .@"64bit", null, null, null },
103862 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },103862 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
103863 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },103863 .patterns = &.{
103864 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },103864 .{ .src = .{ .to_gpr, .simm32, .none } },
103865 } },103865 },
103866 }, .{103866 .extra_temps = .{
103867 .required_features = .{ .avx, null, null, null },103867 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103868 .src_constraints = .{ .any, .po2_any, .any },103868 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103869 .patterns = &.{103869 .unused,
103870 .{ .src = .{ .mem, .none, .none } },103870 .unused,
103871 .{ .src = .{ .to_gpr, .none, .none } },103871 .unused,
103872 },103872 .unused,
103873 .call_frame = .{ .alignment = .@"32" },103873 .unused,
103874 .extra_temps = .{103874 .unused,
103875 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103875 .unused,
103876 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },103876 .unused,
103877 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103877 .unused,
103878 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },103878 },
103879 .unused,103879 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103880 .unused,103880 .each = .{ .once = &.{
103881 .unused,103881 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103882 .unused,103882 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103883 .unused,103883 .{ ._, ._, .movsx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
103884 .unused,103884 } },
103885 .unused,103885 }, .{
103886 },103886 .required_features = .{ .@"64bit", null, null, null },
103887 .clobbers = .{ .eflags = true },103887 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
103888 .each = .{ .once = &.{103888 .patterns = &.{
103889 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },103889 .{ .src = .{ .to_gpr, .simm32, .none } },
103890 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },103890 },
103891 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },103891 .extra_temps = .{
103892 .{ ._, ._r, .ro, .tmp2p, .sa(.src1, .add_log2_size), ._, ._ },103892 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103893 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },103893 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103894 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },103894 .unused,
103895 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },103895 .unused,
103896 } },103896 .unused,
103897 }, .{103897 .unused,
103898 .required_features = .{ .avx, null, null, null },103898 .unused,
103899 .patterns = &.{103899 .unused,
103900 .{ .src = .{ .mem, .none, .none } },103900 .unused,
103901 .{ .src = .{ .to_gpr, .none, .none } },103901 .unused,
103902 },103902 .unused,
103903 .call_frame = .{ .alignment = .@"32" },103903 },
103904 .extra_temps = .{103904 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103905 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103905 .each = .{ .once = &.{
103906 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },103906 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103907 .{ .type = .usize, .kind = .{ .reg = .rax } },103907 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103908 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103908 .{ ._, ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
103909 .{ .type = .usize, .kind = .{ .reg = .rdx } },103909 } },
103910 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },103910 }, .{
103911 .unused,103911 .required_features = .{ .@"64bit", null, null, null },
103912 .unused,103912 .dst_constraints = .{ .{ .signed_int = .word }, .any },
103913 .unused,103913 .patterns = &.{
103914 .unused,103914 .{ .src = .{ .to_gpr, .simm32, .none } },
103915 .unused,103915 },
103916 },103916 .extra_temps = .{
103917 .clobbers = .{ .eflags = true },103917 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103918 .each = .{ .once = &.{103918 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103919 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },103919 .unused,
103920 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },103920 .unused,
103921 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },103921 .unused,
103922 .{ ._, ._, .mov, .tmp3d, .sa(.src1, .add_size), ._, ._ },103922 .unused,
103923 .{ ._, ._, .xor, .tmp4p, .tmp4p, ._, ._ },103923 .unused,
103924 .{ ._, ._, .div, .tmp3p, ._, ._, ._ },103924 .unused,
103925 .{ ._, ._, .@"test", .tmp4p, .tmp4p, ._, ._ },103925 .unused,
103926 .{ ._, ._nz, .j, .@"1f", ._, ._, ._ },103926 .unused,
103927 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },103927 .unused,
103928 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },103928 },
103929 .{ .@"1:", ._, .call, .tmp5d, ._, ._, ._ },103929 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103930 } },103930 .each = .{ .once = &.{
103931 }, .{103931 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103932 .required_features = .{ .sse, .bmi2, null, null },103932 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103933 .src_constraints = .{ .any, .po2_any, .any },103933 .{ ._, ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
103934 .patterns = &.{103934 } },
103935 .{ .src = .{ .mem, .none, .none } },103935 }, .{
103936 .{ .src = .{ .to_gpr, .none, .none } },103936 .required_features = .{ .@"64bit", null, null, null },
103937 },103937 .dst_constraints = .{ .{ .int = .dword }, .any },
103938 .call_frame = .{ .alignment = .@"16" },103938 .patterns = &.{
103939 .extra_temps = .{103939 .{ .src = .{ .to_gpr, .simm32, .none } },
103940 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103940 },
103941 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },103941 .extra_temps = .{
103942 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103942 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103943 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },103943 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103944 .unused,103944 .unused,
103945 .unused,103945 .unused,
103946 .unused,103946 .unused,
103947 .unused,103947 .unused,
103948 .unused,103948 .unused,
103949 .unused,103949 .unused,
103950 .unused,103950 .unused,
103951 },103951 .unused,
103952 .clobbers = .{ .eflags = true },103952 .unused,
103953 .each = .{ .once = &.{103953 },
103954 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },103954 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103955 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },103955 .each = .{ .once = &.{
103956 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },103956 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103957 .{ ._, ._rx, .ro, .tmp2p, .tmp2p, .sa(.src1, .add_log2_size), ._ },103957 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103958 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },103958 .{ ._, ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .dst0), ._, ._ },
103959 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },103959 } },
103960 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },103960 }, .{
103961 } },103961 .required_features = .{ .@"64bit", null, null, null },
103962 }, .{103962 .dst_constraints = .{ .{ .int = .qword }, .any },
103963 .required_features = .{ .sse, null, null, null },103963 .patterns = &.{
103964 .src_constraints = .{ .any, .po2_any, .any },103964 .{ .src = .{ .to_gpr, .simm32, .none } },
103965 .patterns = &.{103965 },
103966 .{ .src = .{ .mem, .none, .none } },103966 .extra_temps = .{
103967 .{ .src = .{ .to_gpr, .none, .none } },103967 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103968 },103968 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103969 .call_frame = .{ .alignment = .@"16" },103969 .unused,
103970 .extra_temps = .{103970 .unused,
103971 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103971 .unused,
103972 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },103972 .unused,
103973 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },103973 .unused,
103974 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },103974 .unused,
103975 .unused,103975 .unused,
103976 .unused,103976 .unused,
103977 .unused,103977 .unused,
103978 .unused,103978 },
103979 .unused,103979 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103980 .unused,103980 .each = .{ .once = &.{
103981 .unused,103981 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103982 },103982 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103983 .clobbers = .{ .eflags = true },103983 .{ ._, ._, .mov, .dst0q, .leasi(.tmp0q, .@"8", .dst0), ._, ._ },
103984 .each = .{ .once = &.{103984 } },
103985 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },103985 }, .{
103986 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },103986 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
103987 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },103987 .patterns = &.{
103988 .{ ._, ._r, .ro, .tmp2p, .sa(.src1, .add_log2_size), ._, ._ },103988 .{ .src = .{ .to_gpr, .simm32, .none } },
103989 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },103989 },
103990 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },103990 .extra_temps = .{
103991 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },103991 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103992 } },103992 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103993 }, .{103993 .unused,
103994 .required_features = .{ .sse, null, null, null },103994 .unused,
103995 .patterns = &.{103995 .unused,
103996 .{ .src = .{ .mem, .none, .none } },103996 .unused,
103997 .{ .src = .{ .to_gpr, .none, .none } },103997 .unused,
103998 },103998 .unused,
103999 .call_frame = .{ .alignment = .@"16" },103999 .unused,
104000 .extra_temps = .{104000 .unused,
104001 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },104001 .unused,
104002 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },104002 },
104003 .{ .type = .usize, .kind = .{ .reg = .rax } },104003 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104004 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },104004 .each = .{ .once = &.{
104005 .{ .type = .usize, .kind = .{ .reg = .rdx } },104005 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104006 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },104006 .{ ._, ._, .movzx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104007 .unused,104007 } },
104008 .unused,104008 }, .{
104009 .unused,104009 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104010 .unused,104010 .patterns = &.{
104011 .unused,104011 .{ .src = .{ .to_gpr, .simm32, .none } },
104012 },104012 },
104013 .clobbers = .{ .eflags = true },104013 .extra_temps = .{
104014 .each = .{ .once = &.{104014 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104015 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },104015 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104016 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },104016 .unused,
104017 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },104017 .unused,
104018 .{ ._, ._, .mov, .tmp3d, .sa(.src1, .add_size), ._, ._ },104018 .unused,
104019 .{ ._, ._, .xor, .tmp4p, .tmp4p, ._, ._ },104019 .unused,
104020 .{ ._, ._, .div, .tmp3p, ._, ._, ._ },104020 .unused,
104021 .{ ._, ._, .@"test", .tmp4p, .tmp4p, ._, ._ },104021 .unused,
104022 .{ ._, ._nz, .j, .@"1f", ._, ._, ._ },104022 .unused,
104023 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },104023 .unused,
104024 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },104024 .unused,
104025 .{ .@"1:", ._, .call, .tmp5d, ._, ._, ._ },104025 },
104026 } },104026 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104027 }, .{104027 .each = .{ .once = &.{
104028 .required_features = .{ .bmi2, null, null, null },104028 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104029 .src_constraints = .{ .any, .po2_any, .any },104029 .{ ._, ._, .movsx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104030 .patterns = &.{104030 } },
104031 .{ .src = .{ .mem, .none, .none } },104031 }, .{
104032 .{ .src = .{ .to_gpr, .none, .none } },104032 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
104033 },104033 .patterns = &.{
104034 .call_frame = .{ .alignment = .@"8" },104034 .{ .src = .{ .to_gpr, .simm32, .none } },
104035 .extra_temps = .{104035 },
104036 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },104036 .extra_temps = .{
104037 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },104037 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104038 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },104038 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104039 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },104039 .unused,
104040 .unused,104040 .unused,
104041 .unused,104041 .unused,
104042 .unused,104042 .unused,
104043 .unused,104043 .unused,
104044 .unused,104044 .unused,
104045 .unused,104045 .unused,
104046 .unused,104046 .unused,
104047 },104047 .unused,
104048 .clobbers = .{ .eflags = true },104048 },
104049 .each = .{ .once = &.{104049 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104050 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },104050 .each = .{ .once = &.{
104051 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },104051 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104052 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },104052 .{ ._, ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104053 .{ ._, ._rx, .ro, .tmp2p, .tmp2p, .sa(.src1, .add_log2_size), ._ },104053 } },
104054 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },104054 }, .{
104055 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },104055 .dst_constraints = .{ .{ .signed_int = .word }, .any },
104056 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },104056 .patterns = &.{
104057 } },104057 .{ .src = .{ .to_gpr, .simm32, .none } },
104058 }, .{104058 },
104059 .src_constraints = .{ .any, .po2_any, .any },104059 .extra_temps = .{
104060 .patterns = &.{104060 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104061 .{ .src = .{ .mem, .none, .none } },104061 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104062 .{ .src = .{ .to_gpr, .none, .none } },104062 .unused,
104063 },104063 .unused,
104064 .call_frame = .{ .alignment = .@"8" },104064 .unused,
104065 .extra_temps = .{104065 .unused,
104066 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },104066 .unused,
104067 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },104067 .unused,
104068 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },104068 .unused,
104069 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },104069 .unused,
104070 .unused,104070 .unused,
104071 .unused,104071 },
104072 .unused,104072 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104073 .unused,104073 .each = .{ .once = &.{
104074 .unused,104074 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104075 .unused,104075 .{ ._, ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104076 .unused,104076 } },
104077 },104077 }, .{
104078 .clobbers = .{ .eflags = true },104078 .dst_constraints = .{ .{ .int = .dword }, .any },
104079 .each = .{ .once = &.{104079 .patterns = &.{
104080 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },104080 .{ .src = .{ .to_gpr, .simm32, .none } },
104081 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },104081 },
104082 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },104082 .extra_temps = .{
104083 .{ ._, ._r, .ro, .tmp2p, .sa(.src1, .add_log2_size), ._, ._ },104083 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104084 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },104084 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104085 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },104085 .unused,
104086 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },104086 .unused,
104087 } },104087 .unused,
104088 }, .{104088 .unused,
104089 .patterns = &.{104089 .unused,
104090 .{ .src = .{ .mem, .none, .none } },104090 .unused,
104091 .{ .src = .{ .to_gpr, .none, .none } },104091 .unused,
104092 },104092 .unused,
104093 .call_frame = .{ .alignment = .@"8" },104093 .unused,
104094 .extra_temps = .{104094 },
104095 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },104095 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104096 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },104096 .each = .{ .once = &.{
104097 .{ .type = .usize, .kind = .{ .reg = .rax } },104097 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104098 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },104098 .{ ._, ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .src0), ._, ._ },
104099 .{ .type = .usize, .kind = .{ .reg = .rdx } },104099 } },
104100 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },104100 } },
104101 .unused,104101 .unwrap_restricted_safe => &.{ .{
104102 .unused,104102 .required_features = .{ .@"64bit", .avx, null, null },
104103 .unused,104103 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104104 .unused,104104 .patterns = &.{
104105 .unused,104105 .{ .src = .{ .to_gpr, .simm32, .none } },
104106 },104106 },
104107 .clobbers = .{ .eflags = true },104107 .call_frame = .{ .alignment = .@"32" },
104108 .each = .{ .once = &.{104108 .extra_temps = .{
104109 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },104109 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104110 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },104110 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104111 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },104111 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104112 .{ ._, ._, .mov, .tmp3d, .sa(.src1, .add_size), ._, ._ },104112 .unused,
104113 .{ ._, ._, .xor, .tmp4p, .tmp4p, ._, ._ },104113 .unused,
104114 .{ ._, ._, .div, .tmp3p, ._, ._, ._ },104114 .unused,
104115 .{ ._, ._, .@"test", .tmp4p, .tmp4p, ._, ._ },104115 .unused,
104116 .{ ._, ._nz, .j, .@"1f", ._, ._, ._ },104116 .unused,
104117 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },104117 .unused,
104118 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },104118 .unused,
104119 .{ .@"1:", ._, .call, .tmp5d, ._, ._, ._ },104119 .unused,
104120 } },104120 },
104121 } }) catch |err| switch (err) {104121 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104122 error.SelectFailed => return cg.fail("failed to select {t} {f} {f} {f}", .{104122 .clobbers = .{ .eflags = true },
104123 air_tag,104123 .each = .{ .once = &.{
104124 unrestricted_ty.fmt(pt),104124 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104125 restricted_ty.fmt(pt),104125 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104126 ops[0].tracking(cg),104126 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104127 }),104127 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104128 else => |e| return e,104128 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104129 },104129 .{ ._, ._, .movzx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
104130 };104130 } },
104131 break :res try ops[0].load(unrestricted_ty, .{}, cg);104131 }, .{
104132 },104132 .required_features = .{ .@"64bit", .sse, null, null },
104133 .direct => ops[0],104133 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104134 .patterns = &.{
104135 .{ .src = .{ .to_gpr, .simm32, .none } },
104136 },
104137 .call_frame = .{ .alignment = .@"16" },
104138 .extra_temps = .{
104139 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104140 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104141 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104142 .unused,
104143 .unused,
104144 .unused,
104145 .unused,
104146 .unused,
104147 .unused,
104148 .unused,
104149 .unused,
104150 },
104151 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104152 .clobbers = .{ .eflags = true },
104153 .each = .{ .once = &.{
104154 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104155 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104156 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104157 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104158 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104159 .{ ._, ._, .movzx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
104160 } },
104161 }, .{
104162 .required_features = .{ .@"64bit", null, null, null },
104163 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104164 .patterns = &.{
104165 .{ .src = .{ .to_gpr, .simm32, .none } },
104166 },
104167 .call_frame = .{ .alignment = .@"8" },
104168 .extra_temps = .{
104169 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104170 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104171 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104172 .unused,
104173 .unused,
104174 .unused,
104175 .unused,
104176 .unused,
104177 .unused,
104178 .unused,
104179 .unused,
104180 },
104181 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104182 .clobbers = .{ .eflags = true },
104183 .each = .{ .once = &.{
104184 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104185 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104186 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104187 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104188 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104189 .{ ._, ._, .movzx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
104190 } },
104191 }, .{
104192 .required_features = .{ .@"64bit", .avx, null, null },
104193 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104194 .patterns = &.{
104195 .{ .src = .{ .to_gpr, .simm32, .none } },
104196 },
104197 .call_frame = .{ .alignment = .@"32" },
104198 .extra_temps = .{
104199 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104200 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104201 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104202 .unused,
104203 .unused,
104204 .unused,
104205 .unused,
104206 .unused,
104207 .unused,
104208 .unused,
104209 .unused,
104210 },
104211 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104212 .clobbers = .{ .eflags = true },
104213 .each = .{ .once = &.{
104214 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104215 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104216 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104217 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104218 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104219 .{ ._, ._, .movsx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
104220 } },
104221 }, .{
104222 .required_features = .{ .@"64bit", .sse, null, null },
104223 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104224 .patterns = &.{
104225 .{ .src = .{ .to_gpr, .simm32, .none } },
104226 },
104227 .call_frame = .{ .alignment = .@"16" },
104228 .extra_temps = .{
104229 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104230 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104231 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104232 .unused,
104233 .unused,
104234 .unused,
104235 .unused,
104236 .unused,
104237 .unused,
104238 .unused,
104239 .unused,
104240 },
104241 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104242 .clobbers = .{ .eflags = true },
104243 .each = .{ .once = &.{
104244 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104245 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104246 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104247 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104248 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104249 .{ ._, ._, .movsx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
104250 } },
104251 }, .{
104252 .required_features = .{ .@"64bit", null, null, null },
104253 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104254 .patterns = &.{
104255 .{ .src = .{ .to_gpr, .simm32, .none } },
104256 },
104257 .call_frame = .{ .alignment = .@"8" },
104258 .extra_temps = .{
104259 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104260 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104261 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104262 .unused,
104263 .unused,
104264 .unused,
104265 .unused,
104266 .unused,
104267 .unused,
104268 .unused,
104269 .unused,
104270 },
104271 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104272 .clobbers = .{ .eflags = true },
104273 .each = .{ .once = &.{
104274 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104275 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104276 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104277 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104278 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104279 .{ ._, ._, .movsx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
104280 } },
104281 }, .{
104282 .required_features = .{ .@"64bit", .avx, null, null },
104283 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
104284 .patterns = &.{
104285 .{ .src = .{ .to_gpr, .simm32, .none } },
104286 },
104287 .call_frame = .{ .alignment = .@"32" },
104288 .extra_temps = .{
104289 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104290 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104291 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104292 .unused,
104293 .unused,
104294 .unused,
104295 .unused,
104296 .unused,
104297 .unused,
104298 .unused,
104299 .unused,
104300 },
104301 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104302 .clobbers = .{ .eflags = true },
104303 .each = .{ .once = &.{
104304 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104305 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104306 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104307 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104308 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104309 .{ ._, ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
104310 } },
104311 }, .{
104312 .required_features = .{ .@"64bit", .sse, null, null },
104313 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
104314 .patterns = &.{
104315 .{ .src = .{ .to_gpr, .simm32, .none } },
104316 },
104317 .call_frame = .{ .alignment = .@"16" },
104318 .extra_temps = .{
104319 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104320 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104321 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104322 .unused,
104323 .unused,
104324 .unused,
104325 .unused,
104326 .unused,
104327 .unused,
104328 .unused,
104329 .unused,
104330 },
104331 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104332 .clobbers = .{ .eflags = true },
104333 .each = .{ .once = &.{
104334 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104335 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104336 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104337 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104338 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104339 .{ ._, ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
104340 } },
104341 }, .{
104342 .required_features = .{ .@"64bit", null, null, null },
104343 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
104344 .patterns = &.{
104345 .{ .src = .{ .to_gpr, .simm32, .none } },
104346 },
104347 .call_frame = .{ .alignment = .@"8" },
104348 .extra_temps = .{
104349 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104350 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104351 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104352 .unused,
104353 .unused,
104354 .unused,
104355 .unused,
104356 .unused,
104357 .unused,
104358 .unused,
104359 .unused,
104360 },
104361 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104362 .clobbers = .{ .eflags = true },
104363 .each = .{ .once = &.{
104364 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104365 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104366 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104367 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104368 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104369 .{ ._, ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
104370 } },
104371 }, .{
104372 .required_features = .{ .@"64bit", .avx, null, null },
104373 .dst_constraints = .{ .{ .signed_int = .word }, .any },
104374 .patterns = &.{
104375 .{ .src = .{ .to_gpr, .simm32, .none } },
104376 },
104377 .call_frame = .{ .alignment = .@"32" },
104378 .extra_temps = .{
104379 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104380 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104381 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104382 .unused,
104383 .unused,
104384 .unused,
104385 .unused,
104386 .unused,
104387 .unused,
104388 .unused,
104389 .unused,
104390 },
104391 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104392 .clobbers = .{ .eflags = true },
104393 .each = .{ .once = &.{
104394 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104395 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104396 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104397 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104398 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104399 .{ ._, ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
104400 } },
104401 }, .{
104402 .required_features = .{ .@"64bit", .sse, null, null },
104403 .dst_constraints = .{ .{ .signed_int = .word }, .any },
104404 .patterns = &.{
104405 .{ .src = .{ .to_gpr, .simm32, .none } },
104406 },
104407 .call_frame = .{ .alignment = .@"16" },
104408 .extra_temps = .{
104409 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104410 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104411 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104412 .unused,
104413 .unused,
104414 .unused,
104415 .unused,
104416 .unused,
104417 .unused,
104418 .unused,
104419 .unused,
104420 },
104421 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104422 .clobbers = .{ .eflags = true },
104423 .each = .{ .once = &.{
104424 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104425 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104426 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104427 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104428 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104429 .{ ._, ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
104430 } },
104431 }, .{
104432 .required_features = .{ .@"64bit", null, null, null },
104433 .dst_constraints = .{ .{ .signed_int = .word }, .any },
104434 .patterns = &.{
104435 .{ .src = .{ .to_gpr, .simm32, .none } },
104436 },
104437 .call_frame = .{ .alignment = .@"8" },
104438 .extra_temps = .{
104439 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104440 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104441 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104442 .unused,
104443 .unused,
104444 .unused,
104445 .unused,
104446 .unused,
104447 .unused,
104448 .unused,
104449 .unused,
104450 },
104451 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104452 .clobbers = .{ .eflags = true },
104453 .each = .{ .once = &.{
104454 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104455 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104456 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104457 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104458 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104459 .{ ._, ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
104460 } },
104461 }, .{
104462 .required_features = .{ .@"64bit", .avx, null, null },
104463 .dst_constraints = .{ .{ .int = .dword }, .any },
104464 .patterns = &.{
104465 .{ .src = .{ .to_gpr, .simm32, .none } },
104466 },
104467 .call_frame = .{ .alignment = .@"32" },
104468 .extra_temps = .{
104469 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104470 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104471 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104472 .unused,
104473 .unused,
104474 .unused,
104475 .unused,
104476 .unused,
104477 .unused,
104478 .unused,
104479 .unused,
104480 },
104481 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104482 .clobbers = .{ .eflags = true },
104483 .each = .{ .once = &.{
104484 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104485 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104486 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104487 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104488 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104489 .{ ._, ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .dst0), ._, ._ },
104490 } },
104491 }, .{
104492 .required_features = .{ .@"64bit", .sse, null, null },
104493 .dst_constraints = .{ .{ .int = .dword }, .any },
104494 .patterns = &.{
104495 .{ .src = .{ .to_gpr, .simm32, .none } },
104496 },
104497 .call_frame = .{ .alignment = .@"16" },
104498 .extra_temps = .{
104499 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104500 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104501 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104502 .unused,
104503 .unused,
104504 .unused,
104505 .unused,
104506 .unused,
104507 .unused,
104508 .unused,
104509 .unused,
104510 },
104511 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104512 .clobbers = .{ .eflags = true },
104513 .each = .{ .once = &.{
104514 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104515 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104516 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104517 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104518 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104519 .{ ._, ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .dst0), ._, ._ },
104520 } },
104521 }, .{
104522 .required_features = .{ .@"64bit", null, null, null },
104523 .dst_constraints = .{ .{ .int = .dword }, .any },
104524 .patterns = &.{
104525 .{ .src = .{ .to_gpr, .simm32, .none } },
104526 },
104527 .call_frame = .{ .alignment = .@"8" },
104528 .extra_temps = .{
104529 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104530 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104531 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104532 .unused,
104533 .unused,
104534 .unused,
104535 .unused,
104536 .unused,
104537 .unused,
104538 .unused,
104539 .unused,
104540 },
104541 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104542 .clobbers = .{ .eflags = true },
104543 .each = .{ .once = &.{
104544 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104545 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104546 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104547 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104548 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104549 .{ ._, ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .dst0), ._, ._ },
104550 } },
104551 }, .{
104552 .required_features = .{ .@"64bit", .avx, null, null },
104553 .dst_constraints = .{ .{ .int = .qword }, .any },
104554 .patterns = &.{
104555 .{ .src = .{ .to_gpr, .simm32, .none } },
104556 },
104557 .call_frame = .{ .alignment = .@"32" },
104558 .extra_temps = .{
104559 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104560 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104561 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104562 .unused,
104563 .unused,
104564 .unused,
104565 .unused,
104566 .unused,
104567 .unused,
104568 .unused,
104569 .unused,
104570 },
104571 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104572 .clobbers = .{ .eflags = true },
104573 .each = .{ .once = &.{
104574 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104575 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104576 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104577 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104578 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104579 .{ ._, ._, .mov, .dst0q, .leasi(.tmp0q, .@"8", .dst0), ._, ._ },
104580 } },
104581 }, .{
104582 .required_features = .{ .@"64bit", .sse, null, null },
104583 .dst_constraints = .{ .{ .int = .qword }, .any },
104584 .patterns = &.{
104585 .{ .src = .{ .to_gpr, .simm32, .none } },
104586 },
104587 .call_frame = .{ .alignment = .@"16" },
104588 .extra_temps = .{
104589 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104590 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104591 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104592 .unused,
104593 .unused,
104594 .unused,
104595 .unused,
104596 .unused,
104597 .unused,
104598 .unused,
104599 .unused,
104600 },
104601 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104602 .clobbers = .{ .eflags = true },
104603 .each = .{ .once = &.{
104604 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104605 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104606 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104607 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104608 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104609 .{ ._, ._, .mov, .dst0q, .leasi(.tmp0q, .@"8", .dst0), ._, ._ },
104610 } },
104611 }, .{
104612 .required_features = .{ .@"64bit", null, null, null },
104613 .dst_constraints = .{ .{ .int = .qword }, .any },
104614 .patterns = &.{
104615 .{ .src = .{ .to_gpr, .simm32, .none } },
104616 },
104617 .call_frame = .{ .alignment = .@"8" },
104618 .extra_temps = .{
104619 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104620 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104621 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104622 .unused,
104623 .unused,
104624 .unused,
104625 .unused,
104626 .unused,
104627 .unused,
104628 .unused,
104629 .unused,
104630 },
104631 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104632 .clobbers = .{ .eflags = true },
104633 .each = .{ .once = &.{
104634 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104635 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104636 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104637 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104638 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104639 .{ ._, ._, .mov, .dst0q, .leasi(.tmp0q, .@"8", .dst0), ._, ._ },
104640 } },
104641 }, .{
104642 .required_features = .{ .avx, null, null, null },
104643 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104644 .patterns = &.{
104645 .{ .src = .{ .to_gpr, .simm32, .none } },
104646 },
104647 .call_frame = .{ .alignment = .@"32" },
104648 .extra_temps = .{
104649 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104650 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104651 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104652 .unused,
104653 .unused,
104654 .unused,
104655 .unused,
104656 .unused,
104657 .unused,
104658 .unused,
104659 .unused,
104660 },
104661 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104662 .clobbers = .{ .eflags = true },
104663 .each = .{ .once = &.{
104664 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104665 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104666 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104667 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104668 .{ .@"0:", ._, .movzx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104669 } },
104670 }, .{
104671 .required_features = .{ .sse, null, null, null },
104672 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104673 .patterns = &.{
104674 .{ .src = .{ .to_gpr, .simm32, .none } },
104675 },
104676 .call_frame = .{ .alignment = .@"16" },
104677 .extra_temps = .{
104678 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104679 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104680 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104681 .unused,
104682 .unused,
104683 .unused,
104684 .unused,
104685 .unused,
104686 .unused,
104687 .unused,
104688 .unused,
104689 },
104690 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104691 .clobbers = .{ .eflags = true },
104692 .each = .{ .once = &.{
104693 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104694 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104695 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104696 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104697 .{ .@"0:", ._, .movzx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104698 } },
104699 }, .{
104700 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104701 .patterns = &.{
104702 .{ .src = .{ .to_gpr, .simm32, .none } },
104703 },
104704 .call_frame = .{ .alignment = .@"8" },
104705 .extra_temps = .{
104706 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104707 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104708 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104709 .unused,
104710 .unused,
104711 .unused,
104712 .unused,
104713 .unused,
104714 .unused,
104715 .unused,
104716 .unused,
104717 },
104718 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104719 .clobbers = .{ .eflags = true },
104720 .each = .{ .once = &.{
104721 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104722 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104723 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104724 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104725 .{ .@"0:", ._, .movzx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104726 } },
104727 }, .{
104728 .required_features = .{ .avx, null, null, null },
104729 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104730 .patterns = &.{
104731 .{ .src = .{ .to_gpr, .simm32, .none } },
104732 },
104733 .call_frame = .{ .alignment = .@"32" },
104734 .extra_temps = .{
104735 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104736 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104737 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104738 .unused,
104739 .unused,
104740 .unused,
104741 .unused,
104742 .unused,
104743 .unused,
104744 .unused,
104745 .unused,
104746 },
104747 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104748 .clobbers = .{ .eflags = true },
104749 .each = .{ .once = &.{
104750 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104751 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104752 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104753 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104754 .{ .@"0:", ._, .movsx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104755 } },
104756 }, .{
104757 .required_features = .{ .sse, null, null, null },
104758 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104759 .patterns = &.{
104760 .{ .src = .{ .to_gpr, .simm32, .none } },
104761 },
104762 .call_frame = .{ .alignment = .@"16" },
104763 .extra_temps = .{
104764 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104765 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104766 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104767 .unused,
104768 .unused,
104769 .unused,
104770 .unused,
104771 .unused,
104772 .unused,
104773 .unused,
104774 .unused,
104775 },
104776 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104777 .clobbers = .{ .eflags = true },
104778 .each = .{ .once = &.{
104779 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104780 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104781 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104782 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104783 .{ .@"0:", ._, .movsx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104784 } },
104785 }, .{
104786 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104787 .patterns = &.{
104788 .{ .src = .{ .to_gpr, .simm32, .none } },
104789 },
104790 .call_frame = .{ .alignment = .@"8" },
104791 .extra_temps = .{
104792 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104793 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104794 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104795 .unused,
104796 .unused,
104797 .unused,
104798 .unused,
104799 .unused,
104800 .unused,
104801 .unused,
104802 .unused,
104803 },
104804 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104805 .clobbers = .{ .eflags = true },
104806 .each = .{ .once = &.{
104807 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104808 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104809 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104810 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104811 .{ .@"0:", ._, .movsx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104812 } },
104813 }, .{
104814 .required_features = .{ .avx, null, null, null },
104815 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
104816 .patterns = &.{
104817 .{ .src = .{ .to_gpr, .simm32, .none } },
104818 },
104819 .call_frame = .{ .alignment = .@"32" },
104820 .extra_temps = .{
104821 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104822 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104823 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104824 .unused,
104825 .unused,
104826 .unused,
104827 .unused,
104828 .unused,
104829 .unused,
104830 .unused,
104831 .unused,
104832 },
104833 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104834 .clobbers = .{ .eflags = true },
104835 .each = .{ .once = &.{
104836 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104837 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104838 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104839 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104840 .{ .@"0:", ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104841 } },
104842 }, .{
104843 .required_features = .{ .sse, null, null, null },
104844 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
104845 .patterns = &.{
104846 .{ .src = .{ .to_gpr, .simm32, .none } },
104847 },
104848 .call_frame = .{ .alignment = .@"16" },
104849 .extra_temps = .{
104850 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104851 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104852 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104853 .unused,
104854 .unused,
104855 .unused,
104856 .unused,
104857 .unused,
104858 .unused,
104859 .unused,
104860 .unused,
104861 },
104862 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104863 .clobbers = .{ .eflags = true },
104864 .each = .{ .once = &.{
104865 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104866 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104867 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104868 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104869 .{ .@"0:", ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104870 } },
104871 }, .{
104872 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
104873 .patterns = &.{
104874 .{ .src = .{ .to_gpr, .simm32, .none } },
104875 },
104876 .call_frame = .{ .alignment = .@"8" },
104877 .extra_temps = .{
104878 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104879 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104880 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104881 .unused,
104882 .unused,
104883 .unused,
104884 .unused,
104885 .unused,
104886 .unused,
104887 .unused,
104888 .unused,
104889 },
104890 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104891 .clobbers = .{ .eflags = true },
104892 .each = .{ .once = &.{
104893 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104894 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104895 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104896 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104897 .{ .@"0:", ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104898 } },
104899 }, .{
104900 .required_features = .{ .avx, null, null, null },
104901 .dst_constraints = .{ .{ .signed_int = .word }, .any },
104902 .patterns = &.{
104903 .{ .src = .{ .to_gpr, .simm32, .none } },
104904 },
104905 .call_frame = .{ .alignment = .@"32" },
104906 .extra_temps = .{
104907 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104908 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104909 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104910 .unused,
104911 .unused,
104912 .unused,
104913 .unused,
104914 .unused,
104915 .unused,
104916 .unused,
104917 .unused,
104918 },
104919 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104920 .clobbers = .{ .eflags = true },
104921 .each = .{ .once = &.{
104922 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104923 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104924 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104925 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104926 .{ .@"0:", ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104927 } },
104928 }, .{
104929 .required_features = .{ .sse, null, null, null },
104930 .dst_constraints = .{ .{ .signed_int = .word }, .any },
104931 .patterns = &.{
104932 .{ .src = .{ .to_gpr, .simm32, .none } },
104933 },
104934 .call_frame = .{ .alignment = .@"16" },
104935 .extra_temps = .{
104936 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104937 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104938 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104939 .unused,
104940 .unused,
104941 .unused,
104942 .unused,
104943 .unused,
104944 .unused,
104945 .unused,
104946 .unused,
104947 },
104948 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104949 .clobbers = .{ .eflags = true },
104950 .each = .{ .once = &.{
104951 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104952 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104953 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104954 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104955 .{ .@"0:", ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104956 } },
104957 }, .{
104958 .dst_constraints = .{ .{ .signed_int = .word }, .any },
104959 .patterns = &.{
104960 .{ .src = .{ .to_gpr, .simm32, .none } },
104961 },
104962 .call_frame = .{ .alignment = .@"8" },
104963 .extra_temps = .{
104964 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104965 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104966 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104967 .unused,
104968 .unused,
104969 .unused,
104970 .unused,
104971 .unused,
104972 .unused,
104973 .unused,
104974 .unused,
104975 },
104976 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104977 .clobbers = .{ .eflags = true },
104978 .each = .{ .once = &.{
104979 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104980 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104981 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104982 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104983 .{ .@"0:", ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104984 } },
104985 }, .{
104986 .required_features = .{ .avx, null, null, null },
104987 .dst_constraints = .{ .{ .int = .dword }, .any },
104988 .patterns = &.{
104989 .{ .src = .{ .to_gpr, .simm32, .none } },
104990 },
104991 .call_frame = .{ .alignment = .@"32" },
104992 .extra_temps = .{
104993 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104994 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104995 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104996 .unused,
104997 .unused,
104998 .unused,
104999 .unused,
105000 .unused,
105001 .unused,
105002 .unused,
105003 .unused,
105004 },
105005 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
105006 .clobbers = .{ .eflags = true },
105007 .each = .{ .once = &.{
105008 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
105009 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
105010 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
105011 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
105012 .{ .@"0:", ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .src0), ._, ._ },
105013 } },
105014 }, .{
105015 .required_features = .{ .sse, null, null, null },
105016 .dst_constraints = .{ .{ .int = .dword }, .any },
105017 .patterns = &.{
105018 .{ .src = .{ .to_gpr, .simm32, .none } },
105019 },
105020 .call_frame = .{ .alignment = .@"16" },
105021 .extra_temps = .{
105022 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
105023 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
105024 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
105025 .unused,
105026 .unused,
105027 .unused,
105028 .unused,
105029 .unused,
105030 .unused,
105031 .unused,
105032 .unused,
105033 },
105034 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
105035 .clobbers = .{ .eflags = true },
105036 .each = .{ .once = &.{
105037 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
105038 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
105039 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
105040 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
105041 .{ .@"0:", ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .src0), ._, ._ },
105042 } },
105043 }, .{
105044 .dst_constraints = .{ .{ .int = .dword }, .any },
105045 .patterns = &.{
105046 .{ .src = .{ .to_gpr, .simm32, .none } },
105047 },
105048 .call_frame = .{ .alignment = .@"8" },
105049 .extra_temps = .{
105050 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
105051 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
105052 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
105053 .unused,
105054 .unused,
105055 .unused,
105056 .unused,
105057 .unused,
105058 .unused,
105059 .unused,
105060 .unused,
105061 },
105062 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
105063 .clobbers = .{ .eflags = true },
105064 .each = .{ .once = &.{
105065 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
105066 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
105067 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
105068 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
105069 .{ .@"0:", ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .src0), ._, ._ },
105070 } },
105071 } },
105072 }) catch |err| switch (err) {
105073 error.SelectFailed => return cg.fail("failed to select {t} {f} {f} {f}", .{
105074 air_tag,
105075 unrestricted_ty.fmt(pt),
105076 restricted_ty.fmt(pt),
105077 ops[0].tracking(cg),
105078 }),
105079 else => |e| return e,
104134 };105080 };
104135 for (ops[1..]) |op| try op.die(cg);105081 for (ops[1..]) |op| try op.die(cg);
104136 try res.finish(inst, &.{ty_op.operand}, ops[0..1], cg);105082 try res[0].finish(inst, &.{ty_op.operand}, ops[0..1], cg);
104137 },105083 },
104138 .struct_field_ptr => {105084 .struct_field_ptr => {
104139 const ty_pl = air_datas[@intFromEnum(inst)].ty_pl;105085 const ty_pl = air_datas[@intFromEnum(inst)].ty_pl;
...@@ -104306,7 +105252,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -104306,7 +105252,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104306 .{ ._, ._, .bt, .src0d, .src1d, ._, ._ },105252 .{ ._, ._, .bt, .src0d, .src1d, ._, ._ },
104307 } },105253 } },
104308 }, .{105254 }, .{
104309 .dst_constraints = .{ .{ .int = .byte }, .any },105255 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104310 .patterns = &.{105256 .patterns = &.{
104311 .{ .src = .{ .to_mem, .simm32, .none } },105257 .{ .src = .{ .to_mem, .simm32, .none } },
104312 },105258 },
...@@ -104315,32 +105261,68 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -104315,32 +105261,68 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104315 .{ ._, ._, .movzx, .dst0d, .mema(.src0b, .add_src0_elem_size_mul_src1), ._, ._ },105261 .{ ._, ._, .movzx, .dst0d, .mema(.src0b, .add_src0_elem_size_mul_src1), ._, ._ },
104316 } },105262 } },
104317 }, .{105263 }, .{
104318 .dst_constraints = .{ .{ .int = .byte }, .any },105264 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104319 .patterns = &.{105265 .patterns = &.{
104320 .{ .src = .{ .to_mem, .to_gpr, .none } },105266 .{ .src = .{ .to_mem, .to_gpr, .none } },
104321 },105267 },
104322 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },105268 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src1, .rc = .general_purpose } }, .unused },
104323 .each = .{ .once = &.{105269 .each = .{ .once = &.{
104324 .{ ._, ._, .movzx, .dst0d, .memi(.src0b, .src1), ._, ._ },105270 .{ ._, ._, .movzx, .dst0d, .memi(.src0b, .src1), ._, ._ },
104325 } },105271 } },
104326 }, .{105272 }, .{
104327 .dst_constraints = .{ .{ .int = .word }, .any },105273 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104328 .patterns = &.{105274 .patterns = &.{
104329 .{ .src = .{ .to_mem, .simm32, .none } },105275 .{ .src = .{ .to_mem, .simm32, .none } },
104330 },105276 },
104331 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },105277 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },
104332 .each = .{ .once = &.{105278 .each = .{ .once = &.{
104333 .{ ._, ._, .movzx, .dst0d, .mema(.src0w, .add_src0_elem_size_mul_src1), ._, ._ },105279 .{ ._, ._, .movsx, .dst0d, .mema(.src0b, .add_src0_elem_size_mul_src1), ._, ._ },
104334 } },105280 } },
104335 }, .{105281 }, .{
104336 .dst_constraints = .{ .{ .int = .word }, .any },105282 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104337 .patterns = &.{105283 .patterns = &.{
104338 .{ .src = .{ .to_mem, .to_gpr, .none } },105284 .{ .src = .{ .to_mem, .to_gpr, .none } },
104339 },105285 },
105286 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src1, .rc = .general_purpose } }, .unused },
105287 .each = .{ .once = &.{
105288 .{ ._, ._, .movsx, .dst0d, .memi(.src0b, .src1), ._, ._ },
105289 } },
105290 }, .{
105291 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
105292 .patterns = &.{
105293 .{ .src = .{ .to_mem, .simm32, .none } },
105294 },
104340 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },105295 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },
105296 .each = .{ .once = &.{
105297 .{ ._, ._, .movzx, .dst0d, .mema(.src0w, .add_src0_elem_size_mul_src1), ._, ._ },
105298 } },
105299 }, .{
105300 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
105301 .patterns = &.{
105302 .{ .src = .{ .to_mem, .to_gpr, .none } },
105303 },
105304 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src1, .rc = .general_purpose } }, .unused },
104341 .each = .{ .once = &.{105305 .each = .{ .once = &.{
104342 .{ ._, ._, .movzx, .dst0d, .memsi(.src0w, .@"2", .src1), ._, ._ },105306 .{ ._, ._, .movzx, .dst0d, .memsi(.src0w, .@"2", .src1), ._, ._ },
104343 } },105307 } },
105308 }, .{
105309 .dst_constraints = .{ .{ .signed_int = .word }, .any },
105310 .patterns = &.{
105311 .{ .src = .{ .to_mem, .simm32, .none } },
105312 },
105313 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },
105314 .each = .{ .once = &.{
105315 .{ ._, ._, .movsx, .dst0d, .mema(.src0w, .add_src0_elem_size_mul_src1), ._, ._ },
105316 } },
105317 }, .{
105318 .dst_constraints = .{ .{ .signed_int = .word }, .any },
105319 .patterns = &.{
105320 .{ .src = .{ .to_mem, .to_gpr, .none } },
105321 },
105322 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src1, .rc = .general_purpose } }, .unused },
105323 .each = .{ .once = &.{
105324 .{ ._, ._, .movsx, .dst0d, .memsi(.src0w, .@"2", .src1), ._, ._ },
105325 } },
104344 }, .{105326 }, .{
104345 .dst_constraints = .{ .{ .int = .dword }, .any },105327 .dst_constraints = .{ .{ .int = .dword }, .any },
104346 .patterns = &.{105328 .patterns = &.{
...@@ -104355,7 +105337,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -104355,7 +105337,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104355 .patterns = &.{105337 .patterns = &.{
104356 .{ .src = .{ .to_mem, .to_gpr, .none } },105338 .{ .src = .{ .to_mem, .to_gpr, .none } },
104357 },105339 },
104358 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },105340 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src1, .rc = .general_purpose } }, .unused },
104359 .each = .{ .once = &.{105341 .each = .{ .once = &.{
104360 .{ ._, ._, .mov, .dst0d, .memsi(.src0d, .@"4", .src1), ._, ._ },105342 .{ ._, ._, .mov, .dst0d, .memsi(.src0d, .@"4", .src1), ._, ._ },
104361 } },105343 } },
...@@ -104375,7 +105357,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {...@@ -104375,7 +105357,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104375 .patterns = &.{105357 .patterns = &.{
104376 .{ .src = .{ .to_mem, .to_gpr, .none } },105358 .{ .src = .{ .to_mem, .to_gpr, .none } },
104377 },105359 },
104378 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },105360 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src1, .rc = .general_purpose } }, .unused },
104379 .each = .{ .once = &.{105361 .each = .{ .once = &.{
104380 .{ ._, ._, .mov, .dst0q, .memsi(.src0q, .@"8", .src1), ._, ._ },105362 .{ ._, ._, .mov, .dst0q, .memsi(.src0q, .@"8", .src1), ._, ._ },
104381 } },105363 } },
...@@ -174389,28 +175371,26 @@ fn allocRegOrMemAdvanced(self: *CodeGen, ty: Type, inst: ?Air.Inst.Index, reg_ok...@@ -174389,28 +175371,26 @@ fn allocRegOrMemAdvanced(self: *CodeGen, ty: Type, inst: ?Air.Inst.Index, reg_ok
174389175371
174390 if (reg_ok) need_mem: {175372 if (reg_ok) need_mem: {
174391 if (!std.math.isPowerOfTwo(abi_size)) break :need_mem;175373 if (!std.math.isPowerOfTwo(abi_size)) break :need_mem;
174392 const unrestricted_ty: Type = if (ty.unrestrictedType(zcu)) |unrestricted_ty| switch (ty.restrictedRepr(zcu)) {175374 if (zcu.intern_pool.isRestrictedType(ty.toIntern()) or
174393 .indirect => .usize,175375 abi_size <= @as(u32, max_abi_size: switch (ty.zigTypeTag(zcu)) {
174394 .direct => unrestricted_ty,175376 .float => switch (ty.floatBits(self.target)) {
174395 } else ty;175377 16, 32, 64, 128 => 16,
174396 if (abi_size <= @as(u32, max_abi_size: switch (unrestricted_ty.zigTypeTag(zcu)) {
174397 .float => switch (ty.floatBits(self.target)) {
174398 16, 32, 64, 128 => 16,
174399 80 => break :need_mem,
174400 else => unreachable,
174401 },
174402 .vector => {
174403 const elem_ty = ty.childType(zcu);
174404 break :max_abi_size if (elem_ty.toIntern() == .bool_type)
174405 8
174406 else if (self.floatBits(elem_ty)) |float_bits| switch (float_bits) {
174407 16, 32, 64, 128 => self.vectorSize(.float),
174408 80 => break :need_mem,175378 80 => break :need_mem,
174409 else => unreachable,175379 else => unreachable,
174410 } else self.vectorSize(.int);175380 },
174411 },175381 .vector => {
174412 else => 8,175382 const elem_ty = ty.childType(zcu);
174413 })) {175383 break :max_abi_size if (elem_ty.toIntern() == .bool_type)
175384 8
175385 else if (self.floatBits(elem_ty)) |float_bits| switch (float_bits) {
175386 16, 32, 64, 128 => self.vectorSize(.float),
175387 80 => break :need_mem,
175388 else => unreachable,
175389 } else self.vectorSize(.int);
175390 },
175391 else => 8,
175392 }))
175393 {
174414 if (self.register_manager.tryAllocReg(inst, self.regSetForType(ty))) |reg| {175394 if (self.register_manager.tryAllocReg(inst, self.regSetForType(ty))) |reg| {
174415 return MCValue{ .register = registerAlias(reg, abi_size) };175395 return MCValue{ .register = registerAlias(reg, abi_size) };
174416 }175396 }
...@@ -181410,7 +182390,6 @@ fn lowerValue(cg: *CodeGen, val: Value) Allocator.Error!MCValue {...@@ -181410,7 +182390,6 @@ fn lowerValue(cg: *CodeGen, val: Value) Allocator.Error!MCValue {
181410 .lea_nav => |nav| .{ .lea_nav = nav },182390 .lea_nav => |nav| .{ .lea_nav = nav },
181411 .lea_uav => |uav| .{ .lea_uav = uav },182391 .lea_uav => |uav| .{ .lea_uav = uav },
181412 .load_uav => |uav| .{ .load_uav = uav },182392 .load_uav => |uav| .{ .load_uav = uav },
181413 .lea_lazy_sym => |lazy_sym| .{ .lea_lazy_sym = lazy_sym },
181414 };182393 };
181415}182394}
181416182395
...@@ -189344,7 +190323,6 @@ const Select = struct {...@@ -189344,7 +190323,6 @@ const Select = struct {
189344 ptr_size,190323 ptr_size,
189345 ptr_bit_size,190324 ptr_bit_size,
189346 size,190325 size,
189347 log2_size,
189348 src0_size,190326 src0_size,
189349 dst0_size,190327 dst0_size,
189350 delta_size,190328 delta_size,
...@@ -189379,7 +190357,6 @@ const Select = struct {...@@ -189379,7 +190357,6 @@ const Select = struct {
189379 rhs: Memory.Scale,190357 rhs: Memory.Scale,
189380190358
189381 const none: Adjust = .{ .sign = .pos, .lhs = .none, .op = .mul, .rhs = .@"1" };190359 const none: Adjust = .{ .sign = .pos, .lhs = .none, .op = .mul, .rhs = .@"1" };
189382 const add_ptr_size: Adjust = .{ .sign = .pos, .lhs = .ptr_size, .op = .mul, .rhs = .@"1" };
189383 const sub_ptr_size: Adjust = .{ .sign = .neg, .lhs = .ptr_size, .op = .mul, .rhs = .@"1" };190360 const sub_ptr_size: Adjust = .{ .sign = .neg, .lhs = .ptr_size, .op = .mul, .rhs = .@"1" };
189384 const add_ptr_bit_size: Adjust = .{ .sign = .pos, .lhs = .ptr_bit_size, .op = .mul, .rhs = .@"1" };190361 const add_ptr_bit_size: Adjust = .{ .sign = .pos, .lhs = .ptr_bit_size, .op = .mul, .rhs = .@"1" };
189385 const add_size: Adjust = .{ .sign = .pos, .lhs = .size, .op = .mul, .rhs = .@"1" };190362 const add_size: Adjust = .{ .sign = .pos, .lhs = .size, .op = .mul, .rhs = .@"1" };
...@@ -189388,7 +190365,6 @@ const Select = struct {...@@ -189388,7 +190365,6 @@ const Select = struct {
189388 const sub_size_div_8: Adjust = .{ .sign = .neg, .lhs = .size, .op = .div, .rhs = .@"8" };190365 const sub_size_div_8: Adjust = .{ .sign = .neg, .lhs = .size, .op = .div, .rhs = .@"8" };
189389 const sub_size_div_4: Adjust = .{ .sign = .neg, .lhs = .size, .op = .div, .rhs = .@"4" };190366 const sub_size_div_4: Adjust = .{ .sign = .neg, .lhs = .size, .op = .div, .rhs = .@"4" };
189390 const sub_size: Adjust = .{ .sign = .neg, .lhs = .size, .op = .mul, .rhs = .@"1" };190367 const sub_size: Adjust = .{ .sign = .neg, .lhs = .size, .op = .mul, .rhs = .@"1" };
189391 const add_log2_size: Adjust = .{ .sign = .pos, .lhs = .log2_size, .op = .mul, .rhs = .@"1" };
189392 const sub_src0_size_div_8: Adjust = .{ .sign = .neg, .lhs = .src0_size, .op = .div, .rhs = .@"8" };190368 const sub_src0_size_div_8: Adjust = .{ .sign = .neg, .lhs = .src0_size, .op = .div, .rhs = .@"8" };
189393 const sub_src0_size: Adjust = .{ .sign = .neg, .lhs = .src0_size, .op = .mul, .rhs = .@"1" };190369 const sub_src0_size: Adjust = .{ .sign = .neg, .lhs = .src0_size, .op = .mul, .rhs = .@"1" };
189394 const add_src0_size: Adjust = .{ .sign = .pos, .lhs = .src0_size, .op = .mul, .rhs = .@"1" };190370 const add_src0_size: Adjust = .{ .sign = .pos, .lhs = .src0_size, .op = .mul, .rhs = .@"1" };
...@@ -189449,6 +190425,7 @@ const Select = struct {...@@ -189449,6 +190425,7 @@ const Select = struct {
189449 const add_src1: Adjust = .{ .sign = .pos, .lhs = .src1, .op = .mul, .rhs = .@"1" };190425 const add_src1: Adjust = .{ .sign = .pos, .lhs = .src1, .op = .mul, .rhs = .@"1" };
189450 const add_src1_rem_32: Adjust = .{ .sign = .pos, .lhs = .src1, .op = .rem_8_mul, .rhs = .@"4" };190426 const add_src1_rem_32: Adjust = .{ .sign = .pos, .lhs = .src1, .op = .rem_8_mul, .rhs = .@"4" };
189451 const add_src1_rem_64: Adjust = .{ .sign = .pos, .lhs = .src1, .op = .rem_8_mul, .rhs = .@"8" };190427 const add_src1_rem_64: Adjust = .{ .sign = .pos, .lhs = .src1, .op = .rem_8_mul, .rhs = .@"8" };
190428 const sub_src1: Adjust = .{ .sign = .neg, .lhs = .src1, .op = .mul, .rhs = .@"1" };
189452 const add_src1_sub_bit_size: Adjust = .{ .sign = .pos, .lhs = .src1_sub_bit_size, .op = .mul, .rhs = .@"1" };190429 const add_src1_sub_bit_size: Adjust = .{ .sign = .pos, .lhs = .src1_sub_bit_size, .op = .mul, .rhs = .@"1" };
189453 const add_log2_src0_elem_size: Adjust = .{ .sign = .pos, .lhs = .log2_src0_elem_size, .op = .mul, .rhs = .@"1" };190430 const add_log2_src0_elem_size: Adjust = .{ .sign = .pos, .lhs = .log2_src0_elem_size, .op = .mul, .rhs = .@"1" };
189454 const elem_mask: Adjust = .{ .sign = .pos, .lhs = .elem_mask, .op = .mul, .rhs = .@"1" };190431 const elem_mask: Adjust = .{ .sign = .pos, .lhs = .elem_mask, .op = .mul, .rhs = .@"1" };
...@@ -190323,7 +191300,6 @@ const Select = struct {...@@ -190323,7 +191300,6 @@ const Select = struct {
190323 .none => 0,191300 .none => 0,
190324 .ptr_size => @divExact(s.cg.target.ptrBitWidth(), 8),191301 .ptr_size => @divExact(s.cg.target.ptrBitWidth(), 8),
190325 .ptr_bit_size => s.cg.target.ptrBitWidth(),191302 .ptr_bit_size => s.cg.target.ptrBitWidth(),
190326 .log2_size => std.math.log2_int_ceil(u64, op.flags.base.ref.typeOf(s).abiSize(s.cg.pt.zcu)),
190327 .size => @intCast(op.flags.base.ref.typeOf(s).abiSize(s.cg.pt.zcu)),191303 .size => @intCast(op.flags.base.ref.typeOf(s).abiSize(s.cg.pt.zcu)),
190328 .src0_size => @intCast(Select.Operand.Ref.src0.typeOf(s).abiSize(s.cg.pt.zcu)),191304 .src0_size => @intCast(Select.Operand.Ref.src0.typeOf(s).abiSize(s.cg.pt.zcu)),
190329 .dst0_size => @intCast(Select.Operand.Ref.dst0.typeOf(s).abiSize(s.cg.pt.zcu)),191305 .dst0_size => @intCast(Select.Operand.Ref.dst0.typeOf(s).abiSize(s.cg.pt.zcu)),
src/codegen/x86_64/Mir.zig+3-3
...@@ -1877,15 +1877,15 @@ pub const Memory = struct {...@@ -1877,15 +1877,15 @@ pub const Memory = struct {
1877 .mod = mem.mod,1877 .mod = mem.mod,
1878 .size = switch (mem.mod) {1878 .size = switch (mem.mod) {
1879 .rm => |rm| rm.size,1879 .rm => |rm| rm.size,
1880 .off => undefined,1880 .off => .none,
1881 },1881 },
1882 .index = switch (mem.mod) {1882 .index = switch (mem.mod) {
1883 .rm => |rm| rm.index,1883 .rm => |rm| rm.index,
1884 .off => undefined,1884 .off => .none,
1885 },1885 },
1886 .scale = switch (mem.mod) {1886 .scale = switch (mem.mod) {
1887 .rm => |rm| rm.scale,1887 .rm => |rm| rm.scale,
1888 .off => undefined,1888 .off => .@"1",
1889 },1889 },
1890 },1890 },
1891 .base = switch (mem.base) {1891 .base = switch (mem.base) {
src/link.zig+6
...@@ -412,6 +412,8 @@ pub const File = struct {...@@ -412,6 +412,8 @@ pub const File = struct {
412 lock: ?Cache.Lock = null,412 lock: ?Cache.Lock = null,
413 child_pid: ?std.process.Child.Id = null,413 child_pid: ?std.process.Child.Id = null,
414414
415 restricted: std.array_hash_map.Auto(InternPool.Index, std.array_hash_map.Auto(InternPool.Index, void)) = .empty,
416
415 pub const OpenOptions = struct {417 pub const OpenOptions = struct {
416 symbol_count_hint: u64 = 32,418 symbol_count_hint: u64 = 32,
417 program_code_size_hint: u64 = 256 * 1024,419 program_code_size_hint: u64 = 256 * 1024,
...@@ -894,6 +896,10 @@ pub const File = struct {...@@ -894,6 +896,10 @@ pub const File = struct {
894 }896 }
895897
896 pub fn destroy(base: *File) void {898 pub fn destroy(base: *File) void {
899 const gpa = base.comp.gpa;
900 for (base.restricted.values()) |*value| value.deinit(gpa);
901 base.restricted.deinit(gpa);
902
897 const io = base.comp.io;903 const io = base.comp.io;
898 base.releaseLock();904 base.releaseLock();
899 if (base.file) |f| f.close(io);905 if (base.file) |f| f.close(io);
src/link/Coff.zig+1
...@@ -1912,6 +1912,7 @@ fn flushUav(...@@ -1912,6 +1912,7 @@ fn flushUav(
1912 try coff.nodes.ensureUnusedCapacity(gpa, 1);1912 try coff.nodes.ensureUnusedCapacity(gpa, 1);
1913 const sym = si.get(coff);1913 const sym = si.get(coff);
1914 const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{1914 const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{
1915 .size = Type.fromInterned(zcu.intern_pool.typeOf(uav_val)).abiSize(zcu),
1915 .alignment = uav_align.toStdMem(),1916 .alignment = uav_align.toStdMem(),
1916 .moved = true,1917 .moved = true,
1917 });1918 });
src/link/Dwarf.zig+36-34
...@@ -3510,13 +3510,9 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -3510,13 +3510,9 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
35103510
3511 if (value_index == .anyerror_type) return; // handled in `flush` instead3511 if (value_index == .anyerror_type) return; // handled in `flush` instead
35123512
3513 const value_ip_key: InternPool.Key = switch (ip.indexToKey(value_index)) {3513 const value_ip_key = switch (ip.indexToKey(value_index)) {
3514 .func => return, // populated by the Nav instead (`updateComptimeNav` or `initWipNav`)3514 .func => return, // populated by the Nav instead (`updateComptimeNav` or `initWipNav`)
3515 .@"extern" => return, // populated by the Nav instead (`initWipNav`)3515 .@"extern" => return, // populated by the Nav instead (`initWipNav`)
3516 .restricted_value => |restricted_value| switch (Type.restrictedRepr(.fromInterned(restricted_value.ty), zcu)) {
3517 .indirect => .{ .restricted_value = restricted_value },
3518 .direct => ip.indexToKey(restricted_value.unrestricted_value),
3519 },
3520 else => |key| key,3516 else => |key| key,
3521 };3517 };
35223518
...@@ -3845,26 +3841,20 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -3845,26 +3841,20 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
3845 .adhoc_inferred_error_set => unreachable,3841 .adhoc_inferred_error_set => unreachable,
3846 },3842 },
3847 .restricted_type => |restricted_type| {3843 .restricted_type => |restricted_type| {
3848 const repr = Type.restrictedReprByTrackedInst(restricted_type.zir_index, zcu);3844 try wip_nav.abbrevCode(.generated_struct_type);
3849 try wip_nav.abbrevCode(switch (repr) {
3850 .indirect => .ptr_type,
3851 .direct => .alias_type,
3852 });
3853 try wip_nav.strpFmt("{f}", .{val.toType().fmt(pt)});3845 try wip_nav.strpFmt("{f}", .{val.toType().fmt(pt)});
3854 switch (repr) {3846 try diw.writeUleb128(val.toType().abiSize(zcu));
3855 .indirect => {3847 try diw.writeUleb128(val.toType().abiAlignment(zcu).toByteUnits().?);
3856 try diw.writeByte(@intFromEnum(InternPool.Key.PtrType.AddressSpace.generic));3848 {
3857 try wip_nav.infoSectionOffset(3849 try wip_nav.abbrevCode(.generated_field);
3858 .debug_info,3850 try wip_nav.strp("value");
3859 wip_nav.unit,3851 try wip_nav.refType(if (zcu.backendSupportsFeature(.restricted_types))
3860 wip_nav.entry,3852 .u32
3861 @intCast(diw.end + dwarf.sectionOffsetBytes()),3853 else
3862 );3854 .fromInterned(restricted_type.unrestricted_type));
3863 try wip_nav.abbrevCode(.is_const);3855 try diw.writeUleb128(0);
3864 },
3865 .direct => {},
3866 }3856 }
3867 try wip_nav.refType(.fromInterned(restricted_type.unrestricted_type));3857 try diw.writeUleb128(@intFromEnum(AbbrevCode.null));
3868 },3858 },
3869 .tuple_type => |tuple_type| if (tuple_type.types.len == 0) {3859 .tuple_type => |tuple_type| if (tuple_type.types.len == 0) {
3870 try wip_nav.abbrevCode(.generated_empty_struct_type);3860 try wip_nav.abbrevCode(.generated_empty_struct_type);
...@@ -4645,7 +4635,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -4645,7 +4635,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
4645 .un => |un| {4635 .un => |un| {
4646 try wip_nav.abbrevCode(.aggregate_comptime_value);4636 try wip_nav.abbrevCode(.aggregate_comptime_value);
4647 try wip_nav.refType(.fromInterned(un.ty));4637 try wip_nav.refType(.fromInterned(un.ty));
4648 field: {4638 {
4649 const loaded_union_type = ip.loadUnionType(un.ty);4639 const loaded_union_type = ip.loadUnionType(un.ty);
4650 assert(loaded_union_type.layout == .auto);4640 assert(loaded_union_type.layout == .auto);
4651 const field_index = zcu.unionTagFieldIndex(loaded_union_type, Value.fromInterned(un.tag)).?;4641 const field_index = zcu.unionTagFieldIndex(loaded_union_type, Value.fromInterned(un.tag)).?;
...@@ -4658,23 +4648,35 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co...@@ -4658,23 +4648,35 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
4658 else if (has_runtime_bits)4648 else if (has_runtime_bits)
4659 .comptime_value_field_runtime_bits4649 .comptime_value_field_runtime_bits
4660 else4650 else
4661 break :field);4651 .field);
4662 try wip_nav.strp(field_name.toSlice(ip));4652 try wip_nav.strp(field_name.toSlice(ip));
4663 if (has_comptime_state)4653 if (has_comptime_state)
4664 try wip_nav.refValue(.fromInterned(un.val))4654 try wip_nav.refValue(.fromInterned(un.val))
4665 else4655 else if (has_runtime_bits)
4666 try wip_nav.blockValue(src_loc, .fromInterned(un.val));4656 try wip_nav.blockValue(src_loc, .fromInterned(un.val));
4667 }4657 }
4668 try diw.writeUleb128(@intFromEnum(AbbrevCode.null));4658 try diw.writeUleb128(@intFromEnum(AbbrevCode.null));
4669 },4659 },
4670 .restricted_value => |restricted_value| { // repr checked above4660 .restricted_value => |restricted_value| {
4671 try wip_nav.abbrevCode(.location_comptime_value);4661 try wip_nav.abbrevCode(.aggregate_comptime_value);
4672 const unrestricted_unit, const unrestricted_entry =4662 try wip_nav.refType(.fromInterned(restricted_value.ty));
4673 try wip_nav.getValueEntry(.fromInterned(restricted_value.unrestricted_value));4663 field: {
4674 try wip_nav.infoExprLoc(.{ .implicit_pointer = .{4664 const unrestricted_ty: Type = .fromInterned(ip.typeOf(restricted_value.unrestricted_value));
4675 .unit = unrestricted_unit,4665 const has_runtime_bits = unrestricted_ty.hasRuntimeBits(zcu);
4676 .entry = unrestricted_entry,4666 const has_comptime_state = unrestricted_ty.comptimeOnly(zcu);
4677 } });4667 try wip_nav.abbrevCode(if (has_comptime_state)
4668 .comptime_value_field_comptime_state
4669 else if (has_runtime_bits)
4670 .comptime_value_field_runtime_bits
4671 else
4672 break :field);
4673 try wip_nav.strp("value");
4674 if (has_comptime_state)
4675 try wip_nav.refValue(.fromInterned(restricted_value.unrestricted_value))
4676 else if (has_runtime_bits)
4677 try wip_nav.blockValue(src_loc, .fromInterned(restricted_value.unrestricted_value));
4678 }
4679 try diw.writeUleb128(@intFromEnum(AbbrevCode.null));
4678 },4680 },
4679 .memoized_call => unreachable, // not a value4681 .memoized_call => unreachable, // not a value
4680 }4682 }
src/link/Elf2.zig+2-4
...@@ -2981,10 +2981,7 @@ pub fn lowerUav(...@@ -2981,10 +2981,7 @@ pub fn lowerUav(
2981 if (gop.found_existing) {2981 if (gop.found_existing) {
2982 gop.value_ptr.alignment = gop.value_ptr.alignment.max(uav_align);2982 gop.value_ptr.alignment = gop.value_ptr.alignment.max(uav_align);
2983 } else {2983 } else {
2984 gop.value_ptr.* = .{2984 gop.value_ptr.* = .{ .alignment = uav_align, .src_loc = src_loc };
2985 .alignment = uav_align,
2986 .src_loc = src_loc,
2987 };
2988 elf.const_prog_node.increaseEstimatedTotalItems(1);2985 elf.const_prog_node.increaseEstimatedTotalItems(1);
2989 }2986 }
2990 }2987 }
...@@ -3245,6 +3242,7 @@ fn flushUav(...@@ -3245,6 +3242,7 @@ fn flushUav(
3245 try elf.nodes.ensureUnusedCapacity(gpa, 1);3242 try elf.nodes.ensureUnusedCapacity(gpa, 1);
3246 const sec_si = elf.si.data;3243 const sec_si = elf.si.data;
3247 const ni = try elf.mf.addLastChildNode(gpa, sec_si.node(elf), .{3244 const ni = try elf.mf.addLastChildNode(gpa, sec_si.node(elf), .{
3245 .size = Type.fromInterned(zcu.intern_pool.typeOf(uav_val)).abiSize(zcu),
3248 .alignment = uav_align.toStdMem(),3246 .alignment = uav_align.toStdMem(),
3249 .moved = true,3247 .moved = true,
3250 });3248 });
src/target.zig+14-9
...@@ -908,9 +908,13 @@ pub fn zigBackend(target: *const std.Target, use_llvm: bool) std.builtin.Compile...@@ -908,9 +908,13 @@ pub fn zigBackend(target: *const std.Target, use_llvm: bool) std.builtin.Compile
908 };908 };
909}909}
910910
911pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, incremental: bool, comptime feature: Feature) bool {911pub inline fn backendSupportsFeature(comptime feature: Feature, opts: struct {
912 backend: std.builtin.CompilerBackend,
913 incremental: bool,
914 use_new_linker: bool,
915}) bool {
912 return switch (feature) {916 return switch (feature) {
913 .panic_fn => switch (backend) {917 .panic_fn => switch (opts.backend) {
914 .stage2_aarch64,918 .stage2_aarch64,
915 .stage2_c,919 .stage2_c,
916 .stage2_llvm,920 .stage2_llvm,
...@@ -920,23 +924,23 @@ pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, incre...@@ -920,23 +924,23 @@ pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, incre
920 => true,924 => true,
921 else => false,925 else => false,
922 },926 },
923 .error_return_trace => switch (backend) {927 .error_return_trace => switch (opts.backend) {
924 .stage2_llvm, .stage2_x86_64 => true,928 .stage2_llvm, .stage2_x86_64 => true,
925 else => false,929 else => false,
926 },930 },
927 .is_named_enum_value => switch (backend) {931 .is_named_enum_value => switch (opts.backend) {
928 .stage2_llvm, .stage2_x86_64 => true,932 .stage2_llvm, .stage2_x86_64 => true,
929 else => false,933 else => false,
930 },934 },
931 .error_set_has_value => switch (backend) {935 .error_set_has_value => switch (opts.backend) {
932 .stage2_llvm, .stage2_wasm, .stage2_x86_64 => true,936 .stage2_llvm, .stage2_wasm, .stage2_x86_64 => true,
933 else => false,937 else => false,
934 },938 },
935 .field_reordering => switch (backend) {939 .field_reordering => switch (opts.backend) {
936 .stage2_aarch64, .stage2_c, .stage2_llvm, .stage2_x86_64 => true,940 .stage2_aarch64, .stage2_c, .stage2_llvm, .stage2_x86_64 => true,
937 else => false,941 else => false,
938 },942 },
939 .separate_thread => switch (backend) {943 .separate_thread => switch (opts.backend) {
940 // Supports a separate thread but does not support N separate944 // Supports a separate thread but does not support N separate
941 // threads because they would all just be locking the same mutex to945 // threads because they would all just be locking the same mutex to
942 // protect Builder.946 // protect Builder.
...@@ -948,9 +952,10 @@ pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, incre...@@ -948,9 +952,10 @@ pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, incre
948 // being run in a separate thread from now on.952 // being run in a separate thread from now on.
949 else => true,953 else => true,
950 },954 },
951 .restricted_types => switch (backend) {955 .restricted_types => switch (opts.backend) {
952 .stage2_c => true,956 .stage2_c => true,
953 .stage2_llvm, .stage2_x86_64 => !incremental,957 .stage2_llvm => !opts.incremental,
958 .stage2_x86_64 => !opts.incremental and opts.use_new_linker,
954 else => false,959 else => false,
955 },960 },
956 };961 };