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 {
501501 };
502502 };
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
506510 const root_error_tracing = b: {
507511 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 {
10171017
10181018 .generic_poison => unreachable,
10191019 },
1020 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {
1021 .indirect => ptrAbiAlignment(target),
1022 .direct => return abiAlignment(.fromInterned(restricted_type.unrestricted_type), zcu),
1023 },
1020 .restricted_type => |restricted_type| if (zcu.backendSupportsFeature(.restricted_types))
1021 .fromByteUnits(std.zig.target.intAlignment(target, 32))
1022 else
1023 abiAlignment(.fromInterned(restricted_type.unrestricted_type), zcu),
10241024 .tuple_type => |tuple| {
10251025 var big_align: Alignment = .@"1";
10261026 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 {
11711171 .anyopaque => unreachable,
11721172 .generic_poison => unreachable,
11731173 },
1174 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {
1175 .indirect => ptrAbiSize(target),
1176 .direct => return abiSize(.fromInterned(restricted_type.unrestricted_type), zcu),
1177 },
1174 .restricted_type => |restricted_type| if (zcu.backendSupportsFeature(.restricted_types))
1175 std.zig.target.intByteSize(target, 32)
1176 else
1177 abiSize(.fromInterned(restricted_type.unrestricted_type), zcu),
11781178 .tuple_type => |tuple| switch (ty.classify(zcu)) {
11791179 // `structFieldOffset` is bogus on NPV tuples, because there may be some fields with
11801180 // non-zero size.
......@@ -1301,10 +1301,10 @@ pub fn bitSize(ty: Type, zcu: *const Zcu) u64 {
13011301 .generic_poison => unreachable,
13021302 },
13031303
1304 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {
1305 .indirect => target.ptrBitWidth(),
1306 .direct => return bitSize(.fromInterned(restricted_type.unrestricted_type), zcu),
1307 },
1304 .restricted_type => |restricted_type| if (zcu.backendSupportsFeature(.restricted_types))
1305 32
1306 else
1307 bitSize(.fromInterned(restricted_type.unrestricted_type), zcu),
13081308 .struct_type => {
13091309 const struct_obj = ip.loadStructType(ty.toIntern());
13101310 switch (struct_obj.layout) {
......@@ -1362,17 +1362,6 @@ pub fn unrestrictedType(ty: Type, zcu: *const Zcu) ?Type {
13621362 };
13631363}
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
13761365pub fn isSinglePointer(ty: Type, zcu: *const Zcu) bool {
13771366 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
13781367 .ptr_type => |ptr_info| ptr_info.flags.size == .one,
......@@ -1450,24 +1439,16 @@ pub fn isCPtr(ty: Type, zcu: *const Zcu) bool {
14501439
14511440pub fn isPtrAtRuntime(ty: Type, zcu: *const Zcu) bool {
14521441 const ip = &zcu.intern_pool;
1453 return ty: switch (ip.indexToKey(ty.toIntern())) {
1442 return switch (ip.indexToKey(ty.toIntern())) {
14541443 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
14551444 .slice => false,
14561445 .one, .many, .c => true,
14571446 },
1458 .restricted_type => |restricted_type| switch (restrictedReprByTrackedInst(restricted_type.zir_index, zcu)) {
1459 .indirect => true,
1460 .direct => continue :ty ip.indexToKey(restricted_type.unrestricted_type),
1461 },
1462 .opt_type => |child| opt_child: switch (ip.indexToKey(child)) {
1447 .opt_type => |child| switch (ip.indexToKey(child)) {
14631448 .ptr_type => |p| switch (p.flags.size) {
14641449 .slice, .c => false,
14651450 .many, .one => !p.flags.is_allowzero,
14661451 },
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 },
14711452 else => false,
14721453 },
14731454 else => false,
......@@ -1483,21 +1464,13 @@ pub fn ptrAllowsZero(ty: Type, zcu: *const Zcu) bool {
14831464/// See also `isPtrLikeOptional`.
14841465pub fn optionalReprIsPayload(ty: Type, zcu: *const Zcu) bool {
14851466 const ip = &zcu.intern_pool;
1486 return ty: switch (ip.indexToKey(ty.toIntern())) {
1467 return switch (ip.indexToKey(ty.toIntern())) {
14871468 .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)) {
14891470 .ptr_type => |ptr_type| ptr_type.flags.size != .c and !ptr_type.flags.is_allowzero,
14901471 .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 },
14951472 else => false,
14961473 },
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 },
15011474 else => false,
15021475 };
15031476}
......@@ -1506,23 +1479,15 @@ pub fn optionalReprIsPayload(ty: Type, zcu: *const Zcu) bool {
15061479/// address value, using 0 for null. Note that this returns true for C pointers.
15071480pub fn isPtrLikeOptional(ty: Type, zcu: *const Zcu) bool {
15081481 const ip = &zcu.intern_pool;
1509 return ty: switch (ip.indexToKey(ty.toIntern())) {
1482 return switch (ip.indexToKey(ty.toIntern())) {
15101483 .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)) {
15121485 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
15131486 .slice, .c => false,
15141487 .many, .one => !ptr_type.flags.is_allowzero,
15151488 },
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 },
15201489 else => false,
15211490 },
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 },
15261491 else => false,
15271492 };
15281493}
......@@ -2056,20 +2021,12 @@ pub fn fnCallingConvention(ty: Type, zcu: *const Zcu) std.builtin.CallingConvent
20562021 return zcu.intern_pool.indexToKey(ty.toIntern()).func_type.cc;
20572022}
20582023
2059pub fn isValidParamType(self: Type, zcu: *const Zcu) bool {
2060 if (self.toIntern() == .generic_poison_type) return true;
2061 return switch (self.zigTypeTag(zcu)) {
2062 .@"opaque", .noreturn => false,
2063 else => true,
2064 };
2024pub fn isValidParamType(ty: Type, zcu: *const Zcu) bool {
2025 return ty.toIntern() == .noreturn_type or ty.isValidReturnType(zcu);
20652026}
20662027
2067pub fn isValidReturnType(self: Type, zcu: *const Zcu) bool {
2068 if (self.toIntern() == .generic_poison_type) return true;
2069 return switch (self.zigTypeTag(zcu)) {
2070 .@"opaque" => false,
2071 else => true,
2072 };
2028pub fn isValidReturnType(ty: Type, zcu: *const Zcu) bool {
2029 return ty.toIntern() == .generic_poison_type or !zcu.intern_pool.isOpaqueType(ty.toIntern());
20732030}
20742031
20752032/// Asserts the type is a function.
src/Zcu.zig+5-1
......@@ -4001,7 +4001,11 @@ pub const Feature = enum {
40014001
40024002pub fn backendSupportsFeature(zcu: *const Zcu, comptime feature: Feature) bool {
40034003 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 });
40054009}
40064010
40074011pub const AtomicPtrAlignmentError = error{
src/codegen.zig+40-52
......@@ -233,6 +233,7 @@ const LazySymbolStructure = struct {
233233
234234 pub const Operation = enum {
235235 end_ptr_inc,
236 append_restricted,
236237
237238 pub fn apply(operation: Operation, slice: []u8, target_opts: struct {
238239 ptr_bit_width: u16,
......@@ -253,6 +254,7 @@ const LazySymbolStructure = struct {
253254 );
254255 },
255256 },
257 .append_restricted => unreachable,
256258 }
257259 }
258260 };
......@@ -290,16 +292,6 @@ pub fn getLazySymbolInfo(
290292 .structure => .{},
291293 .attributes => .{ .required_alignment = .@"1" },
292294 },
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 },
303295 },
304296 .deferred_const_data => switch (lazy_sym.key) {
305297 else => unreachable,
......@@ -309,33 +301,14 @@ pub fn getLazySymbolInfo(
309301 },
310302 _ => switch (ip.indexToKey(lazy_sym.key)) {
311303 else => unreachable,
312 .restricted_value => |restricted_value| switch (kind) {
313 .structure => .{ .parent = .{ .kind = .const_data, .key = restricted_value.ty }, .modify = .{
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 } },
304 .restricted_type => |restricted_type| switch (kind) {
305 .structure => .{},
329306 .attributes => {
330307 const restricted_ty: Type = .fromInterned(lazy_sym.key);
331 const unrestricted_ty: Type = .fromInterned(
332 ip.indexToKey(lazy_sym.key).restricted_type.unrestricted_type,
333 );
334 return .{
335 .header = true,
336 .required_alignment = restricted_ty.abiAlignment(zcu),
337 .size = unrestricted_ty.abiAlignment(zcu).forward(restricted_ty.abiSize(zcu)),
338 };
308 const unrestricted_ty: Type =
309 .fromInterned(restricted_type.unrestricted_type);
310 return .{ .required_alignment = restricted_ty.abiAlignment(zcu)
311 .maxStrict(unrestricted_ty.abiAlignment(zcu)) };
339312 },
340313 },
341314 },
......@@ -379,7 +352,6 @@ pub fn generateLazySymbol(
379352 }
380353 return;
381354 },
382 .restricted_type => return,
383355 else => {},
384356 },
385357 .deferred_const_data => switch (lazy_sym.key) {
......@@ -404,10 +376,22 @@ pub fn generateLazySymbol(
404376 return;
405377 },
406378 _ => switch (ip.indexToKey(lazy_sym.key)) {
407 .restricted_value => |restricted_value| return generateSymbol(bin_file, pt, src_loc, .fromInterned(
408 restricted_value.unrestricted_value,
409 ), w, reloc_parent),
410 .restricted_type => return w.splatByteAll(0, @divExact(zcu.getTarget().ptrBitWidth(), 8)),
379 .restricted_type => |restricted_type| {
380 const restricted_ty: Type = .fromInterned(lazy_sym.key);
381 const unrestricted_ty: Type = .fromInterned(restricted_type.unrestricted_type);
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 },
411395 else => {},
412396 },
413397 else => {},
......@@ -782,10 +766,13 @@ pub fn generateSymbol(
782766 }
783767 },
784768 .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)) {
786 .indirect => try lowerLazySymbolRef(bin_file, pt, .{ .kind = .deferred_const_data, .key = val.toIntern() }, w, reloc_parent, 0),
787 .direct => try generateSymbol(bin_file, pt, src_loc, .fromInterned(restricted_value.unrestricted_value), w, reloc_parent),
788 },
769 .restricted_value => |restricted_value| if (zcu.backendSupportsFeature(.restricted_types)) {
770 const gpa = zcu.gpa;
771 const type_gop = try bin_file.restricted.getOrPut(gpa, restricted_value.ty);
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),
789776 .memoized_call => unreachable,
790777 }
791778}
......@@ -1167,7 +1154,6 @@ pub fn genTypedValue(
11671154 } },
11681155 .fail => |em| .{ .fail = em },
11691156 },
1170 .lea_lazy_sym => unreachable, // `Zcu.Feature.restricted_types` is not supported by this code path
11711157 };
11721158}
11731159
......@@ -1180,7 +1166,6 @@ const LowerResult = union(enum) {
11801166 lea_nav: InternPool.Nav.Index,
11811167 load_uav: InternPool.Key.Ptr.BaseAddr.Uav,
11821168 lea_uav: InternPool.Key.Ptr.BaseAddr.Uav,
1183 lea_lazy_sym: link.File.LazySymbol,
11841169};
11851170
11861171pub 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
11921177
11931178 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)) {
1196 .indirect => return .{ .lea_lazy_sym = .{ .kind = .deferred_const_data, .key = start_val.toIntern() } },
1197 .direct => .{ unrestricted_ty, .fromInterned(ip.indexToKey(start_val.toIntern()).restricted_value.unrestricted_value) },
1198 } else .{ start_ty, start_val };
1180 const ty, const val: Value, const use_uav = if (start_ty.unrestrictedType(zcu)) |unrestricted_ty|
1181 if (zcu.backendSupportsFeature(.restricted_types))
1182 .{ start_ty, start_val, true }
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)) {
12011189 .void => return .none,
12021190 .bool => return .{ .immediate = @intFromBool(val.toBool()) },
12031191 .pointer => switch (ty.ptrSize(zcu)) {
......@@ -1308,7 +1296,7 @@ pub fn lowerValue(pt: Zcu.PerThread, start_val: Value, target: *const std.Target
13081296 .@"opaque" => unreachable,
13091297
13101298 else => {},
1311 }
1299 };
13121300
13131301 return .{ .load_uav = .{
13141302 .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 {
305305 .errunion_payload_ptr_set,
306306 .wrap_errunion_payload,
307307 .wrap_errunion_err,
308 .unwrap_restricted,
309 .unwrap_restricted_safe,
308310 .struct_field_ptr_index_0,
309311 .struct_field_ptr_index_1,
310312 .struct_field_ptr_index_2,
......@@ -658,28 +660,6 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
658660 air_inst_index = air_body[air_body_index];
659661 continue :air_tag air_tags[@intFromEnum(air_inst_index)];
660662 },
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 },
683663 .struct_field_ptr, .struct_field_val => {
684664 const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl;
685665 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,
57635743 if (isel.live_values.fetchRemove(air.inst_index)) |dst_vi| {
57645744 defer dst_vi.value.deref(isel);
57655745 const ty_op = air.data(air.inst_index).ty_op;
5766 const unrestricted_ty = ty_op.ty.toType();
5767 const restricted_ty = isel.air.typeOf(ty_op.operand, ip);
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 }
5746 _ = air_tag; // TODO
5747 try dst_vi.value.move(isel, ty_op.operand);
57825748 }
57835749 if (air.next()) |next_air_tag| continue :air_tag next_air_tag;
57845750 },
src/codegen/c.zig+37-104
......@@ -1306,20 +1306,15 @@ pub const DeclGen = struct {
13061306 if (loaded_union.layout == .auto) try w.writeByte('}');
13071307 }
13081308 },
1309 .restricted_value => |restricted_value| switch (ty.restrictedRepr(zcu)) {
1310 .indirect => {
1311 const loaded_restricted = ip.loadRestrictedType(ty.toIntern());
1312 // Explicitly add the restricted decl dependency on the unrestricted type
1313 _ = try CType.lower(.fromInterned(loaded_restricted.unrestricted_type), &dg.ctype_deps, dg.arena, zcu);
1314 try dg.need_restricted.put(zcu.gpa, val.toIntern(), {});
1315
1316 const restricted_ty_name = loaded_restricted.name.toSlice(ip);
1317 try w.print("&zig_restricted_{f}__{d}[zig_restricted_index_{f}__{d}]", .{
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),
1309 .restricted_value => {
1310 const loaded_restricted = ip.loadRestrictedType(ty.toIntern());
1311 // Explicitly add the restricted decl dependency on the unrestricted type
1312 _ = 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
1315 try w.print("zig_restricted_value_{f}__{d}", .{
1316 fmtIdentUnsolo(loaded_restricted.name.toSlice(ip)), val.toIntern(),
1317 });
13231318 },
13241319 }
13251320 }
......@@ -1327,7 +1322,7 @@ pub const DeclGen = struct {
13271322 fn renderUndefValue(
13281323 dg: *DeclGen,
13291324 w: *Writer,
1330 start_ty: Type,
1325 ty: Type,
13311326 location: ValueRenderLocation,
13321327 ) Error!void {
13331328 const pt = dg.pt;
......@@ -1345,8 +1340,7 @@ pub const DeclGen = struct {
13451340 .ReleaseFast, .ReleaseSmall => false,
13461341 };
13471342
1348 var ty = start_ty;
1349 ty: switch (start_ty.toIntern()) {
1343 switch (ty.toIntern()) {
13501344 .c_longdouble_type,
13511345 .f16_type,
13521346 .f32_type,
......@@ -1374,12 +1368,13 @@ pub const DeclGen = struct {
13741368 return w.writeByte(')');
13751369 },
13761370 .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())) {
13781372 .simple_type, // anyerror, c_char (etc), usize, isize
13791373 .int_type,
13801374 .enum_type,
13811375 .error_set_type,
13821376 .inferred_error_set_type,
1377 .restricted_type,
13831378 => switch (CType.classifyInt(ty, zcu)) {
13841379 .void => unreachable, // opv
13851380 .small => |s| {
......@@ -1475,16 +1470,6 @@ pub const DeclGen = struct {
14751470 try w.writeAll(" }");
14761471 },
14771472 },
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 },
14881473 .struct_type => {
14891474 const loaded_struct = ip.loadStructType(ty.toIntern());
14901475 switch (loaded_struct.layout) {
......@@ -2138,8 +2123,8 @@ pub fn genRestricted(
21382123 });
21392124 for (restricted_vals.keys(), 0..) |restricted_val, restricted_index| {
21402125 try w.print(
2141 \\#define zig_restricted_index_{f}__{d} {d}u
2142 \\ [zig_restricted_index_{f}__{d}] =
2126 \\#define zig_restricted_value_{f}__{d} {d}u
2127 \\ [zig_restricted_value_{f}__{d}] =
21432128 , .{
21442129 fmtIdentUnsolo(restricted_ty_name),
21452130 restricted_val,
......@@ -5641,81 +5626,29 @@ fn airUnwrapRestricted(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue
56415626 // Implicitly adds the restricted decl dependency on the unrestricted type
56425627 const local = try f.allocLocal(inst, unrestricted_ty);
56435628
5644 switch (restricted_ty.restrictedRepr(zcu)) {
5645 .indirect => {
5646 if (safety) {
5647 const target = &f.dg.mod.resolved_target.result;
5648 const ptr_bits = target.ptrBitWidth();
5649
5650 try f.dg.need_restricted.put(zcu.gpa, restricted_ty.toIntern(), {});
5651 const unrestricted_size = unrestricted_ty.abiSize(zcu);
5652 assert(unrestricted_size > 0);
5653 const restricted_ty_name = ip.loadRestrictedType(restricted_ty.toIntern()).name.toSlice(ip);
5654
5655 const ptr_diff = try f.allocLocal(inst, .usize);
5656 try f.writeCValue(w, ptr_diff, .other);
5657 try w.print(" = zig_subw_u{d}(({f})", .{
5658 ptr_bits,
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 },
5629 try f.dg.need_restricted.put(zcu.gpa, restricted_ty.toIntern(), {});
5630 const restricted_ty_name = ip.loadRestrictedType(restricted_ty.toIntern()).name.toSlice(ip);
5631 if (safety) {
5632 try w.writeAll("if (");
5633 try f.writeCValue(w, operand, .other);
5634 try w.print(" >= zig_restricted_len_{f}__{d}) {{", .{
5635 fmtIdentUnsolo(restricted_ty_name),
5636 restricted_ty.toIntern(),
5637 });
5638 f.indent();
5639 try f.newline();
5640 try f.writePanic(.corrupt_restricted_value, w);
5641 try f.outdent();
5642 try w.writeByte('}');
5643 try f.newline();
57175644 }
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("];");
57195652 try f.newline();
57205653
57215654 return local;
src/codegen/c/type.zig+38-53
......@@ -129,29 +129,27 @@ pub const CType = union(enum) {
129129
130130 pub fn bits(int: Int, target: *const std.Target) u16 {
131131 return switch (int) {
132 // zig fmt: off
133 .char => target.cTypeBitSize(.char),
134
135 .@"unsigned short" => target.cTypeBitSize(.ushort),
136 .@"unsigned int" => target.cTypeBitSize(.uint),
137 .@"unsigned long" => target.cTypeBitSize(.ulong),
138 .@"unsigned long long" => target.cTypeBitSize(.ulonglong),
139
140 .@"signed short" => target.cTypeBitSize(.short),
141 .@"signed int" => target.cTypeBitSize(.int),
142 .@"signed long" => target.cTypeBitSize(.long),
143 .@"signed long long" => target.cTypeBitSize(.longlong),
144
145 .uintptr_t, .intptr_t => target.ptrBitWidth(),
146
147 .uint8_t, .int8_t => 8,
148 .uint16_t, .int16_t => 16,
149 .uint24_t, .int24_t => 24,
150 .uint32_t, .int32_t => 32,
151 .uint48_t, .int48_t => 48,
152 .uint64_t, .int64_t => 64,
153 .zig_u128, .zig_i128 => 128,
154 // zig fmt: on
132 .char => target.cTypeBitSize(.char),
133
134 .@"unsigned short" => target.cTypeBitSize(.ushort),
135 .@"unsigned int" => target.cTypeBitSize(.uint),
136 .@"unsigned long" => target.cTypeBitSize(.ulong),
137 .@"unsigned long long" => target.cTypeBitSize(.ulonglong),
138
139 .@"signed short" => target.cTypeBitSize(.short),
140 .@"signed int" => target.cTypeBitSize(.int),
141 .@"signed long" => target.cTypeBitSize(.long),
142 .@"signed long long" => target.cTypeBitSize(.longlong),
143
144 .uintptr_t, .intptr_t => target.ptrBitWidth(),
145
146 .uint8_t, .int8_t => 8,
147 .uint16_t, .int16_t => 16,
148 .uint24_t, .int24_t => 24,
149 .uint32_t, .int32_t => 32,
150 .uint48_t, .int48_t => 48,
151 .uint64_t, .int64_t => 64,
152 .zig_u128, .zig_i128 => 128,
155153 };
156154 }
157155 };
......@@ -239,20 +237,8 @@ pub const CType = union(enum) {
239237 ) Allocator.Error!CType {
240238 const gpa = zcu.comp.gpa;
241239 const ip = &zcu.intern_pool;
242 var cur_ty: Type = if (start_ty.unrestrictedType(zcu)) |unrestricted_ty| switch (start_ty.restrictedRepr(zcu)) {
243 .indirect => {
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;
240 if (ip.isRestrictedType(start_ty.toIntern())) return .{ .int = .uint32_t };
241 var cur_ty = start_ty;
256242 while (true) {
257243 switch (cur_ty.zigTypeTag(zcu)) {
258244 .type,
......@@ -494,6 +480,7 @@ pub const CType = union(enum) {
494480
495481 /// Asserts that `ty` is an integer, enum, bitpack, or error set.
496482 pub fn classifyInt(ty: Type, zcu: *const Zcu) IntClass {
483 if (zcu.intern_pool.isRestrictedType(ty.toIntern())) return classifyBitInt(.unsigned, 32, zcu);
497484 const int_ty: Type = switch (ty.zigTypeTag(zcu)) {
498485 .error_set => return classifyBitInt(.unsigned, zcu.errorSetBits(), zcu),
499486 .@"enum" => ty.intTagType(zcu),
......@@ -502,22 +489,20 @@ pub const CType = union(enum) {
502489 else => unreachable,
503490 };
504491 switch (int_ty.toIntern()) {
505 // zig fmt: off
506 .usize_type => return .{ .small = .uintptr_t },
507 .isize_type => return .{ .small = .intptr_t },
508
509 .c_char_type => return .{ .small = .char },
510
511 .c_short_type => return .{ .small = .@"signed short" },
512 .c_int_type => return .{ .small = .@"signed int" },
513 .c_long_type => return .{ .small = .@"signed long" },
514 .c_longlong_type => return .{ .small = .@"signed long long" },
515
516 .c_ushort_type => return .{ .small = .@"unsigned short" },
517 .c_uint_type => return .{ .small = .@"unsigned int" },
518 .c_ulong_type => return .{ .small = .@"unsigned long" },
519 .c_ulonglong_type => return .{ .small = .@"unsigned long long" },
520 // zig fmt: on
492 .usize_type => return .{ .small = .uintptr_t },
493 .isize_type => return .{ .small = .intptr_t },
494
495 .c_char_type => return .{ .small = .char },
496
497 .c_short_type => return .{ .small = .@"signed short" },
498 .c_int_type => return .{ .small = .@"signed int" },
499 .c_long_type => return .{ .small = .@"signed long" },
500 .c_longlong_type => return .{ .small = .@"signed long long" },
501
502 .c_ushort_type => return .{ .small = .@"unsigned short" },
503 .c_uint_type => return .{ .small = .@"unsigned int" },
504 .c_ulong_type => return .{ .small = .@"unsigned long" },
505 .c_ulonglong_type => return .{ .small = .@"unsigned long long" },
521506
522507 else => {
523508 const int = ty.intInfo(zcu);
src/codegen/llvm.zig+22-44
......@@ -722,7 +722,7 @@ pub const Object = struct {
722722 gop.value_ptr.* = .{
723723 .len = try o.builder.addVariable(
724724 try o.builder.strtabStringFmt("{s}.len", .{ty_name}),
725 try o.lowerType(.usize),
725 .i32,
726726 .default,
727727 ),
728728 .array = try o.builder.addVariable(
......@@ -734,7 +734,7 @@ pub const Object = struct {
734734 };
735735 gop.value_ptr.len.setLinkage(.private, &o.builder);
736736 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);
738738 gop.value_ptr.len.setUnnamedAddr(.unnamed_addr, &o.builder);
739739 gop.value_ptr.array.setLinkage(.private, &o.builder);
740740 gop.value_ptr.array.setMutability(.constant, &o.builder);
......@@ -747,12 +747,9 @@ pub const Object = struct {
747747 fn genRestrictedDecls(o: *Object) Allocator.Error!void {
748748 for (o.restricted_map.values()) |restricted_decls| {
749749 const len = restricted_decls.values.count();
750 try restricted_decls.len.setInitializer(
751 try o.builder.intConst(restricted_decls.len.typeOf(&o.builder), len),
752 &o.builder,
753 );
750 try restricted_decls.len.setInitializer(try o.builder.intConst(.i32, len), &o.builder);
754751 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
756753 else => try o.builder.arrayConst(
757754 try o.builder.arrayType(len, restricted_decls.values.values()[0].typeOf(&o.builder)),
758755 restricted_decls.values.values(),
......@@ -2027,7 +2024,7 @@ pub const Object = struct {
20272024 fn lowerDebugType(
20282025 o: *Object,
20292026 pt: Zcu.PerThread,
2030 start_ty: Type,
2027 ty: Type,
20312028 ty_fwd_ref: Builder.Metadata,
20322029 ) Allocator.Error!Builder.Metadata {
20332030 assert(!o.builder.strip);
......@@ -2037,7 +2034,7 @@ pub const Object = struct {
20372034 const target = zcu.getTarget();
20382035 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
20422039 // lldb cannot handle non-byte-sized types, so in the logic below, bit sizes are padded up.
20432040 // 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 {
20482045 // handling for variants at all, and will never print fields in them, so I opted not to use
20492046 // them for now.
20502047
2051 const ty = if (start_ty.unrestrictedType(zcu)) |unrestricted_ty| switch (start_ty.restrictedRepr(zcu)) {
2052 .indirect => {
2053 const ptr_size = Type.ptrAbiSize(zcu.getTarget());
2054 const ptr_align = Type.ptrAbiAlignment(zcu.getTarget());
2055 return o.builder.debugPointerType(
2056 name,
2057 null, // file
2058 o.debug_compile_unit.unwrap().?, // scope
2059 0, // line
2060 try o.getDebugType(pt, unrestricted_ty),
2061 ptr_size * 8,
2062 ptr_align.toByteUnits().? * 8,
2063 0, // offset
2064 );
2065 },
2066 .direct => unrestricted_ty,
2067 } else start_ty;
2048 if (ip.isRestrictedType(ty.toIntern())) return o.builder.debugTypedefType(
2049 name,
2050 null, // file
2051 o.debug_compile_unit.unwrap().?, // scope
2052 0, // line
2053 try o.getDebugType(pt, .u32),
2054 ty.abiSize(zcu) * 8,
2055 ty.abiAlignment(zcu).toByteUnits().? * 8,
2056 0, // offset
2057 );
20682058
20692059 switch (ty.zigTypeTag(zcu)) {
20702060 .void,
......@@ -3223,10 +3213,7 @@ pub const Object = struct {
32233213 return o.builder.structType(.normal, fields[0..fields_len]);
32243214 },
32253215 .simple_type => unreachable,
3226 .restricted_type => |restricted_type| switch (t.restrictedRepr(zcu)) {
3227 .indirect => .ptr,
3228 .direct => try o.lowerType(.fromInterned(restricted_type.unrestricted_type)),
3229 },
3216 .restricted_type => .i32,
32303217 .struct_type => {
32313218 if (o.type_map.get(t.toIntern())) |value| return value;
32323219
......@@ -3997,20 +3984,11 @@ pub const Object = struct {
39973984 else
39983985 union_ty, vals[0..len]);
39993986 },
4000 .restricted_value => |restricted_value| switch (ty.restrictedRepr(zcu)) {
4001 .indirect => {
4002 const restricted_decls = try o.getRestrictedDecls(ty);
4003 const gop = try restricted_decls.values.getOrPut(o.gpa, arg_val);
4004 if (!gop.found_existing) gop.value_ptr.* = try o.lowerValue(restricted_value.unrestricted_value);
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),
3987 .restricted_value => |restricted_value| {
3988 const restricted_decls = try o.getRestrictedDecls(ty);
3989 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);
3991 return o.builder.intConst(.i32, gop.index);
40143992 },
40153993 .memoized_call => unreachable,
40163994 };
src/codegen/llvm/FuncGen.zig+30-68
......@@ -3258,65 +3258,30 @@ fn airUnwrapRestricted(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocat
32583258 const zcu = o.zcu;
32593259 const target = zcu.getTarget();
32603260 const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
3261 const unrestricted_ty = ty_op.ty.toType();
32613262 const restricted_ty = fg.typeOf(ty_op.operand);
32623263 const operand = try fg.resolveInst(ty_op.operand);
3263 switch (restricted_ty.restrictedRepr(zcu)) {
3264 .indirect => {
3265 const unrestricted_ty = ty_op.ty.toType();
3266 if (safety) {
3267 const restricted_decls = try o.getRestrictedDecls(restricted_ty);
3268 const llvm_usize_ty = restricted_decls.len.typeOf(&o.builder);
3269 const unrestricted_size = unrestricted_ty.abiSize(zcu);
3270 assert(unrestricted_size > 0);
3271 const array = try o.builder.castConst(.ptrtoint, restricted_decls.array.toConst(&o.builder), llvm_usize_ty);
3272 const ptr_diff = try fg.wip.bin(
3273 .sub,
3274 try fg.wip.cast(.ptrtoint, operand, llvm_usize_ty, "unwrap_restricted.operand_int"),
3275 array.toValue(),
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);
3264 const restricted_decls = try o.getRestrictedDecls(restricted_ty);
3265 if (safety) {
3266 const len = try fg.wip.load(
3267 .normal,
3268 .i32,
3269 restricted_decls.len.toValue(&o.builder),
3270 .fromByteUnits(std.zig.target.intAlignment(target, 32)),
3271 "unwrap_restricted.len",
3272 );
3273 const ok = try fg.wip.icmp(.ult, operand, len, "unwrap_restricted.ok");
3274 const invalid_block = try fg.wip.block(1, "unwrap_restricted.invalid");
3275 const valid_block = try fg.wip.block(1, "unwrap_restricted.valid");
3276 _ = try fg.wip.brCond(ok, valid_block, invalid_block, .none);
33133277
3314 fg.wip.cursor = .{ .block = valid_block };
3315 }
3316 return fg.load(operand, unrestricted_ty, unrestricted_ty.abiAlignment(zcu).toLlvm(), .normal);
3317 },
3318 .direct => return operand,
3278 fg.wip.cursor = .{ .block = invalid_block };
3279 try fg.buildSimplePanic(.corrupt_restricted_value);
3280
3281 fg.wip.cursor = .{ .block = valid_block };
33193282 }
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);
33203285}
33213286
33223287fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {
......@@ -6701,7 +6666,7 @@ const ParamTypeIterator = struct {
67016666 it.zig_index += 1;
67026667 it.llvm_index += 1;
67036668 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)))
67056670 {
67066671 it.llvm_index += 1;
67076672 return .slice;
......@@ -7292,11 +7257,8 @@ pub fn buildAllocaInner(
72927257/// This is the one source of truth for whether a type is passed around as an LLVM pointer,
72937258/// or as an LLVM value.
72947259pub fn isByRef(ty: Type, zcu: *const Zcu) bool {
7295 const unrestricted_ty = if (ty.unrestrictedType(zcu)) |unrestricted_ty| switch (ty.restrictedRepr(zcu)) {
7296 .indirect => return false,
7297 .direct => unrestricted_ty,
7298 } else ty;
7299 return switch (unrestricted_ty.zigTypeTag(zcu)) {
7260 if (zcu.intern_pool.isRestrictedType(ty.toIntern())) return false;
7261 return switch (ty.zigTypeTag(zcu)) {
73007262 .type,
73017263 .comptime_int,
73027264 .comptime_float,
......@@ -7321,19 +7283,19 @@ pub fn isByRef(ty: Type, zcu: *const Zcu) bool {
73217283
73227284 .array,
73237285 .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)) {
73317293 .@"packed" => false,
7332 .auto, .@"extern" => unrestricted_ty.hasRuntimeBits(zcu),
7294 .auto, .@"extern" => ty.hasRuntimeBits(zcu),
73337295 },
7334 .@"union" => switch (unrestricted_ty.containerLayout(zcu)) {
7296 .@"union" => switch (ty.containerLayout(zcu)) {
73357297 .@"packed" => false,
7336 else => unrestricted_ty.hasRuntimeBits(zcu) and !unrestricted_ty.unionHasAllZeroBitFieldTypes(zcu),
7298 else => ty.hasRuntimeBits(zcu) and !ty.unionHasAllZeroBitFieldTypes(zcu),
73377299 },
73387300 };
73397301}
src/codegen/wasm/CodeGen.zig+2-10
......@@ -6725,18 +6725,10 @@ fn airErrUnionPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void
67256725}
67266726
67276727fn airUnwrapRestricted(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void {
6728 const zcu = cg.pt.zcu;
67296728 const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
67306729 const operand = try cg.resolveInst(ty_op.operand);
6731 const unrestricted_ty = ty_op.ty.toType();
6732 const restricted_ty = cg.typeOf(ty_op.operand);
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 };
6730 _ = safety; // TODO
6731 const result = cg.reuseOperand(ty_op.operand, operand); // TODO
67406732 return cg.finishAir(inst, result, &.{ty_op.operand});
67416733}
67426734
src/codegen/x86_64/CodeGen.zig+1315-339
......@@ -103826,314 +103826,1260 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
103826103826 const ty_op = air_datas[@intFromEnum(inst)].ty_op;
103827103827 const unrestricted_ty = ty_op.ty.toType();
103828103828 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)};
103830 const res = res: switch (restricted_ty.restrictedRepr(zcu)) {
103831 .indirect => {
103832 if (zcu.comp.config.use_new_linker) switch (air_tag) {
103833 else => unreachable,
103834 .unwrap_restricted => {},
103835 .unwrap_restricted_safe => cg.select(&.{}, &.{}, &ops, &.{ .{
103836 .required_features = .{ .avx, .bmi2, null, null },
103837 .src_constraints = .{ .any, .po2_any, .any },
103838 .patterns = &.{
103839 .{ .src = .{ .mem, .none, .none } },
103840 .{ .src = .{ .to_gpr, .none, .none } },
103841 },
103842 .call_frame = .{ .alignment = .@"32" },
103843 .extra_temps = .{
103844 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103845 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103846 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103847 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
103848 .unused,
103849 .unused,
103850 .unused,
103851 .unused,
103852 .unused,
103853 .unused,
103854 .unused,
103855 },
103856 .clobbers = .{ .eflags = true },
103857 .each = .{ .once = &.{
103858 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },
103859 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },
103860 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },
103861 .{ ._, ._rx, .ro, .tmp2p, .tmp2p, .sa(.src1, .add_log2_size), ._ },
103862 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },
103863 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
103864 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
103865 } },
103866 }, .{
103867 .required_features = .{ .avx, null, null, null },
103868 .src_constraints = .{ .any, .po2_any, .any },
103869 .patterns = &.{
103870 .{ .src = .{ .mem, .none, .none } },
103871 .{ .src = .{ .to_gpr, .none, .none } },
103872 },
103873 .call_frame = .{ .alignment = .@"32" },
103874 .extra_temps = .{
103875 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103876 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103877 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103878 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
103879 .unused,
103880 .unused,
103881 .unused,
103882 .unused,
103883 .unused,
103884 .unused,
103885 .unused,
103886 },
103887 .clobbers = .{ .eflags = true },
103888 .each = .{ .once = &.{
103889 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },
103890 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },
103891 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },
103892 .{ ._, ._r, .ro, .tmp2p, .sa(.src1, .add_log2_size), ._, ._ },
103893 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },
103894 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
103895 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
103896 } },
103897 }, .{
103898 .required_features = .{ .avx, null, null, null },
103899 .patterns = &.{
103900 .{ .src = .{ .mem, .none, .none } },
103901 .{ .src = .{ .to_gpr, .none, .none } },
103902 },
103903 .call_frame = .{ .alignment = .@"32" },
103904 .extra_temps = .{
103905 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103906 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103907 .{ .type = .usize, .kind = .{ .reg = .rax } },
103908 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103909 .{ .type = .usize, .kind = .{ .reg = .rdx } },
103910 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
103911 .unused,
103912 .unused,
103913 .unused,
103914 .unused,
103915 .unused,
103916 },
103917 .clobbers = .{ .eflags = true },
103918 .each = .{ .once = &.{
103919 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },
103920 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },
103921 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },
103922 .{ ._, ._, .mov, .tmp3d, .sa(.src1, .add_size), ._, ._ },
103923 .{ ._, ._, .xor, .tmp4p, .tmp4p, ._, ._ },
103924 .{ ._, ._, .div, .tmp3p, ._, ._, ._ },
103925 .{ ._, ._, .@"test", .tmp4p, .tmp4p, ._, ._ },
103926 .{ ._, ._nz, .j, .@"1f", ._, ._, ._ },
103927 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },
103928 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
103929 .{ .@"1:", ._, .call, .tmp5d, ._, ._, ._ },
103930 } },
103931 }, .{
103932 .required_features = .{ .sse, .bmi2, null, null },
103933 .src_constraints = .{ .any, .po2_any, .any },
103934 .patterns = &.{
103935 .{ .src = .{ .mem, .none, .none } },
103936 .{ .src = .{ .to_gpr, .none, .none } },
103937 },
103938 .call_frame = .{ .alignment = .@"16" },
103939 .extra_temps = .{
103940 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103941 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103942 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103943 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
103944 .unused,
103945 .unused,
103946 .unused,
103947 .unused,
103948 .unused,
103949 .unused,
103950 .unused,
103951 },
103952 .clobbers = .{ .eflags = true },
103953 .each = .{ .once = &.{
103954 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },
103955 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },
103956 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },
103957 .{ ._, ._rx, .ro, .tmp2p, .tmp2p, .sa(.src1, .add_log2_size), ._ },
103958 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },
103959 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
103960 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
103961 } },
103962 }, .{
103963 .required_features = .{ .sse, null, null, null },
103964 .src_constraints = .{ .any, .po2_any, .any },
103965 .patterns = &.{
103966 .{ .src = .{ .mem, .none, .none } },
103967 .{ .src = .{ .to_gpr, .none, .none } },
103968 },
103969 .call_frame = .{ .alignment = .@"16" },
103970 .extra_temps = .{
103971 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103972 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103973 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103974 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
103975 .unused,
103976 .unused,
103977 .unused,
103978 .unused,
103979 .unused,
103980 .unused,
103981 .unused,
103982 },
103983 .clobbers = .{ .eflags = true },
103984 .each = .{ .once = &.{
103985 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },
103986 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },
103987 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },
103988 .{ ._, ._r, .ro, .tmp2p, .sa(.src1, .add_log2_size), ._, ._ },
103989 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },
103990 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
103991 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
103992 } },
103993 }, .{
103994 .required_features = .{ .sse, null, null, null },
103995 .patterns = &.{
103996 .{ .src = .{ .mem, .none, .none } },
103997 .{ .src = .{ .to_gpr, .none, .none } },
103998 },
103999 .call_frame = .{ .alignment = .@"16" },
104000 .extra_temps = .{
104001 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104002 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104003 .{ .type = .usize, .kind = .{ .reg = .rax } },
104004 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104005 .{ .type = .usize, .kind = .{ .reg = .rdx } },
104006 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104007 .unused,
104008 .unused,
104009 .unused,
104010 .unused,
104011 .unused,
104012 },
104013 .clobbers = .{ .eflags = true },
104014 .each = .{ .once = &.{
104015 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },
104016 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },
104017 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },
104018 .{ ._, ._, .mov, .tmp3d, .sa(.src1, .add_size), ._, ._ },
104019 .{ ._, ._, .xor, .tmp4p, .tmp4p, ._, ._ },
104020 .{ ._, ._, .div, .tmp3p, ._, ._, ._ },
104021 .{ ._, ._, .@"test", .tmp4p, .tmp4p, ._, ._ },
104022 .{ ._, ._nz, .j, .@"1f", ._, ._, ._ },
104023 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },
104024 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104025 .{ .@"1:", ._, .call, .tmp5d, ._, ._, ._ },
104026 } },
104027 }, .{
104028 .required_features = .{ .bmi2, null, null, null },
104029 .src_constraints = .{ .any, .po2_any, .any },
104030 .patterns = &.{
104031 .{ .src = .{ .mem, .none, .none } },
104032 .{ .src = .{ .to_gpr, .none, .none } },
104033 },
104034 .call_frame = .{ .alignment = .@"8" },
104035 .extra_temps = .{
104036 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104037 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104038 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104039 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104040 .unused,
104041 .unused,
104042 .unused,
104043 .unused,
104044 .unused,
104045 .unused,
104046 .unused,
104047 },
104048 .clobbers = .{ .eflags = true },
104049 .each = .{ .once = &.{
104050 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },
104051 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },
104052 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },
104053 .{ ._, ._rx, .ro, .tmp2p, .tmp2p, .sa(.src1, .add_log2_size), ._ },
104054 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },
104055 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104056 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
104057 } },
104058 }, .{
104059 .src_constraints = .{ .any, .po2_any, .any },
104060 .patterns = &.{
104061 .{ .src = .{ .mem, .none, .none } },
104062 .{ .src = .{ .to_gpr, .none, .none } },
104063 },
104064 .call_frame = .{ .alignment = .@"8" },
104065 .extra_temps = .{
104066 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104067 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104068 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104069 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104070 .unused,
104071 .unused,
104072 .unused,
104073 .unused,
104074 .unused,
104075 .unused,
104076 .unused,
104077 },
104078 .clobbers = .{ .eflags = true },
104079 .each = .{ .once = &.{
104080 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },
104081 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },
104082 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },
104083 .{ ._, ._r, .ro, .tmp2p, .sa(.src1, .add_log2_size), ._, ._ },
104084 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },
104085 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104086 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
104087 } },
104088 }, .{
104089 .patterns = &.{
104090 .{ .src = .{ .mem, .none, .none } },
104091 .{ .src = .{ .to_gpr, .none, .none } },
104092 },
104093 .call_frame = .{ .alignment = .@"8" },
104094 .extra_temps = .{
104095 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104096 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104097 .{ .type = .usize, .kind = .{ .reg = .rax } },
104098 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104099 .{ .type = .usize, .kind = .{ .reg = .rdx } },
104100 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104101 .unused,
104102 .unused,
104103 .unused,
104104 .unused,
104105 .unused,
104106 },
104107 .clobbers = .{ .eflags = true },
104108 .each = .{ .once = &.{
104109 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_ptr_size), ._, ._ },
104110 .{ ._, ._, .mov, .tmp2p, .src0p, ._, ._ },
104111 .{ ._, ._, .sub, .tmp2p, .tmp0p, ._, ._ },
104112 .{ ._, ._, .mov, .tmp3d, .sa(.src1, .add_size), ._, ._ },
104113 .{ ._, ._, .xor, .tmp4p, .tmp4p, ._, ._ },
104114 .{ ._, ._, .div, .tmp3p, ._, ._, ._ },
104115 .{ ._, ._, .@"test", .tmp4p, .tmp4p, ._, ._ },
104116 .{ ._, ._nz, .j, .@"1f", ._, ._, ._ },
104117 .{ ._, ._, .cmp, .tmp2p, .leaa(.tmp0p, .sub_ptr_size), ._, ._ },
104118 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104119 .{ .@"1:", ._, .call, .tmp5d, ._, ._, ._ },
104120 } },
104121 } }) catch |err| switch (err) {
104122 error.SelectFailed => return cg.fail("failed to select {t} {f} {f} {f}", .{
104123 air_tag,
104124 unrestricted_ty.fmt(pt),
104125 restricted_ty.fmt(pt),
104126 ops[0].tracking(cg),
104127 }),
104128 else => |e| return e,
104129 },
104130 };
104131 break :res try ops[0].load(unrestricted_ty, .{}, cg);
104132 },
104133 .direct => ops[0],
103829 var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}) ++ .{
103830 try cg.tempInit(.usize, .{ .immediate = unrestricted_ty.abiAlignment(zcu).forward(restricted_ty.abiSize(zcu)) }),
103831 };
103832 var res: [1]Temp = undefined;
103833 cg.select(&res, &.{unrestricted_ty}, &ops, switch (air_tag) {
103834 else => unreachable,
103835 .unwrap_restricted => &.{ .{
103836 .required_features = .{ .@"64bit", null, null, null },
103837 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
103838 .patterns = &.{
103839 .{ .src = .{ .to_gpr, .simm32, .none } },
103840 },
103841 .extra_temps = .{
103842 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103843 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103844 .unused,
103845 .unused,
103846 .unused,
103847 .unused,
103848 .unused,
103849 .unused,
103850 .unused,
103851 .unused,
103852 .unused,
103853 },
103854 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103855 .each = .{ .once = &.{
103856 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103857 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103858 .{ ._, ._, .movzx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
103859 } },
103860 }, .{
103861 .required_features = .{ .@"64bit", null, null, null },
103862 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
103863 .patterns = &.{
103864 .{ .src = .{ .to_gpr, .simm32, .none } },
103865 },
103866 .extra_temps = .{
103867 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103868 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103869 .unused,
103870 .unused,
103871 .unused,
103872 .unused,
103873 .unused,
103874 .unused,
103875 .unused,
103876 .unused,
103877 .unused,
103878 },
103879 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103880 .each = .{ .once = &.{
103881 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103882 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103883 .{ ._, ._, .movsx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
103884 } },
103885 }, .{
103886 .required_features = .{ .@"64bit", null, null, null },
103887 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
103888 .patterns = &.{
103889 .{ .src = .{ .to_gpr, .simm32, .none } },
103890 },
103891 .extra_temps = .{
103892 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103893 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103894 .unused,
103895 .unused,
103896 .unused,
103897 .unused,
103898 .unused,
103899 .unused,
103900 .unused,
103901 .unused,
103902 .unused,
103903 },
103904 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103905 .each = .{ .once = &.{
103906 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103907 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103908 .{ ._, ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
103909 } },
103910 }, .{
103911 .required_features = .{ .@"64bit", null, null, null },
103912 .dst_constraints = .{ .{ .signed_int = .word }, .any },
103913 .patterns = &.{
103914 .{ .src = .{ .to_gpr, .simm32, .none } },
103915 },
103916 .extra_temps = .{
103917 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103918 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103919 .unused,
103920 .unused,
103921 .unused,
103922 .unused,
103923 .unused,
103924 .unused,
103925 .unused,
103926 .unused,
103927 .unused,
103928 },
103929 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103930 .each = .{ .once = &.{
103931 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103932 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103933 .{ ._, ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .dst0), ._, ._ },
103934 } },
103935 }, .{
103936 .required_features = .{ .@"64bit", null, null, null },
103937 .dst_constraints = .{ .{ .int = .dword }, .any },
103938 .patterns = &.{
103939 .{ .src = .{ .to_gpr, .simm32, .none } },
103940 },
103941 .extra_temps = .{
103942 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103943 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103944 .unused,
103945 .unused,
103946 .unused,
103947 .unused,
103948 .unused,
103949 .unused,
103950 .unused,
103951 .unused,
103952 .unused,
103953 },
103954 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103955 .each = .{ .once = &.{
103956 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103957 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103958 .{ ._, ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .dst0), ._, ._ },
103959 } },
103960 }, .{
103961 .required_features = .{ .@"64bit", null, null, null },
103962 .dst_constraints = .{ .{ .int = .qword }, .any },
103963 .patterns = &.{
103964 .{ .src = .{ .to_gpr, .simm32, .none } },
103965 },
103966 .extra_temps = .{
103967 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103968 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103969 .unused,
103970 .unused,
103971 .unused,
103972 .unused,
103973 .unused,
103974 .unused,
103975 .unused,
103976 .unused,
103977 .unused,
103978 },
103979 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
103980 .each = .{ .once = &.{
103981 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
103982 .{ ._, ._, .mov, .dst0d, .src0d, ._, ._ },
103983 .{ ._, ._, .mov, .dst0q, .leasi(.tmp0q, .@"8", .dst0), ._, ._ },
103984 } },
103985 }, .{
103986 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
103987 .patterns = &.{
103988 .{ .src = .{ .to_gpr, .simm32, .none } },
103989 },
103990 .extra_temps = .{
103991 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
103992 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
103993 .unused,
103994 .unused,
103995 .unused,
103996 .unused,
103997 .unused,
103998 .unused,
103999 .unused,
104000 .unused,
104001 .unused,
104002 },
104003 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104004 .each = .{ .once = &.{
104005 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104006 .{ ._, ._, .movzx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104007 } },
104008 }, .{
104009 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104010 .patterns = &.{
104011 .{ .src = .{ .to_gpr, .simm32, .none } },
104012 },
104013 .extra_temps = .{
104014 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104015 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104016 .unused,
104017 .unused,
104018 .unused,
104019 .unused,
104020 .unused,
104021 .unused,
104022 .unused,
104023 .unused,
104024 .unused,
104025 },
104026 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104027 .each = .{ .once = &.{
104028 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104029 .{ ._, ._, .movsx, .dst0d, .leai(.tmp0b, .src0), ._, ._ },
104030 } },
104031 }, .{
104032 .dst_constraints = .{ .{ .unsigned_int = .word }, .any },
104033 .patterns = &.{
104034 .{ .src = .{ .to_gpr, .simm32, .none } },
104035 },
104036 .extra_temps = .{
104037 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104038 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104039 .unused,
104040 .unused,
104041 .unused,
104042 .unused,
104043 .unused,
104044 .unused,
104045 .unused,
104046 .unused,
104047 .unused,
104048 },
104049 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104050 .each = .{ .once = &.{
104051 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104052 .{ ._, ._, .movzx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104053 } },
104054 }, .{
104055 .dst_constraints = .{ .{ .signed_int = .word }, .any },
104056 .patterns = &.{
104057 .{ .src = .{ .to_gpr, .simm32, .none } },
104058 },
104059 .extra_temps = .{
104060 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104061 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104062 .unused,
104063 .unused,
104064 .unused,
104065 .unused,
104066 .unused,
104067 .unused,
104068 .unused,
104069 .unused,
104070 .unused,
104071 },
104072 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104073 .each = .{ .once = &.{
104074 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104075 .{ ._, ._, .movsx, .dst0d, .leasi(.tmp0w, .@"2", .src0), ._, ._ },
104076 } },
104077 }, .{
104078 .dst_constraints = .{ .{ .int = .dword }, .any },
104079 .patterns = &.{
104080 .{ .src = .{ .to_gpr, .simm32, .none } },
104081 },
104082 .extra_temps = .{
104083 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104084 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104085 .unused,
104086 .unused,
104087 .unused,
104088 .unused,
104089 .unused,
104090 .unused,
104091 .unused,
104092 .unused,
104093 .unused,
104094 },
104095 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104096 .each = .{ .once = &.{
104097 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104098 .{ ._, ._, .mov, .dst0d, .leasi(.tmp0d, .@"4", .src0), ._, ._ },
104099 } },
104100 } },
104101 .unwrap_restricted_safe => &.{ .{
104102 .required_features = .{ .@"64bit", .avx, null, null },
104103 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104104 .patterns = &.{
104105 .{ .src = .{ .to_gpr, .simm32, .none } },
104106 },
104107 .call_frame = .{ .alignment = .@"32" },
104108 .extra_temps = .{
104109 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
104110 .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .deferred_const_data, .ref = .src0 } } },
104111 .{ .type = .usize, .kind = .{ .panic_func = .corrupt_restricted_value } },
104112 .unused,
104113 .unused,
104114 .unused,
104115 .unused,
104116 .unused,
104117 .unused,
104118 .unused,
104119 .unused,
104120 },
104121 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } }, .unused },
104122 .clobbers = .{ .eflags = true },
104123 .each = .{ .once = &.{
104124 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp1, .add_src1), ._, ._ },
104125 .{ ._, ._, .cmp, .src0d, .leaa(.tmp0d, .sub_src1), ._, ._ },
104126 .{ ._, ._b, .j, .@"0f", ._, ._, ._ },
104127 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
104128 .{ .@"0:", ._, .mov, .dst0d, .src0d, ._, ._ },
104129 .{ ._, ._, .movzx, .dst0d, .leai(.tmp0b, .dst0), ._, ._ },
104130 } },
104131 }, .{
104132 .required_features = .{ .@"64bit", .sse, null, null },
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,
104134105080 };
104135105081 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);
104137105083 },
104138105084 .struct_field_ptr => {
104139105085 const ty_pl = air_datas[@intFromEnum(inst)].ty_pl;
......@@ -104306,7 +105252,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104306105252 .{ ._, ._, .bt, .src0d, .src1d, ._, ._ },
104307105253 } },
104308105254 }, .{
104309 .dst_constraints = .{ .{ .int = .byte }, .any },
105255 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104310105256 .patterns = &.{
104311105257 .{ .src = .{ .to_mem, .simm32, .none } },
104312105258 },
......@@ -104315,32 +105261,68 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104315105261 .{ ._, ._, .movzx, .dst0d, .mema(.src0b, .add_src0_elem_size_mul_src1), ._, ._ },
104316105262 } },
104317105263 }, .{
104318 .dst_constraints = .{ .{ .int = .byte }, .any },
105264 .dst_constraints = .{ .{ .unsigned_int = .byte }, .any },
104319105265 .patterns = &.{
104320105266 .{ .src = .{ .to_mem, .to_gpr, .none } },
104321105267 },
104322 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },
105268 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src1, .rc = .general_purpose } }, .unused },
104323105269 .each = .{ .once = &.{
104324105270 .{ ._, ._, .movzx, .dst0d, .memi(.src0b, .src1), ._, ._ },
104325105271 } },
104326105272 }, .{
104327 .dst_constraints = .{ .{ .int = .word }, .any },
105273 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104328105274 .patterns = &.{
104329105275 .{ .src = .{ .to_mem, .simm32, .none } },
104330105276 },
104331105277 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },
104332105278 .each = .{ .once = &.{
104333 .{ ._, ._, .movzx, .dst0d, .mema(.src0w, .add_src0_elem_size_mul_src1), ._, ._ },
105279 .{ ._, ._, .movsx, .dst0d, .mema(.src0b, .add_src0_elem_size_mul_src1), ._, ._ },
104334105280 } },
104335105281 }, .{
104336 .dst_constraints = .{ .{ .int = .word }, .any },
105282 .dst_constraints = .{ .{ .signed_int = .byte }, .any },
104337105283 .patterns = &.{
104338105284 .{ .src = .{ .to_mem, .to_gpr, .none } },
104339105285 },
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 },
104340105295 .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 },
104341105305 .each = .{ .once = &.{
104342105306 .{ ._, ._, .movzx, .dst0d, .memsi(.src0w, .@"2", .src1), ._, ._ },
104343105307 } },
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 } },
104344105326 }, .{
104345105327 .dst_constraints = .{ .{ .int = .dword }, .any },
104346105328 .patterns = &.{
......@@ -104355,7 +105337,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104355105337 .patterns = &.{
104356105338 .{ .src = .{ .to_mem, .to_gpr, .none } },
104357105339 },
104358 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },
105340 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src1, .rc = .general_purpose } }, .unused },
104359105341 .each = .{ .once = &.{
104360105342 .{ ._, ._, .mov, .dst0d, .memsi(.src0d, .@"4", .src1), ._, ._ },
104361105343 } },
......@@ -104375,7 +105357,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
104375105357 .patterns = &.{
104376105358 .{ .src = .{ .to_mem, .to_gpr, .none } },
104377105359 },
104378 .dst_temps = .{ .{ .rc = .general_purpose }, .unused },
105360 .dst_temps = .{ .{ .mut_rc = .{ .ref = .src1, .rc = .general_purpose } }, .unused },
104379105361 .each = .{ .once = &.{
104380105362 .{ ._, ._, .mov, .dst0q, .memsi(.src0q, .@"8", .src1), ._, ._ },
104381105363 } },
......@@ -174389,28 +175371,26 @@ fn allocRegOrMemAdvanced(self: *CodeGen, ty: Type, inst: ?Air.Inst.Index, reg_ok
174389175371
174390175372 if (reg_ok) need_mem: {
174391175373 if (!std.math.isPowerOfTwo(abi_size)) break :need_mem;
174392 const unrestricted_ty: Type = if (ty.unrestrictedType(zcu)) |unrestricted_ty| switch (ty.restrictedRepr(zcu)) {
174393 .indirect => .usize,
174394 .direct => unrestricted_ty,
174395 } else ty;
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),
175374 if (zcu.intern_pool.isRestrictedType(ty.toIntern()) or
175375 abi_size <= @as(u32, max_abi_size: switch (ty.zigTypeTag(zcu)) {
175376 .float => switch (ty.floatBits(self.target)) {
175377 16, 32, 64, 128 => 16,
174408175378 80 => break :need_mem,
174409175379 else => unreachable,
174410 } else self.vectorSize(.int);
174411 },
174412 else => 8,
174413 })) {
175380 },
175381 .vector => {
175382 const elem_ty = ty.childType(zcu);
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 {
174414175394 if (self.register_manager.tryAllocReg(inst, self.regSetForType(ty))) |reg| {
174415175395 return MCValue{ .register = registerAlias(reg, abi_size) };
174416175396 }
......@@ -181410,7 +182390,6 @@ fn lowerValue(cg: *CodeGen, val: Value) Allocator.Error!MCValue {
181410182390 .lea_nav => |nav| .{ .lea_nav = nav },
181411182391 .lea_uav => |uav| .{ .lea_uav = uav },
181412182392 .load_uav => |uav| .{ .load_uav = uav },
181413 .lea_lazy_sym => |lazy_sym| .{ .lea_lazy_sym = lazy_sym },
181414182393 };
181415182394}
181416182395
......@@ -189344,7 +190323,6 @@ const Select = struct {
189344190323 ptr_size,
189345190324 ptr_bit_size,
189346190325 size,
189347 log2_size,
189348190326 src0_size,
189349190327 dst0_size,
189350190328 delta_size,
......@@ -189379,7 +190357,6 @@ const Select = struct {
189379190357 rhs: Memory.Scale,
189380190358
189381190359 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" };
189383190360 const sub_ptr_size: Adjust = .{ .sign = .neg, .lhs = .ptr_size, .op = .mul, .rhs = .@"1" };
189384190361 const add_ptr_bit_size: Adjust = .{ .sign = .pos, .lhs = .ptr_bit_size, .op = .mul, .rhs = .@"1" };
189385190362 const add_size: Adjust = .{ .sign = .pos, .lhs = .size, .op = .mul, .rhs = .@"1" };
......@@ -189388,7 +190365,6 @@ const Select = struct {
189388190365 const sub_size_div_8: Adjust = .{ .sign = .neg, .lhs = .size, .op = .div, .rhs = .@"8" };
189389190366 const sub_size_div_4: Adjust = .{ .sign = .neg, .lhs = .size, .op = .div, .rhs = .@"4" };
189390190367 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" };
189392190368 const sub_src0_size_div_8: Adjust = .{ .sign = .neg, .lhs = .src0_size, .op = .div, .rhs = .@"8" };
189393190369 const sub_src0_size: Adjust = .{ .sign = .neg, .lhs = .src0_size, .op = .mul, .rhs = .@"1" };
189394190370 const add_src0_size: Adjust = .{ .sign = .pos, .lhs = .src0_size, .op = .mul, .rhs = .@"1" };
......@@ -189449,6 +190425,7 @@ const Select = struct {
189449190425 const add_src1: Adjust = .{ .sign = .pos, .lhs = .src1, .op = .mul, .rhs = .@"1" };
189450190426 const add_src1_rem_32: Adjust = .{ .sign = .pos, .lhs = .src1, .op = .rem_8_mul, .rhs = .@"4" };
189451190427 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" };
189452190429 const add_src1_sub_bit_size: Adjust = .{ .sign = .pos, .lhs = .src1_sub_bit_size, .op = .mul, .rhs = .@"1" };
189453190430 const add_log2_src0_elem_size: Adjust = .{ .sign = .pos, .lhs = .log2_src0_elem_size, .op = .mul, .rhs = .@"1" };
189454190431 const elem_mask: Adjust = .{ .sign = .pos, .lhs = .elem_mask, .op = .mul, .rhs = .@"1" };
......@@ -190323,7 +191300,6 @@ const Select = struct {
190323191300 .none => 0,
190324191301 .ptr_size => @divExact(s.cg.target.ptrBitWidth(), 8),
190325191302 .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)),
190327191303 .size => @intCast(op.flags.base.ref.typeOf(s).abiSize(s.cg.pt.zcu)),
190328191304 .src0_size => @intCast(Select.Operand.Ref.src0.typeOf(s).abiSize(s.cg.pt.zcu)),
190329191305 .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 {
18771877 .mod = mem.mod,
18781878 .size = switch (mem.mod) {
18791879 .rm => |rm| rm.size,
1880 .off => undefined,
1880 .off => .none,
18811881 },
18821882 .index = switch (mem.mod) {
18831883 .rm => |rm| rm.index,
1884 .off => undefined,
1884 .off => .none,
18851885 },
18861886 .scale = switch (mem.mod) {
18871887 .rm => |rm| rm.scale,
1888 .off => undefined,
1888 .off => .@"1",
18891889 },
18901890 },
18911891 .base = switch (mem.base) {
src/link.zig+6
......@@ -412,6 +412,8 @@ pub const File = struct {
412412 lock: ?Cache.Lock = null,
413413 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
415417 pub const OpenOptions = struct {
416418 symbol_count_hint: u64 = 32,
417419 program_code_size_hint: u64 = 256 * 1024,
......@@ -894,6 +896,10 @@ pub const File = struct {
894896 }
895897
896898 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
897903 const io = base.comp.io;
898904 base.releaseLock();
899905 if (base.file) |f| f.close(io);
src/link/Coff.zig+1
......@@ -1912,6 +1912,7 @@ fn flushUav(
19121912 try coff.nodes.ensureUnusedCapacity(gpa, 1);
19131913 const sym = si.get(coff);
19141914 const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{
1915 .size = Type.fromInterned(zcu.intern_pool.typeOf(uav_val)).abiSize(zcu),
19151916 .alignment = uav_align.toStdMem(),
19161917 .moved = true,
19171918 });
src/link/Dwarf.zig+36-34
......@@ -3510,13 +3510,9 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
35103510
35113511 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)) {
35143514 .func => return, // populated by the Nav instead (`updateComptimeNav` or `initWipNav`)
35153515 .@"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 },
35203516 else => |key| key,
35213517 };
35223518
......@@ -3845,26 +3841,20 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
38453841 .adhoc_inferred_error_set => unreachable,
38463842 },
38473843 .restricted_type => |restricted_type| {
3848 const repr = Type.restrictedReprByTrackedInst(restricted_type.zir_index, zcu);
3849 try wip_nav.abbrevCode(switch (repr) {
3850 .indirect => .ptr_type,
3851 .direct => .alias_type,
3852 });
3844 try wip_nav.abbrevCode(.generated_struct_type);
38533845 try wip_nav.strpFmt("{f}", .{val.toType().fmt(pt)});
3854 switch (repr) {
3855 .indirect => {
3856 try diw.writeByte(@intFromEnum(InternPool.Key.PtrType.AddressSpace.generic));
3857 try wip_nav.infoSectionOffset(
3858 .debug_info,
3859 wip_nav.unit,
3860 wip_nav.entry,
3861 @intCast(diw.end + dwarf.sectionOffsetBytes()),
3862 );
3863 try wip_nav.abbrevCode(.is_const);
3864 },
3865 .direct => {},
3846 try diw.writeUleb128(val.toType().abiSize(zcu));
3847 try diw.writeUleb128(val.toType().abiAlignment(zcu).toByteUnits().?);
3848 {
3849 try wip_nav.abbrevCode(.generated_field);
3850 try wip_nav.strp("value");
3851 try wip_nav.refType(if (zcu.backendSupportsFeature(.restricted_types))
3852 .u32
3853 else
3854 .fromInterned(restricted_type.unrestricted_type));
3855 try diw.writeUleb128(0);
38663856 }
3867 try wip_nav.refType(.fromInterned(restricted_type.unrestricted_type));
3857 try diw.writeUleb128(@intFromEnum(AbbrevCode.null));
38683858 },
38693859 .tuple_type => |tuple_type| if (tuple_type.types.len == 0) {
38703860 try wip_nav.abbrevCode(.generated_empty_struct_type);
......@@ -4645,7 +4635,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
46454635 .un => |un| {
46464636 try wip_nav.abbrevCode(.aggregate_comptime_value);
46474637 try wip_nav.refType(.fromInterned(un.ty));
4648 field: {
4638 {
46494639 const loaded_union_type = ip.loadUnionType(un.ty);
46504640 assert(loaded_union_type.layout == .auto);
46514641 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
46584648 else if (has_runtime_bits)
46594649 .comptime_value_field_runtime_bits
46604650 else
4661 break :field);
4651 .field);
46624652 try wip_nav.strp(field_name.toSlice(ip));
46634653 if (has_comptime_state)
46644654 try wip_nav.refValue(.fromInterned(un.val))
4665 else
4655 else if (has_runtime_bits)
46664656 try wip_nav.blockValue(src_loc, .fromInterned(un.val));
46674657 }
46684658 try diw.writeUleb128(@intFromEnum(AbbrevCode.null));
46694659 },
4670 .restricted_value => |restricted_value| { // repr checked above
4671 try wip_nav.abbrevCode(.location_comptime_value);
4672 const unrestricted_unit, const unrestricted_entry =
4673 try wip_nav.getValueEntry(.fromInterned(restricted_value.unrestricted_value));
4674 try wip_nav.infoExprLoc(.{ .implicit_pointer = .{
4675 .unit = unrestricted_unit,
4676 .entry = unrestricted_entry,
4677 } });
4660 .restricted_value => |restricted_value| {
4661 try wip_nav.abbrevCode(.aggregate_comptime_value);
4662 try wip_nav.refType(.fromInterned(restricted_value.ty));
4663 field: {
4664 const unrestricted_ty: Type = .fromInterned(ip.typeOf(restricted_value.unrestricted_value));
4665 const has_runtime_bits = unrestricted_ty.hasRuntimeBits(zcu);
4666 const has_comptime_state = unrestricted_ty.comptimeOnly(zcu);
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));
46784680 },
46794681 .memoized_call => unreachable, // not a value
46804682 }
src/link/Elf2.zig+2-4
......@@ -2981,10 +2981,7 @@ pub fn lowerUav(
29812981 if (gop.found_existing) {
29822982 gop.value_ptr.alignment = gop.value_ptr.alignment.max(uav_align);
29832983 } else {
2984 gop.value_ptr.* = .{
2985 .alignment = uav_align,
2986 .src_loc = src_loc,
2987 };
2984 gop.value_ptr.* = .{ .alignment = uav_align, .src_loc = src_loc };
29882985 elf.const_prog_node.increaseEstimatedTotalItems(1);
29892986 }
29902987 }
......@@ -3245,6 +3242,7 @@ fn flushUav(
32453242 try elf.nodes.ensureUnusedCapacity(gpa, 1);
32463243 const sec_si = elf.si.data;
32473244 const ni = try elf.mf.addLastChildNode(gpa, sec_si.node(elf), .{
3245 .size = Type.fromInterned(zcu.intern_pool.typeOf(uav_val)).abiSize(zcu),
32483246 .alignment = uav_align.toStdMem(),
32493247 .moved = true,
32503248 });
src/target.zig+14-9
......@@ -908,9 +908,13 @@ pub fn zigBackend(target: *const std.Target, use_llvm: bool) std.builtin.Compile
908908 };
909909}
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 {
912916 return switch (feature) {
913 .panic_fn => switch (backend) {
917 .panic_fn => switch (opts.backend) {
914918 .stage2_aarch64,
915919 .stage2_c,
916920 .stage2_llvm,
......@@ -920,23 +924,23 @@ pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, incre
920924 => true,
921925 else => false,
922926 },
923 .error_return_trace => switch (backend) {
927 .error_return_trace => switch (opts.backend) {
924928 .stage2_llvm, .stage2_x86_64 => true,
925929 else => false,
926930 },
927 .is_named_enum_value => switch (backend) {
931 .is_named_enum_value => switch (opts.backend) {
928932 .stage2_llvm, .stage2_x86_64 => true,
929933 else => false,
930934 },
931 .error_set_has_value => switch (backend) {
935 .error_set_has_value => switch (opts.backend) {
932936 .stage2_llvm, .stage2_wasm, .stage2_x86_64 => true,
933937 else => false,
934938 },
935 .field_reordering => switch (backend) {
939 .field_reordering => switch (opts.backend) {
936940 .stage2_aarch64, .stage2_c, .stage2_llvm, .stage2_x86_64 => true,
937941 else => false,
938942 },
939 .separate_thread => switch (backend) {
943 .separate_thread => switch (opts.backend) {
940944 // Supports a separate thread but does not support N separate
941945 // threads because they would all just be locking the same mutex to
942946 // protect Builder.
......@@ -948,9 +952,10 @@ pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, incre
948952 // being run in a separate thread from now on.
949953 else => true,
950954 },
951 .restricted_types => switch (backend) {
955 .restricted_types => switch (opts.backend) {
952956 .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,
954959 else => false,
955960 },
956961 };