This function: int f(int x) { return x ^ 0x1234; } currently compiles (with -mtune=xscale) to: mov r3, #4608 add r3, r3, #52 eor r0, r0, r3 @ lr needed for prologue mov pc, lr or (with -mtune=arm9) to: ldr r3, .L3 @ lr needed for prologue eor r0, r0, r3 mov pc, lr .L4: .align 2 .L3: .word 4660 But, in both cases, it could be better done as: eor r0, r0, #4608 eor r0, r0, #52 mov pc, lr
Confirmed. arm_split_constant() already knows how to handle XOR, so it should be just a matter of copying the model used for andsi3 into the xorsi3 expander.
Fixed with: http://gcc.gnu.org/ml/gcc-patches/2009-10/msg01723.html