xref: /freebsd/lib/msun/i387/s_floorf.S (revision 1d386b48a555f61cb7325543adbbb5c3f3407a66)
1fe69257dSDavid Schultz/*
2fe69257dSDavid Schultz * Written by J.T. Conklin <jtc@netbsd.org>.
3fe69257dSDavid Schultz * Public domain.
4fe69257dSDavid Schultz */
5fe69257dSDavid Schultz
6fe69257dSDavid Schultz#include <machine/asm.h>
7fe69257dSDavid Schultz/* RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $") */
8fe69257dSDavid Schultz
9fe69257dSDavid SchultzENTRY(floorf)
10fe69257dSDavid Schultz	pushl	%ebp
11fe69257dSDavid Schultz	movl	%esp,%ebp
12fe69257dSDavid Schultz	subl	$8,%esp
13fe69257dSDavid Schultz
147f8fa2cfSDaniel Eischen	fstcw	-4(%ebp)		/* store fpu control word */
157f8fa2cfSDaniel Eischen	movw	-4(%ebp),%dx
16fe69257dSDavid Schultz	orw	$0x0400,%dx		/* round towards -oo */
17fe69257dSDavid Schultz	andw	$0xf7ff,%dx
187f8fa2cfSDaniel Eischen	movw	%dx,-8(%ebp)
19*a52f4499SGordon Bergling	fldcw	-8(%ebp)		/* load modified control word */
20fe69257dSDavid Schultz
21fe69257dSDavid Schultz	flds	8(%ebp);		/* round */
22fe69257dSDavid Schultz	frndint
23fe69257dSDavid Schultz
247f8fa2cfSDaniel Eischen	fldcw	-4(%ebp)		/* restore original control word */
25fe69257dSDavid Schultz
26fe69257dSDavid Schultz	leave
27fe69257dSDavid Schultz	ret
289235ed71SAttilio RaoEND(floorf)
298997563cSKonstantin Belousov
308997563cSKonstantin Belousov	.section .note.GNU-stack,"",%progbits
31