about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2024-01-03 12:07:14 +0000
committerJoseph Myers <jsm@polyomino.org.uk>2024-01-03 12:07:14 +0000
commitb34b46b8806a115b86da3b2b22555ad5bffa89d1 (patch)
treec386e5b6064843e19c7079ea15d3f0610aa5ce1a /stdlib
parentfe316dad7ccfe44e9d649727b04cd36708477545 (diff)
downloadglibc-b34b46b8806a115b86da3b2b22555ad5bffa89d1.tar.gz
glibc-b34b46b8806a115b86da3b2b22555ad5bffa89d1.tar.xz
glibc-b34b46b8806a115b86da3b2b22555ad5bffa89d1.zip
Implement C23 <stdbit.h>
C23 adds a header <stdbit.h> with various functions and type-generic
macros for bit-manipulation of unsigned integers (plus macro defines
related to endianness).  Implement this header for glibc.

The functions have both inline definitions in the header (referenced
by macros defined in the header) and copies with external linkage in
the library (which are implemented in terms of those macros to avoid
duplication).  They are documented in the glibc manual.  Tests, as
well as verifying results for various inputs (of both the macros and
the out-of-line functions), verify the types of those results (which
showed up a bug in an earlier version with the type-generic macro
stdc_has_single_bit wrongly returning a promoted type), that the
macros can be used at top level in a source file (so don't use ({})),
that they evaluate their arguments exactly once, and that the macros
for the type-specific functions have the expected implicit conversions
to the relevant argument type.

Jakub previously referred to -Wconversion warnings in type-generic
macros, so I've included a test with -Wconversion (but the only
warnings I saw and fixed from that test were actually in inline
functions in the <stdbit.h> header - not anything coming from use of
the type-generic macros themselves).

This implementation of the type-generic macros does not handle
unsigned __int128, or unsigned _BitInt types with a width other than
that of a standard integer type (and C23 doesn't require the header to
handle such types either).  Support for those types, using the new
type-generic built-in functions Jakub's added for GCC 14, can
reasonably be added in a followup (along of course with associated
tests).

This implementation doesn't do anything special to handle C++, or have
any tests of functionality in C++ beyond the existing tests that all
headers can be compiled in C++ code; it's not clear exactly what form
this header should take in C++, but probably not one using macros.

DIS ballot comment AT-107 asks for the word "count" to be added to the
names of the stdc_leading_zeros, stdc_leading_ones,
stdc_trailing_zeros and stdc_trailing_ones functions and macros.  I
don't think it's likely to be accepted (accepting any technical
comments would mean having an FDIS ballot), but if it is accepted at
the WG14 meeting (22-26 January in Strasbourg, starting with DIS
ballot comment handling) then there would still be time to update
glibc for the renaming before the 2.39 release.

The new functions and header are placed in the stdlib/ directory in
glibc, rather than creating a new toplevel stdbit/ or putting them in
string/ alongside ffs.

Tested for x86_64 and x86.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/Makefile103
-rw-r--r--stdlib/Versions72
-rw-r--r--stdlib/stdbit.h773
-rw-r--r--stdlib/stdc_bit_ceil_uc.c25
-rw-r--r--stdlib/stdc_bit_ceil_ui.c25
-rw-r--r--stdlib/stdc_bit_ceil_ul.c25
-rw-r--r--stdlib/stdc_bit_ceil_ull.c25
-rw-r--r--stdlib/stdc_bit_ceil_us.c25
-rw-r--r--stdlib/stdc_bit_floor_uc.c25
-rw-r--r--stdlib/stdc_bit_floor_ui.c25
-rw-r--r--stdlib/stdc_bit_floor_ul.c25
-rw-r--r--stdlib/stdc_bit_floor_ull.c25
-rw-r--r--stdlib/stdc_bit_floor_us.c25
-rw-r--r--stdlib/stdc_bit_width_uc.c25
-rw-r--r--stdlib/stdc_bit_width_ui.c25
-rw-r--r--stdlib/stdc_bit_width_ul.c25
-rw-r--r--stdlib/stdc_bit_width_ull.c25
-rw-r--r--stdlib/stdc_bit_width_us.c25
-rw-r--r--stdlib/stdc_count_ones_uc.c25
-rw-r--r--stdlib/stdc_count_ones_ui.c25
-rw-r--r--stdlib/stdc_count_ones_ul.c25
-rw-r--r--stdlib/stdc_count_ones_ull.c25
-rw-r--r--stdlib/stdc_count_ones_us.c25
-rw-r--r--stdlib/stdc_count_zeros_uc.c25
-rw-r--r--stdlib/stdc_count_zeros_ui.c25
-rw-r--r--stdlib/stdc_count_zeros_ul.c25
-rw-r--r--stdlib/stdc_count_zeros_ull.c25
-rw-r--r--stdlib/stdc_count_zeros_us.c25
-rw-r--r--stdlib/stdc_first_leading_one_uc.c25
-rw-r--r--stdlib/stdc_first_leading_one_ui.c25
-rw-r--r--stdlib/stdc_first_leading_one_ul.c25
-rw-r--r--stdlib/stdc_first_leading_one_ull.c25
-rw-r--r--stdlib/stdc_first_leading_one_us.c25
-rw-r--r--stdlib/stdc_first_leading_zero_uc.c25
-rw-r--r--stdlib/stdc_first_leading_zero_ui.c25
-rw-r--r--stdlib/stdc_first_leading_zero_ul.c25
-rw-r--r--stdlib/stdc_first_leading_zero_ull.c25
-rw-r--r--stdlib/stdc_first_leading_zero_us.c25
-rw-r--r--stdlib/stdc_first_trailing_one_uc.c25
-rw-r--r--stdlib/stdc_first_trailing_one_ui.c25
-rw-r--r--stdlib/stdc_first_trailing_one_ul.c25
-rw-r--r--stdlib/stdc_first_trailing_one_ull.c25
-rw-r--r--stdlib/stdc_first_trailing_one_us.c25
-rw-r--r--stdlib/stdc_first_trailing_zero_uc.c25
-rw-r--r--stdlib/stdc_first_trailing_zero_ui.c25
-rw-r--r--stdlib/stdc_first_trailing_zero_ul.c25
-rw-r--r--stdlib/stdc_first_trailing_zero_ull.c25
-rw-r--r--stdlib/stdc_first_trailing_zero_us.c25
-rw-r--r--stdlib/stdc_has_single_bit_uc.c25
-rw-r--r--stdlib/stdc_has_single_bit_ui.c25
-rw-r--r--stdlib/stdc_has_single_bit_ul.c25
-rw-r--r--stdlib/stdc_has_single_bit_ull.c25
-rw-r--r--stdlib/stdc_has_single_bit_us.c25
-rw-r--r--stdlib/stdc_leading_ones_uc.c25
-rw-r--r--stdlib/stdc_leading_ones_ui.c25
-rw-r--r--stdlib/stdc_leading_ones_ul.c25
-rw-r--r--stdlib/stdc_leading_ones_ull.c25
-rw-r--r--stdlib/stdc_leading_ones_us.c25
-rw-r--r--stdlib/stdc_leading_zeros_uc.c25
-rw-r--r--stdlib/stdc_leading_zeros_ui.c25
-rw-r--r--stdlib/stdc_leading_zeros_ul.c25
-rw-r--r--stdlib/stdc_leading_zeros_ull.c25
-rw-r--r--stdlib/stdc_leading_zeros_us.c25
-rw-r--r--stdlib/stdc_trailing_ones_uc.c25
-rw-r--r--stdlib/stdc_trailing_ones_ui.c25
-rw-r--r--stdlib/stdc_trailing_ones_ul.c25
-rw-r--r--stdlib/stdc_trailing_ones_ull.c25
-rw-r--r--stdlib/stdc_trailing_ones_us.c25
-rw-r--r--stdlib/stdc_trailing_zeros_uc.c25
-rw-r--r--stdlib/stdc_trailing_zeros_ui.c25
-rw-r--r--stdlib/stdc_trailing_zeros_ul.c25
-rw-r--r--stdlib/stdc_trailing_zeros_ull.c25
-rw-r--r--stdlib/stdc_trailing_zeros_us.c25
-rw-r--r--stdlib/stdint.h13
-rw-r--r--stdlib/tst-stdbit-Wconversion.c107
-rw-r--r--stdlib/tst-stdbit.h198
-rw-r--r--stdlib/tst-stdc_bit_ceil.c88
-rw-r--r--stdlib/tst-stdc_bit_floor.c88
-rw-r--r--stdlib/tst-stdc_bit_width.c88
-rw-r--r--stdlib/tst-stdc_count_ones.c88
-rw-r--r--stdlib/tst-stdc_count_zeros.c88
-rw-r--r--stdlib/tst-stdc_first_leading_one.c88
-rw-r--r--stdlib/tst-stdc_first_leading_zero.c88
-rw-r--r--stdlib/tst-stdc_first_trailing_one.c88
-rw-r--r--stdlib/tst-stdc_first_trailing_zero.c88
-rw-r--r--stdlib/tst-stdc_has_single_bit.c88
-rw-r--r--stdlib/tst-stdc_leading_ones.c88
-rw-r--r--stdlib/tst-stdc_leading_zeros.c88
-rw-r--r--stdlib/tst-stdc_trailing_ones.c88
-rw-r--r--stdlib/tst-stdc_trailing_zeros.c88
90 files changed, 4236 insertions, 12 deletions
diff --git a/stdlib/Makefile b/stdlib/Makefile
index f166ec6c80..bed39b8258 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -28,6 +28,7 @@ headers := \
   bits/indirect-return.h \
   bits/monetary-ldbl.h \
   bits/stdint-intn.h \
+  bits/stdint-least.h \
   bits/stdint-uintn.h \
   bits/stdlib-bsearch.h \
   bits/stdlib-float.h \
@@ -41,6 +42,7 @@ headers := \
   fmtmsg.h \
   inttypes.h \
   monetary.h \
+  stdbit.h \
   stdint.h \
   stdlib.h \
   sys/errno.h \
@@ -115,6 +117,76 @@ routines := \
   setenv \
   srand48 \
   srand48_r \
+  stdc_bit_ceil_uc \
+  stdc_bit_ceil_ui \
+  stdc_bit_ceil_ul \
+  stdc_bit_ceil_ull \
+  stdc_bit_ceil_us \
+  stdc_bit_floor_uc \
+  stdc_bit_floor_ui \
+  stdc_bit_floor_ul \
+  stdc_bit_floor_ull \
+  stdc_bit_floor_us \
+  stdc_bit_width_uc \
+  stdc_bit_width_ui \
+  stdc_bit_width_ul \
+  stdc_bit_width_ull \
+  stdc_bit_width_us \
+  stdc_count_ones_uc \
+  stdc_count_ones_ui \
+  stdc_count_ones_ul \
+  stdc_count_ones_ull \
+  stdc_count_ones_us \
+  stdc_count_zeros_uc \
+  stdc_count_zeros_ui \
+  stdc_count_zeros_ul \
+  stdc_count_zeros_ull \
+  stdc_count_zeros_us \
+  stdc_first_leading_one_uc \
+  stdc_first_leading_one_ui \
+  stdc_first_leading_one_ul \
+  stdc_first_leading_one_ull \
+  stdc_first_leading_one_us \
+  stdc_first_leading_zero_uc \
+  stdc_first_leading_zero_ui \
+  stdc_first_leading_zero_ul \
+  stdc_first_leading_zero_ull \
+  stdc_first_leading_zero_us \
+  stdc_first_trailing_one_uc \
+  stdc_first_trailing_one_ui \
+  stdc_first_trailing_one_ul \
+  stdc_first_trailing_one_ull \
+  stdc_first_trailing_one_us \
+  stdc_first_trailing_zero_uc \
+  stdc_first_trailing_zero_ui \
+  stdc_first_trailing_zero_ul \
+  stdc_first_trailing_zero_ull \
+  stdc_first_trailing_zero_us \
+  stdc_has_single_bit_uc \
+  stdc_has_single_bit_ui \
+  stdc_has_single_bit_ul \
+  stdc_has_single_bit_ull \
+  stdc_has_single_bit_us \
+  stdc_leading_ones_uc \
+  stdc_leading_ones_ui \
+  stdc_leading_ones_ul \
+  stdc_leading_ones_ull \
+  stdc_leading_ones_us \
+  stdc_leading_zeros_uc \
+  stdc_leading_zeros_ui \
+  stdc_leading_zeros_ul \
+  stdc_leading_zeros_ull \
+  stdc_leading_zeros_us \
+  stdc_trailing_ones_uc \
+  stdc_trailing_ones_ui \
+  stdc_trailing_ones_ul \
+  stdc_trailing_ones_ull \
+  stdc_trailing_ones_us \
+  stdc_trailing_zeros_uc \
+  stdc_trailing_zeros_ui \
+  stdc_trailing_zeros_ul \
+  stdc_trailing_zeros_ull \
+  stdc_trailing_zeros_us \
   strfmon \
   strfmon_l \
   strfromd \
@@ -236,6 +308,21 @@ tests := \
   tst-setcontext9 \
   tst-setcontext10 \
   tst-setcontext11 \
+  tst-stdbit-Wconversion \
+  tst-stdc_bit_ceil \
+  tst-stdc_bit_floor \
+  tst-stdc_bit_width \
+  tst-stdc_count_ones \
+  tst-stdc_count_zeros \
+  tst-stdc_first_leading_one \
+  tst-stdc_first_leading_zero \
+  tst-stdc_first_trailing_one \
+  tst-stdc_first_trailing_zero \
+  tst-stdc_has_single_bit \
+  tst-stdc_leading_ones \
+  tst-stdc_leading_zeros \
+  tst-stdc_trailing_ones \
+  tst-stdc_trailing_zeros \
   tst-strfmon_l \
   tst-strfrom \
   tst-strfrom-locale \
@@ -307,6 +394,22 @@ CFLAGS-tst-abs.c += -fno-builtin
 CFLAGS-tst-labs.c += -fno-builtin
 CFLAGS-tst-llabs.c += -fno-builtin
 
+CFLAGS-tst-stdbit-Wconversion.c += -Wconversion -Werror
+CFLAGS-tst-stdc_trailing_zeros.c += -fno-builtin
+CFLAGS-tst-stdc_trailing_ones.c += -fno-builtin
+CFLAGS-tst-stdc_leading_zeros.c += -fno-builtin
+CFLAGS-tst-stdc_leading_ones.c += -fno-builtin
+CFLAGS-tst-stdc_has_single_bit.c += -fno-builtin
+CFLAGS-tst-stdc_first_trailing_zero.c += -fno-builtin
+CFLAGS-tst-stdc_first_trailing_one.c += -fno-builtin
+CFLAGS-tst-stdc_first_leading_zero.c += -fno-builtin
+CFLAGS-tst-stdc_first_leading_one.c += -fno-builtin
+CFLAGS-tst-stdc_count_zeros.c += -fno-builtin
+CFLAGS-tst-stdc_count_ones.c += -fno-builtin
+CFLAGS-tst-stdc_bit_width.c += -fno-builtin
+CFLAGS-tst-stdc_bit_floor.c += -fno-builtin
+CFLAGS-tst-stdc_bit_ceil.c += -fno-builtin
+
 ifeq ($(have-cxx-thread_local),yes)
 CFLAGS-tst-quick_exit.o = -std=c++11
 LDLIBS-tst-quick_exit = -lstdc++
diff --git a/stdlib/Versions b/stdlib/Versions
index 6a861c54a1..ea2265bbd4 100644
--- a/stdlib/Versions
+++ b/stdlib/Versions
@@ -151,6 +151,78 @@ libc {
     __isoc23_strtoimax;
     __isoc23_strtoumax;
   }
+  GLIBC_2.39 {
+    stdc_leading_zeros_uc;
+    stdc_leading_zeros_us;
+    stdc_leading_zeros_ui;
+    stdc_leading_zeros_ul;
+    stdc_leading_zeros_ull;
+    stdc_leading_ones_uc;
+    stdc_leading_ones_us;
+    stdc_leading_ones_ui;
+    stdc_leading_ones_ul;
+    stdc_leading_ones_ull;
+    stdc_trailing_zeros_uc;
+    stdc_trailing_zeros_us;
+    stdc_trailing_zeros_ui;
+    stdc_trailing_zeros_ul;
+    stdc_trailing_zeros_ull;
+    stdc_trailing_ones_uc;
+    stdc_trailing_ones_us;
+    stdc_trailing_ones_ui;
+    stdc_trailing_ones_ul;
+    stdc_trailing_ones_ull;
+    stdc_first_leading_zero_uc;
+    stdc_first_leading_zero_us;
+    stdc_first_leading_zero_ui;
+    stdc_first_leading_zero_ul;
+    stdc_first_leading_zero_ull;
+    stdc_first_leading_one_uc;
+    stdc_first_leading_one_us;
+    stdc_first_leading_one_ui;
+    stdc_first_leading_one_ul;
+    stdc_first_leading_one_ull;
+    stdc_first_trailing_zero_uc;
+    stdc_first_trailing_zero_us;
+    stdc_first_trailing_zero_ui;
+    stdc_first_trailing_zero_ul;
+    stdc_first_trailing_zero_ull;
+    stdc_first_trailing_one_uc;
+    stdc_first_trailing_one_us;
+    stdc_first_trailing_one_ui;
+    stdc_first_trailing_one_ul;
+    stdc_first_trailing_one_ull;
+    stdc_count_zeros_uc;
+    stdc_count_zeros_us;
+    stdc_count_zeros_ui;
+    stdc_count_zeros_ul;
+    stdc_count_zeros_ull;
+    stdc_count_ones_uc;
+    stdc_count_ones_us;
+    stdc_count_ones_ui;
+    stdc_count_ones_ul;
+    stdc_count_ones_ull;
+    stdc_has_single_bit_uc;
+    stdc_has_single_bit_us;
+    stdc_has_single_bit_ui;
+    stdc_has_single_bit_ul;
+    stdc_has_single_bit_ull;
+    stdc_bit_width_uc;
+    stdc_bit_width_us;
+    stdc_bit_width_ui;
+    stdc_bit_width_ul;
+    stdc_bit_width_ull;
+    stdc_bit_floor_uc;
+    stdc_bit_floor_us;
+    stdc_bit_floor_ui;
+    stdc_bit_floor_ul;
+    stdc_bit_floor_ull;
+    stdc_bit_ceil_uc;
+    stdc_bit_ceil_us;
+    stdc_bit_ceil_ui;
+    stdc_bit_ceil_ul;
+    stdc_bit_ceil_ull;
+  }
   GLIBC_PRIVATE {
     # functions which have an additional interface since they are
     # are cancelable.
diff --git a/stdlib/stdbit.h b/stdlib/stdbit.h
new file mode 100644
index 0000000000..773b2ab72d
--- /dev/null
+++ b/stdlib/stdbit.h
@@ -0,0 +1,773 @@
+/* ISO C23 Standard: 7.18 - Bit and byte utilities <stdbit.h>.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _STDBIT_H
+#define _STDBIT_H	1
+
+#include <features.h>
+#include <bits/endian.h>
+#include <bits/stdint-intn.h>
+#include <bits/stdint-uintn.h>
+#include <bits/stdint-least.h>
+/* In C23, <stdbool.h> defines only an implementation-namespace macro,
+   so is OK to include here.  Before C23, including <stdbool.h> allows
+   the header to use bool rather than _Bool unconditionally, and so to
+   compile as C++ (although the type-generic macros are not a good
+   form of type-generic interface for C++).  */
+#include <stdbool.h>
+#define __need_size_t
+#include <stddef.h>
+
+#define __STDC_VERSION_STDBIT_H__	202311L
+
+#define __STDC_ENDIAN_LITTLE__		__LITTLE_ENDIAN
+#define __STDC_ENDIAN_BIG__		__BIG_ENDIAN
+#define __STDC_ENDIAN_NATIVE__		__BYTE_ORDER
+
+__BEGIN_DECLS
+
+/* Count leading zeros.  */
+extern unsigned int stdc_leading_zeros_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_leading_zeros_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_leading_zeros_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_leading_zeros_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_leading_zeros_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_leading_zeros(x)				\
+  (stdc_leading_zeros_ull (x)				\
+   - (unsigned int) (8 * (sizeof (0ULL) - sizeof (x))))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
+static __always_inline unsigned int
+__clz64_inline (uint64_t __x)
+{
+  return __x == 0 ? 64U : (unsigned int) __builtin_clzll (__x);
+}
+
+static __always_inline unsigned int
+__clz32_inline (uint32_t __x)
+{
+  return __x == 0 ? 32U : (unsigned int) __builtin_clz (__x);
+}
+
+static __always_inline unsigned int
+__clz16_inline (uint16_t __x)
+{
+  return __clz32_inline (__x) - 16;
+}
+
+static __always_inline unsigned int
+__clz8_inline (uint8_t __x)
+{
+  return __clz32_inline (__x) - 24;
+}
+
+# define stdc_leading_zeros_uc(x) (__clz8_inline (x))
+# define stdc_leading_zeros_us(x) (__clz16_inline (x))
+# define stdc_leading_zeros_ui(x) (__clz32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_leading_zeros_ul(x) (__clz64_inline (x))
+# else
+#  define stdc_leading_zeros_ul(x) (__clz32_inline (x))
+# endif
+# define stdc_leading_zeros_ull(x) (__clz64_inline (x))
+#endif
+
+/* Count leading ones.  */
+extern unsigned int stdc_leading_ones_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_leading_ones_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_leading_ones_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_leading_ones_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_leading_ones_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_leading_ones(x)					\
+  (stdc_leading_ones_ull ((unsigned long long int) (x)		\
+			  << 8 * (sizeof (0ULL) - sizeof (x))))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
+static __always_inline unsigned int
+__clo64_inline (uint64_t __x)
+{
+  return __clz64_inline (~__x);
+}
+
+static __always_inline unsigned int
+__clo32_inline (uint32_t __x)
+{
+  return __clz32_inline (~__x);
+}
+
+static __always_inline unsigned int
+__clo16_inline (uint16_t __x)
+{
+  return __clz16_inline (~__x);
+}
+
+static __always_inline unsigned int
+__clo8_inline (uint8_t __x)
+{
+  return __clz8_inline (~__x);
+}
+
+# define stdc_leading_ones_uc(x) (__clo8_inline (x))
+# define stdc_leading_ones_us(x) (__clo16_inline (x))
+# define stdc_leading_ones_ui(x) (__clo32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_leading_ones_ul(x) (__clo64_inline (x))
+# else
+#  define stdc_leading_ones_ul(x) (__clo32_inline (x))
+# endif
+# define stdc_leading_ones_ull(x) (__clo64_inline (x))
+#endif
+
+/* Count trailing zeros.  */
+extern unsigned int stdc_trailing_zeros_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_trailing_zeros_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_trailing_zeros_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_trailing_zeros_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_trailing_zeros_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_trailing_zeros(x)				\
+  (sizeof (x) == 8 ? stdc_trailing_zeros_ull (x)	\
+   : sizeof (x) == 4 ? stdc_trailing_zeros_ui (x)	\
+   : sizeof (x) == 2 ? stdc_trailing_zeros_us (x)	\
+   : stdc_trailing_zeros_uc (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_ctzll)
+static __always_inline unsigned int
+__ctz64_inline (uint64_t __x)
+{
+  return __x == 0 ? 64U : (unsigned int) __builtin_ctzll (__x);
+}
+
+static __always_inline unsigned int
+__ctz32_inline (uint32_t __x)
+{
+  return __x == 0 ? 32U : (unsigned int) __builtin_ctz (__x);
+}
+
+static __always_inline unsigned int
+__ctz16_inline (uint16_t __x)
+{
+  return __x == 0 ? 16U : (unsigned int) __builtin_ctz (__x);
+}
+
+static __always_inline unsigned int
+__ctz8_inline (uint8_t __x)
+{
+  return __x == 0 ? 8U : (unsigned int) __builtin_ctz (__x);
+}
+
+# define stdc_trailing_zeros_uc(x) (__ctz8_inline (x))
+# define stdc_trailing_zeros_us(x) (__ctz16_inline (x))
+# define stdc_trailing_zeros_ui(x) (__ctz32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_trailing_zeros_ul(x) (__ctz64_inline (x))
+# else
+#  define stdc_trailing_zeros_ul(x) (__ctz32_inline (x))
+# endif
+# define stdc_trailing_zeros_ull(x) (__ctz64_inline (x))
+#endif
+
+/* Count trailing ones.  */
+extern unsigned int stdc_trailing_ones_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_trailing_ones_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_trailing_ones_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_trailing_ones_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_trailing_ones_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_trailing_ones(x) (stdc_trailing_ones_ull (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_ctzll)
+static __always_inline unsigned int
+__cto64_inline (uint64_t __x)
+{
+  return __ctz64_inline (~__x);
+}
+
+static __always_inline unsigned int
+__cto32_inline (uint32_t __x)
+{
+  return __ctz32_inline (~__x);
+}
+
+static __always_inline unsigned int
+__cto16_inline (uint16_t __x)
+{
+  return __ctz16_inline (~__x);
+}
+
+static __always_inline unsigned int
+__cto8_inline (uint8_t __x)
+{
+  return __ctz8_inline (~__x);
+}
+
+# define stdc_trailing_ones_uc(x) (__cto8_inline (x))
+# define stdc_trailing_ones_us(x) (__cto16_inline (x))
+# define stdc_trailing_ones_ui(x) (__cto32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_trailing_ones_ul(x) (__cto64_inline (x))
+# else
+#  define stdc_trailing_ones_ul(x) (__cto32_inline (x))
+# endif
+# define stdc_trailing_ones_ull(x) (__cto64_inline (x))
+#endif
+
+/* First leading zero.  */
+extern unsigned int stdc_first_leading_zero_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_leading_zero_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_leading_zero_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_leading_zero_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_first_leading_zero_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_first_leading_zero(x)			\
+  (sizeof (x) == 8 ? stdc_first_leading_zero_ull (x)	\
+   : sizeof (x) == 4 ? stdc_first_leading_zero_ui (x)	\
+   : sizeof (x) == 2 ? stdc_first_leading_zero_us (x)	\
+   : stdc_first_leading_zero_uc (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
+static __always_inline unsigned int
+__flz64_inline (uint64_t __x)
+{
+  return __x == (uint64_t) -1 ? 0 : 1 + __clo64_inline (__x);
+}
+
+static __always_inline unsigned int
+__flz32_inline (uint32_t __x)
+{
+  return __x == (uint32_t) -1 ? 0 : 1 + __clo32_inline (__x);
+}
+
+static __always_inline unsigned int
+__flz16_inline (uint16_t __x)
+{
+  return __x == (uint16_t) -1 ? 0 : 1 + __clo16_inline (__x);
+}
+
+static __always_inline unsigned int
+__flz8_inline (uint8_t __x)
+{
+  return __x == (uint8_t) -1 ? 0 : 1 + __clo8_inline (__x);
+}
+
+# define stdc_first_leading_zero_uc(x) (__flz8_inline (x))
+# define stdc_first_leading_zero_us(x) (__flz16_inline (x))
+# define stdc_first_leading_zero_ui(x) (__flz32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_first_leading_zero_ul(x) (__flz64_inline (x))
+# else
+#  define stdc_first_leading_zero_ul(x) (__flz32_inline (x))
+# endif
+# define stdc_first_leading_zero_ull(x) (__flz64_inline (x))
+#endif
+
+/* First leading one.  */
+extern unsigned int stdc_first_leading_one_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_leading_one_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_leading_one_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_leading_one_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_first_leading_one_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_first_leading_one(x)			\
+  (sizeof (x) == 8 ? stdc_first_leading_one_ull (x)	\
+   : sizeof (x) == 4 ? stdc_first_leading_one_ui (x)	\
+   : sizeof (x) == 2 ? stdc_first_leading_one_us (x)	\
+   : stdc_first_leading_one_uc (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
+static __always_inline unsigned int
+__flo64_inline (uint64_t __x)
+{
+  return __x == 0 ? 0 : 1 + __clz64_inline (__x);
+}
+
+static __always_inline unsigned int
+__flo32_inline (uint32_t __x)
+{
+  return __x == 0 ? 0 : 1 + __clz32_inline (__x);
+}
+
+static __always_inline unsigned int
+__flo16_inline (uint16_t __x)
+{
+  return __x == 0 ? 0 : 1 + __clz16_inline (__x);
+}
+
+static __always_inline unsigned int
+__flo8_inline (uint8_t __x)
+{
+  return __x == 0 ? 0 : 1 + __clz8_inline (__x);
+}
+
+# define stdc_first_leading_one_uc(x) (__flo8_inline (x))
+# define stdc_first_leading_one_us(x) (__flo16_inline (x))
+# define stdc_first_leading_one_ui(x) (__flo32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_first_leading_one_ul(x) (__flo64_inline (x))
+# else
+#  define stdc_first_leading_one_ul(x) (__flo32_inline (x))
+# endif
+# define stdc_first_leading_one_ull(x) (__flo64_inline (x))
+#endif
+
+/* First trailing zero.  */
+extern unsigned int stdc_first_trailing_zero_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_trailing_zero_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_trailing_zero_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_trailing_zero_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_first_trailing_zero_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_first_trailing_zero(x)			\
+  (sizeof (x) == 8 ? stdc_first_trailing_zero_ull (x)	\
+   : sizeof (x) == 4 ? stdc_first_trailing_zero_ui (x)	\
+   : sizeof (x) == 2 ? stdc_first_trailing_zero_us (x)	\
+   : stdc_first_trailing_zero_uc (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_ctzll)
+static __always_inline unsigned int
+__ftz64_inline (uint64_t __x)
+{
+  return __x == (uint64_t) -1 ? 0 : 1 + __cto64_inline (__x);
+}
+
+static __always_inline unsigned int
+__ftz32_inline (uint32_t __x)
+{
+  return __x == (uint32_t) -1 ? 0 : 1 + __cto32_inline (__x);
+}
+
+static __always_inline unsigned int
+__ftz16_inline (uint16_t __x)
+{
+  return __x == (uint16_t) -1 ? 0 : 1 + __cto16_inline (__x);
+}
+
+static __always_inline unsigned int
+__ftz8_inline (uint8_t __x)
+{
+  return __x == (uint8_t) -1 ? 0 : 1 + __cto8_inline (__x);
+}
+
+# define stdc_first_trailing_zero_uc(x) (__ftz8_inline (x))
+# define stdc_first_trailing_zero_us(x) (__ftz16_inline (x))
+# define stdc_first_trailing_zero_ui(x) (__ftz32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_first_trailing_zero_ul(x) (__ftz64_inline (x))
+# else
+#  define stdc_first_trailing_zero_ul(x) (__ftz32_inline (x))
+# endif
+# define stdc_first_trailing_zero_ull(x) (__ftz64_inline (x))
+#endif
+
+/* First trailing one.  */
+extern unsigned int stdc_first_trailing_one_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_trailing_one_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_trailing_one_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_first_trailing_one_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_first_trailing_one_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_first_trailing_one(x)			\
+  (sizeof (x) == 8 ? stdc_first_trailing_one_ull (x)	\
+   : sizeof (x) == 4 ? stdc_first_trailing_one_ui (x)	\
+   : sizeof (x) == 2 ? stdc_first_trailing_one_us (x)	\
+   : stdc_first_trailing_one_uc (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_ctzll)
+static __always_inline unsigned int
+__fto64_inline (uint64_t __x)
+{
+  return __x == 0 ? 0 : 1 + __ctz64_inline (__x);
+}
+
+static __always_inline unsigned int
+__fto32_inline (uint32_t __x)
+{
+  return __x == 0 ? 0 : 1 + __ctz32_inline (__x);
+}
+
+static __always_inline unsigned int
+__fto16_inline (uint16_t __x)
+{
+  return __x == 0 ? 0 : 1 + __ctz16_inline (__x);
+}
+
+static __always_inline unsigned int
+__fto8_inline (uint8_t __x)
+{
+  return __x == 0 ? 0 : 1 + __ctz8_inline (__x);
+}
+
+# define stdc_first_trailing_one_uc(x) (__fto8_inline (x))
+# define stdc_first_trailing_one_us(x) (__fto16_inline (x))
+# define stdc_first_trailing_one_ui(x) (__fto32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_first_trailing_one_ul(x) (__fto64_inline (x))
+# else
+#  define stdc_first_trailing_one_ul(x) (__fto32_inline (x))
+# endif
+# define stdc_first_trailing_one_ull(x) (__fto64_inline (x))
+#endif
+
+/* Count zeros.  */
+extern unsigned int stdc_count_zeros_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_count_zeros_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_count_zeros_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_count_zeros_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_count_zeros_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_count_zeros(x)				\
+  (stdc_count_zeros_ull (x)				\
+   - (unsigned int) (8 * (sizeof (0ULL) - sizeof (x))))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_popcountll)
+static __always_inline unsigned int
+__cz64_inline (uint64_t __x)
+{
+  return 64U - (unsigned int) __builtin_popcountll (__x);
+}
+
+static __always_inline unsigned int
+__cz32_inline (uint32_t __x)
+{
+  return 32U - (unsigned int) __builtin_popcount (__x);
+}
+
+static __always_inline unsigned int
+__cz16_inline (uint16_t __x)
+{
+  return 16U - (unsigned int) __builtin_popcount (__x);
+}
+
+static __always_inline unsigned int
+__cz8_inline (uint8_t __x)
+{
+  return 8U - (unsigned int) __builtin_popcount (__x);
+}
+
+# define stdc_count_zeros_uc(x) (__cz8_inline (x))
+# define stdc_count_zeros_us(x) (__cz16_inline (x))
+# define stdc_count_zeros_ui(x) (__cz32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_count_zeros_ul(x) (__cz64_inline (x))
+# else
+#  define stdc_count_zeros_ul(x) (__cz32_inline (x))
+# endif
+# define stdc_count_zeros_ull(x) (__cz64_inline (x))
+#endif
+
+/* Count ones.  */
+extern unsigned int stdc_count_ones_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_count_ones_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_count_ones_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_count_ones_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_count_ones_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_count_ones(x) (stdc_count_ones_ull (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_popcountll)
+static __always_inline unsigned int
+__co64_inline (uint64_t __x)
+{
+  return (unsigned int) __builtin_popcountll (__x);
+}
+
+static __always_inline unsigned int
+__co32_inline (uint32_t __x)
+{
+  return (unsigned int) __builtin_popcount (__x);
+}
+
+static __always_inline unsigned int
+__co16_inline (uint16_t __x)
+{
+  return (unsigned int) __builtin_popcount (__x);
+}
+
+static __always_inline unsigned int
+__co8_inline (uint8_t __x)
+{
+  return (unsigned int) __builtin_popcount (__x);
+}
+
+# define stdc_count_ones_uc(x) (__co8_inline (x))
+# define stdc_count_ones_us(x) (__co16_inline (x))
+# define stdc_count_ones_ui(x) (__co32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_count_ones_ul(x) (__co64_inline (x))
+# else
+#  define stdc_count_ones_ul(x) (__co32_inline (x))
+# endif
+# define stdc_count_ones_ull(x) (__co64_inline (x))
+#endif
+
+/* Single-bit check.  */
+extern bool stdc_has_single_bit_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern bool stdc_has_single_bit_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern bool stdc_has_single_bit_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern bool stdc_has_single_bit_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern bool stdc_has_single_bit_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_has_single_bit(x)				\
+  ((bool) (sizeof (x) <= sizeof (unsigned int)		\
+	   ? stdc_has_single_bit_ui (x)			\
+	   : stdc_has_single_bit_ull (x)))
+
+static __always_inline bool
+__hsb64_inline (uint64_t __x)
+{
+  return (__x ^ (__x - 1)) > __x - 1;
+}
+
+static __always_inline bool
+__hsb32_inline (uint32_t __x)
+{
+  return (__x ^ (__x - 1)) > __x - 1;
+}
+
+static __always_inline bool
+__hsb16_inline (uint16_t __x)
+{
+  return (__x ^ (__x - 1)) > __x - 1;
+}
+
+static __always_inline bool
+__hsb8_inline (uint8_t __x)
+{
+  return (__x ^ (__x - 1)) > __x - 1;
+}
+
+#define stdc_has_single_bit_uc(x) (__hsb8_inline (x))
+#define stdc_has_single_bit_us(x) (__hsb16_inline (x))
+#define stdc_has_single_bit_ui(x) (__hsb32_inline (x))
+#if __WORDSIZE == 64
+# define stdc_has_single_bit_ul(x) (__hsb64_inline (x))
+#else
+# define stdc_has_single_bit_ul(x) (__hsb32_inline (x))
+#endif
+#define stdc_has_single_bit_ull(x) (__hsb64_inline (x))
+
+/* Bit width.  */
+extern unsigned int stdc_bit_width_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_bit_width_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_bit_width_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_bit_width_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned int stdc_bit_width_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_bit_width(x) (stdc_bit_width_ull (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
+static __always_inline unsigned int
+__bw64_inline (uint64_t __x)
+{
+  return 64 - __clz64_inline (__x);
+}
+
+static __always_inline unsigned int
+__bw32_inline (uint32_t __x)
+{
+  return 32 - __clz32_inline (__x);
+}
+
+static __always_inline unsigned int
+__bw16_inline (uint16_t __x)
+{
+  return 16 - __clz16_inline (__x);
+}
+
+static __always_inline unsigned int
+__bw8_inline (uint8_t __x)
+{
+  return 8 - __clz8_inline (__x);
+}
+
+# define stdc_bit_width_uc(x) (__bw8_inline (x))
+# define stdc_bit_width_us(x) (__bw16_inline (x))
+# define stdc_bit_width_ui(x) (__bw32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_bit_width_ul(x) (__bw64_inline (x))
+# else
+#  define stdc_bit_width_ul(x) (__bw32_inline (x))
+# endif
+# define stdc_bit_width_ull(x) (__bw64_inline (x))
+#endif
+
+/* Bit floor.  */
+extern unsigned char stdc_bit_floor_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned short stdc_bit_floor_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_bit_floor_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned long int stdc_bit_floor_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned long long int stdc_bit_floor_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_bit_floor(x) ((__typeof (x)) stdc_bit_floor_ull (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
+static __always_inline uint64_t
+__bf64_inline (uint64_t __x)
+{
+  return __x == 0 ? 0 : ((uint64_t) 1) << (__bw64_inline (__x) - 1);
+}
+
+static __always_inline uint32_t
+__bf32_inline (uint32_t __x)
+{
+  return __x == 0 ? 0 : ((uint32_t) 1) << (__bw32_inline (__x) - 1);
+}
+
+static __always_inline uint16_t
+__bf16_inline (uint16_t __x)
+{
+  return __x == 0 ? 0 : ((uint16_t) 1) << (__bw16_inline (__x) - 1);
+}
+
+static __always_inline uint8_t
+__bf8_inline (uint8_t __x)
+{
+  return __x == 0 ? 0 : ((uint8_t) 1) << (__bw8_inline (__x) - 1);
+}
+
+# define stdc_bit_floor_uc(x) ((unsigned char) __bf8_inline (x))
+# define stdc_bit_floor_us(x) ((unsigned short) __bf16_inline (x))
+# define stdc_bit_floor_ui(x) ((unsigned int) __bf32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_bit_floor_ul(x) ((unsigned long int) __bf64_inline (x))
+# else
+#  define stdc_bit_floor_ul(x) ((unsigned long int) __bf32_inline (x))
+# endif
+# define stdc_bit_floor_ull(x) ((unsigned long long int) __bf64_inline (x))
+#endif
+
+/* Bit ceiling.  */
+extern unsigned char stdc_bit_ceil_uc (unsigned char __x)
+     __THROW __attribute_const__;
+extern unsigned short stdc_bit_ceil_us (unsigned short __x)
+     __THROW __attribute_const__;
+extern unsigned int stdc_bit_ceil_ui (unsigned int __x)
+     __THROW __attribute_const__;
+extern unsigned long int stdc_bit_ceil_ul (unsigned long int __x)
+     __THROW __attribute_const__;
+__extension__
+extern unsigned long long int stdc_bit_ceil_ull (unsigned long long int __x)
+     __THROW __attribute_const__;
+#define stdc_bit_ceil(x) ((__typeof (x)) stdc_bit_ceil_ull (x))
+
+#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
+static __always_inline uint64_t
+__bc64_inline (uint64_t __x)
+{
+  return __x <= 1 ? 1 : ((uint64_t) 2) << (__bw64_inline (__x - 1) - 1);
+}
+
+static __always_inline uint32_t
+__bc32_inline (uint32_t __x)
+{
+  return __x <= 1 ? 1 : ((uint32_t) 2) << (__bw32_inline (__x - 1) - 1);
+}
+
+static __always_inline uint16_t
+__bc16_inline (uint16_t __x)
+{
+  return __x <= 1 ? 1 : ((uint16_t) 2) << (__bw16_inline (__x - 1) - 1);
+}
+
+static __always_inline uint8_t
+__bc8_inline (uint8_t __x)
+{
+  return __x <= 1 ? 1 : ((uint8_t) 2) << (__bw8_inline (__x - 1) - 1);
+}
+
+# define stdc_bit_ceil_uc(x) ((unsigned char) __bc8_inline (x))
+# define stdc_bit_ceil_us(x) ((unsigned short) __bc16_inline (x))
+# define stdc_bit_ceil_ui(x) ((unsigned int) __bc32_inline (x))
+# if __WORDSIZE == 64
+#  define stdc_bit_ceil_ul(x) ((unsigned long int) __bc64_inline (x))
+# else
+#  define stdc_bit_ceil_ul(x) ((unsigned long int) __bc32_inline (x))
+# endif
+# define stdc_bit_ceil_ull(x) ((unsigned long long int) __bc64_inline (x))
+#endif
+
+__END_DECLS
+
+#endif /* _STDBIT_H */
diff --git a/stdlib/stdc_bit_ceil_uc.c b/stdlib/stdc_bit_ceil_uc.c
new file mode 100644
index 0000000000..366412060b
--- /dev/null
+++ b/stdlib/stdc_bit_ceil_uc.c
@@ -0,0 +1,25 @@
+/* Bit ceiling for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned char
+(stdc_bit_ceil_uc) (unsigned char x)
+{
+  return stdc_bit_ceil_uc (x);
+}
diff --git a/stdlib/stdc_bit_ceil_ui.c b/stdlib/stdc_bit_ceil_ui.c
new file mode 100644
index 0000000000..8f6dd55ed9
--- /dev/null
+++ b/stdlib/stdc_bit_ceil_ui.c
@@ -0,0 +1,25 @@
+/* Bit ceiling for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_bit_ceil_ui) (unsigned int x)
+{
+  return stdc_bit_ceil_ui (x);
+}
diff --git a/stdlib/stdc_bit_ceil_ul.c b/stdlib/stdc_bit_ceil_ul.c
new file mode 100644
index 0000000000..24ff5d2257
--- /dev/null
+++ b/stdlib/stdc_bit_ceil_ul.c
@@ -0,0 +1,25 @@
+/* Bit ceiling for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned long int
+(stdc_bit_ceil_ul) (unsigned long int x)
+{
+  return stdc_bit_ceil_ul (x);
+}
diff --git a/stdlib/stdc_bit_ceil_ull.c b/stdlib/stdc_bit_ceil_ull.c
new file mode 100644
index 0000000000..032501d864
--- /dev/null
+++ b/stdlib/stdc_bit_ceil_ull.c
@@ -0,0 +1,25 @@
+/* Bit ceiling for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned long long int
+(stdc_bit_ceil_ull) (unsigned long long int x)
+{
+  return stdc_bit_ceil_ull (x);
+}
diff --git a/stdlib/stdc_bit_ceil_us.c b/stdlib/stdc_bit_ceil_us.c
new file mode 100644
index 0000000000..36bb63d03e
--- /dev/null
+++ b/stdlib/stdc_bit_ceil_us.c
@@ -0,0 +1,25 @@
+/* Bit ceiling for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned short
+(stdc_bit_ceil_us) (unsigned short x)
+{
+  return stdc_bit_ceil_us (x);
+}
diff --git a/stdlib/stdc_bit_floor_uc.c b/stdlib/stdc_bit_floor_uc.c
new file mode 100644
index 0000000000..6538a6b344
--- /dev/null
+++ b/stdlib/stdc_bit_floor_uc.c
@@ -0,0 +1,25 @@
+/* Bit floor for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned char
+(stdc_bit_floor_uc) (unsigned char x)
+{
+  return stdc_bit_floor_uc (x);
+}
diff --git a/stdlib/stdc_bit_floor_ui.c b/stdlib/stdc_bit_floor_ui.c
new file mode 100644
index 0000000000..2419594bf7
--- /dev/null
+++ b/stdlib/stdc_bit_floor_ui.c
@@ -0,0 +1,25 @@
+/* Bit floor for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_bit_floor_ui) (unsigned int x)
+{
+  return stdc_bit_floor_ui (x);
+}
diff --git a/stdlib/stdc_bit_floor_ul.c b/stdlib/stdc_bit_floor_ul.c
new file mode 100644
index 0000000000..4a8fc72224
--- /dev/null
+++ b/stdlib/stdc_bit_floor_ul.c
@@ -0,0 +1,25 @@
+/* Bit floor for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned long int
+(stdc_bit_floor_ul) (unsigned long int x)
+{
+  return stdc_bit_floor_ul (x);
+}
diff --git a/stdlib/stdc_bit_floor_ull.c b/stdlib/stdc_bit_floor_ull.c
new file mode 100644
index 0000000000..7fc8b25f5f
--- /dev/null
+++ b/stdlib/stdc_bit_floor_ull.c
@@ -0,0 +1,25 @@
+/* Bit floor for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned long long int
+(stdc_bit_floor_ull) (unsigned long long int x)
+{
+  return stdc_bit_floor_ull (x);
+}
diff --git a/stdlib/stdc_bit_floor_us.c b/stdlib/stdc_bit_floor_us.c
new file mode 100644
index 0000000000..653b51ab1d
--- /dev/null
+++ b/stdlib/stdc_bit_floor_us.c
@@ -0,0 +1,25 @@
+/* Bit floor for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned short
+(stdc_bit_floor_us) (unsigned short x)
+{
+  return stdc_bit_floor_us (x);
+}
diff --git a/stdlib/stdc_bit_width_uc.c b/stdlib/stdc_bit_width_uc.c
new file mode 100644
index 0000000000..b8917fb704
--- /dev/null
+++ b/stdlib/stdc_bit_width_uc.c
@@ -0,0 +1,25 @@
+/* Bit width for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_bit_width_uc) (unsigned char x)
+{
+  return stdc_bit_width_uc (x);
+}
diff --git a/stdlib/stdc_bit_width_ui.c b/stdlib/stdc_bit_width_ui.c
new file mode 100644
index 0000000000..9c0674e02a
--- /dev/null
+++ b/stdlib/stdc_bit_width_ui.c
@@ -0,0 +1,25 @@
+/* Bit width for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_bit_width_ui) (unsigned int x)
+{
+  return stdc_bit_width_ui (x);
+}
diff --git a/stdlib/stdc_bit_width_ul.c b/stdlib/stdc_bit_width_ul.c
new file mode 100644
index 0000000000..1f582e3255
--- /dev/null
+++ b/stdlib/stdc_bit_width_ul.c
@@ -0,0 +1,25 @@
+/* Bit width for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_bit_width_ul) (unsigned long int x)
+{
+  return stdc_bit_width_ul (x);
+}
diff --git a/stdlib/stdc_bit_width_ull.c b/stdlib/stdc_bit_width_ull.c
new file mode 100644
index 0000000000..1b157017fc
--- /dev/null
+++ b/stdlib/stdc_bit_width_ull.c
@@ -0,0 +1,25 @@
+/* Bit width for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_bit_width_ull) (unsigned long long int x)
+{
+  return stdc_bit_width_ull (x);
+}
diff --git a/stdlib/stdc_bit_width_us.c b/stdlib/stdc_bit_width_us.c
new file mode 100644
index 0000000000..09c33bb594
--- /dev/null
+++ b/stdlib/stdc_bit_width_us.c
@@ -0,0 +1,25 @@
+/* Bit width for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_bit_width_us) (unsigned short x)
+{
+  return stdc_bit_width_us (x);
+}
diff --git a/stdlib/stdc_count_ones_uc.c b/stdlib/stdc_count_ones_uc.c
new file mode 100644
index 0000000000..0c6970a44c
--- /dev/null
+++ b/stdlib/stdc_count_ones_uc.c
@@ -0,0 +1,25 @@
+/* Count ones for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_ones_uc) (unsigned char x)
+{
+  return stdc_count_ones_uc (x);
+}
diff --git a/stdlib/stdc_count_ones_ui.c b/stdlib/stdc_count_ones_ui.c
new file mode 100644
index 0000000000..db3a1c3d0e
--- /dev/null
+++ b/stdlib/stdc_count_ones_ui.c
@@ -0,0 +1,25 @@
+/* Count ones for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_ones_ui) (unsigned int x)
+{
+  return stdc_count_ones_ui (x);
+}
diff --git a/stdlib/stdc_count_ones_ul.c b/stdlib/stdc_count_ones_ul.c
new file mode 100644
index 0000000000..35bb7d7cc2
--- /dev/null
+++ b/stdlib/stdc_count_ones_ul.c
@@ -0,0 +1,25 @@
+/* Count ones for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_ones_ul) (unsigned long int x)
+{
+  return stdc_count_ones_ul (x);
+}
diff --git a/stdlib/stdc_count_ones_ull.c b/stdlib/stdc_count_ones_ull.c
new file mode 100644
index 0000000000..26ae57933c
--- /dev/null
+++ b/stdlib/stdc_count_ones_ull.c
@@ -0,0 +1,25 @@
+/* Count ones for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_ones_ull) (unsigned long long int x)
+{
+  return stdc_count_ones_ull (x);
+}
diff --git a/stdlib/stdc_count_ones_us.c b/stdlib/stdc_count_ones_us.c
new file mode 100644
index 0000000000..138931a479
--- /dev/null
+++ b/stdlib/stdc_count_ones_us.c
@@ -0,0 +1,25 @@
+/* Count ones for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_ones_us) (unsigned short x)
+{
+  return stdc_count_ones_us (x);
+}
diff --git a/stdlib/stdc_count_zeros_uc.c b/stdlib/stdc_count_zeros_uc.c
new file mode 100644
index 0000000000..74ff5c52f2
--- /dev/null
+++ b/stdlib/stdc_count_zeros_uc.c
@@ -0,0 +1,25 @@
+/* Count zeros for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_zeros_uc) (unsigned char x)
+{
+  return stdc_count_zeros_uc (x);
+}
diff --git a/stdlib/stdc_count_zeros_ui.c b/stdlib/stdc_count_zeros_ui.c
new file mode 100644
index 0000000000..e9e4dc9662
--- /dev/null
+++ b/stdlib/stdc_count_zeros_ui.c
@@ -0,0 +1,25 @@
+/* Count zeros for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_zeros_ui) (unsigned int x)
+{
+  return stdc_count_zeros_ui (x);
+}
diff --git a/stdlib/stdc_count_zeros_ul.c b/stdlib/stdc_count_zeros_ul.c
new file mode 100644
index 0000000000..776311d94f
--- /dev/null
+++ b/stdlib/stdc_count_zeros_ul.c
@@ -0,0 +1,25 @@
+/* Count zeros for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_zeros_ul) (unsigned long int x)
+{
+  return stdc_count_zeros_ul (x);
+}
diff --git a/stdlib/stdc_count_zeros_ull.c b/stdlib/stdc_count_zeros_ull.c
new file mode 100644
index 0000000000..07a699029c
--- /dev/null
+++ b/stdlib/stdc_count_zeros_ull.c
@@ -0,0 +1,25 @@
+/* Count zeros for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_zeros_ull) (unsigned long long int x)
+{
+  return stdc_count_zeros_ull (x);
+}
diff --git a/stdlib/stdc_count_zeros_us.c b/stdlib/stdc_count_zeros_us.c
new file mode 100644
index 0000000000..634c597442
--- /dev/null
+++ b/stdlib/stdc_count_zeros_us.c
@@ -0,0 +1,25 @@
+/* Count zeros for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_count_zeros_us) (unsigned short x)
+{
+  return stdc_count_zeros_us (x);
+}
diff --git a/stdlib/stdc_first_leading_one_uc.c b/stdlib/stdc_first_leading_one_uc.c
new file mode 100644
index 0000000000..35b80cc9e6
--- /dev/null
+++ b/stdlib/stdc_first_leading_one_uc.c
@@ -0,0 +1,25 @@
+/* First leading one for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_one_uc) (unsigned char x)
+{
+  return stdc_first_leading_one_uc (x);
+}
diff --git a/stdlib/stdc_first_leading_one_ui.c b/stdlib/stdc_first_leading_one_ui.c
new file mode 100644
index 0000000000..da7dc1317b
--- /dev/null
+++ b/stdlib/stdc_first_leading_one_ui.c
@@ -0,0 +1,25 @@
+/* First leading one for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_one_ui) (unsigned int x)
+{
+  return stdc_first_leading_one_ui (x);
+}
diff --git a/stdlib/stdc_first_leading_one_ul.c b/stdlib/stdc_first_leading_one_ul.c
new file mode 100644
index 0000000000..251b8685cc
--- /dev/null
+++ b/stdlib/stdc_first_leading_one_ul.c
@@ -0,0 +1,25 @@
+/* First leading one for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_one_ul) (unsigned long int x)
+{
+  return stdc_first_leading_one_ul (x);
+}
diff --git a/stdlib/stdc_first_leading_one_ull.c b/stdlib/stdc_first_leading_one_ull.c
new file mode 100644
index 0000000000..0b1620199e
--- /dev/null
+++ b/stdlib/stdc_first_leading_one_ull.c
@@ -0,0 +1,25 @@
+/* First leading one for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_one_ull) (unsigned long long int x)
+{
+  return stdc_first_leading_one_ull (x);
+}
diff --git a/stdlib/stdc_first_leading_one_us.c b/stdlib/stdc_first_leading_one_us.c
new file mode 100644
index 0000000000..c1b3da38f2
--- /dev/null
+++ b/stdlib/stdc_first_leading_one_us.c
@@ -0,0 +1,25 @@
+/* First leading one for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_one_us) (unsigned short x)
+{
+  return stdc_first_leading_one_us (x);
+}
diff --git a/stdlib/stdc_first_leading_zero_uc.c b/stdlib/stdc_first_leading_zero_uc.c
new file mode 100644
index 0000000000..064bec71c5
--- /dev/null
+++ b/stdlib/stdc_first_leading_zero_uc.c
@@ -0,0 +1,25 @@
+/* First leading zero for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_zero_uc) (unsigned char x)
+{
+  return stdc_first_leading_zero_uc (x);
+}
diff --git a/stdlib/stdc_first_leading_zero_ui.c b/stdlib/stdc_first_leading_zero_ui.c
new file mode 100644
index 0000000000..829f670cbe
--- /dev/null
+++ b/stdlib/stdc_first_leading_zero_ui.c
@@ -0,0 +1,25 @@
+/* First leading zero for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_zero_ui) (unsigned int x)
+{
+  return stdc_first_leading_zero_ui (x);
+}
diff --git a/stdlib/stdc_first_leading_zero_ul.c b/stdlib/stdc_first_leading_zero_ul.c
new file mode 100644
index 0000000000..c384dc0534
--- /dev/null
+++ b/stdlib/stdc_first_leading_zero_ul.c
@@ -0,0 +1,25 @@
+/* First leading zero for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_zero_ul) (unsigned long int x)
+{
+  return stdc_first_leading_zero_ul (x);
+}
diff --git a/stdlib/stdc_first_leading_zero_ull.c b/stdlib/stdc_first_leading_zero_ull.c
new file mode 100644
index 0000000000..ca064317f8
--- /dev/null
+++ b/stdlib/stdc_first_leading_zero_ull.c
@@ -0,0 +1,25 @@
+/* First leading zero for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_zero_ull) (unsigned long long int x)
+{
+  return stdc_first_leading_zero_ull (x);
+}
diff --git a/stdlib/stdc_first_leading_zero_us.c b/stdlib/stdc_first_leading_zero_us.c
new file mode 100644
index 0000000000..35eceb43d4
--- /dev/null
+++ b/stdlib/stdc_first_leading_zero_us.c
@@ -0,0 +1,25 @@
+/* First leading zero for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_leading_zero_us) (unsigned short x)
+{
+  return stdc_first_leading_zero_us (x);
+}
diff --git a/stdlib/stdc_first_trailing_one_uc.c b/stdlib/stdc_first_trailing_one_uc.c
new file mode 100644
index 0000000000..de565eb04c
--- /dev/null
+++ b/stdlib/stdc_first_trailing_one_uc.c
@@ -0,0 +1,25 @@
+/* First trailing one for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_one_uc) (unsigned char x)
+{
+  return stdc_first_trailing_one_uc (x);
+}
diff --git a/stdlib/stdc_first_trailing_one_ui.c b/stdlib/stdc_first_trailing_one_ui.c
new file mode 100644
index 0000000000..ab38b86d5e
--- /dev/null
+++ b/stdlib/stdc_first_trailing_one_ui.c
@@ -0,0 +1,25 @@
+/* First trailing one for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_one_ui) (unsigned int x)
+{
+  return stdc_first_trailing_one_ui (x);
+}
diff --git a/stdlib/stdc_first_trailing_one_ul.c b/stdlib/stdc_first_trailing_one_ul.c
new file mode 100644
index 0000000000..3adc1ed0ce
--- /dev/null
+++ b/stdlib/stdc_first_trailing_one_ul.c
@@ -0,0 +1,25 @@
+/* First trailing one for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_one_ul) (unsigned long int x)
+{
+  return stdc_first_trailing_one_ul (x);
+}
diff --git a/stdlib/stdc_first_trailing_one_ull.c b/stdlib/stdc_first_trailing_one_ull.c
new file mode 100644
index 0000000000..b3bbcda96d
--- /dev/null
+++ b/stdlib/stdc_first_trailing_one_ull.c
@@ -0,0 +1,25 @@
+/* First trailing one for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_one_ull) (unsigned long long int x)
+{
+  return stdc_first_trailing_one_ull (x);
+}
diff --git a/stdlib/stdc_first_trailing_one_us.c b/stdlib/stdc_first_trailing_one_us.c
new file mode 100644
index 0000000000..b90d25836c
--- /dev/null
+++ b/stdlib/stdc_first_trailing_one_us.c
@@ -0,0 +1,25 @@
+/* First trailing one for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_one_us) (unsigned short x)
+{
+  return stdc_first_trailing_one_us (x);
+}
diff --git a/stdlib/stdc_first_trailing_zero_uc.c b/stdlib/stdc_first_trailing_zero_uc.c
new file mode 100644
index 0000000000..def43e31c8
--- /dev/null
+++ b/stdlib/stdc_first_trailing_zero_uc.c
@@ -0,0 +1,25 @@
+/* First trailing zero for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_zero_uc) (unsigned char x)
+{
+  return stdc_first_trailing_zero_uc (x);
+}
diff --git a/stdlib/stdc_first_trailing_zero_ui.c b/stdlib/stdc_first_trailing_zero_ui.c
new file mode 100644
index 0000000000..51ea12623d
--- /dev/null
+++ b/stdlib/stdc_first_trailing_zero_ui.c
@@ -0,0 +1,25 @@
+/* First trailing zero for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_zero_ui) (unsigned int x)
+{
+  return stdc_first_trailing_zero_ui (x);
+}
diff --git a/stdlib/stdc_first_trailing_zero_ul.c b/stdlib/stdc_first_trailing_zero_ul.c
new file mode 100644
index 0000000000..17076a0304
--- /dev/null
+++ b/stdlib/stdc_first_trailing_zero_ul.c
@@ -0,0 +1,25 @@
+/* First trailing zero for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_zero_ul) (unsigned long int x)
+{
+  return stdc_first_trailing_zero_ul (x);
+}
diff --git a/stdlib/stdc_first_trailing_zero_ull.c b/stdlib/stdc_first_trailing_zero_ull.c
new file mode 100644
index 0000000000..26f101538a
--- /dev/null
+++ b/stdlib/stdc_first_trailing_zero_ull.c
@@ -0,0 +1,25 @@
+/* First trailing zero for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_zero_ull) (unsigned long long int x)
+{
+  return stdc_first_trailing_zero_ull (x);
+}
diff --git a/stdlib/stdc_first_trailing_zero_us.c b/stdlib/stdc_first_trailing_zero_us.c
new file mode 100644
index 0000000000..89a6284ebd
--- /dev/null
+++ b/stdlib/stdc_first_trailing_zero_us.c
@@ -0,0 +1,25 @@
+/* First trailing zero for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_first_trailing_zero_us) (unsigned short x)
+{
+  return stdc_first_trailing_zero_us (x);
+}
diff --git a/stdlib/stdc_has_single_bit_uc.c b/stdlib/stdc_has_single_bit_uc.c
new file mode 100644
index 0000000000..78b1a953c5
--- /dev/null
+++ b/stdlib/stdc_has_single_bit_uc.c
@@ -0,0 +1,25 @@
+/* Single-bit check for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+_Bool
+(stdc_has_single_bit_uc) (unsigned char x)
+{
+  return stdc_has_single_bit_uc (x);
+}
diff --git a/stdlib/stdc_has_single_bit_ui.c b/stdlib/stdc_has_single_bit_ui.c
new file mode 100644
index 0000000000..5269c54f3c
--- /dev/null
+++ b/stdlib/stdc_has_single_bit_ui.c
@@ -0,0 +1,25 @@
+/* Single-bit check for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+_Bool
+(stdc_has_single_bit_ui) (unsigned int x)
+{
+  return stdc_has_single_bit_ui (x);
+}
diff --git a/stdlib/stdc_has_single_bit_ul.c b/stdlib/stdc_has_single_bit_ul.c
new file mode 100644
index 0000000000..b21d2518ab
--- /dev/null
+++ b/stdlib/stdc_has_single_bit_ul.c
@@ -0,0 +1,25 @@
+/* Single-bit check for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+_Bool
+(stdc_has_single_bit_ul) (unsigned long int x)
+{
+  return stdc_has_single_bit_ul (x);
+}
diff --git a/stdlib/stdc_has_single_bit_ull.c b/stdlib/stdc_has_single_bit_ull.c
new file mode 100644
index 0000000000..518246051c
--- /dev/null
+++ b/stdlib/stdc_has_single_bit_ull.c
@@ -0,0 +1,25 @@
+/* Single-bit check for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+_Bool
+(stdc_has_single_bit_ull) (unsigned long long int x)
+{
+  return stdc_has_single_bit_ull (x);
+}
diff --git a/stdlib/stdc_has_single_bit_us.c b/stdlib/stdc_has_single_bit_us.c
new file mode 100644
index 0000000000..f99658e4ce
--- /dev/null
+++ b/stdlib/stdc_has_single_bit_us.c
@@ -0,0 +1,25 @@
+/* Single-bit check for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+_Bool
+(stdc_has_single_bit_us) (unsigned short x)
+{
+  return stdc_has_single_bit_us (x);
+}
diff --git a/stdlib/stdc_leading_ones_uc.c b/stdlib/stdc_leading_ones_uc.c
new file mode 100644
index 0000000000..34714ebafb
--- /dev/null
+++ b/stdlib/stdc_leading_ones_uc.c
@@ -0,0 +1,25 @@
+/* Count leading ones for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_ones_uc) (unsigned char x)
+{
+  return stdc_leading_ones_uc (x);
+}
diff --git a/stdlib/stdc_leading_ones_ui.c b/stdlib/stdc_leading_ones_ui.c
new file mode 100644
index 0000000000..845ae35570
--- /dev/null
+++ b/stdlib/stdc_leading_ones_ui.c
@@ -0,0 +1,25 @@
+/* Count leading ones for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_ones_ui) (unsigned int x)
+{
+  return stdc_leading_ones_ui (x);
+}
diff --git a/stdlib/stdc_leading_ones_ul.c b/stdlib/stdc_leading_ones_ul.c
new file mode 100644
index 0000000000..43022da76f
--- /dev/null
+++ b/stdlib/stdc_leading_ones_ul.c
@@ -0,0 +1,25 @@
+/* Count leading ones for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_ones_ul) (unsigned long int x)
+{
+  return stdc_leading_ones_ul (x);
+}
diff --git a/stdlib/stdc_leading_ones_ull.c b/stdlib/stdc_leading_ones_ull.c
new file mode 100644
index 0000000000..5bef08c311
--- /dev/null
+++ b/stdlib/stdc_leading_ones_ull.c
@@ -0,0 +1,25 @@
+/* Count leading ones for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_ones_ull) (unsigned long long int x)
+{
+  return stdc_leading_ones_ull (x);
+}
diff --git a/stdlib/stdc_leading_ones_us.c b/stdlib/stdc_leading_ones_us.c
new file mode 100644
index 0000000000..405528a05c
--- /dev/null
+++ b/stdlib/stdc_leading_ones_us.c
@@ -0,0 +1,25 @@
+/* Count leading ones for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_ones_us) (unsigned short x)
+{
+  return stdc_leading_ones_us (x);
+}
diff --git a/stdlib/stdc_leading_zeros_uc.c b/stdlib/stdc_leading_zeros_uc.c
new file mode 100644
index 0000000000..c07dba94cb
--- /dev/null
+++ b/stdlib/stdc_leading_zeros_uc.c
@@ -0,0 +1,25 @@
+/* Count leading zeros for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_zeros_uc) (unsigned char x)
+{
+  return stdc_leading_zeros_uc (x);
+}
diff --git a/stdlib/stdc_leading_zeros_ui.c b/stdlib/stdc_leading_zeros_ui.c
new file mode 100644
index 0000000000..590f04f7aa
--- /dev/null
+++ b/stdlib/stdc_leading_zeros_ui.c
@@ -0,0 +1,25 @@
+/* Count leading zeros for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_zeros_ui) (unsigned int x)
+{
+  return stdc_leading_zeros_ui (x);
+}
diff --git a/stdlib/stdc_leading_zeros_ul.c b/stdlib/stdc_leading_zeros_ul.c
new file mode 100644
index 0000000000..5b435f3e4a
--- /dev/null
+++ b/stdlib/stdc_leading_zeros_ul.c
@@ -0,0 +1,25 @@
+/* Count leading zeros for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_zeros_ul) (unsigned long int x)
+{
+  return stdc_leading_zeros_ul (x);
+}
diff --git a/stdlib/stdc_leading_zeros_ull.c b/stdlib/stdc_leading_zeros_ull.c
new file mode 100644
index 0000000000..40393d2750
--- /dev/null
+++ b/stdlib/stdc_leading_zeros_ull.c
@@ -0,0 +1,25 @@
+/* Count leading zeros for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_zeros_ull) (unsigned long long int x)
+{
+  return stdc_leading_zeros_ull (x);
+}
diff --git a/stdlib/stdc_leading_zeros_us.c b/stdlib/stdc_leading_zeros_us.c
new file mode 100644
index 0000000000..11248269ae
--- /dev/null
+++ b/stdlib/stdc_leading_zeros_us.c
@@ -0,0 +1,25 @@
+/* Count leading zeros for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_leading_zeros_us) (unsigned short x)
+{
+  return stdc_leading_zeros_us (x);
+}
diff --git a/stdlib/stdc_trailing_ones_uc.c b/stdlib/stdc_trailing_ones_uc.c
new file mode 100644
index 0000000000..d1c89cbd24
--- /dev/null
+++ b/stdlib/stdc_trailing_ones_uc.c
@@ -0,0 +1,25 @@
+/* Count trailing ones for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_ones_uc) (unsigned char x)
+{
+  return stdc_trailing_ones_uc (x);
+}
diff --git a/stdlib/stdc_trailing_ones_ui.c b/stdlib/stdc_trailing_ones_ui.c
new file mode 100644
index 0000000000..47b63cf569
--- /dev/null
+++ b/stdlib/stdc_trailing_ones_ui.c
@@ -0,0 +1,25 @@
+/* Count trailing ones for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_ones_ui) (unsigned int x)
+{
+  return stdc_trailing_ones_ui (x);
+}
diff --git a/stdlib/stdc_trailing_ones_ul.c b/stdlib/stdc_trailing_ones_ul.c
new file mode 100644
index 0000000000..4712b18010
--- /dev/null
+++ b/stdlib/stdc_trailing_ones_ul.c
@@ -0,0 +1,25 @@
+/* Count trailing ones for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_ones_ul) (unsigned long int x)
+{
+  return stdc_trailing_ones_ul (x);
+}
diff --git a/stdlib/stdc_trailing_ones_ull.c b/stdlib/stdc_trailing_ones_ull.c
new file mode 100644
index 0000000000..71698181a6
--- /dev/null
+++ b/stdlib/stdc_trailing_ones_ull.c
@@ -0,0 +1,25 @@
+/* Count trailing ones for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_ones_ull) (unsigned long long int x)
+{
+  return stdc_trailing_ones_ull (x);
+}
diff --git a/stdlib/stdc_trailing_ones_us.c b/stdlib/stdc_trailing_ones_us.c
new file mode 100644
index 0000000000..da10a66293
--- /dev/null
+++ b/stdlib/stdc_trailing_ones_us.c
@@ -0,0 +1,25 @@
+/* Count trailing ones for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_ones_us) (unsigned short x)
+{
+  return stdc_trailing_ones_us (x);
+}
diff --git a/stdlib/stdc_trailing_zeros_uc.c b/stdlib/stdc_trailing_zeros_uc.c
new file mode 100644
index 0000000000..660645ed99
--- /dev/null
+++ b/stdlib/stdc_trailing_zeros_uc.c
@@ -0,0 +1,25 @@
+/* Count trailing zeros for unsigned char.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_zeros_uc) (unsigned char x)
+{
+  return stdc_trailing_zeros_uc (x);
+}
diff --git a/stdlib/stdc_trailing_zeros_ui.c b/stdlib/stdc_trailing_zeros_ui.c
new file mode 100644
index 0000000000..737c784697
--- /dev/null
+++ b/stdlib/stdc_trailing_zeros_ui.c
@@ -0,0 +1,25 @@
+/* Count trailing zeros for unsigned int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_zeros_ui) (unsigned int x)
+{
+  return stdc_trailing_zeros_ui (x);
+}
diff --git a/stdlib/stdc_trailing_zeros_ul.c b/stdlib/stdc_trailing_zeros_ul.c
new file mode 100644
index 0000000000..ca43c56f49
--- /dev/null
+++ b/stdlib/stdc_trailing_zeros_ul.c
@@ -0,0 +1,25 @@
+/* Count trailing zeros for unsigned long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_zeros_ul) (unsigned long int x)
+{
+  return stdc_trailing_zeros_ul (x);
+}
diff --git a/stdlib/stdc_trailing_zeros_ull.c b/stdlib/stdc_trailing_zeros_ull.c
new file mode 100644
index 0000000000..b94b8d5efa
--- /dev/null
+++ b/stdlib/stdc_trailing_zeros_ull.c
@@ -0,0 +1,25 @@
+/* Count trailing zeros for unsigned long long int.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_zeros_ull) (unsigned long long int x)
+{
+  return stdc_trailing_zeros_ull (x);
+}
diff --git a/stdlib/stdc_trailing_zeros_us.c b/stdlib/stdc_trailing_zeros_us.c
new file mode 100644
index 0000000000..6393c4caac
--- /dev/null
+++ b/stdlib/stdc_trailing_zeros_us.c
@@ -0,0 +1,25 @@
+/* Count trailing zeros for unsigned short.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+
+unsigned int
+(stdc_trailing_zeros_us) (unsigned short x)
+{
+  return stdc_trailing_zeros_us (x);
+}
diff --git a/stdlib/stdint.h b/stdlib/stdint.h
index 9c89c1385e..01a9abc9e5 100644
--- a/stdlib/stdint.h
+++ b/stdlib/stdint.h
@@ -38,18 +38,7 @@
 
 
 /* Small types.  */
-
-/* Signed.  */
-typedef __int_least8_t int_least8_t;
-typedef __int_least16_t int_least16_t;
-typedef __int_least32_t int_least32_t;
-typedef __int_least64_t int_least64_t;
-
-/* Unsigned.  */
-typedef __uint_least8_t uint_least8_t;
-typedef __uint_least16_t uint_least16_t;
-typedef __uint_least32_t uint_least32_t;
-typedef __uint_least64_t uint_least64_t;
+#include <bits/stdint-least.h>
 
 
 /* Fast types.  */
diff --git a/stdlib/tst-stdbit-Wconversion.c b/stdlib/tst-stdbit-Wconversion.c
new file mode 100644
index 0000000000..1a5fbf965c
--- /dev/null
+++ b/stdlib/tst-stdbit-Wconversion.c
@@ -0,0 +1,107 @@
+/* Test <stdbit.h> type-generic macros with -Wconversion.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdbit.h>
+#include <support/check.h>
+
+unsigned char uc;
+unsigned short us;
+unsigned int ui;
+unsigned long int ul;
+unsigned long long int ull;
+
+static int
+do_test (void)
+{
+  /* The main point of this test is the compile-time test that there
+     are no -Wconversion warnings from the type-generic macros, not
+     the runtime execution of those macros.  */
+  (void) stdc_leading_zeros (uc);
+  (void) stdc_leading_zeros (us);
+  (void) stdc_leading_zeros (ui);
+  (void) stdc_leading_zeros (ul);
+  (void) stdc_leading_zeros (ull);
+  (void) stdc_leading_ones (uc);
+  (void) stdc_leading_ones (us);
+  (void) stdc_leading_ones (ui);
+  (void) stdc_leading_ones (ul);
+  (void) stdc_leading_ones (ull);
+  (void) stdc_trailing_zeros (uc);
+  (void) stdc_trailing_zeros (us);
+  (void) stdc_trailing_zeros (ui);
+  (void) stdc_trailing_zeros (ul);
+  (void) stdc_trailing_zeros (ull);
+  (void) stdc_trailing_ones (uc);
+  (void) stdc_trailing_ones (us);
+  (void) stdc_trailing_ones (ui);
+  (void) stdc_trailing_ones (ul);
+  (void) stdc_trailing_ones (ull);
+  (void) stdc_first_leading_zero (uc);
+  (void) stdc_first_leading_zero (us);
+  (void) stdc_first_leading_zero (ui);
+  (void) stdc_first_leading_zero (ul);
+  (void) stdc_first_leading_zero (ull);
+  (void) stdc_first_leading_one (uc);
+  (void) stdc_first_leading_one (us);
+  (void) stdc_first_leading_one (ui);
+  (void) stdc_first_leading_one (ul);
+  (void) stdc_first_leading_one (ull);
+  (void) stdc_first_trailing_zero (uc);
+  (void) stdc_first_trailing_zero (us);
+  (void) stdc_first_trailing_zero (ui);
+  (void) stdc_first_trailing_zero (ul);
+  (void) stdc_first_trailing_zero (ull);
+  (void) stdc_first_trailing_one (uc);
+  (void) stdc_first_trailing_one (us);
+  (void) stdc_first_trailing_one (ui);
+  (void) stdc_first_trailing_one (ul);
+  (void) stdc_first_trailing_one (ull);
+  (void) stdc_count_zeros (uc);
+  (void) stdc_count_zeros (us);
+  (void) stdc_count_zeros (ui);
+  (void) stdc_count_zeros (ul);
+  (void) stdc_count_zeros (ull);
+  (void) stdc_count_ones (uc);
+  (void) stdc_count_ones (us);
+  (void) stdc_count_ones (ui);
+  (void) stdc_count_ones (ul);
+  (void) stdc_count_ones (ull);
+  (void) stdc_has_single_bit (uc);
+  (void) stdc_has_single_bit (us);
+  (void) stdc_has_single_bit (ui);
+  (void) stdc_has_single_bit (ul);
+  (void) stdc_has_single_bit (ull);
+  (void) stdc_bit_width (uc);
+  (void) stdc_bit_width (us);
+  (void) stdc_bit_width (ui);
+  (void) stdc_bit_width (ul);
+  (void) stdc_bit_width (ull);
+  (void) stdc_bit_floor (uc);
+  (void) stdc_bit_floor (us);
+  (void) stdc_bit_floor (ui);
+  (void) stdc_bit_floor (ul);
+  (void) stdc_bit_floor (ull);
+  (void) stdc_bit_ceil (uc);
+  (void) stdc_bit_ceil (us);
+  (void) stdc_bit_ceil (ui);
+  (void) stdc_bit_ceil (ul);
+  (void) stdc_bit_ceil (ull);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdbit.h b/stdlib/tst-stdbit.h
new file mode 100644
index 0000000000..39b765beaa
--- /dev/null
+++ b/stdlib/tst-stdbit.h
@@ -0,0 +1,198 @@
+/* Common test support for <stdbit.h> tests.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _TST_STDBIT_H
+#define _TST_STDBIT_H
+
+#include <stdbit.h>
+#include <stdbool.h>
+
+#include <array_length.h>
+#include <support/check.h>
+
+struct stdbit_test
+{
+  /* The test input.  */
+  uint64_t x;
+  /* Expected results if that test input is converted to 8, 16, 32 or
+     64 bits and then passed to the function under test for that
+     width.  */
+  uint64_t res_8, res_16, res_32, res_64;
+};
+
+#define TEST_TYPE(EXPR, TYPE)						\
+  _Static_assert (_Generic ((EXPR), TYPE: 1, default: 0), "bad type")
+
+/* Test a <stdbit.h> function / macro.  For each function family, and
+   each input type, we test both with and without macros from the
+   header being used, both with a possibly wider argument being passed
+   (that must be truncated by the prototype) and with the argument
+   truncated in the caller, as well as testing the type-generic macro
+   (with the argument truncated in the caller).  Also test that the
+   results have the correct type; also test truncation from
+   floating-point arguments (valid for functions, including with macro
+   expansion, because the prototype must implicitly convert to integer
+   type; not valid for the type-generic macros).  Also test that the
+   argument is evaluated exactly once.  Also test the macros are
+   usable (e.g. in typeof) at top level (GCC doesn't allow ({})
+   outside functions: bug 93239).  */
+
+#define TEST_STDBIT_T(FUNC, X, RES, TTYPE, TYPE, SUFFIX)		\
+  do									\
+    {									\
+      TEST_COMPARE (FUNC ## SUFFIX (X), (RES));				\
+      TEST_TYPE (FUNC ## SUFFIX (X), TTYPE);				\
+      TEST_COMPARE ((FUNC ## SUFFIX) (X), (RES));			\
+      TEST_TYPE ((FUNC ## SUFFIX) (X), TTYPE);				\
+      TEST_COMPARE (FUNC ## SUFFIX ((TYPE) (X)), (RES));		\
+      TEST_TYPE (FUNC ## SUFFIX ((TYPE) (X)), TTYPE);			\
+      TEST_COMPARE ((FUNC ## SUFFIX) ((TYPE) (X)), (RES));		\
+      TEST_TYPE ((FUNC ## SUFFIX) ((TYPE) (X)), TTYPE);			\
+      TEST_COMPARE (FUNC ((TYPE) (X)), (RES));				\
+      TEST_TYPE (FUNC ((TYPE) (X)), TTYPE);				\
+      if (sizeof (TYPE) <= 2)						\
+	{								\
+	  TEST_COMPARE (FUNC ## SUFFIX ((float) (TYPE) (X)), (RES));	\
+	  TEST_TYPE (FUNC ## SUFFIX ((float) (TYPE) (X)), TTYPE);	\
+	  TEST_COMPARE ((FUNC ## SUFFIX) ((float) (TYPE) (X)), (RES));	\
+	  TEST_TYPE ((FUNC ## SUFFIX) ((float) (TYPE) (X)), TTYPE);	\
+	}								\
+      if (sizeof (TYPE) <= 4)						\
+	{								\
+	  TEST_COMPARE (FUNC ## SUFFIX ((double) (TYPE) (X)), (RES));	\
+	  TEST_TYPE (FUNC ## SUFFIX ((double) (TYPE) (X)), TTYPE);	\
+	  TEST_COMPARE ((FUNC ## SUFFIX) ((double) (TYPE) (X)), (RES));	\
+	  TEST_TYPE ((FUNC ## SUFFIX) ((double) (TYPE) (X)), TTYPE);	\
+	  TEST_COMPARE (FUNC ## SUFFIX ((long double) (TYPE) (X)), (RES)); \
+	  TEST_TYPE (FUNC ## SUFFIX ((long double) (TYPE) (X)), TTYPE); \
+	  TEST_COMPARE ((FUNC ## SUFFIX) ((long double) (TYPE) (X)), (RES)); \
+	  TEST_TYPE ((FUNC ## SUFFIX) ((long double) (TYPE) (X)), TTYPE); \
+	}								\
+      TYPE xt = (X);							\
+      TEST_COMPARE (FUNC ## SUFFIX (xt++), (RES));			\
+      TEST_COMPARE (xt, (TYPE) ((X) + 1));				\
+      xt = (X);								\
+      TEST_COMPARE (FUNC (xt++), (RES));				\
+      TEST_COMPARE (xt, (TYPE) ((X) + 1));				\
+    }									\
+  while (0)
+
+#define TEST_STDBIT_UI(FUNC, INPUTS)			\
+  do							\
+    for (int i = 0; i < array_length (INPUTS); i++)	\
+      {							\
+	uint64_t x = (INPUTS)[i].x;			\
+	unsigned int res_8 = (INPUTS)[i].res_8;		\
+	unsigned int res_16 = (INPUTS)[i].res_16;	\
+	unsigned int res_32 = (INPUTS)[i].res_32;	\
+	unsigned int res_64 = (INPUTS)[i].res_64;	\
+	unsigned int res_l = (sizeof (long int) == 4	\
+			      ? res_32 : res_64);	\
+	TEST_STDBIT_T (FUNC, x, res_8, unsigned int,	\
+		       unsigned char, _uc);		\
+	TEST_STDBIT_T (FUNC, x, res_16, unsigned int,	\
+		       unsigned short, _us);		\
+	TEST_STDBIT_T (FUNC, x, res_32, unsigned int,	\
+		       unsigned int, _ui);		\
+	TEST_STDBIT_T (FUNC, x, res_l, unsigned int,	\
+		       unsigned long int, _ul);		\
+	TEST_STDBIT_T (FUNC, x, res_64, unsigned int,	\
+		       unsigned long long int, _ull);	\
+      }							\
+  while (0)
+
+#define TEST_STDBIT_BOOL(FUNC, INPUTS)					\
+  do									\
+    for (int i = 0; i < array_length (INPUTS); i++)			\
+      {									\
+	uint64_t x = (INPUTS)[i].x;					\
+	bool res_8 = (INPUTS)[i].res_8;					\
+	bool res_16 = (INPUTS)[i].res_16;				\
+	bool res_32 = (INPUTS)[i].res_32;				\
+	bool res_64 = (INPUTS)[i].res_64;				\
+	bool res_l = (sizeof (long int) == 4 ? res_32 : res_64);	\
+	TEST_STDBIT_T (FUNC, x, res_8, _Bool, unsigned char, _uc);	\
+	TEST_STDBIT_T (FUNC, x, res_16, _Bool, unsigned short, _us);	\
+	TEST_STDBIT_T (FUNC, x, res_32, _Bool, unsigned int, _ui);	\
+	TEST_STDBIT_T (FUNC, x, res_l, _Bool, unsigned long int, _ul);	\
+	TEST_STDBIT_T (FUNC, x, res_64, _Bool,				\
+		       unsigned long long int, _ull);			\
+      }									\
+  while (0)
+
+#define TEST_STDBIT_SAME(FUNC, INPUTS)				\
+  do								\
+    for (int i = 0; i < array_length (INPUTS); i++)		\
+      {								\
+	uint64_t x = (INPUTS)[i].x;				\
+	unsigned char res_8 = (INPUTS)[i].res_8;		\
+	unsigned short res_16 = (INPUTS)[i].res_16;		\
+	unsigned int res_32 = (INPUTS)[i].res_32;		\
+	unsigned long long int res_64 = (INPUTS)[i].res_64;	\
+	unsigned long int res_l = (sizeof (long int) == 4	\
+				   ? res_32 : res_64);		\
+	TEST_STDBIT_T (FUNC, x, res_8, unsigned char,		\
+		       unsigned char, _uc);			\
+	TEST_STDBIT_T (FUNC, x, res_16, unsigned short,		\
+		       unsigned short, _us);			\
+	TEST_STDBIT_T (FUNC, x, res_32, unsigned int,		\
+		       unsigned int, _ui);			\
+	TEST_STDBIT_T (FUNC, x, res_l, unsigned long int,	\
+		       unsigned long int, _ul);			\
+	TEST_STDBIT_T (FUNC, x, res_64, unsigned long long int,	\
+		       unsigned long long int, _ull);		\
+      }								\
+  while (0)
+
+#define TEST_STDBIT_UI_TOPLEVEL(FUNC)				\
+  TEST_TYPE (FUNC ## _uc ((unsigned char) 0), unsigned int);	\
+  TEST_TYPE (FUNC ((unsigned char) 0), unsigned int);		\
+  TEST_TYPE (FUNC ## _us ((unsigned short) 0), unsigned int);	\
+  TEST_TYPE (FUNC ((unsigned short) 0), unsigned int);		\
+  TEST_TYPE (FUNC ## _ui (0U), unsigned int);			\
+  TEST_TYPE (FUNC (0U), unsigned int);				\
+  TEST_TYPE (FUNC ## _ul (0UL), unsigned int);			\
+  TEST_TYPE (FUNC (0UL), unsigned int);				\
+  TEST_TYPE (FUNC ## _ull (0ULL), unsigned int);		\
+  TEST_TYPE (FUNC (0ULL), unsigned int)
+
+#define TEST_STDBIT_BOOL_TOPLEVEL(FUNC)			\
+  TEST_TYPE (FUNC ## _uc ((unsigned char) 0), _Bool);	\
+  TEST_TYPE (FUNC ((unsigned char) 0), _Bool);		\
+  TEST_TYPE (FUNC ## _us ((unsigned short) 0), _Bool);	\
+  TEST_TYPE (FUNC ((unsigned short) 0), _Bool);		\
+  TEST_TYPE (FUNC ## _ui (0U), _Bool);			\
+  TEST_TYPE (FUNC (0U), _Bool);				\
+  TEST_TYPE (FUNC ## _ul (0UL), _Bool);			\
+  TEST_TYPE (FUNC (0UL), _Bool);			\
+  TEST_TYPE (FUNC ## _ull (0ULL), _Bool);		\
+  TEST_TYPE (FUNC (0ULL), _Bool)
+
+#define TEST_STDBIT_SAME_TOPLEVEL(FUNC)				\
+  TEST_TYPE (FUNC ## _uc ((unsigned char) 0), unsigned char);	\
+  TEST_TYPE (FUNC ((unsigned char) 0), unsigned char);		\
+  TEST_TYPE (FUNC ## _us ((unsigned short) 0), unsigned short);	\
+  TEST_TYPE (FUNC ((unsigned short) 0), unsigned short);	\
+  TEST_TYPE (FUNC ## _ui (0U), unsigned int);			\
+  TEST_TYPE (FUNC (0U), unsigned int);				\
+  TEST_TYPE (FUNC ## _ul (0UL), unsigned long int);		\
+  TEST_TYPE (FUNC (0UL), unsigned long int);			\
+  TEST_TYPE (FUNC ## _ull (0ULL), unsigned long long int);	\
+  TEST_TYPE (FUNC (0ULL), unsigned long long int)
+
+#endif
diff --git a/stdlib/tst-stdc_bit_ceil.c b/stdlib/tst-stdc_bit_ceil.c
new file mode 100644
index 0000000000..9f2f327a3a
--- /dev/null
+++ b/stdlib/tst-stdc_bit_ceil.c
@@ -0,0 +1,88 @@
+/* Test stdc_bit_ceil functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 0x1, 0x1, 0x1, 0x1ULL },
+    { 0x1ULL, 0x1, 0x1, 0x1, 0x1ULL },
+    { 0x2ULL, 0x2, 0x2, 0x2, 0x2ULL },
+    { 0x3ULL, 0x4, 0x4, 0x4, 0x4ULL },
+    { 0x4ULL, 0x4, 0x4, 0x4, 0x4ULL },
+    { 0x5ULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0x6ULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0x7ULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0x8ULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0x9ULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0xaULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0xbULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0xcULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0xdULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0xeULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0xfULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0x10ULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0x11ULL, 0x20, 0x20, 0x20, 0x20ULL },
+    { 0x12ULL, 0x20, 0x20, 0x20, 0x20ULL },
+    { 0x1fULL, 0x20, 0x20, 0x20, 0x20ULL },
+    { 0x20ULL, 0x20, 0x20, 0x20, 0x20ULL },
+    { 0x7fULL, 0x80, 0x80, 0x80, 0x80ULL },
+    { 0x80ULL, 0x80, 0x80, 0x80, 0x80ULL },
+    { 0x81ULL, 0, 0x100, 0x100, 0x100ULL },
+    { 0x9aULL, 0, 0x100, 0x100, 0x100ULL },
+    { 0xf3ULL, 0, 0x100, 0x100, 0x100ULL },
+    { 0xffULL, 0, 0x100, 0x100, 0x100ULL },
+    { 0x100ULL, 0x1, 0x100, 0x100, 0x100ULL },
+    { 0x101ULL, 0x1, 0x200, 0x200, 0x200ULL },
+    { 0x102ULL, 0x2, 0x200, 0x200, 0x200ULL },
+    { 0x1feULL, 0, 0x200, 0x200, 0x200ULL },
+    { 0x1ffULL, 0, 0x200, 0x200, 0x200ULL },
+    { 0x200ULL, 0x1, 0x200, 0x200, 0x200ULL },
+    { 0x234ULL, 0x40, 0x400, 0x400, 0x400ULL },
+    { 0x4567ULL, 0x80, 0x8000, 0x8000, 0x8000ULL },
+    { 0x7fffULL, 0, 0x8000, 0x8000, 0x8000ULL },
+    { 0x8000ULL, 0x1, 0x8000, 0x8000, 0x8000ULL },
+    { 0x8001ULL, 0x1, 0, 0x10000, 0x10000ULL },
+    { 0xfffeULL, 0, 0, 0x10000, 0x10000ULL },
+    { 0xffffULL, 0, 0, 0x10000, 0x10000ULL },
+    { 0x10000ULL, 0x1, 0x1, 0x10000, 0x10000ULL },
+    { 0x10001ULL, 0x1, 0x1, 0x20000, 0x20000ULL },
+    { 0xfedcba98ULL, 0, 0, 0, 0x100000000ULL },
+    { 0xfffffefeULL, 0, 0, 0, 0x100000000ULL },
+    { 0xffffffffULL, 0, 0, 0, 0x100000000ULL },
+    { 0x100000000ULL, 0x1, 0x1, 0x1, 0x100000000ULL },
+    { 0x100000001ULL, 0x1, 0x1, 0x1, 0x200000000ULL },
+    { 0x123456789ULL, 0, 0x8000, 0x40000000, 0x200000000ULL },
+    { 0x123456789abcdefULL, 0, 0, 0, 0x200000000000000ULL },
+    { 0x789abcdef0123456ULL, 0x80, 0x4000, 0, 0x8000000000000000ULL },
+    { 0x8000000000000000ULL, 0x1, 0x1, 0x1, 0x8000000000000000ULL },
+    { 0x8000000000000001ULL, 0x1, 0x1, 0x1, 0ULL },
+    { 0xfffffffffffffffeULL, 0, 0, 0, 0ULL },
+    { 0xffffffffffffffffULL, 0, 0, 0, 0ULL },
+  };
+
+TEST_STDBIT_SAME_TOPLEVEL (stdc_bit_ceil);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_SAME (stdc_bit_ceil, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_bit_floor.c b/stdlib/tst-stdc_bit_floor.c
new file mode 100644
index 0000000000..3f1d0537fd
--- /dev/null
+++ b/stdlib/tst-stdc_bit_floor.c
@@ -0,0 +1,88 @@
+/* Test stdc_bit_floor functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 0, 0, 0, 0ULL },
+    { 0x1ULL, 0x1, 0x1, 0x1, 0x1ULL },
+    { 0x2ULL, 0x2, 0x2, 0x2, 0x2ULL },
+    { 0x3ULL, 0x2, 0x2, 0x2, 0x2ULL },
+    { 0x4ULL, 0x4, 0x4, 0x4, 0x4ULL },
+    { 0x5ULL, 0x4, 0x4, 0x4, 0x4ULL },
+    { 0x6ULL, 0x4, 0x4, 0x4, 0x4ULL },
+    { 0x7ULL, 0x4, 0x4, 0x4, 0x4ULL },
+    { 0x8ULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0x9ULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0xaULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0xbULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0xcULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0xdULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0xeULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0xfULL, 0x8, 0x8, 0x8, 0x8ULL },
+    { 0x10ULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0x11ULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0x12ULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0x1fULL, 0x10, 0x10, 0x10, 0x10ULL },
+    { 0x20ULL, 0x20, 0x20, 0x20, 0x20ULL },
+    { 0x7fULL, 0x40, 0x40, 0x40, 0x40ULL },
+    { 0x80ULL, 0x80, 0x80, 0x80, 0x80ULL },
+    { 0x81ULL, 0x80, 0x80, 0x80, 0x80ULL },
+    { 0x9aULL, 0x80, 0x80, 0x80, 0x80ULL },
+    { 0xf3ULL, 0x80, 0x80, 0x80, 0x80ULL },
+    { 0xffULL, 0x80, 0x80, 0x80, 0x80ULL },
+    { 0x100ULL, 0, 0x100, 0x100, 0x100ULL },
+    { 0x101ULL, 0x1, 0x100, 0x100, 0x100ULL },
+    { 0x102ULL, 0x2, 0x100, 0x100, 0x100ULL },
+    { 0x1feULL, 0x80, 0x100, 0x100, 0x100ULL },
+    { 0x1ffULL, 0x80, 0x100, 0x100, 0x100ULL },
+    { 0x200ULL, 0, 0x200, 0x200, 0x200ULL },
+    { 0x234ULL, 0x20, 0x200, 0x200, 0x200ULL },
+    { 0x4567ULL, 0x40, 0x4000, 0x4000, 0x4000ULL },
+    { 0x7fffULL, 0x80, 0x4000, 0x4000, 0x4000ULL },
+    { 0x8000ULL, 0, 0x8000, 0x8000, 0x8000ULL },
+    { 0x8001ULL, 0x1, 0x8000, 0x8000, 0x8000ULL },
+    { 0xfffeULL, 0x80, 0x8000, 0x8000, 0x8000ULL },
+    { 0xffffULL, 0x80, 0x8000, 0x8000, 0x8000ULL },
+    { 0x10000ULL, 0, 0, 0x10000, 0x10000ULL },
+    { 0x10001ULL, 0x1, 0x1, 0x10000, 0x10000ULL },
+    { 0xfedcba98ULL, 0x80, 0x8000, 0x80000000, 0x80000000ULL },
+    { 0xfffffefeULL, 0x80, 0x8000, 0x80000000, 0x80000000ULL },
+    { 0xffffffffULL, 0x80, 0x8000, 0x80000000, 0x80000000ULL },
+    { 0x100000000ULL, 0, 0, 0, 0x100000000ULL },
+    { 0x100000001ULL, 0x1, 0x1, 0x1, 0x100000000ULL },
+    { 0x123456789ULL, 0x80, 0x4000, 0x20000000, 0x100000000ULL },
+    { 0x123456789abcdefULL, 0x80, 0x8000, 0x80000000, 0x100000000000000ULL },
+    { 0x789abcdef0123456ULL, 0x40, 0x2000, 0x80000000, 0x4000000000000000ULL },
+    { 0x8000000000000000ULL, 0, 0, 0, 0x8000000000000000ULL },
+    { 0x8000000000000001ULL, 0x1, 0x1, 0x1, 0x8000000000000000ULL },
+    { 0xfffffffffffffffeULL, 0x80, 0x8000, 0x80000000, 0x8000000000000000ULL },
+    { 0xffffffffffffffffULL, 0x80, 0x8000, 0x80000000, 0x8000000000000000ULL },
+  };
+
+TEST_STDBIT_SAME_TOPLEVEL (stdc_bit_floor);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_SAME (stdc_bit_floor, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_bit_width.c b/stdlib/tst-stdc_bit_width.c
new file mode 100644
index 0000000000..b3bb6f6818
--- /dev/null
+++ b/stdlib/tst-stdc_bit_width.c
@@ -0,0 +1,88 @@
+/* Test stdc_bit_width functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 0, 0, 0, 0 },
+    { 0x1ULL, 1, 1, 1, 1 },
+    { 0x2ULL, 2, 2, 2, 2 },
+    { 0x3ULL, 2, 2, 2, 2 },
+    { 0x4ULL, 3, 3, 3, 3 },
+    { 0x5ULL, 3, 3, 3, 3 },
+    { 0x6ULL, 3, 3, 3, 3 },
+    { 0x7ULL, 3, 3, 3, 3 },
+    { 0x8ULL, 4, 4, 4, 4 },
+    { 0x9ULL, 4, 4, 4, 4 },
+    { 0xaULL, 4, 4, 4, 4 },
+    { 0xbULL, 4, 4, 4, 4 },
+    { 0xcULL, 4, 4, 4, 4 },
+    { 0xdULL, 4, 4, 4, 4 },
+    { 0xeULL, 4, 4, 4, 4 },
+    { 0xfULL, 4, 4, 4, 4 },
+    { 0x10ULL, 5, 5, 5, 5 },
+    { 0x11ULL, 5, 5, 5, 5 },
+    { 0x12ULL, 5, 5, 5, 5 },
+    { 0x1fULL, 5, 5, 5, 5 },
+    { 0x20ULL, 6, 6, 6, 6 },
+    { 0x7fULL, 7, 7, 7, 7 },
+    { 0x80ULL, 8, 8, 8, 8 },
+    { 0x81ULL, 8, 8, 8, 8 },
+    { 0x9aULL, 8, 8, 8, 8 },
+    { 0xf3ULL, 8, 8, 8, 8 },
+    { 0xffULL, 8, 8, 8, 8 },
+    { 0x100ULL, 0, 9, 9, 9 },
+    { 0x101ULL, 1, 9, 9, 9 },
+    { 0x102ULL, 2, 9, 9, 9 },
+    { 0x1feULL, 8, 9, 9, 9 },
+    { 0x1ffULL, 8, 9, 9, 9 },
+    { 0x200ULL, 0, 10, 10, 10 },
+    { 0x234ULL, 6, 10, 10, 10 },
+    { 0x4567ULL, 7, 15, 15, 15 },
+    { 0x7fffULL, 8, 15, 15, 15 },
+    { 0x8000ULL, 0, 16, 16, 16 },
+    { 0x8001ULL, 1, 16, 16, 16 },
+    { 0xfffeULL, 8, 16, 16, 16 },
+    { 0xffffULL, 8, 16, 16, 16 },
+    { 0x10000ULL, 0, 0, 17, 17 },
+    { 0x10001ULL, 1, 1, 17, 17 },
+    { 0xfedcba98ULL, 8, 16, 32, 32 },
+    { 0xfffffefeULL, 8, 16, 32, 32 },
+    { 0xffffffffULL, 8, 16, 32, 32 },
+    { 0x100000000ULL, 0, 0, 0, 33 },
+    { 0x100000001ULL, 1, 1, 1, 33 },
+    { 0x123456789ULL, 8, 15, 30, 33 },
+    { 0x123456789abcdefULL, 8, 16, 32, 57 },
+    { 0x789abcdef0123456ULL, 7, 14, 32, 63 },
+    { 0x8000000000000000ULL, 0, 0, 0, 64 },
+    { 0x8000000000000001ULL, 1, 1, 1, 64 },
+    { 0xfffffffffffffffeULL, 8, 16, 32, 64 },
+    { 0xffffffffffffffffULL, 8, 16, 32, 64 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_bit_width);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_bit_width, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_count_ones.c b/stdlib/tst-stdc_count_ones.c
new file mode 100644
index 0000000000..8f8e3a7233
--- /dev/null
+++ b/stdlib/tst-stdc_count_ones.c
@@ -0,0 +1,88 @@
+/* Test stdc_count_ones functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 0, 0, 0, 0 },
+    { 0x1ULL, 1, 1, 1, 1 },
+    { 0x2ULL, 1, 1, 1, 1 },
+    { 0x3ULL, 2, 2, 2, 2 },
+    { 0x4ULL, 1, 1, 1, 1 },
+    { 0x5ULL, 2, 2, 2, 2 },
+    { 0x6ULL, 2, 2, 2, 2 },
+    { 0x7ULL, 3, 3, 3, 3 },
+    { 0x8ULL, 1, 1, 1, 1 },
+    { 0x9ULL, 2, 2, 2, 2 },
+    { 0xaULL, 2, 2, 2, 2 },
+    { 0xbULL, 3, 3, 3, 3 },
+    { 0xcULL, 2, 2, 2, 2 },
+    { 0xdULL, 3, 3, 3, 3 },
+    { 0xeULL, 3, 3, 3, 3 },
+    { 0xfULL, 4, 4, 4, 4 },
+    { 0x10ULL, 1, 1, 1, 1 },
+    { 0x11ULL, 2, 2, 2, 2 },
+    { 0x12ULL, 2, 2, 2, 2 },
+    { 0x1fULL, 5, 5, 5, 5 },
+    { 0x20ULL, 1, 1, 1, 1 },
+    { 0x7fULL, 7, 7, 7, 7 },
+    { 0x80ULL, 1, 1, 1, 1 },
+    { 0x81ULL, 2, 2, 2, 2 },
+    { 0x9aULL, 4, 4, 4, 4 },
+    { 0xf3ULL, 6, 6, 6, 6 },
+    { 0xffULL, 8, 8, 8, 8 },
+    { 0x100ULL, 0, 1, 1, 1 },
+    { 0x101ULL, 1, 2, 2, 2 },
+    { 0x102ULL, 1, 2, 2, 2 },
+    { 0x1feULL, 7, 8, 8, 8 },
+    { 0x1ffULL, 8, 9, 9, 9 },
+    { 0x200ULL, 0, 1, 1, 1 },
+    { 0x234ULL, 3, 4, 4, 4 },
+    { 0x4567ULL, 5, 8, 8, 8 },
+    { 0x7fffULL, 8, 15, 15, 15 },
+    { 0x8000ULL, 0, 1, 1, 1 },
+    { 0x8001ULL, 1, 2, 2, 2 },
+    { 0xfffeULL, 7, 15, 15, 15 },
+    { 0xffffULL, 8, 16, 16, 16 },
+    { 0x10000ULL, 0, 0, 1, 1 },
+    { 0x10001ULL, 1, 1, 2, 2 },
+    { 0xfedcba98ULL, 3, 8, 20, 20 },
+    { 0xfffffefeULL, 7, 14, 30, 30 },
+    { 0xffffffffULL, 8, 16, 32, 32 },
+    { 0x100000000ULL, 0, 0, 0, 1 },
+    { 0x100000001ULL, 1, 1, 1, 2 },
+    { 0x123456789ULL, 3, 8, 14, 15 },
+    { 0x123456789abcdefULL, 7, 12, 20, 32 },
+    { 0x789abcdef0123456ULL, 4, 7, 13, 32 },
+    { 0x8000000000000000ULL, 0, 0, 0, 1 },
+    { 0x8000000000000001ULL, 1, 1, 1, 2 },
+    { 0xfffffffffffffffeULL, 7, 15, 31, 63 },
+    { 0xffffffffffffffffULL, 8, 16, 32, 64 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_count_ones);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_count_ones, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_count_zeros.c b/stdlib/tst-stdc_count_zeros.c
new file mode 100644
index 0000000000..cb72c83e1a
--- /dev/null
+++ b/stdlib/tst-stdc_count_zeros.c
@@ -0,0 +1,88 @@
+/* Test stdc_count_zeros functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 8, 16, 32, 64 },
+    { 0x1ULL, 7, 15, 31, 63 },
+    { 0x2ULL, 7, 15, 31, 63 },
+    { 0x3ULL, 6, 14, 30, 62 },
+    { 0x4ULL, 7, 15, 31, 63 },
+    { 0x5ULL, 6, 14, 30, 62 },
+    { 0x6ULL, 6, 14, 30, 62 },
+    { 0x7ULL, 5, 13, 29, 61 },
+    { 0x8ULL, 7, 15, 31, 63 },
+    { 0x9ULL, 6, 14, 30, 62 },
+    { 0xaULL, 6, 14, 30, 62 },
+    { 0xbULL, 5, 13, 29, 61 },
+    { 0xcULL, 6, 14, 30, 62 },
+    { 0xdULL, 5, 13, 29, 61 },
+    { 0xeULL, 5, 13, 29, 61 },
+    { 0xfULL, 4, 12, 28, 60 },
+    { 0x10ULL, 7, 15, 31, 63 },
+    { 0x11ULL, 6, 14, 30, 62 },
+    { 0x12ULL, 6, 14, 30, 62 },
+    { 0x1fULL, 3, 11, 27, 59 },
+    { 0x20ULL, 7, 15, 31, 63 },
+    { 0x7fULL, 1, 9, 25, 57 },
+    { 0x80ULL, 7, 15, 31, 63 },
+    { 0x81ULL, 6, 14, 30, 62 },
+    { 0x9aULL, 4, 12, 28, 60 },
+    { 0xf3ULL, 2, 10, 26, 58 },
+    { 0xffULL, 0, 8, 24, 56 },
+    { 0x100ULL, 8, 15, 31, 63 },
+    { 0x101ULL, 7, 14, 30, 62 },
+    { 0x102ULL, 7, 14, 30, 62 },
+    { 0x1feULL, 1, 8, 24, 56 },
+    { 0x1ffULL, 0, 7, 23, 55 },
+    { 0x200ULL, 8, 15, 31, 63 },
+    { 0x234ULL, 5, 12, 28, 60 },
+    { 0x4567ULL, 3, 8, 24, 56 },
+    { 0x7fffULL, 0, 1, 17, 49 },
+    { 0x8000ULL, 8, 15, 31, 63 },
+    { 0x8001ULL, 7, 14, 30, 62 },
+    { 0xfffeULL, 1, 1, 17, 49 },
+    { 0xffffULL, 0, 0, 16, 48 },
+    { 0x10000ULL, 8, 16, 31, 63 },
+    { 0x10001ULL, 7, 15, 30, 62 },
+    { 0xfedcba98ULL, 5, 8, 12, 44 },
+    { 0xfffffefeULL, 1, 2, 2, 34 },
+    { 0xffffffffULL, 0, 0, 0, 32 },
+    { 0x100000000ULL, 8, 16, 32, 63 },
+    { 0x100000001ULL, 7, 15, 31, 62 },
+    { 0x123456789ULL, 5, 8, 18, 49 },
+    { 0x123456789abcdefULL, 1, 4, 12, 32 },
+    { 0x789abcdef0123456ULL, 4, 9, 19, 32 },
+    { 0x8000000000000000ULL, 8, 16, 32, 63 },
+    { 0x8000000000000001ULL, 7, 15, 31, 62 },
+    { 0xfffffffffffffffeULL, 1, 1, 1, 1 },
+    { 0xffffffffffffffffULL, 0, 0, 0, 0 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_count_zeros);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_count_zeros, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_first_leading_one.c b/stdlib/tst-stdc_first_leading_one.c
new file mode 100644
index 0000000000..63f24bd5fe
--- /dev/null
+++ b/stdlib/tst-stdc_first_leading_one.c
@@ -0,0 +1,88 @@
+/* Test stdc_first_leading_one functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 0, 0, 0, 0 },
+    { 0x1ULL, 8, 16, 32, 64 },
+    { 0x2ULL, 7, 15, 31, 63 },
+    { 0x3ULL, 7, 15, 31, 63 },
+    { 0x4ULL, 6, 14, 30, 62 },
+    { 0x5ULL, 6, 14, 30, 62 },
+    { 0x6ULL, 6, 14, 30, 62 },
+    { 0x7ULL, 6, 14, 30, 62 },
+    { 0x8ULL, 5, 13, 29, 61 },
+    { 0x9ULL, 5, 13, 29, 61 },
+    { 0xaULL, 5, 13, 29, 61 },
+    { 0xbULL, 5, 13, 29, 61 },
+    { 0xcULL, 5, 13, 29, 61 },
+    { 0xdULL, 5, 13, 29, 61 },
+    { 0xeULL, 5, 13, 29, 61 },
+    { 0xfULL, 5, 13, 29, 61 },
+    { 0x10ULL, 4, 12, 28, 60 },
+    { 0x11ULL, 4, 12, 28, 60 },
+    { 0x12ULL, 4, 12, 28, 60 },
+    { 0x1fULL, 4, 12, 28, 60 },
+    { 0x20ULL, 3, 11, 27, 59 },
+    { 0x7fULL, 2, 10, 26, 58 },
+    { 0x80ULL, 1, 9, 25, 57 },
+    { 0x81ULL, 1, 9, 25, 57 },
+    { 0x9aULL, 1, 9, 25, 57 },
+    { 0xf3ULL, 1, 9, 25, 57 },
+    { 0xffULL, 1, 9, 25, 57 },
+    { 0x100ULL, 0, 8, 24, 56 },
+    { 0x101ULL, 8, 8, 24, 56 },
+    { 0x102ULL, 7, 8, 24, 56 },
+    { 0x1feULL, 1, 8, 24, 56 },
+    { 0x1ffULL, 1, 8, 24, 56 },
+    { 0x200ULL, 0, 7, 23, 55 },
+    { 0x234ULL, 3, 7, 23, 55 },
+    { 0x4567ULL, 2, 2, 18, 50 },
+    { 0x7fffULL, 1, 2, 18, 50 },
+    { 0x8000ULL, 0, 1, 17, 49 },
+    { 0x8001ULL, 8, 1, 17, 49 },
+    { 0xfffeULL, 1, 1, 17, 49 },
+    { 0xffffULL, 1, 1, 17, 49 },
+    { 0x10000ULL, 0, 0, 16, 48 },
+    { 0x10001ULL, 8, 16, 16, 48 },
+    { 0xfedcba98ULL, 1, 1, 1, 33 },
+    { 0xfffffefeULL, 1, 1, 1, 33 },
+    { 0xffffffffULL, 1, 1, 1, 33 },
+    { 0x100000000ULL, 0, 0, 0, 32 },
+    { 0x100000001ULL, 8, 16, 32, 32 },
+    { 0x123456789ULL, 1, 2, 3, 32 },
+    { 0x123456789abcdefULL, 1, 1, 1, 8 },
+    { 0x789abcdef0123456ULL, 2, 3, 1, 2 },
+    { 0x8000000000000000ULL, 0, 0, 0, 1 },
+    { 0x8000000000000001ULL, 8, 16, 32, 1 },
+    { 0xfffffffffffffffeULL, 1, 1, 1, 1 },
+    { 0xffffffffffffffffULL, 1, 1, 1, 1 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_first_leading_one);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_first_leading_one, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_first_leading_zero.c b/stdlib/tst-stdc_first_leading_zero.c
new file mode 100644
index 0000000000..b9d11677e3
--- /dev/null
+++ b/stdlib/tst-stdc_first_leading_zero.c
@@ -0,0 +1,88 @@
+/* Test stdc_first_leading_zero functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 1, 1, 1, 1 },
+    { 0x1ULL, 1, 1, 1, 1 },
+    { 0x2ULL, 1, 1, 1, 1 },
+    { 0x3ULL, 1, 1, 1, 1 },
+    { 0x4ULL, 1, 1, 1, 1 },
+    { 0x5ULL, 1, 1, 1, 1 },
+    { 0x6ULL, 1, 1, 1, 1 },
+    { 0x7ULL, 1, 1, 1, 1 },
+    { 0x8ULL, 1, 1, 1, 1 },
+    { 0x9ULL, 1, 1, 1, 1 },
+    { 0xaULL, 1, 1, 1, 1 },
+    { 0xbULL, 1, 1, 1, 1 },
+    { 0xcULL, 1, 1, 1, 1 },
+    { 0xdULL, 1, 1, 1, 1 },
+    { 0xeULL, 1, 1, 1, 1 },
+    { 0xfULL, 1, 1, 1, 1 },
+    { 0x10ULL, 1, 1, 1, 1 },
+    { 0x11ULL, 1, 1, 1, 1 },
+    { 0x12ULL, 1, 1, 1, 1 },
+    { 0x1fULL, 1, 1, 1, 1 },
+    { 0x20ULL, 1, 1, 1, 1 },
+    { 0x7fULL, 1, 1, 1, 1 },
+    { 0x80ULL, 2, 1, 1, 1 },
+    { 0x81ULL, 2, 1, 1, 1 },
+    { 0x9aULL, 2, 1, 1, 1 },
+    { 0xf3ULL, 5, 1, 1, 1 },
+    { 0xffULL, 0, 1, 1, 1 },
+    { 0x100ULL, 1, 1, 1, 1 },
+    { 0x101ULL, 1, 1, 1, 1 },
+    { 0x102ULL, 1, 1, 1, 1 },
+    { 0x1feULL, 8, 1, 1, 1 },
+    { 0x1ffULL, 0, 1, 1, 1 },
+    { 0x200ULL, 1, 1, 1, 1 },
+    { 0x234ULL, 1, 1, 1, 1 },
+    { 0x4567ULL, 1, 1, 1, 1 },
+    { 0x7fffULL, 0, 1, 1, 1 },
+    { 0x8000ULL, 1, 2, 1, 1 },
+    { 0x8001ULL, 1, 2, 1, 1 },
+    { 0xfffeULL, 8, 16, 1, 1 },
+    { 0xffffULL, 0, 0, 1, 1 },
+    { 0x10000ULL, 1, 1, 1, 1 },
+    { 0x10001ULL, 1, 1, 1, 1 },
+    { 0xfedcba98ULL, 2, 2, 8, 1 },
+    { 0xfffffefeULL, 8, 8, 24, 1 },
+    { 0xffffffffULL, 0, 0, 0, 1 },
+    { 0x100000000ULL, 1, 1, 1, 1 },
+    { 0x100000001ULL, 1, 1, 1, 1 },
+    { 0x123456789ULL, 2, 1, 1, 1 },
+    { 0x123456789abcdefULL, 4, 3, 2, 1 },
+    { 0x789abcdef0123456ULL, 1, 1, 5, 1 },
+    { 0x8000000000000000ULL, 1, 1, 1, 2 },
+    { 0x8000000000000001ULL, 1, 1, 1, 2 },
+    { 0xfffffffffffffffeULL, 8, 16, 32, 64 },
+    { 0xffffffffffffffffULL, 0, 0, 0, 0 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_first_leading_zero);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_first_leading_zero, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_first_trailing_one.c b/stdlib/tst-stdc_first_trailing_one.c
new file mode 100644
index 0000000000..d4eeb22e0a
--- /dev/null
+++ b/stdlib/tst-stdc_first_trailing_one.c
@@ -0,0 +1,88 @@
+/* Test stdc_first_trailing_one functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 0, 0, 0, 0 },
+    { 0x1ULL, 1, 1, 1, 1 },
+    { 0x2ULL, 2, 2, 2, 2 },
+    { 0x3ULL, 1, 1, 1, 1 },
+    { 0x4ULL, 3, 3, 3, 3 },
+    { 0x5ULL, 1, 1, 1, 1 },
+    { 0x6ULL, 2, 2, 2, 2 },
+    { 0x7ULL, 1, 1, 1, 1 },
+    { 0x8ULL, 4, 4, 4, 4 },
+    { 0x9ULL, 1, 1, 1, 1 },
+    { 0xaULL, 2, 2, 2, 2 },
+    { 0xbULL, 1, 1, 1, 1 },
+    { 0xcULL, 3, 3, 3, 3 },
+    { 0xdULL, 1, 1, 1, 1 },
+    { 0xeULL, 2, 2, 2, 2 },
+    { 0xfULL, 1, 1, 1, 1 },
+    { 0x10ULL, 5, 5, 5, 5 },
+    { 0x11ULL, 1, 1, 1, 1 },
+    { 0x12ULL, 2, 2, 2, 2 },
+    { 0x1fULL, 1, 1, 1, 1 },
+    { 0x20ULL, 6, 6, 6, 6 },
+    { 0x7fULL, 1, 1, 1, 1 },
+    { 0x80ULL, 8, 8, 8, 8 },
+    { 0x81ULL, 1, 1, 1, 1 },
+    { 0x9aULL, 2, 2, 2, 2 },
+    { 0xf3ULL, 1, 1, 1, 1 },
+    { 0xffULL, 1, 1, 1, 1 },
+    { 0x100ULL, 0, 9, 9, 9 },
+    { 0x101ULL, 1, 1, 1, 1 },
+    { 0x102ULL, 2, 2, 2, 2 },
+    { 0x1feULL, 2, 2, 2, 2 },
+    { 0x1ffULL, 1, 1, 1, 1 },
+    { 0x200ULL, 0, 10, 10, 10 },
+    { 0x234ULL, 3, 3, 3, 3 },
+    { 0x4567ULL, 1, 1, 1, 1 },
+    { 0x7fffULL, 1, 1, 1, 1 },
+    { 0x8000ULL, 0, 16, 16, 16 },
+    { 0x8001ULL, 1, 1, 1, 1 },
+    { 0xfffeULL, 2, 2, 2, 2 },
+    { 0xffffULL, 1, 1, 1, 1 },
+    { 0x10000ULL, 0, 0, 17, 17 },
+    { 0x10001ULL, 1, 1, 1, 1 },
+    { 0xfedcba98ULL, 4, 4, 4, 4 },
+    { 0xfffffefeULL, 2, 2, 2, 2 },
+    { 0xffffffffULL, 1, 1, 1, 1 },
+    { 0x100000000ULL, 0, 0, 0, 33 },
+    { 0x100000001ULL, 1, 1, 1, 1 },
+    { 0x123456789ULL, 1, 1, 1, 1 },
+    { 0x123456789abcdefULL, 1, 1, 1, 1 },
+    { 0x789abcdef0123456ULL, 2, 2, 2, 2 },
+    { 0x8000000000000000ULL, 0, 0, 0, 64 },
+    { 0x8000000000000001ULL, 1, 1, 1, 1 },
+    { 0xfffffffffffffffeULL, 2, 2, 2, 2 },
+    { 0xffffffffffffffffULL, 1, 1, 1, 1 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_first_trailing_one);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_first_trailing_one, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_first_trailing_zero.c b/stdlib/tst-stdc_first_trailing_zero.c
new file mode 100644
index 0000000000..4a804e2d5f
--- /dev/null
+++ b/stdlib/tst-stdc_first_trailing_zero.c
@@ -0,0 +1,88 @@
+/* Test stdc_first_trailing_zero functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 1, 1, 1, 1 },
+    { 0x1ULL, 2, 2, 2, 2 },
+    { 0x2ULL, 1, 1, 1, 1 },
+    { 0x3ULL, 3, 3, 3, 3 },
+    { 0x4ULL, 1, 1, 1, 1 },
+    { 0x5ULL, 2, 2, 2, 2 },
+    { 0x6ULL, 1, 1, 1, 1 },
+    { 0x7ULL, 4, 4, 4, 4 },
+    { 0x8ULL, 1, 1, 1, 1 },
+    { 0x9ULL, 2, 2, 2, 2 },
+    { 0xaULL, 1, 1, 1, 1 },
+    { 0xbULL, 3, 3, 3, 3 },
+    { 0xcULL, 1, 1, 1, 1 },
+    { 0xdULL, 2, 2, 2, 2 },
+    { 0xeULL, 1, 1, 1, 1 },
+    { 0xfULL, 5, 5, 5, 5 },
+    { 0x10ULL, 1, 1, 1, 1 },
+    { 0x11ULL, 2, 2, 2, 2 },
+    { 0x12ULL, 1, 1, 1, 1 },
+    { 0x1fULL, 6, 6, 6, 6 },
+    { 0x20ULL, 1, 1, 1, 1 },
+    { 0x7fULL, 8, 8, 8, 8 },
+    { 0x80ULL, 1, 1, 1, 1 },
+    { 0x81ULL, 2, 2, 2, 2 },
+    { 0x9aULL, 1, 1, 1, 1 },
+    { 0xf3ULL, 3, 3, 3, 3 },
+    { 0xffULL, 0, 9, 9, 9 },
+    { 0x100ULL, 1, 1, 1, 1 },
+    { 0x101ULL, 2, 2, 2, 2 },
+    { 0x102ULL, 1, 1, 1, 1 },
+    { 0x1feULL, 1, 1, 1, 1 },
+    { 0x1ffULL, 0, 10, 10, 10 },
+    { 0x200ULL, 1, 1, 1, 1 },
+    { 0x234ULL, 1, 1, 1, 1 },
+    { 0x4567ULL, 4, 4, 4, 4 },
+    { 0x7fffULL, 0, 16, 16, 16 },
+    { 0x8000ULL, 1, 1, 1, 1 },
+    { 0x8001ULL, 2, 2, 2, 2 },
+    { 0xfffeULL, 1, 1, 1, 1 },
+    { 0xffffULL, 0, 0, 17, 17 },
+    { 0x10000ULL, 1, 1, 1, 1 },
+    { 0x10001ULL, 2, 2, 2, 2 },
+    { 0xfedcba98ULL, 1, 1, 1, 1 },
+    { 0xfffffefeULL, 1, 1, 1, 1 },
+    { 0xffffffffULL, 0, 0, 0, 33 },
+    { 0x100000000ULL, 1, 1, 1, 1 },
+    { 0x100000001ULL, 2, 2, 2, 2 },
+    { 0x123456789ULL, 2, 2, 2, 2 },
+    { 0x123456789abcdefULL, 5, 5, 5, 5 },
+    { 0x789abcdef0123456ULL, 1, 1, 1, 1 },
+    { 0x8000000000000000ULL, 1, 1, 1, 1 },
+    { 0x8000000000000001ULL, 2, 2, 2, 2 },
+    { 0xfffffffffffffffeULL, 1, 1, 1, 1 },
+    { 0xffffffffffffffffULL, 0, 0, 0, 0 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_first_trailing_zero);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_first_trailing_zero, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_has_single_bit.c b/stdlib/tst-stdc_has_single_bit.c
new file mode 100644
index 0000000000..2a2c855825
--- /dev/null
+++ b/stdlib/tst-stdc_has_single_bit.c
@@ -0,0 +1,88 @@
+/* Test stdc_has_single_bit functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, false, false, false, false },
+    { 0x1ULL, true, true, true, true },
+    { 0x2ULL, true, true, true, true },
+    { 0x3ULL, false, false, false, false },
+    { 0x4ULL, true, true, true, true },
+    { 0x5ULL, false, false, false, false },
+    { 0x6ULL, false, false, false, false },
+    { 0x7ULL, false, false, false, false },
+    { 0x8ULL, true, true, true, true },
+    { 0x9ULL, false, false, false, false },
+    { 0xaULL, false, false, false, false },
+    { 0xbULL, false, false, false, false },
+    { 0xcULL, false, false, false, false },
+    { 0xdULL, false, false, false, false },
+    { 0xeULL, false, false, false, false },
+    { 0xfULL, false, false, false, false },
+    { 0x10ULL, true, true, true, true },
+    { 0x11ULL, false, false, false, false },
+    { 0x12ULL, false, false, false, false },
+    { 0x1fULL, false, false, false, false },
+    { 0x20ULL, true, true, true, true },
+    { 0x7fULL, false, false, false, false },
+    { 0x80ULL, true, true, true, true },
+    { 0x81ULL, false, false, false, false },
+    { 0x9aULL, false, false, false, false },
+    { 0xf3ULL, false, false, false, false },
+    { 0xffULL, false, false, false, false },
+    { 0x100ULL, false, true, true, true },
+    { 0x101ULL, true, false, false, false },
+    { 0x102ULL, true, false, false, false },
+    { 0x1feULL, false, false, false, false },
+    { 0x1ffULL, false, false, false, false },
+    { 0x200ULL, false, true, true, true },
+    { 0x234ULL, false, false, false, false },
+    { 0x4567ULL, false, false, false, false },
+    { 0x7fffULL, false, false, false, false },
+    { 0x8000ULL, false, true, true, true },
+    { 0x8001ULL, true, false, false, false },
+    { 0xfffeULL, false, false, false, false },
+    { 0xffffULL, false, false, false, false },
+    { 0x10000ULL, false, false, true, true },
+    { 0x10001ULL, true, true, false, false },
+    { 0xfedcba98ULL, false, false, false, false },
+    { 0xfffffefeULL, false, false, false, false },
+    { 0xffffffffULL, false, false, false, false },
+    { 0x100000000ULL, false, false, false, true },
+    { 0x100000001ULL, true, true, true, false },
+    { 0x123456789ULL, false, false, false, false },
+    { 0x123456789abcdefULL, false, false, false, false },
+    { 0x789abcdef0123456ULL, false, false, false, false },
+    { 0x8000000000000000ULL, false, false, false, true },
+    { 0x8000000000000001ULL, true, true, true, false },
+    { 0xfffffffffffffffeULL, false, false, false, false },
+    { 0xffffffffffffffffULL, false, false, false, false },
+  };
+
+TEST_STDBIT_BOOL_TOPLEVEL (stdc_has_single_bit);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_BOOL (stdc_has_single_bit, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_leading_ones.c b/stdlib/tst-stdc_leading_ones.c
new file mode 100644
index 0000000000..8d8ccd5ecf
--- /dev/null
+++ b/stdlib/tst-stdc_leading_ones.c
@@ -0,0 +1,88 @@
+/* Test stdc_leading_ones functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 0, 0, 0, 0 },
+    { 0x1ULL, 0, 0, 0, 0 },
+    { 0x2ULL, 0, 0, 0, 0 },
+    { 0x3ULL, 0, 0, 0, 0 },
+    { 0x4ULL, 0, 0, 0, 0 },
+    { 0x5ULL, 0, 0, 0, 0 },
+    { 0x6ULL, 0, 0, 0, 0 },
+    { 0x7ULL, 0, 0, 0, 0 },
+    { 0x8ULL, 0, 0, 0, 0 },
+    { 0x9ULL, 0, 0, 0, 0 },
+    { 0xaULL, 0, 0, 0, 0 },
+    { 0xbULL, 0, 0, 0, 0 },
+    { 0xcULL, 0, 0, 0, 0 },
+    { 0xdULL, 0, 0, 0, 0 },
+    { 0xeULL, 0, 0, 0, 0 },
+    { 0xfULL, 0, 0, 0, 0 },
+    { 0x10ULL, 0, 0, 0, 0 },
+    { 0x11ULL, 0, 0, 0, 0 },
+    { 0x12ULL, 0, 0, 0, 0 },
+    { 0x1fULL, 0, 0, 0, 0 },
+    { 0x20ULL, 0, 0, 0, 0 },
+    { 0x7fULL, 0, 0, 0, 0 },
+    { 0x80ULL, 1, 0, 0, 0 },
+    { 0x81ULL, 1, 0, 0, 0 },
+    { 0x9aULL, 1, 0, 0, 0 },
+    { 0xf3ULL, 4, 0, 0, 0 },
+    { 0xffULL, 8, 0, 0, 0 },
+    { 0x100ULL, 0, 0, 0, 0 },
+    { 0x101ULL, 0, 0, 0, 0 },
+    { 0x102ULL, 0, 0, 0, 0 },
+    { 0x1feULL, 7, 0, 0, 0 },
+    { 0x1ffULL, 8, 0, 0, 0 },
+    { 0x200ULL, 0, 0, 0, 0 },
+    { 0x234ULL, 0, 0, 0, 0 },
+    { 0x4567ULL, 0, 0, 0, 0 },
+    { 0x7fffULL, 8, 0, 0, 0 },
+    { 0x8000ULL, 0, 1, 0, 0 },
+    { 0x8001ULL, 0, 1, 0, 0 },
+    { 0xfffeULL, 7, 15, 0, 0 },
+    { 0xffffULL, 8, 16, 0, 0 },
+    { 0x10000ULL, 0, 0, 0, 0 },
+    { 0x10001ULL, 0, 0, 0, 0 },
+    { 0xfedcba98ULL, 1, 1, 7, 0 },
+    { 0xfffffefeULL, 7, 7, 23, 0 },
+    { 0xffffffffULL, 8, 16, 32, 0 },
+    { 0x100000000ULL, 0, 0, 0, 0 },
+    { 0x100000001ULL, 0, 0, 0, 0 },
+    { 0x123456789ULL, 1, 0, 0, 0 },
+    { 0x123456789abcdefULL, 3, 2, 1, 0 },
+    { 0x789abcdef0123456ULL, 0, 0, 4, 0 },
+    { 0x8000000000000000ULL, 0, 0, 0, 1 },
+    { 0x8000000000000001ULL, 0, 0, 0, 1 },
+    { 0xfffffffffffffffeULL, 7, 15, 31, 63 },
+    { 0xffffffffffffffffULL, 8, 16, 32, 64 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_leading_ones);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_leading_ones, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_leading_zeros.c b/stdlib/tst-stdc_leading_zeros.c
new file mode 100644
index 0000000000..3452908d5b
--- /dev/null
+++ b/stdlib/tst-stdc_leading_zeros.c
@@ -0,0 +1,88 @@
+/* Test stdc_leading_zeros functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 8, 16, 32, 64 },
+    { 0x1ULL, 7, 15, 31, 63 },
+    { 0x2ULL, 6, 14, 30, 62 },
+    { 0x3ULL, 6, 14, 30, 62 },
+    { 0x4ULL, 5, 13, 29, 61 },
+    { 0x5ULL, 5, 13, 29, 61 },
+    { 0x6ULL, 5, 13, 29, 61 },
+    { 0x7ULL, 5, 13, 29, 61 },
+    { 0x8ULL, 4, 12, 28, 60 },
+    { 0x9ULL, 4, 12, 28, 60 },
+    { 0xaULL, 4, 12, 28, 60 },
+    { 0xbULL, 4, 12, 28, 60 },
+    { 0xcULL, 4, 12, 28, 60 },
+    { 0xdULL, 4, 12, 28, 60 },
+    { 0xeULL, 4, 12, 28, 60 },
+    { 0xfULL, 4, 12, 28, 60 },
+    { 0x10ULL, 3, 11, 27, 59 },
+    { 0x11ULL, 3, 11, 27, 59 },
+    { 0x12ULL, 3, 11, 27, 59 },
+    { 0x1fULL, 3, 11, 27, 59 },
+    { 0x20ULL, 2, 10, 26, 58 },
+    { 0x7fULL, 1, 9, 25, 57 },
+    { 0x80ULL, 0, 8, 24, 56 },
+    { 0x81ULL, 0, 8, 24, 56 },
+    { 0x9aULL, 0, 8, 24, 56 },
+    { 0xf3ULL, 0, 8, 24, 56 },
+    { 0xffULL, 0, 8, 24, 56 },
+    { 0x100ULL, 8, 7, 23, 55 },
+    { 0x101ULL, 7, 7, 23, 55 },
+    { 0x102ULL, 6, 7, 23, 55 },
+    { 0x1feULL, 0, 7, 23, 55 },
+    { 0x1ffULL, 0, 7, 23, 55 },
+    { 0x200ULL, 8, 6, 22, 54 },
+    { 0x234ULL, 2, 6, 22, 54 },
+    { 0x4567ULL, 1, 1, 17, 49 },
+    { 0x7fffULL, 0, 1, 17, 49 },
+    { 0x8000ULL, 8, 0, 16, 48 },
+    { 0x8001ULL, 7, 0, 16, 48 },
+    { 0xfffeULL, 0, 0, 16, 48 },
+    { 0xffffULL, 0, 0, 16, 48 },
+    { 0x10000ULL, 8, 16, 15, 47 },
+    { 0x10001ULL, 7, 15, 15, 47 },
+    { 0xfedcba98ULL, 0, 0, 0, 32 },
+    { 0xfffffefeULL, 0, 0, 0, 32 },
+    { 0xffffffffULL, 0, 0, 0, 32 },
+    { 0x100000000ULL, 8, 16, 32, 31 },
+    { 0x100000001ULL, 7, 15, 31, 31 },
+    { 0x123456789ULL, 0, 1, 2, 31 },
+    { 0x123456789abcdefULL, 0, 0, 0, 7 },
+    { 0x789abcdef0123456ULL, 1, 2, 0, 1 },
+    { 0x8000000000000000ULL, 8, 16, 32, 0 },
+    { 0x8000000000000001ULL, 7, 15, 31, 0 },
+    { 0xfffffffffffffffeULL, 0, 0, 0, 0 },
+    { 0xffffffffffffffffULL, 0, 0, 0, 0 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_leading_zeros);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_leading_zeros, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_trailing_ones.c b/stdlib/tst-stdc_trailing_ones.c
new file mode 100644
index 0000000000..6fcd9d8000
--- /dev/null
+++ b/stdlib/tst-stdc_trailing_ones.c
@@ -0,0 +1,88 @@
+/* Test stdc_trailing_ones functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 0, 0, 0, 0 },
+    { 0x1ULL, 1, 1, 1, 1 },
+    { 0x2ULL, 0, 0, 0, 0 },
+    { 0x3ULL, 2, 2, 2, 2 },
+    { 0x4ULL, 0, 0, 0, 0 },
+    { 0x5ULL, 1, 1, 1, 1 },
+    { 0x6ULL, 0, 0, 0, 0 },
+    { 0x7ULL, 3, 3, 3, 3 },
+    { 0x8ULL, 0, 0, 0, 0 },
+    { 0x9ULL, 1, 1, 1, 1 },
+    { 0xaULL, 0, 0, 0, 0 },
+    { 0xbULL, 2, 2, 2, 2 },
+    { 0xcULL, 0, 0, 0, 0 },
+    { 0xdULL, 1, 1, 1, 1 },
+    { 0xeULL, 0, 0, 0, 0 },
+    { 0xfULL, 4, 4, 4, 4 },
+    { 0x10ULL, 0, 0, 0, 0 },
+    { 0x11ULL, 1, 1, 1, 1 },
+    { 0x12ULL, 0, 0, 0, 0 },
+    { 0x1fULL, 5, 5, 5, 5 },
+    { 0x20ULL, 0, 0, 0, 0 },
+    { 0x7fULL, 7, 7, 7, 7 },
+    { 0x80ULL, 0, 0, 0, 0 },
+    { 0x81ULL, 1, 1, 1, 1 },
+    { 0x9aULL, 0, 0, 0, 0 },
+    { 0xf3ULL, 2, 2, 2, 2 },
+    { 0xffULL, 8, 8, 8, 8 },
+    { 0x100ULL, 0, 0, 0, 0 },
+    { 0x101ULL, 1, 1, 1, 1 },
+    { 0x102ULL, 0, 0, 0, 0 },
+    { 0x1feULL, 0, 0, 0, 0 },
+    { 0x1ffULL, 8, 9, 9, 9 },
+    { 0x200ULL, 0, 0, 0, 0 },
+    { 0x234ULL, 0, 0, 0, 0 },
+    { 0x4567ULL, 3, 3, 3, 3 },
+    { 0x7fffULL, 8, 15, 15, 15 },
+    { 0x8000ULL, 0, 0, 0, 0 },
+    { 0x8001ULL, 1, 1, 1, 1 },
+    { 0xfffeULL, 0, 0, 0, 0 },
+    { 0xffffULL, 8, 16, 16, 16 },
+    { 0x10000ULL, 0, 0, 0, 0 },
+    { 0x10001ULL, 1, 1, 1, 1 },
+    { 0xfedcba98ULL, 0, 0, 0, 0 },
+    { 0xfffffefeULL, 0, 0, 0, 0 },
+    { 0xffffffffULL, 8, 16, 32, 32 },
+    { 0x100000000ULL, 0, 0, 0, 0 },
+    { 0x100000001ULL, 1, 1, 1, 1 },
+    { 0x123456789ULL, 1, 1, 1, 1 },
+    { 0x123456789abcdefULL, 4, 4, 4, 4 },
+    { 0x789abcdef0123456ULL, 0, 0, 0, 0 },
+    { 0x8000000000000000ULL, 0, 0, 0, 0 },
+    { 0x8000000000000001ULL, 1, 1, 1, 1 },
+    { 0xfffffffffffffffeULL, 0, 0, 0, 0 },
+    { 0xffffffffffffffffULL, 8, 16, 32, 64 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_trailing_ones);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_trailing_ones, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/stdlib/tst-stdc_trailing_zeros.c b/stdlib/tst-stdc_trailing_zeros.c
new file mode 100644
index 0000000000..a7664ee5bb
--- /dev/null
+++ b/stdlib/tst-stdc_trailing_zeros.c
@@ -0,0 +1,88 @@
+/* Test stdc_trailing_zeros functions and macros.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <tst-stdbit.h>
+
+static const struct stdbit_test inputs[] =
+  {
+    { 0ULL, 8, 16, 32, 64 },
+    { 0x1ULL, 0, 0, 0, 0 },
+    { 0x2ULL, 1, 1, 1, 1 },
+    { 0x3ULL, 0, 0, 0, 0 },
+    { 0x4ULL, 2, 2, 2, 2 },
+    { 0x5ULL, 0, 0, 0, 0 },
+    { 0x6ULL, 1, 1, 1, 1 },
+    { 0x7ULL, 0, 0, 0, 0 },
+    { 0x8ULL, 3, 3, 3, 3 },
+    { 0x9ULL, 0, 0, 0, 0 },
+    { 0xaULL, 1, 1, 1, 1 },
+    { 0xbULL, 0, 0, 0, 0 },
+    { 0xcULL, 2, 2, 2, 2 },
+    { 0xdULL, 0, 0, 0, 0 },
+    { 0xeULL, 1, 1, 1, 1 },
+    { 0xfULL, 0, 0, 0, 0 },
+    { 0x10ULL, 4, 4, 4, 4 },
+    { 0x11ULL, 0, 0, 0, 0 },
+    { 0x12ULL, 1, 1, 1, 1 },
+    { 0x1fULL, 0, 0, 0, 0 },
+    { 0x20ULL, 5, 5, 5, 5 },
+    { 0x7fULL, 0, 0, 0, 0 },
+    { 0x80ULL, 7, 7, 7, 7 },
+    { 0x81ULL, 0, 0, 0, 0 },
+    { 0x9aULL, 1, 1, 1, 1 },
+    { 0xf3ULL, 0, 0, 0, 0 },
+    { 0xffULL, 0, 0, 0, 0 },
+    { 0x100ULL, 8, 8, 8, 8 },
+    { 0x101ULL, 0, 0, 0, 0 },
+    { 0x102ULL, 1, 1, 1, 1 },
+    { 0x1feULL, 1, 1, 1, 1 },
+    { 0x1ffULL, 0, 0, 0, 0 },
+    { 0x200ULL, 8, 9, 9, 9 },
+    { 0x234ULL, 2, 2, 2, 2 },
+    { 0x4567ULL, 0, 0, 0, 0 },
+    { 0x7fffULL, 0, 0, 0, 0 },
+    { 0x8000ULL, 8, 15, 15, 15 },
+    { 0x8001ULL, 0, 0, 0, 0 },
+    { 0xfffeULL, 1, 1, 1, 1 },
+    { 0xffffULL, 0, 0, 0, 0 },
+    { 0x10000ULL, 8, 16, 16, 16 },
+    { 0x10001ULL, 0, 0, 0, 0 },
+    { 0xfedcba98ULL, 3, 3, 3, 3 },
+    { 0xfffffefeULL, 1, 1, 1, 1 },
+    { 0xffffffffULL, 0, 0, 0, 0 },
+    { 0x100000000ULL, 8, 16, 32, 32 },
+    { 0x100000001ULL, 0, 0, 0, 0 },
+    { 0x123456789ULL, 0, 0, 0, 0 },
+    { 0x123456789abcdefULL, 0, 0, 0, 0 },
+    { 0x789abcdef0123456ULL, 1, 1, 1, 1 },
+    { 0x8000000000000000ULL, 8, 16, 32, 63 },
+    { 0x8000000000000001ULL, 0, 0, 0, 0 },
+    { 0xfffffffffffffffeULL, 1, 1, 1, 1 },
+    { 0xffffffffffffffffULL, 0, 0, 0, 0 },
+  };
+
+TEST_STDBIT_UI_TOPLEVEL (stdc_trailing_zeros);
+
+static int
+do_test (void)
+{
+  TEST_STDBIT_UI (stdc_trailing_zeros, inputs);
+  return 0;
+}
+
+#include <support/test-driver.c>