Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Nov 1999 19:47:46 +0100
From:      Marcel Moolenaar <marcel@scc.nl>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Ville-Pertti Keinonen <will@iki.fi>, current@FreeBSD.ORG
Subject:   Re: kernel: -mpreferred-stack-boundary=2 ??
Message-ID:  <38441BD2.5540BE94@scc.nl>
References:  <19991130133337.25847.qmail@ns.demophon.com> <199911301735.JAA25885@apollo.backplane.com> <384410F3.F5247785@scc.nl> <199911301822.KAA26455@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Dillon wrote:

>     All I can say to that is "bleh".  The real question is whether performance
>     is actually improved significantly or not.  If not, I'd sent a nasty email
>     to the gcc folks :-)

I guess only if you do have a PIII and are using the new instructions.
In most cases this has no effect whatsoever. Not counting the
significant code size increase.

From the GCC manual (reproduced without explicit permission :-)

	-mpreferred-stack-boundary=num Attempt to keep the stack boundary
aligned to a 2 raised to num byte boundary. If
`-mpreferred-stack-boundary' is not specified, the default is 4 (16
bytes or 128 bits). The stack is required to be aligned on a 4 byte
boundary. On Pentium and PentiumPro, double and long double values
should be aligned to an 8 byte boundary (see `-malign-double') or suffer
significant run time performance penalties. On Pentium III, the
Streaming SIMD Extention (SSE) data type __m128 suffers similar
penalties if it is not 16 byte aligned. To ensure proper alignment of
this values on the stack, the stack boundary must be as aligned as that
required by any value stored on the stack. Further, every function must
be generated such that it keeps the stack aligned. Thus calling a
function compiled with a higher preferred stack boundary from a function
compiled with a lower preferred stack boundary will most likely misalign
the stack. It is recommended that libraries that use callbacks always
use the default setting. This extra alignment does consume extra stack
space. Code that is sensitive to stack space usage, such as embedded
systems and operating system kernels, may want to reduce the preferred
alignment to `-mpreferred-stack-boundary=2'.

-- 
Marcel Moolenaar                        mailto:marcel@scc.nl
SCC Internetworking & Databases           http://www.scc.nl/
The FreeBSD project                mailto:marcel@FreeBSD.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38441BD2.5540BE94>