[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
Mon Jul 6 22:03:34 PDT 2026
https://github.com/ian-twilightcoder created https://github.com/llvm/llvm-project/pull/207895
Skip the rounding mode parts of scalbn{f} due to underflow behavior in libm.
Mark enable_execute_stack_test.c unsupported on Apple arm64 platforms because they don't support an executable stack.
Assisted-by: Claude Code
>From b577d43909e02d8f310af6411df79e54a83910e5 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] Fix some compiler-rt
builtins tests on Apple platforms
Skip the rounding mode parts of scalbn{f} due to underflow behavior in libm.
Mark enable_execute_stack_test.c unsupported on Apple arm64 platforms because they don't support an executable stack.
Assisted-by: Claude Code
---
compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c | 4 +++-
compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c | 4 +++-
compiler-rt/test/builtins/Unit/enable_execute_stack_test.c | 3 +++
3 files changed, 9 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;
diff --git a/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c b/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
index b3cb4df005ca5..138d56eb560d0 100644
--- a/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
+++ b/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
@@ -2,6 +2,9 @@
// RUN: %clang_builtins %s %librt -o %t && %run_nomprotect %t
// REQUIRES: librt_has_enable_execute_stack
+// Apple platforms don't allow an executable stack on arm64.
+// UNSUPPORTED: darwin && target={{arm64.*}}
+
#include <stdio.h>
#include <string.h>
#include <stdint.h>
More information about the llvm-commits
mailing list