From patchwork Wed Jan 24 13:12:58 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: 125653 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp414585ljf; Wed, 24 Jan 2018 05:26:55 -0800 (PST) X-Google-Smtp-Source: AH8x227jWEypf2cBBdOmEQVI0ViTGLlvfbNWX5UOoeloaH+GpHF0ciY5bf6FaG6DKX1A2KcU2vAU X-Received: by 10.37.214.83 with SMTP id n80mr5273953ybg.36.1516800415263; Wed, 24 Jan 2018 05:26:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516800415; cv=none; d=google.com; s=arc-20160816; b=eqSLCHq9gvBKGgTBjNF8f4ZEd4vYtoI+zJKGEt36bc/QJjvk3dG//D5+W5MO1wWdE9 5Da6vO5+tAGg4JDAnI2mFHzZKHvSH0fBPdknBT6+vHQDkCARghd9QdFE9i55Qm2RQBku 77ROpPvR0kV7KllKNU5ERXd1u3hbeztRPEB+xQM96Hhzj7hCxO86uxALHqPXM7ziB/U+ sxui2qwGbkVg5XBCgyU6Uy/8Fp3Z/pPzMIkZ1ZmOteHWtxrC6NO6lVZtR6FKiVrzqe/r 60LX6QAOdBy3ABF0ZEslbwb0uf7sCK9JyouQILrVPdbvcfglVUqr/EQTdNGQFkJV42Rx Kqzg== 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=6e42PntWcXp9kup69M+lCg5U5Wv68rh4rND0cf5yMTw=; b=eJuId7MZEgLyJhEucDvsnqvSR/ekFHj5QwNjjAubEfIcvdV6BwOWlAHRgnWJjp6CP9 irjXBmymj/C5Otbzb780Ye+tfdTlDVzDExT98jhWkuNFDtG3snCD/wQQyCjiV4eLYsMq b7qIt9NyInaed6xCAKO7Q7/2IuiUqELVhGPG06sjYjy5epruqzw2avIQFLw5zRbAk3K1 nEePLZcEEus/ufrQA+JyZOPj0V8TJu+r6jR4KjF/aNufkNJo2AABKeRLPv7WqksQO5Cw pmAYQFXtryWgLq9+0rGu0CoxFvMZEpLoK8IeE/rZNWJ5seVTS/9g2xMo0Y1BAcL3OUhb uCEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hjyqoa+W; 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 c64si167376ybb.806.2018.01.24.05.26.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 24 Jan 2018 05:26:55 -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=hjyqoa+W; 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]:48582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeL4o-0005Ky-LG for patch@linaro.org; Wed, 24 Jan 2018 08:26:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeKrk-0003G2-UC for qemu-devel@nongnu.org; Wed, 24 Jan 2018 08:13:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeKrj-0003jg-Tw for qemu-devel@nongnu.org; Wed, 24 Jan 2018 08:13:24 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:42081) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeKrj-0003i2-Nq for qemu-devel@nongnu.org; Wed, 24 Jan 2018 08:13:23 -0500 Received: by mail-wr0-x241.google.com with SMTP id e41so3975848wre.9 for ; Wed, 24 Jan 2018 05:13:23 -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=6e42PntWcXp9kup69M+lCg5U5Wv68rh4rND0cf5yMTw=; b=hjyqoa+WGmWubpmR71RJmzw7WGnR8yCNBnF5Y/jXr91pTHzONBQkuvipWBAJbTUGS4 6CKxqrR2IknXhXN9rTws5NPHHip7eVFNgPpDz4BPS3VheihLJ4XZiGIvK9iYZPeulB1L /zZZrf0DN7fJACU4ESRCtzrRgm76vKN8e/w10= 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=6e42PntWcXp9kup69M+lCg5U5Wv68rh4rND0cf5yMTw=; b=G1/hdmft0aK6ID7P+heD+OBelEz87Nkqnny7Mfs+E5+i7koJp+8X4bpEVa4Op5W45l nC8q53sYvqlvS7VoHCWk/FNojouoci8JYKRGhl7JmSH6721O6FXHJ2iGQgwpRKxJn/3y ROwRmK4ArbLCvI85wGVu58Qp4abQfL9n24hyyUHbmSZMl9cg34faA9zdY3LSpiE2Cjce ysQ2wjbFYwXLFs6QWDLph0xTMrDX0KIG/Tw0pEmMcNtK47PywtasUszPS1K9w3s7vPIJ Vd9FrDIBmfCJnD7PDWaHmtBlQxYK6FOBSL0hf77JII69+//sFxGmhK+KEmvccXOkCcMw uAeA== X-Gm-Message-State: AKwxytcGXl495sNuur3IUu1Lf17Guodv9C0zjAD6ZNS6mB7RXrdyPne8 G4/3gRQvRzK5GlAeiVN973drhg== X-Received: by 10.223.200.141 with SMTP id k13mr5478250wrh.216.1516799602668; Wed, 24 Jan 2018 05:13:22 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h194sm506375wma.8.2018.01.24.05.13.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 05:13:21 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 0E9173E050E; Wed, 24 Jan 2018 13:13: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: Wed, 24 Jan 2018 13:12:58 +0000 Message-Id: <20180124131315.30567-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180124131315.30567-1-alex.bennee@linaro.org> References: <20180124131315.30567-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 v3 05/22] 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 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- include/fpu/softfloat.h | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.15.1 diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index f3b9008f78..1d34f2c3eb 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -265,6 +265,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. *----------------------------------------------------------------------------*/