s_floorf.S revision 1.2
11.1Sjtc/*
21.2Sjtc * Written by J.T. Conklin <jtc@netbsd.org>.
31.2Sjtc * Public domain.
41.1Sjtc */
51.1Sjtc
61.1Sjtc#include <machine/asm.h>
71.1Sjtc
81.2SjtcRCSID("$Id: s_floorf.S,v 1.2 1995/04/28 22:44:05 jtc Exp $")
91.1Sjtc
101.1SjtcENTRY(floorf)
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	$0x0400,%dx		/* round towards -oo */
181.1Sjtc	andw	$0xf7ff,%dx
191.1Sjtc	movw	%dx,-16(%ebp)
201.1Sjtc	fldcw	-16(%ebp)		/* load modfied control word */
211.1Sjtc
221.1Sjtc	flds	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