From patchwork Tue May 15 22:25:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135947 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp82853lji; Tue, 15 May 2018 15:36:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZookcnt4zMbxjRwKHiYHy3vs6hg8PyxxWDNUGQPJ2xzXzXRnUAZm2bdNmJBk1TzKWRInsUK X-Received: by 2002:a37:7f46:: with SMTP id a67-v6mr10098137qkd.351.1526423798934; Tue, 15 May 2018 15:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526423798; cv=none; d=google.com; s=arc-20160816; b=lBB4+CN+2aQN2VNzFCwMxgzyA29XRDUMG7pVBlLDjMD647thQ86ClwgXdn5UslDkyv lvPjoAiSg2eKjYynA0cS4LW1NmMpgNbUaG9Ce8d3Sz67rRMIDt5P+5R5sCSvwpba9+si eQgg0eD82l8mMKKKnCJ/6QXX5iB7RrYJKXQc6jutq1mqPDfilUUEWlvlE7quAywkDcRx hMDsBR8jj7DscvnHfMvPBlAKp1rIjwU0hC9ZQCPZn9m1Y8h5lVI9zrjnfDTHMsvTOZiL Zi1B0G8fb8Wpvcp9x6Vl02UJ3BKeBAiupCIh+AZPQghxx9TAlCLLGIZN4BMny8Qv43Ab ECPA== 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=h62BzzH4LLhuXxYTEWEspmGWZCobGiYio26vYR2atOs=; b=jBWx60vPSmeOut7v+/b+55VrHqjAwvfWSGUAuP+brCra0Sj7+DyVJMqAtHHv+fivPG NExl0FoR84S2Xr3Atr5UPZkPYgvn8yvu7xVSMYN0OPzNomNfwIHi5STY0F7hXZNJ3AR+ OHJRNO3fUtPPpERbO0BmUSGUDDERH7fC7XwSggCTfkKMd6KqWUslxM8Ic/wt/PemtqtS DikaW/cYUSNl7V3b5gNqexWDegsQmFnY5xJ8ZpFmhUCuxCgo5dWp1Q+O2vhwy0YwiBmt jOAsjPC4ybpF33m4UbBKetn/Qfo2dMGdPLY1HhJ5W8BB/kdQl+FHQ2WcB1NQa4VlUc7i Axyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dG/xZhge; 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 24-v6si260570qtu.74.2018.05.15.15.36.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 15 May 2018 15:36:38 -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=dG/xZhge; 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]:36365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIiYg-0002Ux-9q for patch@linaro.org; Tue, 15 May 2018 18:36:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIiOd-0003e8-9C for qemu-devel@nongnu.org; Tue, 15 May 2018 18:26:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIiOb-0007FY-BK for qemu-devel@nongnu.org; Tue, 15 May 2018 18:26:15 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:36071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fIiOb-00076y-30 for qemu-devel@nongnu.org; Tue, 15 May 2018 18:26:13 -0400 Received: by mail-pl0-x243.google.com with SMTP id v24-v6so867966plo.3 for ; Tue, 15 May 2018 15:26:13 -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=h62BzzH4LLhuXxYTEWEspmGWZCobGiYio26vYR2atOs=; b=dG/xZhgeY2F4oeLMMrjrKsM0posSP6czvUIjoYS2uh2eaEk+VhZ7p1Im+mppzx3fGN DnzdZzJByN+uZkqxvKxeKkasHFViG441iyxfELM0X1RW59GXv8KJBOASupfg/DX1lS2j 94xvoG5CSUhY8VW08F/TlQ9CkBDCoaPSG/omc= 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=h62BzzH4LLhuXxYTEWEspmGWZCobGiYio26vYR2atOs=; b=plDoHw847LuAs0avMk/stcQwCseq+8TYP6v9INocRQfOYf35V2/CYqooZtdKAjLBhs 5svuEX4IUvbiY+jgzidmRY63GBa5D8HhLH14qeDb+sD0DCoxvZNctCXV2RaCKv+StAh+ MzQauKRBWw8Lb/7Ljw+AyKAlsddABEGEXIWk8wzAABs5f5UyrEi4WhPdpiVImNz1xlFi F0w+araI54W/BnQgnypTb8W1Rwl92/7TehtW0EaNs/PlOmXaGApnO65wbMI7VfPD/0+C ia4TzJ3DyHepevMViy99aa2El2ek6/Fab7dnlG30A9OLRwXXDlGIllYZEfg6ARYoxLKR IdJA== X-Gm-Message-State: ALKqPwflVQxX+yxJoUTS6T4t5P0JLN6yfQbb8PXrvUN+M2iWTq9rKb5c ntgxaD3TRm7t9U+QeKhis7rj4fVDX8E= X-Received: by 2002:a17:902:8647:: with SMTP id y7-v6mr16127970plt.86.1526423171779; Tue, 15 May 2018 15:26:11 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id g11-v6sm941419pgq.62.2018.05.15.15.26.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 15:26:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 15 May 2018 15:25:32 -0700 Message-Id: <20180515222540.9988-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515222540.9988-1-richard.henderson@linaro.org> References: <20180515222540.9988-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PATCH v6 20/28] fpu/softfloat: Use float*_silence_nan in propagateFloat*NaN 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, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have already checked the arguments for SNaN; we don't need to do it again. Tested-by: Alex Bennée Reviewed-by: Alex Bennée Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- fpu/softfloat-specialize.h | 44 +++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) -- 2.17.0 diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index 995a0132c6..4fa068a5dc 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -498,7 +498,7 @@ static float32 commonNaNToFloat32(commonNaNT a, float_status *status) | The routine is passed various bits of information about the | two NaNs and should return 0 to select NaN a and 1 for NaN b. | Note that signalling NaNs are always squashed to quiet NaNs -| by the caller, by calling floatXX_maybe_silence_nan() before +| by the caller, by calling floatXX_silence_nan() before | returning them. | | aIsLargerSignificand is only valid if both a and b are NaNs @@ -536,7 +536,7 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, { /* According to MIPS specifications, if one of the two operands is * a sNaN, a new qNaN has to be generated. This is done in - * floatXX_maybe_silence_nan(). For qNaN inputs the specifications + * floatXX_silence_nan(). For qNaN inputs the specifications * says: "When possible, this QNaN result is one of the operand QNaN * values." In practice it seems that most implementations choose * the first operand if both operands are qNaN. In short this gives @@ -788,9 +788,15 @@ static float32 propagateFloat32NaN(float32 a, float32 b, float_status *status) if (pickNaN(aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN, aIsLargerSignificand)) { - return float32_maybe_silence_nan(b, status); + if (bIsSignalingNaN) { + return float32_silence_nan(b, status); + } + return b; } else { - return float32_maybe_silence_nan(a, status); + if (aIsSignalingNaN) { + return float32_silence_nan(a, status); + } + return a; } } @@ -950,9 +956,15 @@ static float64 propagateFloat64NaN(float64 a, float64 b, float_status *status) if (pickNaN(aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN, aIsLargerSignificand)) { - return float64_maybe_silence_nan(b, status); + if (bIsSignalingNaN) { + return float64_silence_nan(b, status); + } + return b; } else { - return float64_maybe_silence_nan(a, status); + if (aIsSignalingNaN) { + return float64_silence_nan(a, status); + } + return a; } } @@ -1121,9 +1133,15 @@ floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status) if (pickNaN(aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN, aIsLargerSignificand)) { - return floatx80_maybe_silence_nan(b, status); + if (bIsSignalingNaN) { + return floatx80_silence_nan(b, status); + } + return b; } else { - return floatx80_maybe_silence_nan(a, status); + if (aIsSignalingNaN) { + return floatx80_silence_nan(a, status); + } + return a; } } @@ -1270,8 +1288,14 @@ static float128 propagateFloat128NaN(float128 a, float128 b, if (pickNaN(aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN, aIsLargerSignificand)) { - return float128_maybe_silence_nan(b, status); + if (bIsSignalingNaN) { + return float128_silence_nan(b, status); + } + return b; } else { - return float128_maybe_silence_nan(a, status); + if (aIsSignalingNaN) { + return float128_silence_nan(a, status); + } + return a; } }