From patchwork Tue Feb 6 16:48:03 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: 127045 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3096542ljc; Tue, 6 Feb 2018 09:00:23 -0800 (PST) X-Google-Smtp-Source: AH8x224hDCvbMi9Aces4FZZzOUltnO1QW6cIV26+a2oCvCIvxcmtjC/oVcvf1JEK/uV5WlLwOZly X-Received: by 10.37.147.144 with SMTP id a16mr1879857ybm.137.1517936423425; Tue, 06 Feb 2018 09:00:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517936423; cv=none; d=google.com; s=arc-20160816; b=I9KDaDQprI2/ciELlKJ78r3euepu40EcVJjskfI46C0OibkBcenyzv4j8biUDvc9CF 6ozFb7Y0fobgkEcPyZ/VLF0c856tN6DeuhtZK9z1XnhiPg0eGNW6i/uCCveRkMwQlsq4 OyYYQK3GXVNlCDJXXjokdQlLYDR18Z0N/3KtlE1+mcy9RdpG9AtQcpBI2vzLEzfVKcZM UXI76zzvyH37ZhPdXiOv475YEdGGRSRCxaaG/zDvDJFSH4Yss87+qqCyxgOoj1aApfDO Fu5ZPrWOCb+rmmzeFzerymaL1h/Lfdy0w2t+At98dVMloZulzneXWYI0YTMO/AQChVLD bZkA== 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=mxxgOfnozx7cvpkKXjRfz6cqqxRGu0Az+qLPzYygsUA=; b=I45QKuf/POZyw2jtCSoLLQaRKYfaGkPns7xBDtdWWMf+cZKfMnatYymLV8wAd0V5xV fxZf91T5af/k9kMEPRahvd44y3b0qHh2ZyQwgWA3UEC8bxXOW5tXGH2ovARfTmfjQXro k0trFYkLKVHSRWceMGm/pm+kSe+bYSkfENcdTRVyr8AupgHyppZTn6nhc78K482qrs7o VnOkaVdO5+vOl9rHl2Ca1O2+gG6kcpuNQaop/C/IlNcKUZuV6PkY6zRZDGFAFIWdXpHQ vxDNYlzW65oLo9JDvn9FARdZniE6fSE1UxFOoHM9yT7GnSAwkuKlMNfPFUp8z9et1WdO 9Bqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HrQqfTSF; 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 x13si1332875ybm.27.2018.02.06.09.00.23 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 06 Feb 2018 09:00:23 -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=HrQqfTSF; 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]:37968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej6bW-0002Ya-No for patch@linaro.org; Tue, 06 Feb 2018 12:00:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej6Q4-0000bF-BH for qemu-devel@nongnu.org; Tue, 06 Feb 2018 11:48:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej6Q3-00052X-8P for qemu-devel@nongnu.org; Tue, 06 Feb 2018 11:48:32 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:37927) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ej6Q2-00052A-Tp for qemu-devel@nongnu.org; Tue, 06 Feb 2018 11:48:31 -0500 Received: by mail-wm0-x242.google.com with SMTP id 141so5103685wme.3 for ; Tue, 06 Feb 2018 08:48:30 -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=mxxgOfnozx7cvpkKXjRfz6cqqxRGu0Az+qLPzYygsUA=; b=HrQqfTSF3Ql5uc89yvMQVpp9RfyRjZTpEYnxgRUacvhQosHB5exTvBB3l+6PnsZJra BiJYAVD/N70wXkQd/1EBGyfHDImDOjkU6tHxdnoRGcdEWICSBAc+yokAGgVJcwMHua72 rDB98ckiprQd/ChyXdyrnPhfjdKOnH66GaLl0= 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=mxxgOfnozx7cvpkKXjRfz6cqqxRGu0Az+qLPzYygsUA=; b=SAxwJU6UvNGiPnHxR/l1P5Zq6W9UHuudfMhUTtn7lmWJGMmCnEjWcOUMOTXyjosUWy bdx6/QQzBxZfpVQXX0ULxbs9IDGtgDNkGdpUzrwXLCJs09nVtUWhEWXpNsXIa2XwXPBA wfOOODxFRbi4Ibcluef1GAYtstf6+Re9ktXT47uJBK68nYj13bZ+sXJ5Rne59Xd/8MTM 66yx3G95SduGIWUkFB0p/9Z1k4OmDciI4UIYYZr4/Ly9LtxWSPjUk2BKWJAbpjmzQMJZ R0YR8zLFPpD4eJLnD9FffneE8m4SPg+h0S8j5E2zhn3w+lovZfeSkowC96s4tRhbGYoT NMnQ== X-Gm-Message-State: APf1xPCVUj5z3pyfcTt/VUsGf6gAVPaQrDLnfgMLKAnSNpnaFi5bqhlC c4ldQhJpwLLZtRC4R8CIiPv01Q== X-Received: by 10.28.118.13 with SMTP id r13mr2289703wmc.95.1517935709756; Tue, 06 Feb 2018 08:48:29 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x65sm6372052wmg.29.2018.02.06.08.48.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2018 08:48:22 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 09CCB3E074C; Tue, 6 Feb 2018 16:48:16 +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, 6 Feb 2018 16:48:03 +0000 Message-Id: <20180206164815.10084-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180206164815.10084-1-alex.bennee@linaro.org> References: <20180206164815.10084-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::242 Subject: [Qemu-devel] [PATCH v4 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 --- v2 - fix minor white space nit --- fpu/softfloat.c | 120 +++++++++++++++++++++++++------------------------------- 1 file changed, 54 insertions(+), 66 deletions(-) -- 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.