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
This commit is contained in:
Justin Hibbits 2019-04-03 03:54:30 +00:00
parent 1406895958
commit 81dd9c5e69
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345829

View file

@ -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;
}