From patchwork Tue Feb 6 16:47:56 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: 127025 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3087147ljc; Tue, 6 Feb 2018 08:48:57 -0800 (PST) X-Google-Smtp-Source: AH8x226GUoO+LSqlbL1FOUocmFBkO9/EJihpRkWiJ5+IK8rP0Lcr9MRG6PSHXTY6BWhPPqH+lWoj X-Received: by 10.37.162.135 with SMTP id c7mr1960114ybi.247.1517935737777; Tue, 06 Feb 2018 08:48:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517935737; cv=none; d=google.com; s=arc-20160816; b=x03sYdqiyH4/TQPZXOMwmxoPDIXq4NwDqy0HMglcGunzmBcmTb/mN7e5/c1aYcXFUm jCMhd0zgays25bUO2g6ZhGiZkPuDxU8wghT70JAsbQw6HQnOCb31iAaPB00YrSdWODHf WuaRQ8B6Anmz33yzmS8gH9GrfUAT1UT3M5CF0S/gYLPFwr0cRNXIqMVHR7iS9+OAPJgE utX4ZIL4DVDaNYlJY4XC+me4rxzU2fVXfeJT75r00xW2AbCj4lZS3trPrayJt7jEeBUX dHjBNNviYqTbfiwxEIt4oUKy6GOOF4Z69nKRZ378UVcPwMPu6kT8mcuV3zCvnUE1/O18 b9sw== 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=b8BgNJT3hHBvrBVeYE+kzxGeZV6BI607e0AjKLb6He8=; b=OSap5uo8WuXryMiP1pHJKiopoBWdqV8SPfswLRr6Npsu9A47QS8jJCALQkCo2W/bcU 6Uce+2LVMkD4F5tWmh968zLdlIPbNjSCxBqG2CeHev/Q40pZAC3UaB9EG5XSRbHzOBfR 2EYQWhkj7Zn4jHtUsjx6u/VB8qNJjfEKXFzvsFQ29q//2sgeGUbpFfli4B3UpPK6SF9Y 5HGNJ2KiujMETqwOy4sbV3Z2WAsYqHF6VzwdnQuamzVXK/3ABtD8p+qKosbrnL/gGuBK 9Y9a61dSMgLZM5q5GNdPKL2+QA3SRKhBLlmw4/tCl6ksX+es6zV/Tg6tG9idA8V2ENDS 3s+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TMXJ3f2e; 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 l8si30705ywk.149.2018.02.06.08.48.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 06 Feb 2018 08:48:57 -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=TMXJ3f2e; 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]:37437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej6QT-0000Vv-3K for patch@linaro.org; Tue, 06 Feb 2018 11:48:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej6Pu-0000TQ-Oa for qemu-devel@nongnu.org; Tue, 06 Feb 2018 11:48:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej6Pt-0004jS-7d for qemu-devel@nongnu.org; Tue, 06 Feb 2018 11:48:22 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:39094) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ej6Ps-0004hw-Tw for qemu-devel@nongnu.org; Tue, 06 Feb 2018 11:48:21 -0500 Received: by mail-wr0-x241.google.com with SMTP id f6so2648280wra.6 for ; Tue, 06 Feb 2018 08:48:20 -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=b8BgNJT3hHBvrBVeYE+kzxGeZV6BI607e0AjKLb6He8=; b=TMXJ3f2eGVcgejbDQV8w87hcnALpeDrAGNjaaeOzlkNC7Jqf41IvfeOe63E6VkPxQ0 G++kFpZd2SAD+piUtpwUPS9u/UrKx8dj2TZrqZ5Z1c5Cm8bXsFZXqPk53pFuCEbijufy gSPLZHB0TTS83grvJtONERds7u/yNpbDHpHj4= 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=b8BgNJT3hHBvrBVeYE+kzxGeZV6BI607e0AjKLb6He8=; b=EjlA1KolqIgvzlJeq5vYgDWYajTshc+tqmibqVZk39rBeM/HsLAlkhUHHBrlXhUnJq OEzLRWNk/jugBC1/pRLvztZJ+kvhQu6Z/6V3DITKi1+9sRvr5V7B6nKraQAQ9d9Xocch 00RzqldDKY7FmlXNW+rKCjhT/a3qttzMb/X9mYIGXKUekZwEQs8t6SK8dITpjk7K1HdS BCVJsubjJzEmsZhzPVzzf/bxUQkj2sv30VTghi/idgZzqj6CDuBY9Og+zoZsIBdozaLO BisQeUtoulLU9HwWoWsVD5bJTObTJeXBvXGL2y98HYFr0i/FnWgWAHnxJbOriQvDcj8+ d5Uw== X-Gm-Message-State: APf1xPBd1ToWqV2EROTcwgvVCuuoxknuCAM1LC3XOHSUNKMjm+plOEbl +7vsK0e2PgM4CToEkkYNrIhCag== X-Received: by 10.223.152.130 with SMTP id w2mr2868978wrb.12.1517935699637; Tue, 06 Feb 2018 08:48:19 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u79sm16532383wma.10.2018.02.06.08.48.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2018 08:48:16 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 5336F3E0576; Tue, 6 Feb 2018 16:48:15 +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:47:56 +0000 Message-Id: <20180206164815.10084-4-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:c0c::241 Subject: [Qemu-devel] [PATCH v4 03/22] fpu/softfloat-types: new header to prevent excessive re-builds 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" The main culprit here is bswap.h which pulled in softfloat.h so it could use the types in its CPU_Float* and ldfl/stfql functions. As bswap.h is very widely included this added a compile dependency every time we touch softfloat.h. Move the typedefs for each float type into their own file so we don't re-build the world every time we tweak the main softfloat.h header. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- v3 - new in v3 --- include/fpu/softfloat-types.h | 115 ++++++++++++++++++++++++++++++++++++++++++ include/fpu/softfloat.h | 31 +----------- include/qemu/bswap.h | 2 +- 3 files changed, 117 insertions(+), 31 deletions(-) create mode 100644 include/fpu/softfloat-types.h -- 2.15.1 diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h new file mode 100644 index 0000000000..8210a94ea1 --- /dev/null +++ b/include/fpu/softfloat-types.h @@ -0,0 +1,115 @@ +/* + * QEMU float support + * + * The code in this source file is derived from release 2a of the SoftFloat + * IEC/IEEE Floating-point Arithmetic Package. Those parts of the code (and + * some later contributions) are provided under that license, as detailed below. + * It has subsequently been modified by contributors to the QEMU Project, + * so some portions are provided under: + * the SoftFloat-2a license + * the BSD license + * GPL-v2-or-later + * + * This header holds definitions for code that might be dealing with + * softfloat types but not need access to the actual library functions. + */ +/* +=============================================================================== +This C header file is part of the SoftFloat IEC/IEEE Floating-point +Arithmetic Package, Release 2a. + +Written by John R. Hauser. This work was made possible in part by the +International Computer Science Institute, located at Suite 600, 1947 Center +Street, Berkeley, California 94704. Funding was partially provided by the +National Science Foundation under grant MIP-9311980. The original version +of this code was written as part of a project to build a fixed-point vector +processor in collaboration with the University of California at Berkeley, +overseen by Profs. Nelson Morgan and John Wawrzynek. More information +is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/ +arithmetic/SoftFloat.html'. + +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. + +Derivative works are acceptable, even for commercial purposes, so long as +(1) they include prominent notice that the work is derivative, and (2) they +include prominent notice akin to these four paragraphs for those parts of +this code that are retained. + +=============================================================================== +*/ + +/* BSD licensing: + * Copyright (c) 2006, Fabrice Bellard + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* Portions of this work are licensed under the terms of the GNU GPL, + * version 2 or later. See the COPYING file in the top-level directory. + */ + +#ifndef SOFTFLOAT_TYPES_H +#define SOFTFLOAT_TYPES_H + +/* + * Software IEC/IEEE floating-point types. + */ + +typedef uint16_t float16; +typedef uint32_t float32; +typedef uint64_t float64; +#define float16_val(x) (x) +#define float32_val(x) (x) +#define float64_val(x) (x) +#define make_float16(x) (x) +#define make_float32(x) (x) +#define make_float64(x) (x) +#define const_float16(x) (x) +#define const_float32(x) (x) +#define const_float64(x) (x) +typedef struct { + uint64_t low; + uint16_t high; +} floatx80; +#define make_floatx80(exp, mant) ((floatx80) { mant, exp }) +#define make_floatx80_init(exp, mant) { .low = mant, .high = exp } +typedef struct { +#ifdef HOST_WORDS_BIGENDIAN + uint64_t high, low; +#else + uint64_t low, high; +#endif +} float128; +#define make_float128(high_, low_) ((float128) { .high = high_, .low = low_ }) +#define make_float128_init(high_, low_) { .high = high_, .low = low_ } + +#endif /* SOFTFLOAT_TYPES_H */ diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 52af1412de..4e16e22e58 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -100,36 +100,7 @@ enum { float_relation_unordered = 2 }; -/*---------------------------------------------------------------------------- -| Software IEC/IEEE floating-point types. -*----------------------------------------------------------------------------*/ -typedef uint16_t float16; -typedef uint32_t float32; -typedef uint64_t float64; -#define float16_val(x) (x) -#define float32_val(x) (x) -#define float64_val(x) (x) -#define make_float16(x) (x) -#define make_float32(x) (x) -#define make_float64(x) (x) -#define const_float16(x) (x) -#define const_float32(x) (x) -#define const_float64(x) (x) -typedef struct { - uint64_t low; - uint16_t high; -} floatx80; -#define make_floatx80(exp, mant) ((floatx80) { mant, exp }) -#define make_floatx80_init(exp, mant) { .low = mant, .high = exp } -typedef struct { -#ifdef HOST_WORDS_BIGENDIAN - uint64_t high, low; -#else - uint64_t low, high; -#endif -} float128; -#define make_float128(high_, low_) ((float128) { .high = high_, .low = low_ }) -#define make_float128_init(high_, low_) { .high = high_, .low = low_ } +#include "fpu/softfloat-types.h" /*---------------------------------------------------------------------------- | Software IEC/IEEE floating-point underflow tininess-detection mode. diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 09c78fd28a..3f28f661b1 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -1,7 +1,7 @@ #ifndef BSWAP_H #define BSWAP_H -#include "fpu/softfloat.h" +#include "fpu/softfloat-types.h" #ifdef CONFIG_MACHINE_BSWAP_H # include