This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Gcc extra alignment..
- To: Linus Torvalds <torvalds at transmeta dot com>
- Subject: Re: Gcc extra alignment..
- From: Jamie Lokier <egcs at tantalophile dot demon dot co dot uk>
- Date: Thu, 2 Nov 2000 01:09:41 +0100
- Cc: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>, gcc at gcc dot gnu dot org
- References: <200010311957.NAA95981@latour.rsch.comm.mot.com> <Pine.LNX.4.10.10010311211220.21954-100000@penguin.transmeta.com>
Linus Torvalds wrote:
> foo:
> subl $12, %esp
> call bar
> addl $12, %esp
> ret
As opposed to:
> foo:
> jmp bar
> (I wonder why. It's not as if we're adding any new variables in scope or
> anything like that. Strange. I'm sure it has a perfectly good explanation,
> but it does look like some obvious optimization is trivially missed).
The loop causes the tail-call to be missed, hence "call bar" instead of
"jmp bar".
The stack is aligned to 16 bytes for some reason I don't entirely see
the point in. (Like, why can't the few functions that use 128-bit SIMD
use `and' to align their stack instead?) So, because of the call GCC
has to adjust the stack to maintain the alignment.
If you're seeing this in the kernel, you probably want to use
-mpreferred-stack-boundary=2 to get better code.
enjoy,
-- Jamie