public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place
@ 2022-02-08 14:01 hjl.tools at gmail dot com
  2022-02-08 14:01 ` [Bug target/104441] " hjl.tools at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2022-02-08 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104441
           Summary: [12 Regression] vzeroupper is placed at the wrong
                    place
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: crazylht at gmail dot com, lili.cui at intel dot com
  Target Milestone: ---
            Target: x86-64

Created attachment 52375
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52375&action=edit
A testcase

When compiled with -march=skylake -Wno-attributes, GCC 12 generated:

.L3:
        vmovd   (%rdi), %xmm0
        vmovd   (%rdi,%r13), %xmm1
        vpinsrd $1, (%rdi,%r12), %xmm1, %xmm1
        vpinsrd $1, (%rdi,%rsi), %xmm0, %xmm0
        vmovd   (%rax,%rbx), %xmm2
        vinserti128     $0x1, %xmm1, %ymm0, %ymm0
        vmovd   (%rax), %xmm1
        vpinsrd $1, (%rax,%rcx), %xmm1, %xmm1
        vpinsrd $1, (%rax,%r11), %xmm2, %xmm2
        addl    $4, %edx
        vinserti128     $0x1, %xmm2, %ymm1, %ymm1
        vpsadbw %ymm1, %ymm0, %ymm0
        vpaddd  %ymm0, %ymm3, %ymm0
        vmovdqa %ymm0, %ymm3
        addq    %r10, %rdi
        addq    %r9, %rax
        cmpl    %r8d, %edx
        jb      .L3
        vzeroupper   <<<<<<<<<<< Clear upper 128bits.
        popq    %rbx
        popq    %r12
        vextracti128    $0x1, %ymm3, %xmm3  << The upper 128bits of YMM3 are
used.
        vpaddd  %xmm3, %xmm0, %xmm0
        popq    %r13
        vmovd   %xmm0, %eax
        popq    %rbp

This is triggered by

commit 9775e465c1fbfc32656de77c618c61acf5bd905d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jul 27 07:46:04 2021 -0700

    x86: Don't set AVX_U128_DIRTY when zeroing YMM/ZMM register

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

* [Bug target/104441] [12 Regression] vzeroupper is placed at the wrong place
  2022-02-08 14:01 [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place hjl.tools at gmail dot com
@ 2022-02-08 14:01 ` hjl.tools at gmail dot com
  2022-02-08 14:30 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2022-02-08 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P2
   Last reconfirmed|                            |2022-02-08

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

* [Bug target/104441] [12 Regression] vzeroupper is placed at the wrong place
  2022-02-08 14:01 [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place hjl.tools at gmail dot com
  2022-02-08 14:01 ` [Bug target/104441] " hjl.tools at gmail dot com
@ 2022-02-08 14:30 ` hjl.tools at gmail dot com
  2022-02-08 16:08 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2022-02-08 14:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
ix86_check_avx_upper_register doesn't check

(vec_select:V2DI (reg/v:V4DI 23 xmm3 [orig:91 ymm ] [91])
    (parallel [
            (const_int 2 [0x2])
            (const_int 3 [0x3])
        ]))

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

* [Bug target/104441] [12 Regression] vzeroupper is placed at the wrong place
  2022-02-08 14:01 [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place hjl.tools at gmail dot com
  2022-02-08 14:01 ` [Bug target/104441] " hjl.tools at gmail dot com
  2022-02-08 14:30 ` hjl.tools at gmail dot com
@ 2022-02-08 16:08 ` hjl.tools at gmail dot com
  2022-02-09  7:28 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2022-02-08 16:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 52376
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52376&action=edit
A patch

I am testing this.

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

* [Bug target/104441] [12 Regression] vzeroupper is placed at the wrong place
  2022-02-08 14:01 [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2022-02-08 16:08 ` hjl.tools at gmail dot com
@ 2022-02-09  7:28 ` rguenth at gcc dot gnu.org
  2022-02-09 12:30 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-09  7:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1
           Keywords|                            |wrong-code
             Target|x86-64                      |x86_64-*-* i?86-*-*

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

* [Bug target/104441] [12 Regression] vzeroupper is placed at the wrong place
  2022-02-08 14:01 [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2022-02-09  7:28 ` rguenth at gcc dot gnu.org
@ 2022-02-09 12:30 ` cvs-commit at gcc dot gnu.org
  2022-02-09 12:41 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-09 12:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:5390a2f191682dae3c6d1e1deac20e05be413514

commit r12-7125-g5390a2f191682dae3c6d1e1deac20e05be413514
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Jan 30 10:08:14 2022 -0800

    x86: Check each component of source operand for AVX_U128_DIRTY

    commit 9775e465c1fbfc32656de77c618c61acf5bd905d
    Author: H.J. Lu <hjl.tools@gmail.com>
    Date:   Tue Jul 27 07:46:04 2021 -0700

        x86: Don't set AVX_U128_DIRTY when zeroing YMM/ZMM register

    called ix86_check_avx_upper_register to check mode on source operand.
    But ix86_check_avx_upper_register doesn't work on source operand like

    (vec_select:V2DI (reg/v:V4DI 23 xmm3 [orig:91 ymm ] [91])
        (parallel [
                (const_int 2 [0x2])
                (const_int 3 [0x3])
            ]))

    Add ix86_avx_u128_mode_source to check mode for each component of source
    operand.

    gcc/

            PR target/104441
            * config/i386/i386.cc (ix86_avx_u128_mode_source): New function.
            (ix86_avx_u128_mode_needed): Return AVX_U128_ANY for debug INSN.
            Call ix86_avx_u128_mode_source to check mode for each component
            of source operand.

    gcc/testsuite/

            PR target/104441
            * gcc.target/i386/pr104441-1a.c: New test.
            * gcc.target/i386/pr104441-1b.c: Likewise.

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

* [Bug target/104441] [12 Regression] vzeroupper is placed at the wrong place
  2022-02-08 14:01 [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2022-02-09 12:30 ` cvs-commit at gcc dot gnu.org
@ 2022-02-09 12:41 ` hjl.tools at gmail dot com
  2022-02-09 19:53 ` cvs-commit at gcc dot gnu.org
  2022-05-23 23:57 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2022-02-09 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.

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

* [Bug target/104441] [12 Regression] vzeroupper is placed at the wrong place
  2022-02-08 14:01 [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2022-02-09 12:41 ` hjl.tools at gmail dot com
@ 2022-02-09 19:53 ` cvs-commit at gcc dot gnu.org
  2022-05-23 23:57 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-09 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:354349e7d59323559d0e372484f10358bd86a54f

commit r12-7149-g354349e7d59323559d0e372484f10358bd86a54f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Feb 9 11:48:58 2022 -0800

    x86: Compile PR target/104441 tests with -march=x86-64

    Compile PR target/104441 tests with -march=x86-64 to fix test failures
    when GCC is configured with --with-arch=native --with-cpu=native.

            PR target/104441
            * gcc.target/i386/pr104441-1a.c: Compile with -march=x86-64.
            * gcc.target/i386/pr104441-1b.c: Likewise.

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

* [Bug target/104441] [12 Regression] vzeroupper is placed at the wrong place
  2022-02-08 14:01 [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place hjl.tools at gmail dot com
                   ` (6 preceding siblings ...)
  2022-02-09 19:53 ` cvs-commit at gcc dot gnu.org
@ 2022-05-23 23:57 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-23 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

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

commit r13-718-gf1a80c05db8b08e71741bae8170f9e77e94bfc35
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon May 23 10:42:33 2022 -0700

    x86: Avoid uninitialized variable in PR target/104441 test

            PR target/104441
            * gcc.target/i386/pr104441-1a.c (load8bit_4x4_avx2): Initialize
            src23.

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

end of thread, other threads:[~2022-05-23 23:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 14:01 [Bug target/104441] New: [12 Regression] vzeroupper is placed at the wrong place hjl.tools at gmail dot com
2022-02-08 14:01 ` [Bug target/104441] " hjl.tools at gmail dot com
2022-02-08 14:30 ` hjl.tools at gmail dot com
2022-02-08 16:08 ` hjl.tools at gmail dot com
2022-02-09  7:28 ` rguenth at gcc dot gnu.org
2022-02-09 12:30 ` cvs-commit at gcc dot gnu.org
2022-02-09 12:41 ` hjl.tools at gmail dot com
2022-02-09 19:53 ` cvs-commit at gcc dot gnu.org
2022-05-23 23:57 ` cvs-commit 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).