[libcxx-commits] [libcxx] [libc++][test] Migrate _BitInt probe to __BITINT_MAXWIDTH__ and fix latent test bugs (PR #203876)

Xavier Roche via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 30 00:37:28 PDT 2026


================
@@ -119,8 +120,12 @@ constexpr bool test() {
   test_num<unsigned _BitInt(64)>(0x0123456789ABCDEFULL, 0xEFCDAB8967452301ULL);
   test_num<signed _BitInt(64)>(0x0123456789ABCDEFLL, static_cast<signed _BitInt(64)>(0xEFCDAB8967452301ULL));
 
-#  if __BITINT_MAXWIDTH__ >= 128
-  // sizeof == 16: __builtin_bswap128 fallback or __builtin_bswapg.
+#  if __BITINT_MAXWIDTH__ >= 128 && (TEST_HAS_BUILTIN(__builtin_bswapg) || !defined(TEST_HAS_NO_INT128))
+  // sizeof == 16: __builtin_bswap128 fallback or __builtin_bswapg. Targets
+  // without libc++ __int128 (32-bit ARM, MSVC ABI on Windows clang-cl) and an
+  // older compiler that lacks __builtin_bswapg cannot byteswap a 16-byte
+  // value; skip the block. TEST_HAS_NO_INT128 mirrors libc++'s
+  // _LIBCPP_HAS_INT128 (false on _MSC_VER even when __SIZEOF_INT128__ is set).
----------------
xroche wrote:

I definitely wasn't careful enough with curating comments (focusing on the code). I've opened #206666 to reword them across the _BitInt tests this PR touched, and I'll be more picky on them for the next PRs.


https://github.com/llvm/llvm-project/pull/203876


More information about the libcxx-commits mailing list