From nobody Tue Feb 10 17:08:02 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15155010102741003.0835625873594; Tue, 9 Jan 2018 04:30:10 -0800 (PST) Received: from localhost ([::1]:49523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYt2V-0003O8-3j for importer@patchew.org; Tue, 09 Jan 2018 07:29:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYsvp-0006ed-8C for qemu-devel@nongnu.org; Tue, 09 Jan 2018 07:23:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYsvn-0006d8-Ow for qemu-devel@nongnu.org; Tue, 09 Jan 2018 07:23:05 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:44851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYsvn-0006aT-Hf for qemu-devel@nongnu.org; Tue, 09 Jan 2018 07:23:03 -0500 Received: by mail-wr0-x241.google.com with SMTP id w50so4697081wrc.11 for ; Tue, 09 Jan 2018 04:23:03 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id j132sm1629257wmd.7.2018.01.09.04.22.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 04:22:59 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id A33343E2B4A; Tue, 9 Jan 2018 12:22:52 +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=CMj7/OCLKuOKn1F/BoEznnKNy9Zs3Wj1+nU1V8x9KRo=; b=ayaBk4gPi3IEICu07geC1ugd1Lo++/gA4XvJ/3rZ/zCcRiK6yDl49SInXhTUXFWOk8 m9r+QAbdPY7wGvgbrdzumPBUNZnwtD0Tq9Qz+C4D+hksAKZBnAnxdagEMhhw9fVISIC7 Mj9qRQUjKBuV2Qksh2p2boz008Ur83rBQq4nc= 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=CMj7/OCLKuOKn1F/BoEznnKNy9Zs3Wj1+nU1V8x9KRo=; b=TiqThbdQ1NKrERK/xA5rrwOmjmBp/gCmIaW6XGQI4TUhj2L3hxBTsHzJvsoSCyHcn7 1eXSlYUqLzNjLInpiliZkgh7CiCeRxS3maQEsAT/Lb4eyugPwiQPCCjrIgzq1Rz6gYrA /1ZFErtOUH8HebNbqATa/rfDsbankSqOtuzq9RFQTz6MzqsU6n5ZS9RZ+cxDOVXpl9fW kGbp85fRYv0Te51VUc5tBYff+CigRDpYxMLjC5z2xVZ5tZv15j8Pra8Mp+uKnQhjjplG 1HSr+xCzuUjNRkKqt9/zcembrNfBIZAJ4oYMOYh3FXFY7cRpX3RLotDLCo6esIXCuhs8 ueig== X-Gm-Message-State: AKGB3mIeeKk5O9NiShvHz6uiGNq1LvV6k4gT5qKoA68FPkCt0jIcybM7 bmL6Mz8P1qNvt6qQ8vibsT7Mlg== X-Google-Smtp-Source: ACJfBos6QH69/L3gweEsoDA7/A/CRTvTHmv8kNdHe6V0rdyntIfr4hmY/n1HtiwCjI/MsG0pEuH3Bw== X-Received: by 10.223.164.148 with SMTP id g20mr13218352wrb.177.1515500582427; Tue, 09 Jan 2018 04:23:02 -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 Date: Tue, 9 Jan 2018 12:22:39 +0000 Message-Id: <20180109122252.17670-8-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 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::241 Subject: [Qemu-devel] [PATCH v2 07/20] 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