11.10Schs/* $NetBSD: fpsetmask.c,v 1.10 2017/02/27 06:55:26 chs Exp $ */ 21.2Sjonathan 31.1Sjtc/* 41.1Sjtc * Written by J.T. Conklin, Apr 11, 1995 51.1Sjtc * Public domain. 61.1Sjtc */ 71.1Sjtc 81.3Sthorpej#include <sys/cdefs.h> 91.4Slukem#if defined(LIBC_SCCS) && !defined(lint) 101.10Schs__RCSID("$NetBSD: fpsetmask.c,v 1.10 2017/02/27 06:55:26 chs Exp $"); 111.4Slukem#endif /* LIBC_SCCS and not lint */ 121.3Sthorpej 131.3Sthorpej#include "namespace.h" 141.3Sthorpej 151.1Sjtc#include <ieeefp.h> 161.3Sthorpej 171.3Sthorpej#ifdef __weak_alias 181.3Sthorpej__weak_alias(fpsetmask,_fpsetmask) 191.3Sthorpej#endif 201.1Sjtc 211.1Sjtcfp_except 221.6Smattfpsetmask(fp_except mask) 231.1Sjtc{ 241.1Sjtc fp_except old; 251.1Sjtc fp_except new; 261.1Sjtc 271.9Sjoerg __asm(".set push; .set noat; cfc1 %0,$31; .set pop" : "=r" (old)); 281.1Sjtc 291.6Smatt new = old & ~(0x1f << 7); 301.1Sjtc new |= ((mask & 0x1f) << 7); 311.1Sjtc 321.10Schs __asm(".set push; .set noat; ctc1 %0,$31; .set pop" : : "r" (new)); 331.1Sjtc 341.8Smatt return (old >> 7) & 0x1f; 351.1Sjtc} 36