This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Local optimization on i386 ?
- To: egcs at egcs dot cygnus dot com
- Subject: Local optimization on i386 ?
- From: Marc Espie <Marc dot Espie at liafa dot jussieu dot fr>
- Date: Tue, 30 Nov 1999 00:44:02 +0100
Is this normal behavior on a 386 ?
With egcs-current,
---- gcc -O2 -S a.c
void f(int i)
{}
void g(int i)
{
f(i);
}
---yields:
.file "a.c"
.version "01.01"
gcc2_compiled.:
___gnu_compiled_c:
.text
.align 2,0x90
.globl _f
.type _f , @function
_f:
pushl %ebp
movl %esp, %ebp
leave
ret
.size _f , . - _f
.align 2,0x90
.globl _g
.type _g , @function
_g:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
subl $12, %esp
pushl 8(%ebp)
call _f
leave
ret
.size _g , . - _g
Note the
subl $8, %esp
subl $12, %esp
I don't know enough about 386, but should't this be
subl $20, %esp ?
I assume I'm missing some obvious reason why there are two separate
subs...
(gcc 2.95.2 replaces one sub with an add, but still doesn't peep-hole
anything).
--
Marc Espie
|anime, sf, juggling, unicycle, acrobatics, comics...
|AmigaOS, OpenBSD, C++, perl, Icon, PostScript...
| `real programmers don't die, they just get out of beta'