From patchwork Tue May 25 15:07:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 447322 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4436485jac; Tue, 25 May 2021 09:38:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCyyq2s6RFJlZUpq89ugNUrz+8/9YWMP1oO07MB02FENCa63PKTb/Ah7EgzjhzggrCaQOi X-Received: by 2002:a17:907:20a7:: with SMTP id pw7mr29983071ejb.39.1621960703143; Tue, 25 May 2021 09:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621960703; cv=none; d=google.com; s=arc-20160816; b=DXINUReuiKVwwLwHrp3Gp0ZJa4GzIx6GX+MeVNd6zbHXUbTnTW/u8G93BOFQqXE5AL mwxFgf0YDbeGQJ7criZEpBwciXc4WtmDoYnQZy0fhtQlDDG0dg+0jKEkN8tgDFq/FB1Q 0Huy24jOAdu6rifmG397G3OrMgMSGt16zl6vFBw2UPJQxP4JT7AsYstocYevh7W89jaE IOKOgff9c8TEs8BfqED2OXfCi4YsYOJsRMx7R8gTrK/nn0/Q2GIfAJ+ogYk9yxkSQKRe 0r8vRXPgvQBjrNkQviPcfHCfIhJiFL/8x4LkwyS2czHJPnjsRUd2G7WwPdpwYNzWSSUQ Z7jw== 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=2avWxXahubZ/o5oT70KgFRqpsBXSFNH/Xke7KM6cuMA=; b=wDWVLOIiJnUpudhuNLeN2oq0RBuauxp7JI5dr0tBq/DoIhkOjEiT7izQ/YSOMid8uw u6Ur/x/JJ3U+7110Ie+wD0odOzPQrA2LMCIxPxwFieqpOa/241y+JSkJ2XevWU2bMlO9 DKPWBl3ASKmwKzhAaxP5f/d5J27Xi04dVa7fs2z1scE/iY7T7E3AhmQmW0Gp0aKKKUEO mbG3/tM++6tPRaHXMfkdM2J/6pcJBxTaMYJGlkHPycAcqEkJf0n2lQco0cGW24diNc/I i5ekbvWxXC0TCbZbEcLXNKhWM/rlzshbqf1mIMhMeNbpnvieEhv2MK8gBkEyapbXN+Z/ rnFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Em9r4PRl; 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=pass (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 x17si15513506edr.496.2021.05.25.09.38.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 09:38:23 -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=pass header.i=@linaro.org header.s=google header.b=Em9r4PRl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lla4U-0000K8-58 for patch@linaro.org; Tue, 25 May 2021 12:38:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llYeh-0001zs-9q for qemu-devel@nongnu.org; Tue, 25 May 2021 11:07:39 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:36532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llYeQ-0006kx-WC for qemu-devel@nongnu.org; Tue, 25 May 2021 11:07:38 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 27so21669979pgy.3 for ; Tue, 25 May 2021 08:07: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=2avWxXahubZ/o5oT70KgFRqpsBXSFNH/Xke7KM6cuMA=; b=Em9r4PRlDFRSDkqXeXPAwGjl2ne5ZDxYhGOCvwdesdsoZLz40VrS4/qpMTaTR7D28T zvb5x/UmhiUdxmJW/tD6Lmy4to6NLI7FJz2e6aYagZTj5zvWESzG/om2aR2BxWFMwr7A VLZMIue2VNiVGFklFwkTr3+TLW9SbEMBGRsGtJnGS4qLR2gDKkQZ4VZHYag01rJM5mJh UxOsx9ql05D+PIMbQH5BDVvG0O9uSIjycSqWrjjojfS/o5nVFVVwyyHmGeaWlBXlkcPa yKztmPls4bApMkNmNu5uhVDQvSZTIhL6TDsWaSDkRrVd3K76uwcSaxXL4ufEDILpg7Y8 j0IA== 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=2avWxXahubZ/o5oT70KgFRqpsBXSFNH/Xke7KM6cuMA=; b=KiFF3KTqGepo1nhr7YkrHvCaJaXfnvO4RR6krMJS9EgyhMA1zrXcbTinnCtx2nIG67 s5VKkpqGu49XGTWszStU9/yFjEGzdwmESd7GPvt7YEYmBOuMTLAYA3J112Vt/aLsTtUI UDwL2t2heCdrP47izOOEYir/4Zo25NhLU6VSe4F9s2ot1X4qNElMyHrtjoC4Enea68NX NrCwt9P40apccDFsz7OgILQqH89MhMedokf993bDvBR3rE7mKKs/7O/5f7DjZHPFEo3p OGROTnbbw/V6wugL+L1Ai5rYoQ1uxa4n+obdgf/fa4kXKTqIli0ZeLdGn44d8LJyEbIQ pysQ== X-Gm-Message-State: AOAM532ebBJ8Z1uqZdPTo9US9OG3F1fGm9vVYrw4YgkE9O23J5Fqba6m 9x8G8GS5HkIHqzCwlkTN6D4OeO/tLKSQWQ== X-Received: by 2002:a63:1953:: with SMTP id 19mr19377649pgz.273.1621955241568; Tue, 25 May 2021 08:07:21 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id z19sm2231943pjq.11.2021.05.25.08.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 08:07:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 22/28] softfloat: Convert floatx80_scalbn to FloatParts Date: Tue, 25 May 2021 08:07:00 -0700 Message-Id: <20210525150706.294968-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525150706.294968-1-richard.henderson@linaro.org> References: <20210525150706.294968-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 | 50 +++++++++++-------------------------------------- 1 file changed, 11 insertions(+), 39 deletions(-) -- 2.25.1 Reviewed-by: Alex Bennée diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 52a9aa1837..0d1d9df70d 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -3914,6 +3914,17 @@ float128 float128_scalbn(float128 a, int n, float_status *status) return float128_round_pack_canonical(&p, status); } +floatx80 floatx80_scalbn(floatx80 a, int n, float_status *status) +{ + FloatParts128 p; + + if (!floatx80_unpack_canonical(&p, a, status)) { + return floatx80_default_nan(status); + } + parts_scalbn(&p, n, status); + return floatx80_round_pack_canonical(&p, status); +} + /* * Square Root */ @@ -5748,45 +5759,6 @@ FloatRelation floatx80_compare_quiet(floatx80 a, floatx80 b, return floatx80_compare_internal(a, b, 1, status); } -floatx80 floatx80_scalbn(floatx80 a, int n, float_status *status) -{ - bool aSign; - int32_t aExp; - uint64_t aSig; - - if (floatx80_invalid_encoding(a)) { - float_raise(float_flag_invalid, status); - return floatx80_default_nan(status); - } - aSig = extractFloatx80Frac( a ); - aExp = extractFloatx80Exp( a ); - aSign = extractFloatx80Sign( a ); - - if ( aExp == 0x7FFF ) { - if ( aSig<<1 ) { - return propagateFloatx80NaN(a, a, status); - } - return a; - } - - if (aExp == 0) { - if (aSig == 0) { - return a; - } - aExp++; - } - - if (n > 0x10000) { - n = 0x10000; - } else if (n < -0x10000) { - n = -0x10000; - } - - aExp += n; - return normalizeRoundAndPackFloatx80(status->floatx80_rounding_precision, - aSign, aExp, aSig, 0, status); -} - static void __attribute__((constructor)) softfloat_init(void) { union_float64 ua, ub, uc, ur;