Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/fpu fpu_sub(): Do not invert sign bit of NaN.



details:   https://anonhg.NetBSD.org/src/rev/16710484beab
branches:  trunk
changeset: 369895:16710484beab
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Sep 06 23:07:53 2022 +0000

description:
fpu_sub(): Do not invert sign bit of NaN.

Taken from FreeBSD:
https://cgit.freebsd.org/src/commit/lib/libc/sparc64/fpu?h=releng/12.3&id=8ff9d52cd08cbf31efde4052d3593a5680eaa2a5

diffstat:

 sys/arch/powerpc/fpu/fpu_emu.h |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r d4bebc8255e2 -r 16710484beab sys/arch/powerpc/fpu/fpu_emu.h
--- a/sys/arch/powerpc/fpu/fpu_emu.h    Tue Sep 06 23:05:52 2022 +0000
+++ b/sys/arch/powerpc/fpu/fpu_emu.h    Tue Sep 06 23:07:53 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_emu.h,v 1.10 2022/09/05 00:27:16 rin Exp $ */
+/*     $NetBSD: fpu_emu.h,v 1.11 2022/09/06 23:07:53 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -163,7 +163,8 @@
  * Each returns a pointer to the result and/or sets exceptions.
  */
 struct fpn *fpu_add(struct fpemu *);
-#define        fpu_sub(fe) ((fe)->fe_f2.fp_sign ^= 1, fpu_add(fe))
+#define        fpu_sub(fe)                                                     \
+    ((ISNAN(&(fe)->fe_f2) ? 0 : ((fe)->fe_f2.fp_sign ^= 1)), fpu_add(fe))
 struct fpn *fpu_mul(struct fpemu *);
 struct fpn *fpu_div(struct fpemu *);
 struct fpn *fpu_sqrt(struct fpemu *);



Home | Main Index | Thread Index | Old Index