| 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> |
| 5 | * Public domain. |
| 6 | */ |
| 7 | |
| 8 | #include <machine/asm.h> |
| 9 | |
| 10 | |
| 11 | ENTRY(__ceill) |
| 12 | fldt 8(%rsp) |
| 13 | |
| 14 | fstcw -4(%rsp) /* store fpu control word */ |
| 15 | |
| 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 $0x0800,%edx /* round towards +oo */ |
| 20 | orl -4(%rsp),%edx |
| 21 | andl $0xfbff,%edx |
| 22 | movl %edx,-8(%rsp) |
| 23 | fldcw -8(%rsp) /* load modified control word */ |
| 24 | |
| 25 | frndint /* round */ |
| 26 | |
| 27 | fldcw -4(%rsp) /* restore original control word */ |
| 28 | |
| 29 | ret |
| 30 | END (__ceill) |
| 31 | weak_alias (__ceill, ceill) |
| 32 | |