[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Need help compiling testcase with gcc 3.3.5 or 3.4.3
From: |
Dmitry K. |
Subject: |
Re: [avr-gcc-list] Need help compiling testcase with gcc 3.3.5 or 3.4.3 |
Date: |
Sat, 29 Jan 2005 15:42:51 +1000 |
User-agent: |
KMail/1.5 |
On Saturday 29 January 2005 00:30, Andy Hutchinson wrote:
> Thanks Ian!
>
> Ideally, loop should be transformed into 10..1 and end in BRNE or maybe
> 9..0 and BRLT.
>
> Here is difference
>
> WINAVR 3.3.1 GCC4.0
> TESTLOOP1 9..0 loop 10..1 loop
> SBRS BRNE
>
> TESTLOOP2 0..9 9..0
> cpi/cpc SBRS
>
> TESTLOOP3 9..0 0..9
> SBRS cpi/cpc
>
> TESTLOOP4 0..9 9..0
> cpi/cpc SBRS
>
> TESTLOOP5 9..0 10..1
> SBRS BRNE
Another interesting case (-Os used):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int foo (int x)
{
int i= x;
do {
x *= 2;
} while (--i);
return x;
}
Result with 3.3.4:
~~~~~~~~~~~~~~~~~~
foo:
/* prologue: frame size=0 */
/* prologue end (size=0) */
mov r18,r24
mov r19,r25
.L2:
add r24,r24
adc r25,r25
subi r18,lo8(-(-1))
sbci r19,hi8(-(-1))
brne .L2
/* epilogue: frame size=0 */
ret
Result with 4.0:
~~~~~~~~~~~~~~~~
foo:
/* prologue: frame size=0 */
/* prologue end (size=0) */
ldi r18,lo8(0)
ldi r19,hi8(0)
clr r20
clr r21
sub r20,r24
sbc r21,r25
.L2:
add r24,r24
adc r25,r25
subi r18,lo8(-(-1))
sbci r19,hi8(-(-1))
cp r18,r20
cpc r19,r21
brne .L2
/* epilogue: frame size=0 */
ret
Re: [avr-gcc-list] Need help compiling testcase with gcc 3.3.5 or 3.4.3, E. Weddington, 2005/01/28