On Wed, Nov 12, 2008 at 3:35 PM, Joerg Wunsch <[EMAIL PROTECTED]> wrote: > Sparr <[EMAIL PROTECTED]> wrote: > >> Why does "foo++;" compile to "subi Rd,lo8(-(1))" instead of "inc >> Rd"? > > As I already wrote you on avrfreaks.net, the use of fixed registers is > such a minor issue that nobody bothered to special-case peephole > optimizations for it in AVR-GCC.
Fixed registers just make this problem much easier to spot. If you have a block of code with 20+ "normal" local variables being manipulated then this mis-implementation of the simple ++ (and, i presume, --) operator may cause non-optimal code generation due to a variable that could otherwise live in r<16 being moved to r>=16 just for the increment, displacing another variable that later has to be moved back there. I can produce a test case for this if you insist, but the implications should be obvious. _______________________________________________ AVR-GCC-list mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
