xref: /minix3/lib/libc/arch/sparc64/gen/fpgetround.c (revision e415d488727a332a2c69df018aa35e2cecf4148a)
1*e415d488SLionel Sambuc /*	$NetBSD: fpgetround.c,v 1.6 2012/06/24 15:26:02 christos Exp $	*/
22fe8fb19SBen Gras 
32fe8fb19SBen Gras /*
42fe8fb19SBen Gras  * Written by J.T. Conklin, Apr 10, 1995
52fe8fb19SBen Gras  * Public domain.
62fe8fb19SBen Gras  */
72fe8fb19SBen Gras 
82fe8fb19SBen Gras #include <sys/cdefs.h>
92fe8fb19SBen Gras #if defined(LIBC_SCCS) && !defined(lint)
10*e415d488SLionel Sambuc __RCSID("$NetBSD: fpgetround.c,v 1.6 2012/06/24 15:26:02 christos Exp $");
112fe8fb19SBen Gras #endif /* LIBC_SCCS and not lint */
122fe8fb19SBen Gras 
132fe8fb19SBen Gras #include "namespace.h"
142fe8fb19SBen Gras 
15*e415d488SLionel Sambuc #include <sys/types.h>
162fe8fb19SBen Gras #include <ieeefp.h>
172fe8fb19SBen Gras 
182fe8fb19SBen Gras #ifdef __weak_alias
__weak_alias(fpgetround,_fpgetround)192fe8fb19SBen Gras __weak_alias(fpgetround,_fpgetround)
202fe8fb19SBen Gras #endif
212fe8fb19SBen Gras 
222fe8fb19SBen Gras fp_rnd
23*e415d488SLionel Sambuc fpgetround(void)
242fe8fb19SBen Gras {
25*e415d488SLionel Sambuc 	uint32_t x;
262fe8fb19SBen Gras 
272fe8fb19SBen Gras 	__asm("st %%fsr,%0" : "=m" (*&x));
282fe8fb19SBen Gras 	return (x >> 30) & 0x03;
292fe8fb19SBen Gras }
30