public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "liuhongt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/112891] New: [10/11/12/13/14 Regression] Missing vzeroupper insert.
Date: Thu, 07 Dec 2023 00:59:22 +0000	[thread overview]
Message-ID: <bug-112891-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 112891
           Summary: [10/11/12/13/14 Regression] Missing vzeroupper insert.
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liuhongt at gcc dot gnu.org
  Target Milestone: ---

#include<math.h>
void
__attribute__((noinline))
bar (double* a)
{
    a[0] = 1.0;
    a[1] = 2.0;
}

void
__attribute__((noinline))
foo (double* __restrict a, double* b)
{
    a[0] += b[0];
    a[1] += b[1];
    a[2] += b[2];
    a[3] += b[3];
    bar (b);
}

double
foo1 (double* __restrict a, double* b)
{
    foo (a, b);
    return exp (b[1]);
}


gcc -O3 -mavx2 Got

bar(double*):
        vmovapd xmm0, XMMWORD PTR .LC0[rip]
        vmovupd XMMWORD PTR [rdi], xmm0
        ret
foo(double*, double*):
        mov     rax, rdi
        vmovupd ymm0, YMMWORD PTR [rsi]
        mov     rdi, rsi
        vaddpd  ymm0, ymm0, YMMWORD PTR [rax]
        vmovupd YMMWORD PTR [rax], ymm0
        jmp     bar(double*)
foo1(double*, double*):
        sub     rsp, 8
        call    foo(double*, double*)
        vmovsd  xmm0, QWORD PTR [rsi+8]
        add     rsp, 8
        jmp     exp
.LC0:
        .long   0
        .long   1072693248
        .long   0
        .long   1073741824

In foo, 256-bit ymm are used, and the upper bits are dirty, but there's no
vzeroupper inserted by exp which cause big avx->sse transition penalty.

             reply	other threads:[~2023-12-07  0:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07  0:59 liuhongt at gcc dot gnu.org [this message]
2023-12-07  1:10 ` [Bug target/112891] " liuhongt at gcc dot gnu.org
2023-12-07  5:04 ` liuhongt at gcc dot gnu.org
2023-12-07  6:13 ` liuhongt at gcc dot gnu.org
2023-12-07  8:18 ` [Bug target/112891] [11/12/13/14 " rguenth at gcc dot gnu.org
2023-12-07 17:00 ` rsandifo at gcc dot gnu.org
2023-12-12  5:24 ` cvs-commit at gcc dot gnu.org
2023-12-12 10:48 ` cvs-commit at gcc dot gnu.org
2023-12-12 10:48 ` cvs-commit at gcc dot gnu.org
2023-12-12 10:49 ` cvs-commit at gcc dot gnu.org
2023-12-12 10:50 ` liuhongt at gcc dot gnu.org

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=bug-112891-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).