From patchwork Tue Dec 3 20:39:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 846972 Delivered-To: patch@linaro.org Received: by 2002:a5d:44cd:0:b0:385:e875:8a9e with SMTP id z13csp714911wrr; Tue, 3 Dec 2024 12:40:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW5zAk9hkKwZrqEXJLfDkYfeaVA+QeRyhL2uY9Z4JS6WTclozjjMY+bi2YyuBOOAyrTeX6WOA==@linaro.org X-Google-Smtp-Source: AGHT+IHrNzokT9MCl1bNDwVdHF/YI4C1myeow8nrfzC9AcOi12ggGvoMsnn0QBH1Ig1+djIurUyH X-Received: by 2002:a05:620a:3902:b0:7a9:8679:993 with SMTP id af79cd13be357-7b6a5d52142mr393304485a.13.1733258446271; Tue, 03 Dec 2024 12:40:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733258446; cv=none; d=google.com; s=arc-20240605; b=U1tLlQxq5wh4cIvIC2wboGydUL1qJQdR7ZYYTKfEODltXS0pLsWDuDAXeQDo8rTZMI IcsSJyh6SutxO3cjQwAYJxbpvnwzfMCWh0whwvvYmL4Fbix9lZxBZVE5MOQ7K2RFGHgf sX4ZgIsccSktV0T+d9VyCSJ/jd3P1sZ/cQeeT7wT41PMBQy11mK7w1qdyueSIG5g300O tZTwLE3FsAXT0hqVaBTDE2VyNMFJUzSRv3N50uioUWZVroJWugmK4IVT6KkyPmYIWcud 5AT0tZhSpomEbqJ8i73Ic36iwA72xfX00Dyrk1hxnssnC1aQOmZ3wp+UVhm6yaP+euE3 NsuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D37F/cHBY8ajgMOC8jexCpS0iZn1VRkSiMEiE7b+toE=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=Jsby7e0oo/gaqB2/N65qioo8sY8TlbUviiWWWW1KPdlYbYMmTfBes3XbYCIqtTBoBL 9AC+wuAk68r55n0yX4Lpq422SVtYL13Dp1S4taYL+4C3DrbuOReNws138WIwr1RsqpDh Fp8AGcgjtdm8b6NftZ0J1cvaMLUHPAB4IH1//pXCcVkoPzU5d0WkleHNlYwuCuZowJQU F9Tj0xHGrLQEFu0bomkJOe57AIbxBQW8UStblIAsxmFg2aQwgZEE6iEM1kAzJ6ibrt1q 21D9mgVW2PnwP3wDsCLNVTzieyfw/0eEc45746bVuciFh/6bVhE3ZaPmEWcNZyyF72qD sY6A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MR1+ZZs+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b6849b4070si1527662285a.260.2024.12.03.12.40.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Dec 2024 12:40:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MR1+ZZs+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIZgi-0001Pq-7E; Tue, 03 Dec 2024 15:40:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIZgc-0001LA-Et for qemu-devel@nongnu.org; Tue, 03 Dec 2024 15:39:58 -0500 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tIZgZ-0003Am-Qo for qemu-devel@nongnu.org; Tue, 03 Dec 2024 15:39:57 -0500 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-27d0e994ae3so3547645fac.3 for ; Tue, 03 Dec 2024 12:39:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733258394; x=1733863194; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D37F/cHBY8ajgMOC8jexCpS0iZn1VRkSiMEiE7b+toE=; b=MR1+ZZs+2k9oa+xItIcaW7I2AzopaIp4ICpGuUnmU/BpxjKTDq7rcfq0+WU5FZI1n/ 7CTwtDkPpJBxc759AaaRZb4n+tVWP0w8OcxhyF1N4ZzuXVQfyoZe2MQyRNqMOnpb2jfu kVD667SnxQVtP0CCQOUyDpXzbalidc4mUcNUYf7g+w0MxNxaPqlaUDhNkCWfOPlR+xt+ saZTeJpG819RnMD+7O8cb1lBOxUQ8413u5v1eoxXXNB0qcbYrG7c2QMZf5Dqwrjo253m Y5NvSegyje0EBYNC3pt8v2vX2fzZ5xDek/AB8Rk2Bsydj3wv1A+Blbd9TseJcaHH+TwI GBkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733258394; x=1733863194; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D37F/cHBY8ajgMOC8jexCpS0iZn1VRkSiMEiE7b+toE=; b=YEdeyg22mETCgiMzIhMAqeKxIoo3YNYU6fHv2zGRTM9/18ebA/6Asp5A12C+b08Ppm 0UPUaNtWDPYIEvo6EiJb1he/FH3HNthgVTwFMB9oUVmk3keJGr9fZwTXBLG8m4h64eAu guMrRxYAVqKtNWqqGgRknkgSh9WgW00C76drjRyy5f3U9tCLvOe65mHkt+OnEq2UNUZ1 Iq2/lZckXndnch85CoRdnDQ2YbWmSe7akfb90UDrWifgg2579Hg17slzsQxwdFHpazL/ sTHnm3IJz8nLTwiJwQcKyjggC0buDCXAM2piC9fDZt8BNHhvl0/O9dJAZe8tLTO9jnjb 8Bgw== X-Gm-Message-State: AOJu0YzBKBVwmk/SJCdHN7xrJhJGXG/H4ZCNTdPHY1abRcjbBD204RUZ NIg1c/yzedAa36vUNrO+4K0C8gjNNXPdg4pjMXWkbGFO8mod6orTXVLCeoBHjwoJyz5PjeA0NSQ yq3c= X-Gm-Gg: ASbGnctxm9fUWN5+n6RM/5e0ynzaAmbdRWIHVhDEMZvpHboACP4i31WKmJZZe6bXmNP sww9uQEmvWKtj1D9VWLqwF8k2KVsRP44sLlbBhVdu7GEfRGqFrxONhXq/erHZDPZLcGhM46o75u uEzN6HpbRvm3TMsbeym7fMVFa4IQO9EKeQkINM6sDPA6Ylnql/b+AZrhhXU0fNpsFCrDgQ7Fnzw PSfcW+Vni/uQUL/VE0x9Sh4xDkEPJ5nzeB8sJOgGW2Pk6FpVq8amQ4aeSAdpWpQZvvo7sn6rH+a wICPEmFgiJ6iN6TnToj8Qq/J/q1Uq34FY7fe X-Received: by 2002:a05:6870:e0c8:b0:29e:3345:74ff with SMTP id 586e51a60fabf-29e886baf81mr5215810fac.23.1733258394221; Tue, 03 Dec 2024 12:39:54 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29e3ae09f25sm2684018fac.49.2024.12.03.12.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 12:39:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 03/11] softfloat: Use goto for default nan case in pick_nan_muladd Date: Tue, 3 Dec 2024 14:39:40 -0600 Message-ID: <20241203203949.483774-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241203203949.483774-1-richard.henderson@linaro.org> References: <20241203203949.483774-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2b; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Remove "3" as a special case for which and simply branch to return the desired value. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- fpu/softfloat-parts.c.inc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index f5c6b21fee..6423e12406 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -79,7 +79,7 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, } if (s->default_nan_mode) { - which = 3; + goto default_nan; } else if (infzero) { /* * Inf * 0 + NaN -- some implementations return the @@ -87,17 +87,18 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, */ switch (s->float_infzeronan_rule) { case float_infzeronan_dnan_never: - which = 2; break; case float_infzeronan_dnan_always: - which = 3; - break; + goto default_nan; case float_infzeronan_dnan_if_qnan: - which = is_qnan(c->cls) ? 3 : 2; + if (is_qnan(c->cls)) { + goto default_nan; + } break; default: g_assert_not_reached(); } + which = 2; } else { FloatClass cls[3] = { a->cls, b->cls, c->cls }; Float3NaNPropRule rule = s->float_3nan_prop_rule; @@ -117,11 +118,6 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, } } - if (which == 3) { - parts_default_nan(a, s); - return a; - } - switch (which) { case 0: break; @@ -138,6 +134,10 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, parts_silence_nan(a, s); } return a; + + default_nan: + parts_default_nan(a, s); + return a; } /*