[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a
From: |
Paul Schlie |
Subject: |
Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks. |
Date: |
Sat, 20 Nov 2004 11:50:04 -0500 |
User-agent: |
Microsoft-Entourage/11.1.0.040913 |
Yes but:
volatile f;
f = f * f;
Produces:
ldd r14, Y+18 ; 0x12
ldd r15, Y+19 ; 0x13
ldd r16, Y+20 ; 0x14
ldd r17, Y+21 ; 0x15
ldd r24, Y+18 ; 0x12
ldd r25, Y+19 ; 0x13
ldd r26, Y+20 ; 0x14
ldd r27, Y+21 ; 0x15
movw r18, r24
movw r20, r26
movw r24, r16
movw r22, r14
call 0x5a4
movw r26, r24
movw r24, r22
std Y+18, r24 ; 0x12
std Y+19, r25 ; 0x13
std Y+20, r26 ; 0x14
std Y+21, r27 ; 0x15
But would have expected:
ldd r22, Y+18 ; 0x12
ldd r23, Y+19 ; 0x13
ldd r24, Y+20 ; 0x14
ldd r25, Y+21 ; 0x15
ldd r18, Y+18 ; 0x12
ldd r19, Y+19 ; 0x13
ldd r20, Y+20 ; 0x14
ldd r21, Y+21 ; 0x15
call 0x5a4
std Y+18, r22 ; 0x12
std Y+19, r23 ; 0x13
std Y+20, r24 ; 0x14
std Y+21, r25 ; 0x15
Anyone know why this is not being produced? (or simply an optimization bug?)
> From: "Dmitry K." <address@hidden>
>
> Paul Schlie wrote:
>
>> - any insight as to why the compiler (3.4.3 for the sake of argument) first
>> load variable into one set of registers to just then passes them to the
>> function's parameter registers, as opposed to loading them there
>> initially, which seems like a waste of cycles? happens for example with:
>>
>> volatile float f;
>> f = f * f; // or most any other multi-byte libgcc defined function.
>
> `volatile' is the reason of double reading.
>
> avr-gcc 3.3.4 with `-mmcu=avr4 -Os -fnew-ra': beautiful code.
>
> See:
>
> float x;
> float foo (void)
> {
> return x * x;
> }
>
> produce:
> lds r22,x
> lds r23,(x)+1
> lds r24,(x)+2
> lds r25,(x)+3
> movw r18,r22
> movw r20,r24
> rcall __mulsf3
>
> P.S. I do not say about the pair <rcall, ret>. In many cases gcc (x86 port,
> for example) reduce such sequences.
>
- Re: [avr-libc-dev] Strange asm output, (continued)
- Re: [avr-libc-dev] Strange asm output, Paul Schlie, 2004/11/10
- Re: [avr-libc-dev] Strange asm output, Paul Schlie, 2004/11/11
- Re: [avr-libc-dev] Strange asm output, Nicolas Schodet, 2004/11/11
- Re: [avr-libc-dev] Strange asm output, Paul Schlie, 2004/11/11
- [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks., Paul Schlie, 2004/11/19
- Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks., Theodore A. Roth, 2004/11/19
- Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks., Paul Schlie, 2004/11/20
- Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks., Bob Paddock, 2004/11/19
- Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks., Paul Schlie, 2004/11/20
- Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks., Dmitry K., 2004/11/19
- Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks.,
Paul Schlie <=
- Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks., Geoffrey Wossum, 2004/11/22
- Re: [avr-libc-dev] soliciting feedback/thoughts on potential value of a few gcc 4.0 tweaks., Paul Schlie, 2004/11/22