> I'd say it's not as simple as you make it out to be. You can't blindly > combine operations on volatile memory.
I'm not blindly combining them, I'm combining them when I know the hardware will do the volatile-correct thing. > ie, the programmer may have written them as separate statements and > if they're volatile you should leave them alone. Most of the programmers I know would expect "port |= 0x80;" to do a hardware-specific "set bits" operation, not a series of volatile-pedantic operations, especially when the ISA has a set of insns specifically designed to do bit operations on volatile I/O registers. > With this change a series of statements involving > volatiles might be combined into a single insn. That's not good. If the insn does exactly the same thing as the operations, just faster, why is it not good? > I'll note that *NO* ports in the official GCC sources do this and that's > because it's wrong. m32c, rl78, and sh do this (to varying degrees) in the official sources.