From patchwork Wed Dec 11 16:19:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 849204 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp416819wry; Wed, 11 Dec 2024 08:26:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXh2vHuRb00xeC8GFALT912Sy7l/h5zHb2yoPiM2/lmlLuMsefiAO5muBmgxSdn0LdIAuKi1Q==@linaro.org X-Google-Smtp-Source: AGHT+IEzX/jnxTls0BlPSKq5WhTm2X0PiBb+fGpCLNh9LQButN0FBP1f1aCNJnA6dDaIyclwCGgm X-Received: by 2002:ad4:4ee4:0:b0:6d8:b2f2:bcb8 with SMTP id 6a1803df08f44-6d9348c9061mr53394996d6.8.1733934416001; Wed, 11 Dec 2024 08:26:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733934415; cv=none; d=google.com; s=arc-20240605; b=HcNxrssbEHDHe2RhJMXmx+vGG/GC1x8CPXBRLmdOAFD59kt43fqXfYSjF6NkovxWgZ 6L2DEUL8+y2b0Vjnp4TWSi7YXn68ECkU/KOg9H71V6Cjve7pyNp9eWUr69nF9bKQC3V0 cnFz7eBk7TwvBKcKC93+1HlQtsH+/hrnPvOyNbJ7hB7QZUGhZQ/ZAkP0ZwhMy93Oe2Fc 8YAF7LadIej//r4a9lS87lSHk4wH1UrW/bC2D6fgwoPPHqWYMGxqJLVUsNdKSfKGVx9D IAHwumH9uvjbNB46bT2A27PIeC5wQ3chHAySjPmSRWogOk+EuPnLTkEZDgJL0/9l4HAY fj+A== 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=ivfNURTgFhMHqj38K3J6R37tOZQ5Ck2WKrXXhbFBm8w=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=hiq0sPhOT5T+9TKQ9oCbZ2WaLoQkEuumi4QCinZalZHMdevgSCuvrfHnsjzCp44YQv 7HRu5wxCUvv28FhafjxM22tzhwldfj3b36XWSjyPywl2fKHaUOLbgq25GLIerMLxsaOx YsKVxPSplFeUcmCF8mE4HBd6pkl5tKJihvydXhPDTiH6KU40ik9dr2RzFczj3At+UYka urUuEPYogdGBY28GVDBtGAhg/jZakwxaaciC34edWuUQGwWJWc83a+VpV/VG8h0Yk+U4 mfPlYXGoM9h/yy+ZiAuY7HS+ecY5JcgQWyDVw9g01D/wjIdX/jgFNhDtwXE4hXUYh1QD 5u4g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QSoBMIvZ; 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-7b6d915f982si708861585a.166.2024.12.11.08.26.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Dec 2024 08:26:55 -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=QSoBMIvZ; 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-0002BT-Oi; 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 1tLPSl-0001M0-OE for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:21:25 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLPSj-0007u6-Sv for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:21:23 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-434a2033562so59608825e9.1 for ; Wed, 11 Dec 2024 08:21:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733934080; x=1734538880; 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=ivfNURTgFhMHqj38K3J6R37tOZQ5Ck2WKrXXhbFBm8w=; b=QSoBMIvZY6uqK4ks02y7HutchLdBV+4sA5uIpZPNu6nBRauXmPOCwr2rFh3eNW2nYc 85o19SGzbrDEFDd1EatRC1MnMJkozGQ25SL3vZi6efgejU5V+tXSOas3qVyEDPUGJhvC 12OM08+hkSpAquy51n87iH/0ElzPwHHdhfSK5LoO+FO6yqpLWStFz65KyUhhYttEaA/8 bCFPZGijem2eQ5reY0afuy9bsfYKfz+BMwmXbW8epZNJa+/LgMF8FJDB8stz30X0RIaz DEqv+GM7XKidT4qxIEYit7NEQL/M0U/ngfbmVdkKzEoChpAFUsUTL3QssQhvucP7w/v4 mSUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733934080; x=1734538880; 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=ivfNURTgFhMHqj38K3J6R37tOZQ5Ck2WKrXXhbFBm8w=; b=EUgWvSW6qQVyCsAbgNo2v9Qp7r/e0P0Q7LkXV/eLWVrkYjbw01VKlluaAAZ8eIYZsD OYPyAr10Y+eXpbqF35Uh+pHOMa+XaKYm/xPLP06NW9R98PnLcaiVjY4rlwvQfnUHCqmV rjCJQX5oaqy+08LjyZnaml7k5SyFb318bjeCfQjtNSCRgf3TQAm8b+lCpPgPlhYc2ok+ tHvwaDTm+8rQt3fCjngWZmlKm9X1RZ/wSuKcQY0jl2BiSDVtOA3nJBXJXAB+m/jDFxOe vRGEu8Gu4bKUXBV7XzCgCHHW3P4BGHOzKlXK+QBc00/i9i6eGyuizKhnmeqKZBQg9PsL Py8w== X-Gm-Message-State: AOJu0YyswZDx2vn1Pdm88+PhoTCwDY/ui0fv39qkaQi6QRoB0XlFwZou Hr7cxZ7PA/jjsIf5qum6xR+99N42E9Y67NN1iPXjDp+4nsTqcPCOULB71lWQemTdLzyCwU4Tcum 7 X-Gm-Gg: ASbGncu1HQ3WAqk4EXvGdZbWuZHG0A0T3b5U5l+Ojr1uxnX8D2vnLrTWgB9Pz2acBNd xQSZBCPT66AcP9H6tATw6+tzCgq1hgwHzfWzkbaNlE9O75sPmOkMR60YMD4b0UxBIJ6kFh2wNmM auwwTaPM197MJYARao7r+jN/LqPqRjcOfBhUKATL72RSwdt3F6/FfZQCGPIrgeqrEdaycFK9CVV LNv7DlB+SBera7KChORkhkPMhZxHV+ZM0E1f+4CpIbGIAuw6lhUQe2d7H9W X-Received: by 2002:a05:600c:1e89:b0:434:9fac:b158 with SMTP id 5b1f17b1804b1-43622823874mr3173695e9.1.1733934080402; Wed, 11 Dec 2024 08:21:20 -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.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 08:21:19 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 66/72] softfloat: Use parts_pick_nan in propagateFloatx80NaN Date: Wed, 11 Dec 2024 16:19:58 +0000 Message-Id: <20241211162004.2795499-67-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::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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 Unpacking and repacking the parts may be slightly more work than we did before, but we get to reuse more code. For a code path handling exceptional values, this is an improvement. Signed-off-by: Richard Henderson Message-id: 20241203203949.483774-8-richard.henderson@linaro.org Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- fpu/softfloat.c | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 6ba1cfd32a0..8de8d5f3425 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -4928,48 +4928,15 @@ void normalizeFloatx80Subnormal(uint64_t aSig, int32_t *zExpPtr, floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status) { - bool aIsLargerSignificand; - FloatClass a_cls, b_cls; + FloatParts128 pa, pb, *pr; - /* This is not complete, but is good enough for pickNaN. */ - a_cls = (!floatx80_is_any_nan(a) - ? float_class_normal - : floatx80_is_signaling_nan(a, status) - ? float_class_snan - : float_class_qnan); - b_cls = (!floatx80_is_any_nan(b) - ? float_class_normal - : floatx80_is_signaling_nan(b, status) - ? float_class_snan - : float_class_qnan); - - if (is_snan(a_cls) || is_snan(b_cls)) { - float_raise(float_flag_invalid, status); - } - - if (status->default_nan_mode) { + if (!floatx80_unpack_canonical(&pa, a, status) || + !floatx80_unpack_canonical(&pb, b, status)) { return floatx80_default_nan(status); } - if (a.low < b.low) { - aIsLargerSignificand = 0; - } else if (b.low < a.low) { - aIsLargerSignificand = 1; - } else { - aIsLargerSignificand = (a.high < b.high) ? 1 : 0; - } - - if (pickNaN(a_cls, b_cls, aIsLargerSignificand, status)) { - if (is_snan(b_cls)) { - return floatx80_silence_nan(b, status); - } - return b; - } else { - if (is_snan(a_cls)) { - return floatx80_silence_nan(a, status); - } - return a; - } + pr = parts_pick_nan(&pa, &pb, status); + return floatx80_round_pack_canonical(pr, status); } /*----------------------------------------------------------------------------