From patchwork Tue Jan 9 12:22:39 2018 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: 123908 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3960803qgn; Tue, 9 Jan 2018 04:28:28 -0800 (PST) X-Google-Smtp-Source: ACJfBotCdU/qdfliJAQADOe+PNpnv20aeBfXvv17cHgq2NLUpY4tS2iJ2dKjEMa9J+mf45DInYCJ X-Received: by 10.13.222.130 with SMTP id h124mr13509629ywe.217.1515500908620; Tue, 09 Jan 2018 04:28:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515500908; cv=none; d=google.com; s=arc-20160816; b=rAAHyF0wJFs1sCz8O7h/GryEW6TXesQkKvW5EonZrP/U87jqRwt3Z+FCqJI0Zo9LYh a5fpITJi6nkDtIe9mXya/9bEzyGSTjyNDgZAaZc3PogzgONWWrSW4OOmINdeRwZAESBV 3vtMAdrUj94NMkB2nIthvCM9x0c9NQtuazNo0h9zyUDbiSjsUdIQF3YNzTbgxju1y8qs IyOpL2vsUuX/G+kebi6eB+4iaFRcCJE8lPSqMvbdtmJIFOK0y8bNYBl7FM3QBA1f0W1Y IHmfqbPkYcQD9Hv3Zlw+FfqoGUUCLGUSA7RZZ4S/akFEeN9BJBD7VRXjw29n32kjgwNu PoZg== 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=CMj7/OCLKuOKn1F/BoEznnKNy9Zs3Wj1+nU1V8x9KRo=; b=UAIuI5EyxrmAIP0C+Wgk29EOj5YZUqqSR18YU0nd4Mm9xWPzQpqE98q/LBOYDrSUWn QHVKArv4n4+YroJLVyFB/ClQPwP/XjzRRPLb4M7bvNCU9aOeVNI0pHzNTpE4INjSSgx+ dtu4iR26QD2gNFP5xyjdjnOyXDoTFoNMySM9oyB9eF8vulTEQN8lLB6Grzxz6JKXduTA mVAVEHM8ExNEmajf6WnGHNAnUbBblmo89EpGxdjZ55w0XrQNyWWdNroXI0JXuaasV3fq IWjip3uZ5IXKxDo055Iuh2h5uJ2Eui3wo0lGDMLmLkNaHM+R2C0p9ienc94To/vPxTTu yoZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ayaBk4gP; 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 g62si3039867ybb.592.2018.01.09.04.28.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 09 Jan 2018 04:28:28 -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=ayaBk4gP; 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]:49509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYt12-0002Gl-2n for patch@linaro.org; Tue, 09 Jan 2018 07:28:28 -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) 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-Received: by 10.223.164.148 with SMTP id g20mr13218352wrb.177.1515500582427; Tue, 09 Jan 2018 04:23:02 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno 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 Reviewed-by: Richard Henderson --- v2 - added return for propageFloat --- fpu/softfloat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.15.1 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, 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. @@ -7703,11 +7704,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)) { \ + 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; \ } \ } \