arm64: Use builtin for nearbyintf/nearbyint

This allows compiler optimize both calls to a single frinti.

Test: Builds, ran unit tests on arm64.

Change-Id: Ie59ac11a419281836a8051ecda26a5c7b72f3dea
This commit is contained in:
Adhemerval Zanella 2018-08-21 19:02:42 -03:00
parent fc85c3c847
commit 35d8ba303b
2 changed files with 10 additions and 0 deletions

View file

@ -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",

View file

@ -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