From patchwork Mon Dec 2 13:13:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 846612 Delivered-To: patch@linaro.org Received: by 2002:a5d:4cd0:0:b0:385:e875:8a9e with SMTP id c16csp1204993wrt; Mon, 2 Dec 2024 05:28:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUe/4wlUrpm4/aFz50Y5uhy7Gvb66aQRxHeqUY6WmcAXu4KE+WghrLmTEAK1RioGK2V1yz7VQ==@linaro.org X-Google-Smtp-Source: AGHT+IFhCyuoi8YXQHZKjvJ6N90jXtlVpzDzHJ4FZX8N2kQ59mehViDwZhr26U38H3myAJoAHn+Q X-Received: by 2002:a05:6214:c47:b0:6d8:7e03:c427 with SMTP id 6a1803df08f44-6d8b2ff4d13mr4918876d6.20.1733146088228; Mon, 02 Dec 2024 05:28:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733146088; cv=none; d=google.com; s=arc-20240605; b=YBZjRw0ni6dwzL6wo3UFJsKgDH7C64kg9Tnnkd/DWahRS6d+GbJk1iQ0YmMgJV7vjW xEZDOLs4x2hBuxu6chm2j7xlvTKd3DyRxQv0Bh6QH1JWi4z/3J0RdsqbSiXaQ93NyONv hDWpfjsBYdF0XCBTsuqZR/l0/b6OLoQB3tWaPAD/7DtIUF4qPnwlTwVJTFfMycgNJVgh aBYLZGaJhdxy3Z5iWTUMm1nxC69cSrNnRBVuFpVfQdQ2tJD59D4HmTZxo8L2vqo/EMv5 yncTZo6yY4yOCnoJ2XtSc3YR4NRUZMaRZDPyvuUCi9T39FaJxENiBW7QVKz781LtOIBY eF3A== 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=iLWBUHvjOah3un3/57/rPBpB/Wh0uSx2UDmLN935xs0=; fh=QgE9QYJDVj//6C0QJWGeEM+qaFVaxwMel1ZWqkEy6K0=; b=RsYwxjdS5J5j1G+O1PHh/O0ve8u9mD6FZuOYNiYD8Tutrfufa5vH51GAEjBBJF9/SU F4A/vAMpbkJSqkYOZ7BINA1ypb+qSqSkSaMQoV8LhzF+px35JaBj8RODdgDTnom64hF0 /FFiREnWO7qYYnhPnLDNjpV0JSEL2sEdbRpq6iWikhXRvXUbOfSh3nsHbaMghAV3xR7n 3BH3LByq8xJVjYCxwN/oeT5QeLHyOOVRQeNi/9dCz5h9PuLsjnem/RRoKElJNy7UrG32 7dWod80LSDuyyvFipkDmXSZ6UbQSa0TY258acOTH75sRBHbxDaoRuWv6wTr0+MHUChm/ kBVA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z+s9kM6o; 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-6d88cee3963si78629126d6.128.2024.12.02.05.28.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Dec 2024 05:28:08 -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=Z+s9kM6o; 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 1tI6N3-0000sA-Gh; Mon, 02 Dec 2024 08:21:49 -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 1tI6GR-0002GW-Fe for qemu-devel@nongnu.org; Mon, 02 Dec 2024 08:15:02 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tI6GL-0003Cq-9o for qemu-devel@nongnu.org; Mon, 02 Dec 2024 08:14:58 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-385d6e36de7so3706040f8f.0 for ; Mon, 02 Dec 2024 05:14:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733145250; x=1733750050; 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=iLWBUHvjOah3un3/57/rPBpB/Wh0uSx2UDmLN935xs0=; b=Z+s9kM6o4IBZk836N4o9ecJvAypQIOlWG/105jsJUpLKV1Rld8ejoM+QtqvDoeICts Y9H7IJi/6EZ+YAXOj52YJyO+2FInYs2FmAEbhvkgAyX/toedAbAWbiCC6O8gRk6ps4EU wYggH4FXSoVpTSHEF18RnWTvuO1E87o/e8X2VI3nTeEo4G31Q43//pWQrSDkb2jVqDWe qdLQsDmYe1rNiRbMtyQTVig6lrvDZNpDWgpoZ5e9vMTQPDXUF+gafPeGLb06/ENAA0FY //w9SypIbO0TtODNr0mK5qK4kUqKKPtgjhvwT/66qBjy7wlZ8T+TticMXAFvUj8Q0t60 kSOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733145250; x=1733750050; 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=iLWBUHvjOah3un3/57/rPBpB/Wh0uSx2UDmLN935xs0=; b=Szn1mckTmFb0mvkipwVrE0CJaqFROJ0NLTI/Q3YHz79cit3zjlB/k8UL4Z3Sf9rSap DYbZho2AFTYofxJ0BuYF7CzUQiL8DtuoXeNIp8oTGZ5xJ/6v3FH2E9SYuRGVnl/alzL6 9JU2R1E1D34H7C1rjkLxBwzsAW49/9Pd5hjUIt0S60cEEvSMXOHC8iw7ijOXWyionLC4 p4mX/D3ulpBx/gm1eElgasI4ekq7mBxryyy/SXNRVVgz4XAWMBxR5eS3xLANprUGrzlw kuaWDW47d/3QR7+Yg9Xvj6OSssJTe4cvDbaCDKd2qdoKFlzYKd+AGw8RuFcCNIX5xuCC KZCQ== X-Gm-Message-State: AOJu0YxUBzCZAcM7c23kgI4WOurp4MDE8vMqiHe3EAPfTCrR9ixegbKV iGSs8TVTM0vHN/EdnauGtgDrcYV3Rf5JBghxBR4gJLZFnvz87qjGXfiETWDJmMEaOnQom6/wJSY B X-Gm-Gg: ASbGncuMBujYvhxbv/Qjr6m2++WgtwIYgCyBrDwEQQR+A3yViF3hpa45MYOBaU+RjI5 cHUmXWQJa84KO9BESD7rLSgGQOTToam80bVl1BwzmyNmKkdEEhMW3PKKuxH9W7wheDUXMT9f+Wo YfTNob/2mGSE+uzLOaMb2m/G0GZW6SguAA4U78M74Tu4O+8D2/llFWYzF77+SrAjHeEsP3xJMZx kPW7lnQd4slY205M6ffvcU4GeDeN8QSFb+yXp1vyMM8LGh3UIPJcD4= X-Received: by 2002:a5d:6f12:0:b0:385:f996:1b8e with SMTP id ffacd0b85a97d-385f9961e8emr1313251f8f.16.1733145250043; Mon, 02 Dec 2024 05:14:10 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-385dea1e4ebsm10160157f8f.1.2024.12.02.05.14.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 05:14:09 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aleksandar Rikalo , Nicholas Piggin , Daniel Henrique Barboza , David Hildenbrand , Ilya Leoshkevich , Thomas Huth , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 for-10.0 11/54] target/x86: Set FloatInfZeroNaNRule explicitly Date: Mon, 2 Dec 2024 13:13:04 +0000 Message-Id: <20241202131347.498124-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241202131347.498124-1-peter.maydell@linaro.org> References: <20241202131347.498124-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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 Set the FloatInfZeroNaNRule explicitly for the x86 target. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- v1->v2: Update the comment to give the info from the x86 spec rather than a TODO comment saying we need to check it... --- target/i386/tcg/fpu_helper.c | 7 +++++++ fpu/softfloat-specialize.c.inc | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index 53b49bb2977..a98b4f67ff0 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -173,6 +173,13 @@ void cpu_init_fp_statuses(CPUX86State *env) */ set_float_2nan_prop_rule(float_2nan_prop_x87, &env->mmx_status); set_float_2nan_prop_rule(float_2nan_prop_x87, &env->sse_status); + /* + * Only SSE has multiply-add instructions. In the SDM Section 14.5.2 + * "Fused-Multiply-ADD (FMA) Numeric Behavior" the NaN handling is + * specified -- for 0 * inf + NaN the input NaN is selected, and if + * there are multiple input NaNs athey are selected in the order a, b, c. + */ + set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->sse_status); } static inline uint8_t save_exception_flags(CPUX86State *env) diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 3062d19402d..ad4f7096d09 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -490,7 +490,7 @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls, * Temporarily fall back to ifdef ladder */ #if defined(TARGET_HPPA) || \ - defined(TARGET_I386) || defined(TARGET_LOONGARCH) + defined(TARGET_LOONGARCH) /* * For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan) * case sets InvalidOp and returns the input value 'c'