Home | History | Annotate | Line # | Download | only in gen
flt_rounds.S revision 1.4
      1 /*	$NetBSD: flt_rounds.S,v 1.4 2011/09/29 22:45:20 christos Exp $	*/
      2 
      3 #include <machine/asm.h>
      4 
      5 /*
      6  * 00 0 round to zero
      7  * 01 1 round to nearest
      8  * 10 2 round to positive infinity
      9  * 11 3 round to negative infinity
     10  */
     11 	.text
     12 	_ALIGN_TEXT
     13 ENTRY(__flt_rounds)
     14 	fnstcw	-4(%rsp)
     15 	movl	-4(%rsp), %ecx
     16 	shrl	$9, %ecx
     17 	andl	$6, %ecx
     18 	xorl	$1, %eax	/* map 0,1,2,3 -> 1,0,3,2 */
     19 	andl	$3, %eax
     20 	ret
     21