Source-Changes-HG archive

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

[src/trunk]: src/lib/libm/arch/aarch64 Fix fesetenv and feupdateenv.



details:   https://anonhg.NetBSD.org/src/rev/8cd3995f0647
branches:  trunk
changeset: 964990:8cd3995f0647
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Aug 25 18:31:30 2019 +0000

description:
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

diffstat:

 lib/libm/arch/aarch64/fenv.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r 5a6de44768d5 -r 8cd3995f0647 lib/libm/arch/aarch64/fenv.c
--- a/lib/libm/arch/aarch64/fenv.c      Sun Aug 25 17:38:25 2019 +0000
+++ b/lib/libm/arch/aarch64/fenv.c      Sun Aug 25 18:31:30 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.5 2019/08/25 18:31:30 riastradh 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.5 2019/08/25 18:31:30 riastradh Exp $");
 
 #include "namespace.h"
 
@@ -213,6 +213,7 @@
 fesetenv(const fenv_t *envp)
 {
        reg_fpsr_write(envp->__fpsr);
+       reg_fpcr_write(envp->__fpcr);
        return 0;
 }
 
@@ -225,11 +226,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