__attribute__((naked) on x86 would be useful
Jamie Lokier
jamie@shareable.org
Mon Feb 16 17:14:00 GMT 2004
Jakub Jelinek wrote:
> > what I'd like to be two instructions:
> >
> > addl $16,4(%esp)
> > jmp bar
> >
> > into seven:
>
> -O2 -fomit-frame-pointer compiles this into
> movl 4(%esp), %eax
> addl $16, %eax
> movl %eax, 4(%esp)
> jmp bar
> on both gcc-3_3-rhl-branch and gcc-3_4-branch.
That's a nice improveent. GCC 3.2.2 generates 12 instructions because
-fomit-frame-pointer disables the tail call.
> > Interestingly, that movl/addl/movl in the middle there could just as
> > well be one instruction.
>
> Why? You are not optimizing for space, and the 3 insns are faster I think
> (contemporary IA-32 CPUs prefer simple instructions).
With -Os it still emits 3 insns (GCC 3.2.2).
-- Jamie
More information about the Gcc
mailing list