mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
ARM: Simplify two-step constant rematerialization.
This commit is contained in:
parent
afeb4e2c51
commit
79e1eaa73b
@ -141,16 +141,19 @@ static int emit_kdelta2(ASMState *as, Reg d, int32_t i)
|
|||||||
IRRef ref = regcost_ref(as->cost[r]);
|
IRRef ref = regcost_ref(as->cost[r]);
|
||||||
lua_assert(r != d);
|
lua_assert(r != d);
|
||||||
if (emit_canremat(ref)) {
|
if (emit_canremat(ref)) {
|
||||||
int32_t delta = i - (ra_iskref(ref) ? ra_krefk(as, ref) : IR(ref)->i);
|
int32_t other = ra_iskref(ref) ? ra_krefk(as, ref) : IR(ref)->i;
|
||||||
uint32_t sh, inv = 0, k2, k;
|
if (other) {
|
||||||
if (delta < 0) { delta = -delta; inv = ARMI_ADD^ARMI_SUB; }
|
int32_t delta = i - other;
|
||||||
sh = lj_ffs(delta) & ~1;
|
uint32_t sh, inv = 0, k2, k;
|
||||||
k2 = emit_isk12(0, delta & (255 << sh));
|
if (delta < 0) { delta = -delta; inv = ARMI_ADD^ARMI_SUB; }
|
||||||
k = emit_isk12(0, delta & ~(255 << sh));
|
sh = lj_ffs(delta) & ~1;
|
||||||
if (k) {
|
k2 = emit_isk12(0, delta & (255 << sh));
|
||||||
emit_dn(as, ARMI_ADD^k2^inv, d, d);
|
k = emit_isk12(0, delta & ~(255 << sh));
|
||||||
emit_dn(as, ARMI_ADD^k^inv, d, r);
|
if (k) {
|
||||||
return 1;
|
emit_dn(as, ARMI_ADD^k2^inv, d, d);
|
||||||
|
emit_dn(as, ARMI_ADD^k^inv, d, r);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rset_clear(work, r);
|
rset_clear(work, r);
|
||||||
|
Loading…
Reference in New Issue
Block a user