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: Tue, 11 Nov 2008 19:52:42 -0500

On Tue, Nov 11, 2008 at 7:00 PM, Weddington, Eric
<address@hidden> wrote:
> What is the type of foo?

register unsigned char foo asm("r5");

On Tue, Nov 11, 2008 at 7:03 PM, Gre7g Luterman <address@hidden> wrote:
> Does it really matter which instruction the compiler chooses? Both
> constructs consume the same amount of memory and execution time.
>
> I understand your concern that potentially more time and memory could be
> used if the compiler resisted the use of inc and the register was below R16,
> but unless you've seen evidence of it doing this... Is it an issue or just
> an idle curiousity?
> Gre7g

It is an issue.  See above for the declaration of foo.  If r5 was used
instead of copying to r21 it would save two instructions, which is not
as trivial as it sounds since I am doing it inside a timer interrupt
and my current goal is to shrink the code as much as possible.  I know
I will eventually have to do optimizations in asm, but for now I'd
like my C code to be compiled optimally.




reply via email to

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