xref: /relibc/openlibm/i387/s_ceil.S (revision 4f5112ea59cd2488b806c68b41e95dc31ebc8f0b)
1/*
2 * Written by:
3 *	J.T. Conklin (jtc@netbsd.org)
4 *	Public domain.
5 */
6
7#include <i387/bsd_asm.h>
8
9ENTRY(ceil)
10    pushl   %ebp
11	movl	%esp,%ebp
12	subl	$8,%esp
13
14	fstcw	-4(%ebp)		/* store fpu control word */
15	movw	-4(%ebp),%dx
16	orw	$0x0800,%dx		/* round towards +oo */
17	andw	$0xfbff,%dx
18	movw	%dx,-8(%ebp)
19	fldcw	-8(%ebp)		/* load modfied control word */
20
21	fldl	8(%ebp);		/* round */
22	frndint
23
24	fldcw	-4(%ebp)		/* restore original control word */
25
26	leave
27	ret
28END(ceil)
29
30
31/* Enable stack protection */
32#if defined(__ELF__)
33.section .note.GNU-stack,"",%progbits
34#endif
35