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 tree-optimization/54939] Very poor vectorization of loops with complex arithmetic
Date: Fri, 21 Jul 2023 12:28:10 +0000	[thread overview]
Message-ID: <bug-54939-4-RUWViAOLeQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54939-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |crazylht at gmail dot com

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
With SSE4.2 we now get

.L3:
        movupd  (%rdx,%rax), %xmm0
        movupd  (%rcx,%rax), %xmm4
        movapd  %xmm0, %xmm1
        palignr $8, %xmm0, %xmm0
        mulpd   %xmm3, %xmm1
        mulpd   %xmm2, %xmm0
        addpd   %xmm4, %xmm1
        addsubpd        %xmm0, %xmm1
        movups  %xmm1, (%rcx,%rax)
        addq    $16, %rax
        cmpq    %rsi, %rax
        jne     .L3

with AVX and FMA

.L4:
        vmovupd (%rdx,%rax), %ymm0
        vmovapd %ymm4, %ymm1
        vfmadd213pd     (%rcx,%rax), %ymm0, %ymm1
        vpermilpd       $5, %ymm0, %ymm0
        vmulpd  %ymm3, %ymm0, %ymm0
        vaddsubpd       %ymm0, %ymm1, %ymm1
        vmovupd %ymm1, (%rcx,%rax)
        addq    $32, %rax
        cmpq    %rsi, %rax
        jne     .L4

so I'd say fixed.  But.  With AVX512 we now get

.L4:
        vmovupd (%rdi,%rax), %zmm0
        vmovapd %zmm7, %zmm2
        vmovapd %zmm4, %zmm6
        vfmadd213pd     (%rcx,%rax), %zmm0, %zmm2
        vpermilpd       $85, %zmm0, %zmm0
        vfmadd132pd     %zmm0, %zmm2, %zmm6
        vfnmadd132pd    %zmm4, %zmm2, %zmm0
        vmovapd %zmm6, %zmm0{%k1}
        vmovupd %zmm0, (%rcx,%rax)
        addq    $64, %rax
        cmpq    %rax, %rsi
        jne     .L4

it's odd that this only happens with -mprefer-vector-width=512 though.  Do
we possibly miss vec_{fm,}{addsub,subadd} for those?  Looks like so.

Tracking in PR110767.  The vectorizer side is fixed.

  parent reply	other threads:[~2023-07-21 12:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-16 14:22 [Bug tree-optimization/54939] New: " ysrumyan at gmail dot com
2012-10-16 14:37 ` [Bug tree-optimization/54939] " rguenth at gcc dot gnu.org
2012-10-16 14:55 ` ysrumyan at gmail dot com
2012-10-16 15:06 ` ysrumyan at gmail dot com
2012-10-16 15:32 ` rguenth at gcc dot gnu.org
2013-03-27 11:19 ` rguenth at gcc dot gnu.org
2023-07-21 12:28 ` rguenth at gcc dot gnu.org [this message]
2023-07-21 12:31 ` rguenth 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-54939-4-RUWViAOLeQ@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).