summaryrefslogtreecommitdiff
path: root/src/lj_asm_x86.h
diff options
context:
space:
mode:
authorMike Pall <mike>2014-10-08 22:04:51 +0200
committerMike Pall <mike>2014-10-08 22:04:51 +0200
commit6d0654d3eca7654c9c4f8a9923907d06b177a8a1 (patch)
tree163bfa76899ddf2e49382c9861b895c72220a684 /src/lj_asm_x86.h
parent4846a714a9b8e01bac8f9fc1de0eb2a5f00ea79b (diff)
downloadluajit2-6d0654d3eca7654c9c4f8a9923907d06b177a8a1.tar.gz
Fix fused constant loads under high register pressure.
Diffstat (limited to 'src/lj_asm_x86.h')
-rw-r--r--src/lj_asm_x86.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h
index 40f95636..04b79649 100644
--- a/src/lj_asm_x86.h
+++ b/src/lj_asm_x86.h
@@ -325,6 +325,14 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
as->mrm.base = as->mrm.idx = RID_NONE;
return RID_MRM;
}
+ } else if (ir->o == IR_KINT64) {
+ RegSet avail = as->freeset & ~as->modset & RSET_GPR;
+ lua_assert(allow != RSET_EMPTY);
+ if (!(avail & (avail-1))) { /* Fuse if less than two regs available. */
+ as->mrm.ofs = ptr2addr(ir_kint64(ir));
+ as->mrm.base = as->mrm.idx = RID_NONE;
+ return RID_MRM;
+ }
} else if (mayfuse(as, ref)) {
RegSet xallow = (allow & RSET_GPR) ? allow : RSET_GPR;
if (ir->o == IR_SLOAD) {
@@ -361,7 +369,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
return RID_MRM;
}
}
- if (!(as->freeset & allow) &&
+ if (!(as->freeset & allow) && !irref_isk(ref) &&
(allow == RSET_EMPTY || ra_hasspill(ir->s) || iscrossref(as, ref)))
goto fusespill;
return ra_allocref(as, ref, allow);