Skip to content

Commit ee79ca1

Browse files
committed
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.
1 parent 25d7dd2 commit ee79ca1

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct RuntimeLibcallsInfo {
103103
// opcode.
104104
CmpInst::Predicate SoftFloatCompareLibcallPredicates[RTLIB::UNKNOWN_LIBCALL];
105105

106-
static bool darwinHasSinCos(const Triple &TT) {
106+
static bool darwinHasSinCosStret(const Triple &TT) {
107107
assert(TT.isOSDarwin() && "should be called with darwin triple");
108108
// Don't bother with 32 bit x86.
109109
if (TT.getArch() == Triple::x86)
@@ -118,6 +118,12 @@ struct RuntimeLibcallsInfo {
118118
return true;
119119
}
120120

121+
/// Return true if the target has sincosf/sincos/sincosl functions
122+
static bool hasSinCos(const Triple &TT) {
123+
return TT.isGNUEnvironment() || TT.isOSFuchsia() ||
124+
(TT.isAndroid() && !TT.isAndroidVersionLT(9));
125+
}
126+
121127
void initSoftFloatCmpLibcallPredicates();
122128

123129
/// Set default libcall names. If a target wants to opt-out of a libcall it

llvm/lib/IR/RuntimeLibcalls.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
170170
break;
171171
}
172172

173-
if (darwinHasSinCos(TT)) {
173+
if (darwinHasSinCosStret(TT)) {
174174
setLibcallName(RTLIB::SINCOS_STRET_F32, "__sincosf_stret");
175175
setLibcallName(RTLIB::SINCOS_STRET_F64, "__sincos_stret");
176176
if (TT.isWatchABI()) {
@@ -214,8 +214,7 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
214214
setLibcallName(RTLIB::EXP10_F64, "__exp10");
215215
}
216216

217-
if (TT.isGNUEnvironment() || TT.isOSFuchsia() ||
218-
(TT.isAndroid() && !TT.isAndroidVersionLT(9))) {
217+
if (hasSinCos(TT)) {
219218
setLibcallName(RTLIB::SINCOS_F32, "sincosf");
220219
setLibcallName(RTLIB::SINCOS_F64, "sincos");
221220
setLibcallName(RTLIB::SINCOS_F80, "sincosl");

0 commit comments

Comments
 (0)