xref: /openbsd/lib/libc/arch/hppa/gen/fpgetround.c (revision 09467b48)
1 /*	$OpenBSD: fpgetround.c,v 1.5 2016/07/26 19:07:09 guenther Exp $	*/
2 
3 /*
4  * Written by Miodrag Vallat.  Public domain
5  */
6 
7 #include <sys/types.h>
8 #include <ieeefp.h>
9 
10 fp_rnd
11 fpgetround(void)
12 {
13 	u_int64_t fpsr;
14 
15 	__asm__ volatile("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
16 	return ((fpsr >> 41) & 0x3);
17 }
18 DEF_WEAK(fpgetround);
19