From patchwork Fri May 11 00:43:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135449 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp247793lji; Thu, 10 May 2018 17:50:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpHP1CKJeZ2fVV7pbDu79vhgowTlf6nSfdRSlb7YdiY7X8CIEr+87F5oVJ3G7S82TwUyIOj X-Received: by 2002:aed:37a6:: with SMTP id j35-v6mr3489250qtb.323.1525999814684; Thu, 10 May 2018 17:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525999814; cv=none; d=google.com; s=arc-20160816; b=K22KkTgqQ01juuG8LN8sf8ipgLTDCzxz94SPxlvzLE8aawdwkjZ1QbvYmxBEXec8m8 EnmGySYW6azrOCNhn/imh5twc/ztUFXvDVC6cFCbCj7/wDf26dHsgAOvvN0Wjvh/5epr WouFOvKNHe6g8tYmNB3r6JZjC0V3fpWbS3Ywu6PFavJ9TrdWVcsra5QVLG/LWYpqONAb 5eO8oufjc5kaf6AETVvq6QDqZPpNlW3TY4iPNH4bZCx+8d1PXEnWZKVazGmMtJgd74HE ga5FFxoabH5CmGlHfg0GBsW9iVvMzlxBMpSHGTz82z9n24/amTRyCmbsSIE8MFRjVdFJ HF5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=lRf4yJ1cSXJuJwZa6kKK3WAqrniWqnrrAqqQnzy7Auw=; b=t5otgPpHEqkpGst5fb8ahknFj3IEnIGvEJ7ZvpqdrwZzMAK+sVt0wpDIwqsY/zyAQL ET3wZr1L4C3w8r84c8BegN84cHreRSO6YO0BM0JtRahz13QHgBZvBJ0U/IVHoA+usnLF ZZAulRzbxdMIxXAbp3W1UwA5F/j08iisyWlOk5vdfeAd4I6znEMJ8pRv3FZgb0ONb7n6 WyKqgyAXQKHdrGFCYZhebde46iLpZ1Zo6nJ3gRR1NxN55wT3WxX6Q7Gt5MilHJSh2uRo 8jiIkN0jvjopO/fHX3lp4nMDegP/S5PNwWgMxe1KMZ2A4mtUytvABOebdjzQHyvy5JdE VipA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Fprt7CFH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v3-v6si2069683qkl.237.2018.05.10.17.50.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 17:50:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Fprt7CFH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGwGE-0006d4-3k for patch@linaro.org; Thu, 10 May 2018 20:50:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGwAB-00079u-9C for qemu-devel@nongnu.org; Thu, 10 May 2018 20:44:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGwA8-0004pj-SO for qemu-devel@nongnu.org; Thu, 10 May 2018 20:43:57 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:45465) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGwA8-0004pN-Mn for qemu-devel@nongnu.org; Thu, 10 May 2018 20:43:56 -0400 Received: by mail-pl0-x244.google.com with SMTP id bi12-v6so2254001plb.12 for ; Thu, 10 May 2018 17:43:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lRf4yJ1cSXJuJwZa6kKK3WAqrniWqnrrAqqQnzy7Auw=; b=Fprt7CFHjKM9bhr9BzuWlkVebDj5t/FXN9n3DnZJOSHYmXy7K5ORsYi7WbJzNql9Qf hnsEademRDA0e3hZ6sqTIqwtaZZtc1qxwiL2buDGGj38D28mpEte+yxgODK7yzqTIKMh 95PqMtcm2RjUgQJQf4U+ajHU134HSkd8Cnbu0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lRf4yJ1cSXJuJwZa6kKK3WAqrniWqnrrAqqQnzy7Auw=; b=fKs7tzouIaGGKvctQ4+c2Ur63KFSNrgHqG2xz62wIkPYSsHhmhkPRnA7P28wwmA684 IZ/Rd3fhiENwFFAqZELVBMo+OhhGD9h1k+aiGGPDABiQnkEKWwh5Pe5ihfqx3lNuGQPK HyheWpXXSm2IppQ8ZSXV96QrPvUbQZVvAJOTKi3Kfmy/vobxDKR/5ksxFnqQFtv/NvPJ heVjXUxAO2nz6SLc9XySz+jQqTAEecDqKNgb+LnPK22UGgR4Tmip2nrUpMwNDuLQsbs+ /U17tOUlaXHU+D723K1CFn2+y0lEDHkplwePDfu58dEAtfvM6RVzTMxXoe7XoO11ZnDh UxMA== X-Gm-Message-State: ALKqPwfnO/1S9S71MNworwMvk6e6Oi8Phot90biOV+HeOWu1TKldvBVI FvoreMZtI/HUqGLNmkg4pxDitfh2pRs= X-Received: by 2002:a17:902:7896:: with SMTP id q22-v6mr3382409pll.243.1525999435178; Thu, 10 May 2018 17:43:55 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id y24-v6sm4216728pfn.23.2018.05.10.17.43.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 17:43:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 17:43:31 -0700 Message-Id: <20180511004345.26708-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511004345.26708-1-richard.henderson@linaro.org> References: <20180511004345.26708-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::244 Subject: [Qemu-devel] [PATCH 05/19] fpu/softfloat: Introduce parts_is_snan_frac X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- fpu/softfloat-specialize.h | 15 +++++++++++++++ fpu/softfloat.c | 12 ++---------- 2 files changed, 17 insertions(+), 10 deletions(-) -- 2.17.0 diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index b59356f6a5..82d7a030e7 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -86,6 +86,21 @@ this code that are retained. #define NO_SIGNALING_NANS 1 #endif +/*---------------------------------------------------------------------------- +| For the deconstructed floating-point with fraction FRAC, return true +| if the fraction represents a signalling NaN; otherwise false. +*----------------------------------------------------------------------------*/ + +static bool parts_is_snan_frac(uint64_t frac, float_status *status) +{ +#ifdef NO_SIGNALING_NANS + return false; +#else + flag msb = extract64(frac, DECOMPOSED_BINARY_POINT - 1, 1); + return msb == status->snan_bit_is_one; +#endif +} + /*---------------------------------------------------------------------------- | The pattern for a default generated half-precision NaN. *----------------------------------------------------------------------------*/ diff --git a/fpu/softfloat.c b/fpu/softfloat.c index df377b6314..6dfc992a7f 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -330,16 +330,8 @@ static FloatParts canonicalize(FloatParts part, const FloatFmt *parm, part.cls = float_class_inf; } else { part.frac <<= parm->frac_shift; -#ifdef NO_SIGNALING_NANS - part.cls = float_class_qnan; -#else - int64_t msb = part.frac << 2; - if ((msb < 0) == status->snan_bit_is_one) { - part.cls = float_class_snan; - } else { - part.cls = float_class_qnan; - } -#endif + part.cls = (parts_is_snan_frac(part.frac, status) + ? float_class_snan : float_class_qnan); } } else if (part.exp == 0) { if (likely(part.frac == 0)) {