[llvm-branch-commits] [llvm] RuntimeLibcalls: Cleanup darwin exp10 case (PR #145638)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 25 02:45:59 PDT 2025
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/145638
>From 56a5cab5a8fb95735202f864bb93031f2de5f555 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 25 Jun 2025 14:23:21 +0900
Subject: [PATCH] RuntimeLibcalls: Cleanup darwin exp10 case
Add a predicate function following the example of __sincos_stret
---
llvm/include/llvm/IR/RuntimeLibcalls.h | 2 ++
llvm/lib/IR/RuntimeLibcalls.cpp | 48 ++++++++++++--------------
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 2a095be58a49e..5bd5fd1ce8d3f 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -149,6 +149,8 @@ struct RuntimeLibcallsInfo {
return true;
}
+ static bool darwinHasExp10(const Triple &TT);
+
/// Return true if the target has sincosf/sincos/sincosl functions
static bool hasSinCos(const Triple &TT) {
return TT.isGNUEnvironment() || TT.isOSFuchsia() ||
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index e9cb970f804ca..cb8c8457f5a47 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -457,33 +457,12 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
}
}
- switch (TT.getOS()) {
- case Triple::MacOSX:
- if (TT.isMacOSXVersionLT(10, 9)) {
- setLibcallName(RTLIB::EXP10_F32, nullptr);
- setLibcallName(RTLIB::EXP10_F64, nullptr);
- } else {
- setLibcallName(RTLIB::EXP10_F32, "__exp10f");
- setLibcallName(RTLIB::EXP10_F64, "__exp10");
- }
- break;
- case Triple::IOS:
- if (TT.isOSVersionLT(7, 0)) {
- setLibcallName(RTLIB::EXP10_F32, nullptr);
- setLibcallName(RTLIB::EXP10_F64, nullptr);
- break;
- }
- [[fallthrough]];
- case Triple::DriverKit:
- case Triple::TvOS:
- case Triple::WatchOS:
- case Triple::XROS:
- case Triple::BridgeOS:
+ if (darwinHasExp10(TT)) {
setLibcallName(RTLIB::EXP10_F32, "__exp10f");
setLibcallName(RTLIB::EXP10_F64, "__exp10");
- break;
- default:
- break;
+ } else {
+ setLibcallName(RTLIB::EXP10_F32, nullptr);
+ setLibcallName(RTLIB::EXP10_F64, nullptr);
}
}
@@ -662,3 +641,22 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
if (TT.getArch() == Triple::ArchType::msp430)
setMSP430Libcalls(*this, TT);
}
+
+bool RuntimeLibcallsInfo::darwinHasExp10(const Triple &TT) {
+ assert(TT.isOSDarwin() && "should be called with darwin triple");
+
+ switch (TT.getOS()) {
+ case Triple::MacOSX:
+ return !TT.isMacOSXVersionLT(10, 9);
+ case Triple::IOS:
+ return !TT.isOSVersionLT(7, 0);
+ case Triple::DriverKit:
+ case Triple::TvOS:
+ case Triple::WatchOS:
+ case Triple::XROS:
+ case Triple::BridgeOS:
+ return true;
+ default:
+ return false;
+ }
+}
More information about the llvm-branch-commits
mailing list