1258945Sroberto/*
2258945Sroberto * Based on code written by J.T. Conklin <jtc@NetBSD.org>.
3258945Sroberto * Public domain.
4258945Sroberto */
5258945Sroberto
6258945Sroberto#include <machine/asm.h>
7258945Sroberto__FBSDID("$FreeBSD$")
8258945Sroberto
9258945SrobertoENTRY(trunc)
10258945Sroberto	pushl	%ebp
11258945Sroberto	movl	%esp,%ebp
12258945Sroberto	subl	$8,%esp
13258945Sroberto
14258945Sroberto	fstcw	-4(%ebp)		/* store fpu control word */
15258945Sroberto	movw	-4(%ebp),%dx
16258945Sroberto	orw	$0x0c00,%dx		/* round towards -oo */
17258945Sroberto	movw	%dx,-8(%ebp)
18258945Sroberto	fldcw	-8(%ebp)		/* load modfied control word */
19258945Sroberto
20258945Sroberto	fldl	8(%ebp)			/* round */
21258945Sroberto	frndint
22258945Sroberto
23258945Sroberto	fldcw	-4(%ebp)		/* restore original control word */
24258945Sroberto
25258945Sroberto	leave
26258945Sroberto	ret
27258945SrobertoEND(trunc)
28258945Sroberto
29258945Sroberto	.section .note.GNU-stack,"",%progbits
30258945Sroberto