Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/lib/libm/arch/aarch64 Pull up following revision(s) (requ...
details: https://anonhg.NetBSD.org/src/rev/3d545fa4c22d
branches: netbsd-9
changeset: 843626:3d545fa4c22d
user: martin <martin%NetBSD.org@localhost>
date: Sun Dec 08 13:37:46 2019 +0000
description:
Pull up following revision(s) (requested by riastradh in ticket #507):
lib/libm/arch/aarch64/fenv.c: revision 1.5
lib/libm/arch/aarch64/fenv.c: revision 1.6
Fix fesetenv and feupdateenv.
- fesetenv is supposed to set the stored rounding mode (and stored trap
settings, but they have no effect on any ARMv8 I know).
- feupdateenv is supposed to re-raise the exceptions that were raised
in the environment when it was called.
XXX atf test
XXX pullup-9
Fix feraiseexcept.
- Don't touch the trap flags (though on all ARMv8 I know they have no
effect anyway).
- Don't clear any existing raised exception flags; just add to them.
XXX atf test
XXX pullup-9
diffstat:
lib/libm/arch/aarch64/fenv.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diffs (56 lines):
diff -r 6ef9a502419f -r 3d545fa4c22d lib/libm/arch/aarch64/fenv.c
--- a/lib/libm/arch/aarch64/fenv.c Sun Dec 08 13:35:51 2019 +0000
+++ b/lib/libm/arch/aarch64/fenv.c Sun Dec 08 13:37:46 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.4 2018/11/07 06:47:38 riastradh Exp $ */
+/* $NetBSD: fenv.c,v 1.4.2.1 2019/12/08 13:37:46 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: fenv.c,v 1.4 2018/11/07 06:47:38 riastradh Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.4.2.1 2019/12/08 13:37:46 martin Exp $");
#include "namespace.h"
@@ -107,11 +107,9 @@
_DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
#endif
unsigned int fpsr = reg_fpsr_read();
- fpsr = (fpsr & ~FPSR_CSUM) | __SHIFTIN(excepts, FPSR_CSUM);
+ excepts &= FE_ALL_EXCEPT; /* paranoia */
+ fpsr |= __SHIFTIN(excepts, FPSR_CSUM);
reg_fpsr_write(fpsr);
- unsigned int fpcr = reg_fpcr_read();
- fpcr = (fpcr & ~FPCR_ESUM) | __SHIFTIN(excepts, FPCR_ESUM);
- reg_fpcr_write(fpcr);
return 0;
}
@@ -213,6 +211,7 @@
fesetenv(const fenv_t *envp)
{
reg_fpsr_write(envp->__fpsr);
+ reg_fpcr_write(envp->__fpcr);
return 0;
}
@@ -225,11 +224,10 @@
int
feupdateenv(const fenv_t *envp)
{
-#ifndef lint
- _DIAGASSERT(envp != NULL);
-#endif
- reg_fpsr_write(envp->__fpsr);
- reg_fpcr_write(envp->__fpcr);
+ int except = fetestexcept(FE_ALL_EXCEPT);
+
+ fesetenv(envp);
+ feraiseexcept(except);
/* Success */
return 0;
Home |
Main Index |
Thread Index |
Old Index