public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Hongtao Liu <crazylht@gmail.com>
Cc: Uros Bizjak <ubizjak@gmail.com>, liuhongt <hongtao.liu@intel.com>,
	 GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v2] x86: Add TARGET_OMIT_VZEROUPPER_AFTER_AVX_READ_ZERO
Date: Tue, 22 Feb 2022 06:21:50 -0800	[thread overview]
Message-ID: <CAMe9rOp3PBVBeoBvKKoO5PK7n+yOquQL-_tL-7fiNKMdXm0O2w@mail.gmail.com> (raw)
In-Reply-To: <CAMZc-bxiUc+dwKEuepRecHsdHLcF4OVSWh7XWkiCCmAK974pPQ@mail.gmail.com>

On Mon, Feb 21, 2022 at 6:43 PM Hongtao Liu <crazylht@gmail.com> wrote:
>
> On Tue, Feb 22, 2022 at 2:35 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Sun, Feb 20, 2022 at 6:01 PM Hongtao Liu <crazylht@gmail.com> wrote:
> > >
> > > On Thu, Feb 17, 2022 at 9:56 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > On Thu, Feb 17, 2022 at 08:51:31AM +0100, Uros Bizjak wrote:
> > > > > On Thu, Feb 17, 2022 at 6:25 AM Hongtao Liu via Gcc-patches
> > > > > <gcc-patches@gcc.gnu.org> wrote:
> > > > > >
> > > > > > On Thu, Feb 17, 2022 at 12:26 PM H.J. Lu via Gcc-patches
> > > > > > <gcc-patches@gcc.gnu.org> wrote:
> > > > > > >
> > > > > > > Reading YMM registers with all zero bits needs VZEROUPPER on Sandy Bride,
> > > > > > > Ivy Bridge, Haswell, Broadwell and Alder Lake to avoid SSE <-> AVX
> > > > > > > transition penalty.  Add TARGET_READ_ZERO_YMM_ZMM_NEED_VZEROUPPER to
> > > > > > > generate vzeroupper instruction after loading all-zero YMM/YMM registers
> > > > > > > and enable it by default.
> > > > > > Shouldn't TARGET_READ_ZERO_YMM_ZMM_NONEED_VZEROUPPER sounds a bit smoother?
> > > > > > Because originally we needed to add vzeroupper to all avx<->sse cases,
> > > > > > now it's a tune to indicate that we don't need to add it in some
> > > > >
> > > > > Perhaps we should go from the other side and use
> > > > > X86_TUNE_OPTIMIZE_AVX_READ for new processors?
> > > > >
> > > >
> > > > Here is the v2 patch to add TARGET_OMIT_VZEROUPPER_AFTER_AVX_READ_ZERO.
> > > >
> > > The patch LGTM in general, but please rebase against
> > > https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590541.html
> > > and resend the patch, also wait a couple days in case Uros(and others)
> > > have any comments.
> >
> > I am dropping my patch since it causes the compile-time regression.
> I think only vextractif128 part is reverted, but we still have
> vmovdqu(below) which should also cause penalty?

commit fe79d652c96b53384ddfa43e312cb0010251391b
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Feb 17 14:40:16 2022 +0100

    target/104581 - compile-time regression in mode-switching

has

diff --git a/gcc/testsuite/gcc.target/i386/pr101456-1.c
b/gcc/testsuite/gcc.target/i386/pr101456-1.c
index 803fc6e0207..7fb3a3f055c 100644
--- a/gcc/testsuite/gcc.target/i386/pr101456-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr101456-1.c
@@ -30,4 +30,5 @@ foo3 (void)
   bar ();
 }

-/* { dg-final { scan-assembler-not "vzeroupper" } } */
+/* See PR104581 for the XFAIL reason.  */
+/* { dg-final { scan-assembler-not "vzeroupper" { xfail *-*-* } } } */

and I checked in:

commit 1931cbad498e625b1e24452dcfffe02539b12224
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Feb 18 10:36:53 2022 -0800

    pieces-memset-21.c: Expect vzeroupper for ia32

    Update gcc.target/i386/pieces-memset-21.c to expect vzeroupper for ia32
    caused by

    commit fe79d652c96b53384ddfa43e312cb0010251391b
    Author: Richard Biener <rguenther@suse.de>
    Date:   Thu Feb 17 14:40:16 2022 +0100

        target/104581 - compile-time regression in mode-switching

            PR target/104581
            * gcc.target/i386/pieces-memset-21.c: Expect vzeroupper for ia32.

I believe that vmovdqu is also covered.

-- 
H.J.

      reply	other threads:[~2022-02-22 14:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17  4:26 [PATCH] x86: Add TARGET_READ_ZERO_YMM_ZMM_NEED_VZEROUPPER H.J. Lu
2022-02-17  5:33 ` Hongtao Liu
2022-02-17  7:51   ` Uros Bizjak
2022-02-17  9:49     ` Richard Biener
2022-02-17 13:57       ` H.J. Lu
2022-02-17 13:56     ` [PATCH v2] x86: Add TARGET_OMIT_VZEROUPPER_AFTER_AVX_READ_ZERO H.J. Lu
2022-02-21  2:01       ` Hongtao Liu
2022-02-21 18:35         ` H.J. Lu
2022-02-22  2:43           ` Hongtao Liu
2022-02-22 14:21             ` H.J. Lu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMe9rOp3PBVBeoBvKKoO5PK7n+yOquQL-_tL-7fiNKMdXm0O2w@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongtao.liu@intel.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).