public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/99396] std::rotl and std::rotr Does not convert into ROTATE on the gimple level
Date: Sat, 06 Mar 2021 10:12:49 +0000	[thread overview]
Message-ID: <bug-99396-4-imgowhQ4uf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99396-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:84185598dc7470bad4e7f8c22b64e3c944efb670

commit r11-7542-g84185598dc7470bad4e7f8c22b64e3c944efb670
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Mar 6 11:11:30 2021 +0100

    libstdc++: Improve std::rot[lr] [PR99396]

    As can be seen on:

    unsigned char f1 (unsigned char x, int y) { return std::rotl (x, y); }
    unsigned char f2 (unsigned char x, int y) { return std::rotr (x, y); }
    unsigned short f3 (unsigned short x, int y) { return std::rotl (x, y); }
    unsigned short f4 (unsigned short x, int y) { return std::rotr (x, y); }
    unsigned int f5 (unsigned int x, int y) { return std::rotl (x, y); }
    unsigned int f6 (unsigned int x, int y) { return std::rotr (x, y); }
    unsigned long int f7 (unsigned long int x, int y) { return std::rotl (x,
y); }
    unsigned long int f8 (unsigned long int x, int y) { return std::rotr (x,
y); }
    unsigned long long int f9 (unsigned long long int x, int y) { return
std::rotl (x, y); }
    unsigned long long int f10 (unsigned long long int x, int y) { return
std::rotr (x, y); }
    //unsigned __int128 f11 (unsigned __int128 x, int y) { return std::rotl (x,
y); }
    //unsigned __int128 f12 (unsigned __int128 x, int y) { return std::rotr (x,
y); }

    constexpr auto a = std::rotl (1234U, 0);
    constexpr auto b = std::rotl (1234U, 5);
    constexpr auto c = std::rotl (1234U, -5);
    constexpr auto d = std::rotl (1234U, -__INT_MAX__ - 1);
    the current <bit> definitions of std::__rot[lr] aren't pattern recognized
    as rotates, they are too long/complex for that, starting with signed
modulo,
    special case for 0 and different cases for positive and negative.

    For types with power of two bits the following patch adds definitions that
    the compiler can pattern recognize and turn e.g. on x86_64 into
ro[lr][bwlq]
    instructions.  For weirdo types like unsigned __int20 etc. it keeps the
    current definitions.

    2021-03-06  Jakub Jelinek  <jakub@redhat.com>

            PR libstdc++/99396
            * include/std/bit (__rotl, __rotr): Add optimized variants for
power of
            two _Nd which the compiler can pattern match the rotates.

  parent reply	other threads:[~2021-03-06 10:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 23:09 [Bug libstdc++/99396] New: std::rotl and std::rotr do not invoke intrinsics, leading to serious performance issues unlvsur at live dot com
2021-03-05  0:05 ` [Bug tree-optimization/99396] " pinskia at gcc dot gnu.org
2021-03-05  0:06 ` [Bug tree-optimization/99396] std::rotl and std::rotr Does not convert into ROTATE on the gimple level pinskia at gcc dot gnu.org
2021-03-05  2:08 ` unlvsur at live dot com
2021-03-05  3:12 ` pinskia at gcc dot gnu.org
2021-03-05  3:18 ` unlvsur at live dot com
2021-03-05  8:25 ` redi at gcc dot gnu.org
2021-03-05  9:36 ` jakub at gcc dot gnu.org
2021-03-05  9:44 ` jakub at gcc dot gnu.org
2021-03-05  9:50 ` jakub at gcc dot gnu.org
2021-03-05 10:38 ` jakub at gcc dot gnu.org
2021-03-05 10:47 ` redi at gcc dot gnu.org
2021-03-05 10:52 ` jakub at gcc dot gnu.org
2021-03-05 11:02 ` jakub at gcc dot gnu.org
2021-03-05 11:59 ` unlvsur at live dot com
2021-03-05 12:03 ` jakub at gcc dot gnu.org
2021-03-05 12:04 ` jakub at gcc dot gnu.org
2021-03-05 12:08 ` unlvsur at live dot com
2021-03-05 12:09 ` unlvsur at live dot com
2021-03-05 12:12 ` unlvsur at live dot com
2021-03-06 10:12 ` cvs-commit at gcc dot gnu.org [this message]
2021-03-06 10:13 ` jakub 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-99396-4-imgowhQ4uf@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).