mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
ARM64: Fix LDP/STP fusion (again).
Reported and analyzed by Zhongwei Yao. Fix by Peter Cawley. #1075
This commit is contained in:
parent
0705ef6ce4
commit
b8c6ccd50c
@ -113,6 +113,17 @@ static int emit_checkofs(A64Ins ai, int64_t ofs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LJ_AINLINE uint32_t emit_lso_pair_candidate(A64Ins ai, int ofs, int sc)
|
||||||
|
{
|
||||||
|
if (ofs >= 0) {
|
||||||
|
return ai | A64F_U12(ofs>>sc); /* Subsequent lj_ror checks ofs. */
|
||||||
|
} else if (ofs >= -256) {
|
||||||
|
return (ai^A64I_LS_U) | A64F_S9(ofs & 0x1ff);
|
||||||
|
} else {
|
||||||
|
return A64F_D(31); /* Will mismatch prev. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void emit_lso(ASMState *as, A64Ins ai, Reg rd, Reg rn, int64_t ofs)
|
static void emit_lso(ASMState *as, A64Ins ai, Reg rd, Reg rn, int64_t ofs)
|
||||||
{
|
{
|
||||||
int ot = emit_checkofs(ai, ofs), sc = (ai >> 30) & 3;
|
int ot = emit_checkofs(ai, ofs), sc = (ai >> 30) & 3;
|
||||||
@ -124,11 +135,9 @@ static void emit_lso(ASMState *as, A64Ins ai, Reg rd, Reg rn, int64_t ofs)
|
|||||||
uint32_t prev = *as->mcp & ~A64F_D(31);
|
uint32_t prev = *as->mcp & ~A64F_D(31);
|
||||||
int ofsm = ofs - (1<<sc), ofsp = ofs + (1<<sc);
|
int ofsm = ofs - (1<<sc), ofsp = ofs + (1<<sc);
|
||||||
A64Ins aip;
|
A64Ins aip;
|
||||||
if (prev == (ai | A64F_N(rn) | A64F_U12(ofsm>>sc)) ||
|
if (prev == emit_lso_pair_candidate(ai | A64F_N(rn), ofsm, sc)) {
|
||||||
prev == ((ai^A64I_LS_U) | A64F_N(rn) | A64F_S9(ofsm&0x1ff))) {
|
|
||||||
aip = (A64F_A(rd) | A64F_D(*as->mcp & 31));
|
aip = (A64F_A(rd) | A64F_D(*as->mcp & 31));
|
||||||
} else if (prev == (ai | A64F_N(rn) | A64F_U12(ofsp>>sc)) ||
|
} else if (prev == emit_lso_pair_candidate(ai | A64F_N(rn), ofsp, sc)) {
|
||||||
prev == ((ai^A64I_LS_U) | A64F_N(rn) | A64F_S9(ofsp&0x1ff))) {
|
|
||||||
aip = (A64F_D(rd) | A64F_A(*as->mcp & 31));
|
aip = (A64F_D(rd) | A64F_A(*as->mcp & 31));
|
||||||
ofsm = ofs;
|
ofsm = ofs;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user