xref: /netbsd-src/lib/libc/arch/sparc/gen/fpsetsticky.c (revision ce0bb6e8d2e560ecacbe865a848624f94498063b)
1 /*
2  * Written by J.T. Conklin, Apr 10, 1995
3  * Public domain.
4  */
5 
6 #include <ieeefp.h>
7 
8 fp_except
9 fpsetsticky(sticky)
10 	fp_except sticky;
11 {
12 	fp_except old;
13 	fp_except new;
14 
15 	__asm__("st %%fsr,%0" : "=m" (*&old));
16 
17 	new = old;
18 	new &= ~(0x1f << 5);
19 	new |= ((sticky & 0x1f) << 5);
20 
21 	__asm__("ld %0,%%fsr" : : "m" (*&new));
22 
23 	return (old >> 5) & 0x1f;
24 }
25