1 /* $NetBSD: fpgetround.c,v 1.1 2004/07/24 19:09:29 chs Exp $ */ 2 3 /* $OpenBSD: fpgetround.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */ 4 5 /* 6 * Written by Miodrag Vallat. Public domain 7 */ 8 9 #include <sys/types.h> 10 #include <ieeefp.h> 11 12 fp_rnd 13 fpgetround(void) 14 { 15 uint64_t fpsr; 16 17 __asm__ __volatile__("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr)); 18 return ((fpsr >> 41) & 0x3); 19 } 20