Home | History | Annotate | Line # | Download | only in gen
fpsetsticky.c revision 1.2.12.1
      1 /*	$NetBSD: fpsetsticky.c,v 1.2.12.1 2002/01/28 20:50:16 nathanw Exp $	*/
      2 
      3 /*
      4  * Written by J.T. Conklin, Apr 10, 1995
      5  * Public domain.
      6  */
      7 
      8 #include <sys/cdefs.h>
      9 
     10 #include "namespace.h"
     11 
     12 #include <ieeefp.h>
     13 
     14 #ifdef __weak_alias
     15 __weak_alias(fpsetsticky,_fpsetsticky)
     16 #endif
     17 
     18 fp_except
     19 fpsetsticky(sticky)
     20 	fp_except sticky;
     21 {
     22 	fp_except old;
     23 	fp_except new;
     24 
     25 	__asm__("st %%fsr,%0" : "=m" (*&old));
     26 
     27 	new = old;
     28 	new &= ~(0x1f << 5);
     29 	new |= ((sticky & 0x1f) << 5);
     30 
     31 	__asm__("ld %0,%%fsr" : : "m" (*&new));
     32 
     33 	return (old >> 5) & 0x1f;
     34 }
     35