From patchwork Sun Feb 4 04:11:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 126796 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp924194ljc; Sat, 3 Feb 2018 20:14:33 -0800 (PST) X-Google-Smtp-Source: AH8x224KlyaUym25zMh+8xpyyL11RquZJwFOpzvoB33sHcJP51bGyZspKPXsxKahsIU/2x4R8nh2 X-Received: by 10.13.223.12 with SMTP id i12mr29500192ywe.385.1517717673090; Sat, 03 Feb 2018 20:14:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517717673; cv=none; d=google.com; s=arc-20160816; b=PQ1PwstoJyeQ5RDtDYPJx2mo0o/qkOPpunA9uRSS+xCfldnVlf3RRDIEV+NDyghVQf 4XCwDxo6NFPYzoidqfE+LCIzTOMKj3vg8YF1ucTCJvnhh4y7L4nLMOvTauB9wz0QYd4i GR/mZuQd0nYfNcY9Xw0eEKrgaXWVad7Qc/Pczzfm+aPMXf5uYioKlqotwyI0sdFZyAXu 1xU1SvoAJj74xKS6GnG5e4I6Lk9K9bt4zL6Vc/W5NMIO02YaoECzq/VAkf4BC4xPWbWI xjmJiV7B8EultGR/7rUaof/Bz04lpN5XPZ/jvDVR5CW2gAUwNQW1/RFNoEPVT4XFm9FU pKvw== 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=HGk+sRcaO/3VZ+HlNs35hRcgSdkKsfPLIie4AKk36lM=; b=TG18/kaxeHPsHIkjqiBBirLHeNkhs/SiikMpN9IsdCv0v5gz/oh4o+Df+NvmU4mApJ e5i7CLAsiaEt71ZqzXIXxhVMoFHUxgE0bIUkESqfXYwzF3DpxLvd9lYnePGuRnBK7R5k iYxt39hNKAZY4QZSuJb9crVJOOzp9wVIUynyZtYja0wCCx2e1XEm/uCHmrhhPEC3bIfF 1v1zKBZ97ZMKDhNbvP5DKp5QomvXGcnO2MB+QJ0OnZkpx/LsdY/MmtqwGLCPWBWfgTLF xNp410Oe96p6qzb8twpC2FO35I2LlrmLaarYOvOFm83MDvgR34M/E6sHbY7Pv77piGWs LMfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dkgT7sLH; 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 a185si108820ywe.13.2018.02.03.20.14.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 03 Feb 2018 20:14:33 -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=dkgT7sLH; 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]:58241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eiBhI-0005sq-Em for patch@linaro.org; Sat, 03 Feb 2018 23:14:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eiBef-0004V8-Et for qemu-devel@nongnu.org; Sat, 03 Feb 2018 23:11:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eiBee-0004qd-K9 for qemu-devel@nongnu.org; Sat, 03 Feb 2018 23:11:49 -0500 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:36507) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eiBee-0004qS-E7 for qemu-devel@nongnu.org; Sat, 03 Feb 2018 23:11:48 -0500 Received: by mail-pl0-x244.google.com with SMTP id v3so9363299plg.3 for ; Sat, 03 Feb 2018 20:11:48 -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=HGk+sRcaO/3VZ+HlNs35hRcgSdkKsfPLIie4AKk36lM=; b=dkgT7sLH+MOxeKUL4GfojQySoD2FWMVc9qvZJUMMQ0hZUphs+vuVaEdGkICOZj+Uib OmHcHQMNgyNvtQE+36iC36Kn2h3iqX84SuZUkMg4R2ZpYmB2OxRMUQKBRHFa1iBOxr2d Si1CRV+Lv+r63x0IcIV7C1Sl560OFuI791nKY= 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=HGk+sRcaO/3VZ+HlNs35hRcgSdkKsfPLIie4AKk36lM=; b=A34nx3g/PTUFVcigr4z4P3kL3uUl0A1tZ+j62tIqvVpxC6Byhwb0nVxeA1cXf3tSyo AWFEvQhl8HfsyicKp2k77C0XT/2kgP9E8fCmhyam4xF0s5SYIHLm6QcDklVW3jw8sUuA aJ4OzLV2CDt/dvqg84bKCBLkVzBOx9D9B4FPAacKKEFSmO0J9oBuKcNWaszbVTPx8YCA t353DvP3KcyTQqv/uzsJnpegp6pEdtSv81gcN2Xpi05y5rfNvhHYghzXDxSXTJVdzV0b vkY15n9gcjwjLEzwErR1UuOmFe5e3yYsSiTbELHKn72ARu/sTW57NYZpoiLFdBBdmAoO mBSg== X-Gm-Message-State: AKwxyteB9gkjrTs5h37zNDG5kuebDpnleJaZMpxV+9sGFttrYGCKXk3J x4WaIewlLukXFOWfRK4Wyeud/f6du5o= X-Received: by 2002:a17:902:6006:: with SMTP id r6-v6mr23300022plj.78.1517717507180; Sat, 03 Feb 2018 20:11:47 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-6-47.tukw.qwest.net. [174.21.6.47]) by smtp.gmail.com with ESMTPSA id k3sm1399425pgr.12.2018.02.03.20.11.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 03 Feb 2018 20:11:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 3 Feb 2018 20:11:17 -0800 Message-Id: <20180204041136.17525-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204041136.17525-1-richard.henderson@linaro.org> References: <20180204041136.17525-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::244 Subject: [Qemu-devel] [PATCH 05/24] 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: peter.maydell@linaro.org, cota@braap.org, alex.bennee@linaro.org, hsp.cat7@gmail.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée 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.14.3 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. *----------------------------------------------------------------------------*/