s_ceil.S revision 1.3
11.1Sjtc/*
21.3Sjtc * Written by J.T. Conklin <jtc@netbsd.org>.
31.3Sjtc * Public domain.
41.1Sjtc */
51.1Sjtc
61.1Sjtc#include <machine/asm.h>
71.1Sjtc
81.3SjtcRCSID("$Id: s_ceil.S,v 1.3 1995/04/28 22:43:50 jtc Exp $")
91.2Sjtc
101.1SjtcENTRY(ceil)
111.1Sjtc	pushl	%ebp
121.1Sjtc	movl	%esp,%ebp
131.1Sjtc	subl	$8,%esp
141.1Sjtc
151.1Sjtc	fstcw	-12(%ebp)		/* store fpu control word */
161.1Sjtc	movw	-12(%ebp),%dx
171.1Sjtc	orw	$0x0800,%dx		/* round towards +oo */
181.1Sjtc	andw	$0xfbff,%dx
191.1Sjtc	movw	%dx,-16(%ebp)
201.1Sjtc	fldcw	-16(%ebp)		/* load modfied control word */
211.1Sjtc
221.1Sjtc	fldl	8(%ebp);		/* round */
231.1Sjtc	frndint
241.1Sjtc
251.1Sjtc	fldcw	-12(%ebp)		/* restore original control word */
261.1Sjtc
271.1Sjtc	leave
281.1Sjtc	ret
29