1 /*	$OpenBSD: fpsetsticky.c,v 1.3 2005/08/07 16:40:15 espie Exp $ */
2 /*
3  * Written by J.T. Conklin, Apr 10, 1995
4  * Public domain.
5  */
6 
7 #include <ieeefp.h>
8 
9 fp_except
fpsetsticky(sticky)10 fpsetsticky(sticky)
11 	fp_except sticky;
12 {
13 	fp_except old;
14 	fp_except new;
15 
16 	__asm__("st %%fsr,%0" : "=m" (*&old));
17 
18 	new = old;
19 	new &= ~(0x1f << 5);
20 	new |= ((sticky & 0x1f) << 5);
21 
22 	__asm__("ld %0,%%fsr" : : "m" (*&new));
23 
24 	return (old >> 5) & 0x1f;
25 }
26