Re: [PATCH,AArch64] Optimise comparison where intermediate result not used

2012-11-12 Thread Marcus Shawcroft
On 06/11/12 18:49, Ian Bolton wrote: OK for trunk? Cheers, Ian 2012-11-06 Ian Bolton * gcc/config/aarch64/aarch64.md (*compare_neg): New pattern. * gcc/testsuite/gcc.target/aarch64/cmn.c: New test. * gcc/testsuite/gcc.target/aarch64/adds.c: New test. * gcc/tes

[PATCH,AArch64] Optimise comparison where intermediate result not used

2012-11-06 Thread Ian Bolton
Hi all, When we perform an addition but only use the result for a comparison, we can save an instruction. Consider this function: int foo (int a, int b) { return ((a + b) == 0) ? 1 : 7; } Here is the original output: foo: add w0, w0, w1 cmp w0, wzr mov w1, 7