public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94308] New: [10 Regression] ICE in final_scan_insn_1 with vzeroupper
@ 2020-03-24 18:25 jakub at gcc dot gnu.org
  2020-03-24 18:31 ` [Bug target/94308] [10 Regression] ICE in final_scan_insn_1 with vzeroupper since r10-6451 jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-24 18:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94308

            Bug ID: 94308
           Summary: [10 Regression] ICE in final_scan_insn_1 with
                    vzeroupper
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

/* { dg-do compile } */
/* { dg-options "-O2 -mfpmath=sse -mavx2 -mfma" } */

#include <x86intrin.h>

void
foo (float *x, const float *y, const float *z, unsigned int w)
{
  unsigned int a;
  const unsigned int b = w / 8;
  const float *c = y;
  const float *d = z;
  __m256 e = _mm256_setzero_ps ();
  __m256 f, g;
  for (a = 0; a < b; a++)
    {
      f = _mm256_loadu_ps (c);
      g = _mm256_loadu_ps (d);
      c += 8;
      d += 8;
      e = _mm256_fmadd_ps (f, g, e);
    }
  __attribute__ ((aligned (32))) float h[8];
  _mm256_storeu_ps (h, e);
  _mm256_zeroupper ();
  float i = h[0] + h[1] + h[2] + h[3] + h[4] + h[5] + h[6] + h[7];
  for (a = b * 8; a < w; a++)
    i += (*c++) * (*d++);
  *x = i;
}

ICEs on i686-linux or x86_64-linux with -m32.
The problem is that the vzeroupper pass in this case fills in sets for all
xmm0..xmm7 regs, but doesn't force rerecognition of the insn, so it is still
considered avx_vzeroupper_1, but the splitter doesn't trigger for it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/94308] [10 Regression] ICE in final_scan_insn_1 with vzeroupper since r10-6451
  2020-03-24 18:25 [Bug target/94308] New: [10 Regression] ICE in final_scan_insn_1 with vzeroupper jakub at gcc dot gnu.org
@ 2020-03-24 18:31 ` jakub at gcc dot gnu.org
  2020-03-24 18:35 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-24 18:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94308

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10 Regression] ICE in      |[10 Regression] ICE in
                   |final_scan_insn_1 with      |final_scan_insn_1 with
                   |vzeroupper                  |vzeroupper since r10-6451
   Target Milestone|---                         |10.0
   Last reconfirmed|                            |2020-03-24
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with my r10-6451-gb7b3378f91c0641f2ef4d88db22af62a571c9359 change.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/94308] [10 Regression] ICE in final_scan_insn_1 with vzeroupper since r10-6451
  2020-03-24 18:25 [Bug target/94308] New: [10 Regression] ICE in final_scan_insn_1 with vzeroupper jakub at gcc dot gnu.org
  2020-03-24 18:31 ` [Bug target/94308] [10 Regression] ICE in final_scan_insn_1 with vzeroupper since r10-6451 jakub at gcc dot gnu.org
@ 2020-03-24 18:35 ` jakub at gcc dot gnu.org
  2020-03-25  7:36 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-24 18:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94308

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48109
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48109&action=edit
gcc10-pr94308.patch

Untested fix.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/94308] [10 Regression] ICE in final_scan_insn_1 with vzeroupper since r10-6451
  2020-03-24 18:25 [Bug target/94308] New: [10 Regression] ICE in final_scan_insn_1 with vzeroupper jakub at gcc dot gnu.org
  2020-03-24 18:31 ` [Bug target/94308] [10 Regression] ICE in final_scan_insn_1 with vzeroupper since r10-6451 jakub at gcc dot gnu.org
  2020-03-24 18:35 ` jakub at gcc dot gnu.org
@ 2020-03-25  7:36 ` rguenth at gcc dot gnu.org
  2020-03-25 10:40 ` cvs-commit at gcc dot gnu.org
  2020-03-25 10:42 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-25  7:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94308

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/94308] [10 Regression] ICE in final_scan_insn_1 with vzeroupper since r10-6451
  2020-03-24 18:25 [Bug target/94308] New: [10 Regression] ICE in final_scan_insn_1 with vzeroupper jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-03-25  7:36 ` rguenth at gcc dot gnu.org
@ 2020-03-25 10:40 ` cvs-commit at gcc dot gnu.org
  2020-03-25 10:42 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-25 10:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94308

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:d5ad8ee04a78b576867fd78b2f25201ea6b4aae1

commit r10-7373-gd5ad8ee04a78b576867fd78b2f25201ea6b4aae1
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 25 11:40:00 2020 +0100

    i386: Fix ix86_add_reg_usage_to_vzeroupper [PR94308]

    The following patch ICEs due to my recent change r10-6451-gb7b3378f91c.
    Since that patch, for explicit vzeroupper in the sources (when an intrinsic
    is used), we start with the *avx_vzeroupper_1 pattern which contains just
the
    UNSPECV_VZEROUPPER and no sets/clobbers.  The vzeroupper pass then adds
some
    sets to those, but doesn't add clobbers and finally there is an
    && epilogue_completed splitter that splits this into the *avx_vzeroupper
    pattern which has the right number of sets/clobbers (16 on 64-bit, 8 on
    32-bit) + the UNSPECV_VZEROUPPER first.
    The problem with this testcase on !TARGET_64BIT is that the vzeroupper pass
    adds 8 sets to the pattern, i.e. the maximum number, but INSN_CODE stays
    to be the one of the *avx_vzeroupper_1 pattern.  The splitter doesn't do
    anything here, because it sees the number of rtxes in the PARALLEL already
    the right count, but during final we see that the *avx_vzeroupper_1 pattern
    has "#" output template and ICE that we forgot to split it.

    The following patch fixes it by forcing re-recognition of the insn after we
    make the changes to it in ix86_add_reg_usage_to_vzeroupper.  Anything that
    will call recog_memoized later on will recog it and find out it is in this
    case already *avx_vzeroupper rather than *avx_vzeroupper_1.

    2020-03-25  Jakub Jelinek  <jakub@redhat.com>

            PR target/94308
            * config/i386/i386-features.c (ix86_add_reg_usage_to_vzeroupper):
Set
            INSN_CODE (insn) to -1 when changing the pattern.

            * gcc.target/i386/pr94308.c: New test.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/94308] [10 Regression] ICE in final_scan_insn_1 with vzeroupper since r10-6451
  2020-03-24 18:25 [Bug target/94308] New: [10 Regression] ICE in final_scan_insn_1 with vzeroupper jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-03-25 10:40 ` cvs-commit at gcc dot gnu.org
@ 2020-03-25 10:42 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-25 10:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94308

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-25 10:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 18:25 [Bug target/94308] New: [10 Regression] ICE in final_scan_insn_1 with vzeroupper jakub at gcc dot gnu.org
2020-03-24 18:31 ` [Bug target/94308] [10 Regression] ICE in final_scan_insn_1 with vzeroupper since r10-6451 jakub at gcc dot gnu.org
2020-03-24 18:35 ` jakub at gcc dot gnu.org
2020-03-25  7:36 ` rguenth at gcc dot gnu.org
2020-03-25 10:40 ` cvs-commit at gcc dot gnu.org
2020-03-25 10:42 ` jakub at gcc dot gnu.org

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).