aboutsummaryrefslogtreecommitdiff
path: root/src/lj_asm.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_asm.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index 1ecbe45e..d377eb4d 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -818,11 +818,11 @@ static void ra_leftov(ASMState *as, Reg dest, IRRef lref)
818} 818}
819#endif 819#endif
820 820
821#if !LJ_64
822/* Force a RID_RETLO/RID_RETHI destination register pair (marked as free). */ 821/* Force a RID_RETLO/RID_RETHI destination register pair (marked as free). */
823static void ra_destpair(ASMState *as, IRIns *ir) 822static void ra_destpair(ASMState *as, IRIns *ir)
824{ 823{
825 Reg destlo = ir->r, desthi = (ir+1)->r; 824 Reg destlo = ir->r, desthi = (ir+1)->r;
825 IRIns *irx = (LJ_64 && !irt_is64(ir->t)) ? ir+1 : ir;
826 /* First spill unrelated refs blocking the destination registers. */ 826 /* First spill unrelated refs blocking the destination registers. */
827 if (!rset_test(as->freeset, RID_RETLO) && 827 if (!rset_test(as->freeset, RID_RETLO) &&
828 destlo != RID_RETLO && desthi != RID_RETLO) 828 destlo != RID_RETLO && desthi != RID_RETLO)
@@ -846,29 +846,28 @@ static void ra_destpair(ASMState *as, IRIns *ir)
846 /* Check for conflicts and shuffle the registers as needed. */ 846 /* Check for conflicts and shuffle the registers as needed. */
847 if (destlo == RID_RETHI) { 847 if (destlo == RID_RETHI) {
848 if (desthi == RID_RETLO) { 848 if (desthi == RID_RETLO) {
849#if LJ_TARGET_X86 849#if LJ_TARGET_X86ORX64
850 *--as->mcp = XI_XCHGa + RID_RETHI; 850 *--as->mcp = REX_64IR(irx, XI_XCHGa + RID_RETHI);
851#else 851#else
852 emit_movrr(as, ir, RID_RETHI, RID_TMP); 852 emit_movrr(as, irx, RID_RETHI, RID_TMP);
853 emit_movrr(as, ir, RID_RETLO, RID_RETHI); 853 emit_movrr(as, irx, RID_RETLO, RID_RETHI);
854 emit_movrr(as, ir, RID_TMP, RID_RETLO); 854 emit_movrr(as, irx, RID_TMP, RID_RETLO);
855#endif 855#endif
856 } else { 856 } else {
857 emit_movrr(as, ir, RID_RETHI, RID_RETLO); 857 emit_movrr(as, irx, RID_RETHI, RID_RETLO);
858 if (desthi != RID_RETHI) emit_movrr(as, ir, desthi, RID_RETHI); 858 if (desthi != RID_RETHI) emit_movrr(as, irx, desthi, RID_RETHI);
859 } 859 }
860 } else if (desthi == RID_RETLO) { 860 } else if (desthi == RID_RETLO) {
861 emit_movrr(as, ir, RID_RETLO, RID_RETHI); 861 emit_movrr(as, irx, RID_RETLO, RID_RETHI);
862 if (destlo != RID_RETLO) emit_movrr(as, ir, destlo, RID_RETLO); 862 if (destlo != RID_RETLO) emit_movrr(as, irx, destlo, RID_RETLO);
863 } else { 863 } else {
864 if (desthi != RID_RETHI) emit_movrr(as, ir, desthi, RID_RETHI); 864 if (desthi != RID_RETHI) emit_movrr(as, irx, desthi, RID_RETHI);
865 if (destlo != RID_RETLO) emit_movrr(as, ir, destlo, RID_RETLO); 865 if (destlo != RID_RETLO) emit_movrr(as, irx, destlo, RID_RETLO);
866 } 866 }
867 /* Restore spill slots (if any). */ 867 /* Restore spill slots (if any). */
868 if (ra_hasspill((ir+1)->s)) ra_save(as, ir+1, RID_RETHI); 868 if (ra_hasspill((ir+1)->s)) ra_save(as, ir+1, RID_RETHI);
869 if (ra_hasspill(ir->s)) ra_save(as, ir, RID_RETLO); 869 if (ra_hasspill(ir->s)) ra_save(as, ir, RID_RETLO);
870} 870}
871#endif
872 871
873/* -- Snapshot handling --------- ----------------------------------------- */ 872/* -- Snapshot handling --------- ----------------------------------------- */
874 873
@@ -2234,7 +2233,6 @@ static void asm_setup_regsp(ASMState *as)
2234 (RSET_SCRATCH & ~RSET_FPR) : RSET_SCRATCH; 2233 (RSET_SCRATCH & ~RSET_FPR) : RSET_SCRATCH;
2235 continue; 2234 continue;
2236 } 2235 }
2237#if LJ_SOFTFP || (LJ_32 && LJ_HASFFI)
2238 case IR_HIOP: 2236 case IR_HIOP:
2239 switch ((ir-1)->o) { 2237 switch ((ir-1)->o) {
2240#if LJ_SOFTFP && LJ_TARGET_ARM 2238#if LJ_SOFTFP && LJ_TARGET_ARM
@@ -2245,7 +2243,7 @@ static void asm_setup_regsp(ASMState *as)
2245 } 2243 }
2246 break; 2244 break;
2247#endif 2245#endif
2248#if !LJ_SOFTFP && LJ_NEED_FP64 2246#if !LJ_SOFTFP && LJ_NEED_FP64 && LJ_32 && LJ_HASFFI
2249 case IR_CONV: 2247 case IR_CONV:
2250 if (irt_isfp((ir-1)->t)) { 2248 if (irt_isfp((ir-1)->t)) {
2251 ir->prev = REGSP_HINT(RID_FPRET); 2249 ir->prev = REGSP_HINT(RID_FPRET);
@@ -2253,7 +2251,7 @@ static void asm_setup_regsp(ASMState *as)
2253 } 2251 }
2254#endif 2252#endif
2255 /* fallthrough */ 2253 /* fallthrough */
2256 case IR_CALLN: case IR_CALLXS: 2254 case IR_CALLN: case IR_CALLL: case IR_CALLS: case IR_CALLXS:
2257#if LJ_SOFTFP 2255#if LJ_SOFTFP
2258 case IR_MIN: case IR_MAX: 2256 case IR_MIN: case IR_MAX:
2259#endif 2257#endif
@@ -2264,7 +2262,6 @@ static void asm_setup_regsp(ASMState *as)
2264 break; 2262 break;
2265 } 2263 }
2266 break; 2264 break;
2267#endif
2268#if LJ_SOFTFP 2265#if LJ_SOFTFP
2269 case IR_MIN: case IR_MAX: 2266 case IR_MIN: case IR_MAX:
2270 if ((ir+1)->o != IR_HIOP) break; 2267 if ((ir+1)->o != IR_HIOP) break;