From patchwork Tue Feb 6 16:47: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: 127029 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3089996ljc; Tue, 6 Feb 2018 08:52:06 -0800 (PST) X-Google-Smtp-Source: AH8x226XJtS9LeLG9s1PioYXMeefTHTctOpME5cb2dDL0BB3CuYGcyNsW1+Y5Vpt73iyJnvHjkMo X-Received: by 10.129.75.8 with SMTP id y8mr1860046ywa.245.1517935926212; Tue, 06 Feb 2018 08:52:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517935926; cv=none; d=google.com; s=arc-20160816; b=lGNrWTb6wOWFpcYbCetpvkMqLTXJWPphTcTS72a6BMbfsWmT3dcaC7lnbSP79AMIT9 dbHBans0obsJUb2BK3TFdRHOoHVeDHpsgkAFqyaxyR0Yxsjo8hm8rM9zPJLUwaXiuyad u3m/ypg7A9sDoqEaS0QxmymgLPxIc5VaVGxYpi5pHB+hgOu8tLTYlcvEQERMWe18SOXY M/uACcR7z/Vxz+c0mFc+Izo7e0DiJSqt1Q5wSSobnpEFgLqnz1hkD0IK1dI9n+F61pzo rnTkP0JO3mhYcwPeyI8ZIWST+bhTSkr7cE3PhjB7oa5yBcb62cCHceNhy27UMn+1Cldf cBow== 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=i+SF2DfoxrFSy1haP9TRLYopw5m1dYNStHcwirkzQIcmixO7FKP7GlPXoSDS8WUhxa EUHbZ9Jx41B2J7PncrzJLl83gjOgbApqRpG5H34ai/rClBQOXAGs9OJPBqons9ec0xFx znH17OZEhtJno+EaT7yKMVNY53QCaJmRJQtRUXWCMV+DPc2PxHXN3IALsZQRvzahUfY4 lSecgRMLqFEcXhtXazvT3Rzx3F6CEbthBUlC1rxQgccBinTSNMWnfjGaN7ejOm0ucCWA b3wvtHjGhtZB3m89W1fJOqDJkqsdxvLTlZu5ceHIKGjkmBGQlpjcQh1x+KM1EuRUxlzw qdcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ULpIVzMw; 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 w14si213674ybg.767.2018.02.06.08.52.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 06 Feb 2018 08:52:06 -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=ULpIVzMw; 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]:37464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej6TV-0003VZ-HG for patch@linaro.org; Tue, 06 Feb 2018 11:52:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej6Py-0000We-Eh for qemu-devel@nongnu.org; Tue, 06 Feb 2018 11:48:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej6Px-0004ro-Gp for qemu-devel@nongnu.org; Tue, 06 Feb 2018 11:48:26 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:53519) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ej6Px-0004pn-8O for qemu-devel@nongnu.org; Tue, 06 Feb 2018 11:48:25 -0500 Received: by mail-wm0-x242.google.com with SMTP id t74so5035259wme.3 for ; Tue, 06 Feb 2018 08:48:25 -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=ULpIVzMwtQAkCfSB1ba199cLVYHqMDNVZhmmQnTM/4+f0Evi+rV6PeTrsDycWctmUg y13kZ9OO9Rr291ag3YztAwVszmikYqHezq/oqQ3K5A4KN9qRv+A3O6jixYgINPRzozRz MBc/NyMX35xuiYA6cyGSgaxEuW/hNE8EyCA0I= 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=JAS+aiLps17kwGn14JGfapjwipQUcXs1v8+uUYdsvnw/hM14lfWo68cU1CI8oYoPI7 shcKh4UE9UMZUmQYRsDALvHL1Pf7KlAVqZJNRNv8xuFG4ypjJE3fh33OYjJ8DzFENbD+ foqVNg8EYyqLHTdaVvYQKC31FmSc/X2Txww1fY/UVF8CHeAU6WSptJbNkprEfgbHNfcS 2Wc4rRxtcw4XzkW6IuY7sozyUFA92MCyguogrchSA3Kq+cwM6PjCukJKg6Cb2gy/nd7l fzw32wr/fFfYwFi91xleMa38joaFdrqVTDghdjLhh9m2Mvf6ysdfPcl9NRp37ZqXLf9E QyCg== X-Gm-Message-State: APf1xPBBffG5dEbsaZxhZMniWaPgn6XtXEzHJcgGpeIBDYInCU83ZxT6 54/YVrIbhUzUHAIv/pdAzEA/NA== X-Received: by 10.28.23.14 with SMTP id 14mr2496718wmx.5.1517935703972; Tue, 06 Feb 2018 08:48:23 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b35sm34971789wra.13.2018.02.06.08.48.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2018 08:48:21 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id A70AB3E060B; 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:58 +0000 Message-Id: <20180206164815.10084-6-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 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. *----------------------------------------------------------------------------*/