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