]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
ARM64: Fix register allocation for IR_*LOAD.
authorMike Pall <mike>
Tue, 29 Aug 2023 20:35:10 +0000 (22:35 +0200)
committerMike Pall <mike>
Tue, 29 Aug 2023 20:35:10 +0000 (22:35 +0200)
Thanks to Peter Cawley. #1062

src/lj_asm_arm64.h

index 3889883da0204aa0953f0133479944464c6bb05e..c216fced79ddf3a17094e39d5bba367e51363a2f 100644 (file)
@@ -1107,6 +1107,8 @@ static void asm_ahuvload(ASMState *as, IRIns *ir)
   }
   type = ra_scratch(as, rset_clear(gpr, tmp));
   idx = asm_fuseahuref(as, ir->op1, &ofs, rset_clear(gpr, type), A64I_LDRx);
+  rset_clear(gpr, idx);
+  if (ofs & FUSE_REG) rset_clear(gpr, ofs & 31);
   if (ir->o == IR_VLOAD) ofs += 8 * ir->op2;
   /* Always do the type check, even if the load result is unused. */
   asm_guardcc(as, irt_isnum(ir->t) ? CC_LS : CC_NE);
@@ -1114,7 +1116,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir)
     lj_assertA(irt_isinteger(ir->t) || irt_isnum(ir->t),
               "bad load type %d", irt_type(ir->t));
     emit_nm(as, A64I_CMPx | A64F_SH(A64SH_LSR, 32),
-           ra_allock(as, LJ_TISNUM << 15, rset_exclude(gpr, idx)), tmp);
+           ra_allock(as, LJ_TISNUM << 15, gpr), tmp);
   } else if (irt_isaddr(ir->t)) {
     emit_n(as, (A64I_CMNx^A64I_K12) | A64F_U12(-irt_toitype(ir->t)), type);
     emit_dn(as, A64I_ASRx | A64F_IMMR(47), type, tmp);