summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-09-05 09:08:51 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-09-05 09:08:51 -0700
commit7c75e8c5541f03bdfb2e15d0ff12dcfdcc15e33b (patch)
treec63afe8a1a30249f42f416c384815fd5cf57aa77
parent4990176148a487b0272f6b3ec6c57594419eec18 (diff)
parent6c7c06712e453d617336972a2e2919e9ef001dc8 (diff)
Merge "arm64: Use builtin for nearbyintf/nearbyint"
am: 6c7c06712e Change-Id: I60df229e13c1d8e292f1953ace995271967b883c
-rw-r--r--libm/Android.bp2
-rw-r--r--libm/builtins.cpp8
2 files changed, 10 insertions, 0 deletions
diff --git a/libm/Android.bp b/libm/Android.bp
index 3b88fa3a85..c0862c8070 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -315,6 +315,8 @@ cc_library {
"upstream-freebsd/lib/msun/src/s_llrintf.c",
"upstream-freebsd/lib/msun/src/s_lrint.c",
"upstream-freebsd/lib/msun/src/s_lrintf.c",
+ "upstream-freebsd/lib/msun/src/s_nearbyintf.c",
+ "upstream-freebsd/lib/msun/src/s_nearbyint.c",
"upstream-freebsd/lib/msun/src/s_rint.c",
"upstream-freebsd/lib/msun/src/s_rintf.c",
"upstream-freebsd/lib/msun/src/s_round.c",
diff --git a/libm/builtins.cpp b/libm/builtins.cpp
index 2ea63055c6..515b68a806 100644
--- a/libm/builtins.cpp
+++ b/libm/builtins.cpp
@@ -57,4 +57,12 @@ double fmin(double x, double y) { return __builtin_fmin(x, y); }
float roundf(float x) { return __builtin_roundf(x); }
double round(double x) { return __builtin_round(x); }
+
+float nearbyintf(float x) { return __builtin_nearbyintf(x); }
+double nearbyint(double x) { return __builtin_nearbyint(x); }
+// msun s_nearbyint.c defines all floating-point version, so we need to
+// redefine the long double one here. For aarch64, clang/compiler-rt
+// soft-float routines does not use single/double floating-point operation,
+// so it should be safe to call rintl directly.
+long double nearbyintl(long double x) { return rintl(x); }
#endif