[PATCH, PR target/69454] Disable TARGET_STV when stack is not properly aligned
Uros Bizjak
ubizjak@gmail.com
Tue Feb 2 13:08:00 GMT 2016
On Tue, Feb 2, 2016 at 2:06 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Feb 2, 2016 at 5:03 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>> 2016-02-02 15:46 GMT+03:00 H.J. Lu <hjl.tools@gmail.com>:
>>> On Tue, Feb 2, 2016 at 4:30 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Tue, Feb 2, 2016 at 4:29 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>>>>> On Tue, Feb 02, 2016 at 01:24:26PM +0100, Uros Bizjak wrote:
>>>>>> On Tue, Feb 2, 2016 at 12:53 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>>>>>>
>>>>>> >> The bottom line is ix86_minimum_alignment must return the correct
>>>>>> >> number for DImode or you can just turn off STV. My suggestion is
>>>>>> >> to use my patch.
>>>>>> >
>>>>>> > Uros, any preferences here? I mean, it is possible to use
>>>>>> > e.g. the ix86_option_override_internal and have H.J's ix86_minimum_alignment
>>>>>> > change as a safety net, in the usual case for -mpreferred-stack-boundary=2
>>>>>> > we'll just disable TARGET_STV and ix86_minimum_alignment change won't do
>>>>>> > anything, as TARGET_STV will be false, and if for whatever case it gets
>>>>>> > through (target attribute, -mincoming-stack-boundary=, ...)
>>>>>> > ix86_minimum_alignment will be there to ensure enough stack alignment.
>>>>>> > Most of the smaller -mpreferred-stack-boundary= uses are -mno-sse anyway,
>>>>>> > and that is something we don't want to affect.
>>>>>>
>>>>>> IMO, we should disable STV when -mpreferred-stack-boundary < 3, as STV
>>>>>> is only an optimization. Perhaps we can also emit a "sorry" for
>>>>>> explicit -mstv in case stack boundary requirement is not satisfied.
>>>>>> *If* there is a need for -mstv with smaller stack boundary, we can
>>>>>> revisit this decision for later gcc versions.
>>>>>>
>>>>>> I think disabling STV is less surprising option than increasing stack
>>>>>> boundary behind the user's back.
>>>>>
>>>>> So, is http://gcc.gnu.org/ml/gcc-patches/2016-01/msg02129.html
>>>>> ok for trunk then (alone or with additional sorry, incremental or not?)?
>>>>> I believe it does just that.
>>>>
>>>> This patch is WRONG.
>>>>
>>>> --
>>>> H.J.
>>>
>>> You will run into the same ICE with
>>>
>>> -mincoming-stack-boundary=2 -msse2 -O2 -m32
>>>
>>> in a leaf function which needs DImode spill/fill.
>>
>> Why would we need DImode spill/fill having no DImode registers?
>>
>
> Because STV is enabled with
>
> -mincoming-stack-boundary=2 -msse2 -O2 -m32
But this is the whole trick. Since stack alignment requirements won't
be satisfied, we disable STV even with -msse2.
Uros.
More information about the Gcc-patches
mailing list