Module Name: src Committed By: rin Date: Tue Sep 6 23:04:08 UTC 2022
Modified Files: src/sys/arch/powerpc/fpu: fpu_add.c fpu_div.c fpu_mul.c Log Message: Fix priority for NaN propagation: frA > frB > frC. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/fpu/fpu_add.c \ src/sys/arch/powerpc/fpu/fpu_mul.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/fpu/fpu_div.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_add.c diff -u src/sys/arch/powerpc/fpu/fpu_add.c:1.6 src/sys/arch/powerpc/fpu/fpu_add.c:1.7 --- src/sys/arch/powerpc/fpu/fpu_add.c:1.6 Thu Sep 1 06:10:58 2022 +++ src/sys/arch/powerpc/fpu/fpu_add.c Tue Sep 6 23:04:08 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fpu_add.c,v 1.6 2022/09/01 06:10:58 rin Exp $ */ +/* $NetBSD: fpu_add.c,v 1.7 2022/09/06 23:04:08 rin Exp $ */ /* * Copyright (c) 1992, 1993 @@ -47,7 +47,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 1.6 2022/09/01 06:10:58 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 1.7 2022/09/06 23:04:08 rin Exp $"); #include <sys/types.h> #if defined(DIAGNOSTIC)||defined(DEBUG) @@ -93,13 +93,15 @@ fpu_add(struct fpemu *fe) DUMPFPN(FPE_REG, x); DUMPFPN(FPE_REG, y); DPRINTF(FPE_REG, ("=>\n")); - ORDER(x, y); - if (ISNAN(y)) { - if (ISSNAN(y)) + if (ISNAN(x) || ISNAN(y)) { + if (ISSNAN(x) || ISSNAN(y)) fe->fe_cx |= FPSCR_VXSNAN; + if (ISNAN(x)) + y = x; DUMPFPN(FPE_REG, y); return (y); } + ORDER(x, y); if (ISINF(y)) { if (ISINF(x) && x->fp_sign != y->fp_sign) { fe->fe_cx |= FPSCR_VXISI; Index: src/sys/arch/powerpc/fpu/fpu_mul.c diff -u src/sys/arch/powerpc/fpu/fpu_mul.c:1.6 src/sys/arch/powerpc/fpu/fpu_mul.c:1.7 --- src/sys/arch/powerpc/fpu/fpu_mul.c:1.6 Thu Sep 1 06:10:58 2022 +++ src/sys/arch/powerpc/fpu/fpu_mul.c Tue Sep 6 23:04:08 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fpu_mul.c,v 1.6 2022/09/01 06:10:58 rin Exp $ */ +/* $NetBSD: fpu_mul.c,v 1.7 2022/09/06 23:04:08 rin Exp $ */ /* * Copyright (c) 1992, 1993 @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.6 2022/09/01 06:10:58 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.7 2022/09/06 23:04:08 rin Exp $"); #include <sys/types.h> #if defined(DIAGNOSTIC)||defined(DEBUG) @@ -131,14 +131,16 @@ fpu_mul(struct fpemu *fe) DUMPFPN(FPE_REG, y); DPRINTF(FPE_REG, ("=>\n")); - ORDER(x, y); - if (ISNAN(y)) { - y->fp_sign ^= x->fp_sign; - if (ISSNAN(y)) + if (ISNAN(x) || ISNAN(y)) { + if (ISSNAN(x) || ISSNAN(y)) fe->fe_cx |= FPSCR_VXSNAN; + if (ISNAN(x)) + SWAP(x, y); + y->fp_sign ^= x->fp_sign; DUMPFPN(FPE_REG, y); return (y); } + ORDER(x, y); if (ISINF(y)) { if (ISZERO(x)) { fe->fe_cx |= FPSCR_VXIMZ; Index: src/sys/arch/powerpc/fpu/fpu_div.c diff -u src/sys/arch/powerpc/fpu/fpu_div.c:1.8 src/sys/arch/powerpc/fpu/fpu_div.c:1.9 --- src/sys/arch/powerpc/fpu/fpu_div.c:1.8 Sun Sep 4 13:32:14 2022 +++ src/sys/arch/powerpc/fpu/fpu_div.c Tue Sep 6 23:04:08 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fpu_div.c,v 1.8 2022/09/04 13:32:14 rin Exp $ */ +/* $NetBSD: fpu_div.c,v 1.9 2022/09/06 23:04:08 rin Exp $ */ /* * Copyright (c) 1992, 1993 @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.8 2022/09/04 13:32:14 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.9 2022/09/06 23:04:08 rin Exp $"); #include <sys/types.h> #if defined(DIAGNOSTIC)||defined(DEBUG) @@ -182,9 +182,10 @@ fpu_div(struct fpemu *fe) DUMPFPN(FPE_REG, y); DPRINTF(FPE_REG, ("=>\n")); if (ISNAN(x) || ISNAN(y)) { - ORDER(x, y); if (ISSNAN(x) || ISSNAN(y)) fe->fe_cx |= FPSCR_VXSNAN; + if (ISNAN(x)) + y = x; DUMPFPN(FPE_REG, y); return (y); }