From patchwork Sat May 8 01:47:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 432546 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp853259jao; Fri, 7 May 2021 19:12:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMPTF2q0ZJmMhu24eZKr/nyESMefjr6CYQprJVbxllYbiRsp+E18DjxtUC5oWv9y+yfjuu X-Received: by 2002:a5d:8c89:: with SMTP id g9mr10063723ion.27.1620439938003; Fri, 07 May 2021 19:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620439938; cv=none; d=google.com; s=arc-20160816; b=hxQluwoF6PSEbs+K3BTMEH7wS7vSXQiH9wf6TsQhM+1Wh2zoy4IH0b2bto3wnBjNi9 gpgK8HbDlg6+0WtuoLNH8IMO9YuR7lkjrSmdKPCmhY1mwFlx+oQAF0xdAjAJXB9UR2ud veuLE9ICFS2O7C5cvHPeaMhbRfSpXIftBfPJePuPiqzeoK1hK8Ov7EvRX8YVZs+evdqh aWwT35GuPRE9wg5IVWcvlpeTubRfgtvJzRAyTJ0Hwsj6EucU2fDXCRm/6Zg1mb1Clsso JkU6JfJiyGyt9BKwpi5qX9GcYz28bP4FrOn28ZAkFJsYis04UUUtUyx8jQsddxjEL4qQ aOog== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SKdfu6xWiwzxhHlapjrQcnT6V4WXORdkaCXE3ng4KsU=; b=nfxkdELOyQxauz6q6iJd3yBRbXhsagxXR0L7ZJOiNrSRHyReO9be8aTQD8QarQHacG 3snx94AS5+cMYPu9wJjOMMLIJ+8nMliZ8PbFhGo4O865FiMiCXC9xBgpCyIGxIfTqD/i jzN93T7Gbr5Fuw1+EUg0RNMjiDKdE0uYLNB96+lMfTk32ODSZgryoUB7C1omk6TCdKBk KX4zAr7rt5EbBQeHnsPKkae6/QWk/FuGoiwxoJlj8egBNdF9sbTk0/N0O1RXmHXkAslz dR8xhZRS5YKh1HUwl2D7uVmCwDMN1ZxEaLjcalSWlRZNIlu4IuTy4atK8VbMO+MG0QWK //dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xaWZXvI0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id e5si7676804jaq.6.2021.05.07.19.12.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 May 2021 19:12:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xaWZXvI0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:47378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfCS1-00033S-EP for patch@linaro.org; Fri, 07 May 2021 22:12:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfC56-0004JQ-1d for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:36 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:35682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfC4s-0003dX-SS for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:35 -0400 Received: by mail-pf1-x42e.google.com with SMTP id i13so9253099pfu.2 for ; Fri, 07 May 2021 18:48:22 -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 :mime-version:content-transfer-encoding; bh=SKdfu6xWiwzxhHlapjrQcnT6V4WXORdkaCXE3ng4KsU=; b=xaWZXvI0Qb2y1e2in0lYZTgCfsK5fYUHg4r9c19C2tQdm1HW4snsqBNrjGf3TwziAL Q2rAk0KVpFStZtTp3uz2fR1CrwQA7Ci4tsHba4wGBrlGgiEbUZeoLPyJUPl0to8N93PJ 9S4T4mexiByqUACurUMvx3f1k6lDsdfYZfmCZj4XAcq4Xl2as8yC7yrLPI5DwGxDSZOF mLsy29CW89s493IGmQCrOO+0ROAxviTBUL8Bcl8vaZ9yNP4XsMEvWsoCIvNbgYj2YBa6 6UqsFgR/LWdmCs+ofySzDUM/+mhPgcQ/Jnx66mHSDM4f5xHuNMB9TXoh2DMa1HwAFVw7 Dngg== 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:mime-version:content-transfer-encoding; bh=SKdfu6xWiwzxhHlapjrQcnT6V4WXORdkaCXE3ng4KsU=; b=YhviwqpN+ICHYDuGpIUomUBaRR8odIM3ZbWusZ4Fc2mDaE+e544j0UV7hwRFB95K4c PeJbIjnkl+g+jaf/n94wxM3iBhUludmRPW6TI6piwY2uk++ztdhjq43614DceraGi5K3 3QTZw7U671dBNHB+9Zm/pKzJYZwRFkZBGrlahFFrVogMRlcblnBOI/kMHS5oF4FSVUbC p8smIuc91vNRBLpeM675B6R7Xt8AN5U9aVVyTfbeFN+nyU4JoElIlbGvD3erHz7Ra0Ku r5IvRNIt8FzMxHxXWCYHTDmtpScpAYWnGp7k6DlXzAm09UnD5IwENX201kdjL8wfIvWn KEHg== X-Gm-Message-State: AOAM531mpBe86Wr6XPZOoW/NzQIdH/nCosqnbF+ph4h7RSvB2fOPOcty byw8W7lZIt4NxDA88fZNowOZVXoOkkHw8w== X-Received: by 2002:a62:84d2:0:b029:27c:bbd5:6c0d with SMTP id k201-20020a6284d20000b029027cbbd56c0dmr13109766pfd.32.1620438501357; Fri, 07 May 2021 18:48:21 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id t4sm5819681pfq.165.2021.05.07.18.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 18:48:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 27/72] softfloat: Convert float128_default_nan to parts Date: Fri, 7 May 2021 18:47:17 -0700 Message-Id: <20210508014802.892561-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210508014802.892561-1-richard.henderson@linaro.org> References: <20210508014802.892561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: alex.bennee@linaro.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- fpu/softfloat.c | 17 ++++------------- fpu/softfloat-specialize.c.inc | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) -- 2.25.1 Reviewed-by: Alex Bennée diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 073b80d502..6d5392aeab 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -705,7 +705,7 @@ static float128 float128_pack_raw(const FloatParts128 *p) #define PARTS_GENERIC_64_128(NAME, P) \ QEMU_GENERIC(P, (FloatParts128 *, parts128_##NAME), parts64_##NAME) -#define parts_default_nan parts64_default_nan +#define parts_default_nan(P, S) PARTS_GENERIC_64_128(default_nan, P)(P, S) #define parts_silence_nan(P, S) PARTS_GENERIC_64_128(silence_nan, P)(P, S) @@ -3836,20 +3836,11 @@ float64 float64_default_nan(float_status *status) float128 float128_default_nan(float_status *status) { - FloatParts64 p; - float128 r; + FloatParts128 p; parts_default_nan(&p, status); - /* Extrapolate from the choices made by parts_default_nan to fill - * in the quad-floating format. If the low bit is set, assume we - * want to set all non-snan bits. - */ - r.low = -(p.frac & 1); - r.high = p.frac >> (DECOMPOSED_BINARY_POINT - 48); - r.high |= UINT64_C(0x7FFF000000000000); - r.high |= (uint64_t)p.sign << 63; - - return r; + frac_shr(&p, float128_params.frac_shift); + return float128_pack_raw(&p); } bfloat16 bfloat16_default_nan(float_status *status) diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index d892016f0f..a0cf016b4f 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -172,6 +172,25 @@ static void parts64_default_nan(FloatParts64 *p, float_status *status) }; } +static void parts128_default_nan(FloatParts128 *p, float_status *status) +{ + /* + * Extrapolate from the choices made by parts64_default_nan to fill + * in the quad-floating format. If the low bit is set, assume we + * want to set all non-snan bits. + */ + FloatParts64 p64; + parts64_default_nan(&p64, status); + + *p = (FloatParts128) { + .cls = float_class_qnan, + .sign = p64.sign, + .exp = INT_MAX, + .frac_hi = p64.frac, + .frac_lo = -(p64.frac & 1) + }; +} + /*---------------------------------------------------------------------------- | Returns a quiet NaN from a signalling NaN for the deconstructed | floating-point parts.