* Re: [x86] Disable STV pass if -mstackrealign is enabled.
@ 2016-08-31 19:29 Uros Bizjak
2016-09-07 15:07 ` H.J. Lu
0 siblings, 1 reply; 6+ messages in thread
From: Uros Bizjak @ 2016-08-31 19:29 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
> the new STV pass generates SSE instructions in 32-bit mode very late in the
> pipeline and doesn't bother about realigning the stack, so it wreaks havoc on
> OSes where you need to realign the stack, e.g. Windows, but I guess Solaris is
> equally affected. Therefore the attached patch disables it if -mstackrealign
> is enabled (the option is automatically enabled on Windows and Solaris when
> SSE support is enabled), as already done for -mpreferred-stack-boundary={2,3}
> and -mincoming-stack-boundary={2,3}.
>
> Tested on x86/Windows, OK for mainline and 6 branch?
>
>
> 2016-08-31 Eric Botcazou <ebotcazou@adacore.com>
>
> * config/i386/i386.c (ix86_option_override_internal): Also disable the
> STV pass if -mstackrealign is enabled.
OK for mainline and gcc-6 branch.
Thanks,
Uros.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [x86] Disable STV pass if -mstackrealign is enabled.
2016-08-31 19:29 [x86] Disable STV pass if -mstackrealign is enabled Uros Bizjak
@ 2016-09-07 15:07 ` H.J. Lu
2016-09-08 6:06 ` Eric Botcazou
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2016-09-07 15:07 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches, Eric Botcazou
On Wed, Aug 31, 2016 at 12:29 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> the new STV pass generates SSE instructions in 32-bit mode very late in the
>> pipeline and doesn't bother about realigning the stack, so it wreaks havoc on
>> OSes where you need to realign the stack, e.g. Windows, but I guess Solaris is
>> equally affected. Therefore the attached patch disables it if -mstackrealign
>> is enabled (the option is automatically enabled on Windows and Solaris when
>> SSE support is enabled), as already done for -mpreferred-stack-boundary={2,3}
>> and -mincoming-stack-boundary={2,3}.
>>
>> Tested on x86/Windows, OK for mainline and 6 branch?
>>
>>
>> 2016-08-31 Eric Botcazou <ebotcazou@adacore.com>
>>
>> * config/i386/i386.c (ix86_option_override_internal): Also disable the
>> STV pass if -mstackrealign is enabled.
>
> OK for mainline and gcc-6 branch.
>
Is there a testcase to show the problem with -mincoming-stack-boundary=
on Linux?
--
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [x86] Disable STV pass if -mstackrealign is enabled.
@ 2016-08-31 15:53 Eric Botcazou
0 siblings, 0 replies; 6+ messages in thread
From: Eric Botcazou @ 2016-08-31 15:53 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 765 bytes --]
Hi,
the new STV pass generates SSE instructions in 32-bit mode very late in the
pipeline and doesn't bother about realigning the stack, so it wreaks havoc on
OSes where you need to realign the stack, e.g. Windows, but I guess Solaris is
equally affected. Therefore the attached patch disables it if -mstackrealign
is enabled (the option is automatically enabled on Windows and Solaris when
SSE support is enabled), as already done for -mpreferred-stack-boundary={2,3}
and -mincoming-stack-boundary={2,3}.
Tested on x86/Windows, OK for mainline and 6 branch?
2016-08-31 Eric Botcazou <ebotcazou@adacore.com>
* config/i386/i386.c (ix86_option_override_internal): Also disable the
STV pass if -mstackrealign is enabled.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 998 bytes --]
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 239842)
+++ config/i386/i386.c (working copy)
@@ -5957,11 +5957,12 @@ ix86_option_override_internal (bool main_args_p,
if (!(opts_set->x_target_flags & MASK_STV))
opts->x_target_flags |= MASK_STV;
/* Disable STV if -mpreferred-stack-boundary={2,3} or
- -mincoming-stack-boundary={2,3} - the needed
+ -mincoming-stack-boundary={2,3} or -mstackrealign - the needed
stack realignment will be extra cost the pass doesn't take into
account and the pass can't realign the stack. */
if (ix86_preferred_stack_boundary < 128
- || ix86_incoming_stack_boundary < 128)
+ || ix86_incoming_stack_boundary < 128
+ || opts->x_ix86_force_align_arg_pointer)
opts->x_target_flags &= ~MASK_STV;
if (!ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL]
&& !(opts_set->x_target_flags & MASK_AVX256_SPLIT_UNALIGNED_LOAD))
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-09-08 16:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-31 19:29 [x86] Disable STV pass if -mstackrealign is enabled Uros Bizjak
2016-09-07 15:07 ` H.J. Lu
2016-09-08 6:06 ` Eric Botcazou
2016-09-08 14:53 ` H.J. Lu
2016-09-08 16:29 ` Eric Botcazou
-- strict thread matches above, loose matches on Subject: below --
2016-08-31 15:53 Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).