aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2012-11-06 16:57:50 +0100
committerMike Pall <mike>2012-11-06 16:57:50 +0100
commitae1987d5357c45a5dac0c8edc29609ca64ce76be (patch)
treefaa96c350ab429424e41fd3c05e15ab7919f36ff /src
parent69906d15de494cd02acaa3c4f3cac71217ae2439 (diff)
downloadluajit-ae1987d5357c45a5dac0c8edc29609ca64ce76be.tar.gz
luajit-ae1987d5357c45a5dac0c8edc29609ca64ce76be.tar.bz2
luajit-ae1987d5357c45a5dac0c8edc29609ca64ce76be.zip
Fix CONV.num.int sinking.
Diffstat (limited to 'src')
-rw-r--r--src/lj_asm.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index 4a1af480..5f6becad 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -826,10 +826,19 @@ static void asm_snap_alloc1(ASMState *as, IRRef ref)
826 asm_snap_alloc1(as, (irs+1)->op2); 826 asm_snap_alloc1(as, (irs+1)->op2);
827 } 827 }
828 } 828 }
829 } else if (ir->o == IR_CONV && ir->op2 == IRCONV_NUM_INT) {
830 asm_snap_alloc1(as, ir->op1);
831 } else { 829 } else {
832 RegSet allow = (!LJ_SOFTFP && irt_isfp(ir->t)) ? RSET_FPR : RSET_GPR; 830 RegSet allow;
831 if (ir->o == IR_CONV && ir->op2 == IRCONV_NUM_INT) {
832 IRIns *irc;
833 for (irc = IR(as->curins); irc > ir; irc--)
834 if ((irc->op1 == ref || irc->op2 == ref) &&
835 !(irc->r == RID_SINK || irc->r == RID_SUNK))
836 goto nosink; /* Don't sink conversion if result is used. */
837 asm_snap_alloc1(as, ir->op1);
838 return;
839 }
840 nosink:
841 allow = (!LJ_SOFTFP && irt_isfp(ir->t)) ? RSET_FPR : RSET_GPR;
833 if ((as->freeset & allow) || 842 if ((as->freeset & allow) ||
834 (allow == RSET_FPR && asm_snap_canremat(as))) { 843 (allow == RSET_FPR && asm_snap_canremat(as))) {
835 /* Get a weak register if we have a free one or can rematerialize. */ 844 /* Get a weak register if we have a free one or can rematerialize. */