xref: /netbsd/lib/libc/arch/x86_64/gen/flt_rounds.S (revision c4a72b64)
1/*	$NetBSD: flt_rounds.S,v 1.2 2002/06/06 23:04:35 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
18ENTRY(__flt_rounds)
19	fnstcw -4(%rsp)
20	movl -4(%rsp),%eax
21	shrl $10,%eax
22	andl $3,%eax
23#ifdef PIC
24	leaq PIC_GOT(_map),%rcx
25	movb (%rcx,%rax,1),%al
26#else
27	movb _map(,%rax,1),%al
28#endif
29	ret
30