mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
x86: Fix stack slot reservation for FP math functions.
Followup fix for commit ad03eba7
.
This commit is contained in:
parent
9679a949ff
commit
82e6e5fb5f
46
src/lj_asm.c
46
src/lj_asm.c
@ -2088,21 +2088,26 @@ static void asm_setup_regsp(ASMState *as)
|
|||||||
if (inloop)
|
if (inloop)
|
||||||
as->modset = RSET_SCRATCH;
|
as->modset = RSET_SCRATCH;
|
||||||
break;
|
break;
|
||||||
#if !LJ_TARGET_X86ORX64 && !LJ_SOFTFP
|
#if !LJ_SOFTFP
|
||||||
case IR_ATAN2: case IR_LDEXP:
|
case IR_ATAN2:
|
||||||
|
#if LJ_TARGET_X86
|
||||||
|
if (as->evenspill < 4) /* Leave room to call atan2(). */
|
||||||
|
as->evenspill = 4;
|
||||||
|
#endif
|
||||||
|
#if !LJ_TARGET_X86ORX64
|
||||||
|
case IR_LDEXP:
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
case IR_POW:
|
case IR_POW:
|
||||||
if (!LJ_SOFTFP && irt_isnum(ir->t)) {
|
if (!LJ_SOFTFP && irt_isnum(ir->t)) {
|
||||||
#if LJ_TARGET_X86ORX64
|
|
||||||
ir->prev = REGSP_HINT(RID_XMM0);
|
|
||||||
if (inloop)
|
|
||||||
as->modset |= RSET_RANGE(RID_XMM0, RID_XMM1+1)|RID2RSET(RID_EAX);
|
|
||||||
#else
|
|
||||||
ir->prev = REGSP_HINT(RID_FPRET);
|
|
||||||
if (inloop)
|
if (inloop)
|
||||||
as->modset |= RSET_SCRATCH;
|
as->modset |= RSET_SCRATCH;
|
||||||
#endif
|
#if LJ_TARGET_X86
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
ir->prev = REGSP_HINT(RID_FPRET);
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
/* fallthrough for integer POW */
|
/* fallthrough for integer POW */
|
||||||
case IR_DIV: case IR_MOD:
|
case IR_DIV: case IR_MOD:
|
||||||
@ -2115,26 +2120,25 @@ static void asm_setup_regsp(ASMState *as)
|
|||||||
break;
|
break;
|
||||||
case IR_FPMATH:
|
case IR_FPMATH:
|
||||||
#if LJ_TARGET_X86ORX64
|
#if LJ_TARGET_X86ORX64
|
||||||
if (ir->op2 == IRFPM_EXP2) { /* May be joined to pow. */
|
if (ir->op2 <= IRFPM_TRUNC) {
|
||||||
ir->prev = REGSP_HINT(RID_XMM0);
|
if (!(as->flags & JIT_F_SSE4_1)) {
|
||||||
#if !LJ_64
|
|
||||||
if (as->evenspill < 4) /* Leave room for 16 byte scratch area. */
|
|
||||||
as->evenspill = 4;
|
|
||||||
#endif
|
|
||||||
if (inloop)
|
|
||||||
as->modset |= RSET_RANGE(RID_XMM0, RID_XMM2+1)|RID2RSET(RID_EAX);
|
|
||||||
continue;
|
|
||||||
} else if (ir->op2 <= IRFPM_TRUNC && !(as->flags & JIT_F_SSE4_1)) {
|
|
||||||
ir->prev = REGSP_HINT(RID_XMM0);
|
ir->prev = REGSP_HINT(RID_XMM0);
|
||||||
if (inloop)
|
if (inloop)
|
||||||
as->modset |= RSET_RANGE(RID_XMM0, RID_XMM3+1)|RID2RSET(RID_EAX);
|
as->modset |= RSET_RANGE(RID_XMM0, RID_XMM3+1)|RID2RSET(RID_EAX);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#else
|
} else if (ir->op2 == IRFPM_EXP2 && !LJ_64) {
|
||||||
ir->prev = REGSP_HINT(RID_FPRET);
|
if (as->evenspill < 4) /* Leave room to call pow(). */
|
||||||
|
as->evenspill = 4;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (inloop)
|
if (inloop)
|
||||||
as->modset |= RSET_SCRATCH;
|
as->modset |= RSET_SCRATCH;
|
||||||
|
#if LJ_TARGET_X86
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
ir->prev = REGSP_HINT(RID_FPRET);
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
#if LJ_TARGET_X86ORX64
|
#if LJ_TARGET_X86ORX64
|
||||||
|
Loading…
Reference in New Issue
Block a user