xref: /openbsd-src/lib/libc/arch/sparc64/gen/fpgetround.c (revision 29cc2a2d1d99869c4cfa9c708e043103e2d7d805)
1 /*	$OpenBSD: fpgetround.c,v 1.2 2016/07/26 19:07:09 guenther Exp $	*/
2 
3 /*
4  * Written by J.T. Conklin, Apr 10, 1995
5  * Public domain.
6  */
7 
8 #include <ieeefp.h>
9 
10 fp_rnd
fpgetround(void)11 fpgetround(void)
12 {
13 	int x;
14 
15 	__asm__("st %%fsr,%0" : "=m" (*&x));
16 	return (x >> 30) & 0x03;
17 }
18 DEF_WEAK(fpgetround);
19