Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 2019 03:54:31 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345829 - head/sys/powerpc/fpu
Message-ID:  <201904030354.x333sVS1035041@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Wed Apr  3 03:54:30 2019
New Revision: 345829
URL: https://svnweb.freebsd.org/changeset/base/345829

Log:
  powerpc: Apply r178139 from sparc64 to powerpc's fpu_sqrt
  
  This fix was committed less than 2 months after the code was forked into the
  powerpc kernel.  Though powerpc doesn't use quad-precision floating point,
  or need it for emulation, the changes do look like correctness fixes
  overall.
  
  This was found while trying to get fsqrt emulation working on e5500, which
  does have a real FPU, but lacks the fsqrt instruction.  This is not the
  complete fix, the rest is to be committed separately.
  
  MFC after:	1 week

Modified:
  head/sys/powerpc/fpu/fpu_sqrt.c

Modified: head/sys/powerpc/fpu/fpu_sqrt.c
==============================================================================
--- head/sys/powerpc/fpu/fpu_sqrt.c	Wed Apr  3 03:50:16 2019	(r345828)
+++ head/sys/powerpc/fpu/fpu_sqrt.c	Wed Apr  3 03:54:30 2019	(r345829)
@@ -353,7 +353,7 @@ fpu_sqrt(struct fpemu *fe)
 	FPU_SUBC(d0, x0, t0);
 	if ((int)d0 >= 0) {
 		x0 = d0, x1 = d1, x2 = d2;
-		q |= bit;
+		q = bit;
 		y1 |= 1;		/* now t1, y1 are set in concrete */
 	}
 	ODD_DOUBLE;
@@ -385,12 +385,12 @@ fpu_sqrt(struct fpemu *fe)
 	FPU_SUBCS(d2, x2, t2);
 	FPU_SUBCS(d1, x1, t1);
 	FPU_SUBC(d0, x0, t0);
-	ODD_DOUBLE;
 	if ((int)d0 >= 0) {
-		x0 = d0, x1 = d1, x2 = d2;
-		q |= bit;
+		x0 = d0, x1 = d1, x2 = d2; x3 = d3;
+		q = bit;
 		y2 |= 1;
 	}
+	ODD_DOUBLE;
 	while ((bit >>= 1) != 0) {
 		EVEN_DOUBLE;
 		t3 = y3 | bit;
@@ -399,7 +399,7 @@ fpu_sqrt(struct fpemu *fe)
 		FPU_SUBCS(d1, x1, t1);
 		FPU_SUBC(d0, x0, t0);
 		if ((int)d0 >= 0) {
-			x0 = d0, x1 = d1, x2 = d2;
+			x0 = d0, x1 = d1, x2 = d2; x3 = d3;
 			q |= bit;
 			y3 |= bit << 1;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904030354.x333sVS1035041>