From patchwork Thu Jun 3 21:41:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 453335 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp634874jao; Thu, 3 Jun 2021 14:58:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR2h5ENM3wp1p/KZJzUjEEGShMYY5cwDi6D0ghUlOWVQQKyj/ACfMk7Vc3uL7J108/nNHk X-Received: by 2002:a05:620a:2987:: with SMTP id r7mr1288783qkp.461.1622757481005; Thu, 03 Jun 2021 14:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622757481; cv=none; d=google.com; s=arc-20160816; b=ndShmn37Lli43Oxf24+/QflXZHC6spImRhc2ZJlEO/S/XxYXA9Rpek9agn+mHhdE/F TIGjMvL5cY6pRNHTH5Osy2Y46IftfAdtwGkTh8cU0ec6Vcmk9SkTSFZ7Dcv1YLfaRBnh V/LjEw7stPFl4X30K/86eYiSk4B6B3+DEGrpUaRBF624VCpVK3zva3JMHZCpzhtws7mR NAJha/trLz32WMQfoz777GYU49yR4f4ov/L9KmVY1hCYLC16uycALSkmSYDdOcdoe3vt xah3ZytVYaPhdncOplZxTgHCCpvJdPb3DuDoyby8g8gdRQp2AnUscjZlMQg14TAISxnn TADg== 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=KMHyBtePJctFFVLhiljAsXW1cd3DwdhgWcEK6bYLQDk=; b=FN8qKYB6EddIeXsxIPbMCg1GcV4gk+cA7Fv3Rykp999DJB+fALvUo275/os17C/ScO 5Ka9V4QomxvdUptMThzBotLoUsdUnsP4AgIejcRm1NAKgHLXKRsvK4AosXXxxocGEaaX 2g4AtPu5mkKbHoCFRoRDHfKtH0UOw56amRZBjpGZkmnWTmmsvHiNC59KJzPdZFkjry7e ff59bHA/Fn0wuWQNH7xnbaPEq0jbmjVojO7VlodTGTz+vs4DXFQS091cbtnr7Zgr4VkD rd2kAAsxjLtAjXY8meoKK6GFZUF/QBvHGE4q/x7YDLAgTnW9UeL5xGAR9Mh13JYpF/Gw h3Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JRpLLMtd; 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 u2si2487841qtg.304.2021.06.03.14.58.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Jun 2021 14:58:00 -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=JRpLLMtd; 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]:55906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lovLk-0004rl-Fb for patch@linaro.org; Thu, 03 Jun 2021 17:58:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lov6F-0002pn-6T for qemu-devel@nongnu.org; Thu, 03 Jun 2021 17:41:59 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:47034) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lov63-00019h-NI for qemu-devel@nongnu.org; Thu, 03 Jun 2021 17:41:58 -0400 Received: by mail-pf1-x435.google.com with SMTP id u126so1936059pfu.13 for ; Thu, 03 Jun 2021 14:41:46 -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=KMHyBtePJctFFVLhiljAsXW1cd3DwdhgWcEK6bYLQDk=; b=JRpLLMtdiRutBWGRjBoQ5FVYOqY+o9dGY+FOgAROcQ2hv1+bqJZ9XzipCMgER2RvNL odT0UAkgNuL36jYvoJmFJUnEWO1yPfKbYzc62OWwqTO5k5VY3FZWPPd0brBmetg8hhBK b0aNdvBzSQ9wPtLbQTboEzTWwfcIyElbwFlH5eNxOfrG+hGdNCuIuey1e+pAJQVdXKWM xpfh1mnWWHDuCBEf5viEg4qNbJfGxoylHDdNQc9aih7srm/aXXgxj205RfeHCG3XRbPI KFr2b9dIWoH3aBSlBEYqbUkBdGQfp3rqu2HziW5n1/zBu8mJF0cxrezLSUvGySjqsMvf kyBA== 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=KMHyBtePJctFFVLhiljAsXW1cd3DwdhgWcEK6bYLQDk=; b=W09kyp2w75Y620Se5kr0eS2QzcE/PzODmx9YloyuANsanAJIuWAurvwTwqwNXrM1n5 ZOUlkjVOkLyPHVOdhmQ1aBbbnJFE66jUti+WOPjG7Qr78xdc8o8PgtNX303j00s1o/Rx p2HRGysmVCWLCNBx4erxa2nC/jUID4LbvkRdnFchtrtOQEZOX1pj2GmhwnJJXZCWemmc ZOV6QB0Dc4/BFZDvm1mOZSuViestjuSmrjEXFjoSWa/AbM18Yoh/ADRV6xW1SM+TOVbw 0TbOUzfJWWffbuLbBs+mTacYtibtDAEBTYbtZTx3ytGx1IBnCwU5qeFG54jWsXIwehKF +bwQ== X-Gm-Message-State: AOAM531C6i3QA8/ModJILKnBkcOVI+6qYkL8/1V3IdN+ugo90VZLejLx b1EnrPal4lLcrvKQQSQDXwfV1k+P4F/mKw== X-Received: by 2002:a63:914b:: with SMTP id l72mr1495174pge.99.1622756505694; Thu, 03 Jun 2021 14:41:45 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id p65sm40115pfb.62.2021.06.03.14.41.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 14:41:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 20/29] softfloat: Convert integer to floatx80 to FloatParts Date: Thu, 3 Jun 2021 14:41:22 -0700 Message-Id: <20210603214131.629841-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210603214131.629841-1-richard.henderson@linaro.org> References: <20210603214131.629841-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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: =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- fpu/softfloat.c | 58 +++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 45 deletions(-) -- 2.25.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 9caf1ecf9c..be7583780d 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 */ @@ -5033,51 +5046,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<