ARM: Simplify two-step constant rematerialization.

This commit is contained in:
Mike Pall 2012-07-02 22:57:51 +02:00
parent afeb4e2c51
commit 79e1eaa73b

View File

@ -141,7 +141,9 @@ 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;
if (other) {
int32_t delta = i - other;
uint32_t sh, inv = 0, k2, k; uint32_t sh, inv = 0, k2, k;
if (delta < 0) { delta = -delta; inv = ARMI_ADD^ARMI_SUB; } if (delta < 0) { delta = -delta; inv = ARMI_ADD^ARMI_SUB; }
sh = lj_ffs(delta) & ~1; sh = lj_ffs(delta) & ~1;
@ -153,6 +155,7 @@ static int emit_kdelta2(ASMState *as, Reg d, int32_t i)
return 1; return 1;
} }
} }
}
rset_clear(work, r); rset_clear(work, r);
} }
return 0; /* Failed. */ return 0; /* Failed. */