Linux: Consolidate typesizes.h
[glibc.git] / sysdeps / i386 / fpu / s_floorl.S
blob3ec28b477b8ab7aeb0437375e0568644f82a6fc4
1 /*
2  * Public domain.
3  */
5 #include <libm-alias-ldouble.h>
6 #include <machine/asm.h>
8 RCSID("$NetBSD: $")
10 ENTRY(__floorl)
11         fldt    4(%esp)
12         subl    $32,%esp
13         cfi_adjust_cfa_offset (32)
15         fnstenv 4(%esp)                 /* store fpu environment */
17         /* We use here %edx although only the low 1 bits are defined.
18            But none of the operations should care and they are faster
19            than the 16 bit operations.  */
20         movl    $0x400,%edx             /* round towards -oo */
21         orl     4(%esp),%edx
22         andl    $0xf7ff,%edx
23         movl    %edx,(%esp)
24         fldcw   (%esp)                  /* load modified control word */
26         frndint                         /* round */
28         /* Preserve "invalid" exceptions from sNaN input.  */
29         fnstsw
30         andl    $0x1, %eax
31         orl     %eax, 8(%esp)
33         fldenv  4(%esp)                 /* restore original environment */
35         addl    $32,%esp
36         cfi_adjust_cfa_offset (-32)
37         ret
38 END (__floorl)
39 libm_alias_ldouble (__floor, floor)