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(
59485948 rhs_vi: Value.Index,
59495949) !void {
59505950 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
59515954 if (!ty.isRuntimeFloat() and !ty.isArrayOrVector(isel.pt.zcu)) {
59525955 // integeral comparison
59535956 const int_info: std.builtin.Type.Int = if (ty.toIntern() == .bool_type)