From patchwork Tue Jan 9 12:22:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 123915 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3966399qgn; Tue, 9 Jan 2018 04:34:05 -0800 (PST) X-Google-Smtp-Source: ACJfBov2oPbE14gwRmNduZTI2l+cdeFddcdhEit3/zqxT/YJec4DE5L48FArhnzz9Uoyai6Rxx57 X-Received: by 10.37.53.6 with SMTP id c6mr13866577yba.125.1515501245319; Tue, 09 Jan 2018 04:34:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515501245; cv=none; d=google.com; s=arc-20160816; b=uC7OcjTm4PXkNTQjEgAFgwvkfaDSARRty8uiIU4Kps/B73jr3BdfvAuxEcVtDRZFoe tl6mwyYiLum/NpDcOuIUfVEkWASudM5OiZr4uzuDv9VgJJsi5IWelp22gbETYkJLSalW iLg6opG2MqFHJxQ7k8LbnZcHXvcMQIY2m2JH70PXHhjIzuyHsOwVpgrFh0jrCo3rX5T1 frwoVx5ymRMJCnv5HNYb2nApDLk1LKUdflQ0TvumHwu7PiRzr+bpEuk+xS2NGZwg/bwP PfJgVulLbTFAs10ltiHWM18Ntx8mgdA/u7LAPzXAKop5NDZ6J//HU45/ajC95A19sAmR ZPFQ== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=0khpgXmq2qgbbb8kOfF1HJdjZVtA5n1xM++dq8n/wIA=; b=NtIbtadjY/ElkU8ETAXBLylKW/U3+dImYxPcZslfX6muaQVojQ54A/W4Pc0wp2zIrt Kle+hv/uszt1js3LrjJIGY053P4NG1jSu7pLeefjIMvjrTkEyZx4CtWGGZF5irFDrH6L RaMnX4m8Aw6dK0+6DbweWJUtC/E5i46sH/dKv+ReDjgRn0OARbrRmphlQS5aJbiviX2P 6j8lOQBnZkiO4rYCeOGKOoJTCbp2J5Ps0viw6zGaOafHzz0NgXaBZyp8TbKU5VJYw61J ixNNUSuzTf58WYDzWHm1y2YAGRsl9F6K8vOtD2gMzk6p+TK2/GR/FNrWDR7dvj90P4UV /7dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hy4poktA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w12si2990566ywj.582.2018.01.09.04.34.05 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 09 Jan 2018 04:34:05 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hy4poktA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:49543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYt6S-00062W-NV for patch@linaro.org; Tue, 09 Jan 2018 07:34:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYsvu-0006j9-AS for qemu-devel@nongnu.org; Tue, 09 Jan 2018 07:23:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYsvr-0006r6-57 for qemu-devel@nongnu.org; Tue, 09 Jan 2018 07:23:10 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36070) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYsvq-0006nY-Rj for qemu-devel@nongnu.org; Tue, 09 Jan 2018 07:23:07 -0500 Received: by mail-wm0-x243.google.com with SMTP id b76so20438620wmg.1 for ; Tue, 09 Jan 2018 04:23:06 -0800 (PST) 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=0khpgXmq2qgbbb8kOfF1HJdjZVtA5n1xM++dq8n/wIA=; b=Hy4poktA7p+jIIhoo1asO9xb7iO98byjT3EXW1zyZ24ITOmUvYBjkNoNjmdz5qLg2Y hn0CAnZ2f20N/L+yPMJ17oNYHg+x3YR9L3NxnBzWAFhrzS3QnsNBkBu4M7WrVpq9ZRbv 3Nfe+XC4llsth9BCHPu9tok5Z4s7xNaZ8h4b8= 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=0khpgXmq2qgbbb8kOfF1HJdjZVtA5n1xM++dq8n/wIA=; b=XMAQN4wDkCKI3fakesKJa6bwaYRwOFX349CxD5rXP5sV6TEUswLOVC1ks+XIXwS2YC EwsitDT/z4qs62WnJSIuT+Mh+0rh3B5OYJp7IFxCT9na7KWyniSLb7asaTfnPF9LLxLg TnPtx60rwTRn1LsI1Qh78VFCtSulmtWouKH44EcUPYofsjteJ5no8NeJKuCqLQVn+HFg RT/Udzy/C/6yvte7W8+OvoNXOORniVWYuDnInD/SvXkjln/fBff6ApoKa66EzD7zD4Dr FS+4Ay7EFwVI6eUre22xeUoHiCTZw/Dl6NsQPOY/qgIGjWbh8SMGkLNG2mM3RMdhrfXt mhQg== X-Gm-Message-State: AKGB3mIH7qIVxrZbvPpkvbryDF0YSf5JUQ3Nq63T4pmzCtfX7mLKtJGw Wtesrd+LZaGymS0Mu0pVc2pslvi82vY= X-Received: by 10.28.183.8 with SMTP id h8mr10626199wmf.62.1515500585634; Tue, 09 Jan 2018 04:23:05 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id q2sm12886646wma.19.2018.01.09.04.22.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 04:22:59 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id C4A833E2B4C; Tue, 9 Jan 2018 12:22:52 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: richard.henderson@linaro.org, peter.maydell@linaro.org, laurent@vivier.eu, bharata@linux.vnet.ibm.com, andrew@andrewdutcher.com Date: Tue, 9 Jan 2018 12:22:41 +0000 Message-Id: <20180109122252.17670-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180109122252.17670-1-alex.bennee@linaro.org> References: <20180109122252.17670-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PATCH v2 09/20] fpu/softfloat: move the extract functions to the top of the file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is pure code-motion during re-factoring as the helpers will be needed earlier. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- v2 - fix minor white space nit --- fpu/softfloat.c | 120 +++++++++++++++++++++++++------------------------------- 1 file changed, 54 insertions(+), 66 deletions(-) -- 2.15.1 Reviewed-by: Peter Maydell diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 44c043924e..59afe81d06 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -132,6 +132,60 @@ static inline flag extractFloat16Sign(float16 a) return float16_val(a)>>15; } +/*---------------------------------------------------------------------------- +| Returns the fraction bits of the single-precision floating-point value `a'. +*----------------------------------------------------------------------------*/ + +static inline uint32_t extractFloat32Frac(float32 a) +{ + return float32_val(a) & 0x007FFFFF; +} + +/*---------------------------------------------------------------------------- +| Returns the exponent bits of the single-precision floating-point value `a'. +*----------------------------------------------------------------------------*/ + +static inline int extractFloat32Exp(float32 a) +{ + return (float32_val(a) >> 23) & 0xFF; +} + +/*---------------------------------------------------------------------------- +| Returns the sign bit of the single-precision floating-point value `a'. +*----------------------------------------------------------------------------*/ + +static inline flag extractFloat32Sign(float32 a) +{ + return float32_val(a) >> 31; +} + +/*---------------------------------------------------------------------------- +| Returns the fraction bits of the double-precision floating-point value `a'. +*----------------------------------------------------------------------------*/ + +static inline uint64_t extractFloat64Frac(float64 a) +{ + return float64_val(a) & LIT64(0x000FFFFFFFFFFFFF); +} + +/*---------------------------------------------------------------------------- +| Returns the exponent bits of the double-precision floating-point value `a'. +*----------------------------------------------------------------------------*/ + +static inline int extractFloat64Exp(float64 a) +{ + return (float64_val(a) >> 52) & 0x7FF; +} + +/*---------------------------------------------------------------------------- +| Returns the sign bit of the double-precision floating-point value `a'. +*----------------------------------------------------------------------------*/ + +static inline flag extractFloat64Sign(float64 a) +{ + return float64_val(a) >> 63; +} + /*---------------------------------------------------------------------------- | Takes a 64-bit fixed-point value `absZ' with binary point between bits 6 | and 7, and returns the properly rounded 32-bit integer corresponding to the @@ -299,39 +353,6 @@ static int64_t roundAndPackUint64(flag zSign, uint64_t absZ0, return absZ0; } -/*---------------------------------------------------------------------------- -| Returns the fraction bits of the single-precision floating-point value `a'. -*----------------------------------------------------------------------------*/ - -static inline uint32_t extractFloat32Frac( float32 a ) -{ - - return float32_val(a) & 0x007FFFFF; - -} - -/*---------------------------------------------------------------------------- -| Returns the exponent bits of the single-precision floating-point value `a'. -*----------------------------------------------------------------------------*/ - -static inline int extractFloat32Exp(float32 a) -{ - - return ( float32_val(a)>>23 ) & 0xFF; - -} - -/*---------------------------------------------------------------------------- -| Returns the sign bit of the single-precision floating-point value `a'. -*----------------------------------------------------------------------------*/ - -static inline flag extractFloat32Sign( float32 a ) -{ - - return float32_val(a)>>31; - -} - /*---------------------------------------------------------------------------- | If `a' is denormal and we are in flush-to-zero mode then set the | input-denormal exception and return zero. Otherwise just return the value. @@ -492,39 +513,6 @@ static float32 } -/*---------------------------------------------------------------------------- -| Returns the fraction bits of the double-precision floating-point value `a'. -*----------------------------------------------------------------------------*/ - -static inline uint64_t extractFloat64Frac( float64 a ) -{ - - return float64_val(a) & LIT64( 0x000FFFFFFFFFFFFF ); - -} - -/*---------------------------------------------------------------------------- -| Returns the exponent bits of the double-precision floating-point value `a'. -*----------------------------------------------------------------------------*/ - -static inline int extractFloat64Exp(float64 a) -{ - - return ( float64_val(a)>>52 ) & 0x7FF; - -} - -/*---------------------------------------------------------------------------- -| Returns the sign bit of the double-precision floating-point value `a'. -*----------------------------------------------------------------------------*/ - -static inline flag extractFloat64Sign( float64 a ) -{ - - return float64_val(a)>>63; - -} - /*---------------------------------------------------------------------------- | If `a' is denormal and we are in flush-to-zero mode then set the | input-denormal exception and return zero. Otherwise just return the value.