[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: |
Weddington, Eric |
Subject: |
Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access? |
Date: |
Thu, 11 Oct 2012 03:18:04 +0000 |
> -----Original Message-----
> From: Erik Walthinsen [mailto:address@hidden
> Sent: Wednesday, October 10, 2012 9:13 PM
> To: Weddington, Eric
> Cc: avr-gcc-list
> Subject: Re: [avr-gcc-list] >4.5.1 better than this at register-structure
> (xmega) access?
>
> On 10/10/2012 02:24 PM, Weddington, Eric wrote:
> > But as you said: Does it do that with recent versions? I'm afraid that no
> one yet knows.
>
> Nope: (stock binutils 2.22, gcc 4.72, avr-libc 1.80)
Well that's good to know! :-)
>
> void structwrite(uint8_t v) {
> TCC0.CTRLE = v;
> a58: e0 e0 ldi r30, 0x00 ; 0
> a5a: f8 e0 ldi r31, 0x08 ; 8
> a5c: 84 83 std Z+4, r24 ; 0x04
> a5e: 08 95 ret
> }
>
> void straightwrite(uint8_t v) {
> TCC0_CTRLE = v;
> a60: 80 93 04 08 sts 0x0804, r24
> a64: 08 95 ret
> }
>
> #define FS(s,m) (*(typeof(s.m) *)((void *)&s + offsetof(typeof(s),m)))
> void macrowrite(uint8_t v) {
> FS(TCC0,CTRLE) = v;
> a66: 80 93 04 08 sts 0x0804, r24
> a6a: 08 95 ret
> }
>
> (both -O2 and -O6 produce the same, compiled with -fno-inline)
AFAIK, there's no such thing as -O6. You've got -O0,-O1,-O2,-O3, and -Os.
- [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?, Georg-Johann Lay, 2012/10/11
- Re: [avr-gcc-list] >4.5.1 better than this at register-structure (xmega) access?, David Kelly, 2012/10/11
- 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