Module Name:    src
Committed By:   riastradh
Date:           Sun Aug 25 18:59:53 UTC 2019

Modified Files:
        src/lib/libm/arch/aarch64: fenv.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/arch/aarch64/fenv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libm/arch/aarch64/fenv.c
diff -u src/lib/libm/arch/aarch64/fenv.c:1.5 src/lib/libm/arch/aarch64/fenv.c:1.6
--- src/lib/libm/arch/aarch64/fenv.c:1.5	Sun Aug 25 18:31:30 2019
+++ src/lib/libm/arch/aarch64/fenv.c	Sun Aug 25 18:59:52 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.5 2019/08/25 18:31:30 riastradh Exp $ */
+/* $NetBSD: fenv.c,v 1.6 2019/08/25 18:59:52 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fenv.c,v 1.5 2019/08/25 18:31:30 riastradh Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.6 2019/08/25 18:59:52 riastradh Exp $");
 
 #include "namespace.h"
 
@@ -107,11 +107,9 @@ feraiseexcept(int excepts)
 	_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;
 }
 

Reply via email to