svn commit: r230193 - head/lib/libc/sparc64/fpu
David Schultz
das at FreeBSD.org
Mon Jan 16 04:09:46 UTC 2012
Author: das
Date: Mon Jan 16 04:09:45 2012
New Revision: 230193
URL: http://svn.freebsd.org/changeset/base/230193
Log:
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
Modified:
head/lib/libc/sparc64/fpu/fpu_emu.h
head/lib/libc/sparc64/fpu/fpu_mul.c
Modified: head/lib/libc/sparc64/fpu/fpu_emu.h
==============================================================================
--- head/lib/libc/sparc64/fpu/fpu_emu.h Mon Jan 16 04:09:17 2012 (r230192)
+++ head/lib/libc/sparc64/fpu/fpu_emu.h Mon Jan 16 04:09:45 2012 (r230193)
@@ -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
Modified: head/lib/libc/sparc64/fpu/fpu_mul.c
==============================================================================
--- head/lib/libc/sparc64/fpu/fpu_mul.c Mon Jan 16 04:09:17 2012 (r230192)
+++ head/lib/libc/sparc64/fpu/fpu_mul.c Mon Jan 16 04:09:45 2012 (r230193)
@@ -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));
More information about the svn-src-head
mailing list