aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2013-07-31 01:48:21 +0200
committerMike Pall <mike>2013-07-31 01:48:21 +0200
commit6a878b04413b0b02412399aaa9dd8f3767a193f7 (patch)
tree0763385894f08f630c0d10b282848a70b4b85f20
parent6dc02450d3f8af23af8b03c96c371a897219ad61 (diff)
downloadluajit-6a878b04413b0b02412399aaa9dd8f3767a193f7.tar.gz
luajit-6a878b04413b0b02412399aaa9dd8f3767a193f7.tar.bz2
luajit-6a878b04413b0b02412399aaa9dd8f3767a193f7.zip
ARM: Fix register allocation when rematerializing FPRs.
-rw-r--r--src/lj_asm_arm.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h
index a66573c0..d1bdd409 100644
--- a/src/lj_asm_arm.h
+++ b/src/lj_asm_arm.h
@@ -521,10 +521,10 @@ static void asm_tointg(ASMState *as, IRIns *ir, Reg left)
521static void asm_tobit(ASMState *as, IRIns *ir) 521static void asm_tobit(ASMState *as, IRIns *ir)
522{ 522{
523 RegSet allow = RSET_FPR; 523 RegSet allow = RSET_FPR;
524 Reg dest = ra_dest(as, ir, RSET_GPR);
525 Reg left = ra_alloc1(as, ir->op1, allow); 524 Reg left = ra_alloc1(as, ir->op1, allow);
526 Reg right = ra_alloc1(as, ir->op2, rset_clear(allow, left)); 525 Reg right = ra_alloc1(as, ir->op2, rset_clear(allow, left));
527 Reg tmp = ra_scratch(as, rset_clear(allow, right)); 526 Reg tmp = ra_scratch(as, rset_clear(allow, right));
527 Reg dest = ra_dest(as, ir, RSET_GPR);
528 emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15)); 528 emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15));
529 emit_dnm(as, ARMI_VADD_D, (tmp & 15), (left & 15), (right & 15)); 529 emit_dnm(as, ARMI_VADD_D, (tmp & 15), (left & 15), (right & 15));
530} 530}
@@ -564,9 +564,9 @@ static void asm_conv(ASMState *as, IRIns *ir)
564 lua_assert(irt_isint(ir->t) && st == IRT_NUM); 564 lua_assert(irt_isint(ir->t) && st == IRT_NUM);
565 asm_tointg(as, ir, ra_alloc1(as, lref, RSET_FPR)); 565 asm_tointg(as, ir, ra_alloc1(as, lref, RSET_FPR));
566 } else { 566 } else {
567 Reg dest = ra_dest(as, ir, RSET_GPR);
568 Reg left = ra_alloc1(as, lref, RSET_FPR); 567 Reg left = ra_alloc1(as, lref, RSET_FPR);
569 Reg tmp = ra_scratch(as, rset_exclude(RSET_FPR, left)); 568 Reg tmp = ra_scratch(as, rset_exclude(RSET_FPR, left));
569 Reg dest = ra_dest(as, ir, RSET_GPR);
570 ARMIns ai; 570 ARMIns ai;
571 emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15)); 571 emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15));
572 ai = irt_isint(ir->t) ? 572 ai = irt_isint(ir->t) ?
@@ -1210,6 +1210,9 @@ static void asm_sload(ASMState *as, IRIns *ir)
1210 } else 1210 } else
1211#endif 1211#endif
1212 if (ra_used(ir)) { 1212 if (ra_used(ir)) {
1213 Reg tmp = RID_NONE;
1214 if ((ir->op2 & IRSLOAD_CONVERT))
1215 tmp = ra_scratch(as, t == IRT_INT ? RSET_FPR : RSET_GPR);
1213 lua_assert((LJ_SOFTFP ? 0 : irt_isnum(ir->t)) || 1216 lua_assert((LJ_SOFTFP ? 0 : irt_isnum(ir->t)) ||
1214 irt_isint(ir->t) || irt_isaddr(ir->t)); 1217 irt_isint(ir->t) || irt_isaddr(ir->t));
1215 dest = ra_dest(as, ir, (!LJ_SOFTFP && t == IRT_NUM) ? RSET_FPR : allow); 1218 dest = ra_dest(as, ir, (!LJ_SOFTFP && t == IRT_NUM) ? RSET_FPR : allow);
@@ -1217,18 +1220,15 @@ static void asm_sload(ASMState *as, IRIns *ir)
1217 base = ra_alloc1(as, REF_BASE, allow); 1220 base = ra_alloc1(as, REF_BASE, allow);
1218 if ((ir->op2 & IRSLOAD_CONVERT)) { 1221 if ((ir->op2 & IRSLOAD_CONVERT)) {
1219 if (t == IRT_INT) { 1222 if (t == IRT_INT) {
1220 Reg tmp = ra_scratch(as, RSET_FPR);
1221 emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15)); 1223 emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15));
1222 emit_dm(as, ARMI_VCVT_S32_F64, (tmp & 15), (tmp & 15)); 1224 emit_dm(as, ARMI_VCVT_S32_F64, (tmp & 15), (tmp & 15));
1223 dest = tmp;
1224 t = IRT_NUM; /* Check for original type. */ 1225 t = IRT_NUM; /* Check for original type. */
1225 } else { 1226 } else {
1226 Reg tmp = ra_scratch(as, RSET_GPR);
1227 emit_dm(as, ARMI_VCVT_F64_S32, (dest & 15), (dest & 15)); 1227 emit_dm(as, ARMI_VCVT_F64_S32, (dest & 15), (dest & 15));
1228 emit_dn(as, ARMI_VMOV_S_R, tmp, (dest & 15)); 1228 emit_dn(as, ARMI_VMOV_S_R, tmp, (dest & 15));
1229 dest = tmp;
1230 t = IRT_INT; /* Check for original type. */ 1229 t = IRT_INT; /* Check for original type. */
1231 } 1230 }
1231 dest = tmp;
1232 } 1232 }
1233 goto dotypecheck; 1233 goto dotypecheck;
1234 } 1234 }
@@ -1503,7 +1503,7 @@ static void asm_intmul(ASMState *as, IRIns *ir)
1503 if (dest == left && left != right) { left = right; right = dest; } 1503 if (dest == left && left != right) { left = right; right = dest; }
1504 if (irt_isguard(ir->t)) { /* IR_MULOV */ 1504 if (irt_isguard(ir->t)) { /* IR_MULOV */
1505 if (!(as->flags & JIT_F_ARMV6) && dest == left) 1505 if (!(as->flags & JIT_F_ARMV6) && dest == left)
1506 tmp = left = ra_scratch(as, rset_exclude(RSET_FPR, left)); 1506 tmp = left = ra_scratch(as, rset_exclude(RSET_GPR, left));
1507 asm_guardcc(as, CC_NE); 1507 asm_guardcc(as, CC_NE);
1508 emit_nm(as, ARMI_TEQ|ARMF_SH(ARMSH_ASR, 31), RID_TMP, dest); 1508 emit_nm(as, ARMI_TEQ|ARMF_SH(ARMSH_ASR, 31), RID_TMP, dest);
1509 emit_dnm(as, ARMI_SMULL|ARMF_S(right), dest, RID_TMP, left); 1509 emit_dnm(as, ARMI_SMULL|ARMF_S(right), dest, RID_TMP, left);