[PATCH: PR target/44999] Replace "and r0, r0, #255" with uxtb in thumb2

Paul Brook paul@codesourcery.com
Tue Nov 9 11:19:00 GMT 2010


> 2. Why do we need it for Thumb mode, and not for ARM mode?
> 
> In thumb mode, instruction and with constant is 32 bit, uxtb is 16
> bit, with this enhancement we can save 2 bytes.
> In ARM mode, all instructions are 32 bit, convert and to uxtb doesn't
> help us, so we don't care which instruction is used.
> So we need it for Thumb mode only.

No. Look at the output.
In ARM mode we generate uxtb without your patch.
In thumb mode gcc 4.5 generated uxtb, so this is a recent regression. What 
caused this regression?

The fact that this used to work (without andsi expander hacks), and still 
works in ARM mode, suggests there's something you're missing. Given there's 
clearly code somewhere capable of dong this transformation, it seems 
surprising that it's not already undoing you expander hack, and may do so in 
the future.

Paul



More information about the Gcc-patches mailing list