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