From a1981ecbfd4aec84dea26936d91c8ed9164f8b13 Mon Sep 17 00:00:00 2001 From: Xiaolin Tang Date: Wed, 23 Nov 2022 11:44:58 +0800 Subject: 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 --- sysdeps/ieee754/ldbl-128/s_llrintl.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'sysdeps/ieee754/ldbl-128') diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c index 79d3937..3a5635d 100644 --- a/sysdeps/ieee754/ldbl-128/s_llrintl.c +++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c @@ -24,16 +24,22 @@ #include #include #include +#include -static const _Float128 two112[2] = -{ - L(5.19229685853482762853049632922009600E+33), /* 0x406F000000000000, 0 */ - L(-5.19229685853482762853049632922009600E+33) /* 0xC06F000000000000, 0 */ -}; long long int __llrintl (_Float128 x) { +#if USE_LLRINTL_BUILTIN + return __builtin_round (x); +#else + /* Use generic implementation. */ + static const _Float128 two112[2] = + { + L(5.19229685853482762853049632922009600E+33), /* 0x406F000000000000, 0 */ + L(-5.19229685853482762853049632922009600E+33) /* 0xC06F000000000000, 0 */ + }; + int32_t j0; uint64_t i0,i1; _Float128 w; @@ -102,6 +108,7 @@ __llrintl (_Float128 x) } return sx ? -result : result; +#endif /* ! USE_LLRINTL_BUILTIN */ } libm_alias_ldouble (__llrint, llrint) -- cgit v1.1