authorgravatar for xtex@astrafall.orgxtex <xtex@astrafall.org> 2026-08-30 20:31:11+08:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-30 22:54:04+02:00
log14bac1ffcf044c01362776cceb9ff8d381285fd4
tree645d2cc997841f339d6e67593224fb4581a5270e
parent4814caef6fe3dd6c8a3cae31b7934ab4cedf2199

loongarch: protect result register in cmp


1 files changed, 3 insertions(+), 0 deletions(-)

src/codegen/loongarch/Select.zig+3
...@@ -5948,6 +5948,9 @@ fn cmp(...@@ -5948,6 +5948,9 @@ fn cmp(
5948 rhs_vi: Value.Index,5948 rhs_vi: Value.Index,
5949) !void {5949) !void {
5950 wip_mir_log.debug(" | # cmp {f}, {t}, {f}, {t}, {f}", .{ isel.fmtType(ty), res_reg, lhs_vi, op, rhs_vi });5950 wip_mir_log.debug(" | # cmp {f}, {t}, {f}, {t}, {f}", .{ isel.fmtType(ty), res_reg, lhs_vi, op, rhs_vi });
5951 const res_lock = isel.tryLockReg(res_reg);
5952 defer res_lock.unlock(isel);
5953
5951 if (!ty.isRuntimeFloat() and !ty.isArrayOrVector(isel.pt.zcu)) {5954 if (!ty.isRuntimeFloat() and !ty.isArrayOrVector(isel.pt.zcu)) {
5952 // integeral comparison5955 // integeral comparison
5953 const int_info: std.builtin.Type.Int = if (ty.toIntern() == .bool_type)5956 const int_info: std.builtin.Type.Int = if (ty.toIntern() == .bool_type)