[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] What's wrong with this preprocessor statement
From: |
Denis Chertykov |
Subject: |
Re: [avr-gcc-list] What's wrong with this preprocessor statement |
Date: |
28 Feb 2001 00:25:27 +0300 |
address@hidden (J Wunsch) writes:
> Denis Chertykov <address@hidden> wrote:
>
> > Today it's not a true.
> > Now GCC can optimize out such loops.
>
> Out of curiosity: when does gcc optimize them out? All versions of
> gcc i tried (AVR, FreeBSD/i386, Linux/i386, Solaris/Sparc,
> HP-UX/PA-RISC, all of them were 2.95.2 versions) don't optimize it
> away in the following file, not even with -O3 (which implies
> -fstrength-reduce, which is documented to perform the loop variable
> elimination):
>
> void
> foo(void)
> {
> int i;
>
> for (i = 0; i < 10000; i++) ;
> }
Current avr-gcc (CVS version) generates:
.global foo
.type foo,@function
foo:
/* prologue: frame size=0 */
/* prologue end (size=0) */
ldi r24,lo8(9999)
ldi r25,hi8(9999)
.L7:
subi r24,lo8(-(-625)) <---------- Will be executed only 16 times
sbci r25,hi8(-(-625)) <----------
brpl .L7
/* epilogue: frame size=0 */
ret
/* epilogue end (size=1) */
/* function foo size 7 (6) */
.Lfe2:
.size foo,.Lfe2-foo