1 | /* |
2 | * Public domain. |
3 | */ |
4 | |
5 | #include <libm-alias-ldouble.h> |
6 | #include <machine/asm.h> |
7 | |
8 | ENTRY(__floorl) |
9 | fldt 8(%rsp) |
10 | |
11 | fnstenv -28(%rsp) /* store fpu environment */ |
12 | |
13 | /* We use here %edx although only the low 1 bits are defined. |
14 | But none of the operations should care and they are faster |
15 | than the 16 bit operations. */ |
16 | movl $0x400,%edx /* round towards -oo */ |
17 | orl -28(%rsp),%edx |
18 | andl $0xf7ff,%edx |
19 | movl %edx,-32(%rsp) |
20 | fldcw -32(%rsp) /* load modified control word */ |
21 | |
22 | frndint /* round */ |
23 | |
24 | /* Preserve "invalid" exceptions from sNaN input. */ |
25 | fnstsw |
26 | andl $0x1, %eax |
27 | orl %eax, -24(%rsp) |
28 | |
29 | fldenv -28(%rsp) /* restore original environment */ |
30 | |
31 | ret |
32 | END (__floorl) |
33 | libm_alias_ldouble (__floor, floor) |
34 | |