Home | History | Annotate | Line # | Download | only in gen
fpgetsticky.c revision 1.5.4.2
      1  1.5.4.2     yamt /*	$NetBSD: fpgetsticky.c,v 1.5.4.2 2012/10/30 18:58:41 yamt Exp $	*/
      2      1.1      eeh 
      3      1.1      eeh /*
      4      1.1      eeh  * Written by J.T. Conklin, Apr 10, 1995
      5      1.1      eeh  * Public domain.
      6      1.1      eeh  */
      7      1.1      eeh 
      8      1.2  thorpej #include <sys/cdefs.h>
      9      1.3    lukem #if defined(LIBC_SCCS) && !defined(lint)
     10  1.5.4.2     yamt __RCSID("$NetBSD: fpgetsticky.c,v 1.5.4.2 2012/10/30 18:58:41 yamt Exp $");
     11      1.3    lukem #endif /* LIBC_SCCS and not lint */
     12      1.2  thorpej 
     13      1.2  thorpej #include "namespace.h"
     14      1.2  thorpej 
     15  1.5.4.1     yamt #include <sys/types.h>
     16      1.1      eeh #include <ieeefp.h>
     17      1.2  thorpej 
     18      1.2  thorpej #ifdef __weak_alias
     19      1.2  thorpej __weak_alias(fpgetsticky,_fpgetsticky)
     20      1.2  thorpej #endif
     21      1.1      eeh 
     22      1.5   martin #ifdef EXCEPTIONS_WITH_SOFTFLOAT
     23      1.5   martin extern fp_except _softfloat_float_exception_flags;
     24      1.5   martin #endif
     25      1.5   martin 
     26      1.1      eeh fp_except
     27  1.5.4.2     yamt fpgetsticky(void)
     28      1.1      eeh {
     29  1.5.4.1     yamt 	uint32_t x;
     30      1.5   martin 	fp_except res;
     31      1.1      eeh 
     32      1.4    perry 	__asm("st %%fsr,%0" : "=m" (*&x));
     33      1.5   martin 	res = (x >> 5) & 0x1f;
     34      1.5   martin 
     35      1.5   martin #ifdef EXCEPTIONS_WITH_SOFTFLOAT
     36      1.5   martin 	res |= _softfloat_float_exception_flags;
     37      1.5   martin #endif
     38      1.5   martin 
     39      1.5   martin 	return res;
     40      1.1      eeh }
     41