i386: -fno-force-addr working?
Etienne LORRAIN
etienne_lorrain@yahoo.fr
Thu Jan 27 07:22:00 GMT 2000
Hello,
For every "recent" egcs/gcc, I have this:
------------------------------------------
bash-2.02$ cat optim.c
struct {
void (*fct1) (void);
void (*fct2) (void);
void (*fct3) (void);
void (*fct4) (void);
void (*fct5) (void);
void (*fct6) (void);
void (*fct7) (void);
} thestruct;
void fct (void)
{
thestruct.fct1();
thestruct.fct2();
thestruct.fct3();
thestruct.fct4();
thestruct.fct5();
thestruct.fct6();
thestruct.fct7();
}
bash-2.02$ xgcc -O2 -S -fomit-frame-pointer -fno-force-addr optim.c
bash-2.02$ cat optim.s
.file "optim.c"
.version "01.01"
gcc2_compiled.:
___gnu_compiled_c:
.text
.align 16
.globl _fct
.def _fct; .scl 2; .type 32; .endef
_fct:
movl _thestruct, %eax
subl $12, %esp
call *%eax
movl _thestruct+4, %eax
call *%eax
movl _thestruct+8, %eax
call *%eax
movl _thestruct+12, %eax
call *%eax
movl _thestruct+16, %eax
call *%eax
movl _thestruct+20, %eax
call *%eax
movl _thestruct+24, %eax
call *%eax
addl $12, %esp
ret
.comm _thestruct, 32 # 28
bash-2.02$ xgcc -v
Using builtin specs.
gcc version 2.96 19991201 (experimental)
bash-2.02$
------------------------------------------
I do not understand why the opcodes:
call (_thestruct+24)
are not generated, or even better:
movl _thestruct, %ebx
call 4(%ebx)
call 8(%ebx)
but the later is an optimisation thing,
the former seems to show that -fno-force-addr
is not working - or that there is a problem in
the "call" description. I am mode interrested
by the code size than the code speed - but it
seems to be the same (or better) speed anyway,
and will take less space in the cache.
Have a nice day,
Etienne.
___________________________________________________________
Do You Yahoo!?
Achetez, vendez! ÃÂ votre prix! Sur http://encheres.yahoo.fr
More information about the Gcc-bugs
mailing list