[compiler-rt] [compiler-rt][builtins][test][darwin] Fix some compiler-rt builtins tests on Apple platforms (PR #207895)
Ian Anderson via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 16:52:40 PDT 2026
https://github.com/ian-twilightcoder updated https://github.com/llvm/llvm-project/pull/207895
>From 8fb1decbfa9801d74000fbe99608446225e25f9a Mon Sep 17 00:00:00 2001
From: Ian Anderson <iana at apple.com>
Date: Mon, 6 Jul 2026 16:31:13 -0700
Subject: [PATCH] [compiler-rt][builtins][test][darwin] scalbn{f} builtins
tests fail on Apple platforms
Skip the rounding mode parts of scalbn{f} due to underflow behavior in libm.
Assisted-by: Claude Code
rdar://181674975
---
compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c | 4 +++-
compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c b/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c
index 9124601c0bb2e..18e886b502650 100644
--- a/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c
+++ b/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c
@@ -63,11 +63,13 @@ int main() {
defined(__i386__) || defined(__x86_64__)
// Skip these tests on Windows because the UCRT scalbn function always behaves
// as if the default rounding mode is set (FE_TONEAREST).
+// Also skip on Apple because the libm scalbn flushes underflow to zero
+// regardless of the rounding mode.
// Also skip for newlib because although its scalbn function does respect the
// rounding mode, where the tests trigger an underflow or overflow using a
// large exponent the result is rounded in the opposite direction to that which
// would be expected in the (FE_UPWARD) and (FE_DOWNWARD) modes.
-# if !defined(_WIN32) && !defined(_NEWLIB_VERSION)
+# if !defined(_WIN32) && !defined(__APPLE__) && !defined(_NEWLIB_VERSION)
fesetround(FE_UPWARD);
if (iterate_cases("FE_UPWARD")) return 1;
diff --git a/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c b/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c
index 3ffdde6aed3f2..1debed725fc38 100644
--- a/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c
+++ b/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c
@@ -62,11 +62,13 @@ int main() {
defined(__i386__) || defined(__x86_64__)
// Skip these tests on Windows because the UCRT scalbnf function always behaves
// as if the default rounding mode is set (FE_TONEAREST).
+// Also skip on Apple because the libm scalbnf flushes underflow to zero
+// regardless of the rounding mode.
// Also skip for newlib because although its scalbnf function does respect the
// rounding mode, where the tests trigger an underflow or overflow using a
// large exponent the result is rounded in the opposite direction to that which
// would be expected in the (FE_UPWARD) and (FE_DOWNWARD) modes.
-# if !defined(_WIN32) && !defined(_NEWLIB_VERSION)
+# if !defined(_WIN32) && !defined(__APPLE__) && !defined(_NEWLIB_VERSION)
fesetround(FE_UPWARD);
if (iterate_cases("FE_UPWARD")) return 1;
More information about the llvm-commits
mailing list