fpsetround.S revision 1.2 1 /* $NetBSD: fpsetround.S,v 1.2 2002/01/13 21:45:52 thorpej Exp $ */
2
3 /*
4 * Written by Charles M. Hannum, Apr 9, 1995
5 * Public domain.
6 */
7
8 #include <machine/asm.h>
9
10 #ifdef WEAK_ALIAS
11 WEAK_ALIAS(fpsetround, _fpsetround)
12 ENTRY(_fpsetround)
13 #else
14 ENTRY(fpsetround)
15 #endif
16 fnstcw -4(%rsp)
17 movl -4(%rsp),%eax
18
19 rorl $10,%eax
20 movl %eax,%edx
21 andl $3,%eax
22
23 subl %eax,%edx
24 andl $3,%edi
25 orl %edi,%edx
26 roll $10,%edx
27 movl %edx,-4(%rsp)
28 fldcw -4(%rsp)
29 ret
30