From patchwork Tue May 25 15:06:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 447300 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4420508jac; Tue, 25 May 2021 09:19:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzuX+CdmdAUv8YjCkVsmQZ2MEnzZox2PJ/kV5+BQ/TRsceXF3sAhf+C6PeqwwGz/KgJ6Qu X-Received: by 2002:a17:907:d02:: with SMTP id gn2mr20549247ejc.207.1621959565706; Tue, 25 May 2021 09:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621959565; cv=none; d=google.com; s=arc-20160816; b=Qw/Lwe/8sVpmLJqfbIUlqQlNoGN4r1c6CxU65L4BIHGRWNHXCV1BscG+mmGGoM4H4k VNrSBcxHHGG4xItXD0ITi0HQq643xnQEYGtRF3s/n+4Kmyn8oiVTUt7Je1OHn52Tt4kg 6jtmSWK04oA4EDZ5WGHO0FGNAeJqUH3ZoWmoCGz5SmCAVdc4+2jpkNATgixQ2nK7Vh09 zCWW1JymIXa8zi2a3N6DtnjsARFVcxqQG6nKyYpVRTjW5uZ7bAc9cJcfOGevUPdZApR+ E68lXE3tLXsSdHTTnGJA9yaNy9dmqg3xKYGkn7Lq6q/QLTyu/ftx1wU/rhFmKVnloizB +guw== 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=8jY2SfyYuHl84ybtoNE2cXZQw+chD95nctKoUYm9stI=; b=lu55oGPobGoLRwkxjrBQU4S2/fWPHEqUXLdIl475K5qV1el6LCF+YH5vM07LvfSOja ggNlFseeMO1OM0XKvuT5M0trM3y37AV9j7CjcPWwMPulhbYlcTqssHVBDZd4WhCtFk1g 5t+V8Z4InwtQKsA3xP2o8xiOrb7B5dLf++1fm4IdrmHZ15VFcA0Nn2xXPorkm/6CowW4 0fQ9l8caLusuBB5RgUBUa6vU1RkJKUawlOEMqMzd8Kwz4lfufx60YqW55kaEWsm/zXfw 63sUQnLAJZv4HI1OCo43bHpagy/BJnzIsja8y9ed33dIV+StOC76fEIMS5UUKGFL3RdZ fxww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bQUqS0vO; 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 hr17si2120930ejc.232.2021.05.25.09.19.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 09:19:25 -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=bQUqS0vO; 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]:58246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llZm8-0003W4-It for patch@linaro.org; Tue, 25 May 2021 12:19:24 -0400 Received: from [2001:470:142:3::10] (port=60600 helo=eggs.gnu.org) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llYem-0002Bw-Mm for qemu-devel@nongnu.org; Tue, 25 May 2021 11:07:45 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:52803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llYeQ-0006jx-3u for qemu-devel@nongnu.org; Tue, 25 May 2021 11:07:40 -0400 Received: by mail-pj1-x102b.google.com with SMTP id q6so17013777pjj.2 for ; Tue, 25 May 2021 08:07:21 -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=8jY2SfyYuHl84ybtoNE2cXZQw+chD95nctKoUYm9stI=; b=bQUqS0vOqDw3/LR9evNJ6tnnltvDc3sAkbLafYw8eF1qKCOi15miBhJ+oOj60fUyG2 MM8oiwniIG0jW7PtRMXJ10dsxaepCMyR1XpPYa2JLoD//UJToOrBpMdBdrChGefcE5cw nAIImZXlWbOUKBe42SAOIF9TPQG6o693NFZQjoAUIco/+/czYXTjbKJfYEpjqbAw+Ju+ uUQij3hCQH6UvKemxKTyU4vwfDnulXC/EK6SIPwB6tpLhNTXO3zyrJ2vbRjlOj4tV4Ew uOC2ES+1/XrDrYUDY951Xc7zDz51sqM7MLj+02lfxOS96Z8f9K8fBKETsyt1cedyUHaE rDrw== 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=8jY2SfyYuHl84ybtoNE2cXZQw+chD95nctKoUYm9stI=; b=umI2AhSkzloaueW9Ju7f1ASCO2XhsJBtiSxYCSRZnGD606tCISDMAIpqv0cQTwNT09 QHEFC8cmH9HyMCPzYZFFVjyPvxH2sGx5cQffe1fK6nfVsh1hAl3Ble5zLjlmuNpKTsu4 hEf+p1bIF2f3NA1IWK1bd6GchL/2yd+Zh6JpHDU4VMOxIPGAlcaP3LLJ3cl7imaiAMGJ tzYIjeWi3VCtZaKVJ+jWsThXuz4dPzvRJRLuQqLtZUzHBBiSEX8DB2cAaDvDbJxDvRKF MxutN2Osd6d1f+Ka+bY5Wwb7Bdg0DtVIPtyZ3BmLCz7oGlZ945YH6WHQmg36gRLaQg8E xT4g== X-Gm-Message-State: AOAM532zXIeEGWaNAi/2iqLJ4tMewE3EaNUJsApuwf+4lwGIP5Ots6Bh IZSWvB287kSarOALt81g5Yr4KniYDhZUUw== X-Received: by 2002:a17:90b:194b:: with SMTP id nk11mr30006284pjb.42.1621955239684; Tue, 25 May 2021 08:07:19 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 08:07:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 19/28] softfloat: Convert integer to floatx80 to FloatParts Date: Tue, 25 May 2021 08:06:57 -0700 Message-Id: <20210525150706.294968-20-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::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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 | 58 +++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 45 deletions(-) -- 2.25.1 Reviewed-by: Alex Bennée diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 5c4a32bcfc..1cccc40db5 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -3345,6 +3345,19 @@ float128 int32_to_float128(int32_t a, float_status *status) return int64_to_float128(a, status); } +floatx80 int64_to_floatx80(int64_t a, float_status *status) +{ + FloatParts128 p; + + parts_sint_to_float(&p, a, 0, status); + return floatx80_round_pack_canonical(&p, status); +} + +floatx80 int32_to_floatx80(int32_t a, float_status *status) +{ + return int64_to_floatx80(a, status); +} + /* * Unsigned Integer to floating-point conversions */ @@ -5036,51 +5049,6 @@ static float128 normalizeRoundAndPackFloat128(bool zSign, int32_t zExp, } - -/*---------------------------------------------------------------------------- -| Returns the result of converting the 32-bit two's complement integer `a' -| to the extended double-precision floating-point format. The conversion -| is performed according to the IEC/IEEE Standard for Binary Floating-Point -| Arithmetic. -*----------------------------------------------------------------------------*/ - -floatx80 int32_to_floatx80(int32_t a, float_status *status) -{ - bool zSign; - uint32_t absA; - int8_t shiftCount; - uint64_t zSig; - - if ( a == 0 ) return packFloatx80( 0, 0, 0 ); - zSign = ( a < 0 ); - absA = zSign ? - a : a; - shiftCount = clz32(absA) + 32; - zSig = absA; - return packFloatx80( zSign, 0x403E - shiftCount, zSig<