4f49c3e370a74d117d47a66b4725bdf0c3d18b5c
[dragonfly.git] / lib / libc / i386 / gen / flt_rounds.S
1 /*
2  * Written by J.T. Conklin, Apr 4, 1995
3  * Public domain.
4  *
5  * $NetBSD: flt_rounds.S,v 1.6 1999/08/23 08:45:09 kleink Exp $
6  * $DragonFly: src/lib/libc/i386/gen/flt_rounds.S,v 1.1 2005/07/26 21:15:19 joerg Exp $
7  */
8
9 #include <machine/asm.h>
10
11 _START_ENTRY
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         subl $4,%esp
20         fnstcw (%esp)
21         movl (%esp),%eax
22         shrl $10,%eax
23         andl $3,%eax
24 #ifdef PIC
25         PIC_PROLOGUE
26         leal PIC_GOTOFF(_map),%ecx
27         PIC_EPILOGUE
28         movb (%ecx,%eax,1),%al
29 #else
30         movb _map(,%eax,1),%al
31 #endif
32         addl $4,%esp
33         ret