/* Truncate long double value.
- Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
+#include <libm-alias-ldouble.h>
#include <machine/asm.h>
ENTRY(__truncl)
fldt 8(%rsp)
- fstcw -4(%rsp)
+ fnstenv -28(%rsp)
movl $0xc00, %edx
- orl -4(%rsp), %edx
- movl %edx, -8(%rsp)
- fldcw -8(%rsp)
+ orl -28(%rsp), %edx
+ movl %edx, -32(%rsp)
+ fldcw -32(%rsp)
frndint
- fldcw -4(%rsp)
+ fnstsw
+ andl $0x1, %eax
+ orl %eax, -24(%rsp)
+ fldenv -28(%rsp)
ret
END(__truncl)
-weak_alias (__truncl, truncl)
+libm_alias_ldouble (__trunc, trunc)