avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] Missed Optimisation ?


From: jan
Subject: Re: [avr-chat] Missed Optimisation ?
Date: Tue, 1 Mar 2011 14:02:57 +0100

On Tue, 01 Mar 2011 06:56:53 -0500
"Graham Davies" <address@hidden> wrote:

> bob wrote:
> 
> 
> > ... The code is very simple (runs in Port Change interrupt):
> >
> >    if ((PINA & _BV(A2DDATA)) != 0)
> > result |= 0x80000000;
> >
> >    result >>= 1;
> 
> How is result declared?  Are you using the volatile qualifier?  If
> so, that would explain why the compiler feels obliged to load and
> store the entire 32 bits.
> 
> Graham.

I'm no expert but since the data is in RAM I can't see why the compiler
think it need to load and store the three lower bytes. If the variable
was in external registers on a bus, yes, since there could be some
effect on hardware connected to the strobes.

But again, I'm no expert.
/Janne

> 
> 
> 
> _______________________________________________
> AVR-chat mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-chat



reply via email to

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