From patchwork Wed Feb 21 11:05:05 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: 129019 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp490779ljc; Wed, 21 Feb 2018 03:06:14 -0800 (PST) X-Google-Smtp-Source: AH8x227/2SooiAENLCR41XNYLKTVvEwJtEVygNbOOQGzxcErwfQ9FWxDTgnq8Hgd2MYQDYxfLD01 X-Received: by 2002:a25:b7cf:: with SMTP id u15-v6mr1946902ybj.416.1519211174452; Wed, 21 Feb 2018 03:06:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519211174; cv=none; d=google.com; s=arc-20160816; b=oKU7m8tRLcgR8z97ci1+rEs+tC7R2W8Cp4Hd25LTcIa8+tdABT6+HhUqsVlQPyuaSk Ha8MjPt2FDW13tVHWmoYMoycxmwrJqLEEFZjkd12Zv4tB0iU28pCjHA8SdrPGDeZpNBV TtM2ww0ecFoPs+gd7RZhobjEh+lhOHTl1NFcvHe5r/opnhRINpdhvLhPxiZNrUrF9X/Z p+QHPfoXNuzZttt7TUzB6Ww5awwqrsPXSXF6DMgENIERH/u9/oMQOwns2Yj0cEfWcxzr 7P01gxVxsD8wBwPiv1OmwYYP+2emaFgoXDT4KujsylvLnnKx682Xka7Fup/B9evOx3po HbNg== 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=52FcgKh5qAB1ULhGmZ/lCIJkVC4Sw7rnuelKDz4ZKHQ=; b=Jf3AM8x8hmzW2Gh3a3X8zUiQDan+PfG7FYp14E4LsTi16CswNxOY38k+IJBOvjCve0 3Pq101b+5Yemg3XKzJ1uFlNlsFKH2J2QIJii8pmgA53GBJ/2qFtgPB5APB3N/m22L4Ds IYIejp8zYV6QsWUJG3KZ4OEcRHh8LXp05MXRbEUAS1CkqdWw5Hx+WbWW8SFdkxwAjHN+ Tvd8VwH4TbdRSzhMwUGTNKkYsvaiKLzMAUtawMhGMbn44Zd6znl0I64uP8iFyPKtfW/5 fg4cdTx3rAVL2nBA4yGrDoeRN1kaOyBjxyGt6VVvGYiLEHWpe1r0xWUPbnqIfWWPOckn xjMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TdODNVUf; 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 b65si387099ybh.679.2018.02.21.03.06.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 21 Feb 2018 03:06:14 -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=TdODNVUf; 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]:60037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoSE1-0003xa-R6 for patch@linaro.org; Wed, 21 Feb 2018 06:06:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoSDQ-0003tA-0M for qemu-devel@nongnu.org; Wed, 21 Feb 2018 06:05:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoSDP-0006e1-7M for qemu-devel@nongnu.org; Wed, 21 Feb 2018 06:05:35 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:43966) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eoSDP-0006da-0u for qemu-devel@nongnu.org; Wed, 21 Feb 2018 06:05:35 -0500 Received: by mail-wr0-x244.google.com with SMTP id u49so3259133wrc.10 for ; Wed, 21 Feb 2018 03:05:34 -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=52FcgKh5qAB1ULhGmZ/lCIJkVC4Sw7rnuelKDz4ZKHQ=; b=TdODNVUfNbIPl8SB1SIP6HyF6vY3EJ/etOzU6FC8C+cbHlk2ATihiUTs5gp5hb5K+z dTUbd6JgNStF319n0OodnBPydE0QeeTr8LosWeJyURFg2p1M6g+Q3cbraWJM9XFftNo5 ExrkN9Y2qOuNEfDl3QZInpYCBHW5IMJ0EStEM= 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=52FcgKh5qAB1ULhGmZ/lCIJkVC4Sw7rnuelKDz4ZKHQ=; b=ld6qe3imEIn268m/OfPI6KbA2VQeC5T9+Po4e02+JRQRk1fbDiUVWy/+CgseHrcJXv HSzBvsHdiEAh7kNwbdiqjlzd7azQGcEFSY2FS2jCVLDH7JU4oiBMGD5kBihQJiQkHTSP YCpNGkCpw17Owo8h8BI0kVJdTDHtslvQUumkGpyB5ALjT80sElO+u4kEpZEarjkGGluV kkoAHcTGjYr54E11xPd0rWw9GHcmVxuYHZDfl3b3J2e+q5h3rkSEG8GEBpvrwOqejh64 4BayOJ0YRtBJKaXn662W4THOppsyfBruQ2rD+Je513knmgp6O1E1YoM070oxJH7lD/Ie lmxw== X-Gm-Message-State: APf1xPCV3Gq1Txi/6UYuk4Q+7AQPCiC7MG1vZM9L/ImAbelZQ/+bwShU zQctNQPl/YGXVmyBt/np8X3H9w== X-Received: by 10.28.40.198 with SMTP id o189mr1678104wmo.141.1519211133951; Wed, 21 Feb 2018 03:05:33 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k63sm19821228wrc.30.2018.02.21.03.05.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 03:05:27 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 9E9823E042D; Wed, 21 Feb 2018 11:05:23 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Wed, 21 Feb 2018 11:05:05 +0000 Message-Id: <20180221110523.859-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180221110523.859-1-alex.bennee@linaro.org> References: <20180221110523.859-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::244 Subject: [Qemu-devel] [PULL 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 -- 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. *----------------------------------------------------------------------------*/