Re: teaching gcc's optimiser new tricks
On Mon, 2002-08-05 at 02:49, Ian Jeffray wrote:
> > how does one teach the optimiser that this is equivalent and 33% faster:
> >
> > rsbs ip, r4, #1
> > movls ip, #0
>
>
> Hang on a minute, that's not the same algorithm though. For negative
> values of r4, you'll get bogus output... 1 - -2 is 3 wheras you need
> zero. Surely? (ie, !-2 is 0, not 3)
No, I think it's okay. In terms of twos complement, your example is
actually (1 - 0xfffffffe). That will give you three but with C clear,
and the LS conditional will match.
p.
Reply to: