Cross Reference: fpsetsticky.c
xref: /src/lib/libc/arch/sparc64/gen/fpsetsticky.c
  • Home
  • History
  • AnnotateAnnotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /src/lib/libc/arch/sparc64/gen/
11.7Smrg/*	$NetBSD: fpsetsticky.c,v 1.7 2013/10/28 01:06:36 mrg Exp $	*/
21.1Seeh
31.1Seeh/*
41.1Seeh * Written by J.T. Conklin, Apr 10, 1995
51.1Seeh * Public domain.
61.1Seeh */
71.1Seeh
81.2Sthorpej#include <sys/cdefs.h>
91.3Slukem#if defined(LIBC_SCCS) && !defined(lint)
101.7Smrg__RCSID("$NetBSD: fpsetsticky.c,v 1.7 2013/10/28 01:06:36 mrg Exp $");
111.3Slukem#endif /* LIBC_SCCS and not lint */
121.2Sthorpej
131.2Sthorpej#include "namespace.h"
141.2Sthorpej
151.6Smartin#include <sys/types.h>
161.1Seeh#include <ieeefp.h>
171.2Sthorpej
181.2Sthorpej#ifdef __weak_alias
191.2Sthorpej__weak_alias(fpsetsticky,_fpsetsticky)
201.2Sthorpej#endif
211.1Seeh
221.5Smartin#ifdef EXCEPTIONS_WITH_SOFTFLOAT
231.5Smartinextern fp_except _softfloat_float_exception_flags;
241.5Smartin#endif
251.5Smartin
261.1Seehfp_except
271.7Smrgfpsetsticky(fp_except sticky)
281.1Seeh{
291.1Seeh	fp_except old;
301.1Seeh	fp_except new;
311.1Seeh
321.4Sperry	__asm("st %%fsr,%0" : "=m" (*&old));
331.1Seeh
341.1Seeh	new = old;
351.1Seeh	new &= ~(0x1f << 5);
361.1Seeh	new |= ((sticky & 0x1f) << 5);
371.1Seeh
381.4Sperry	__asm("ld %0,%%fsr" : : "m" (*&new));
391.1Seeh
401.6Smartin	old = ((uint32_t)old >> 5) & 0x1f;
411.5Smartin
421.5Smartin#ifdef EXCEPTIONS_WITH_SOFTFLOAT
431.5Smartin	old |= _softfloat_float_exception_flags;
441.5Smartin	_softfloat_float_exception_flags = sticky;
451.5Smartin#endif
461.5Smartin	return old;
471.1Seeh}
48

Indexes created Mon Nov 10 17:20:41 GMT 2025