From patchwork Wed Dec 11 16:20:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 849206 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp416858wry; Wed, 11 Dec 2024 08:27:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXoWfchMM4eLkCXRX53awog/CDxWmC4iCEwofBy+Fa+UdIYJL5hmAG0XuWN5lVv491gL9Qhmg==@linaro.org X-Google-Smtp-Source: AGHT+IFcCgS/Ij6MGwGxx5EuJw3bBoGJZ+NdNw/Zf+I0tdUOnYOicW3qQixBbbhD60USk4txo06o X-Received: by 2002:a05:6214:21c4:b0:6d8:a50f:b5f6 with SMTP id 6a1803df08f44-6d934b2ce8bmr77187346d6.25.1733934420320; Wed, 11 Dec 2024 08:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733934420; cv=none; d=google.com; s=arc-20240605; b=ii/kWoVTWCuH+zThKh6+fV0KkhBwK6MDebaDd9FuQ80UW+ht3xlI1o7BQrXlWQmKrs OmaTSoZpyx8ufeXbva/aHkQXM+axZZdibk/+m1w7xJbVlSzL1Rfx7+EorcnHJBgSnmMp G905/HaKAUARLstll9f8vqkPDeQvoFh5e+nQQNR9KxYXpbmPwc6BHNtkFp5J1ZUQDEll hEq1hrN8O4J1xN8odQ0vQf1OkrBq7bSFwdpd5P4jARsGnQgehlPCvAPJU0C5hfbx6ogg 8HqVkVcONOjMHqp4mh/KiOFr4DuRFlmHqtKGs7zGu7M84ULD2CoEB6gIFJ6Xj7UphGhC dAvw== 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:to:from :dkim-signature; bh=doRTkzLWp9CB3fDTzYDP5bn9+hyyRKBZGVgyCVKSal4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=cPq5IoF8Ic0M/c6I8AKePZbeToMGai9ZClmh1BfTRvqxOz7RW5KqdKIW+xAsJJX+SV t0U/WajYfn8XxeysWpUIUDBWpU/5+nVotbjSoZWKk9Pay6lVWluCjmY/CDVXckAww4Qw JCV4m3rFrWwzEtMS4bWngTEMV6fhSNz+u/JwwyuEjA1jC1uy00ztPNtMr6EbY9MEcD/p ywyD6o9XjRD3jhSuWpetQU7kmYgB/b6JUO1KSP8p27+xavLnaWWQejmbB4qLtcIdS+0C rUMu+wJ8faSJ0yxSHWSmx3wMV9I9kruC7IKzJkJUHwbC0ph/dETZg0v/DjX5RUgEahsk okRQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sBH+xyer; 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 6a1803df08f44-6d8f37a1560si23223786d6.259.2024.12.11.08.27.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Dec 2024 08:27:00 -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=sBH+xyer; 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 1tLPSx-0002A6-2Y; Wed, 11 Dec 2024 11:21:35 -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 1tLPSo-0001Si-JP for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:21:26 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLPSm-0007uq-LX for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:21:26 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-434e69857d9so5486795e9.0 for ; Wed, 11 Dec 2024 08:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733934083; x=1734538883; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=doRTkzLWp9CB3fDTzYDP5bn9+hyyRKBZGVgyCVKSal4=; b=sBH+xyer+4c0o2Dv1L66d4LSbAgPDGqhduB1yQiyLB2U5HwXBL8Xxp81JGIju5qk8/ gRky1G2woe/gVFMeXpj521j1hA3RoHD14Xh4VHfxUsOKd3d4r0qycblnVjFqtSq+iGv8 +STAuEAHVSBHj6gmFAEkQgmBgrcO+clC6Jc3IUjtargYm1U856w9l30yUVnhGzH1Qru6 VEb1NRMJkWQpg+BPJu8COm6lePsKV/d3aMZKuBi3702Tc8u9yoONvIpJ0Hppv44qsj6s 3PLXOWAv0Skt8RQEtaJMiGLJxnQH44I5TikiG+336IfwI6X56/sPSGtjapNdUb5PNhnt YISg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733934083; x=1734538883; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=doRTkzLWp9CB3fDTzYDP5bn9+hyyRKBZGVgyCVKSal4=; b=iPCc7M3VxV+EUVisBGj6/rZI63YJUETOX2LbISY0A5fz2T4q2thJlQafpaVU80qnof A0KKHrAzeN0Dp0Br5zByxhBB8x2d4PHHMmqrqqSz4vsVgjALXfDcM6smrzpnEqgsakVI rqoUdevRdsjeATrHzYgD+Ktlh/hdB0dZFk+w1D2fiNVpPnyMRbuFYCDIS6NXLa1EHV+u veyO/z0AOkZAObep20AbXCnrt8rOwVtnPiEQs+WSHl/G5iEHkBJRvlla8kgwvuDwzBKC /HvvsFBfugNONc1gmdZiVwVDDM+OrnwfqpRHA1WkCdDcwiKOt8HmET7XvTdWzU83LXds uIcw== X-Gm-Message-State: AOJu0YyfFg3IHN4Vvgv9QsLict1f1gh8i1o1kOOs6gkKoZuXypTe9acR RkiJ4/kzwUpq/j9Paid3sNZj/XwNayaH4WVWEZCwP1yG1as/9QsIhSCzmFoq/lYiw9WQJYdG1BU B X-Gm-Gg: ASbGncupf38z8khJ+bCp2KAku9EMZouyRSK9rm2QVgPHdKcgMooAhZYuKxZQVU845f+ X2VGLduwwYVF/FQLQ5laNkUyHoojxN2PzpdBk9EG4B/UEpj2z7VyHuOeU3R2SknjLruBId/GPys jNWt9Vj9o6F1/6lrQg2M+T0daabfimva0yFQILg5TJ7mwEddcGHyk27UGGbxVr7S8mnXPbPDf2D ouN+K2w30dK1RRVmXBrbrlxn559o0hZ2Z/TCNojTZK/n2+eLyVc5x0goGb4 X-Received: by 2002:a05:600c:c8a:b0:434:fddf:5c06 with SMTP id 5b1f17b1804b1-4361c5b8720mr25750205e9.1.1733934083222; Wed, 11 Dec 2024 08:21:23 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434f4dfdcdfsm121460595e9.39.2024.12.11.08.21.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 08:21:22 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 69/72] softfloat: Sink frac_cmp in parts_pick_nan until needed Date: Wed, 11 Dec 2024 16:20:01 +0000 Message-Id: <20241211162004.2795499-70-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211162004.2795499-1-peter.maydell@linaro.org> References: <20241211162004.2795499-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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 From: Richard Henderson Move the fractional comparison to the end of the float_2nan_prop_x87 case. This is not required for any other 2nan propagation rule. Reorganize the x87 case itself to break out of the switch when the fractional comparison is not required. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-id: 20241203203949.483774-11-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- fpu/softfloat-parts.c.inc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 3c77dcbb154..abe24aeaa00 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -52,11 +52,6 @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, return a; } - cmp = frac_cmp(a, b); - if (cmp == 0) { - cmp = a->sign < b->sign; - } - switch (s->float_2nan_prop_rule) { case float_2nan_prop_s_ab: if (have_snan) { @@ -89,20 +84,24 @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, * return the NaN with the positive sign bit (if any). */ if (is_snan(a->cls)) { - if (is_snan(b->cls)) { - which = cmp > 0 ? 0 : 1; - } else { + if (!is_snan(b->cls)) { which = is_qnan(b->cls) ? 1 : 0; + break; } } else if (is_qnan(a->cls)) { if (is_snan(b->cls) || !is_qnan(b->cls)) { which = 0; - } else { - which = cmp > 0 ? 0 : 1; + break; } } else { which = 1; + break; } + cmp = frac_cmp(a, b); + if (cmp == 0) { + cmp = a->sign < b->sign; + } + which = cmp > 0 ? 0 : 1; break; default: g_assert_not_reached();