2.9
[glibc/nacl-glibc.git] / sysdeps / i386 / fpu / s_ceilf.S
blob352d40d7ce60b8cb8fe4c6c8656b57975bd7cb79
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  */
6 #include <machine/asm.h>
8 RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $")
10 ENTRY(__ceilf)
11         flds    4(%esp)
12         subl    $8,%esp
14         fstcw   4(%esp)                 /* store fpu control word */
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(%esp),%edx
21         andl    $0xfbff,%edx
22         movl    %edx,(%esp)
23         fldcw   (%esp)                  /* load modified control word */
25         frndint                         /* round */
27         fldcw   4(%esp)                 /* restore original control word */
29         addl    $8,%esp
30         ret
31 END (__ceilf)
32 weak_alias (__ceilf, ceilf)