aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2014-12-16 22:22:51 +0100
committerMike Pall <mike>2014-12-16 22:25:52 +0100
commit82e6e5fb5f17e497b3341322998ede75ec29e554 (patch)
treea17ff2d568561af328dde2b1cf20deb40d6badb4
parent9679a949ffa2e295f1a1f4d277f39ab864adaac4 (diff)
downloadluajit-82e6e5fb5f17e497b3341322998ede75ec29e554.tar.gz
luajit-82e6e5fb5f17e497b3341322998ede75ec29e554.tar.bz2
luajit-82e6e5fb5f17e497b3341322998ede75ec29e554.zip
x86: Fix stack slot reservation for FP math functions.
Followup fix for commit ad03eba7.
-rw-r--r--src/lj_asm.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index aaab3255..e740e8a8 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -2088,21 +2088,26 @@ static void asm_setup_regsp(ASMState *as)
2088 if (inloop) 2088 if (inloop)
2089 as->modset = RSET_SCRATCH; 2089 as->modset = RSET_SCRATCH;
2090 break; 2090 break;
2091#if !LJ_TARGET_X86ORX64 && !LJ_SOFTFP 2091#if !LJ_SOFTFP
2092 case IR_ATAN2: case IR_LDEXP: 2092 case IR_ATAN2:
2093#if LJ_TARGET_X86
2094 if (as->evenspill < 4) /* Leave room to call atan2(). */
2095 as->evenspill = 4;
2096#endif
2097#if !LJ_TARGET_X86ORX64
2098 case IR_LDEXP:
2099#endif
2093#endif 2100#endif
2094 case IR_POW: 2101 case IR_POW:
2095 if (!LJ_SOFTFP && irt_isnum(ir->t)) { 2102 if (!LJ_SOFTFP && irt_isnum(ir->t)) {
2096#if LJ_TARGET_X86ORX64
2097 ir->prev = REGSP_HINT(RID_XMM0);
2098 if (inloop) 2103 if (inloop)
2099 as->modset |= RSET_RANGE(RID_XMM0, RID_XMM1+1)|RID2RSET(RID_EAX); 2104 as->modset |= RSET_SCRATCH;
2105#if LJ_TARGET_X86
2106 break;
2100#else 2107#else
2101 ir->prev = REGSP_HINT(RID_FPRET); 2108 ir->prev = REGSP_HINT(RID_FPRET);
2102 if (inloop)
2103 as->modset |= RSET_SCRATCH;
2104#endif
2105 continue; 2109 continue;
2110#endif
2106 } 2111 }
2107 /* fallthrough for integer POW */ 2112 /* fallthrough for integer POW */
2108 case IR_DIV: case IR_MOD: 2113 case IR_DIV: case IR_MOD:
@@ -2115,26 +2120,25 @@ static void asm_setup_regsp(ASMState *as)
2115 break; 2120 break;
2116 case IR_FPMATH: 2121 case IR_FPMATH:
2117#if LJ_TARGET_X86ORX64 2122#if LJ_TARGET_X86ORX64
2118 if (ir->op2 == IRFPM_EXP2) { /* May be joined to pow. */ 2123 if (ir->op2 <= IRFPM_TRUNC) {
2119 ir->prev = REGSP_HINT(RID_XMM0); 2124 if (!(as->flags & JIT_F_SSE4_1)) {
2120#if !LJ_64 2125 ir->prev = REGSP_HINT(RID_XMM0);
2121 if (as->evenspill < 4) /* Leave room for 16 byte scratch area. */ 2126 if (inloop)
2127 as->modset |= RSET_RANGE(RID_XMM0, RID_XMM3+1)|RID2RSET(RID_EAX);
2128 continue;
2129 }
2130 break;
2131 } else if (ir->op2 == IRFPM_EXP2 && !LJ_64) {
2132 if (as->evenspill < 4) /* Leave room to call pow(). */
2122 as->evenspill = 4; 2133 as->evenspill = 4;
2123#endif
2124 if (inloop)
2125 as->modset |= RSET_RANGE(RID_XMM0, RID_XMM2+1)|RID2RSET(RID_EAX);
2126 continue;
2127 } else if (ir->op2 <= IRFPM_TRUNC && !(as->flags & JIT_F_SSE4_1)) {
2128 ir->prev = REGSP_HINT(RID_XMM0);
2129 if (inloop)
2130 as->modset |= RSET_RANGE(RID_XMM0, RID_XMM3+1)|RID2RSET(RID_EAX);
2131 continue;
2132 } 2134 }
2135#endif
2136 if (inloop)
2137 as->modset |= RSET_SCRATCH;
2138#if LJ_TARGET_X86
2133 break; 2139 break;
2134#else 2140#else
2135 ir->prev = REGSP_HINT(RID_FPRET); 2141 ir->prev = REGSP_HINT(RID_FPRET);
2136 if (inloop)
2137 as->modset |= RSET_SCRATCH;
2138 continue; 2142 continue;
2139#endif 2143#endif
2140#if LJ_TARGET_X86ORX64 2144#if LJ_TARGET_X86ORX64