From patchwork Fri Oct 13 16:24:15 2017 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: 825583 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="PUWf2U92"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yDCrb2dlsz9sRm for ; Sat, 14 Oct 2017 03:30:55 +1100 (AEDT) Received: from localhost ([::1]:51047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e32rN-0007Ff-Ba for incoming@patchwork.ozlabs.org; Fri, 13 Oct 2017 12:30:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e32lV-0002S2-2Q for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:24:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e32lT-0006XS-Pn for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:24:49 -0400 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]:46124) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e32lT-0006WV-Jl for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:24:47 -0400 Received: by mail-wr0-x22c.google.com with SMTP id l1so1432509wrc.3 for ; Fri, 13 Oct 2017 09:24:47 -0700 (PDT) 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=uzu0EfPAl6ZQEQsG6fFZRrif6loBpwApnK+pLYxHuaw=; b=PUWf2U92u1di+u8UIVYKidFpVWoMPgs8n6BOd3L5lUBTaOrsWEoH9CiFK85yW40W2W 5Y81jVPtWAtLiFn9t5LrQfPyw/7mw+lxkoEdTOn0ttj9/JGldcQTC1uwCPsHPYiA98fe lORQGEgNybMx8R2zIrlBK/3yKdj5G10ccL+XI= 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=uzu0EfPAl6ZQEQsG6fFZRrif6loBpwApnK+pLYxHuaw=; b=LS7a38d/Nyc134ZgAjNTUtkii+SWtw2GBGSLnkZ5nwE4l2A1c0755gEJJUGdOLXD5S 6iyHdggyPuLpcTvMy6h7EKOJwqrvPG5MxRZbpXeIUOxj5kG2QfrtVPCaAHYu9eAiuiAA EMft0zskHy9iEOUaJ2gqddwhYz5h7vnaC4LGqY5R3NjALugBvh5sfhlHSExCgWzgrjzR vMYzVvyFZ2TkcdmQqg5qwLFZhykh6x5ikrrqmKaautWU6If3klTk708+Lrfd4onOhro4 CYhFr3Mhu0p8vgEsY+jjv+juJuES8ciOYhl1lRFVDUAFN27Xz81K2FWF2vm8+Vr5xxRi 9XUw== X-Gm-Message-State: AMCzsaWxAhI4phrc0UU9ioUxso3LEidruId04tqwTwiADOIdHlKIGldU xMz32lmMM1SzhXuvjAyQr/KYDQ== X-Google-Smtp-Source: AOwi7QDDw5gy9g/lqttRcwlYM9iOaOMaboLoBwqZN4XvrMoq7lpS5kDC5cp4VOU2zLtN2yNEpi28YQ== X-Received: by 10.223.135.108 with SMTP id 41mr1825523wrz.160.1507911886525; Fri, 13 Oct 2017 09:24:46 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 31sm1042784wrr.6.2017.10.13.09.24.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 09:24:42 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id E36443E07CC; Fri, 13 Oct 2017 17:24:38 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: richard.henderson@linaro.org Date: Fri, 13 Oct 2017 17:24:15 +0100 Message-Id: <20171013162438.32458-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171013162438.32458-1-alex.bennee@linaro.org> References: <20171013162438.32458-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::22c Subject: [Qemu-devel] [RFC PATCH 07/30] 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, qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.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 --- include/fpu/softfloat.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index d5e99667b6..edf402d422 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -374,6 +374,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. *----------------------------------------------------------------------------*/