Update from main archive 961219
[glibc.git] / sysdeps / libm-i387 / s_ceill.S
bloba77e550d7be40c1f3c04304501dbea498b8394ef
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         pushl   %ebp
13         movl    %esp,%ebp
14         subl    $8,%esp
16         fstcw   -4(%ebp)                /* store fpu control word */
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    -4(%ebp),%edx
22         orl     $0x0800,%edx            /* round towards +oo */
23         andl    $0xfbff,%edx
24         movl    %edx,-8(%ebp)
25         fldcw   -8(%ebp)                /* load modified control word */
27         fldt    8(%ebp);                /* round */
28         frndint
30         fldcw   -4(%ebp)                /* restore original control word */
32         leave
33         ret
34 PSEUDO_END (__ceill)
35 weak_alias (__ceill, ceill)