From patchwork Mon Feb 17 12:50:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 865926 Delivered-To: patch@linaro.org Received: by 2002:a5d:64e6:0:b0:38f:210b:807b with SMTP id g6csp1069079wri; Mon, 17 Feb 2025 04:52:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVhd3Rx4V1do3gWqkHUBkclIGV8qkvQ7/ZFCcRjTIdF828cLnWOyyhZbEs9Tg9rWgb6UZVqeQ==@linaro.org X-Google-Smtp-Source: AGHT+IFpkeAClxdZZFUmk0ogQUx36lqYAaLcml4Pzun79y7w8QiaQd6RsXjZEKXtwUIqJLFVk6fY X-Received: by 2002:a05:622a:8b:b0:46e:2d0b:e1bf with SMTP id d75a77b69052e-471c015077bmr240042261cf.11.1739796771722; Mon, 17 Feb 2025 04:52:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1739796771; cv=none; d=google.com; s=arc-20240605; b=fmQan/YMoFdnpcYWpK8y8eHeZgRkuhRP1nUm63x2rlcEnY3fJpSjkoXq7L90ZeyKgY 5ds3/Vh2BfzlF53FdV6hrnZEsq9sLi8dFyzu3jbfcc1Q2a3lHLNUzb19WzLmgT3a37wd A/hovkpFeKGzJJDGZHXW4GzCBtr0c1eljCVccv1qQaPxHchZE/PfrLRbUY91Lu3fQ3Ba 4++c3ElXrdbSr/hWJRdgmWGyMni4qXZBP6GbvPmSiNRC/CkQckE2+RKzHzNdzQuE/YXq IRIgzjhXd9PDZZkrjrp1XfYxTz2/AX1eeiKF0P84doBHFIStxnZ3N25AE9N0WBMpFa2u /LrA== 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=AU+2tCNu3akZDepHPqncf6ZMUhVIfAv/JNg+9Si1I98=; fh=sX8zUUORJuGQY9ekiqVytwsRQCpKiqNE9LyGNVxaIX0=; b=D9r6PVqy0hQ2VT2FjUrnkUqc5JnuQ+HeY9stSPq80/w8HU3X1/F3ybr71BChSk/NLe IgioM4OwoBKE1qnLJ5rlpcZk9C9vrgPlCmYNrwm9UuZNfFDMCHUVj6jZHzAd+s8N/lMo Ec0X4an3ZKdCddhgHpEzit0+VH2kpM+Lsk/tl/ku3rQI7faRBuMNg+Zeh2JndSdJHE5S l7n1xUHemkL/mZTqHV3jHxFHEXFkeFez13iMJmT6K+u9Bv9+mCni++Vbx2aW/UGjz1cr YJe3FH4l4qOxgS17SFUVAigU+km9kqJhX+D8s6LK0z3bYSd7aBczCGgs19V+XWZqkGJb XtPg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e9yVSPDc; 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-471ea046484si26705241cf.657.2025.02.17.04.52.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Feb 2025 04:52:51 -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=e9yVSPDc; 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 1tk0b6-0001i0-7S; Mon, 17 Feb 2025 07:51:40 -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 1tk0ac-0001cT-Fk for qemu-devel@nongnu.org; Mon, 17 Feb 2025 07:51:16 -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 1tk0aV-0002F7-3E for qemu-devel@nongnu.org; Mon, 17 Feb 2025 07:51:07 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43964e79314so38596315e9.3 for ; Mon, 17 Feb 2025 04:51:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1739796660; x=1740401460; 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=AU+2tCNu3akZDepHPqncf6ZMUhVIfAv/JNg+9Si1I98=; b=e9yVSPDc7gQa3R3CFrEAgnowub4h1Ibmid2Y2iUIxCALzwi48VeTmHBHFZL08g7k1F uRk9o/+uDLzjOGND3ijvVWV2cHuGjvx+TqxSB1edwipQlbdMFavieuN+UG8pAx2jpnrP 2BIWW4Q//ub+u8TFCm/IqhZmFWpeIOHA10bDbOzh9/1J3fyOcuwd6A+hn/9zX//tsQ8L XOho7hJEZcVocn7CKQsRrhADfVon1EsWwqM/8JSJDq5+pcdQ5wAdGysgquBMTQASnr8X H32jbLTENGtxI5zwWZxEK2a0M3HfxeDEnm+3OaB7kxAemESBH1hvs8iZXfaV+gWb+h9s vMNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739796661; x=1740401461; 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=AU+2tCNu3akZDepHPqncf6ZMUhVIfAv/JNg+9Si1I98=; b=QBQQcZF607uspinYInMrrFxTtxQp82ydeUiT/gEsF2daBbcCMXDIXqWrUs68ktjass m9UFRygri/Ug3euZee4aY2Mic2G0A5cBfQwcZdOAMUVGWEvEfzVe/IzxxSwYRkWj46ID SA0AQd7Bqi9Ew8D5M/csZ0eSqbPCOMZ45S780mcnaZ1BngBOcTTMySI8qWR3l6A4Qszw F4iubiRtaeLdIZ/6osoOtIgI5XPXmWBN6l9GcIU+NEj9Bnyi9x8tMYsfa7emSuKtkNvr UNSo0vVgxiATm0V0TxlLjY6bk5NDbyULwmA+ewyNrbQmPUEu+aK/yxFY6i5sz+KOv0Vu P6ig== X-Gm-Message-State: AOJu0Yx8D0Ng5Vk0nDRFq+vTq/Qa7IHWNTAmYtDFhT1StblLow6qFLKj E6IG6TZDuJl/UGRM5rWg0VJOmbBbqboLPLJViPeyu6lx4yXODamp/E2wm2yLsr9oUCO2ela1ElU u X-Gm-Gg: ASbGncsTG/cm6PRAXDXxumzIdin7biEHXgGOR4tEX+HdprU+miAE0sDWceJEkTXCEoy 6vXetPG5XCD8rsdZYQrIJd/PXgGeu2JfLxNbI5x4zIR6VEUjxcuLa61p7FUoh5ir+Mk1EL7+l7X 6VXtlXJzQVqj9X4c/er63Q70GBN6FbB1nn7NP6885Xn8ARxWBJSeVg47thJI+NbrUD054Mehq2y CuQP4osANmrC33mK5C2JBEOwMkgEVjJ3/wE/adVE/iaXC0OuBoWz75MuKRpa9XeiRUqHOGkC0QK NUbGoE4EkoqbiHSln+/Rcg== X-Received: by 2002:a05:600c:444c:b0:439:6925:4d28 with SMTP id 5b1f17b1804b1-4396e6d8176mr91363115e9.4.1739796660028; Mon, 17 Feb 2025 04:51:00 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4398e84efb9sm3562455e9.10.2025.02.17.04.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 04:50:59 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Laurent Vivier Subject: [PATCH 02/10] target/m68k: Avoid using floatx80_infinity global const Date: Mon, 17 Feb 2025 12:50:47 +0000 Message-ID: <20250217125055.160887-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250217125055.160887-1-peter.maydell@linaro.org> References: <20250217125055.160887-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 The global const floatx80_infinity is (unlike all the other float*_infinity values) target-specific, because whether the explicit Integer bit is set or not varies between m68k and i386. We want to be able to compile softfloat once for multiple targets, so we can't continue to use a single global whose value needs to be different between targets. Replace the direct uses of floatx80_infinity in target/m68k with calls to the new floatx80_default_inf() function. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/m68k/softfloat.c | 47 ++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/target/m68k/softfloat.c b/target/m68k/softfloat.c index 02dcc03d15d..d1f150e641f 100644 --- a/target/m68k/softfloat.c +++ b/target/m68k/softfloat.c @@ -142,8 +142,7 @@ floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status *status) if ((uint64_t) (aSig << 1)) { return propagateFloatx80NaN(a, b, status); } - return packFloatx80(aSign, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(aSign, status); } if (aExp == 0) { if (aSig == 0) { @@ -245,7 +244,7 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *status) float_raise(float_flag_invalid, status); return floatx80_default_nan(status); } - return packFloatx80(0, floatx80_infinity.high, floatx80_infinity.low); + return floatx80_default_inf(0, status); } if (aExp == 0 && aSig == 0) { @@ -255,8 +254,7 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *status) if (aSign && aExp >= one_exp) { if (aExp == one_exp && aSig == one_sig) { float_raise(float_flag_divbyzero, status); - return packFloatx80(aSign, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(aSign, status); } float_raise(float_flag_invalid, status); return floatx80_default_nan(status); @@ -442,8 +440,7 @@ floatx80 floatx80_logn(floatx80 a, float_status *status) propagateFloatx80NaNOneArg(a, status); } if (aSign == 0) { - return packFloatx80(0, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(0, status); } } @@ -452,8 +449,7 @@ floatx80 floatx80_logn(floatx80 a, float_status *status) if (aExp == 0) { if (aSig == 0) { /* zero */ float_raise(float_flag_divbyzero, status); - return packFloatx80(1, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(1, status); } if ((aSig & one_sig) == 0) { /* denormal */ normalizeFloatx80Subnormal(aSig, &aExp, &aSig); @@ -610,15 +606,13 @@ floatx80 floatx80_log10(floatx80 a, float_status *status) propagateFloatx80NaNOneArg(a, status); } if (aSign == 0) { - return packFloatx80(0, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(0, status); } } if (aExp == 0 && aSig == 0) { float_raise(float_flag_divbyzero, status); - return packFloatx80(1, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(1, status); } if (aSign) { @@ -668,16 +662,14 @@ floatx80 floatx80_log2(floatx80 a, float_status *status) propagateFloatx80NaNOneArg(a, status); } if (aSign == 0) { - return packFloatx80(0, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(0, status); } } if (aExp == 0) { if (aSig == 0) { float_raise(float_flag_divbyzero, status); - return packFloatx80(1, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(1, status); } normalizeFloatx80Subnormal(aSig, &aExp, &aSig); } @@ -740,8 +732,7 @@ floatx80 floatx80_etox(floatx80 a, float_status *status) if (aSign) { return packFloatx80(0, 0, 0); } - return packFloatx80(0, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(0, status); } if (aExp == 0 && aSig == 0) { @@ -924,8 +915,7 @@ floatx80 floatx80_twotox(floatx80 a, float_status *status) if (aSign) { return packFloatx80(0, 0, 0); } - return packFloatx80(0, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(0, status); } if (aExp == 0 && aSig == 0) { @@ -1075,8 +1065,7 @@ floatx80 floatx80_tentox(floatx80 a, float_status *status) if (aSign) { return packFloatx80(0, 0, 0); } - return packFloatx80(0, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(0, status); } if (aExp == 0 && aSig == 0) { @@ -2260,8 +2249,7 @@ floatx80 floatx80_atanh(floatx80 a, float_status *status) if (compact >= 0x3FFF8000) { /* |X| >= 1 */ if (aExp == one_exp && aSig == one_sig) { /* |X| == 1 */ float_raise(float_flag_divbyzero, status); - return packFloatx80(aSign, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(aSign, status); } else { /* |X| > 1 */ float_raise(float_flag_invalid, status); return floatx80_default_nan(status); @@ -2320,8 +2308,7 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status) if (aSign) { return packFloatx80(aSign, one_exp, one_sig); } - return packFloatx80(0, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(0, status); } if (aExp == 0 && aSig == 0) { @@ -2687,8 +2674,7 @@ floatx80 floatx80_sinh(floatx80 a, float_status *status) if ((uint64_t) (aSig << 1)) { return propagateFloatx80NaNOneArg(a, status); } - return packFloatx80(aSign, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(aSign, status); } if (aExp == 0 && aSig == 0) { @@ -2774,8 +2760,7 @@ floatx80 floatx80_cosh(floatx80 a, float_status *status) if ((uint64_t) (aSig << 1)) { return propagateFloatx80NaNOneArg(a, status); } - return packFloatx80(0, floatx80_infinity.high, - floatx80_infinity.low); + return floatx80_default_inf(0, status); } if (aExp == 0 && aSig == 0) {