s_ceil.S revision 1.3
1/*	$OpenBSD: s_ceil.S,v 1.3 2005/08/02 11:17:31 espie Exp $ */
2/*
3 * Written by J.T. Conklin <jtc@netbsd.org>.
4 * Public domain.
5 */
6
7#include <machine/asm.h>
8
9ENTRY(ceil)
10	subl	$8,%esp
11
12	fstcw	4(%esp)		/* store fpu control word */
13	movw	4(%esp),%dx
14	orw	$0x0800,%dx		/* round towards +oo */
15	andw	$0xfbff,%dx
16	movw	%dx,(%esp)
17	fldcw	(%esp)		/* load modfied control word */
18
19	fldl	12(%esp);		/* round */
20	frndint
21
22	fldcw	4(%esp)		/* restore original control word */
23
24	addl	$8,%esp
25	ret
26