[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
This commit is contained in:
Martin Storsjö 2021-10-12 19:36:33 +00:00
parent b541845ea0
commit a03e17d4d9

View file

@ -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