From patchwork Mon Aug 19 12:17:04 2019 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: 171626 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2948947ily; Mon, 19 Aug 2019 06:03:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhBjWoxbH6TYxD3whkGrQS57loXc7H8wY3QgV/+TQ0HhQhB/KNEg/7M+tEnfr4Mf0TZk8P X-Received: by 2002:ac8:73d8:: with SMTP id v24mr21027656qtp.221.1566219798527; Mon, 19 Aug 2019 06:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566219798; cv=none; d=google.com; s=arc-20160816; b=XMdt2DuTfh7DsCRIORpcPZ0egJdZr6QApVCfztmEwbCsNU5lnvAeMzE5BlEsQqmbLF b25JrxK655hBiLXMMb7eCs74lWugSEmfQw6gf1Djtha07QWkBEa2+czPfVbmGnlBO20X JS6D4hFnvmIldMbRwp+fL0uzlsK3w2L8ULGaOlueCXW33thnbazISkoewnx9zj8FCffE nd4dlxhAvpiPq4Rw9phGfT/l9icCwtMy/yyUG+KEkeXOnc6tHV0awAvZkaCUWOKgLEKo 6m5ooLJc12ZENS73yJ/w+hrpz7IESUKGjd6F4jXVHLWWNbgQFsH+6+QHS+gtFoThSoHe mhDQ== 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; bh=nNuQAxTqrKNssICPiBxV3B4W+wm2ff+GCJ1t0tQcCPc=; b=ydCevh71F8UiCQfYF1C3D8jE7PRhepy/edLtAWnunycRTzMWEhwHiMBP6CB2RfAJR0 5fTDVJiKNM0p/IBRXJ6n6kA+8dq0SkSW7QFbEJx+LKjBiTu158kx3+An0omXkKj/HyPf Ta13CyaQTWImGBsjtEEUyr2XCJHUFzmff0LQK7DuO8npqyfDgZIG9BpzrKIiZfx7arxo vY24Kbo9oI9B2I9JixJOi5i8fUa1f87V+mbLnTqvri+SzkSWi8AGxxyUflzPg2nFhCak 2IpCTOKva9gsqV4x7By8iR0/iwGeSzcwQAAEKlqHGFNVua51N9l3F7m+HP87rxCMNRMZ Ji/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="j/c+iXwj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id e68si8663484qtb.331.2019.08.19.06.03.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2019 06:03:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="j/c+iXwj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:49906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzhJd-0000LD-9v for patch@linaro.org; Mon, 19 Aug 2019 09:03:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37930) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzgbI-0003AV-Oz for qemu-devel@nongnu.org; Mon, 19 Aug 2019 08:17:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzgbG-0007H8-FZ for qemu-devel@nongnu.org; Mon, 19 Aug 2019 08:17:28 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:40661) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzgbE-0007A3-7c for qemu-devel@nongnu.org; Mon, 19 Aug 2019 08:17:24 -0400 Received: by mail-wr1-x429.google.com with SMTP id c3so8494217wrd.7 for ; Mon, 19 Aug 2019 05:17:17 -0700 (PDT) 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=nNuQAxTqrKNssICPiBxV3B4W+wm2ff+GCJ1t0tQcCPc=; b=j/c+iXwj4sd9DZBevAnUb8+TkqHbUUdLeiJ142dS+v9rVZQ43encgXFdIQSsii73Un rhw3li/aNJIuAwgEsegzHrBx32EENhTh4ZTbtIb6AIvvmtAiSRSc+WxVUHuVH9h4dy1N gG0IZMBxSwlPTav33/1LX0DO5nFtgFjQ2+NMg2VRKr34JK/hzGAciEWAIEGEuIE9YAEd Vyp3GByQe5KSk+h1attT1LZ7DES3HfcpOeVhEf0U70IdgfVIjBm99vpg/nHBJfnugsj/ BUUtJr7ggMvIeONmYfKj5Xykx9kXC8CvCd2ps3uLqOiIxWp2pcJWpnnLtwCtsQDdqOam 5qng== 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=nNuQAxTqrKNssICPiBxV3B4W+wm2ff+GCJ1t0tQcCPc=; b=ep4++nmQurs6Gw957cjgvlEvMMM7RkCqm/rYNA/smg5Rw9US3uH0lOWfI8ayKGpoce UZORi9H1OJwnxFwWGOAzPp7x4W5atV4gqz9ZOxS+4kP8ODR/TMleLC2v62NEsYzSeG39 Z3oPJmLvvEBqpznv7WUjRhoqMdHmgmm8ehj9GNX8WlBB3T7ek477ioOEeKG/zmLUnQwp LWDvqudEKhvLx/l64KyEoto4M1GXXKa3hFZVtkwDRhPw1DS6Q9TB9ys7Td+2UwnmiWdR t1CaOtUjepbB1wTglLk9lhQXvhjKD2Frjpm20l45fJKI4b7uYzBgmQwDneqaLaTv1I6q Lm4Q== X-Gm-Message-State: APjAAAWXXLNygI8zXM7wFcq1GA9jN2bHIzoSStMxrQsrn404vhHjbd2p XA9mUU9OPDSgfHaeM+7B//GdIQ== X-Received: by 2002:a5d:4bc1:: with SMTP id l1mr28000181wrt.259.1566217036617; Mon, 19 Aug 2019 05:17:16 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l62sm12798379wml.13.2019.08.19.05.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 05:17:13 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 84AA21FF96; Mon, 19 Aug 2019 13:17:10 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Mon, 19 Aug 2019 13:17:04 +0100 Message-Id: <20190819121709.31597-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190819121709.31597-1-alex.bennee@linaro.org> References: <20190819121709.31597-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:4864:20::429 Subject: [Qemu-devel] [PULL 07/12] fpu: move inline helpers into a separate header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, Aurelien Jarno , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There are a bunch of users of the inline helpers who do not need access to the entire softfloat API. Move those inline helpers into a new header file which can be included without bringing in the rest of the world. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé -- 2.20.1 diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h new file mode 100644 index 00000000000..e0baf24c8f5 --- /dev/null +++ b/include/fpu/softfloat-helpers.h @@ -0,0 +1,132 @@ +/* + * QEMU float support - standalone helpers + * + * This is provided for files that don't need the access to the full + * set of softfloat functions. Typically this is cpu initialisation + * code which wants to set default rounding and exceptions modes. + * + * 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 + * + * Any future contributions to this file after December 1st 2014 will be + * taken to be licensed under the Softfloat-2a license unless specifically + * indicated otherwise. + */ + +/* +=============================================================================== +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. + +=============================================================================== +*/ + +#ifndef _SOFTFLOAT_HELPERS_H_ +#define _SOFTFLOAT_HELPERS_H_ + +#include "fpu/softfloat-types.h" + +static inline void set_float_detect_tininess(int val, float_status *status) +{ + status->float_detect_tininess = val; +} + +static inline void set_float_rounding_mode(int val, float_status *status) +{ + status->float_rounding_mode = val; +} + +static inline void set_float_exception_flags(int val, float_status *status) +{ + status->float_exception_flags = val; +} + +static inline void set_floatx80_rounding_precision(int val, + float_status *status) +{ + status->floatx80_rounding_precision = val; +} + +static inline void set_flush_to_zero(flag val, float_status *status) +{ + status->flush_to_zero = val; +} + +static inline void set_flush_inputs_to_zero(flag val, float_status *status) +{ + status->flush_inputs_to_zero = val; +} + +static inline void set_default_nan_mode(flag val, float_status *status) +{ + status->default_nan_mode = val; +} + +static inline void set_snan_bit_is_one(flag val, float_status *status) +{ + status->snan_bit_is_one = val; +} + +static inline int get_float_detect_tininess(float_status *status) +{ + return status->float_detect_tininess; +} + +static inline int get_float_rounding_mode(float_status *status) +{ + return status->float_rounding_mode; +} + +static inline int get_float_exception_flags(float_status *status) +{ + return status->float_exception_flags; +} + +static inline int get_floatx80_rounding_precision(float_status *status) +{ + return status->floatx80_rounding_precision; +} + +static inline flag get_flush_to_zero(float_status *status) +{ + return status->flush_to_zero; +} + +static inline flag get_flush_inputs_to_zero(float_status *status) +{ + return status->flush_inputs_to_zero; +} + +static inline flag get_default_nan_mode(float_status *status) +{ + return status->default_nan_mode; +} + +#endif /* _SOFTFLOAT_HELPERS_H_ */ diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index d9333eb65b8..ecb8ba01149 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -93,68 +93,7 @@ enum { }; #include "fpu/softfloat-types.h" - -static inline void set_float_detect_tininess(int val, float_status *status) -{ - status->float_detect_tininess = val; -} -static inline void set_float_rounding_mode(int val, float_status *status) -{ - status->float_rounding_mode = val; -} -static inline void set_float_exception_flags(int val, float_status *status) -{ - status->float_exception_flags = val; -} -static inline void set_floatx80_rounding_precision(int val, - float_status *status) -{ - status->floatx80_rounding_precision = val; -} -static inline void set_flush_to_zero(flag val, float_status *status) -{ - status->flush_to_zero = val; -} -static inline void set_flush_inputs_to_zero(flag val, float_status *status) -{ - status->flush_inputs_to_zero = val; -} -static inline void set_default_nan_mode(flag val, float_status *status) -{ - status->default_nan_mode = val; -} -static inline void set_snan_bit_is_one(flag val, float_status *status) -{ - status->snan_bit_is_one = val; -} -static inline int get_float_detect_tininess(float_status *status) -{ - return status->float_detect_tininess; -} -static inline int get_float_rounding_mode(float_status *status) -{ - return status->float_rounding_mode; -} -static inline int get_float_exception_flags(float_status *status) -{ - return status->float_exception_flags; -} -static inline int get_floatx80_rounding_precision(float_status *status) -{ - return status->floatx80_rounding_precision; -} -static inline flag get_flush_to_zero(float_status *status) -{ - return status->flush_to_zero; -} -static inline flag get_flush_inputs_to_zero(float_status *status) -{ - return status->flush_inputs_to_zero; -} -static inline flag get_default_nan_mode(float_status *status) -{ - return status->default_nan_mode; -} +#include "fpu/softfloat-helpers.h" /*---------------------------------------------------------------------------- | Routine to raise any or all of the software IEC/IEEE floating-point