diff options
author | caiyinyu <caiyinyu@loongson.cn> | 2022-07-19 09:20:48 +0800 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-07-26 12:35:12 -0300 |
commit | c742795dce9706ba3b26b649a7123a379bd506cb (patch) | |
tree | 0ef7059c1fdd72397cfa3c1024d8a2c22053c41e /sysdeps/loongarch/e_sqrtl.c | |
parent | 619bfc6770275da9deceb87187f47ab95b3b24cc (diff) | |
download | glibc-c742795dce9706ba3b26b649a7123a379bd506cb.tar glibc-c742795dce9706ba3b26b649a7123a379bd506cb.tar.gz glibc-c742795dce9706ba3b26b649a7123a379bd506cb.tar.bz2 glibc-c742795dce9706ba3b26b649a7123a379bd506cb.zip |
LoongArch: Generic <math.h> and soft-fp Routines
Diffstat (limited to 'sysdeps/loongarch/e_sqrtl.c')
-rw-r--r-- | sysdeps/loongarch/e_sqrtl.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sysdeps/loongarch/e_sqrtl.c b/sysdeps/loongarch/e_sqrtl.c new file mode 100644 index 0000000000..020c8911e6 --- /dev/null +++ b/sysdeps/loongarch/e_sqrtl.c @@ -0,0 +1,39 @@ +/* long double square root in software floating-point emulation. + 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 <stdlib.h> +#include <soft-fp/soft-fp.h> +#include <soft-fp/quad.h> +#include <libm-alias-finite.h> + +long double +__ieee754_sqrtl (const long double a) +{ + FP_DECL_EX; + FP_DECL_Q (A); + FP_DECL_Q (C); + long double c; + + FP_INIT_ROUNDMODE; + FP_UNPACK_Q (A, a); + FP_SQRT_Q (C, A); + FP_PACK_Q (c, C); + FP_HANDLE_EXCEPTIONS; + return c; +} +libm_alias_finite (__ieee754_sqrtl, __sqrtl) |