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 fres and frsqrte.



details:   https://anonhg.NetBSD.org/src/rev/37ebce9399bd
branches:  trunk
changeset: 369823:37ebce9399bd
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Sep 02 12:47:10 2022 +0000

description:
Fix fres and frsqrte.
- Pass correct fp to succeeding fpu_implode().
- fres calculates 1 / frB; not 1 / sqrt(frB).

diffstat:

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

diffs (40 lines):

diff -r cbf2538315e5 -r 37ebce9399bd sys/arch/powerpc/fpu/fpu_emu.c
--- a/sys/arch/powerpc/fpu/fpu_emu.c    Fri Sep 02 12:40:49 2022 +0000
+++ b/sys/arch/powerpc/fpu/fpu_emu.c    Fri Sep 02 12:47:10 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_emu.c,v 1.45 2022/09/02 12:40:49 rin Exp $ */
+/*     $NetBSD: fpu_emu.c,v 1.46 2022/09/02 12:47:10 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.45 2022/09/02 12:40:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.46 2022/09/02 12:47:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -690,10 +690,9 @@
                        case    OPC59_FRES:
                                FPU_EMU_EVCNT_INCR(fpres);
                                DPRINTF(FPE_INSN, ("fpu_execute: FPRES\n"));
+                               fpu_explode(fe, &fe->fe_f1, FTYPE_INT, 1);
                                fpu_explode(fe, &fe->fe_f2, type, FR(rb));
-                               fp = fpu_sqrt(fe);
-                               fpu_explode(fe, &fe->fe_f1, FTYPE_INT, 1);
-                               fpu_div(fe);
+                               fp = fpu_div(fe);
                                break;
                        case    OPC59_FMULS:
                                FPU_EMU_EVCNT_INCR(fmul);
@@ -710,7 +709,7 @@
                                fp = fpu_sqrt(fe);
                                fe->fe_f2 = *fp;
                                fpu_explode(fe, &fe->fe_f1, FTYPE_INT, 1);
-                               fpu_div(fe);
+                               fp = fpu_div(fe);
                                break;
                        case    OPC59_FMSUBS:
                                FPU_EMU_EVCNT_INCR(fmulsub);



Home | Main Index | Thread Index | Old Index