From patchwork Mon Dec 11 12:56:54 2017 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: 121405 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2767399qgn; Mon, 11 Dec 2017 05:07:24 -0800 (PST) X-Google-Smtp-Source: ACJfBosPc64tzvptbGO7TGCobNcacjIEZquPFOkOlowkWu0bMSJhNMv5TPwmv9E4pgSUyN+j+bXS X-Received: by 10.37.132.138 with SMTP id v10mr210675ybk.228.1512997644298; Mon, 11 Dec 2017 05:07:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512997644; cv=none; d=google.com; s=arc-20160816; b=KKTm+bniGwRm8Ngf1mVuJj4XcDg4f8cWBePz39l44+HdGxE5Ng6MQ0hEJ8eb/fJEkA 1XuMiR1dxt47lNgEkC8GCCcZDYVs4/SrIkcMpxDoTMEkCpzisIaXsBN3zN+s+nTjqLkF UTJRtLW6c5lOCx36cGuLTydHIHa7cqPkxqd1lNOIsLbtPHgAF0pw6DlbnCoT4jtm5y5B qlNoB7CWqDrVSwd9cTowqLuxO414ezoYI7YkPj3CASnYKOmi8YaxdGFc96eaObjWrNSC 1InOd0Lt5DBO3xNXwdbkd2EJa85B5slFoaX4/ayWhNcqyiBInni0Ebfg1aaYsoNreg1p WSPw== 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=b6zTeLeoJwXTa0YonO9q4Wjz9CylVVC+D6KJ/p8yPj8=; b=YoFysmUKqpKYZJiAIoNPqPh+5wUoMkEmSmNZBE5mVfcq61Sq0oFBKqlaIfxUFFFy61 4MAHLSt41HR0L3GEJ59g97h/dHu8k3cH8mVihiD0rWzZetQwjRlEHdmk+i/U0bnXPVra g1b+eMwrOLDFR3jx86qRAAISUxwiDmjMcjcyk8FXPpAl1G4QsD/Be9qxEpRrwP6WZvsK Nm85Gm6o9R9VkNcYbfBADLl8TA9dNaiLzRHp1vuOT2zTFhUgSeTyaeLzkdSctwsMbSUs MLqN8V1pc3ckAw3j63qHe0yeThJwr7+z97MdUjMtMp5QROfpObxxksguuNmCu3KJfJ6F 5imw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LNuw23Ah; 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 r133si2915041ywr.494.2017.12.11.05.07.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 11 Dec 2017 05:07:24 -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=LNuw23Ah; 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]:52667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eONnn-0005cL-O9 for patch@linaro.org; Mon, 11 Dec 2017 08:07:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eONe4-0002QJ-BL for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eONe1-0007gx-9i for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:20 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:44849) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eONe1-0007g1-0S for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:17 -0500 Received: by mail-wr0-x243.google.com with SMTP id l22so17456934wrc.11 for ; Mon, 11 Dec 2017 04:57:16 -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=b6zTeLeoJwXTa0YonO9q4Wjz9CylVVC+D6KJ/p8yPj8=; b=LNuw23AhkRiW4FD7dTWhUPsapQxPk7FgF5V3jTOZRwAsS6z7lVNsZgIYwb+sbaycs2 vjm+DK1doQlVovfjI6757iujBMB7Esn+x0Z2YjcVZedsNKrdJ3rwV1RxR0YueBcBYnVI wweu9s0QF1xQXKlB3MGvKDMsCdSjL2OrgYFr8= 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=b6zTeLeoJwXTa0YonO9q4Wjz9CylVVC+D6KJ/p8yPj8=; b=dfUrm3XiVPScZ0nQCYn8+HsULm6noMt71lqrP728hM3kj0DSEb/vJVPV1JJgOXLd0U KjL/NVeuu/hWVv3hkUegD/ocd1w8Cr+HSVIX4PdSqDfIVE3PDeSPNsp4CtDybElAxPId 9YChGak7ywV/9S0+nj3UoiCaOgo5jaFmzRc3wLWuqvagkQw/hutxWM89s7y+Qzzqcpss F1JfkEza5uG/m0Lvgiin1ePVxFMnJB0dLdoIbd4ymJH+E2Z+8wKoP7Awfd1vw7hHoTvB qz2D/XJDyRQjO8+/eQXZ2zh3zIZ2n/P3hhUXPK3Z9Fu+2SMTSUOf7Twt36aKNoI2U2/v XVMQ== X-Gm-Message-State: AKGB3mIH3TgZdPJHx2K1zFefKMds02abhpsRudCwi3zUbFeWqCFSXeo6 wJPJNYZZxlQcu4bsIqjtBlHanA== X-Received: by 10.223.158.147 with SMTP id a19mr312760wrf.179.1512997035709; Mon, 11 Dec 2017 04:57:15 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m11sm16176601wrf.56.2017.12.11.04.57.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 04:57:11 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id EFF153E099E; Mon, 11 Dec 2017 12:57:05 +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, aleksandar.markovic@imgtec.com Date: Mon, 11 Dec 2017 12:56:54 +0000 Message-Id: <20171211125705.16120-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171211125705.16120-1-alex.bennee@linaro.org> References: <20171211125705.16120-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:c0c::243 Subject: [Qemu-devel] [PATCH v1 08/19] 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 --- fpu/softfloat.c | 119 +++++++++++++++++++++++++------------------------------- 1 file changed, 53 insertions(+), 66 deletions(-) -- 2.15.1 Reviewed-by: Richard Henderson diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 44c043924e..0850a78149 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -132,6 +132,59 @@ 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 +352,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 +512,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.