avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] Missed Optimisation ?


From: bob
Subject: Re: [avr-chat] Missed Optimisation ?
Date: Tue, 01 Mar 2011 15:46:17 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4

On 01/03/11 15:33, Colin O'Flynn wrote:
> Hi Bob,
> 
> One consideration is that reading or writing might have side-effects on a
> memory-mapped peripheral.
> 
> So if you were accessing a peripheral with a pointer to a volatile uint32_t,
> and issue the |= command, you might actually be expecting the CPU to perform
> the memory read & write. The simple act of reading the memory could clear a
> flag for example.
> 
> My personal thought process with the volatile keyword is I assume the
> compiler does *all* memory accesses, even the unnecessary ones.
> 
> Regards,
> 
>   -Colin
Hi Colin,
by this logic the missing 'OR' instructions could also affect external
hardware as they are read-modify-write, but these are optimised away.

Cheers,

Bob



reply via email to

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