> -----Original Message----- > From: Erik Walthinsen [mailto:om...@omegacs.net] > 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 mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list