1/* $OpenBSD: flt_rounds.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2/* $NetBSD: flt_rounds.S,v 1.2 2002/06/06 23:04:35 fvdl Exp $ */ 3 4/* 5 * Written by J.T. Conklin, Apr 4, 1995 6 * Public domain. 7 */ 8 9#include <machine/asm.h> 10 11 .text 12 _ALIGN_TEXT 13_map: 14 .byte 1 /* round to nearest */ 15 .byte 3 /* round to negative infinity */ 16 .byte 2 /* round to positive infinity */ 17 .byte 0 /* round to zero */ 18 19ENTRY(__flt_rounds) 20 fnstcw -4(%rsp) 21 movl -4(%rsp),%eax 22 shrl $10,%eax 23 andl $3,%eax 24#ifdef PIC 25 leaq PIC_GOT(_map),%rcx 26 movb (%rcx,%rax,1),%al 27#else 28 movb _map(,%rax,1),%al 29#endif 30 ret 31