1*3d365e74Schristos /* $NetBSD: fpgetround.c,v 1.6 2012/06/24 15:26:02 christos Exp $ */ 2cf009bccSeeh 3cf009bccSeeh /* 4cf009bccSeeh * Written by J.T. Conklin, Apr 10, 1995 5cf009bccSeeh * Public domain. 6cf009bccSeeh */ 7cf009bccSeeh 85d3e8294Sthorpej #include <sys/cdefs.h> 988c3eadbSlukem #if defined(LIBC_SCCS) && !defined(lint) 10*3d365e74Schristos __RCSID("$NetBSD: fpgetround.c,v 1.6 2012/06/24 15:26:02 christos Exp $"); 1188c3eadbSlukem #endif /* LIBC_SCCS and not lint */ 125d3e8294Sthorpej 135d3e8294Sthorpej #include "namespace.h" 145d3e8294Sthorpej 150abf123aSmartin #include <sys/types.h> 16cf009bccSeeh #include <ieeefp.h> 17cf009bccSeeh 185d3e8294Sthorpej #ifdef __weak_alias __weak_alias(fpgetround,_fpgetround)195d3e8294Sthorpej__weak_alias(fpgetround,_fpgetround) 205d3e8294Sthorpej #endif 215d3e8294Sthorpej 22cf009bccSeeh fp_rnd 23*3d365e74Schristos fpgetround(void) 24cf009bccSeeh { 250abf123aSmartin uint32_t x; 26cf009bccSeeh 27ce666bb8Sperry __asm("st %%fsr,%0" : "=m" (*&x)); 28cf009bccSeeh return (x >> 30) & 0x03; 29cf009bccSeeh } 30