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/flt-32/s_llrintf.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'sysdeps/ieee754/flt-32') 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 #include #include - -static const float two23[2] = -{ - 8.3886080000e+06, /* 0x4B000000 */ - -8.3886080000e+06, /* 0xCB000000 */ -}; +#include 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) -- cgit 1.4.1