2.9
[glibc/nacl-glibc.git] / sysdeps / i386 / fpu / s_ceill.S
blob0128966ebe917ab076503e8a9d59a9e5b296052b
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(__ceill)
12         fldt    4(%esp)
13         subl    $8,%esp
15         fstcw   4(%esp)                 /* store fpu control word */
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    $0x0800,%edx            /* round towards +oo */
21         orl     4(%esp),%edx
22         andl    $0xfbff,%edx
23         movl    %edx,(%esp)
24         fldcw   (%esp)                  /* load modified control word */
26         frndint                         /* round */
28         fldcw   4(%esp)                 /* restore original control word */
30         addl    $8,%esp
31         ret
32 END (__ceill)
33 weak_alias (__ceill, ceill)