xref: /netbsd-src/lib/libc/arch/i386/gen/fpsetround.S (revision 93f9db1b75d415b78f73ed629beeb86235153473)
1/*	$NetBSD: fpsetround.S,v 1.2 1998/01/09 03:45:06 perry Exp $	*/
2
3/*
4 * Written by Charles M. Hannum, Apr 9, 1995
5 * Public domain.
6 */
7
8#include <machine/asm.h>
9
10ENTRY(fpsetround)
11	subl $4,%esp
12
13	fnstcw (%esp)
14	movl (%esp),%eax
15
16	rorl $10,%eax
17	movl %eax,%edx
18	andl $3,%eax
19
20	subl %eax,%edx
21	movl 8(%esp),%ecx
22	andl $3,%ecx
23	orl %ecx,%edx
24	roll $10,%edx
25	movl %edx,(%esp)
26	fldcw (%esp)
27
28	addl $4,%esp
29	ret
30