xref: /netbsd-src/lib/libc/arch/x86_64/gen/fpgetround.S (revision 92d1d4411b9f8cbaff3d5eb0b336fcc1c32deb29)
1/*	$NetBSD: fpgetround.S,v 1.5 2014/05/22 15:01:56 uebayasi Exp $	*/
2
3/*
4 * Written by J.T. Conklin, Apr 4, 1995
5 * Public domain.
6 */
7
8#include <machine/asm.h>
9
10/*
11 * XXX load only x87 state. If an application only uses the fp*
12 * interface, this should be in sync with the SSE mxcsr register.
13 */
14
15#ifdef WEAK_ALIAS
16WEAK_ALIAS(fpgetround, _fpgetround)
17ENTRY(_fpgetround)
18#else
19ENTRY(fpgetround)
20#endif
21	fnstcw -4(%rsp)
22	movl -4(%rsp), %eax
23	andl $0x00000c00, %eax
24	ret
25#ifdef WEAK_ALIAS
26END(_fpgetround)
27#else
28END(fpgetround)
29#endif
30