Home | History | Annotate | Line # | Download | only in gen
fpsetround.S revision 1.2
      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 
     10 ENTRY(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