1/* $NetBSD: flt_rounds.S,v 1.10 2014/05/23 02:34:19 uebayasi 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 13ENTRY(__flt_rounds) 14 fnstcw -4(%esp) 15 movl -4(%esp), %ecx 16 shrl $9, %ecx 17 andl $6, %ecx 18 movl $0x2d, %eax /* 0x2d = 00.10.11.01 */ 19 sarl %cl, %eax /* 0,1,2,3 -> 1,3,2,0 */ 20 andl $3, %eax 21 ret 22END(__flt_rounds) 23