From owner-svn-src-all@FreeBSD.ORG Mon Jan 16 04:09:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82AA01065673; Mon, 16 Jan 2012 04:09:46 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DB098FC14; Mon, 16 Jan 2012 04:09:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0G49kdq014844; Mon, 16 Jan 2012 04:09:46 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0G49kHt014841; Mon, 16 Jan 2012 04:09:46 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201201160409.q0G49kHt014841@svn.freebsd.org> From: David Schultz Date: Mon, 16 Jan 2012 04:09:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230193 - head/lib/libc/sparc64/fpu X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2012 04:09:46 -0000 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));