[libcxx-commits] [libcxx] a03e17d - [libcxx] [test] Generalize the conditions for testing bitcasts between long double, double and int128
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 13 12:56:04 PDT 2021
Author: Martin Storsjö
Date: 2021-10-13T22:55:01+03:00
New Revision: a03e17d4d9419811da16bc2e893fd0cf9b8aa2a7
URL: https://github.com/llvm/llvm-project/commit/a03e17d4d9419811da16bc2e893fd0cf9b8aa2a7
DIFF: https://github.com/llvm/llvm-project/commit/a03e17d4d9419811da16bc2e893fd0cf9b8aa2a7.diff
LOG: [libcxx] [test] Generalize the conditions for testing bitcasts between long double, double and int128
MSVC targets also have a 64 bit long double, as do MinGW targets on ARM.
This hasn't been noticed in CI because the MSVC configurations there run
with _LIBCPP_HAS_NO_INT128 defined.
This avoids assuming that either __int128_t or double is equal in size to
long double. i386 MinGW targets have sizeof(long double) == 10, which
doesn't match any of the tested types.
Differential Revision: https://reviews.llvm.org/D111671
Added:
Modified:
libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp b/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
index 06a8154ae14cd..c212ad0b195d6 100644
--- a/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
@@ -227,16 +227,10 @@ bool tests() {
test_roundtrip_through_nested_T<false>(i);
test_roundtrip_through_buffer<false>(i);
- // On arm64 on Apple platforms, long double is just double, so we don't
- // test against int128, but instead against double itself. Otherwise,
- // we test against int128 if we have those types available.
-#if defined(__aarch64__) && defined(__APPLE__)
-# define LONG_DOUBLE_IS_DOUBLE
-#endif
-
-#if defined(LONG_DOUBLE_IS_DOUBLE)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
test_roundtrip_through<double, false>(i);
-#elif !defined(_LIBCPP_HAS_NO_INT128)
+#endif
+#if defined(__SIZEOF_INT128__) && __SIZEOF_LONG_DOUBLE__ == __SIZEOF_INT128__
test_roundtrip_through<__int128_t, false>(i);
test_roundtrip_through<__uint128_t, false>(i);
#endif
More information about the libcxx-commits
mailing list