Nicholas Clark wrote:
Currently if you ask gcc -O2 (tried on 3.0) to evaluate !a it will give you code of the form: cmp r4, #0 movne ip, #0 moveq ip, #1 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) Ian.