[llvm-branch-commits] [llvm] RuntimeLibcalls: Cleanup sincos predicate functions (PR #143081)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Jun 8 19:35:55 PDT 2025
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/143081
>From 30983d1ad907744cac767a4f39c012a667db20c6 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 6 Jun 2025 15:15:53 +0900
Subject: [PATCH] RuntimeLibcalls: Cleanup sincos predicate functions
The darwinHasSinCos wasn't actually used for sincos, only the stret
variant. Rename this to reflect that, and introduce a new one for
enabling sincos.
---
llvm/include/llvm/IR/RuntimeLibcalls.h | 8 +++++++-
llvm/lib/IR/RuntimeLibcalls.cpp | 5 ++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 45826fcd19f38..d8f467e30fa6a 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -116,7 +116,7 @@ struct RuntimeLibcallsInfo {
// opcode.
CmpInst::Predicate SoftFloatCompareLibcallPredicates[RTLIB::UNKNOWN_LIBCALL];
- static bool darwinHasSinCos(const Triple &TT) {
+ static bool darwinHasSinCosStret(const Triple &TT) {
assert(TT.isOSDarwin() && "should be called with darwin triple");
// Don't bother with 32 bit x86.
if (TT.getArch() == Triple::x86)
@@ -131,6 +131,12 @@ struct RuntimeLibcallsInfo {
return true;
}
+ /// Return true if the target has sincosf/sincos/sincosl functions
+ static bool hasSinCos(const Triple &TT) {
+ return TT.isGNUEnvironment() || TT.isOSFuchsia() ||
+ (TT.isAndroid() && !TT.isAndroidVersionLT(9));
+ }
+
void initSoftFloatCmpLibcallPredicates();
/// Set default libcall names. If a target wants to opt-out of a libcall it
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index 1978382d48571..515bc8c050f7b 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -190,7 +190,7 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
break;
}
- if (darwinHasSinCos(TT)) {
+ if (darwinHasSinCosStret(TT)) {
setLibcallName(RTLIB::SINCOS_STRET_F32, "__sincosf_stret");
setLibcallName(RTLIB::SINCOS_STRET_F64, "__sincos_stret");
if (TT.isWatchABI()) {
@@ -234,8 +234,7 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
setLibcallName(RTLIB::EXP10_F64, "__exp10");
}
- if (TT.isGNUEnvironment() || TT.isOSFuchsia() ||
- (TT.isAndroid() && !TT.isAndroidVersionLT(9))) {
+ if (hasSinCos(TT)) {
setLibcallName(RTLIB::SINCOS_F32, "sincosf");
setLibcallName(RTLIB::SINCOS_F64, "sincos");
setLibcallName(RTLIB::SINCOS_F80, "sincosl");
More information about the llvm-branch-commits
mailing list