authorgravatar for xtex@astrafall.orgxtex <xtex@astrafall.org> 2026-10-17 10:14:44+08:00
committergravatar for xtex@astrafall.orgxtex <xtex@astrafall.org> 2026-10-17 10:30:18+08:00
loge9ab04c89ae3079cf106d34571a825e76f46bd58
tree87651817633cd9c2ec9bad31d502e95f96d27892
parent70648bc4b8440abd22161148afc41645e1ab3fd0
signature Signed by SSH key SHA256:IEYEjkZlkUTr5U9GiDAmZU/4eZus2t2RsxusyhQqwao

loongarch: is_non_null materialize only the required part

Materialize the has_value part instead of picking a byte from the optional. This makes the zero_ext modifier only apply to the has_value part rather than to the whole optional.

1 files changed, 2 insertions(+), 4 deletions(-)

src/codegen/loongarch/Select.zig+2-4
......@@ -1300,7 +1300,6 @@ pub const Value = struct {
13001300
13011301 /// Materializes a value
13021302 fn mat(vi: Value.Index, isel: *Select, opts: MatOptions) codegen.Error!Mat {
1303 // try vi.split(isel, true);
13041303 const mat_size = @min(opts.size, @as(u32, @intCast(vi.size(isel) - opts.offset)));
13051304 const loc_pref = if (opts.extension == .garbage)
13061305 opts.pref
......@@ -4064,9 +4063,8 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) codegen.Error!void
40644063 .{ 0, @as(u32, @intCast(payload_size)) };
40654064
40664065 const opt_vi = try isel.use(un_op);
4067 const has_value_mat = try opt_vi.mat(isel, .{
4068 .offset = has_value_offset,
4069 .size = has_value_size,
4066 const has_value_vi = try opt_vi.partExact(isel, has_value_offset, has_value_size);
4067 const has_value_mat = try has_value_vi.mat(isel, .{
40704068 .pref = .only_reg,
40714069 .reg_mod = .integer,
40724070 .extension = .zero_ext,