[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega)
From: |
David Kelly |
Subject: |
Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access? |
Date: |
Thu, 11 Oct 2012 14:13:08 -0500 |
On Oct 11, 2012, at 2:04 AM, Georg-Johann Lay wrote:
> But to make sure we know what we are talking about, here is a test case.
>
> typedef struct
> {
> unsigned char volatile CTRLA;
> unsigned char volatile CTRLB;
> unsigned char volatile CTRLC;
> unsigned char volatile CTRLD;
> } TC0_t;
>
> void tc0_writeC (void)
> {
> (*(TC0_t*) 0x0800).CTRL = 0;
> }
>
> Remember that GCC developers don't know what "TCC0" or "CTRLE" is.
> They don't even know what "AVR" stands for.
Why should they have to know anything about AVR to optimize struct references?
Am suspicious gcc is treating TCC0 as volatile, the address of the struct as
volatile, while the desire is for the contents to be volatile. Appears to be
defined as a pointer to a struct of volatiles, but perhaps the volatile
property is leaking?
Dereferencing TCC0.CTRLE by taking its address and casting it as a pointer may
strip volatile allowing gcc to optimize. It should be able to optimize anyway.
--
David Kelly N4HHE, address@hidden
============================================================
Whom computers would destroy, they must first drive mad.
- [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Erik Walthinsen, 2012/10/10
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Georg-Johann Lay, 2012/10/10
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Erik Walthinsen, 2012/10/10
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Weddington, Eric, 2012/10/10
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Erik Walthinsen, 2012/10/10
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Erik Walthinsen, 2012/10/10
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Weddington, Eric, 2012/10/10
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Georg-Johann Lay, 2012/10/11
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?,
David Kelly <=
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Erik Walthinsen, 2012/10/11
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Weddington, Eric, 2012/10/11
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, David Brown, 2012/10/11
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, Georg-Johann Lay, 2012/10/12