[PATCH] Fix up bootstrap on i686 --with-arch=corei7 --with-fpmath=sse (PR bootstrap/69677)

H.J. Lu hjl.tools@gmail.com
Fri Feb 5 16:24:00 GMT 2016


On Fri, Feb 5, 2016 at 1:11 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> 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

I checked in this testcase.

-- 
H.J.
--
Index: ChangeLog
===================================================================
--- ChangeLog (revision 233179)
+++ ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2016-02-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+ PR target/69677
+ * gcc.target/i386/pr69677.c: New test.
+
 2016-02-05  Patrick Palka  <ppalka@gcc.gnu.org>

  PR c++/68948
Index: gcc.target/i386/pr69677.c
===================================================================
--- gcc.target/i386/pr69677.c (nonexistent)
+++ gcc.target/i386/pr69677.c (working copy)
@@ -0,0 +1,20 @@
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -mno-avx -march=corei7 -fdump-rtl-final" } */
+
+extern const unsigned int a[];
+extern const unsigned long long b[];
+
+int
+fn1 (unsigned int p1, unsigned long long p2)
+{
+  unsigned int p3;
+
+  p3 = a[p1];
+  if (p3 == 0 || p3 > 64)
+    return 0;
+
+  p2 &= b[p1];
+  return p2 == ((unsigned long long) 1 << (p3 - 1));
+}
+
+// { dg-final { scan-rtl-dump-not "S16
A64\[^\n\]*\\\*movv2di_internal" "final" } }



More information about the Gcc-patches mailing list