[PATCH] D42288: [Analysis] Disable exp/exp2/pow finite lib calls on Android with -ffast-math.

MinSeong Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 03:13:09 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL323187: [Analysis] Disable exp/exp2/pow finite lib calls on Android with -ffast-math. (authored by MinSeongKIM, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D42288

Files:
  llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
  llvm/trunk/test/CodeGen/AArch64/illegal-float-ops.ll


Index: llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
===================================================================
--- llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
+++ llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
@@ -397,6 +397,15 @@
     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);
Index: llvm/trunk/test/CodeGen/AArch64/illegal-float-ops.ll
===================================================================
--- llvm/trunk/test/CodeGen/AArch64/illegal-float-ops.ll
+++ llvm/trunk/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 @@
 
   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" }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42288.131024.patch
Type: text/x-patch
Size: 2174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180123/5784f09f/attachment.bin>


More information about the llvm-commits mailing list