xref: /freebsd/lib/msun/i387/s_floorf.S (revision 984485a02eb3e63b4170dd911b72de38b35b2289)
1/*
2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Public domain.
4 */
5
6#include <machine/asm.h>
7
8__FBSDID("$FreeBSD$");
9/* RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $") */
10
11ENTRY(floorf)
12	pushl	%ebp
13	movl	%esp,%ebp
14	subl	$8,%esp
15
16	fstcw	-4(%ebp)		/* store fpu control word */
17	movw	-4(%ebp),%dx
18	orw	$0x0400,%dx		/* round towards -oo */
19	andw	$0xf7ff,%dx
20	movw	%dx,-8(%ebp)
21	fldcw	-8(%ebp)		/* load modfied control word */
22
23	flds	8(%ebp);		/* round */
24	frndint
25
26	fldcw	-4(%ebp)		/* restore original control word */
27
28	leave
29	ret
30END(floorf)
31