risc-v: use clang's builtins for more of libm.

This completes the set, and gets riscv64 to parity with arm64.

Test: llvm-objdump -d
Test: bionic-unit-tests-static --gtest_filter='math*'
Bug: https://github.com/google/android-riscv64/issues/11
Change-Id: I4230005abcd8d6025d82f1e8afe5831fad2db04d
This commit is contained in:
Elliott Hughes 2023-03-22 14:11:35 -07:00
parent 060cd2438c
commit 2289ca2bd3
2 changed files with 13 additions and 36 deletions

View file

@ -94,8 +94,6 @@ cc_library {
"upstream-freebsd/lib/msun/src/s_cbrtf.c",
"upstream-freebsd/lib/msun/src/s_ccosh.c",
"upstream-freebsd/lib/msun/src/s_ccoshf.c",
"upstream-freebsd/lib/msun/src/s_ceil.c",
"upstream-freebsd/lib/msun/src/s_ceilf.c",
"upstream-freebsd/lib/msun/src/s_cexp.c",
"upstream-freebsd/lib/msun/src/s_cexpf.c",
"upstream-freebsd/lib/msun/src/s_cimag.c",
@ -130,8 +128,6 @@ cc_library {
"upstream-freebsd/lib/msun/src/s_fdim.c",
"upstream-freebsd/lib/msun/src/s_finite.c",
"upstream-freebsd/lib/msun/src/s_finitef.c",
"upstream-freebsd/lib/msun/src/s_floor.c",
"upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_fma.c",
"upstream-freebsd/lib/msun/src/s_fmaf.c",
"upstream-freebsd/lib/msun/src/s_fmax.c",
@ -282,10 +278,8 @@ cc_library {
arm: {
srcs: [
"arm/fenv.c",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/s_floor.c",
"upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_ceil.c",
"upstream-freebsd/lib/msun/src/s_ceilf.c",
],
instruction_set: "arm",
pack_relocations: false,
@ -303,10 +297,6 @@ cc_library {
"arm64/fenv.c",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/s_ceil.c",
"upstream-freebsd/lib/msun/src/s_ceilf.c",
"upstream-freebsd/lib/msun/src/s_floor.c",
"upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_fma.c",
"upstream-freebsd/lib/msun/src/s_fmaf.c",
"upstream-freebsd/lib/msun/src/s_fmax.c",
@ -337,11 +327,6 @@ cc_library {
],
exclude_srcs: [
// TODO: do the rest when our clang has https://reviews.llvm.org/D136508.
// TODO: "upstream-freebsd/lib/msun/src/s_ceil.c",
// TODO: "upstream-freebsd/lib/msun/src/s_ceilf.c",
// TODO: "upstream-freebsd/lib/msun/src/s_floor.c",
// TODO: "upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_fma.c",
"upstream-freebsd/lib/msun/src/s_fmaf.c",
"upstream-freebsd/lib/msun/src/s_fmax.c",
@ -356,12 +341,12 @@ cc_library {
"upstream-freebsd/lib/msun/src/s_lrintf.c",
"upstream-freebsd/lib/msun/src/s_lround.c",
"upstream-freebsd/lib/msun/src/s_lroundf.c",
// TODO: "upstream-freebsd/lib/msun/src/s_rint.c",
// TODO: "upstream-freebsd/lib/msun/src/s_rintf.c",
// TODO: "upstream-freebsd/lib/msun/src/s_round.c",
// TODO: "upstream-freebsd/lib/msun/src/s_roundf.c",
// TODO: "upstream-freebsd/lib/msun/src/s_trunc.c",
// TODO: "upstream-freebsd/lib/msun/src/s_truncf.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",
"upstream-freebsd/lib/msun/src/s_roundf.c",
"upstream-freebsd/lib/msun/src/s_trunc.c",
"upstream-freebsd/lib/msun/src/s_truncf.c",
],
version_script: ":libm.riscv64.map",
},
@ -373,10 +358,6 @@ cc_library {
"x86/lrintf.S",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/s_ceil.c",
"upstream-freebsd/lib/msun/src/s_ceilf.c",
"upstream-freebsd/lib/msun/src/s_floor.c",
"upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_lrint.c",
"upstream-freebsd/lib/msun/src/s_lrintf.c",
"upstream-freebsd/lib/msun/src/s_rint.c",
@ -400,10 +381,6 @@ cc_library {
"x86_64/lrintf.S",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/s_ceil.c",
"upstream-freebsd/lib/msun/src/s_ceilf.c",
"upstream-freebsd/lib/msun/src/s_floor.c",
"upstream-freebsd/lib/msun/src/s_floorf.c",
"upstream-freebsd/lib/msun/src/s_llrint.c",
"upstream-freebsd/lib/msun/src/s_llrintf.c",
"upstream-freebsd/lib/msun/src/s_lrint.c",

View file

@ -22,7 +22,7 @@ double fabs(double x) { return __builtin_fabs(x); }
float fabsf(float x) { return __builtin_fabsf(x); }
long double fabsl(long double x) { return __builtin_fabsl(x); }
#if defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
#if defined(__aarch64__) || defined(__riscv) || defined(__i386__) || defined(__x86_64__)
float ceilf(float x) { return __builtin_ceilf(x); }
double ceil(double x) { return __builtin_ceil(x); }
#if defined(__ILP32__)
@ -46,7 +46,7 @@ namespace s_floorf {
}
float floorf(float x) { return s_floorf::floorf(x); }
double floor(double x) { return s_floor::floor(x); }
#elif defined(__arm__) || defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
#else
float floorf(float x) { return __builtin_floorf(x); }
double floor(double x) { return __builtin_floor(x); }
#if defined(__ILP32__)
@ -79,7 +79,7 @@ long long llround(double x) { return __builtin_llround(x); }
long long llroundf(float x) { return __builtin_llroundf(x); }
#endif
#if defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
#if defined(__aarch64__) || defined(__riscv) || defined(__i386__) || defined(__x86_64__)
float rintf(float x) { return __builtin_rintf(x); }
double rint(double x) { return __builtin_rint(x); }
#if defined(__ILP32__)
@ -87,7 +87,7 @@ __weak_reference(rint, rintl);
#endif
#endif
#if defined(__aarch64__)
#if defined(__aarch64__) || defined(__riscv)
float roundf(float x) { return __builtin_roundf(x); }
double round(double x) { return __builtin_round(x); }
#endif
@ -98,7 +98,7 @@ double sqrt(double x) { return __builtin_sqrt(x); }
__weak_reference(sqrt, sqrtl);
#endif
#if defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
#if defined(__aarch64__) || defined(__riscv) || defined(__i386__) || defined(__x86_64__)
float truncf(float x) { return __builtin_truncf(x); }
double trunc(double x) { return __builtin_trunc(x); }
#if defined(__ILP32__)