https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/145638
Add a predicate function following the example of __sincos_stret >From 5266f79e89936261972af847253d2b017145e141 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <matthew.arsena...@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; + } +} _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits