aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2024-08-30 15:05:29 +0100
committerGitHub <noreply@github.com>2024-08-30 15:05:29 +0100
commitc792de28dfaf3a13703e83e4eb09dd44574b3a3e (patch)
treeeb9022d2dc0ec6a57b1c19a9f78888e763de0a4c
parent24977395592fb3a47d0356b6e9e6d25358a521c5 (diff)
downloadllvm-c792de28dfaf3a13703e83e4eb09dd44574b3a3e.zip
llvm-c792de28dfaf3a13703e83e4eb09dd44574b3a3e.tar.gz
llvm-c792de28dfaf3a13703e83e4eb09dd44574b3a3e.tar.bz2
[libcxx][test] Add macro for when long double is just double (#106708)
This removes the need for the long list of platforms in strong_order_long_double_verify.
-rw-r--r--libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp19
-rw-r--r--libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp2
-rw-r--r--libcxx/test/support/test_macros.h4
3 files changed, 9 insertions, 16 deletions
diff --git a/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp b/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp
index c9c2ba2..cd032d4 100644
--- a/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp
+++ b/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp
@@ -8,21 +8,6 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
-// The following platforms have sizeof(long double) == sizeof(double), so this test doesn't apply to them.
-// This test does apply to aarch64 where Arm's AAPCS64 is followed. There they are different sizes.
-// XFAIL: target={{arm64|arm64e|armv(7|8)(l|m)?|powerpc|powerpc64}}-{{.+}}
-
-// MSVC configurations have long double equal to regular double on all
-// architectures.
-// XFAIL: target={{.+}}-pc-windows-msvc
-
-// ARM/AArch64 MinGW also has got long double equal to regular double, just
-// like MSVC (thus match both MinGW and MSVC here, for those architectures).
-// XFAIL: target={{aarch64|armv7}}-{{.*}}-windows-{{.+}}
-
-// Android's 32-bit x86 target has long double equal to regular double.
-// XFAIL: target=i686-{{.+}}-android{{.*}}
-
// <compare>
// template<class T> constexpr strong_ordering strong_order(const T& a, const T& b);
@@ -37,5 +22,9 @@
void f() {
long double ld = 3.14;
+#ifdef TEST_LONG_DOUBLE_IS_DOUBLE
+ (void)ld; // expected-no-diagnostics
+#else
(void)std::strong_order(ld, ld); // expected-error@*:* {{std::strong_order is unimplemented for this floating-point type}}
+#endif
}
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 f738774..0445892 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
@@ -229,7 +229,7 @@ bool tests() {
test_roundtrip_through_nested_T<false>(i);
test_roundtrip_through_buffer<false>(i);
-#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
+#ifdef TEST_LONG_DOUBLE_IS_DOUBLE
test_roundtrip_through<double, false>(i);
#endif
#if defined(__SIZEOF_INT128__) && __SIZEOF_LONG_DOUBLE__ == __SIZEOF_INT128__ && \
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 6f7ec3a..5d4c1a6 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -511,4 +511,8 @@ inline Tp const& DoNotOptimize(Tp const& value) {
# define TEST_CONSTEXPR_OPERATOR_NEW
#endif
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
+# define TEST_LONG_DOUBLE_IS_DOUBLE
+#endif
+
#endif // SUPPORT_TEST_MACROS_HPP