Support mcount/gprof test with GCC defaulting to PIE
[glibc.git] / sysdeps / i386 / fpu / s_floorl.S
blobdc74a0c44682ef8f1b73d255d55cc3f003280941
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
4  * Public domain.
5  */
7 #include <machine/asm.h>
9 RCSID("$NetBSD: $")
11 ENTRY(__floorl)
12         fldt    4(%esp)
13         subl    $32,%esp
14         cfi_adjust_cfa_offset (32)
16         fnstenv 4(%esp)                 /* store fpu environment */
18         /* We use here %edx although only the low 1 bits are defined.
19            But none of the operations should care and they are faster
20            than the 16 bit operations.  */
21         movl    $0x400,%edx             /* round towards -oo */
22         orl     4(%esp),%edx
23         andl    $0xf7ff,%edx
24         movl    %edx,(%esp)
25         fldcw   (%esp)                  /* load modified control word */
27         frndint                         /* round */
29         /* Preserve "invalid" exceptions from sNaN input.  */
30         fnstsw
31         andl    $0x1, %eax
32         orl     %eax, 8(%esp)
34         fldenv  4(%esp)                 /* restore original environment */
36         addl    $32,%esp
37         cfi_adjust_cfa_offset (-32)
38         ret
39 END (__floorl)
40 weak_alias (__floorl, floorl)