[compiler-rt] e256f55 - [builtins][test] Skip scalbn rounding tests on newlib
David Candler via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 01:01:06 PDT 2023
Author: David Candler
Date: 2023-05-30T09:00:45+01:00
New Revision: e256f552c81527712cc3dcf245ca606c43742915
URL: https://github.com/llvm/llvm-project/commit/e256f552c81527712cc3dcf245ca606c43742915
DIFF: https://github.com/llvm/llvm-project/commit/e256f552c81527712cc3dcf245ca606c43742915.diff
LOG: [builtins][test] Skip scalbn rounding tests on newlib
The picolib/newlib implementation of scalbn gives slightly different
results compared to glibc and compiler-rt's inlined
__compiler_rt_scalbn in certain rounding modes. Since these tests
are already disabled for msvc which doesn't respect the mode change,
this patch skips them for newlib as well.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D150280
Added:
Modified:
compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c
compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c
Removed:
################################################################################
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 e1cda63246fd0..990e7b947cb2e 100644
--- a/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c
+++ b/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c
@@ -63,7 +63,11 @@ int main() {
defined(__i386__) || defined(__x86_64__)
// Skip these tests for MSVC because its scalbn function always behaves as if
// the default rounding mode is set (FE_TONEAREST).
-#ifndef _MSC_VER
+// 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(_MSC_VER) && !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 dfa34232604fe..9edfe4aa1de3e 100644
--- a/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c
+++ b/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c
@@ -62,7 +62,11 @@ int main() {
defined(__i386__) || defined(__x86_64__)
// Skip these tests for MSVC because its scalbnf function always behaves as if
// the default rounding mode is set (FE_TONEAREST).
-#ifndef _MSC_VER
+// 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(_MSC_VER) && !defined(_NEWLIB_VERSION)
fesetround(FE_UPWARD);
if (iterate_cases("FE_UPWARD")) return 1;
More information about the llvm-commits
mailing list