Computations on NaNs are supposed to return one of the input NaNs unchanged.

Fix a few places in the sparc64 floating-point emulator where this wasn't
being handled properly.

Submitted by:	bde
This commit is contained in:
David Schultz 2012-01-16 04:09:45 +00:00
parent 7bde21b1f9
commit 8ff9d52cd0
2 changed files with 3 additions and 4 deletions

View File

@ -159,7 +159,8 @@ struct fpemu {
* Each of these may modify its inputs (f1,f2) and/or the temporary.
* Each returns a pointer to the result and/or sets exceptions.
*/
#define __fpu_sub(fe) ((fe)->fe_f2.fp_sign ^= 1, __fpu_add(fe))
#define __fpu_sub(fe) (ISNAN(&(fe)->fe_f2) ? 0 : ((fe)->fe_f2.fp_sign ^= 1), \
__fpu_add(fe))
#ifdef FPU_DEBUG
#define FPE_INSN 0x1

View File

@ -125,10 +125,8 @@ __fpu_mul(fe)
* The result is x * y (XOR sign, multiply bits, add exponents).
*/
ORDER(x, y);
if (ISNAN(y)) {
y->fp_sign ^= x->fp_sign;
if (ISNAN(y))
return (y);
}
if (ISINF(y)) {
if (ISZERO(x))
return (__fpu_newnan(fe));