1/*
2 * Public domain.
3 */
4
5#include <machine/asm.h>
6#include <libm-alias-double.h>
7
8RCSID("$NetBSD: s_ceil.S,v 1.4 1995/05/08 23:52:13 jtc Exp $")
9
10ENTRY(__ceil)
11	fldl	4(%esp)
12	subl	$32,%esp
13	cfi_adjust_cfa_offset (32)
14
15	fnstenv	4(%esp)			/* store fpu environment */
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	$0x0800,%edx		/* round towards +oo */
21	orl	4(%esp),%edx
22	andl	$0xfbff,%edx
23	movl	%edx,(%esp)
24	fldcw	(%esp)			/* load modified control word */
25
26	frndint				/* round */
27
28	fldenv	4(%esp)			/* restore original environment */
29
30	addl	$32,%esp
31	cfi_adjust_cfa_offset (-32)
32	ret
33END (__ceil)
34libm_alias_double (__ceil, ceil)
35