Commit fbb83b43 by Alexandre Oliva Committed by Alexandre Oliva

i386.c (override_options): Default to minimum stack alignment when optimizing for code size.

* config/i386/i386.c (override_options): Default to minimum
stack alignment when optimizing for code size.
* doc/invoke.texi (-mpreferred-stack-boundary): Document the
change.

From-SVN: r46433
parent c6257c5d
2001-10-23 Alexandre Oliva <aoliva@redhat.com> 2001-10-23 Alexandre Oliva <aoliva@redhat.com>
* config/i386/i386.c (override_options): Default to minimum
stack alignment when optimizing for code size.
* doc/invoke.texi (-mpreferred-stack-boundary): Document the
change.
* config/i386/i386.c (override_options): Set upper limit of * config/i386/i386.c (override_options): Set upper limit of
-mpreferred-stack-boundary to 12. -mpreferred-stack-boundary to 12.
......
...@@ -973,8 +973,12 @@ override_options () ...@@ -973,8 +973,12 @@ override_options ()
align_functions = 1 << abs (processor_target_table[ix86_cpu].align_func); align_functions = 1 << abs (processor_target_table[ix86_cpu].align_func);
/* Validate -mpreferred-stack-boundary= value, or provide default. /* Validate -mpreferred-stack-boundary= value, or provide default.
The default of 128 bits is for Pentium III's SSE __m128. */ The default of 128 bits is for Pentium III's SSE __m128, but we
ix86_preferred_stack_boundary = 128; don't want additional code to keep the stack aligned when
optimizing for code size. */
ix86_preferred_stack_boundary = (optimize_size
? TARGET_64BIT ? 64 : 32
: 128);
if (ix86_preferred_stack_boundary_string) if (ix86_preferred_stack_boundary_string)
{ {
i = atoi (ix86_preferred_stack_boundary_string); i = atoi (ix86_preferred_stack_boundary_string);
......
...@@ -7587,12 +7587,13 @@ startup modules. ...@@ -7587,12 +7587,13 @@ startup modules.
@opindex mpreferred-stack-boundary @opindex mpreferred-stack-boundary
Attempt to keep the stack boundary aligned to a 2 raised to @var{num} Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
byte boundary. If @option{-mpreferred-stack-boundary} is not specified, byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
the default is 4 (16 bytes or 128 bits). the default is 4 (16 bytes or 128 bits), except when optimizing for code
size (@option{-Os}), in which case the default is the minimum correct
alignment (4 bytes for x86, and 8 bytes for x86-64).
The stack is required to be aligned on a 4 byte boundary. On Pentium On Pentium and PentiumPro, @code{double} and @code{long double} values
and PentiumPro, @code{double} and @code{long double} values should be should be aligned to an 8 byte boundary (see @option{-malign-double}) or
aligned to an 8 byte boundary (see @option{-malign-double}) or suffer suffer significant run time performance penalties. On Pentium III, the
significant run time performance penalties. On Pentium III, the
Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
penalties if it is not 16 byte aligned. penalties if it is not 16 byte aligned.
...@@ -7604,10 +7605,10 @@ stack boundary from a function compiled with a lower preferred stack ...@@ -7604,10 +7605,10 @@ stack boundary from a function compiled with a lower preferred stack
boundary will most likely misalign the stack. It is recommended that boundary will most likely misalign the stack. It is recommended that
libraries that use callbacks always use the default setting. libraries that use callbacks always use the default setting.
This extra alignment does consume extra stack space. Code that is sensitive This extra alignment does consume extra stack space, and generally
to stack space usage, such as embedded systems and operating system kernels, increases code size. Code that is sensitive to stack space usage, such
may want to reduce the preferred alignment to as embedded systems and operating system kernels, may want to reduce the
@option{-mpreferred-stack-boundary=2}. preferred alignment to @option{-mpreferred-stack-boundary=2}.
@item -mmmx @item -mmmx
@itemx -mno-mmx @itemx -mno-mmx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment