summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMinSeong Kim <min.s.kim@samsung.com>2018-01-23 11:11:36 +0000
committerMinSeong Kim <min.s.kim@samsung.com>2018-01-23 11:11:36 +0000
commit27f77b4300a9060579a14a190ae1fe123468a1f1 (patch)
treed0d741bfa67a6ff5b2431284f0d6fc938cd37428
parentca8f4e7451480b2e2cda25736a08982c03d011bc (diff)
downloadbcm5719-llvm-27f77b4300a9060579a14a190ae1fe123468a1f1.tar.gz
bcm5719-llvm-27f77b4300a9060579a14a190ae1fe123468a1f1.zip
[Analysis] Disable exp/exp2/pow finite lib calls on Android with -ffast-math.
Summary: Since r322087, glibc's finite lib calls are generated when possible. However, glibc is not supported on Android. Therefore this change enables llvm to finely distinguish between linux and Android for unsupported library calls. The change also include some regression tests. Reviewers: srhines, pirama Reviewed By: srhines Subscribers: kongyi, chh, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D42288 llvm-svn: 323187
-rw-r--r--llvm/lib/Analysis/TargetLibraryInfo.cpp9
-rw-r--r--llvm/test/CodeGen/AArch64/illegal-float-ops.ll29
2 files changed, 38 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index f655eaeca52..2dbcc9fa6f2 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -397,6 +397,15 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
TLI.setUnavailable(LibFunc_flsll);
}
+ // Android uses bionic instead of glibc. So disable some finite
+ // lib calls in glibc for Android. The list of unsupported lib
+ // calls for Android may expand as the need arises.
+ if (T.isAndroid()) {
+ TLI.setUnavailable(LibFunc_exp_finite);
+ TLI.setUnavailable(LibFunc_exp2_finite);
+ TLI.setUnavailable(LibFunc_pow_finite);
+ }
+
// The following functions are available on at least Linux:
if (!T.isOSLinux()) {
TLI.setUnavailable(LibFunc_dunder_strdup);
diff --git a/llvm/test/CodeGen/AArch64/illegal-float-ops.ll b/llvm/test/CodeGen/AArch64/illegal-float-ops.ll
index 9f7dd998bc2..81a3abd2bd9 100644
--- a/llvm/test/CodeGen/AArch64/illegal-float-ops.ll
+++ b/llvm/test/CodeGen/AArch64/illegal-float-ops.ll
@@ -1,4 +1,5 @@
; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s
+; RUN: llc -mtriple=aarch64-linux-android -verify-machineinstrs -o - %s | FileCheck --check-prefix=ANDROID-AARCH64 %s
@varfloat = global float 0.0
@vardouble = global double 0.0
@@ -245,3 +246,31 @@ define void @test_fmuladd(fp128 %fp128) {
ret void
}
+
+define void @test_exp_finite(double %double) #0 {
+ %expdouble = call double @llvm.exp.f64(double %double)
+ store double %expdouble, double* @vardouble
+ ; ANDROID-AARCH64-NOT: bl __exp_finite
+ ; CHECK: bl __exp_finite
+
+ ret void
+}
+
+define void @test_exp2_finite(double %double) #0 {
+ %expdouble = call double @llvm.exp2.f64(double %double)
+ store double %expdouble, double* @vardouble
+ ; ANDROID-AARCH64-NOT: bl __exp2_finite
+ ; CHECK: bl __exp2_finite
+
+ ret void
+}
+
+define void @test_pow_finite(double %double) #0 {
+ %powdouble = call double @llvm.pow.f64(double %double, double %double)
+ store double %powdouble, double* @vardouble
+ ; ANDROID-AARCH64-NOT: bl __pow_finite
+ ; CHECK: bl __pow_finite
+ ret void
+}
+
+attributes #0 = { "no-infs-fp-math"="true" "no-nans-fp-math"="true" }
OpenPOWER on IntegriCloud