[pypy-dev] [pypy-svn] pypy fold_intadd: Changed test to reflect my optimizeopt's decision to emit int_sub(iX, -x) when x < 0

Armin Rigo arigo at tunes.org
Sun Mar 20 14:14:46 CET 2011


Hi Anto, hi Ademan,

On Sat, Mar 19, 2011 at 10:07 AM, Antonio Cuni <anto.cuni at gmail.com> wrote:
> what happens when you are on 32 bit and see int_add(i0, -2147483648)?

It probably works, because -(-2147483648) == -2147483648, and
int_add(i0, -2147483648) and int_sub(i0, -2147483648) do the same
thing.  However I have no clue why this replacement is giving you
anything.  If anything at all I would say that replacing int_add(i0,
-128) with int_sub(i0, 128) is a (very marginally) bad idea on x86
because the constant -128 fits in 8 bits but the constant 128 doesn't.
 Well, I suppose that "it makes it easier for me, the human, to
understand it" is a valid reason after all.


A bientôt,

Armin.



More information about the Pypy-dev mailing list