public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gabravier at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/94908] New: Failure to optimally optimize certain shuffle patterns
Date: Fri, 01 May 2020 19:02:46 +0000	[thread overview]
Message-ID: <bug-94908-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 94908
           Summary: Failure to optimally optimize certain shuffle patterns
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

typedef float v4sf __attribute__((vector_size(16)));

v4sf g();

v4sf f(v4sf a, v4sf b)
{
    return (v4sf){g()[1], a[1], a[2], a[3]};
}

With -O3, LLVM outputs this :

f(float __vector(4), float __vector(4)): # @f(float __vector(4), float
__vector(4))
  sub rsp, 24
  movaps xmmword ptr [rsp], xmm0 # 16-byte Spill
  call g()
  movaps xmm1, xmmword ptr [rsp] # 16-byte Reload
  shufps xmm0, xmm1, 17 # xmm0 = xmm0[1,0],xmm1[1,0]
  shufps xmm0, xmm1, 232 # xmm0 = xmm0[0,2],xmm1[2,3]
  add rsp, 24
  ret

GCC outputs this : 

f(float __vector(4), float __vector(4)):
  sub rsp, 24
  movaps XMMWORD PTR [rsp], xmm0
  call g()
  movaps xmm1, XMMWORD PTR [rsp]
  add rsp, 24
  shufps xmm0, xmm0, 85
  movaps xmm2, xmm1
  shufps xmm2, xmm1, 85
  movaps xmm3, xmm2
  movaps xmm2, xmm1
  unpckhps xmm2, xmm1
  unpcklps xmm0, xmm3
  shufps xmm1, xmm1, 255
  unpcklps xmm2, xmm1
  movlhps xmm0, xmm2
  ret

This also seems to occurs on powerpc64le, so I haven't marked it as
target-specific.

             reply	other threads:[~2020-05-01 19:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 19:02 gabravier at gmail dot com [this message]
2020-05-01 21:24 ` [Bug tree-optimization/94908] " glisse at gcc dot gnu.org
2020-05-04  6:30 ` rguenth at gcc dot gnu.org
2023-02-17 20:49 ` gabravier at gmail dot com
2023-02-17 21:05 ` [Bug target/94908] " pinskia at gcc dot gnu.org
2023-02-18  9:35 ` ubizjak at gmail dot com
2023-02-20  3:32 ` crazylht at gmail dot com
2023-03-08 13:19 ` ubizjak at gmail dot com
2023-03-09  4:22 ` crazylht at gmail dot com
2023-03-09 14:27 ` ubizjak at gmail dot com
2023-03-09 14:32 ` ubizjak at gmail dot com
2023-04-18 16:59 ` cvs-commit at gcc dot gnu.org
2023-04-18 17:01 ` ubizjak at gmail dot com

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-94908-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).