]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/libm-i387/s_ceil.S
update from main archive 961005
[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
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 -4(%ebp),%edx
21 orl $0x0800,%edx /* round towards +oo */
22 andl $0xfbff,%edx
23 movl %edx,-8(%ebp)
24 fldcw -8(%ebp) /* load modfied control word */
25
26 fldl 8(%ebp); /* round */
27 frndint
28
29 fldcw -4(%ebp) /* restore original control word */
30
31 leave
32 ret
33 PSEUDO_END (__ceil)
34 weak_alias (__ceil, ceil)