public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/101579] Suboptimal codegen for __builtin_shufflevector
Date: Tue, 27 Jul 2021 10:35:47 +0000	[thread overview]
Message-ID: <bug-101579-4-ZrhNc3iGGF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101579-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
As
typedef unsigned char V __attribute__((vector_size (32)));

V
foo (V x)
{
  return __builtin_shufflevector (x, x, 0, 1, 2, 0, 5, 1, 0, 1, 3, 2, 3, 0, 4,
3, 1, 2,
                                        2, 0, 4, 2, 3, 1, 1, 2, 3, 4, 1, 1, 0,
0, 5, 2);
}

V
bar (V x)
{
  return __builtin_shufflevector (x, x, 0, 3, 3, 3, 3, 4, 5, 0, 1, 5, 2, 1, 0,
1, 1, 2,
                                        3, 2, 0, 5, 4, 5, 1, 0, 1, 4, 4, 3, 4,
5, 2, 0);
}
with -O2 -mavx2 is handled, I'd say this is veclower task to determine that the
particular permutation could be cheaply implemented with two permutations of
half-sized vectors and ask the backend if it supports those.
Of course there can be other permutations that can't be implemented that way
easily and might e.g. need more half-sized permutations...

  parent reply	other threads:[~2021-07-27 10:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 12:41 [Bug target/101579] New: " hjl.tools at gmail dot com
2021-07-27 10:14 ` [Bug target/101579] " rguenth at gcc dot gnu.org
2021-07-27 10:35 ` jakub at gcc dot gnu.org [this message]
2021-07-28  9:01 ` crazylht at gmail dot com
2021-07-28  9:40 ` crazylht at gmail dot com
2021-07-28  9:45 ` crazylht at gmail dot com
2021-07-28  9:49 ` jakub at gcc dot gnu.org
2021-07-28 10:03 ` crazylht at gmail dot com
2021-07-28 10:12 ` crazylht 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-101579-4-ZrhNc3iGGF@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).