xref: /freebsd/lib/msun/i387/s_truncf.S (revision 02e9120893770924227138ba49df1edb3896112a)
1/*
2 * Based on code written by J.T. Conklin <jtc@NetBSD.org>.
3 * Public domain.
4 */
5
6#include <machine/asm.h>
7ENTRY(truncf)
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	$0x0c00,%dx		/* round towards -oo */
15	movw	%dx,-8(%ebp)
16	fldcw	-8(%ebp)		/* load modified control word */
17
18	flds	8(%ebp)			/* round */
19	frndint
20
21	fldcw	-4(%ebp)		/* restore original control word */
22
23	leave
24	ret
25END(truncf)
26
27	.section .note.GNU-stack,"",%progbits
28