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 Fix weird logic. NFC.



details:   https://anonhg.NetBSD.org/src/rev/6a6d557521e9
branches:  trunk
changeset: 369839:6a6d557521e9
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Sep 03 04:54:08 2022 +0000

description:
Fix weird logic. NFC.

Set both type and size to double by default, and change both to
single if required.

diffstat:

 sys/arch/powerpc/fpu/fpu_emu.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (55 lines):

diff -r 9af0dfd8eee6 -r 6a6d557521e9 sys/arch/powerpc/fpu/fpu_emu.c
--- a/sys/arch/powerpc/fpu/fpu_emu.c    Sat Sep 03 04:52:50 2022 +0000
+++ b/sys/arch/powerpc/fpu/fpu_emu.c    Sat Sep 03 04:54:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_emu.c,v 1.47 2022/09/03 04:52:50 rin Exp $ */
+/*     $NetBSD: fpu_emu.c,v 1.48 2022/09/03 04:54:08 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.47 2022/09/03 04:52:50 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.48 2022/09/03 04:54:08 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -336,7 +336,7 @@
                 * and update index reg if needed.
                 */
                uint64_t buf;
-               size_t size = sizeof(float);
+               size_t size = sizeof(double);
                int store, update;
 
                cond = 0; /* ld/st never set condition codes */
@@ -372,10 +372,10 @@
                                return (NOTFPU);
 
                        store = (instr.i_x.i_xo & 0x80);
-                       if (instr.i_x.i_xo & 0x40)
-                               size = sizeof(double);
-                       else
+                       if ((instr.i_x.i_xo & 0x40) == 0) {
                                type = FTYPE_SNG;
+                               size = sizeof(float);
+                       }
                        update = (instr.i_x.i_xo & 0x20);
                        
                        /* calculate EA of load/store */
@@ -389,10 +389,10 @@
                        rt = instr.i_x.i_rt;
                } else {
                        store = instr.i_d.i_opcd & 0x4;
-                       if (instr.i_d.i_opcd & 0x2)
-                               size = sizeof(double);
-                       else
+                       if ((instr.i_d.i_opcd & 0x2) == 0) {
                                type = FTYPE_SNG;
+                               size = sizeof(float);
+                       }
                        update = instr.i_d.i_opcd & 0x1;
 
                        /* calculate EA of load/store */



Home | Main Index | Thread Index | Old Index