gcc/libstdc++-v3
Jakub Jelinek 84185598dc 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.
2021-03-06 11:11:30 +01:00
..
config libstdc++: Update Solaris baselines for GCC 11.1 2021-03-03 14:25:51 +01:00
doc libstdc++: Document library versioning for GCC 11 2021-02-25 15:35:59 +00:00
include libstdc++: Improve std::rot[lr] [PR99396] 2021-03-06 11:11:30 +01:00
libsupc++ PR c++/99074 - crash in dynamic_cast<>() on null pointer 2021-02-23 14:14:20 -07:00
po Update copyright years. 2021-01-04 10:26:59 +01:00
python Update copyright years. 2021-01-04 10:26:59 +01:00
scripts libstdc++: Add simd testsuite 2021-01-27 16:37:26 +00:00
src libstdc++: Fix order of arguments to sprintf [PR 99261] 2021-02-24 22:33:59 +00:00
testsuite libstdc++: Fix buffer overflows in tests [PR 99382] 2021-03-04 10:31:27 +00:00
ChangeLog Daily bump. 2021-03-05 00:16:21 +00:00
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
ChangeLog-2020 libstdc++: Fix typo in ChangeLog-2020 2021-01-13 11:02:13 +00:00
Makefile.am Update copyright years. 2021-01-04 10:26:59 +01:00
Makefile.in libstdc++: Add C++ runtime support for new 128-bit long double format 2020-12-16 23:25:01 +00:00
README
acinclude.m4 libstdc++: Test errno macros directly, not via autoconf [PR 93151] 2020-12-16 13:36:02 +00:00
aclocal.m4
config.h.in libstdc++: Regenerate autoconf files 2020-12-17 14:02:59 +00:00
configure Update GNU/Hurd configure support 2021-01-05 16:04:14 -07:00
configure.ac libstdc++: Add C++ runtime support for new 128-bit long double format 2020-12-16 23:25:01 +00:00
configure.host
crossconfig.m4
fragment.am libstdc++: Add C++ runtime support for new 128-bit long double format 2020-12-16 23:25:01 +00:00
linkage.m4

README

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.