Use libm_alias_ldouble in sysdeps/x86_64/fpu.
[glibc.git] / sysdeps / x86_64 / fpu / s_floorl.S
blob75f82556488512f1bc8426bb16e2902f0c976451
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
4  * Changes for x86-64 by Andreas Jaeger <aj@suse.de>=09
5  * Public domain.
6  */
8 #include <libm-alias-ldouble.h>
9 #include <machine/asm.h>
11 ENTRY(__floorl)
12         fldt    8(%rsp)
14         fnstenv -28(%rsp)               /* store fpu environment */
16         /* We use here %edx although only the low 1 bits are defined.
17            But none of the operations should care and they are faster
18            than the 16 bit operations.  */
19         movl    $0x400,%edx             /* round towards -oo */
20         orl     -28(%rsp),%edx
21         andl    $0xf7ff,%edx
22         movl    %edx,-32(%rsp)
23         fldcw   -32(%rsp)               /* load modified control word */
25         frndint                         /* round */
27         /* Preserve "invalid" exceptions from sNaN input.  */
28         fnstsw
29         andl    $0x1, %eax
30         orl     %eax, -24(%rsp)
32         fldenv  -28(%rsp)               /* restore original environment */
34         ret
35 END (__floorl)
36 libm_alias_ldouble (__floor, floor)