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