xref: /freebsd/lib/msun/i387/s_truncl.S (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1/*
2 * Based on code written by J.T. Conklin <jtc@NetBSD.org>.
3 * Public domain.
4 */
5
6#include <machine/asm.h>
7ENTRY(truncl)
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	fldt	8(%ebp)			/* round */
19	frndint
20
21	fldcw	-4(%ebp)		/* restore original control word */
22
23	leave
24	ret
25END(truncl)
26
27	.section .note.GNU-stack,"",%progbits
28