From nobody Tue Feb 10 22:18:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151299725207490.34425943932831; Mon, 11 Dec 2017 05:00:52 -0800 (PST) Received: from localhost ([::1]:52603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eONhN-0004tL-Im for importer@patchew.org; Mon, 11 Dec 2017 08:00:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eONdz-0002La-Ea for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eONdy-0007e5-IT for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:15 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:45093) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eONdy-0007dE-CL for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:14 -0500 Received: by mail-wr0-x242.google.com with SMTP id h1so17431058wre.12 for ; Mon, 11 Dec 2017 04:57:14 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 201sm8488742wmm.38.2017.12.11.04.57.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 04:57:10 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id CDF1C3E0992; Mon, 11 Dec 2017 12:57:05 +0000 (GMT) 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=a8qJvGNOHj73yUicqTGoW6jItVWTSgReiBPPFz2yrLk=; b=Ktv/wxD1H2PdhZcXiBa12rQRFBC5iXsSmM0PNtPExSiPxrSc0avcU34rVNEUXR6yF4 KBkivQj2stXv0ciPqnjDp4SV+Cu49srFUQ4/k7NwYdwdPdNomwjKIzcn74F7DvI/RXf/ oi6/tucajccxCaD6WaCW2CS0VcQH2aSU8I6cU= 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=a8qJvGNOHj73yUicqTGoW6jItVWTSgReiBPPFz2yrLk=; b=o7cWHOKXpSwGhgFdP7vFDZKlohpkqYrS2DddPS9I7toSTyLRL8y5txA2e8BpufPGLw Cmx3OorrwNsL1IYSdQn52pnNndZmUcb/dvEHJwGjbcKfXa2Hoi2FfXbzCNszFibtN0YA yg7waHmxjijURrmrObphrHYMcnuKxLx+NAbG3mCoFyYGzINPveIzz6BNVXaOgkn90PcT MFmiqHq9vGYaAXOGjO5siLhRpoKQoAxQIVu9iB7Zo4tRhD//NHmKuKVJctW9bZwksVvv YeMCZS8ylibgcMp1K55/eHk7vcGjrSy1uqcUr+BCYgYuNOFh8FFjcSrYEtq9PmzoNkTM zFKg== X-Gm-Message-State: AKGB3mK1WRMyNRmhxdmVzc0Ne6IL/tWw7/gTE2JMcJwqvtAxZT3zatXj vZIHehHs45N+1yRHcXJpfvnU47d3nYY= X-Google-Smtp-Source: ACJfBouGMIGXYpTTq8P/NbMOpNIVl35ZOPztXKVyQGrjqnK7a/hXvoG5Hp9AdOjNcs0zjlpDQz5dFg== X-Received: by 10.223.158.203 with SMTP id b11mr346185wrf.82.1512997033243; Mon, 11 Dec 2017 04:57:13 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: richard.henderson@linaro.org, peter.maydell@linaro.org, laurent@vivier.eu, bharata@linux.vnet.ibm.com, andrew@andrewdutcher.com, aleksandar.markovic@imgtec.com Date: Mon, 11 Dec 2017 12:56:52 +0000 Message-Id: <20171211125705.16120-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171211125705.16120-1-alex.bennee@linaro.org> References: <20171211125705.16120-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PATCH v1 06/19] fpu/softfloat: 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 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=C3=A9e Reviewed-by: Richard Henderson --- v2 - added return for propageFloat --- fpu/softfloat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 3a4ab1355f..44c043924e 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -7683,6 +7683,7 @@ int float128_compare_quiet(float128 a, float128 b, fl= oat_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. @@ -7703,11 +7704,14 @@ static inline float ## s float ## s ## _minmax(floa= t ## 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)) { \ + return 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; \ } \ } \ --=20 2.15.1