This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [cft] aligning main's stack frame
- From: Andi Kleen <ak at suse dot de>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 17 Oct 2005 12:25:46 +0200
- Subject: Re: [cft] aligning main's stack frame
- References: <4351AE1C.1010704@sco.com.suse.lists.egcs><20051016201110.GA7226@redhat.com.suse.lists.egcs>
Richard Henderson <rth@redhat.com> writes:
> main:
> leal 4(%esp), %ecx # create argument pointer
> andl $-16, %esp # align stack
> pushl -4(%ecx) # copy return address
This will misaligned the call/ret stack in the CPU, leading to branch
mispredictions on many of the following RETs. On main it's probably
not a big issue, but for other functions it might be.
-Andi