1145171Sdas/*
2145171Sdas * Based on code written by J.T. Conklin <jtc@NetBSD.org>.
3145171Sdas * Public domain.
4145171Sdas */
5145171Sdas
6145171Sdas#include <machine/asm.h>
7145171Sdas__FBSDID("$FreeBSD$")
8145171Sdas
9145171SdasENTRY(trunc)
10145171Sdas	pushl	%ebp
11145171Sdas	movl	%esp,%ebp
12145171Sdas	subl	$8,%esp
13145171Sdas
14145171Sdas	fstcw	-4(%ebp)		/* store fpu control word */
15145171Sdas	movw	-4(%ebp),%dx
16145171Sdas	orw	$0x0c00,%dx		/* round towards -oo */
17145171Sdas	movw	%dx,-8(%ebp)
18145171Sdas	fldcw	-8(%ebp)		/* load modfied control word */
19145171Sdas
20145171Sdas	fldl	8(%ebp)			/* round */
21145171Sdas	frndint
22145171Sdas
23145171Sdas	fldcw	-4(%ebp)		/* restore original control word */
24145171Sdas
25145171Sdas	leave
26145171Sdas	ret
27192760SattilioEND(trunc)
28217108Skib
29217108Skib	.section .note.GNU-stack,"",%progbits
30