about summary refs log tree commit diff
path: root/manual
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-01-31 19:17:27 +0100
committerJakub Jelinek <jakub@redhat.com>2024-01-31 19:17:27 +0100
commitda89496337b97e6a2aaf1e81d55cf998f6db1070 (patch)
tree387c162fccd66a88e5663ee69e0ee131f183615d /manual
parent903cd866060555c77abbf70d0d85994ec5a18193 (diff)
downloadglibc-da89496337b97e6a2aaf1e81d55cf998f6db1070.tar.gz
glibc-da89496337b97e6a2aaf1e81d55cf998f6db1070.tar.xz
glibc-da89496337b97e6a2aaf1e81d55cf998f6db1070.zip
Use gcc __builtin_stdc_* builtins in stdbit.h if possible
The following patch uses the GCC 14 __builtin_stdc_* builtins in stdbit.h
for the type-generic macros, so that when compiled with GCC 14 or later,
it supports not just 8/16/32/64-bit unsigned integers, but also 128-bit
(if target supports them) and unsigned _BitInt (any supported precision).
And so that the macros don't expand arguments multiple times and can be
evaluated in constant expressions.

The new testcase is gcc's gcc/testsuite/gcc.dg/builtin-stdc-bit-1.c
adjusted to test stdbit.h and the type-generic macros in there instead
of the builtins and adjusted to use glibc test framework rather than
gcc style tests with __builtin_abort ().

Signed-off-by: Jakub Jelinek <jakub@redhat.com>
Reviewed-by: Joseph Myers <josmyers@redhat.com>
Diffstat (limited to 'manual')
-rw-r--r--manual/stdbit.texi8
1 files changed, 7 insertions, 1 deletions
diff --git a/manual/stdbit.texi b/manual/stdbit.texi
index fe41c671d8..8688930f12 100644
--- a/manual/stdbit.texi
+++ b/manual/stdbit.texi
@@ -32,7 +32,13 @@ and @code{unsigned long long int}.  In addition, there is a
 corresponding type-generic macro (not listed below), named the same as
 the functions but without any suffix such as @samp{_uc}.  The
 type-generic macro can only be used with an argument of an unsigned
-integer type with a width of 8, 16, 32 or 64 bits.
+integer type with a width of 8, 16, 32 or 64 bits, or when using
+a compiler with support for
+@uref{https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html@code{__builtin_stdc_bit_ceil}},
+etc.@:, built-in functions such as GCC 14.1 or later
+any unsigned integer type those built-in functions support.
+In GCC 14.1 that includes support for @code{unsigned __int128} and
+@code{unsigned _BitInt(@var{n})} if supported by the target.
 
 @deftypefun {unsigned int} stdc_leading_zeros_uc (unsigned char @var{x})
 @deftypefunx {unsigned int} stdc_leading_zeros_us (unsigned short @var{x})