fpsetsticky.c revision 201856
1/* $NetBSD: fpsetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */ 2 3/* 4 * Written by J.T. Conklin, Apr 11, 1995 5 * Public domain. 6 */ 7 8#include <sys/cdefs.h> 9__FBSDID("$FreeBSD: head/lib/libc/mips/gen/hardfloat/fpsetsticky.c 201856 2010-01-08 23:50:39Z imp $"); 10#if defined(LIBC_SCCS) && !defined(lint) 11__RCSID("$NetBSD: fpsetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $"); 12#endif /* LIBC_SCCS and not lint */ 13 14#include "namespace.h" 15 16#include <ieeefp.h> 17 18#ifdef __weak_alias 19__weak_alias(fpsetsticky,_fpsetsticky) 20#endif 21 22fp_except 23fpsetsticky(sticky) 24 fp_except sticky; 25{ 26 fp_except old; 27 fp_except new; 28 29 __asm("cfc1 %0,$31" : "=r" (old)); 30 31 new = old; 32 new &= ~(0x1f << 2); 33 new |= ((sticky & 0x1f) << 2); 34 35 __asm("ctc1 %0,$31" : : "r" (new)); 36 37 return (old >> 2) & 0x1f; 38} 39