From nobody Tue Feb 10 00:23:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1566373694; cv=none; d=zoho.com; s=zohoarc; b=TxewrM9pR5VaoZML+uk6o1PofzCZ72JIIBRiQfOX4X2TPeswSHBFESoimCmptb0cip3TPRGMPdEEyuP9q5srd+l3+86dQpXGbcP8Y45c/2NPi7fww1voKWPFnN+KiFPP7w4LIMW2+knm7T5xsayP4ISLdZoWA42j3MYh9lTAKf8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566373694; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1UTLybSSsFRhI5ID/F0byoAb8rrC6EdZgGxriSo4OBM=; b=SXeWLA/64ftcx4uQ8Hc8sd8bJtYmCe2e7T24LTygU9NZBy/6nEZoysd28iuuZq/o8+9mXdLPeHsrR99Hh5+oDrdh95L6PxaXVyfb6SZyZFO7kmPxWNtyiRTW7hNZygLL/k2D5BlwtM8E5SHFw0Do/FCD1afenhySrzyArroL8aY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566373694263194.33330661746265; Wed, 21 Aug 2019 00:48:14 -0700 (PDT) Received: from localhost ([::1]:44632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0LLm-0005EO-Lm for importer@patchew.org; Wed, 21 Aug 2019 03:48:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0L1F-0005dT-2R for qemu-devel@nongnu.org; Wed, 21 Aug 2019 03:26:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0L1D-0000HU-Ou for qemu-devel@nongnu.org; Wed, 21 Aug 2019 03:26:56 -0400 Received: from ozlabs.org ([203.11.71.1]:41471) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0L1D-0000FX-DV; Wed, 21 Aug 2019 03:26:55 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 46CzjH563Yz9sRJ; Wed, 21 Aug 2019 17:25:52 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1566372355; bh=LBLOm9mkU3pspBTmFyXrCZgMP0BWYNROIiCcVmX9xdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Onds5MDIWLIR+JZjWNuPMM2aZVmrb9DaNjvWQ6husp3AfaCXb9rXwgugzfVwD33gK pJTrUnlkjGsFzbCb6xkuKL612g7g5x2NwEIN7fWY/75X3CHYHmKsaMXrj8X/ciFy+a +mZPIekN3jgxvbhdShG9ohuegXNfNfxArbejVRMA= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 21 Aug 2019 17:25:41 +1000 Message-Id: <20190821072542.23090-42-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190821072542.23090-1-david@gibson.dropbear.id.au> References: <20190821072542.23090-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 41/42] ppc: Fix emulated INFINITY and NAN conversions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, aik@ozlabs.ru, Richard Henderson , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, "Paul A. Clarke" , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: "Paul A. Clarke" helper_todouble() was not properly converting INFINITY from 32 bit float to 64 bit double. (Normalized operand conversion is unchanged, other than indentation.) Signed-off-by: Paul A. Clarke Message-Id: <1566242388-9244-1-git-send-email-pc@us.ibm.com> Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 23b9c97439..52bcda27a6 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -58,10 +58,17 @@ uint64_t helper_todouble(uint32_t arg) uint64_t ret; =20 if (likely(abs_arg >=3D 0x00800000)) { - /* Normalized operand, or Inf, or NaN. */ - ret =3D (uint64_t)extract32(arg, 30, 2) << 62; - ret |=3D ((extract32(arg, 30, 1) ^ 1) * (uint64_t)7) << 59; - ret |=3D (uint64_t)extract32(arg, 0, 30) << 29; + if (unlikely(extract32(arg, 23, 8) =3D=3D 0xff)) { + /* Inf or NAN. */ + ret =3D (uint64_t)extract32(arg, 31, 1) << 63; + ret |=3D (uint64_t)0x7ff << 52; + ret |=3D (uint64_t)extract32(arg, 0, 23) << 29; + } else { + /* Normalized operand. */ + ret =3D (uint64_t)extract32(arg, 30, 2) << 62; + ret |=3D ((extract32(arg, 30, 1) ^ 1) * (uint64_t)7) << 59; + ret |=3D (uint64_t)extract32(arg, 0, 30) << 29; + } } else { /* Zero or Denormalized operand. */ ret =3D (uint64_t)extract32(arg, 31, 1) << 63; --=20 2.21.0