From patchwork Mon Jan 21 21:32:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 214278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5FC3C2C0080 for ; Tue, 22 Jan 2013 08:32:55 +1100 (EST) Received: from localhost ([::1]:47035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxOz7-0001vo-FK for incoming@patchwork.ozlabs.org; Mon, 21 Jan 2013 16:32:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxOyz-0001vG-8y for qemu-devel@nongnu.org; Mon, 21 Jan 2013 16:32:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxOyw-0007VT-Ab for qemu-devel@nongnu.org; Mon, 21 Jan 2013 16:32:45 -0500 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:51533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxOyw-0007VF-41 for qemu-devel@nongnu.org; Mon, 21 Jan 2013 16:32:42 -0500 Received: by mail-wg0-f41.google.com with SMTP id ds1so1342071wgb.0 for ; Mon, 21 Jan 2013 13:32:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version:content-type; bh=fWTFcbCO9QWC0asTv8D2Dw9H/9wqZhZ0u7fx7Tw2vw8=; b=Ms+zhckb9z+CkYPYSVNgdJpTA1pGIGaOCimeJpvZ/i5Qzj8jzMs2JKNO/1yVlVcyG7 aHgiDTqz0ThqjDAAhtvIJL1/EpVbhGQYnPiWxxotEWjwn7M9yIHMXuJL1SjzNiO+jatv 9R0xt7NbYauZgi7eWiy5puBrOEQlvZfGSsHGfErCyAtcQFsQRKz1miulkmVwbam8T/cL uLk4D1qInwiFONgyMFzl+UX/W0zF/Rrc3v4c8TIGMt0JrmJwEvyMhbRXzX3DhofDLejF O9Q2kshWk2P21nlSZg9mcPyJ042klzRZLw3E9JcjOEZSV6vTosuXepQbOH5Le3P5h2D1 SdxQ== X-Received: by 10.194.238.226 with SMTP id vn2mr28585922wjc.23.1358803960423; Mon, 21 Jan 2013 13:32:40 -0800 (PST) Received: from localhost ([2.26.205.107]) by mx.google.com with ESMTPS id eo10sm20638192wib.9.2013.01.21.13.32.38 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 21 Jan 2013 13:32:39 -0800 (PST) From: Richard Sandiford To: qemu-devel@nongnu.org Mail-Followup-To: qemu-devel@nongnu.org, rdsandiford@googlemail.com Date: Mon, 21 Jan 2013 21:32:37 +0000 Message-ID: <87ehhekyru.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::229 Subject: [Qemu-devel] [PATCH] softfloat: Handle float_muladd_negate_c when product is zero X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Honour float_muladd_negate_c in the case where the product is zero and c is nonzero. Previously we would fail to negate c. Seen in (and tested against) the gfortran testsuite on MIPS. Signed-off-by: Richard Sandiford --- fpu/softfloat.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index ac3d150..0028415 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -2234,6 +2234,9 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM) } } /* Zero plus something non-zero : just return the something */ + if (flags & float_muladd_negate_c) { + signflip ^= 1; + } return make_float32(float32_val(c) ^ (signflip << 31)); } @@ -3787,6 +3790,9 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM) } } /* Zero plus something non-zero : just return the something */ + if (flags & float_muladd_negate_c) { + signflip ^= 1; + } return make_float64(float64_val(c) ^ ((uint64_t)signflip << 63)); }