From patchwork Tue Dec 3 20:39:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 846979 Delivered-To: patch@linaro.org Received: by 2002:a5d:44cd:0:b0:385:e875:8a9e with SMTP id z13csp715356wrr; Tue, 3 Dec 2024 12:42:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVLJE/ZIis6Lt7+SfrKgJbrk45P5Uo3ZqnhVTfZW2q6gR18e0zue2NMnxfIICrd4rLfNk2a+w==@linaro.org X-Google-Smtp-Source: AGHT+IEsJcYd4kLBhC60KmNwY1LpHWdpjAufOQWyJ/uCBb4YH1bsdsGW9vmcJfAVTcnG/8cz9YMO X-Received: by 2002:a05:622a:252:b0:45f:788:b1b1 with SMTP id d75a77b69052e-4670c0b884fmr42489931cf.25.1733258520679; Tue, 03 Dec 2024 12:42:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733258520; cv=none; d=google.com; s=arc-20240605; b=EcP4kt3zk7R7B9AFn1CpEGHCfH+47WAk+J8J7/LbTju3AGdJEVQMG0QlFD/lDRCSgi o6Mxmm9Q4wlV/nS9UeGvp8audTJluWP/JcflyHIWnsXScg9my/Mg5Dt5MyPpfMgIKVkc vi8BZfzw6dwraBcQ+lCtxq8d4H79Dkw7P6U3TS2p0OVKyhXbdhj5gCKo17eddEdKqqbi eQoz0jfFGtZKsWyBybkwDtI3nl0QUr0Ty2xNu8y+kcdDKQwBq6HehGR8SFOxonM92mZ4 ZNGpGUhEr5QegalyjqMuLanff7v+e80q6GVXSsTKepR4/9eKC5wzbcwjQCnaWr6Dnn3o ACbg== 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=O/WrKqelHnCbtbsQVD2Xt769eF5XVcZugiQlkdqiXsE=; fh=UQCixiNfr28ZOrfhmxiGPA65dFhly8CmRsnoYC6xI9k=; b=XHAwZpEAnbyMgVEGBLW/I/KrOw7YNgWPqgtJGsgdNi31dorvu+F8LYMn674u6gflqA 2ynwLuiL6nQZdjRszYvY8lkrsYW7NX+9GGxRV6FflDfNnw1yhxE5kG4oiYF/kjGQ6Rx3 wsdy4aX3hdpxBB2nDPmWWY+PnDNT2NKwO5yvk8A73NJkwcfbDvbyywvq92hg0JT0PLLC 4sIKg++uz1zIxuAmJXnAV9xtZbHwVmdmFlXlFzFh8PmeqX0RLagLK4V5Bhtws2p53Hew F8eNvdaDYn/Kz7gQ2JBr0TnHm/uNLM2Peu517EDIIuI+2N5aPiLPsszgUlO+GW00sLKT ZZEQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WuoUtc+k; 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 d75a77b69052e-466c4104d03si152346821cf.350.2024.12.03.12.42.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Dec 2024 12:42: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=WuoUtc+k; 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 1tIZhE-0001hM-Lu; Tue, 03 Dec 2024 15:40:36 -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 1tIZge-0001OX-7l for qemu-devel@nongnu.org; Tue, 03 Dec 2024 15:40:00 -0500 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tIZgc-0003BH-7R for qemu-devel@nongnu.org; Tue, 03 Dec 2024 15:40:00 -0500 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-29e5c0c46c3so2265677fac.3 for ; Tue, 03 Dec 2024 12:39:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733258397; x=1733863197; 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=O/WrKqelHnCbtbsQVD2Xt769eF5XVcZugiQlkdqiXsE=; b=WuoUtc+kGPc9t0t7a+YlRfqJ6rgPr2QZWU/oiGcmwPjZZ5c+31ubnjgB+GPENwQNka X2Hqa4wKL1jGBoed8LWfaQ+k1jA455xGsedbbJjDGQm1AlVKZLR+hCxew84AgTEtjPjP JPqlNiZ4UaIhaE4nXS1i+AwtAZ6FcWb07QmlvLYNIuVMIy++WKoXHzEd7W36i16QB+Jm CLpRfaopU5kyS2J00UImVr7cxvVw4wHcmMNEh9ugfKcNdDQB7B9/n4a/JgyWUowArk3N py42ncLmeOsbLnhYLPezHfTs0xX3L90KLAeOhKJEwTxHuRK128jHGf3hV52L7XsFu6R+ C1Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733258397; x=1733863197; 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=O/WrKqelHnCbtbsQVD2Xt769eF5XVcZugiQlkdqiXsE=; b=umQYbtL1838Gb/RkjEIwxFgMGFPYIPFLnujDMa3/WFkl9+YzG28DTzeiDyjZhEbYIK bYe2CEVFC68bS3skNv5TVSYsfYanFAryq9+ep8C5HebtomSMFBvHmhPNy1wcKS6V4Tjv Q+5Hr02phyZP2vr6UWsgPbfUmaVTGBU+efwBwBpNLZ4gCvEBZVP8m/BgcIs4Y4RMe3nP R6J2MIaz4JuX44jjQ7S4AhO7pxMYhT1kFCHASo6xFXlyZC7bPtWx4WCccKcLlocFBoI0 D+/Fcw2LXxvctBm/zBOfnMUU7xzdIGLkn+MMn30le4Rl1rpbVSPTYwDLEcrzZvUanSwD XuBw== X-Gm-Message-State: AOJu0YxmSmARcBsaNoMPO/ZqTvaxoj/FtFzTRMPEXM562cU1ugTT3gKI kPBDbBxq72b+DOwy2ORpcBLemv4glgD/idvxKpUQSny8uYiHSQFjjKrL+IhJx/xBIl0+abdXdbT mKdE= X-Gm-Gg: ASbGncsPb3UA4LcpTvEQ84Z/pxghRIJ/LQFLAlC7OulqRCmTUHqlniB+bdTxwLDr1df gkvIBeBAAWn1ZG8uO99F+Tmaa/EK8BPqUQDZhwW/GENJXdGLhRepCQhNBIZaLug8+oHK2dpzHh0 iOlYG7GKHe/Z5V6s7WikaD5SCOV0B1t1J5rdLiP4zs7OwbmhZmuMFhFPAed5dMFwhheG2PcNgfd pMh0jP5pCTFESYWAGh0Gcj2bBsu4Te+Ah7Lvwg9DRHgSDj1SGu1p/QohlvZ7og3u3Tr4zCIuwEk tNbdP/mgx2dDleaRQ8rKPBXNrYEwOMUG60di X-Received: by 2002:a05:6870:8a08:b0:29e:5a89:8ed8 with SMTP id 586e51a60fabf-29e8863a36emr4100834fac.11.1733258396717; Tue, 03 Dec 2024 12:39:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 12:39:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 06/11] softfloat: Move propagateFloatx80NaN to softfloat.c Date: Tue, 3 Dec 2024 14:39:43 -0600 Message-ID: <20241203203949.483774-7-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::2e; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2e.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 This function is part of the public interface and is not "specialized" to any target in any way. Signed-off-by: Richard Henderson --- fpu/softfloat.c | 52 ++++++++++++++++++++++++++++++++++ fpu/softfloat-specialize.c.inc | 52 ---------------------------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 027a8e576d..6ba1cfd32a 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -4920,6 +4920,58 @@ void normalizeFloatx80Subnormal(uint64_t aSig, int32_t *zExpPtr, *zExpPtr = 1 - shiftCount; } +/*---------------------------------------------------------------------------- +| Takes two extended double-precision floating-point values `a' and `b', one +| of which is a NaN, and returns the appropriate NaN result. If either `a' or +| `b' is a signaling NaN, the invalid exception is raised. +*----------------------------------------------------------------------------*/ + +floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status) +{ + bool aIsLargerSignificand; + FloatClass a_cls, b_cls; + + /* 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) { + 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; + } +} + /*---------------------------------------------------------------------------- | Takes an abstract floating-point value having sign `zSign', exponent `zExp', | and extended significand formed by the concatenation of `zSig0' and `zSig1', diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index f26458eaa3..f7a320f6ff 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -551,58 +551,6 @@ floatx80 floatx80_silence_nan(floatx80 a, float_status *status) return a; } -/*---------------------------------------------------------------------------- -| Takes two extended double-precision floating-point values `a' and `b', one -| of which is a NaN, and returns the appropriate NaN result. If either `a' or -| `b' is a signaling NaN, the invalid exception is raised. -*----------------------------------------------------------------------------*/ - -floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status) -{ - bool aIsLargerSignificand; - FloatClass a_cls, b_cls; - - /* 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) { - 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; - } -} - /*---------------------------------------------------------------------------- | Returns 1 if the quadruple-precision floating-point value `a' is a quiet | NaN; otherwise returns 0.