diff options
| -rw-r--r-- | libm/Android.bp | 2 | ||||
| -rw-r--r-- | libm/builtins.cpp | 8 |
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 |
