From patchwork Sat May 8 01:47:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 432581 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp866014jao; Fri, 7 May 2021 19:37:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUi1UPD5k+hv74fqrcEz78svND+RhJ7NCk48qAu/BRpeNSkG91nAR58feYmCi4OC8OC7BK X-Received: by 2002:a02:2a8c:: with SMTP id w134mr11457391jaw.138.1620441465566; Fri, 07 May 2021 19:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620441465; cv=none; d=google.com; s=arc-20160816; b=OEgPxfLtVjMJiLsNTboT68wmf6fF20P7LN7mwGB6zuM4bpsNGDYZTnh/RBSpubZDLP 8ogj3SpZnRQHT/uJD/ZaPNOpOaTUhF1GlXkAl64OS6F2JsV90Gb0kNthlk9mmtj64O5F /9CfxW89krtcwgZA2WCP3xRx4KeNsBqRgtCnpYi5W6kZd0tkysBvK6dA5M/S+F41Tpz0 aO292GT/uWrAFmj53nnUiO9tpfH852ob/LKmH5SmlzWeyPfn3/OfkTo2snDiqvk1T667 xHUnD/ZzUUgu9O+72+b7xfWYjMR0aA2kUYSfce3L6t/wfuadD4rElExHra+64I29pR5B DhaQ== 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=zL439EHx3BPOhexd35s+Xkdi6C28utf2wKmRbPR2CBI=; b=hf55KPOW+qdFUuZkVoJtofbr5bMafhocTpQhcFLKpG9IMYoGFOFsvd9XBzCWYkCy/A u+M8w+UUtC8XmTQqtJ4MwNVo5Sk0A/xir0ui9mGMDe6WXtgUHQu2ZGV3JdkoACNsWFsc m7OFBXJ1V17gqCLla56e/pzl9N8auXu7AExO3GBOWwGhD13fUUFt6ucmAqIQ2jQQZ+h4 egtzR+1wVNUL7xgtHoQOJ1+MCWwA18cFgBKRhBfdTuAz3R7zKZG6d6wqWs7fgC9zrrLe DAI2KMS/9civAs14zo7HPiNWtOWo+WsKsXciGpvYVLJfnu1Uz9/xKVfoi/DkgiWvR48J 3LTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Xey1+YXB; 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 g1si9248439ila.101.2021.05.07.19.37.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 May 2021 19:37:45 -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=Xey1+YXB; 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]:39614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfCqe-00040s-VT for patch@linaro.org; Fri, 07 May 2021 22:37:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfC86-00039V-70 for qemu-devel@nongnu.org; Fri, 07 May 2021 21:51:42 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:44903) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfC84-0005VH-D5 for qemu-devel@nongnu.org; Fri, 07 May 2021 21:51:41 -0400 Received: by mail-pg1-x535.google.com with SMTP id y32so8617369pga.11 for ; Fri, 07 May 2021 18:51:39 -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=zL439EHx3BPOhexd35s+Xkdi6C28utf2wKmRbPR2CBI=; b=Xey1+YXBlzvQ+XRKDOTSi4J19G9eWajaJyQTd4PukhpSnIX9gaxXRNme2bKqp7za1o CAEcAZ5ihkqzT/CwcSjMNGMM2STzyNwO2cuUsrk3ln+peKvBum3Mx7xt0yNEC2uIgRYw 49cptIz+sBVEcVj5nGjTV4+4EItUWu5qhRmVCxPAJDd931TmowV5OA8CYEcD90vjbAGZ pdWu+56H44gIspc0AMnkkc9HC2NEFB+Fabv/wloG42kDTJh/u4f2gy04q2M0mgdEqurU Sla3L64Boa/gdK9YgNpwo1yNjYVpe6G11ge20RA42/EG/x3iork8waEeNDqah3O9lINq B+aw== 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=zL439EHx3BPOhexd35s+Xkdi6C28utf2wKmRbPR2CBI=; b=qOVgiHUfxbNQabcHBxFG5JEZlkGtQ017CmfM/3rNYMk5pc14U/gCa23ZKw2F61jF0n qYIQRwKPJalxyIiAXW2rgQ/TnGrm6CkRoc3BzSyl6T0/U9Mo27QPnVeKbm1Y+HyadG4H 6pGV5mg9dpNrIfC44AxXdl/gnVDISVzRQHrHytSxMKWlil8dHaQuWS1p5rRn+doKrMJq tDMHGv7z822y2zOPURhM9lbKdW+cPlp4Af15JaAEpysv3kru8OSdvUNBiUvB7N6yFzbX 5R77UutSViOOZ60dNhLqEStLjMoNIFp9rOdolUMbfqUCo34P3yGHWY6HLmwjDR//vsXJ ylhw== X-Gm-Message-State: AOAM533SWh6a6iL2/xYG/j7o3Hko+EUdy7j+t54mGaelGtSW0vrN5lx8 Ho0ZhDlR1uWdyasMWK3zrbTa49oXle37EQ== X-Received: by 2002:aa7:9104:0:b029:279:e897:2825 with SMTP id 4-20020aa791040000b0290279e8972825mr13447797pfh.51.1620438699041; Fri, 07 May 2021 18:51:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id 204sm5861396pfw.158.2021.05.07.18.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 18:51:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 54/72] softfloat: Split out parts_uncanon_normal Date: Fri, 7 May 2021 18:47:44 -0700 Message-Id: <20210508014802.892561-55-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::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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" We will need to treat the non-normal cases of floatx80 specially, so split out the normal case that we can reuse. Signed-off-by: Richard Henderson --- fpu/softfloat.c | 8 ++++++ fpu/softfloat-parts.c.inc | 56 ++++++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 25 deletions(-) -- 2.25.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 75a3bb881d..4df69029ec 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -763,6 +763,14 @@ static void parts128_canonicalize(FloatParts128 *p, float_status *status, #define parts_canonicalize(A, S, F) \ PARTS_GENERIC_64_128(canonicalize, A)(A, S, F) +static void parts64_uncanon_normal(FloatParts64 *p, float_status *status, + const FloatFmt *fmt); +static void parts128_uncanon_normal(FloatParts128 *p, float_status *status, + const FloatFmt *fmt); + +#define parts_uncanon_normal(A, S, F) \ + PARTS_GENERIC_64_128(uncanon_normal, A)(A, S, F) + static void parts64_uncanon(FloatParts64 *p, float_status *status, const FloatFmt *fmt); static void parts128_uncanon(FloatParts128 *p, float_status *status, diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 293029711c..65462bf6cb 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -140,8 +140,8 @@ static void partsN(canonicalize)(FloatPartsN *p, float_status *status, * fraction; these bits will be removed. The exponent will be biased * by EXP_BIAS and must be bounded by [EXP_MAX-1, 0]. */ -static void partsN(uncanon)(FloatPartsN *p, float_status *s, - const FloatFmt *fmt) +static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s, + const FloatFmt *fmt) { const int exp_max = fmt->exp_max; const int frac_shift = fmt->frac_shift; @@ -153,29 +153,6 @@ static void partsN(uncanon)(FloatPartsN *p, float_status *s, bool overflow_norm; int exp, flags = 0; - if (unlikely(p->cls != float_class_normal)) { - switch (p->cls) { - case float_class_zero: - p->exp = 0; - frac_clear(p); - return; - case float_class_inf: - g_assert(!fmt->arm_althp); - p->exp = fmt->exp_max; - frac_clear(p); - return; - case float_class_qnan: - case float_class_snan: - g_assert(!fmt->arm_althp); - p->exp = fmt->exp_max; - frac_shr(p, fmt->frac_shift); - return; - default: - break; - } - g_assert_not_reached(); - } - switch (s->float_rounding_mode) { case float_round_nearest_even: overflow_norm = false; @@ -282,6 +259,35 @@ static void partsN(uncanon)(FloatPartsN *p, float_status *s, float_raise(flags, s); } +static void partsN(uncanon)(FloatPartsN *p, float_status *s, + const FloatFmt *fmt) +{ + if (likely(p->cls == float_class_normal)) { + parts_uncanon_normal(p, s, fmt); + } else { + switch (p->cls) { + case float_class_zero: + p->exp = 0; + frac_clear(p); + return; + case float_class_inf: + g_assert(!fmt->arm_althp); + p->exp = fmt->exp_max; + frac_clear(p); + return; + case float_class_qnan: + case float_class_snan: + g_assert(!fmt->arm_althp); + p->exp = fmt->exp_max; + frac_shr(p, fmt->frac_shift); + return; + default: + break; + } + g_assert_not_reached(); + } +} + /* * Returns the result of adding or subtracting the values of the * floating-point values `a' and `b'. The operation is performed