Module Name:    src
Committed By:   rin
Date:           Sat Sep  3 04:54:08 UTC 2022

Modified Files:
        src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Fix weird logic. NFC.

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


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.47 src/sys/arch/powerpc/fpu/fpu_emu.c:1.48
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.47	Sat Sep  3 04:52:50 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Sat Sep  3 04:54:08 2022
@@ -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 @@ fpu_execute(struct trapframe *tf, struct
 		 * 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 @@ fpu_execute(struct trapframe *tf, struct
 				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 @@ fpu_execute(struct trapframe *tf, struct
 			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 */

Reply via email to