On Mar 16, 2011, at 10:12 AM, Richard Henderson wrote: > On 03/16/2011 04:48 AM, Nick Clifton wrote: >> (peephole): Add peephole to combine zero- and sign- extending >> loads with arithmetic instructions. > > Do you really need peepholes for this? I would have thought that > merely adding the instruction patterns for this would have been > enough to encourage combine to do its job merging these patterns...
I've caught 4.5.x not handling really, really simple things like: unsigned char ub; unsigned short us; unsigned int ui; unsigned long ul; signed char sb; signed short ss; signed int si; signed long sl; main() { us = ub; ui = us; } because there were two zero_extends, instead of just one, my patterns only covered 1. I've love a more comprehensive solution, where I can explain my loads can do either sign or zero extend, and simply not have to worry about all the knock on patterns. Another nit, I had a QI->DI extending load pattern, but when asked to do a QI-SI load, it didn't want to widen to a QI->DI load and then just subreg the SI part. :-( The scary thing, it isn't like zero extension is a brand new instruction that had been invented last week.