Date: Mon, 16 Jan 2012 04:09:46 +0000 (UTC) From: David Schultz <das@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r230193 - head/lib/libc/sparc64/fpu Message-ID: <201201160409.q0G49kHt014841@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201160409.q0G49kHt014841>