[libc-commits] [libc] d9739a0 - [libc] Disable fenv tests that don't work in Arm/AArch64 softfp (#217334)
via libc-commits
libc-commits at lists.llvm.org
Wed Aug 26 02:56:08 PDT 2026
Author: Victor Campos
Date: 2026-08-26T10:56:03+01:00
New Revision: d9739a01045b14e2a9fcaaeb88d3a2bb7c333be1
URL: https://github.com/llvm/llvm-project/commit/d9739a01045b14e2a9fcaaeb88d3a2bb7c333be1
DIFF: https://github.com/llvm/llvm-project/commit/d9739a01045b14e2a9fcaaeb88d3a2bb7c333be1.diff
LOG: [libc] Disable fenv tests that don't work in Arm/AArch64 softfp (#217334)
The fenv tests do not work in Arm and AArch64 without proper floating
point environment support.
This patch adds preprocessor directives that effectively disable the
tests in this case.
Added:
Modified:
libc/test/src/fenv/enabled_exceptions_test.cpp
libc/test/src/fenv/exception_flags_test.cpp
libc/test/src/fenv/exception_status_test.cpp
libc/test/src/fenv/feupdateenv_test.cpp
libc/test/src/fenv/getenv_and_setenv_test.cpp
libc/test/src/fenv/rounding_mode_test.cpp
Removed:
################################################################################
diff --git a/libc/test/src/fenv/enabled_exceptions_test.cpp b/libc/test/src/fenv/enabled_exceptions_test.cpp
index 8a1643953f883..4fdf5bf2f8557 100644
--- a/libc/test/src/fenv/enabled_exceptions_test.cpp
+++ b/libc/test/src/fenv/enabled_exceptions_test.cpp
@@ -27,6 +27,9 @@ using LlvmLibcExceptionStatusTest = LIBC_NAMESPACE::testing::FEnvSafeTest;
// This test enables an exception and verifies that raising that exception
// triggers SIGFPE.
TEST_F(LlvmLibcExceptionStatusTest, RaiseAndCrash) {
+#if defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
+ // Unsupported: no fenv
+#else
// TODO: Install a floating point exception handler and verify that the
// the expected exception was raised. One will have to longjmp back from
// that exception handler, so such a testing can be done after we have
@@ -62,4 +65,5 @@ TEST_F(LlvmLibcExceptionStatusTest, RaiseAndCrash) {
LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
ASSERT_EQ(LIBC_NAMESPACE::feclearexcept(FE_ALL_EXCEPT), 0);
}
+#endif // defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
}
diff --git a/libc/test/src/fenv/exception_flags_test.cpp b/libc/test/src/fenv/exception_flags_test.cpp
index 6fbb1a45bc54b..bb56abce31d39 100644
--- a/libc/test/src/fenv/exception_flags_test.cpp
+++ b/libc/test/src/fenv/exception_flags_test.cpp
@@ -22,6 +22,9 @@
using LlvmLibcFEnvTest = LIBC_NAMESPACE::testing::FEnvSafeTest;
TEST_F(LlvmLibcFEnvTest, GetSetTestExceptFlag) {
+#if defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
+ // Unsupported: no fenv
+#else
// We will disable all exceptions to prevent invocation of the exception
// handler.
LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
@@ -76,4 +79,5 @@ TEST_F(LlvmLibcFEnvTest, GetSetTestExceptFlag) {
// When we set the flags and test, we should only see FE_INVALID.
LIBC_NAMESPACE::fesetexceptflag(&invalid_flag, FE_ALL_EXCEPT);
EXPECT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT), FE_INVALID);
+#endif // defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
}
diff --git a/libc/test/src/fenv/exception_status_test.cpp b/libc/test/src/fenv/exception_status_test.cpp
index 49461bc4908a3..e28abbf6890fe 100644
--- a/libc/test/src/fenv/exception_status_test.cpp
+++ b/libc/test/src/fenv/exception_status_test.cpp
@@ -25,6 +25,9 @@
using LlvmLibcExceptionStatusTest = LIBC_NAMESPACE::testing::FEnvSafeTest;
TEST_F(LlvmLibcExceptionStatusTest, RaiseAndTest) {
+#if defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
+ // Unsupported: no fenv
+#else
// This test raises a set of exceptions and checks that the exception
// status flags are updated. The intention is really not to invoke the
// exception handler. Hence, we will disable all exceptions at the
@@ -149,4 +152,5 @@ TEST_F(LlvmLibcExceptionStatusTest, RaiseAndTest) {
ASSERT_EQ(r, 0);
s = LIBC_NAMESPACE::fetestexcept(ALL_EXCEPTS);
ASSERT_EQ(s, ALL_EXCEPTS);
+#endif // defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
}
diff --git a/libc/test/src/fenv/feupdateenv_test.cpp b/libc/test/src/fenv/feupdateenv_test.cpp
index f50b25e0233e3..897a132c3056c 100644
--- a/libc/test/src/fenv/feupdateenv_test.cpp
+++ b/libc/test/src/fenv/feupdateenv_test.cpp
@@ -18,6 +18,9 @@
using LlvmLibcFEnvTest = LIBC_NAMESPACE::testing::FEnvSafeTest;
TEST_F(LlvmLibcFEnvTest, UpdateEnvTest) {
+#if defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
+ // Unsupported: no fenv
+#else
LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
@@ -27,4 +30,5 @@ TEST_F(LlvmLibcFEnvTest, UpdateEnvTest) {
ASSERT_EQ(LIBC_NAMESPACE::feupdateenv(&env), 0);
ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_INVALID | FE_INEXACT),
FE_INVALID | FE_INEXACT);
+#endif // defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
}
diff --git a/libc/test/src/fenv/getenv_and_setenv_test.cpp b/libc/test/src/fenv/getenv_and_setenv_test.cpp
index f51c59951ec5a..46109de9be790 100644
--- a/libc/test/src/fenv/getenv_and_setenv_test.cpp
+++ b/libc/test/src/fenv/getenv_and_setenv_test.cpp
@@ -24,6 +24,9 @@
using LlvmLibcFEnvTest = LIBC_NAMESPACE::testing::FEnvSafeTest;
TEST_F(LlvmLibcFEnvTest, GetEnvAndSetEnv) {
+#if defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
+ // Unsupported: no fenv
+#else
// We will disable all exceptions to prevent invocation of the exception
// handler.
LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
@@ -42,9 +45,13 @@ TEST_F(LlvmLibcFEnvTest, GetEnvAndSetEnv) {
ASSERT_EQ(LIBC_NAMESPACE::fesetenv(&env), 0);
ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & e, 0);
}
+#endif // defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
}
TEST_F(LlvmLibcFEnvTest, Set_FE_DFL_ENV) {
+#if defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
+ // Unsupported: no fenv
+#else
// We will disable all exceptions to prevent invocation of the exception
// handler.
LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
@@ -73,4 +80,5 @@ TEST_F(LlvmLibcFEnvTest, Set_FE_DFL_ENV) {
// Setting the default env should set rounding mode to FE_TONEAREST.
int rm = LIBC_NAMESPACE::fegetround();
EXPECT_EQ(rm, FE_TONEAREST);
+#endif // defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
}
diff --git a/libc/test/src/fenv/rounding_mode_test.cpp b/libc/test/src/fenv/rounding_mode_test.cpp
index f242ed9aaffe5..c50ac9a9a6e7e 100644
--- a/libc/test/src/fenv/rounding_mode_test.cpp
+++ b/libc/test/src/fenv/rounding_mode_test.cpp
@@ -17,6 +17,9 @@
using LlvmLibcRoundingModeTest = LIBC_NAMESPACE::testing::FEnvSafeTest;
TEST_F(LlvmLibcRoundingModeTest, SetAndGet) {
+#if defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
+ // Unsupported: no fenv
+#else
struct ResetDefaultRoundingMode {
int original = LIBC_NAMESPACE::fegetround();
~ResetDefaultRoundingMode() { LIBC_NAMESPACE::fesetround(original); }
@@ -41,4 +44,5 @@ TEST_F(LlvmLibcRoundingModeTest, SetAndGet) {
EXPECT_EQ(s, 0);
rm = LIBC_NAMESPACE::fegetround();
EXPECT_EQ(rm, FE_TOWARDZERO);
+#endif // defined(LIBC_TARGET_ARCH_IS_ANY_ARM) && !defined(__ARM_FP)
}
More information about the libc-commits
mailing list