From patchwork Mon Dec 11 12:56:52 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: 121392 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2755960qgn; Mon, 11 Dec 2017 04:59:14 -0800 (PST) X-Google-Smtp-Source: ACJfBovK1/S9D94yEyj8R/+8FNUbrO0nRaVdnzCKVrAsLFM3wY+paPckbEY3PlO1i3o+JawcoK30 X-Received: by 10.129.164.13 with SMTP id b13mr188109ywh.137.1512997154087; Mon, 11 Dec 2017 04:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512997154; cv=none; d=google.com; s=arc-20160816; b=RGI1giyJDakTbAnPCm86lphsEJdICcSJj1E0folFMqmFGLOOZ2+ohtndTBml7jkOl3 yHQOntIZizECFnFZxc/j5x+Y+gJ8fYH1GzJqAsvnS90h0KEKm1PgjJkaulQO06WdVQMM bEdVUd2rYrR5XrXChJZh7wt3Uy1pHx/FINZNFEm3uPNHF5y6iqvdTQLVmENCS+VyhVxG B++g04bzcZiVX/E7yCclB2VPWonOmjpnI1oPXa/ZVSgMEqvbGuOhM7GH0/fovbjeqe3K lRGP0PE9keMzv4THTLcXfYNQq2WPx5v3xGn53oEtPi2e3VAX7jjtTpfiejfdRHrd+YCp LsVg== 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=a8qJvGNOHj73yUicqTGoW6jItVWTSgReiBPPFz2yrLk=; b=KETvwc6neBwedLXUAhgYwnIlaqjd+WYWfQjpOOP6slGRbvi2KZfbY8DkUQOid5B/a+ egWWIlDBZlc/mFqVzY82tg6oyHvbDc90oMgdD2XxeKPNKPEQhOgNupBVn2c4xxXEUjBp RSUSk1xkWoztgGEevRUpZNl/TEMsEkvh1b0w3enLmvXdZVHZujEDuWuXu+lx23tpVD4F K9TR58HISXj9DhO30JZlPc8o9uTv76eTqQqzLYRD5zmbY5RBEC7NkpOObnvvOZopd4aK kg2UiPQflXpGKbchObSXfU1IuF2REbHMIWEO7b/sMFPqMRl/JyENpx2i2Nrg0pdWWp97 ufhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ktv/wxD1; 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 t16si2875878ybb.34.2017.12.11.04.59.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 11 Dec 2017 04:59:14 -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=Ktv/wxD1; 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]:52590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eONft-0003dt-FM for patch@linaro.org; Mon, 11 Dec 2017 07:59:13 -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) 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-Received: by 10.223.158.203 with SMTP id b11mr346185wrf.82.1512997033243; Mon, 11 Dec 2017 04:57:13 -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) 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, 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 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_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 --- v2 - added return for propageFloat --- fpu/softfloat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.15.1 Reviewed-by: Richard Henderson 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; \ } \ } \