From patchwork Mon Dec 11 12:56:48 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: 121391 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2754486qgn; Mon, 11 Dec 2017 04:57:38 -0800 (PST) X-Google-Smtp-Source: ACJfBotnrAFsXGv1/WlHuF3ewCqK+YjaCsxGWZOEy+7fUbdSy4ON/WDEIBTelMS+yJVHDP5nev0E X-Received: by 10.13.210.69 with SMTP id u66mr199569ywd.126.1512997058572; Mon, 11 Dec 2017 04:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512997058; cv=none; d=google.com; s=arc-20160816; b=jkvhGJRlxmtxuBwFVG/MOpHGell2JQG9/HbC+T2AuGYe56UBzUYBJuYZ29vOh6MbRd 8u4v9/uiVnj/tlRlLYCvbJX4Gm2D01hE9wRpP/RTX11Xw9z+408zCU1yiYvRhgvL+gOq +lV7G61RQObjkm4EaxYm2W8E9qgbVW5uqgf/zSNQSbqOuvMHOu6nxAP+ybU+3YmWTfbU b39Cij3DWH92HOrCQ7h+3ivkhkY7CS5141zK3x3wQA4EZEdCjZu/RR2wC+sfLWl9A1n4 nhkWlmBJ74TWnw/TKnIAgFw/2rOAnAMSK1zSC94x4QGyIGeYe0igMnxW0nwN6hC6DyoW 3X2Q== 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=u5wQ9RSdeDG1Nh66eJT3Ak6Ya8mFr9eGwuAxMU+ctEc=; b=oJCWRL1AI5zcyDhLtPpEiGlg6Fea+eSV2jyd0XYDVJKdevmZUQc3uxvHyxQyjisKqz tv97UQqEfVDW1rJTKlt5yyRsURF+a0MbGlgBffTz1KGPTi3XW9NvA0l87xdVQOaN8QcL GF5C0RxF/7/dVXSkPi5Scnv4HMs+k9/eIwISOtlWnfYUHobKdnlwDNFpGtQeAEvaM+o+ KIbEoB3W2pmMTZgUIz7ivD+T2T3A1jNzy0iKOIBzJ+nuJBQEtepO2/q8lpcE59oBnFUn 8faqayvNBSWW7D7hzuTU9EvQJ0ikE/dY1fb/IlEx/Q/EzGRBGYN4LpfcTXDj8N68v1rt NPfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=D3hLtmfs; 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 t65si2927084ywa.52.2017.12.11.04.57.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 11 Dec 2017 04:57:38 -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=D3hLtmfs; 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]:52582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eONeL-0002KF-Vd for patch@linaro.org; Mon, 11 Dec 2017 07:57:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eONdv-0002JU-Uk for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eONdu-0007ZG-9G for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:12 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:45377) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eONdu-0007YG-32 for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:10 -0500 Received: by mail-wm0-x243.google.com with SMTP id 9so14236012wme.4 for ; Mon, 11 Dec 2017 04:57:09 -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=u5wQ9RSdeDG1Nh66eJT3Ak6Ya8mFr9eGwuAxMU+ctEc=; b=D3hLtmfsFjL4E5J5x2LNzfNQv7/V3W6XsH0NfTJwcVzZureJwgFY2kCsK/RIjaMW2v inKqvfvmpqY077tSwwQ3MgCRp+mp+GoeQpJlFhiIGmaOueOgsiuUjGQg9VKVlJZ0Z0JW Vr0P/SXzbyvPm1ENhYPUUb8txADsXVniUdtuI= 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=u5wQ9RSdeDG1Nh66eJT3Ak6Ya8mFr9eGwuAxMU+ctEc=; b=AOVYcCZyjlWt/kT3d0vnYntB/a8xC7f/tosiVjQK4GPzgsXg7eTbbYUn5eijBOwqMH 4S0UxGysKbnlJrxoXBzpGQGRf7KMlup8CUQMGtniqA/4jrvwc0Ez8K8zLjEh2ydMbjck esdCAs3E4tsQyAz6q1gVwXAolq/kgewAsCBEtjvAEj+cu8heq3xBxTdZeJirkNiAgZTr 2NAwiaFyrdoGnE5CfJPMMAd8r+3XuS+Ktq3Oey0eGgOL9YX22X38RrGM3bFSom/apwjx +yRGSn2BuFlynjMfF3g2qeUXrkOQxmrvjqkGIlKycgwiKDOYPmRrFg/EyxlOzsDERKyX nyJw== X-Gm-Message-State: AKGB3mL81FpPaIRjnRmghOn8OLDF0vit0wvqOo+BHZvsH/6LcGcCT2GU S+VIIy0yBSg96owsDni/PYeZwg== X-Received: by 10.28.54.207 with SMTP id y76mr800617wmh.94.1512997028895; Mon, 11 Dec 2017 04:57:08 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o88sm19867994wrc.10.2017.12.11.04.57.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 04:57:06 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 886953E0620; 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:48 +0000 Message-Id: <20171211125705.16120-3-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:c09::243 Subject: [Qemu-devel] [PATCH v1 02/19] include/fpu/softfloat: implement float16_abs helper 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 will be required when expanding the MINMAX() macro for 16 bit/half-precision operations. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- include/fpu/softfloat.h | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.15.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index d5e99667b6..edf402d422 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -374,6 +374,13 @@ static inline int float16_is_zero_or_denormal(float16 a) return (float16_val(a) & 0x7c00) == 0; } +static inline float16 float16_abs(float16 a) +{ + /* Note that abs does *not* handle NaN specially, nor does + * it flush denormal inputs to zero. + */ + return make_float16(float16_val(a) & 0x7fff); +} /*---------------------------------------------------------------------------- | The pattern for a default generated half-precision NaN. *----------------------------------------------------------------------------*/