Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/m68k/fpe Fix a sign when a source or destination is...



details:   https://anonhg.NetBSD.org/src/rev/1061b8452055
branches:  trunk
changeset: 792358:1061b8452055
user:      isaki <isaki%NetBSD.org@localhost>
date:      Wed Jan 01 05:22:22 2014 +0000

description:
Fix a sign when a source or destination is either (plus/minus)zero
or (plus/minus)infinity.  Found by XM6i.

diffstat:

 sys/arch/m68k/fpe/fpu_div.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r 41ab51d58017 -r 1061b8452055 sys/arch/m68k/fpe/fpu_div.c
--- a/sys/arch/m68k/fpe/fpu_div.c       Wed Jan 01 00:33:34 2014 +0000
+++ b/sys/arch/m68k/fpe/fpu_div.c       Wed Jan 01 05:22:22 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_div.c,v 1.8 2013/03/26 11:30:20 isaki Exp $ */
+/*     $NetBSD: fpu_div.c,v 1.9 2014/01/01 05:22:22 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.8 2013/03/26 11:30:20 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.9 2014/01/01 05:22:22 isaki Exp $");
 
 #include <sys/types.h>
 
@@ -166,10 +166,10 @@
         * return it.  Otherwise we have the following cases:
         *
         *      Inf / Inf = NaN, plus NV exception
-        *      Inf / num = Inf [i.e., return x]
-        *      Inf / 0   = Inf [i.e., return x]
-        *      0 / Inf = 0 [i.e., return x]
-        *      0 / num = 0 [i.e., return x]
+        *      Inf / num = Inf
+        *      Inf / 0   = Inf
+        *      0 / Inf = 0
+        *      0 / num = 0
         *      0 / 0   = NaN, plus NV exception
         *      num / Inf = 0
         *      num / num = num (do the divide)
@@ -182,6 +182,8 @@
        if (ISINF(x) || ISZERO(x)) {
                if (x->fp_class == y->fp_class)
                        return (fpu_newnan(fe));
+               /* all results at this point use XOR of operand signs */
+               x->fp_sign ^= y->fp_sign;
                return (x);
        }
 



Home | Main Index | Thread Index | Old Index