From patchwork Fri Oct 13 16:24:17 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: 115791 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp923162qgn; Fri, 13 Oct 2017 09:30:49 -0700 (PDT) X-Received: by 10.55.98.206 with SMTP id w197mr2632093qkb.292.1507912249162; Fri, 13 Oct 2017 09:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507912249; cv=none; d=google.com; s=arc-20160816; b=aliO0h1LM5glqyOsRvYgAOHEFSieVrmDyD1eq43nxufWQKpBHnBDcqf7aIlYblvgjs BTuT8MjN2KJz3sPQcYsTuvKjmNRbwSYo75PNBKhl4OjXqCg/CTKmDH2wrR1qnDIOmpE0 amIuxwEbn0iD3rI8y8VN2PVHKhKqRv0mAgmMEAf0Ct0Q1vYYa4dysSQIpFH0B5OrQjCn 2j3nH4lutuaeDC9L/+REqr52KYAp8KVXsxoEqQkxaLOhXUDvJDWf3j8D50rKDPlhBc8g MwIV3z/ZHbhkn9YzBRoMlbi9TxEiFe/UMM1rHZJiRZFxukjDP58pg+i6aSfgf3m7KGgR b0BA== 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=HeMI3G4s0BPN1NotGhq0tBi6MXXSlwpVMAwWeGBeoTo=; b=QRGoE4sdKrt4ZCSwGfC9VbeyHfoAjklOKvzOqJKAff3v1MGohd6TsU6Ws8V7qdLUON nCUVhtTKCOgu1Jmr2jiF+1RIKRR9Rj/xCTcOpfiYpz4v5InXSN7G8A97veBLnP/SKs+G p7EoXcBLZ4k9tXjY1df2W8sf+vCkpF+RxIqjZud6BnA6GBiVLmwv2WAryJ4vofPe4BTF cvcVS2Uhwv4xc0/l88eYrlHlUOFy6t5+CMuEUj/hAnSfDOpQh+j6eB636GF2+kkgJZg3 d0S8eTbm3ZeM0XKToBswTjYe0qE5EBm0H+iD8UQ9NOcLVCOdAPkMUJN4nV4MKd2X4N3D pCzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QpslxyND; 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 k40si1137122qkh.8.2017.10.13.09.30.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 13 Oct 2017 09:30:49 -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.s=google header.b=QpslxyND; 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]:51052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e32rG-0007Uv-Dr for patch@linaro.org; Fri, 13 Oct 2017 12:30:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e32ld-0002cy-Po for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:24:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e32lZ-0006bL-8Z for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:24:57 -0400 Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]:54683) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e32lZ-0006ak-2N for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:24:53 -0400 Received: by mail-wr0-x233.google.com with SMTP id o44so1427033wrf.11 for ; Fri, 13 Oct 2017 09:24:52 -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=HeMI3G4s0BPN1NotGhq0tBi6MXXSlwpVMAwWeGBeoTo=; b=QpslxyNDSBZ8lywHLIylgjxkUnzov8qA6ACb5km2okuQKpoES21bCTqeCpN3FjOil9 w8T+ESMF/oGKBY1/CuAQJRGaOYgJW59ONqLuv8H8FQx7jLFuPhTrXXlKSDjlLB4qWezl HS7t92BJnR1IgivEW/8DhLcN710Irmmuf69oE= 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=HeMI3G4s0BPN1NotGhq0tBi6MXXSlwpVMAwWeGBeoTo=; b=ZwPMWOBam4Sf8agMFLQM1z/rbK3QlT1BRvUIL2wGkNKi4MdrYCGgXNvh2DO9qpzJBz QMgPaUy9OZyV5hl0aADxUbLMSiS/1DkfQPuYwoPBRY2Kg4Snqy8rwK4jL8dUx9EDvPnG AsjN6yx/368nCecWWvMHE4X/G4WRQtfejP5+GC+PL9k2SxR5uQKI+sTeme+8+D5uSmDB Db8tMaqbFBqjBazZ5wWlrI4JNwm2EMEKAzS/2//TVtvwihZql/pkhepSRwrM65JE8ujL IH0AgKo5AvxZwLzy5duYRMBSxUK+CQzSsk13T6LtlupioSgcNEUU4bw71Wl+mTaSiOJg qpZA== X-Gm-Message-State: AMCzsaX2pIYZNhwOkl+Gi5iS2XW40rSg3V6KL+o1CONCtKAE7bva9qUB IrhskGFddSUXv8dIzqZfGb5VLw== X-Google-Smtp-Source: AOwi7QCv2o6VDU6p62S36IE40CNFT+E+0I95aKF6OHExxN0YRvcO6aIHvMsMI7WCg44vfP0V2Kj8KA== X-Received: by 10.223.134.154 with SMTP id 26mr2046858wrx.137.1507911892023; Fri, 13 Oct 2017 09:24:52 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a34sm3466724wra.64.2017.10.13.09.24.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 09:24:48 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 131903E0899; Fri, 13 Oct 2017 17:24:39 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: richard.henderson@linaro.org Date: Fri, 13 Oct 2017 17:24:17 +0100 Message-Id: <20171013162438.32458-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171013162438.32458-1-alex.bennee@linaro.org> References: <20171013162438.32458-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::233 Subject: [Qemu-devel] [RFC PATCH 09/30] 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: peter.maydell@linaro.org, qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , 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 --- fpu/softfloat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.14.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 013b223947..6ab4b39c09 100644 --- a/fpu/softfloat.c +++ b/fpu/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; \ } \ } \