Skip to content

Commit 08f3669

Browse files
Enable exp10 libcall on linux
1 parent 45636ec commit 08f3669

File tree

4 files changed

+575
-249
lines changed

4 files changed

+575
-249
lines changed

llvm/lib/Analysis/TargetLibraryInfo.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,12 +562,9 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
562562
// or we have a reasonable detection strategy, we cannot use exp10 reliably
563563
// on Linux.
564564
//
565-
// Fall through to disable all of them.
566-
[[fallthrough]];
567-
default:
568-
TLI.setUnavailable(LibFunc_exp10);
569-
TLI.setUnavailable(LibFunc_exp10f);
570-
TLI.setUnavailable(LibFunc_exp10l);
565+
TLI.setAvailableWithName(LibFunc_exp10, "__exp10");
566+
TLI.setAvailableWithName(LibFunc_exp10f, "__exp10f");
567+
break;
571568
}
572569

573570
// ffsl is available on at least Darwin, Mac OS X, iOS, FreeBSD, and
@@ -834,6 +831,9 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
834831
TLI.setUnavailable(LibFunc_strndup);
835832
TLI.setUnavailable(LibFunc_strnlen);
836833
TLI.setUnavailable(LibFunc_toascii);
834+
TLI.setUnavailable(LibFunc_exp10);
835+
TLI.setUnavailable(LibFunc_exp10f);
836+
TLI.setUnavailable(LibFunc_exp10l);
837837
}
838838

839839
// As currently implemented in clang, NVPTX code has no standard library to

llvm/test/Transforms/InstCombine/double-float-shrink-1.ll

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,20 @@ define double @expm1_test2(float %f) {
224224
; exp10f() doesn't exist for this triple, so it doesn't shrink.
225225

226226
define float @exp10_test1(float %f) {
227-
; CHECK-LABEL: @exp10_test1(
228-
; CHECK-NEXT: [[CONV:%.*]] = fpext float [[F:%.*]] to double
229-
; CHECK-NEXT: [[CALL:%.*]] = call fast double @exp10(double [[CONV]])
230-
; CHECK-NEXT: [[CONV1:%.*]] = fptrunc double [[CALL]] to float
231-
; CHECK-NEXT: ret float [[CONV1]]
227+
; LINUX-LABEL: define float @exp10_test1(
228+
; LINUX-SAME: float [[F:%.*]]) {
229+
; LINUX-NEXT: [[EXP10F:%.*]] = call fast float @__exp10f(float [[F]])
230+
; LINUX-NEXT: ret float [[EXP10F]]
231+
;
232+
; MS64-LABEL: define float @exp10_test1(
233+
; MS64-SAME: float [[F:%.*]]) {
234+
; MS64-NEXT: [[EXP10F:%.*]] = call fast float @exp10f(float [[F]])
235+
; MS64-NEXT: ret float [[EXP10F]]
236+
;
237+
; MS32-LABEL: define float @exp10_test1(
238+
; MS32-SAME: float [[F:%.*]]) {
239+
; MS32-NEXT: [[EXP10F:%.*]] = call fast float @exp10f(float [[F]])
240+
; MS32-NEXT: ret float [[EXP10F]]
232241
;
233242
%conv = fpext float %f to double
234243
%call = call fast double @exp10(double %conv)

0 commit comments

Comments
 (0)