avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] foo++, subi vs inc?


From: Sparr
Subject: Re: [avr-gcc-list] foo++, subi vs inc?
Date: Wed, 12 Nov 2008 15:57:13 -0500

On Wed, Nov 12, 2008 at 3:35 PM, Joerg Wunsch <address@hidden> wrote:
> Sparr <address@hidden> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]