2.9
[glibc/nacl-glibc.git] / sysdeps / x86_64 / fpu / s_floorl.S
blobf9ecc388dfa0333e8d6a824312cf0938968665fc
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 <machine/asm.h>
10 ENTRY(__floorl)
11         fldt    8(%rsp)
13         fstcw   -4(%rsp)                /* store fpu control word */
15         /* We use here %edx although only the low 1 bits are defined.
16            But none of the operations should care and they are faster
17            than the 16 bit operations.  */
18         movl    $0x400,%edx             /* round towards -oo */
19         orl     -4(%rsp),%edx
20         andl    $0xf7ff,%edx
21         movl    %edx,-8(%rsp)
22         fldcw   -8(%rsp)                /* load modified control word */
24         frndint                         /* round */
26         fldcw   -4(%rsp)                /* restore original control word */
28         ret
29 END (__floorl)
30 weak_alias (__floorl, floorl)