flt_rounds.S revision 1.5 1 1.5 perry /* $NetBSD: flt_rounds.S,v 1.5 1998/01/09 03:45:03 perry Exp $ */
2 1.5 perry
3 1.1 jtc /*
4 1.1 jtc * Written by J.T. Conklin, Apr 4, 1995
5 1.1 jtc * Public domain.
6 1.1 jtc */
7 1.1 jtc
8 1.1 jtc #include <machine/asm.h>
9 1.1 jtc
10 1.1 jtc .text
11 1.1 jtc .align 2
12 1.1 jtc _map:
13 1.2 mycroft .byte 1 /* round to nearest */
14 1.2 mycroft .byte 3 /* round to negative infinity */
15 1.2 mycroft .byte 2 /* round to positive infinity */
16 1.2 mycroft .byte 0 /* round to zero */
17 1.1 jtc
18 1.1 jtc ENTRY(__flt_rounds)
19 1.1 jtc subl $4,%esp
20 1.2 mycroft fnstcw (%esp)
21 1.3 mycroft movl (%esp),%eax
22 1.1 jtc shrl $10,%eax
23 1.1 jtc andl $3,%eax
24 1.4 pk #ifdef PIC
25 1.4 pk PIC_PROLOGUE
26 1.4 pk leal PIC_GOTOFF(_map),%ecx
27 1.4 pk PIC_EPILOGUE
28 1.4 pk movb (%ecx,%eax,1),%al
29 1.4 pk #else
30 1.2 mycroft movb _map(,%eax,1),%al
31 1.4 pk #endif
32 1.1 jtc addl $4,%esp
33 1.1 jtc ret
34