From patchwork Thu Jul 20 15:04:24 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: 108376 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2277087qge; Thu, 20 Jul 2017 08:26:00 -0700 (PDT) X-Received: by 10.55.71.136 with SMTP id u130mr5202255qka.66.1500564360190; Thu, 20 Jul 2017 08:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500564360; cv=none; d=google.com; s=arc-20160816; b=y8jvkkYR2b9HoVjtOlUSSEXH744EHWAf32fYbzudF91hI4dRcdSOk1TdTzBKUF4++M 3AsQ+9RFMygQ3kgrzboK3vROuJLjqLGR4a1lyHriltgiPjLMCbP7M+OdIWXwtz5bo58k cPeZ3LJ/reYWVfxl/nlok9v7N9Uwm+zox6kUmaVeku1jIgAq3NCUTqF9Ltlbl+H0t4wX pH0WFHgipSnSn2Yqjlw44N6+aDc7a5wbxBae5NwgN+UUa5tEiLXV40BpxgLvxYlS359d EhdWkQUgDt2mR7miH3rZhLOm43OcLsJZJpBfb9SXMdyNvF664Mh/4KxQu1DASFBPaxFo gMWA== 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=ugUH+9Lg27t5q3OCTjaQZza+sTjGSEBLGUAZhIqPRzs=; b=oMtypyRb/3ncuUXk0GqsP+C8VBCp6ffQ1kQD6fpJDmoyjBRbTNS+fwEbT7HfEFSoPQ iXKN00xybVWSUdc66hUvH0QVd0uhCY0BNIBWbfBG/JxJ/1cSdBKxCP5rwmDLqHC6u8Oc lgwI6mzt/IkT8NAd2fkGG51Vot4PHkIPJnlyRnIPTqQyzGxlYwpXsklxTRumD5B6WPFr zz5myFWQlBE2+7I3WdYpCZifTwk44r64/0h9/Tz+/4+9B6VAqIQgRvjZ4DRCzwylZ0rs uwgY+AnTJoLwOL7hy5nb1oZPfeUu0pGl53Ca+voX2YrTD8A8LUkesJ3bRf1iE4bw5wWm 6gAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=Qn1eCXqH; 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 m21si2234608qkm.345.2017.07.20.08.25.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 20 Jul 2017 08:26:00 -0700 (PDT) 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.b=Qn1eCXqH; 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]:38611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYDKv-0007b6-On for patch@linaro.org; Thu, 20 Jul 2017 11:25:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55707) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYD89-0003H1-Po for qemu-devel@nongnu.org; Thu, 20 Jul 2017 11:12:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYD88-0004NW-LG for qemu-devel@nongnu.org; Thu, 20 Jul 2017 11:12:45 -0400 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:38164) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dYD88-0004Mk-Dl for qemu-devel@nongnu.org; Thu, 20 Jul 2017 11:12:44 -0400 Received: by mail-wr0-x230.google.com with SMTP id f21so15630498wrf.5 for ; Thu, 20 Jul 2017 08:12:44 -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=ugUH+9Lg27t5q3OCTjaQZza+sTjGSEBLGUAZhIqPRzs=; b=Qn1eCXqHP7U0TmRSJBqGkuDHRhw1YznwoPJ7Rm27mMyiEZKBu+X2I6rGX6IZVO7Ah9 0YBk5FrqK0d3dXtcLkF5YOB+YyFaDCOQOBmdhFsRMxudNL5kIq0IH7W0eUMQVxtvikgy JEnbI6jF/FqszCpltxDe2i+pCQiQZQe76xmFs= 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=ugUH+9Lg27t5q3OCTjaQZza+sTjGSEBLGUAZhIqPRzs=; b=nkavnqcwQGEzKPKFaYi0oy5GBLMJGWeLwyQA+91yURZxOAwcZ8N0QNp/CxDK9eGgWD RRG1jSxQgyy34yi3ixEp8cRKOH62esNXqxY2E36r7uTgqiUZ1sEBad4J0Ehra3g4Vc73 gv3fYsKSb7xrwtGzh84RFsKvj5WVboBFKky07Y2B+FF8AHqV1O0tfK8S90Jn6IdqNM9u aQErIVFiuR8OOQh9ax5txKYYYjlhuVW1NfUYV9RvXPO1Yd6ZH8rLg/0I7qbct45o6jDb 1tujvJ2GeX8kBDDuccx3e77f/qdjUjxNMViFgJDGi9bE4Bp3/I7PlRhNk66F/4s71Fyd xssQ== X-Gm-Message-State: AIVw113OLYmvi4ATz3YZV8/ov3aglIMLDTk61Bkn+y4Esy9BCaMQcGpE 7FSTRfCgmzX85L60 X-Received: by 10.223.179.13 with SMTP id j13mr3195033wrd.228.1500563563403; Thu, 20 Jul 2017 08:12:43 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b4sm3226424wrf.70.2017.07.20.08.12.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jul 2017 08:12:38 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id EC9AE3E0BB7; Thu, 20 Jul 2017 16:04:33 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Thu, 20 Jul 2017 16:04:24 +0100 Message-Id: <20170720150426.12393-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170720150426.12393-1-alex.bennee@linaro.org> References: <20170720150426.12393-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::230 Subject: [Qemu-devel] [RFC PATCH for 2.11 21/23] fpu/softfloat2a: propagate signalling NaNs in MINMAX 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: qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno , rth@twiddle.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" While a comparison between a QNaN and a number will return the number it is not the same with a signaling NaN. In this case the SNaN will "win" and after potentially raising an exception it will be quietened. Signed-off-by: Alex Bennée --- fpu/softfloat2a/softfloat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.13.0 diff --git a/fpu/softfloat2a/softfloat.c b/fpu/softfloat2a/softfloat.c index 67115298bd..5e918cc208 100644 --- a/fpu/softfloat2a/softfloat.c +++ b/fpu/softfloat2a/softfloat.c @@ -7684,6 +7684,7 @@ int float128_compare_quiet(float128 a, float128 b, float_status *status) * minnum() and maxnum() functions. These are similar to the min() * and max() functions but if one of the arguments is a QNaN and * the other is numerical then the numerical argument is returned. + * SNaNs will get quietened before being returned. * minnum() and maxnum correspond to the IEEE 754-2008 minNum() * and maxNum() operations. min() and max() are the typical min/max * semantics provided by many CPUs which predate that specification. @@ -7704,11 +7705,14 @@ static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \ if (float ## s ## _is_any_nan(a) || \ float ## s ## _is_any_nan(b)) { \ if (isieee) { \ - if (float ## s ## _is_quiet_nan(a, status) && \ + if (float ## s ## _is_signaling_nan(a, status) || \ + float ## s ## _is_signaling_nan(b, status)) { \ + propagateFloat ## s ## NaN(a, b, status); \ + } else if (float ## s ## _is_quiet_nan(a, status) && \ !float ## s ##_is_any_nan(b)) { \ return b; \ } else if (float ## s ## _is_quiet_nan(b, status) && \ - !float ## s ## _is_any_nan(a)) { \ + !float ## s ## _is_any_nan(a)) { \ return a; \ } \ } \