public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/103850] missed optimization in AVX code
Date: Tue, 04 Jan 2022 13:55:47 +0000	[thread overview]
Message-ID: <bug-103850-4-DXuHH3gA2l@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103850-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note the issue can be reproduced without -ffast-math as well where the
functions are nearly identical so I fear you are running into some
micro-architectural hazard.  Maybe


.L3:
        vmovapd %ymm2, %ymm0
        vmovapd %ymm3, %ymm1
.L2:
        vbroadcastsd    (%rsi), %ymm2
        vbroadcastsd    8(%rsi), %ymm4
        addq    $32, %rdx
        addq    $16, %rsi
        vmovapd %ymm2, %ymm3
        vfmadd132pd     -32(%rsp), %ymm4, %ymm2
        vfmadd132pd     %ymm15, %ymm4, %ymm3
        vbroadcastsd    -24(%rdx), %ymm4
        vfmadd132pd     %ymm1, %ymm14, %ymm3
        vmovapd %ymm1, %ymm14
        vfmadd231pd     %ymm1, %ymm4, %ymm11
        vfmadd231pd     %ymm0, %ymm4, %ymm7
        vbroadcastsd    -8(%rdx), %ymm4
        vfmadd132pd     %ymm0, %ymm13, %ymm2
        vbroadcastsd    -32(%rdx), %ymm13
        vfmadd231pd     %ymm1, %ymm4, %ymm9
        vfmadd231pd     %ymm0, %ymm4, %ymm5
        vfmadd231pd     %ymm1, %ymm13, %ymm12
        vfmadd231pd     %ymm0, %ymm13, %ymm8
        vbroadcastsd    -16(%rdx), %ymm13
        vfmadd231pd     %ymm1, %ymm13, %ymm10
        vfmadd231pd     %ymm0, %ymm13, %ymm6
        vmovapd %ymm0, %ymm13
        cmpq    %rdx, %rax
        jne     .L3

is easier to handle since there's only one data dependence on the
addq $32, %rdx of the followup loads but for (slow)

.L8:
        vmovapd %ymm2, %ymm0
        vmovapd %ymm3, %ymm1
.L7:
        vbroadcastsd    8(%rdx), %ymm2
        vbroadcastsd    (%rdx), %ymm3
        addq    $16, %rsi
        addq    $32, %rdx
        vbroadcastsd    -8(%rsi), %ymm4
        vfmadd231pd     %ymm1, %ymm2, %ymm11
        vfmadd231pd     %ymm0, %ymm2, %ymm7
        vbroadcastsd    -8(%rdx), %ymm2
        vfmadd231pd     %ymm1, %ymm3, %ymm12
        vfmadd231pd     %ymm0, %ymm3, %ymm8
        vbroadcastsd    -16(%rdx), %ymm3
        vfmadd231pd     %ymm1, %ymm2, %ymm9
        vfmadd231pd     %ymm0, %ymm2, %ymm5
        vbroadcastsd    -16(%rsi), %ymm2
        vfmadd231pd     %ymm1, %ymm3, %ymm10
        vfmadd231pd     %ymm0, %ymm3, %ymm6
        vmovapd %ymm2, %ymm3
        vfmadd132pd     -32(%rsp), %ymm4, %ymm2
        vfmadd132pd     %ymm15, %ymm4, %ymm3
        vfmadd132pd     %ymm1, %ymm14, %ymm3
        vmovapd %ymm1, %ymm14
        vfmadd132pd     %ymm0, %ymm13, %ymm2
        vmovapd %ymm0, %ymm13
        cmpq    %rsi, %rax
        jne     .L8

both increments impose dependences on the following loads.

  parent reply	other threads:[~2022-01-04 13:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28 10:10 [Bug c/103850] New: " martin@mpa-garching.mpg.de
2021-12-28 10:24 ` [Bug target/103850] " pinskia at gcc dot gnu.org
2021-12-28 10:32 ` martin@mpa-garching.mpg.de
2021-12-28 10:41 ` martin@mpa-garching.mpg.de
2022-01-04 13:45 ` rguenth at gcc dot gnu.org
2022-01-04 13:55 ` rguenth at gcc dot gnu.org [this message]
2022-01-04 14:12 ` martin@mpa-garching.mpg.de

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-103850-4-DXuHH3gA2l@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).