From patchwork Wed Feb 21 11:05:10 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: 129021 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp493411ljc; Wed, 21 Feb 2018 03:09:10 -0800 (PST) X-Google-Smtp-Source: AH8x225Cu06HHHbxiDewFoXYwb4Wksx5gACIpPslXjkpZdD3mc2G8PegxZbRwah8hyeNOWVqM4T/ X-Received: by 10.129.38.214 with SMTP id m205mr1895243ywm.436.1519211349904; Wed, 21 Feb 2018 03:09:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519211349; cv=none; d=google.com; s=arc-20160816; b=0XiIEBVH7/nV8bqy5DZpGuxeA3Z/U7y0ACle1pY8TgKkBHa8olXzWoB3YlViNtoNAX GpUwfWG/0QR6pEhf1bW4GQ0K3PdIo3dtnXuaEfbbt4c6FN5XaP+T3M3pCrTV4phCbA9b 5PBHs4bfpXjnrZgeVUsRsi9cR03K9AGcQV0VcTBUk7+sIYiV+MEHlPw0jAQy+bPv5blt IJA5zptkP/eBGWPA/C96IhVJk7Gw51bjHHS5GZh/FofxlJ3t9xENAvB7jjEjw63PssKW 6PlqU8rwCT4jwgxvBtfTaDG4pERLNQk4xCmFEisHeaLJB49lO4MIIoRNtv+PbXgLGAnS uNtA== 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=xg2TzrleE+1h+u0B6reJVfYEHy0RU9XEXCikOjlL9v0=; b=Queh1Sq1+cFAn0Wrh3u1mRFfXgCKEGLwELIfFg66Or/+D+u3GcD569oOEufv01KC+i QVUleq7nGyhW3dZnPlgc602ZEj/EUY5tewPa86j/4tYxQOcxC0DKR3vGUHgJjNfEDuk5 d3mBIN+1/wX8m0cT7Ch5+z05eR4l2Vr6bl/ksZwaoP1rT+569dRClmY5+NhWvuPpdu9r YUBx/yWqoVyVVr6fK7WcnVW4pbVWlZAhQTuzqT5LL42RvmHVxoHdpADqB7oXSsSOWurS btxYKagxLx4O1YWAxIk1wtDsu4TzJb2z/+cAEr5jMdcFQBDYfZCdLy7W2ZzhHtij/f09 NRnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UmyLk7JT; 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 v68si1716601ywd.370.2018.02.21.03.09.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 21 Feb 2018 03:09:09 -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=UmyLk7JT; 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]:60044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoSGr-0005VE-6y for patch@linaro.org; Wed, 21 Feb 2018 06:09:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoSDd-00041s-Hd for qemu-devel@nongnu.org; Wed, 21 Feb 2018 06:05:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoSDb-0006ir-PS for qemu-devel@nongnu.org; Wed, 21 Feb 2018 06:05:49 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:38140) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eoSDb-0006iU-GY for qemu-devel@nongnu.org; Wed, 21 Feb 2018 06:05:47 -0500 Received: by mail-wr0-x244.google.com with SMTP id n7so3287058wrn.5 for ; Wed, 21 Feb 2018 03:05:47 -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=xg2TzrleE+1h+u0B6reJVfYEHy0RU9XEXCikOjlL9v0=; b=UmyLk7JTsq+DfhvUYjSE/nnHxanWkPcHvCl4pIY77DjHVcflP+h5wH2QbtN8E2YoVx Ma+EiVcDTWB594XGOKK5zAnjx73fj3DAm2WjVQlRDtTcfbCDmQpcyzPMJzF7gXAuE3Lb 66CZ6MhkE+wB5YlN3DNIdHzVI+j+2X5FovL3g= 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=xg2TzrleE+1h+u0B6reJVfYEHy0RU9XEXCikOjlL9v0=; b=AkiyRm5Iix0CLLu5ibL1V5GTun9URRoo7NhLrXmzkE7Xqa9Sl15K1ah02EYOf5vzZ4 yCtoRRSNzf3KXPOj57QytjNfKldtYdE8f5l8gTCF2xmN43Z9AhCOoBUy2T5/92lMioeA Izw1Xi/9h+rkNstBATfhHPTDte/4sTDQzD9SUcfLe+nvRnysVZejtXnLP0DoH7H/KUpJ Br98SleZLDxI2PYt6KE0oKatwk6IgDHlQRiCHiUUuMCDl6TyCqwdILnO2FNZKiZXuhj7 AH7vJ7yxzw/ShNaNzXki+VX8tMzYgWxyuwRnQfHaxl0uqBpO1vsduR6teAm4J6PIJiBr H1Sg== X-Gm-Message-State: APf1xPBnJSmenMiby+eNWYgCwIcqyXRLakFnxkyJ9rqgKWNJdXgnsloL 23UUjvGa/52eJZX31ZB/GUh8Uw== X-Received: by 10.28.178.147 with SMTP id b141mr1640027wmf.87.1519211146357; Wed, 21 Feb 2018 03:05:46 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a14sm9688083wra.27.2018.02.21.03.05.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 03:05:36 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 00CDC3E0968; Wed, 21 Feb 2018 11:05:24 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Wed, 21 Feb 2018 11:05:10 +0000 Message-Id: <20180221110523.859-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180221110523.859-1-alex.bennee@linaro.org> References: <20180221110523.859-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::244 Subject: [Qemu-devel] [PULL 10/22] 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 Reviewed-by: Peter Maydell -- 2.15.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 3a4ab1355f..297e48f5c9 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.