Skip to content

Commit 30983d1

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 dff6aca commit 30983d1

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
@@ -116,7 +116,7 @@ struct RuntimeLibcallsInfo {
116116
// opcode.
117117
CmpInst::Predicate SoftFloatCompareLibcallPredicates[RTLIB::UNKNOWN_LIBCALL];
118118

119-
static bool darwinHasSinCos(const Triple &TT) {
119+
static bool darwinHasSinCosStret(const Triple &TT) {
120120
assert(TT.isOSDarwin() && "should be called with darwin triple");
121121
// Don't bother with 32 bit x86.
122122
if (TT.getArch() == Triple::x86)
@@ -131,6 +131,12 @@ struct RuntimeLibcallsInfo {
131131
return true;
132132
}
133133

134+
/// Return true if the target has sincosf/sincos/sincosl functions
135+
static bool hasSinCos(const Triple &TT) {
136+
return TT.isGNUEnvironment() || TT.isOSFuchsia() ||
137+
(TT.isAndroid() && !TT.isAndroidVersionLT(9));
138+
}
139+
134140
void initSoftFloatCmpLibcallPredicates();
135141

136142
/// 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
@@ -190,7 +190,7 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
190190
break;
191191
}
192192

193-
if (darwinHasSinCos(TT)) {
193+
if (darwinHasSinCosStret(TT)) {
194194
setLibcallName(RTLIB::SINCOS_STRET_F32, "__sincosf_stret");
195195
setLibcallName(RTLIB::SINCOS_STRET_F64, "__sincos_stret");
196196
if (TT.isWatchABI()) {
@@ -234,8 +234,7 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
234234
setLibcallName(RTLIB::EXP10_F64, "__exp10");
235235
}
236236

237-
if (TT.isGNUEnvironment() || TT.isOSFuchsia() ||
238-
(TT.isAndroid() && !TT.isAndroidVersionLT(9))) {
237+
if (hasSinCos(TT)) {
239238
setLibcallName(RTLIB::SINCOS_F32, "sincosf");
240239
setLibcallName(RTLIB::SINCOS_F64, "sincos");
241240
setLibcallName(RTLIB::SINCOS_F80, "sincosl");

0 commit comments

Comments
 (0)