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/
fpsetsticky.c revision 1.5
11.5Smartin/*	$NetBSD: fpsetsticky.c,v 1.5 2011/03/06 10:32:47 martin 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.5Smartin__RCSID("$NetBSD: fpsetsticky.c,v 1.5 2011/03/06 10:32:47 martin Exp $");
111.3Slukem#endif /* LIBC_SCCS and not lint */
121.2Sthorpej
131.2Sthorpej#include "namespace.h"
141.2Sthorpej
151.1Seeh#include <ieeefp.h>
161.2Sthorpej
171.2Sthorpej#ifdef __weak_alias
181.2Sthorpej__weak_alias(fpsetsticky,_fpsetsticky)
191.2Sthorpej#endif
201.1Seeh
211.5Smartin#ifdef EXCEPTIONS_WITH_SOFTFLOAT
221.5Smartinextern fp_except _softfloat_float_exception_flags;
231.5Smartin#endif
241.5Smartin
251.1Seehfp_except
261.1Seehfpsetsticky(sticky)
271.1Seeh	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.5Smartin	old = (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