diff options
author | Xiaolin Tang <tangxiaolin@loongson.cn> | 2022-11-23 11:44:58 +0800 |
---|---|---|
committer | caiyinyu <caiyinyu@loongson.cn> | 2022-11-29 16:00:28 +0800 |
commit | a1981ecbfd4aec84dea26936d91c8ed9164f8b13 (patch) | |
tree | d78cf6c9ba6e1b931c8ad01c9844c9665651175c /sysdeps/ieee754/flt-32 | |
parent | e1697a540c49d5bd35e84b22fcd537c14f71a4e9 (diff) | |
download | glibc-a1981ecbfd4aec84dea26936d91c8ed9164f8b13.tar.gz glibc-a1981ecbfd4aec84dea26936d91c8ed9164f8b13.tar.xz glibc-a1981ecbfd4aec84dea26936d91c8ed9164f8b13.zip |
Use GCC builtins for llrint functions if desired.
This patch is using the corresponding GCC builtin for llrintf, llrint, llrintl and llrintf128 if the USE_FUNCTION_BUILTIN macros are defined to one in math-use-builtins-function.h. Co-Authored-By: Xi Ruoyao <xry111@xry111.site>
Diffstat (limited to 'sysdeps/ieee754/flt-32')
-rw-r--r-- | sysdeps/ieee754/flt-32/s_llrintf.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sysdeps/ieee754/flt-32/s_llrintf.c b/sysdeps/ieee754/flt-32/s_llrintf.c index 226b8261d3..79e3c385d1 100644 --- a/sysdeps/ieee754/flt-32/s_llrintf.c +++ b/sysdeps/ieee754/flt-32/s_llrintf.c @@ -25,17 +25,22 @@ #include <math_private.h> #include <libm-alias-float.h> #include <fix-fp-int-convert-overflow.h> - -static const float two23[2] = -{ - 8.3886080000e+06, /* 0x4B000000 */ - -8.3886080000e+06, /* 0xCB000000 */ -}; +#include <math-use-builtins.h> long long int __llrintf (float x) { +#if USE_LLRINTF_BUILTIN + return __builtin_llrintf (x); +#else + /* Use generic implementation. */ + static const float two23[2] = + { + 8.3886080000e+06, /* 0x4B000000 */ + -8.3886080000e+06, /* 0xCB000000 */ + }; + int32_t j0; uint32_t i0; float w; @@ -82,6 +87,7 @@ __llrintf (float x) } return sx ? -result : result; +#endif /* ! USE_LLRINTF_BUILTIN */ } libm_alias_float (__llrint, llrint) |