From patchwork Sat May 8 01:47:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 432584 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp867443jao; Fri, 7 May 2021 19:40:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8L4DA3klQjUcOQHdYMl+/QgMg5935MF/UtsxfES/xQMaqJ8Snd454JWXjaLfBrovbmjiw X-Received: by 2002:a6b:7d4c:: with SMTP id d12mr9560749ioq.29.1620441614552; Fri, 07 May 2021 19:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620441614; cv=none; d=google.com; s=arc-20160816; b=immzbcCd8ROuupxCPep+HjhZUuJEQPSfjDuTvvnEKQNCKIcPW75vQTR0rHkzWElHMV GpNwfsBctuK4a87JBF3QHqPcYyj6K9T7r9JgUnOYX9B2nE6gKBhd2R+qPA20lW2tohAJ YtsfJqMxuDh8xUdTISvl7hCGMhxRHU+Fp1RBXNBF9/YXD3ybPWem9p5DMHh0nsKdZjkH OC3Gl5QqvYZVi1AAsvT3PCHTXD1Na3Ve7cjFiU3qRmxfsxU0xw164Wcmg2+WmeLfD1tX nm5ZgbkQgTuyMMiARTrIPeMNWIpYxWIIIHfQv6ah7YEFvnsX9MzFjcb1QX8y3ff1mbUA pvkg== 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=jj12YuLJHh6Oh0IVnZb6UWCqmTi7ol2b4RGLMuxGRMs=; b=Ygzaj39bAzRaHb8RsM6vySjIeReTANPz14NUVgJOhNNbaFmP5wfJ2kJ/wGTgsEkA9B weQBrFiGdlyjHZ7mM5Lx3M1ARLThRr3x0LX8wyBZxXH5+2YhajN1864i6wFoyv9it0TD hZFxjBM00Kp5pL8rQ7CuipjV5pp8+YAFCb0xh52khH6fWqv6q+mXDuWs3knwFmWLpSvs n3QNV8UfOqrshq3yWsSj3q0v3/nT/lml25n/d1OQinOQyt6VdiKd0SJHYKctudI/+hLp UTN7VCUCuy/SDpR6lWaZwoQzj0ESmZQeJX72p7g8PbarbZoXPeT24f5LomOaTUZMKkIO CBoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RycazAL0; 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 y10si4132986ill.98.2021.05.07.19.40.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 May 2021 19:40:14 -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=RycazAL0; 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]:48096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfCt3-0001Dl-Jp for patch@linaro.org; Fri, 07 May 2021 22:40:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfC8A-0003Oo-3b for qemu-devel@nongnu.org; Fri, 07 May 2021 21:51:47 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:45649) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfC88-0005Xp-A3 for qemu-devel@nongnu.org; Fri, 07 May 2021 21:51:45 -0400 Received: by mail-pj1-x1031.google.com with SMTP id gc22-20020a17090b3116b02901558435aec1so6554371pjb.4 for ; Fri, 07 May 2021 18:51:43 -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=jj12YuLJHh6Oh0IVnZb6UWCqmTi7ol2b4RGLMuxGRMs=; b=RycazAL0aOSpcA4WGriN2xv74sN+27JCubZHcifpriZC2ioJCPwuJFSHS4IKdrwyA0 /0H8/QX3CaLn2xFSpwOEhaYozuUXIqSom0/kb/HCRZJe4mIW3IIcwuEsj04bR4li2wEg JXQaHOayerofcomsKyZcVCcCr8Z+sJAtyNnpKtE5f2I06BL3GMWaAslPTks+IMnz9l9V KPDY46CUgAM3AxyXED13R1xlZLLO9pusFqALLb1VjSzhKYcIAzwGwpYLoK92GB9lS0JH H4PETKCDVl1P4v5Ap0OkJrDS9WIEKeqbOG+o+j2dNRhyAyeYeq84QynMPCAjOXwcesX4 tBUA== 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=jj12YuLJHh6Oh0IVnZb6UWCqmTi7ol2b4RGLMuxGRMs=; b=s7kk5OpDsN5RMsCxWleLr3ldqY5XDyvTkHS1IhAXmjs3WR5xuIejJ4A99f1Os4MESw aOojnUQ5n8Ed4/HHzfMEgBfeGmCvqpsY4AKMVbI6jKScQeKWLvnRQry5a8itZUPV4Gww c55VOdM3+6ak1JXt+82JpbbgW8qoXnHGATL9rccJYGVsQaRIKJTSyvI6I0ys+UR1d+Ge 0Zfb3so9wzu5JhbJ83eMlF6rJoEssdiR6PJcLDLv9XwpJ5Am/XotCbknvX2wiArYk7VK 2cGh3z3U9asa8Nb9s2TpZ0rgq2jn4BQE/nfHBjke0qmzwwYODM+pZPPlxCVZH0zJQBgK 53UA== X-Gm-Message-State: AOAM532wov9XRoR312Ifpa5BJ4MSNBkm2OhinlyCUYQxRo6lIoWqS97s +xiX6awdn8CdRdCXKsvaBOenIsWRIGlW3Q== X-Received: by 2002:a17:90a:cf10:: with SMTP id h16mr13534007pju.49.1620438702973; Fri, 07 May 2021 18:51:42 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id 204sm5861396pfw.158.2021.05.07.18.51.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 18:51:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 60/72] softfloat: Convert floatx80_mul to FloatParts Date: Fri, 7 May 2021 18:47:50 -0700 Message-Id: <20210508014802.892561-61-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::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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 | 76 +++++++++---------------------------------------- 1 file changed, 14 insertions(+), 62 deletions(-) -- 2.25.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 3c6751e4d0..4454219f8a 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1943,6 +1943,20 @@ float128_mul(float128 a, float128 b, float_status *status) return float128_round_pack_canonical(pr, status); } +floatx80 QEMU_FLATTEN +floatx80_mul(floatx80 a, floatx80 b, float_status *status) +{ + FloatParts128 pa, pb, *pr; + + if (!floatx80_unpack_canonical(&pa, a, status) || + !floatx80_unpack_canonical(&pb, b, status)) { + return floatx80_default_nan(status); + } + + pr = parts_mul(&pa, &pb, status); + return floatx80_round_pack_canonical(pr, status); +} + /* * Fused multiply-add */ @@ -5865,68 +5879,6 @@ floatx80 floatx80_round_to_int(floatx80 a, float_status *status) } -/*---------------------------------------------------------------------------- -| Returns the result of multiplying the extended double-precision floating- -| point values `a' and `b'. The operation is performed according to the -| IEC/IEEE Standard for Binary Floating-Point Arithmetic. -*----------------------------------------------------------------------------*/ - -floatx80 floatx80_mul(floatx80 a, floatx80 b, float_status *status) -{ - bool aSign, bSign, zSign; - int32_t aExp, bExp, zExp; - uint64_t aSig, bSig, zSig0, zSig1; - - if (floatx80_invalid_encoding(a) || floatx80_invalid_encoding(b)) { - float_raise(float_flag_invalid, status); - return floatx80_default_nan(status); - } - aSig = extractFloatx80Frac( a ); - aExp = extractFloatx80Exp( a ); - aSign = extractFloatx80Sign( a ); - bSig = extractFloatx80Frac( b ); - bExp = extractFloatx80Exp( b ); - bSign = extractFloatx80Sign( b ); - zSign = aSign ^ bSign; - if ( aExp == 0x7FFF ) { - if ( (uint64_t) ( aSig<<1 ) - || ( ( bExp == 0x7FFF ) && (uint64_t) ( bSig<<1 ) ) ) { - return propagateFloatx80NaN(a, b, status); - } - if ( ( bExp | bSig ) == 0 ) goto invalid; - return packFloatx80(zSign, floatx80_infinity_high, - floatx80_infinity_low); - } - if ( bExp == 0x7FFF ) { - if ((uint64_t)(bSig << 1)) { - return propagateFloatx80NaN(a, b, status); - } - if ( ( aExp | aSig ) == 0 ) { - invalid: - float_raise(float_flag_invalid, status); - return floatx80_default_nan(status); - } - return packFloatx80(zSign, floatx80_infinity_high, - floatx80_infinity_low); - } - if ( aExp == 0 ) { - if ( aSig == 0 ) return packFloatx80( zSign, 0, 0 ); - normalizeFloatx80Subnormal( aSig, &aExp, &aSig ); - } - if ( bExp == 0 ) { - if ( bSig == 0 ) return packFloatx80( zSign, 0, 0 ); - normalizeFloatx80Subnormal( bSig, &bExp, &bSig ); - } - zExp = aExp + bExp - 0x3FFE; - mul64To128( aSig, bSig, &zSig0, &zSig1 ); - if ( 0 < (int64_t) zSig0 ) { - shortShift128Left( zSig0, zSig1, 1, &zSig0, &zSig1 ); - --zExp; - } - return roundAndPackFloatx80(status->floatx80_rounding_precision, - zSign, zExp, zSig0, zSig1, status); -} - /*---------------------------------------------------------------------------- | Returns the result of dividing the extended double-precision floating-point | value `a' by the corresponding value `b'. The operation is performed