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 {...@@ -1300,7 +1300,6 @@ pub const Value = struct {
13001300
1301 /// Materializes a value1301 /// Materializes a value
1302 fn mat(vi: Value.Index, isel: *Select, opts: MatOptions) codegen.Error!Mat {1302 fn mat(vi: Value.Index, isel: *Select, opts: MatOptions) codegen.Error!Mat {
1303 // try vi.split(isel, true);
1304 const mat_size = @min(opts.size, @as(u32, @intCast(vi.size(isel) - opts.offset)));1303 const mat_size = @min(opts.size, @as(u32, @intCast(vi.size(isel) - opts.offset)));
1305 const loc_pref = if (opts.extension == .garbage)1304 const loc_pref = if (opts.extension == .garbage)
1306 opts.pref1305 opts.pref
...@@ -4064,9 +4063,8 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) codegen.Error!void...@@ -4064,9 +4063,8 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) codegen.Error!void
4064 .{ 0, @as(u32, @intCast(payload_size)) };4063 .{ 0, @as(u32, @intCast(payload_size)) };
40654064
4066 const opt_vi = try isel.use(un_op);4065 const opt_vi = try isel.use(un_op);
4067 const has_value_mat = try opt_vi.mat(isel, .{4066 const has_value_vi = try opt_vi.partExact(isel, has_value_offset, has_value_size);
4068 .offset = has_value_offset,4067 const has_value_mat = try has_value_vi.mat(isel, .{
4069 .size = has_value_size,
4070 .pref = .only_reg,4068 .pref = .only_reg,
4071 .reg_mod = .integer,4069 .reg_mod = .integer,
4072 .extension = .zero_ext,4070 .extension = .zero_ext,