Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libm/arch/arm Add our common non standard extensions and...



details:   https://anonhg.NetBSD.org/src/rev/4eff462378ea
branches:  trunk
changeset: 805284:4eff462378ea
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Dec 27 17:54:24 2014 +0000

description:
Add our common non standard extensions and fix typo (FE_EXCEPT_ALL ->
FE_ALL_EXCEPT).

diffstat:

 lib/libm/arch/arm/fenv.c |  51 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 45 insertions(+), 6 deletions(-)

diffs (110 lines):

diff -r 441d2019b89b -r 4eff462378ea lib/libm/arch/arm/fenv.c
--- a/lib/libm/arch/arm/fenv.c  Sat Dec 27 17:52:45 2014 +0000
+++ b/lib/libm/arch/arm/fenv.c  Sat Dec 27 17:54:24 2014 +0000
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fenv.c,v 1.3 2013/05/01 04:04:54 matt Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.4 2014/12/27 17:54:24 martin Exp $");
 
 #include <sys/types.h>
 #include <assert.h>
@@ -57,7 +57,7 @@
 feclearexcept(int excepts)
 {
 #ifndef lint
-       _DIAGASSERT((except & ~FE_EXCEPT_ALL) == 0);
+       _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
 #endif
 #ifdef __SOFTFP__
        fpsetsticky(fpgetsticky() & ~excepts);
@@ -78,7 +78,7 @@
 int
 fegetexceptflag(fexcept_t *flagp, int excepts)
 {
-       _DIAGASSERT((except & ~FE_EXCEPT_ALL) == 0);
+       _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
 #ifdef __SOFTFP__
        *flagp = fpgetsticky() & excepts;
 #else
@@ -96,7 +96,7 @@
 feraiseexcept(int excepts)
 {
 #ifndef lint
-       _DIAGASSERT((except & ~FE_EXCEPT_ALL) == 0);
+       _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
 #endif
 #ifdef __SOFTFP__
        excepts &= fpgetsticky();
@@ -140,7 +140,7 @@
 fesetexceptflag(const fexcept_t *flagp, int excepts)
 {
 #ifndef lint
-       _DIAGASSERT((except & ~FE_EXCEPT_ALL) == 0);
+       _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
 #endif
 #ifdef __SOFTFP__
        fpsetsticky((fpgetsticky() & ~excepts) | (excepts & *flagp));
@@ -153,6 +153,39 @@
        return 0;
 }
 
+int
+feenableexcept(int excepts)
+{
+#ifndef lint
+       _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
+#endif
+#ifdef __SOFTFP__
+       int old = fpgetsticky();
+       fpsetsticky(old | excepts);
+#else
+       int fpscr = armreg_fpscr_read();
+       armreg_fpscr_write(fpscr | __SHIFTIN((excepts), VFP_FPSCR_CSUM));
+       return __SHIFTOUT(fpscr, VFP_FPSCR_CSUM) & FE_ALL_EXCEPT;
+#endif
+}
+
+int
+fedisableexcept(int excepts)
+{
+#ifndef lint
+       _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
+#endif
+#ifdef __SOFTFP__
+       int old = fpgetsticky();
+       fpsetsticky(old & ~excepts);
+       return old;
+#else
+       int fpscr = armreg_fpscr_read();
+       armreg_fpscr_write(fpscr & ~__SHIFTIN((excepts), VFP_FPSCR_CSUM));
+       return __SHIFTOUT(fpscr, VFP_FPSCR_CSUM) & FE_ALL_EXCEPT;
+#endif
+}
+
 /*
  * The fetestexcept() function shall determine which of a specified subset of
  * the floating-point exception flags are currently set. The excepts argument
@@ -161,7 +194,7 @@
 int
 fetestexcept(int excepts)
 {
-       _DIAGASSERT((except & ~FE_EXCEPT_ALL) == 0);
+       _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
 #ifdef __SOFTFP__
        return fpgetsticky() & excepts;
 #else
@@ -169,6 +202,12 @@
 #endif
 }
 
+int     
+fegetexcept(void)
+{
+       return fetestexcept(FE_ALL_EXCEPT);
+}
+
 /*
  * The fegetround() function shall get the current rounding direction.
  */



Home | Main Index | Thread Index | Old Index