diff options
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_fabsl.c | 8 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/s_fabsl.c | 5 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-96/s_fabsl.c | 28 |
3 files changed, 36 insertions, 5 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_fabsl.c b/sysdeps/ieee754/ldbl-128/s_fabsl.c index 7e08980..f22515f 100644 --- a/sysdeps/ieee754/ldbl-128/s_fabsl.c +++ b/sysdeps/ieee754/ldbl-128/s_fabsl.c @@ -24,11 +24,9 @@ static char rcsid[] = "$NetBSD: $"; #include <math_private.h> #include <libm-alias-ldouble.h> -_Float128 __fabsl(_Float128 x) +_Float128 +__fabsl (_Float128 x) { - uint64_t hx; - GET_LDOUBLE_MSW64(hx,x); - SET_LDOUBLE_MSW64(x,hx&0x7fffffffffffffffLL); - return x; + return __builtin_fabsf128 (x); } libm_alias_ldouble (__fabs, fabs) diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c b/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c index cba7de6..7f26315 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c @@ -24,9 +24,13 @@ static char rcsid[] = "$NetBSD: $"; #include <math.h> #include <math_private.h> #include <math_ldbl_opt.h> +#include <math-use-builtins.h> long double __fabsl(long double x) { +#if USE_FABSL_BUILTIN + return __builtin_fabsl (x); +#else uint64_t hx, lx; double xhi, xlo; @@ -39,5 +43,6 @@ long double __fabsl(long double x) INSERT_WORDS64 (xlo, lx); x = ldbl_pack (xhi, xlo); return x; +#endif } long_double_symbol (libm, __fabsl, fabsl); diff --git a/sysdeps/ieee754/ldbl-96/s_fabsl.c b/sysdeps/ieee754/ldbl-96/s_fabsl.c new file mode 100644 index 0000000..0eceb0c --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_fabsl.c @@ -0,0 +1,28 @@ +/* Absolute value of floating-point number. + Copyright (C) 2022 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <math.h> +#include <libm-alias-ldouble.h> +#include <math-use-builtins.h> + +long double +__fabsl (long double x) +{ + return __builtin_fabsl (x); +} +libm_alias_ldouble (__fabs, fabs) |