xref: /netbsd/lib/libc/arch/i386/gen/flt_rounds.S (revision bf9ec67e)
1/*	$NetBSD: flt_rounds.S,v 1.6 1999/08/23 08:45:09 kleink 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
18ENTRY(__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
34