xref: /freebsd/lib/msun/i387/s_floorl.S (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1/*
2 * Based on code written by J.T. Conklin <jtc@NetBSD.org>.
3 * Public domain.
4 */
5
6#include <machine/asm.h>
7ENTRY(floorl)
8	pushl	%ebp
9	movl	%esp,%ebp
10	subl	$8,%esp
11
12	fstcw	-4(%ebp)		/* store fpu control word */
13	movw	-4(%ebp),%dx
14	orw	$0x0400,%dx		/* round towards -oo */
15	andw	$0xf7ff,%dx
16	movw	%dx,-8(%ebp)
17	fldcw	-8(%ebp)		/* load modified control word */
18
19	fldt	8(%ebp)			/* round */
20	frndint
21
22	fldcw	-4(%ebp)		/* restore original control word */
23
24	leave
25	ret
26END(floorl)
27
28	.section .note.GNU-stack,"",%progbits
29