From patchwork Tue Jan 9 12:22:35 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: 123902 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3956070qgn; Tue, 9 Jan 2018 04:23:26 -0800 (PST) X-Google-Smtp-Source: ACJfBos6kcRV+lD0/yKU1/FS1aGdSEeRqpZYaPCWlH/vuZ+6cUAGlbOyAIyDG8Uo/KyeCU5qIJ9d X-Received: by 10.129.122.195 with SMTP id v186mr5077429ywc.95.1515500606783; Tue, 09 Jan 2018 04:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515500606; cv=none; d=google.com; s=arc-20160816; b=H5LtCys0bv4JFb/gEdCkKKnPPg4t3Szo9NYugzjE9nd8FZQjvGfAOtj4vAb/Egz64e sLD0ECC+Xo6X0b5keVfEj/mm7CwqlSitAiaccm0+Fs9/bgOwUCBHLtDj4JdBWZ+5YEjt qO9CWFF27sIJJJ1o1QAYuR/MLr1qhJSBmA8EZZJ6Ujh0n1KT83LZDM9FpS6zfoGNgN+l ggFhPQfWiZ1gwv2Crgj5TdYvQlHLTEJ60vkcq/hy6WQPOG4tWr7vay2QZMPvPSiQd/Bb uuz/sw8YQI1sSrylgMXP2yPEuNCh+BkRCz9imJfemdoC6gqvcMzbxnX4Igroiqkm+U9P gMyg== 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=87/TgytgcRnsZ9ORu6HegwY7s5qXzy9GuhJ9dMbtH00=; b=QrAuHWthnA7l9smRu3J1oaRuXK8ueld1curJGjd1qUlPKfobL9naorJLtscFzN+yVW S8hAm5ct0CCY7imclcNYSkyUzX9d4teL5chekvQr/arz1vdlaAXSUXGA28YO4kjyfDn1 sTyH/q0djkyxSi3YqkphH7qBK8IAPNoNT6IeQHwWn4eLM/m+eO2Uc1f5aWa4WmmmOK9+ rtAK8q+2rXSmqcl4t6Ccg25YF3rKgCHxZcmAYvKcDueWbKGgfj9Kb6im5xfd/+/J8lAu LAvpNCVqHeNobpv4JDzZekyiPRU0As5f7bVhpsvXPGFgeV3msdbNrL41Feax8bUNDl8f +iEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iRaPK+Fc; 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 u17si2927618ybk.367.2018.01.09.04.23.26 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 09 Jan 2018 04:23:26 -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=iRaPK+Fc; 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]:49423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYswA-0006bJ-8g for patch@linaro.org; Tue, 09 Jan 2018 07:23:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYsvj-0006ZF-TK for qemu-devel@nongnu.org; Tue, 09 Jan 2018 07:23:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYsvh-0006J7-ME for qemu-devel@nongnu.org; Tue, 09 Jan 2018 07:22:59 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:40434) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYsvh-0006GN-Fh for qemu-devel@nongnu.org; Tue, 09 Jan 2018 07:22:57 -0500 Received: by mail-wr0-x244.google.com with SMTP id p17so13914631wre.7 for ; Tue, 09 Jan 2018 04:22:57 -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=87/TgytgcRnsZ9ORu6HegwY7s5qXzy9GuhJ9dMbtH00=; b=iRaPK+FcwQ3v2rVbM7YX4acnfLIg9EpUuHJwGySsOLq2EAPmQi5OaY11p2e+vHamAh IGdh6nVLaECMPJ5biYrydtqF8QJLb16AZiFTU3/SupXS7vhY1KR76LMQO8W7WynWYQ0B vvmEaOOxhHBB9/4WXdJvRaGj9JNdq6mo7eqHM= 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=87/TgytgcRnsZ9ORu6HegwY7s5qXzy9GuhJ9dMbtH00=; b=k/Y67SXlVbYOrHXkdAfNYwChWqN68CkO3rDscgL9vji8FeJnettfrbXcHgGgaD9AFi cHdRyzon4ogM6+2QXq41OrsjIzFt0LfoiTCxTkuEP1z8eFhASOfhsJhPOWu6Kuz3fa0S 8YmLNIGTqWVwSjvCYyDV+PsIOiyDW0c0NcURu5rAxuZEMCOhvLVmc58VTohXKqaPWiUC HSBdjcrRlmikzyy8kwWuIhuknsMO/6MEWaVFlLv24V0WlIDpIAwFRKL4wy9HHC+ctrK4 KVHLvgc7QKBqHgA3yaI9kHZG4PvnJtTrCsLNhQtB5a+G1aVNcoGkI3Jv84EQF9uykHuN M7mg== X-Gm-Message-State: AKGB3mI38koaR6I//Ch7d0a3J+n91P04Zv6t9as7UWlyyTaIr5uYKK9m ysXMGf85wnJpSXkniBEuFAdlEQ== X-Received: by 10.223.134.26 with SMTP id 26mr12417119wrv.218.1515500576407; Tue, 09 Jan 2018 04:22:56 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 67sm17436758wmq.38.2018.01.09.04.22.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 04:22:54 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 60ACA3E2A7A; Tue, 9 Jan 2018 12:22:52 +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, 9 Jan 2018 12:22:35 +0000 Message-Id: <20180109122252.17670-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180109122252.17670-1-alex.bennee@linaro.org> References: <20180109122252.17670-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] [PATCH v2 03/20] 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é --- include/fpu/softfloat.h | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.15.1 Reviewed-by: Peter Maydell diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 52af1412de..cfc615008d 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -347,6 +347,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. *----------------------------------------------------------------------------*/