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 fnm{add,sub}{,s}: Do not negate NaN.



details:   https://anonhg.NetBSD.org/src/rev/95c89f50e13a
branches:  trunk
changeset: 370072:95c89f50e13a
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Sep 15 14:25:28 2022 +0000

description:
fnm{add,sub}{,s}: Do not negate NaN.

diffstat:

 sys/arch/powerpc/fpu/fpu_emu.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r d4a5cf40ed4c -r 95c89f50e13a sys/arch/powerpc/fpu/fpu_emu.c
--- a/sys/arch/powerpc/fpu/fpu_emu.c    Thu Sep 15 14:24:00 2022 +0000
+++ b/sys/arch/powerpc/fpu/fpu_emu.c    Thu Sep 15 14:25:28 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_emu.c,v 1.57 2022/09/15 14:24:00 rin Exp $ */
+/*     $NetBSD: fpu_emu.c,v 1.58 2022/09/15 14:25:28 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.57 2022/09/15 14:24:00 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.58 2022/09/15 14:25:28 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -738,7 +738,8 @@
                                fpu_explode(fe, &fe->fe_f2, type, FR(rb));
                                fp = fpu_sub(fe);
                                /* Negate */
-                               fp->fp_sign ^= 1;
+                               if (!ISNAN(fp))
+                                       fp->fp_sign ^= 1;
                                break;
                        case    OPC59_FNMADDS:
                                FPU_EMU_EVCNT_INCR(fnmadd);
@@ -750,7 +751,8 @@
                                fpu_explode(fe, &fe->fe_f2, type, FR(rb));
                                fp = fpu_add(fe);
                                /* Negate */
-                               fp->fp_sign ^= 1;
+                               if (!ISNAN(fp))
+                                       fp->fp_sign ^= 1;
                                break;
                        default:
                                return (NOTFPU);



Home | Main Index | Thread Index | Old Index