]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/libm-i387/s_ceil.S
eabe662a6c2a501f863866cb781e1ccbb014a781
[thirdparty/glibc.git] / sysdeps / libm-i387 / s_ceil.S
1 /*
2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Public domain.
4 */
5
6 #include <machine/asm.h>
7
8 RCSID("$NetBSD: s_ceil.S,v 1.4 1995/05/08 23:52:13 jtc Exp $")
9
10 ENTRY(__ceil)
11 pushl %ebp
12 movl %esp,%ebp
13 subl $8,%esp
14
15 fstcw -4(%ebp) /* store fpu control word */
16 movw -4(%ebp),%dx
17 orw $0x0800,%dx /* round towards +oo */
18 andw $0xfbff,%dx
19 movw %dx,-8(%ebp)
20 fldcw -8(%ebp) /* load modfied control word */
21
22 fldl 8(%ebp); /* round */
23 frndint
24
25 fldcw -4(%ebp) /* restore original control word */
26
27 leave
28 ret
29 weak_alias (__ceil, ceil)