Message ID | 20160204230444.GT3017@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On Fri, Feb 5, 2016 at 12:04 AM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > As mentioned in the PR, the convert_scalars_to_vector hunk is important, > without that we e.g. miscompile simplify-rtx.c. > The following patch restores that hunk and extends disabling of TARGET_STV > also for the 64-bit, but not 128-bit, aligned preferred or incoming stack > boundaries (also non-default). > > Bootstrapped/regtested on i686-linux --with-arch=corei7 --with-tune=corei7 > --with-fpmath=sse. > > Alternatively, it is enough to just adjust stack_alignment_estimated in > there and keep stack_alignment_needed as is, that version has also been > successfully bootstrapped on i686-linux --with-arch=corei7 > --with-tune=corei7 --with-fpmath=sse. > > 2016-02-04 Jakub Jelinek <jakub@redhat.com> > > PR bootstrap/69677 > * config/i386/i386.c (convert_scalars_to_vector): Readd stack > alignment fixes. > (ix86_option_override_internal): Disable TARGET_STV even for > -m{incoming,preferred}-stack-boundary=3. Let's go with this patch to resolve the bootstrap problem. As said earlier, after gcc-6 is released, we can fix the problem in a proper way. OK. Thanks, Uros. > --- gcc/config/i386/i386.c.jj 2016-02-04 18:59:38.309204574 +0100 > +++ gcc/config/i386/i386.c 2016-02-04 21:54:02.439904261 +0100 > @@ -3588,6 +3588,16 @@ convert_scalars_to_vector () > bitmap_obstack_release (NULL); > df_process_deferred_rescans (); > > + /* Conversion means we may have 128bit register spills/fills > + which require aligned stack. */ > + if (converted_insns) > + { > + if (crtl->stack_alignment_needed < 128) > + crtl->stack_alignment_needed = 128; > + if (crtl->stack_alignment_estimated < 128) > + crtl->stack_alignment_estimated = 128; > + } > + > return 0; > } > @@ -5443,12 +5453,12 @@ ix86_option_override_internal (bool main > opts->x_target_flags |= MASK_VZEROUPPER; > if (!(opts_set->x_target_flags & MASK_STV)) > opts->x_target_flags |= MASK_STV; > - /* Disable STV if -mpreferred-stack-boundary=2 or > - -mincoming-stack-boundary=2 - the needed > + /* Disable STV if -mpreferred-stack-boundary={2,3} or > + -mincoming-stack-boundary={2,3} - 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 < 64 > - || ix86_incoming_stack_boundary < 64) > + if (ix86_preferred_stack_boundary < 128 > + || ix86_incoming_stack_boundary < 128) > 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)) > > Jakub
--- gcc/config/i386/i386.c.jj 2016-02-04 18:59:38.309204574 +0100 +++ gcc/config/i386/i386.c 2016-02-04 21:54:02.439904261 +0100 @@ -3588,6 +3588,16 @@ convert_scalars_to_vector () bitmap_obstack_release (NULL); df_process_deferred_rescans (); + /* Conversion means we may have 128bit register spills/fills + which require aligned stack. */ + if (converted_insns) + { + if (crtl->stack_alignment_needed < 128) + crtl->stack_alignment_needed = 128; + if (crtl->stack_alignment_estimated < 128) + crtl->stack_alignment_estimated = 128; + } + return 0; } @@ -5443,12 +5453,12 @@ ix86_option_override_internal (bool main opts->x_target_flags |= MASK_VZEROUPPER; if (!(opts_set->x_target_flags & MASK_STV)) opts->x_target_flags |= MASK_STV; - /* Disable STV if -mpreferred-stack-boundary=2 or - -mincoming-stack-boundary=2 - the needed + /* Disable STV if -mpreferred-stack-boundary={2,3} or + -mincoming-stack-boundary={2,3} - 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 < 64 - || ix86_incoming_stack_boundary < 64) + if (ix86_preferred_stack_boundary < 128 + || ix86_incoming_stack_boundary < 128) 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))