From patchwork Fri Jan 24 16:27:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859557 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp879524wrq; Fri, 24 Jan 2025 08:29:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVvS3Jg9+hWV+gV2OCrANmGixUizXr8hQJGOk43zEOfJO2Q7ZBdGeOvZYln9i5wxZ3dnms+wQ==@linaro.org X-Google-Smtp-Source: AGHT+IEVMIS1GUkWJaB88n1bNjrB0EgMCtSezoWpnfoXTlKCLfsGXYzUqu+4INC4OX6R/k/ozqJp X-Received: by 2002:a05:6102:504e:b0:4b4:695e:f17f with SMTP id ada2fe7eead31-4b690990815mr29471712137.0.1737736141719; Fri, 24 Jan 2025 08:29:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736141; cv=none; d=google.com; s=arc-20240605; b=R+fxQsHJp1/4cIavIDMOCbua3vOcOEXU09lNi73itBA1WcmI6cvT1Q7MgndljNJmgq S6ywfsB7Cc8YByaRtfs3Piw9QT2i9pOUKau0CO29I4FoOYMtRq4Hv3PaNF9Mw/hPQuZc y8tZRqPmfCDuqAyqRAIGY0SPxNWh7qzWqbE8wWAMdVDH5DH76LTvrsD9oHnV9LDKNP/T ohbSj6ivpZWXFuC5JCD79qCTITIQH+kR03HkyP3egGOPzJasxtwX2XXWR515QC+SB7AS 0N4PgjEhc4eVv1IFNHzg7wdVhWo4tqIz0PdL3JtNpwpOT0zEW6HA23+aNKa2xeEVRbeU EtXA== 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=aZAtVcMAZKjHRvt52hIevKlBELo2Ys5/XXx3UpdxpVg=; fh=SAarn/LJfkobZksFl6x8SHK+vbqrXSni9ntGRdr4p+U=; b=DiXwXY1ZEmwBwCNAMICQ4Ygz+vqpVG0IQPXvXX6gS+NBU1Cq4bBP6guRAu/pLIeU5E Oq/lSjyBoSxXSsl7uf2AYqIFCKf3bUg1wYREix+LKaHetYYO4wcNGXQxeeOnHanexNa2 GDmn0O43AVRQKOMst3vEXOMJMxUYI0gjVzYt4TDQkoUwnB6EujrqZDZ+m9Xdh+ISKR6w JPC0dsM7SGcDx/k/X9bslslIotaMWrNQ3OXV0sOEwqNqZdovpYFQ3+i+Z807F4ajFmQb ix0P76C2phciI0LyqOB2NiBFmSsvzrPP1uUjFfH4y/Nhcmwstda5oJ5y+M3ePxfqMMpp MKQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KKDa7+LR; 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 ada2fe7eead31-4b7099ae006si810025137.455.2025.01.24.08.29.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:29:01 -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=KKDa7+LR; 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 1tbMYG-0003jD-5p; Fri, 24 Jan 2025 11:29:00 -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 1tbMY6-0003Vo-Rk for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:52 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMXy-0005LJ-HY for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:45 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43634b570c1so16737145e9.0 for ; Fri, 24 Jan 2025 08:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736120; x=1738340920; 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=aZAtVcMAZKjHRvt52hIevKlBELo2Ys5/XXx3UpdxpVg=; b=KKDa7+LROzcessQPiB6IqGJhJMGxrlkhFDa83Iobu+rOPy2vqNu+6fwEW6nPuIUhoS EQCTqjuNetmlryARHaDbFv7ZoyvCtgoZ7cdfWeD6J3tUEtuwFrYe/JaI6SqsNObarZDz xVwRIXecz6UxOssb1QBRK6E2qbgEbBIFxpVQSwXRV5rFdo738NGjyEPs/s0gpqXwicQn iopuWzdXp7kivGwS3onsOwyyY+c6BO11FWnWrCafCIRBFUteGRokPn8shm0StY6tgBGX 7sa5DagaSBHm+0ZuO/8+tkOrDKtNwlyUbqr+z695tJVhI0jJh2rVV6v07PwN8y/5R67s R4Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736120; x=1738340920; 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=aZAtVcMAZKjHRvt52hIevKlBELo2Ys5/XXx3UpdxpVg=; b=V5nPs5SwgWGczV5U6Rv6XalKMa8bLc+Z3SQ4HJ4+yjI9o8EC5kuQRggdCdc+X+Dexj gHrNOmIo5cvWBMu7YsGovSHmBVq+eQ4GFzZGi+sNb4S5YZ7sVhF3xNo4SVvW/IXel7Wy NnX7a43Lk7XsxI/puGUKXmWDQRL2qSEGnqHC+InAj2PSuZyjYafRa3QisYQRW9Er2CpK XPUa5V5aubyclxZEE7gVY8icvGaboy5gIeuIl3lpYModwuiP2pPM3wuD7HgcoM9jkzSN 9AMvsUvN/9JNd0En4ubsSuCSYfAFMIIWjN03ae18G7sdTKCHLJvS0L2QR9e0G9rk4bTr rq0A== X-Forwarded-Encrypted: i=1; AJvYcCUNGY1FOWc6EG4Mq+a0VWfVWMt0TLgmKj2ceTQA8X8HFv9raK5GJ2WdrmoHUerq6Qak0ALyLqTsD1zn@nongnu.org X-Gm-Message-State: AOJu0YxMbZGEor3pYYbQkm4RkqFuc/6cuw215ElRGIvAaDWZ4vI8YgRe lIaANU71Psmz0xnBWukiGs0dkkJIGRTAGyiw8qcMmZUXF3N91oU07vkfw68iLvk= X-Gm-Gg: ASbGncusKH/wLdqIB5bQKu+4UI/T2xiouBIpqczDfSqbgvmgXm+ExrrDz7F4JGI2w4n JTqhzrjBGuUciL5KFF9nl8bsTtXgf1u3xFe13eXNgadGJZWqB89u9vEOqfpPidVsYf2onhsZUN5 gKNkgSlPxaHX3OOW5Hh6pzg35gk0mVz7DnvR9NAYvCn4BxLSiUO/vZs7qjGMmfq/9LOluXGizLT uwjZXZ2KWgPb6+8PzzcOGKBEFypIE7a+m3zN9nhoUwVujjh8ynNB4QY6AdhtWg4GvVftMtJCy9k nGDUPtpbDY4= X-Received: by 2002:a05:600c:1d1d:b0:434:faa9:5266 with SMTP id 5b1f17b1804b1-438913e79e2mr281251225e9.13.1737736120003; Fri, 24 Jan 2025 08:28:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:39 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 01/76] target/i386: Do not raise Invalid for 0 * Inf + QNaN Date: Fri, 24 Jan 2025 16:27:21 +0000 Message-Id: <20250124162836.2332150-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 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 In commit 8adcff4ae7 ("fpu: handle raising Invalid for infzero in pick_nan_muladd") we changed the handling of 0 * Inf + QNaN to always raise the Invalid exception regardless of target architecture. (This was a change affecting hppa, i386, sh4 and tricore.) However, this was incorrect for i386, which documents in the SDM section 14.5.2 that for the 0 * Inf + NaN case that it will only raise the Invalid exception when the input is an SNaN. (This is permitted by the IEEE 754-2008 specification, which documents that whether we raise Invalid for 0 * Inf + QNaN is implementation defined.) Adjust the softfloat pick_nan_muladd code to allow the target to suppress the raising of Invalid for the inf * zero + NaN case (as an extra flag orthogonal to its choice for when to use the default NaN), and enable that for x86. We do not revert here the behaviour change for hppa, sh4 or tricore: * The sh4 manual is clear that it should signal Invalid * The tricore manual is a bit vague but doesn't say it shouldn't * The hppa manual doesn't talk about fused multiply-add corner cases at all Cc: qemu-stable@nongnu.org Fixes: 8adcff4ae7 (""fpu: handle raising Invalid for infzero in pick_nan_muladd") Signed-off-by: Peter Maydell --- include/fpu/softfloat-types.h | 16 +++++++++++++--- target/i386/tcg/fpu_helper.c | 5 ++++- fpu/softfloat-parts.c.inc | 5 +++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index 9d37cdfaa8e..d8f831c331d 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -278,11 +278,21 @@ typedef enum __attribute__((__packed__)) { /* No propagation rule specified */ float_infzeronan_none = 0, /* Result is never the default NaN (so always the input NaN) */ - float_infzeronan_dnan_never, + float_infzeronan_dnan_never = 1, /* Result is always the default NaN */ - float_infzeronan_dnan_always, + float_infzeronan_dnan_always = 2, /* Result is the default NaN if the input NaN is quiet */ - float_infzeronan_dnan_if_qnan, + float_infzeronan_dnan_if_qnan = 3, + /* + * Don't raise Invalid for 0 * Inf + NaN. Default is to raise. + * IEEE 754-2008 section 7.2 makes it implementation defined whether + * 0 * Inf + QNaN raises Invalid or not. Note that 0 * Inf + SNaN will + * raise the Invalid flag for the SNaN anyway. + * + * This is a flag which can be ORed in with any of the above + * DNaN behaviour options. + */ + float_infzeronan_suppress_invalid = (1 << 2), } FloatInfZeroNaNRule; /* diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index d0a1e2f3c8a..e0a072b4ebc 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -178,8 +178,11 @@ void cpu_init_fp_statuses(CPUX86State *env) * "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 they are selected in the order a, b, c. + * We also do not raise Invalid for the 0 * inf + (Q)NaN case. */ - set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->sse_status); + set_float_infzeronan_rule(float_infzeronan_dnan_never | + float_infzeronan_suppress_invalid, + &env->sse_status); set_float_3nan_prop_rule(float_3nan_prop_abc, &env->sse_status); /* Default NaN: sign bit set, most significant frac bit set */ set_float_default_nan_pattern(0b11000000, &env->fp_status); diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index ebde42992fc..4bb341b2f94 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -126,7 +126,8 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, float_raise(float_flag_invalid | float_flag_invalid_snan, s); } - if (infzero) { + if (infzero && + !(s->float_infzeronan_rule & float_infzeronan_suppress_invalid)) { /* This is (0 * inf) + NaN or (inf * 0) + NaN */ float_raise(float_flag_invalid | float_flag_invalid_imz, s); } @@ -144,7 +145,7 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, * Inf * 0 + NaN -- some implementations return the * default NaN here, and some return the input NaN. */ - switch (s->float_infzeronan_rule) { + switch (s->float_infzeronan_rule & ~float_infzeronan_suppress_invalid) { case float_infzeronan_dnan_never: break; case float_infzeronan_dnan_always: From patchwork Fri Jan 24 16:27:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859570 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881787wrq; Fri, 24 Jan 2025 08:32:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXWWGXbEoLZ5QFo6YW8qqJox8NtPxmaHPrYi3f1kQVj78eVtpn65LSqEfjaaESsirwH7eriQw==@linaro.org X-Google-Smtp-Source: AGHT+IEOYNlCtz92NQuI19mwqTIcjtoAK8joTTaZJhPBdw+WPKNpcpFc99IhsOTZM2DGIPjNvUKR X-Received: by 2002:a05:6122:8ce:b0:50d:5e21:ef39 with SMTP id 71dfb90a1353d-51d51b65ca7mr23762762e0c.1.1737736371539; Fri, 24 Jan 2025 08:32:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736371; cv=none; d=google.com; s=arc-20240605; b=biaHQ4f0qnBJ8ORLzI2QeU4iJJ8l92VoFrOb8O8DEBtutDYxKq7kueZMzxBdN6u3Wl yIP+LeBmjVXWsRfIycJlYi21g6Fki3AhODrYjHHdZv58sFDxMLTtGxuytnBnN/e6BIpU XfyjHaHC9oTwY0JFRDKMDAUVzq7VMU8R9TDxCk8KOPG/e69hWpUq5BEckSw9JvI8H11Z 7YadZ3bZEpKljPfxqrP6xOcrApOgcEpZiNIXkHEn7gnC50WgiCfNiprqukvir1HyA4XI Ly528EhycnRE0WJHNW7xolCsF4RRPRyOqpIUGIgKbJbcuAEAIlQoU11fNEiZwoo9Efa+ fIQA== 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=cIp/ry/DGiFODjiThDZlgJEFjr5yBLQ4629/fR6TMgU=; fh=SrcXO4O+xZDWjLKLO0UlQPvhNahfMo3l5+mwKI8/GaA=; b=JdVQzLUfIHtJN2LmjcBgmTNir/Yo4kLTEp0xt2veLGTGRds3XGC8LCdrNgeW2wuZHm Xagr/m4fVbjgwXbYNdOANlXvDZwRKClZuuLJbUYlP14/LuS+3OUEWExemQYruStQkkrK vicfbHW1W8ivq5oVtJtaJHmTHUl4CEyMW4Hm+RRcpj9mrgTS28Le90Idc0T9eUfU61uq T5wtSPAHrkI0R2QFQGYcB9mivkA69guFW/9jZqkpidtEltx7ApVlSYemMDwa1cgXNwOY SNKCT2HtYIBKBl5/UWEiJxni8FGjakThV5HTn3Kvp5F0FzJfw3+wioJSRZpRDl+NTMjg hIfA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eyt0uoBf; 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 71dfb90a1353d-51e4ec4453csi1145855e0c.163.2025.01.24.08.32.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:32: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=eyt0uoBf; 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 1tbMYj-0004bb-G4; Fri, 24 Jan 2025 11:29:29 -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 1tbMY7-0003ai-J8 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:52 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMXz-0005Lf-P3 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:48 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso16639895e9.1 for ; Fri, 24 Jan 2025 08:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736121; x=1738340921; 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=cIp/ry/DGiFODjiThDZlgJEFjr5yBLQ4629/fR6TMgU=; b=eyt0uoBfDPexOTWkAA62YwpBXmkPpUJse9P0JcMVngJSYcrbdVjlt3s3DlxlxS2coM L8lNUilQ191LUpPCl035Fq1Avpm6jdm6qJFbe63rdG3BgG3pdDxJ23KGGbuBdB55twrV Zr7Z+CaaY2knhoCS1uW1XIk8YE8tZtse6e0V7DKxiDWNewez3KyJ/uEBSD5KgIkxmuk+ lgS6kpbkxIqR6RksmbNOm0K04fkiQCfAg5vwH4XuQIs9DIy8LViKExN4LevSIiAo44Ic 3CPDkGPW5KMhZpbvPXm06SZjYcE+wKGUWtOcDXiZRxQvRvupAtV4P4JE/ZhbRzI25iv+ qlkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736121; x=1738340921; 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=cIp/ry/DGiFODjiThDZlgJEFjr5yBLQ4629/fR6TMgU=; b=s6fOhMEAavupJ/W6nHiFvSTGSYK+IJmOqbEbpg1vxk5N/MlP7PxIZpR4lJuHz/x1Nc OHuXUUSelcd9gk25fshouBpZo7F2FvoQeXLSPll1nrQBbGjG1raojoxZ+1/IGoBvYmNk oy6J5okPZLLbQzPthOW7DZUtJGoCAfjU17GOdeKVFrOing807zseIEKX8nZQTyJnnHbQ 4hv5iJyN1opiiD6Pq+Yxsy22iF5QeDXoub/xhefKo75i6qUFN2a/Ve/qcUqB4WeyNDiC OnbDAqzhzVwsxvtv8g1hO5/w2hOgjMLTtVLo9iZiujFgHac8BdbqcPZ1OkYoVKaSL+iK q3qA== X-Forwarded-Encrypted: i=1; AJvYcCXsRYG2Bd2sYfSHEVky2ZgoNqpLhL2A3TRM/u9rJ5R0wEvzSaVXnKmg/6dPbPxsqIKVQ41/IsKopwfG@nongnu.org X-Gm-Message-State: AOJu0YzCcOVBlKEkQJoNWQYwOSTKwv3TqVZL9mVJDTmMtt5EMCwcbXGf XeNCVL0hUFl3tpAUxcSn0qlp9mC1KAl+UbdGY1hfZ/0e5ztxD4sbinGCUx+lwSk= X-Gm-Gg: ASbGncvxm0GIKKeqrgiQzVQ9R+e4xRsD5exQkDyP5rKkNmY1cBNeyikB15QGhFp104e Z+9oZ3u2Yj1GYJ99xzo0sHm2ZwnOtujrc54x9iK7SELfH1GEiUImXsDDD/dYt07MZgdL0NMzuD2 /0lfRIiRwZR38ClWHb0qV25yXQ6Y2FAvO4VcW9wQ5UgKrGObvULHoJdxvNy+J5lR08Z7ZYoZExl rsG6ldLKUOcuZ76rBAy9SC/pDtk4a5RO+DpmOASKCg5t45zL23Njlqm3i/azP3laURPog38LWq6 ox4I4UNfU/IFr8TnMe/peg== X-Received: by 2002:a05:600c:1f0d:b0:431:3bf9:3ebb with SMTP id 5b1f17b1804b1-4389143923bmr262859175e9.24.1737736120992; Fri, 24 Jan 2025 08:28:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:40 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 02/76] tests/tcg/x86_64/fma: Test some x86 fused-multiply-add cases Date: Fri, 24 Jan 2025 16:27:22 +0000 Message-Id: <20250124162836.2332150-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Add a test case which tests some corner case behaviour of fused-multiply-add on x86: * 0 * Inf + SNaN should raise Invalid * 0 * Inf + QNaN shouldh not raise Invalid * tininess should be detected after rounding There is also one currently-disabled test case: * flush-to-zero should be done after rounding This is disabled because QEMU's emulation currently does this incorrectly (and so would fail the test). The test case is kept in but disabled, as the justification for why the test running harness has support for testing both with and without FTZ set. Signed-off-by: Peter Maydell --- tests/tcg/x86_64/fma.c | 109 +++++++++++++++++++++++++++++++ tests/tcg/x86_64/Makefile.target | 1 + 2 files changed, 110 insertions(+) create mode 100644 tests/tcg/x86_64/fma.c diff --git a/tests/tcg/x86_64/fma.c b/tests/tcg/x86_64/fma.c new file mode 100644 index 00000000000..09c622ebc00 --- /dev/null +++ b/tests/tcg/x86_64/fma.c @@ -0,0 +1,109 @@ +/* + * Test some fused multiply add corner cases. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include +#include +#include + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +/* + * Perform one "n * m + a" operation using the vfmadd insn and return + * the result; on return *mxcsr_p is set to the bottom 6 bits of MXCSR + * (the Flag bits). If ftz is true then we set MXCSR.FTZ while doing + * the operation. + * We print the operation and its results to stdout. + */ +static uint64_t do_fmadd(uint64_t n, uint64_t m, uint64_t a, + bool ftz, uint32_t *mxcsr_p) +{ + uint64_t r; + uint32_t mxcsr = 0; + uint32_t ftz_bit = ftz ? (1 << 15) : 0; + uint32_t saved_mxcsr = 0; + + asm volatile("stmxcsr %[saved_mxcsr]\n" + "stmxcsr %[mxcsr]\n" + "andl $0xffff7fc0, %[mxcsr]\n" + "orl %[ftz_bit], %[mxcsr]\n" + "ldmxcsr %[mxcsr]\n" + "movq %[a], %%xmm0\n" + "movq %[m], %%xmm1\n" + "movq %[n], %%xmm2\n" + /* xmm0 = xmm0 + xmm2 * xmm1 */ + "vfmadd231sd %%xmm1, %%xmm2, %%xmm0\n" + "movq %%xmm0, %[r]\n" + "stmxcsr %[mxcsr]\n" + "ldmxcsr %[saved_mxcsr]\n" + : [r] "=r" (r), [mxcsr] "=m" (mxcsr), + [saved_mxcsr] "=m" (saved_mxcsr) + : [n] "r" (n), [m] "r" (m), [a] "r" (a), + [ftz_bit] "r" (ftz_bit) + : "xmm0", "xmm1", "xmm2"); + *mxcsr_p = mxcsr & 0x3f; + printf("vfmadd132sd 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 + " = 0x%" PRIx64 " MXCSR flags 0x%" PRIx32 "\n", + n, m, a, r, *mxcsr_p); + return r; +} + +typedef struct testdata { + /* Input n, m, a */ + uint64_t n; + uint64_t m; + uint64_t a; + bool ftz; + /* Expected result */ + uint64_t expected_r; + /* Expected low 6 bits of MXCSR (the Flag bits) */ + uint32_t expected_mxcsr; +} testdata; + +static testdata tests[] = { + { 0, 0x7ff0000000000000, 0x7ff000000000aaaa, false, /* 0 * Inf + SNaN */ + 0x7ff800000000aaaa, 1 }, /* Should be QNaN and does raise Invalid */ + { 0, 0x7ff0000000000000, 0x7ff800000000aaaa, false, /* 0 * Inf + QNaN */ + 0x7ff800000000aaaa, 0 }, /* Should be QNaN and does *not* raise Invalid */ + /* + * These inputs give a result which is tiny before rounding but which + * becomes non-tiny after rounding. x86 is a "detect tininess after + * rounding" architecture, so it should give a non-denormal result and + * not set the Underflow flag (only the Precision flag for an inexact + * result). + */ + { 0x3fdfffffffffffff, 0x001fffffffffffff, 0x801fffffffffffff, false, + 0x8010000000000000, 0x20 }, + /* + * Flushing of denormal outputs to zero should also happen after + * rounding, so setting FTZ should not affect the result or the flags. + * QEMU currently does not emulate this correctly because we do the + * flush-to-zero check before rounding, so we incorrectly produce a + * zero result and set Underflow as well as Precision. + */ +#ifdef ENABLE_FAILING_TESTS + { 0x3fdfffffffffffff, 0x001fffffffffffff, 0x801fffffffffffff, true, + 0x8010000000000000, 0x20 }, /* Enabling FTZ shouldn't change flags */ +#endif +}; + +int main(void) +{ + bool passed = true; + for (int i = 0; i < ARRAY_SIZE(tests); i++) { + uint32_t mxcsr; + uint64_t r = do_fmadd(tests[i].n, tests[i].m, tests[i].a, + tests[i].ftz, &mxcsr); + if (r != tests[i].expected_r) { + printf("expected result 0x%" PRIx64 "\n", tests[i].expected_r); + passed = false; + } + if (mxcsr != tests[i].expected_mxcsr) { + printf("expected MXCSR flags 0x%x\n", tests[i].expected_mxcsr); + passed = false; + } + } + return passed ? 0 : 1; +} diff --git a/tests/tcg/x86_64/Makefile.target b/tests/tcg/x86_64/Makefile.target index d6dff559c7d..be20fc64e88 100644 --- a/tests/tcg/x86_64/Makefile.target +++ b/tests/tcg/x86_64/Makefile.target @@ -18,6 +18,7 @@ X86_64_TESTS += adox X86_64_TESTS += test-1648 X86_64_TESTS += test-2175 X86_64_TESTS += cross-modifying-code +X86_64_TESTS += fma TESTS=$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64 else TESTS=$(MULTIARCH_TESTS) From patchwork Fri Jan 24 16:27:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859560 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp879862wrq; Fri, 24 Jan 2025 08:29:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU4vMpWzzcHEWqkXYnwkiUmB4At8P96QgROeKrR8Qb0d8HsY83Q8BLtMgXpO5iKSHJUy+SKMQ==@linaro.org X-Google-Smtp-Source: AGHT+IHHMeX4pR2YcMK6NImND7MG+9R1QxWr1OWiFonAEhUPHYNJk0u8E5666uPU6u8ym8vd7uND X-Received: by 2002:ad4:4eaf:0:b0:6d8:96a6:ec31 with SMTP id 6a1803df08f44-6e1b222f637mr492017026d6.35.1737736178229; Fri, 24 Jan 2025 08:29:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736178; cv=none; d=google.com; s=arc-20240605; b=YlluKdP7/7wKJBVEok96tJi9cQH7DGtJq6RHdQHiSF3kYG0QbFgnXbZ1FUk2xJEBSv hQJlU7hNQ3VyQ8XVHGczz60vtBbEjcwYXuLax1Ief8ZxVWDp1hIGlN7Rf39iDMCLxDab TFJKsxAhgixlvmQAc9cHOodZrNL4r364hj/dPdZtSC7yexGK7D7bwzVALyEc+qe4fSp0 KqtmYWmZ1epBXdVxq1D+ww/xJz9yz2SkxIePrQs4Y4X5FvuiENo/yF5aCdgADEK2gAFv /WqtZSLJp2F67t6R35BWEclvTF92vX1BV+eTDz9zvJ0q5GThMjmdxZT9kpdASi4dUihb 7ruA== 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=PuY6MWGhC3e5y5qwwUhsJwJ57vpQ+lSQf4tubMQ4Og4=; fh=rw+0KfdVRsF0zfX7AWDg6OqOJMayJc40k7fv/rrz4HY=; b=XC2Qmy6AikthTQ5dPeQXH0540Qc1DQphedijYN4DcNYpoMF8WIjg5e4hj4gjkrbjk2 Gr/6kpkd+CeFZNrFl5YEJIVZeiVAeLkepIgSQ9hBfJzVaZnV41Cl1zdVe+rNySC3E/hQ tiNSvxW/cJTmu5BGM0HW5qdifLYIryipqHLcfCf/r+564PLLwrE2HsuGceVCylxkndvq jJzkgJ+nho7E4fizw+6p8bgrt+bsaZgbig+Aj5orH2ANTN8fyodQbzoZ8mt8vrntgZzj pTc6RD/q20FDYLJHIIP0w+YMnqlnU1wRNWKr9wMNgELb48hoHBUydeFCkWUJuwNSpDwg pY4g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZdpMs7wy; 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-46e6686c3ddsi25166091cf.37.2025.01.24.08.29.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:29:38 -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=ZdpMs7wy; 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 1tbMYa-00041G-HL; Fri, 24 Jan 2025 11:29:20 -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 1tbMY7-0003ag-Ic for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:52 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMXz-0005Lv-P0 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:47 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43624b2d453so24601625e9.2 for ; Fri, 24 Jan 2025 08:28:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736122; x=1738340922; 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=PuY6MWGhC3e5y5qwwUhsJwJ57vpQ+lSQf4tubMQ4Og4=; b=ZdpMs7wyNJwDFzy+2Mz+2SB1M3zfBODocyjyOJnrxbuwqsoham171a6h+2hctU8HPg eTrvpAIl1JktsOLPq3hj5B9DD+WPApYXG0wmQVp538HmCbU+DAShmc4k+mOvWPDtESUp XU8TLOPxIxx0V3jq5Hq1mhp4HsBetnQwFdu03Fy4dOcb5JdFd+6X/6tVGb0ybLYsFZSt MbY78l+KpCm863EwcphMSbuDQqz6KsoO5wOBeFzkZGk7LYyf1+XDn/7YsMQF4zjh6Gth L7US7JjQZTlWBE/DSTbV0pGXwFIK5qrMLTzHA9/qB0G9+vRtBXGukrm5jOnPKRArxUYH nfsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736122; x=1738340922; 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=PuY6MWGhC3e5y5qwwUhsJwJ57vpQ+lSQf4tubMQ4Og4=; b=nfRPp/0WMXrxY/tL0voCnIfTaCmkEd7FW+1h5D0+Obbhtc1UZvSoSixA8ksij3PAgU 6B77bTgLEI4DnCKEHr/9caKrsuyY4sGo1PeAiXLw6r6oJud8jvY4XZFSqmSJY7Yd6o/0 rJW4icBDzk7iUezSj4L7SNYL2xqBPFN38ylQkhgkHvcGEsXW1PQVD4TG06LZ2TeoYbsN SukRejVXSqiv5Adiyez0Se8/LThiCf3NBu8XG6f8wMG50vcJWbvRL9CGLX26xZ5BdY73 uH3ZHLK9U/tC1/797NwjdGqsdIGIzg+9O37yzzJH+eT59lxfv5gxh8V2GQFQbipu2Fvk +qKw== X-Forwarded-Encrypted: i=1; AJvYcCUCVPzidgiFJXFNh8+NciZ1q4kswIhlPfmagI9lKzLpiPBCSfFWNqQGpbqsk3jhBmPrXZu17H+6+9uG@nongnu.org X-Gm-Message-State: AOJu0YzUU1dNf1aE9NVJQlb6FumPcM7Fxysd4MW92jTUloMjQKW5Rh5h bjnrwRFd3xL3HAmYNP0l+4DPzbimRa8erjOYihFiYnQeE2AfSBJsQGM5AJ8oLA8wo2/JLXbr/M9 f X-Gm-Gg: ASbGncu7PyV8fMKNqV3k4sAk/+kTSA0niWgLyMypRWec6XnaMCr8TzsCZFMPllvXe1R jG2YU70qP9qebftZ0uqhuy8cbZD4mVy0ilH4l+0rmDpqTi0Tga3nIioinfHh1WTjp6pJl610mgU Gf0HUZYQ3yVV5o243w4PawLIwTbYF7Z72Ng3rM9/OIcbqg4RUTo0cTuM2tb2v2CmwKFpkloGG+7 OM+slDBIHEMeWvvBS/crgqWo28GPaUNutcPOw73jhssCZYO/qj8t5eN4QtxpFvOBDftk1b/2xw9 jH0E1IiCCHg= X-Received: by 2002:a05:600c:1913:b0:434:f4fa:83c4 with SMTP id 5b1f17b1804b1-43891453fa7mr312500675e9.29.1737736122162; Fri, 24 Jan 2025 08:28:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:41 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 03/76] target/arm: arm_reset_sve_state() should set FPSR, not FPCR Date: Fri, 24 Jan 2025 16:27:23 +0000 Message-Id: <20250124162836.2332150-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 pseudocode ResetSVEState() does: FPSR = ZeroExtend(0x0800009f<31:0>, 64); but QEMU's arm_reset_sve_state() called vfp_set_fpcr() by accident. Before the advent of FEAT_AFP, this was only setting a collection of RES0 bits, which vfp_set_fpsr() would then ignore, so the only effect was that we didn't actually set the FPSR the way we are supposed to do. Once FEAT_AFP is implemented, setting the bottom bits of FPSR will change the floating point behaviour. Call vfp_set_fpsr(), as we ought to. (Note for stable backports: commit 7f2a01e7368f9 moved this function from sme_helper.c to helper.c, but it had the same bug before the move too.) Cc: qemu-stable@nongnu.org Fixes: f84734b87461 ("target/arm: Implement SMSTART, SMSTOP") Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 63997678513..40bdfc851a5 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6413,7 +6413,7 @@ static void arm_reset_sve_state(CPUARMState *env) memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs)); /* Recall that FFR is stored as pregs[16]. */ memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs)); - vfp_set_fpcr(env, 0x0800009f); + vfp_set_fpsr(env, 0x0800009f); } void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask) From patchwork Fri Jan 24 16:27:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859561 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp879915wrq; Fri, 24 Jan 2025 08:29:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX0oKlnIcxqkZXHsYbfpxMDxK+sDQ5sYhbmsgKL2oHv++jgRHjL4trkPf8QRnuKFzRzBualrQ==@linaro.org X-Google-Smtp-Source: AGHT+IFzuOxlXUC7H26VnOppjKocpZPMetaf6bSEjjZHIPFVoDyI9e7PEF3/bWX1ZiwVjQ87Nho2 X-Received: by 2002:a05:622a:20b:b0:460:f34c:12b6 with SMTP id d75a77b69052e-46e12bc5b93mr493032661cf.44.1737736185265; Fri, 24 Jan 2025 08:29:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736185; cv=none; d=google.com; s=arc-20240605; b=CsWKAI4OtIrFY+pSaQhp5kARCH7NPi0ftM/iz2SEkfxSM783XEeOS/4ScSBKOuLh+Q cU354i66ib/XXFdVv7N+xyHzL80T5bwEYE1m5cHm0SAVTGNIX54fSluH2mVkDS5+iiY6 kUq9vUWpSLmnWTkH0HjNyR9SEmGa/SgQwIjSzvj2XDNtfLVKwHZTyc7ugL8KDuerbAjw 7zDE9+5FYojusH/Hhzjx+Kr3KvXhOWdBCb97/Uutm7S+uT3401ttoFQO9UlVArhDMGbQ HY8oTc4J4aPtlVDTN4F8idDmZwTOAZRCSxkff23ONpeoq1FluAoUfG+iNUyl9cLOMvro EGUA== 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=ZfLM2/7vpDqFu3x5XoiYwdSrSuh29YwT8u6Y3ue6NKY=; fh=nK1ks6Z3PxVWD/MX6Wm3AbQM5FHkWesazQTf3zIRM5w=; b=aVURBqeoBVA2s/RD8BX83UUKlHhVHvHj8yaO9oXNqlCV7Pyc3NrZtWLuRMf+KCn0IG sygeeZIWuD7pbME/cYeo62CZBJuvJuJ6uubAXjhM/atPM9LAn29m/JuebUvC/0MqJfkx DaVyGYAqOGlYq6WGUdctZEt5blasBmeTGmq8I0eIfXNyvRD+OaDYlh5eLCY1M1mOfroP Hy7/BdvR+lK9b/0jHM/+T3A7ymhJS/Q9RMwdhwI9KS2ClbJ0y25uTJqEJyopzbn99Gbr Ks5xxIQ5WFYPds7lKv+Y1BQ3jh19Sp7N3wyge1HO2oE2pvQdGEVwJb0UcQBBkw6PsUZb RQFg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LOnOkjyk; 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-46e6686be93si28531751cf.135.2025.01.24.08.29.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:29:45 -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=LOnOkjyk; 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 1tbMYO-0003s0-Ba; Fri, 24 Jan 2025 11:29:08 -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 1tbMYA-0003bu-VP for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:55 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMY2-0005ME-W2 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:51 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso24063575e9.0 for ; Fri, 24 Jan 2025 08:28:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736123; x=1738340923; 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=ZfLM2/7vpDqFu3x5XoiYwdSrSuh29YwT8u6Y3ue6NKY=; b=LOnOkjykumiqOrKrIdrTYOsYzcEiwXBAD7VYtoeFqU+HomhXX+Taq0VL6/D+82iZm6 mLEIufcQgrcgxU0RJWWQqGHhk5pTehtCMJtlpWILbtxuHRt6+SNHHxWSu52XhISYQfbt 1T8IF+vXB7Tnv92W6v4pBGEEjEDQPPSvQq5d74t436i4tQpIG64gwO7DD692Y9ck4EMU fV3IfLA7A3/XE2yVFP8fcCsNrYAexQAY/ajq7a6wr18oZXxNL4ehBAQDxh5YnsUUDcDE gaRCtBqBbxLh5sSgYTWprXCo0aG61udcZprMfFGGISvFXx3Fw5UH5GPUXimwDZBCnJ3Y LN9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736123; x=1738340923; 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=ZfLM2/7vpDqFu3x5XoiYwdSrSuh29YwT8u6Y3ue6NKY=; b=XFo/UlMpjki7smjJ3EeUXS5PqbAUh5uVVSQ9CS6XZ6NqvxNVB3RSMZLbO4GUrAsKJk TFhKKtwNlDekOae5/XCUXqq08G+AzG6f1FSkxWYdLP1RBxcWBluPBi+SeZaSRgQZmqw6 sCEdh6tMP3MwPqx3gSD2fk891rafi67xgetFfQv0f0Y8FpfFi6flx6NFYF2RHP8zP0LD LEZHhsNJt6ZPd1Mu/TJ9Tcxsislg9cisDNx402REpVI58g/tAiT20RS+xKGz5U+34OeM lPWUGbWOJZyK42LHwn/p0mnbY64YzJt+Y//2diu7/yKX7fEbWQ8U/r0WmE6AaFYr4KSA HXjQ== X-Forwarded-Encrypted: i=1; AJvYcCXQAe2NhiQhf7IFadExG470vi6l11C+A0XnOpAK1bPbdHl2hfIPXKt9klZ07vvRpVLoMnQT/lWdUMD3@nongnu.org X-Gm-Message-State: AOJu0Yw1Z8ae3mSVCnQ7UPNrSLLlk6jgBysI3ghuZpUHwlat2vkRFVfg yLMtU3wmjX9PHWkOsj5QMRiZYdYuKHlWJRodNJzJSh5MRE4J3+mULQKWJOygxbq7d0flXOeEG4J 4 X-Gm-Gg: ASbGnctl8DYzQxM4qP+jxuGnHxA59ugX+627j3kbzV7ghyWOcrEDFcxJDieH4jBbF9h RgPhxJwbNKVcnb1zWrXVo+2DRZm3nfEvP60w0hfz88LZv312Syax8I8AEt3AehrQJiOBpJJ5w/W HU5pAS6tzAdLSr3OYnQl1hmffJPT8ySFz5nsBYoLjySTyPF686mpdkLm8pWY3kaGyW9WML2D1Ji k/zNbgB7Ty6CbLD3/o6iMuG+yfX59Q5vkh7x1+3KsYR89HqIhA6AY2uXBLvOktT5DA1ERQF6zRY 0Z+0dlIEFzQ= X-Received: by 2002:a05:600c:19cc:b0:436:fb9e:26c with SMTP id 5b1f17b1804b1-438913de937mr288271085e9.17.1737736123297; Fri, 24 Jan 2025 08:28:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:42 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 04/76] target/arm: Use FPSR_ constants in vfp_exceptbits_from_host() Date: Fri, 24 Jan 2025 16:27:24 +0000 Message-Id: <20250124162836.2332150-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Use the FPSR_ named constants in vfp_exceptbits_from_host(), rather than hardcoded magic numbers. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/vfp_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index fc20a567530..fcc9e5d382e 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -39,22 +39,22 @@ static inline int vfp_exceptbits_from_host(int host_bits) int target_bits = 0; if (host_bits & float_flag_invalid) { - target_bits |= 1; + target_bits |= FPSR_IOC; } if (host_bits & float_flag_divbyzero) { - target_bits |= 2; + target_bits |= FPSR_DZC; } if (host_bits & float_flag_overflow) { - target_bits |= 4; + target_bits |= FPSR_OFC; } if (host_bits & (float_flag_underflow | float_flag_output_denormal)) { - target_bits |= 8; + target_bits |= FPSR_UFC; } if (host_bits & float_flag_inexact) { - target_bits |= 0x10; + target_bits |= FPSR_IXC; } if (host_bits & float_flag_input_denormal) { - target_bits |= 0x80; + target_bits |= FPSR_IDC; } return target_bits; } From patchwork Fri Jan 24 16:27:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859558 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp879764wrq; Fri, 24 Jan 2025 08:29:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW/zKpY/6dcgedDk2ZciDLIY8e9nzsNlrMqaQ+6Y3i2+KgIl+1ZDNwtwJAHiDoDy4ixJHtfoQ==@linaro.org X-Google-Smtp-Source: AGHT+IG6jrIF8iLo1XNhUYTzQjmKAflqXwXEh/IvyXZ/MnyGaJRPHc6GaAq0Rkv8Gxt8yeZjbaJ4 X-Received: by 2002:a05:622a:1a1f:b0:46c:729a:a5b with SMTP id d75a77b69052e-46e12a9b53dmr400879921cf.28.1737736168527; Fri, 24 Jan 2025 08:29:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736168; cv=none; d=google.com; s=arc-20240605; b=Xd9E321/6soilCbOqwKuD0MrUCjLYOfOWHHZpS8MTz0GTfo8haW511idgYgbRdiYo/ W3Yi4e1MXPsFIbX4Nr7lwrhW2nVFad4mnPWihakhHUQHh3EqxR2c1nW/acdxsFhGMBCr 4SUckmiEfNHIvfDPiblfLnSoiX1cGoThMmlImluZFNd87kUAU4SXZpUwqIYOxe9YD6Wy xzHzLPuIMQhEO0Pufv8lkyT/enhnOdMmVdx7e3Dr+aGjoOi2lkZ7m6atoGPWwj8xGJHg gHbDvM70z06Yt+WQ/3+JXnoFky48wt063yi/6OQPqzxKAPewiM9+qxLlnIpzq3PrgnMK TxTg== 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=wm1x6oiOauNECv1hFmpDM5ccIz/XsL+cZ9qJ5GlshBY=; fh=WxZF2JLtkJ2jwiyAWdt0GHe4oSPooj8bNcJf6zZollU=; b=MnaG5naJ+AGGL6k8sM0C3eWEUsg7/he1tVqDxTvdY+WwJvn7iN8BsnDPSFZMh20IRB ckSzdz2fA6A9F7hYFgq2LfeVPpWbKJ1pXqotrGAfJicfvrBrUFZaS0hP4AjxB5j/k0j8 LhOvl1p0zbD7fKvHHndfcdHvvogkTNIAysqAB7Laqg+t8Bc6OabZwjtpedVv2rrA51dR KcOxv4h4zBxEzFaYImmM8Rch0r1/IDgboBLEX1ILj80L1JKwuNA5NHlNQMytpVl/KG85 W0JaBTp+YVEWG3ZqP9NxcUYS4seTE9LK3Xql4LbyzWZhQLaperCHpV+1KYVJPqbGQopK xspA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wm++KZep; 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-46e66ba75f8si28980361cf.498.2025.01.24.08.29.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:29:28 -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=wm++KZep; 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 1tbMYb-00043c-5I; Fri, 24 Jan 2025 11:29:21 -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 1tbMYB-0003bx-BN for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:55 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMY4-0005Mg-5d for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:52 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43626213fffso22177425e9.1 for ; Fri, 24 Jan 2025 08:28:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736124; x=1738340924; 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=wm1x6oiOauNECv1hFmpDM5ccIz/XsL+cZ9qJ5GlshBY=; b=wm++KZepxv2eKzKGeICpSUkckFI77In3G1MrKj8MfGeOR8EER0mLFje1I6dd9vUjp2 jTv5hEaYPiPd4VGxFtkc/drb5Vw5zQU3f9eyrdhh0IwQ6I/wUIYLNJwA9Yg2VzzRnEl4 77aLl4NoLAz6YqjVfcweSHvvUfWoVcKIl6c2ZBQ9IxkgL+vtFCzRwVpt6lf6oBOOA5M9 caaT1uhR+wYTvVe4BcndmBSXcPje4i9tjXPzJIs/q0MOJIdyv+I0lsWsfj1AGkWk2yRP MqjW3aCnjT2ZNG1l2ZYm+WMaflqP3qpzZAwe+xM00tDJhGSAyVQI+n8dBBtZPjFMYhv2 oH1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736124; x=1738340924; 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=wm1x6oiOauNECv1hFmpDM5ccIz/XsL+cZ9qJ5GlshBY=; b=NKxYpQmDY9yiFXOjtne0NLABrmVIVBRCpwVuwX8wtXdlAlpxLWI6SPTJqS3cx5soSE f11t9RtEhFhE5CU6nkYXvqJxJQu2obcjpnvL/1IXoBsnk4HtPE5fBDbt3vlZC2gLKQNq AnRvF8WHPqMHGEpMCYWNux5iT8V/UoZ0hYeOUxaZSh0nFO1RqwXf/oO1YufRiMlL471c uSurrk0r6d37p4Zin9xJ9bsQRdfz8Cl4niMkxKeB92Z4PiAc4VHnKyc4UHwf5vKnPfsJ eW4r4y8l3v32f3oRsx+xDuSpK+DR62CLgbHlSljtVaydVBNwECxNWdU47KTHQW3sVuAW aYIQ== X-Forwarded-Encrypted: i=1; AJvYcCXk/0bwKga0xW/JceZYdVt/4C1leeCE2aG9wIo9+5pBHsOtXNavbTWHp5xNO6Pr2+QCPnNpq5AWVlk6@nongnu.org X-Gm-Message-State: AOJu0YwKzrdLisJQlMD+SPIlZNxu+jb/Vs/mQO/rfe5L55FLP2mwS/oK E4ed5ccYXX+2I95XKg6hvHW8Z0iPFhPoRHI/9Pyeqn8KLoN8MeFl1p/89cvzHV2E6Qt+Ew1HXyw P X-Gm-Gg: ASbGncs4H6TGZgYUxkvtYjgUPSvz3CW3nAe0VpV5SdDoNCyT1VjDiNHijZree050pJQ MYdLPR8PkiS+El+yKoapN5/KaKvV9QBvvDWca5f4Oj5migWJ1vPUrFYjRNuS6spnS/bIXzd3ZtZ 9f+gPLfAQVvfUWS+iMoOY/ECvhsXN8XMM+BQe6hgW3xcHKXwnr/zZr2pNbYm3tCZBdq4efseags o3QqIEhZ/OW80Y6brwQrPd0W/Ardx9lHuElECbBuUDub/9QfKRnIrDJT1IxrFKGZ+VvmiiCDlhd fQVggKiMWLU= X-Received: by 2002:a05:600c:45cd:b0:436:fdac:26eb with SMTP id 5b1f17b1804b1-438bd06bd67mr38032315e9.7.1737736124292; Fri, 24 Jan 2025 08:28:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:43 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 05/76] target/arm: Use uint32_t in vfp_exceptbits_from_host() Date: Fri, 24 Jan 2025 16:27:25 +0000 Message-Id: <20250124162836.2332150-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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, T_SCC_BODY_TEXT_LINE=-0.01 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 In vfp_exceptbits_from_host(), we accumulate the FPSR flags in an "int", and our return type is also "int". However, the only callsite returns the same information as a uint32_t, and more generally we handle FPSR values in the code as uint32_t, not int. Bring this function in to line with that convention. There is no behaviour change because none of the FPSR bits we set in this function are bit 31. The input argument to the function remains 'int' because that is the return type of the softfloat get_float_exception_flags(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/vfp_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index fcc9e5d382e..afc41420eb1 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -34,9 +34,9 @@ #ifdef CONFIG_TCG /* Convert host exception flags to vfp form. */ -static inline int vfp_exceptbits_from_host(int host_bits) +static inline uint32_t vfp_exceptbits_from_host(int host_bits) { - int target_bits = 0; + uint32_t target_bits = 0; if (host_bits & float_flag_invalid) { target_bits |= FPSR_IOC; From patchwork Fri Jan 24 16:27:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859633 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp892769wrq; Fri, 24 Jan 2025 08:58:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX1Lf5+JV7NzEhXXpQC8nDkWl8fRaTKE2HlUGzdlw0NloZmgoM8zg8V4LqQ9IEyg1w/yrAh6A==@linaro.org X-Google-Smtp-Source: AGHT+IHJZAh/B8G5twOpLXcOnbJZ9D4epkVIn3+JteQ+WB52jmRGP3/jAvdqj4sg+gDWGdcVNM+Q X-Received: by 2002:a05:6102:2ac8:b0:4af:f892:e9f0 with SMTP id ada2fe7eead31-4b690c1a623mr22630621137.14.1737737896730; Fri, 24 Jan 2025 08:58:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737896; cv=none; d=google.com; s=arc-20240605; b=lG1n3llZ/a5FJim4UjrWHzj1Rl0J0iV11Dkc+EYLeQjojFt5Yq2BJFSLe3dLq9ZVpK cyFLZclBZlOeaD4sy1mZBEM8nTWlMJKh6/LTHIUhQ7Pao3RnCyy5XGclJr+VlaqV9ou4 pDOY5/Yaf3feOHeWNFFF4SlNtb2yiEpDLE0FhIcTA1Hbwtn5SUadgB+kg/OKVtWj3bU4 dv72enC3ltPej12CtibVn6qRF9RAxiPaK/fwdjA5DrYfzuwHbhMtto0995njtRsHxLzE Eq01PuHGvE3emVj+61lKKjQ2CQ/XG9E24OOmJa001i+XUhqGLjJ4X2s5HPZ/InOK63Fu vpUQ== 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=MgMjtmIn5YHOySMtqed78/dy6/ryGORph+YbtAdKVfY=; fh=JpfxHlLH6qltW1DXTg/Q3IQErmgSUpjCZOq985eri8k=; b=IZ/TeUzfGhL4w4x+ba9d6BTJlOs/eu946En2zDsAWKfLbQ5aPcqviJ3iqxlxouoziU UnKOLJp7xykPusnbwuWt/h7JZn0yfd165z5IrTw9vowxHmpNx4ZBp9mcnFVauQJKSZQ8 DLGHZO50Tjilvs2IhVMe45zM6t41aUoLleu1A6cSiYfd0pdDPuB27CzNeV7goZ6fZTCO zMoAEdMddzySmzrPOkNx5JQrlxXWz/ZZ4c9WvmhqY+KVROypjXbbecaf5zY++ppmTyjo kAfDEM30jY5qkPR1oHev+XTUee2NDPRRaD1rlKJM0yb6G5H8oR104xwcVFfZUVKxk3Ve KkIg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZOK8y6St; 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 ada2fe7eead31-4b709a154aasi1116972137.590.2025.01.24.08.58.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:58:16 -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=ZOK8y6St; 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 1tbMZx-0006SQ-Ba; Fri, 24 Jan 2025 11:30:46 -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 1tbMYI-0003rV-Fl for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:04 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYE-0005N5-Dk for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:01 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4361f65ca01so23925635e9.1 for ; Fri, 24 Jan 2025 08:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736125; x=1738340925; 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=MgMjtmIn5YHOySMtqed78/dy6/ryGORph+YbtAdKVfY=; b=ZOK8y6SthOCMdrJ7V8Yu8MsmjtqhA3NkeX2WOV1vnXK2N9b9rCKu1yvleKyTJ3vFQs fc9n+Grt3swpKnqxRc36m9/wLKqkre4g327A3FyLLaZTZbOuNEzJTYT843EAn8YHfp4z vnSQbgSOjlXsZYNFjaOyETwe/f+VHTVCu8tmcKWFVFy/LyrdckzT6RxymOBwA5pFxVR+ FXfWcVWh6fjJ/v3xhoYOKzMty8cqP1a7xROVxf1TL+VYwxEq7kvbQGuIw1mHcoKR1ar5 AzAJNO3FlmveecygrsvvtiAh23nJaRMuFfkcSegseNl9OUDMzYS5S/BvER49eMrJ/Tvy Im2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736125; x=1738340925; 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=MgMjtmIn5YHOySMtqed78/dy6/ryGORph+YbtAdKVfY=; b=p8fbn8//3LCNIjcwlARXQ7v67C6xQkzym96JVBuTDCfhViwkcrWbIbMfIHVsemAHaU EaxeQr7qVcVF0FHnFEWRGLHWKC/D+FCH/476chGCMkpI0jzrWeDnFkmESb54YBvzJWsQ VuC236jwerONMGt3bkXGtcmMOYBZ4UpOZJ3mKB3Yz1ifnG/JZyclSYNbBiNOnoBQCJUS h6JB2DBq8i5luoRxiDXEUlci5pNcOa19V05mGc6isnkSR6nRgf6+275UWf//uj0s/Dt9 ne17V0haZ68/DZQWXxJwbNfvm9LGuPD4R3weW9EFwllBmgCYNBCmXMRuwIPbjkmib2sf eVHQ== X-Forwarded-Encrypted: i=1; AJvYcCWYwac9wOxUzs3FFWt7WQCh1uFCl2sktEjvrz0kSC3HdqfhlYDnAM1kVYOskJTpC7725SJhXhg9Ife+@nongnu.org X-Gm-Message-State: AOJu0YzzkeFWGEGzhlbgAm9CScGqJNH0GFFXGjK1c2/TqXpdirJe0GDT KvDy67zs2kEtr71ATf9Pet78H3mDKRVG0lhOG1YKGy2ZcAQvpIW20ICgmRfUOHV2DcASJdaqXul S X-Gm-Gg: ASbGncvEkjT2U5dcQSSLufaTZtE8jufk7dP2A7risFEvcgIc50IS1xN+Ylmrh3TY2BL OHTKATL86KHWTgdNneA8xbG+djXKo5C83a8YEgrrKd0QpMd8PRxQ10kgvjCZCvYprrBhqPCwUPh gf9rpTiIwouJSWonCjGnQhvtZanxVtOiVXC60t8IYcujaUFQYeSN99oacU+tw/l2lUXy6aKjwCn AeFMP98DCwpwXNi3siU2VEU2LUY+tTV5Xi6TkXq0Y0a+jA13tG3PS35wpQ7HOqM6geAL8ySucNG ERrUKkr5G88= X-Received: by 2002:a7b:c3d8:0:b0:436:17e4:ad4c with SMTP id 5b1f17b1804b1-438a0d3c71fmr222778305e9.6.1737736125570; Fri, 24 Jan 2025 08:28:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:44 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 06/76] target/arm: Define new fp_status_a32 and fp_status_a64 Date: Fri, 24 Jan 2025 16:27:26 +0000 Message-Id: <20250124162836.2332150-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 We want to split the existing fp_status in the Arm CPUState into separate float_status fields for AArch32 and AArch64. (This is because new control bits defined by FEAT_AFP only have an effect for AArch64, not AArch32.) To make this split we will: * define new fp_status_a32 and fp_status_a64 which have identical behaviour to the existing fp_status * move existing uses of fp_status to fp_status_a32 or fp_status_a64 as appropriate * delete the old fp_status when it has no uses left In this patch we add the new float_status fields. We will also need to split fp_status_f16, but we will do that as a separate series of patches. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 4 ++++ target/arm/tcg/translate.h | 12 ++++++++++++ target/arm/cpu.c | 2 ++ target/arm/vfp_helper.c | 12 ++++++++++++ 4 files changed, 30 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 9a6e8e589cc..337c5383748 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -634,6 +634,8 @@ typedef struct CPUArchState { /* There are a number of distinct float control structures: * * fp_status: is the "normal" fp status. + * fp_status_a32: is the "normal" fp status for AArch32 insns + * fp_status_a64: is the "normal" fp status for AArch64 insns * fp_status_fp16: used for half-precision calculations * standard_fp_status : the ARM "Standard FPSCR Value" * standard_fp_status_fp16 : used for half-precision @@ -659,6 +661,8 @@ typedef struct CPUArchState { * an explicit FPSCR read. */ float_status fp_status; + float_status fp_status_a32; + float_status fp_status_a64; float_status fp_status_f16; float_status standard_fp_status; float_status standard_fp_status_f16; diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 2d37d7c9f21..a7509b314b0 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -671,6 +671,8 @@ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb) */ typedef enum ARMFPStatusFlavour { FPST_FPCR, + FPST_FPCR_A32, + FPST_FPCR_A64, FPST_FPCR_F16, FPST_STD, FPST_STD_F16, @@ -686,6 +688,10 @@ typedef enum ARMFPStatusFlavour { * * FPST_FPCR * for non-FP16 operations controlled by the FPCR + * FPST_FPCR_A32 + * for AArch32 non-FP16 operations controlled by the FPCR + * FPST_FPCR_A64 + * for AArch64 non-FP16 operations controlled by the FPCR * FPST_FPCR_F16 * for operations controlled by the FPCR where FPCR.FZ16 is to be used * FPST_STD @@ -702,6 +708,12 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) case FPST_FPCR: offset = offsetof(CPUARMState, vfp.fp_status); break; + case FPST_FPCR_A32: + offset = offsetof(CPUARMState, vfp.fp_status_a32); + break; + case FPST_FPCR_A64: + offset = offsetof(CPUARMState, vfp.fp_status_a64); + break; case FPST_FPCR_F16: offset = offsetof(CPUARMState, vfp.fp_status_f16); break; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index dc0231233a6..8bdd535db95 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -573,6 +573,8 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type) set_default_nan_mode(1, &env->vfp.standard_fp_status); set_default_nan_mode(1, &env->vfp.standard_fp_status_f16); arm_set_default_fp_behaviours(&env->vfp.fp_status); + arm_set_default_fp_behaviours(&env->vfp.fp_status_a32); + arm_set_default_fp_behaviours(&env->vfp.fp_status_a64); arm_set_default_fp_behaviours(&env->vfp.standard_fp_status); arm_set_default_fp_behaviours(&env->vfp.fp_status_f16); arm_set_default_fp_behaviours(&env->vfp.standard_fp_status_f16); diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index afc41420eb1..7475f97e0ce 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -64,6 +64,8 @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env) uint32_t i; i = get_float_exception_flags(&env->vfp.fp_status); + i |= get_float_exception_flags(&env->vfp.fp_status_a32); + i |= get_float_exception_flags(&env->vfp.fp_status_a64); i |= get_float_exception_flags(&env->vfp.standard_fp_status); /* FZ16 does not generate an input denormal exception. */ i |= (get_float_exception_flags(&env->vfp.fp_status_f16) @@ -81,6 +83,8 @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env) * be the architecturally up-to-date exception flag information first. */ set_float_exception_flags(0, &env->vfp.fp_status); + set_float_exception_flags(0, &env->vfp.fp_status_a32); + set_float_exception_flags(0, &env->vfp.fp_status_a64); set_float_exception_flags(0, &env->vfp.fp_status_f16); set_float_exception_flags(0, &env->vfp.standard_fp_status); set_float_exception_flags(0, &env->vfp.standard_fp_status_f16); @@ -109,6 +113,8 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) break; } set_float_rounding_mode(i, &env->vfp.fp_status); + set_float_rounding_mode(i, &env->vfp.fp_status_a32); + set_float_rounding_mode(i, &env->vfp.fp_status_a64); set_float_rounding_mode(i, &env->vfp.fp_status_f16); } if (changed & FPCR_FZ16) { @@ -122,10 +128,16 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) bool ftz_enabled = val & FPCR_FZ; set_flush_to_zero(ftz_enabled, &env->vfp.fp_status); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status); + set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a32); + set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a32); + set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a64); + set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a64); } if (changed & FPCR_DN) { bool dnan_enabled = val & FPCR_DN; set_default_nan_mode(dnan_enabled, &env->vfp.fp_status); + set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32); + set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16); } } From patchwork Fri Jan 24 16:27:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859564 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881205wrq; Fri, 24 Jan 2025 08:31:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWbehzLrwAqYpekcKWYbdez7xiOmgKHOB5LYw0VefY6+jeyarEplV+m4bwpoLlYWtYIFZreXQ==@linaro.org X-Google-Smtp-Source: AGHT+IH3vzgSI/qEMbxXZpjk0Egnfxs5w7iUutzU9ZC2eDK2AM8a45LKFVWoXClxIZ3I5yFkIbRk X-Received: by 2002:a05:6122:8b87:b0:518:a287:56e3 with SMTP id 71dfb90a1353d-51d5b2fd483mr28576682e0c.7.1737736312423; Fri, 24 Jan 2025 08:31:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736312; cv=none; d=google.com; s=arc-20240605; b=ULjF05TcJPR7o319NCtFn/8AD/n/B/UpckE6+A0tnn+WVoz+rUOIMF8uu6kXCm7gI1 TlVrJNExhrsac5zz18zLVOTLyi/SegKLhwtwhY9d0y/VxTqmYjUVKBc7vBqhWo1oFpRD 1cXHnPehOd1jVJANEZw/FNwsLgee/YQuZbAQdTXfKqoIcf9R9uVL3WpSVjymWuTvviUC sKwjIolOF1w0GLCp5vITMxKP90HtZu/ExdhjWSMR0BpDf4ZfUrhFepqaTPGGs7GA9TMl SVJSgFxopyvc9A7NY09BDk1qpp/BfotHMOQMn2pf++bB7x3Ba7nDmJGJBkM75uhVH+zv nh/g== 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=4jWmHkLkE0PYmSdvm4vatXKXqnaGihoCx12P90WWE9A=; fh=SvLOdtZgR2BpyXn3+yPcDiEuQ7gWpBWCPmGkc+btSS4=; b=CVH0fB1GtRccOQENc+l2IKnyDBPt/FdRq2aNz0XtAgJiJw7QUqHsFZ1gyBJ2vUWJ9P GPqAhWKiWD/rEL0PrsipodQ0X0he+uJI3KnKz1k64wiT2ypA68iOf3HG++aPqrAfFnaT +FDAuoCGjzOy2ePAoEWxceI3uc7rhaKqQRZpH8ozrYFQjrG5+0ceTsq7T32uo2hah198 NEIT+0FiNgCPhLB1Gf+EJqN6oWUPBM+MBPWLpFpWMIODG1vjFt/pEcWCpLX8S7GZDs7A VwSoCGl9SFihFu1vcGRXJSZsGR0sVBT0/7IKhKLu6fVApn2BoIJaA96XUzh7jz6+x5oY 1QbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dF002bzs; 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 ada2fe7eead31-4b709792d0csi817800137.199.2025.01.24.08.31.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:31:52 -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=dF002bzs; 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 1tbMZ7-0005aR-Ri; Fri, 24 Jan 2025 11:30:00 -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 1tbMYG-0003m3-Ik for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:01 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYB-0005Nl-3T for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:58 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43675b1155bso25526475e9.2 for ; Fri, 24 Jan 2025 08:28:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736127; x=1738340927; 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=4jWmHkLkE0PYmSdvm4vatXKXqnaGihoCx12P90WWE9A=; b=dF002bzsfqv2LkDtcFRWO5X806u1sptlVisz2GLzFEliJ3YFXH83JRC0mLt67tNa9B 5x3Ag+ReoWVzr1uuAvAxD2v097JE8p5CJ0xvuiFgH+/wzYhsjz8pwhLbSSIeQ/ZbpRbm g3luSMxy5kzAVkE5hev6v2QFDfLdy/OoF0psaw4T2DBttmNi6jBPkxcI8iVNkf6T/jSP MQLubhupNVK6PTaW1S/3sHF/d+nIaTrXdnIiLw4SIZoba5mDOTDAo19CvuZ2dCysJkvy 5TFNPBTp0Vaq/gD4bCxNzSt6vsognTi41a58plMLcMqUfM+iwfp5QXBOALGRFpTRsX7k D34w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736127; x=1738340927; 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=4jWmHkLkE0PYmSdvm4vatXKXqnaGihoCx12P90WWE9A=; b=alJXm5bkt16KIVfe8cpcY60HWQ+Y2PkKBG0cIQJPAl2PqULKWfiTtWIbFGMFWd/kBa u+oV+EhGuRmQrUFlHYFOwM9G/iJtaGNwJJAh96YbckwpH3/XwcHBqXULs7FH0zyzJ3b3 toZ87yvLklntLMrd0k/S1JAoTdWsmgulfucq/rU7w8NoZvrHOm7+PrTTPpvCxsSRZ0TG QQol5oonN/GTm1MJrfyvqKjoYpQvBhgp3sh/90CN+H4Al63ji4vZvBxuWc+Kiyek+csn YrrPUfG4xe/UPBgwG0jKjkZYciUeVFO7HggQddXwB/jsPLBm91oMvnq5xAZNNDyXJaBa 9lvg== X-Forwarded-Encrypted: i=1; AJvYcCU7FRAcrVdJfOCKN4Z5W5wvZdxc4v13TbSdBHxNiieWg/Jnr9FgdidEnvvQfAf2nOVz/CBf5EuLnzbe@nongnu.org X-Gm-Message-State: AOJu0Yx9Z5o2fGerW4vxpm53eb5RwQqRtDpHibN7U6lLkMx93idKPCvV TGfWQt0VUCSzqvXEYPk8Gwfz5LM3WXklUQ6jL+CsLhCqzc+hBmfQAa/tamWY9rYBDadvPdwYkLv 3 X-Gm-Gg: ASbGncv/S0VbNfcruAdG31N1FBXlh0jS9Aef8Jp8hvgPBMIimlRj5ZUG9EqGn+RR6wl dEkzqNAOReJv/GUnofJXohWIfuQljpdfhsDXZ2RH/5IZ1mRNNxsaSRZB7/yofIppR+EwIN4bXnE 1oHS25SVkgMoWInGEpz4jx9mQ1NqSW4zSTuf87hIY5MsZ1cHpoTOp1Oo8KSCxJposRVW9nW5Q2t PxYWRUX1KSzZmX+lu+PE8z24Lg+cmFZqORarSk7yLKzUHAnGDsbb/vULnn34p6PsGd8hFc350qA NxAWgIcN+NY= X-Received: by 2002:a05:600c:1d1d:b0:434:a815:2b5d with SMTP id 5b1f17b1804b1-4389141c211mr253290065e9.24.1737736127353; Fri, 24 Jan 2025 08:28:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:46 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 07/76] target/arm: Use vfp.fp_status_a64 in A64-only helper functions Date: Fri, 24 Jan 2025 16:27:27 +0000 Message-Id: <20250124162836.2332150-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Switch from vfp.fp_status to vfp.fp_status_a64 for helpers which: * directly reference an fp_status field * are called only from the A64 decoder * are not called inside a set_rmode/restore_rmode sequence Signed-off-by: Peter Maydell --- target/arm/tcg/sme_helper.c | 2 +- target/arm/tcg/vec_helper.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c index a0e6b4a41ea..2aad00d3ad9 100644 --- a/target/arm/tcg/sme_helper.c +++ b/target/arm/tcg/sme_helper.c @@ -1044,7 +1044,7 @@ void HELPER(sme_fmopa_h)(void *vza, void *vzn, void *vzm, void *vpn, * round-to-odd -- see above. */ fpst_f16 = env->vfp.fp_status_f16; - fpst_std = env->vfp.fp_status; + fpst_std = env->vfp.fp_status_a64; set_default_nan_mode(true, &fpst_std); set_default_nan_mode(true, &fpst_f16); fpst_odd = fpst_std; diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index e3083c6e84e..44ee2c81fad 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2066,7 +2066,7 @@ void HELPER(gvec_fmlal_a32)(void *vd, void *vn, void *vm, void HELPER(gvec_fmlal_a64)(void *vd, void *vn, void *vm, CPUARMState *env, uint32_t desc) { - do_fmlal(vd, vn, vm, &env->vfp.fp_status, desc, + do_fmlal(vd, vn, vm, &env->vfp.fp_status_a64, desc, get_flush_inputs_to_zero(&env->vfp.fp_status_f16)); } @@ -2076,7 +2076,7 @@ void HELPER(sve2_fmlal_zzzw_s)(void *vd, void *vn, void *vm, void *va, intptr_t i, oprsz = simd_oprsz(desc); uint16_t negn = extract32(desc, SIMD_DATA_SHIFT, 1) << 15; intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16); - float_status *status = &env->vfp.fp_status; + float_status *status = &env->vfp.fp_status_a64; bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16); for (i = 0; i < oprsz; i += sizeof(float32)) { @@ -2128,7 +2128,7 @@ void HELPER(gvec_fmlal_idx_a32)(void *vd, void *vn, void *vm, void HELPER(gvec_fmlal_idx_a64)(void *vd, void *vn, void *vm, CPUARMState *env, uint32_t desc) { - do_fmlal_idx(vd, vn, vm, &env->vfp.fp_status, desc, + do_fmlal_idx(vd, vn, vm, &env->vfp.fp_status_a64, desc, get_flush_inputs_to_zero(&env->vfp.fp_status_f16)); } @@ -2139,7 +2139,7 @@ void HELPER(sve2_fmlal_zzxw_s)(void *vd, void *vn, void *vm, void *va, uint16_t negn = extract32(desc, SIMD_DATA_SHIFT, 1) << 15; intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16); intptr_t idx = extract32(desc, SIMD_DATA_SHIFT + 2, 3) * sizeof(float16); - float_status *status = &env->vfp.fp_status; + float_status *status = &env->vfp.fp_status_a64; bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16); for (i = 0; i < oprsz; i += 16) { @@ -2808,7 +2808,7 @@ bool is_ebf(CPUARMState *env, float_status *statusp, float_status *oddstatusp) */ bool ebf = is_a64(env) && env->vfp.fpcr & FPCR_EBF; - *statusp = env->vfp.fp_status; + *statusp = env->vfp.fp_status_a64; set_default_nan_mode(true, statusp); if (ebf) { From patchwork Fri Jan 24 16:27:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859581 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp882908wrq; Fri, 24 Jan 2025 08:35:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXBCdMAFWIBHhSJDOlJXPg7lbgkG31a6WNR194f2ptkZ7tGqyuQxV5SKsqzi+KIR3S2FdEPfQ==@linaro.org X-Google-Smtp-Source: AGHT+IGldBqcS9MFPcGix2XAZLVd1bq+1qoLr9xITd+/T/+jYHi1sSyXmoU+SI5J/pjFqE3oTmS5 X-Received: by 2002:a05:6122:4fa1:b0:51b:8949:c9ab with SMTP id 71dfb90a1353d-51d5b30c761mr27696575e0c.9.1737736499707; Fri, 24 Jan 2025 08:34:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736499; cv=none; d=google.com; s=arc-20240605; b=TspOuaQnstk6ArmNJ8TRALuNiAV5oIV9sqwBezl1E/i+7qEev3+n78vyi1YtMwd4bT bV4EgkN+o9FWJd0p7EfOBDCWEsls5aKBBYloLUdRKcjPguTxfSkNzhCJRK6Z/vHGhjSf 9WQP2bD9NQrtNmIGGCvS0dK95MWvJ5hKCx57wtU4XkN3KwNzuB6bCZNAkdno/Pt0jNmW 0XyBdvyOp1FfrPw8TjwAg1hQFsYcmSa98m9HXh0vEfM4NhgSz89XJnCohdR2GfXCxA7T F8Sxt7CBEVvL8m6EtpyWAXCoAt/FxUVyFD80n+8Hz/1Pk1BT53RVN5Kb85H+7ra8ggVY svbA== 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=bk8UKy/5UtUVN5mexJL1A3Tm3jtSo3Xn1L8OQBTpPsg=; fh=qd8gR6q/Qck5+V2nsWC2ArCnQtoycXcJuKasW16ZpMg=; b=iAFZE590z12zL9ulR+SkXowkwzTUbinpQP48OXLrxt9lPPD9WTTwNQq+wnApDH3PnU yjzdrCVfhA6FqgNk6tYTDE6C92GRaxZpV8Tlf1s0S+BFXJznIMkBcXV4u7puaZigrJNC D2tuznKx6MINeTyze2OmToEOHxMz6zPQ5/8egUzpWIL5nguzGcM1yoJtc5ZKNAwTAX4u ZhTkLBZzIiZf3UsJyrMkvQE/VCoPslxLK9QXQ+XkbzLVrA41YH4cQKxdzCAvJLCKU8ec FluqIEaZ/zjDX/pyBf7vAVU9a44hcyXlITLPu7v1ZWgtc1q8JhTl/XD6YtrKbx9vkatF abYg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M1X7Ukzj; 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 71dfb90a1353d-51e4ea36c7bsi1165623e0c.3.2025.01.24.08.34.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:34:59 -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=M1X7Ukzj; 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 1tbMYo-0004zP-U2; Fri, 24 Jan 2025 11:29:34 -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 1tbMYG-0003lv-IG for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:01 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYB-0005OA-4S for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:58 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43675b1155bso25526615e9.2 for ; Fri, 24 Jan 2025 08:28:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736128; x=1738340928; 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=bk8UKy/5UtUVN5mexJL1A3Tm3jtSo3Xn1L8OQBTpPsg=; b=M1X7UkzjhmbvqqqHJUNt3OWJI789SnF2nCqj+jYz7tonNT9OgzONQHVibvZ/Z7dHOr KEFhVX1+NMRysusmCWIwIM9bR2huXtbN3HMFjpVIPzlwR31mP4symGWYlIg+S2/ErN/N taCaqWxvHuAFC+lgK8YARqT53n0no8MNqj+vLq5rc5sEwlgyd4AjPVLRc8zCIvF2WBjE ZV6hEjT2nKtv/UUH/faoQxAYA7PH/YQVSZLHluIhARJhS50hFZ/wWKT7jJKOgkNESZj2 wPDpuovbxlWsXthiVAU3r6xdkb8Wz4W1JRyGy1fpqsEBvf8m0HgPp1P78vKuuTnmtj3/ Ww0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736128; x=1738340928; 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=bk8UKy/5UtUVN5mexJL1A3Tm3jtSo3Xn1L8OQBTpPsg=; b=orC82laplUj67UX9N+rUZAwA/yKHxehVChZZ+Vkzho4EZW3+fRKgZ4FTTYKOLyaJVF ROuQrWN/C6a1GF5Y0T/Yc8SiNBNDcUgxqjlQ3YzSe2q3phum+iCrzKKcE9JTLAIlbPfC aHkbz/WE6h34z4qB3ZB+9ktUX3fg3qC1CsfL+tOVqI9pOLZ67kkbNBXKdt7rKkr/9Fnl qQjkWMqoShKieT7KkKhRUTz7ZHjg/irUBA1X5I2ITfft+ZodoWSE349w8cZuayJ9CIL3 EJQTm3nBnwv84sV2Muu0pscfvXdamKFmuwuiYX7foK7z0AtyE695kVXs+1he+3HgXWTq 1uZQ== X-Forwarded-Encrypted: i=1; AJvYcCXAllmRpiUvVqL4EioetyocMlxTrB3idh76ZaeC/e/taySfvD1N9lldQTBuS7U76Hn8+eiD3zYanKxK@nongnu.org X-Gm-Message-State: AOJu0Yxlj6tmhUsY5R29bYTXG/QcOGvOlK9Nn96Q/pNGMUhEaBoxLWTA PJz3vmJgeuAjnQz3aZs9wLuBG0Qexfhtk2UtMQMG9EB71PCDe9yiO6q9DPi/2geb6ozjJnFsupt s X-Gm-Gg: ASbGnctrUX7Ka1WR8JCAW6AGLdpiyeNIjPseAxnCP9mWe/8BNE6ADHhQI4XHg9QynIr 7ZdJXasPFCnNvGw71JVk75/RWrUQRGNDUSFWgsSQjh9K8MnGPFzZxj88bvM3CdRdVebAPY48cje Xqmuuje6OS+WE4N+nVqZ74MKMiuN+oa6VIVTbd3wz1RvTT4wmQb6nwFmmuX3VYUwvyMWi+Ev7mq OLBVGkQBiZIDxJH8WsNQBX15boSvRW72Fgm2ccoDp+N4oBvJO32MO3vvW5R6uKYmOn8G/jVhBsJ jvqU+3De6k0= X-Received: by 2002:a05:600c:1da1:b0:434:a202:7a0d with SMTP id 5b1f17b1804b1-4389141c227mr256881565e9.22.1737736128268; Fri, 24 Jan 2025 08:28:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:47 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 08/76] target/arm: Use fp_status_a32 in vjvct helper Date: Fri, 24 Jan 2025 16:27:28 +0000 Message-Id: <20250124162836.2332150-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Use fp_status_a32 in the vjcvt helper function; this is called only from the A32/T32 decoder and is not used inside a set_rmode/restore_rmode sequence. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/vfp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 7475f97e0ce..0671ba3a88b 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -1144,7 +1144,7 @@ uint64_t HELPER(fjcvtzs)(float64 value, float_status *status) uint32_t HELPER(vjcvt)(float64 value, CPUARMState *env) { - uint64_t pair = HELPER(fjcvtzs)(value, &env->vfp.fp_status); + uint64_t pair = HELPER(fjcvtzs)(value, &env->vfp.fp_status_a32); uint32_t result = pair; uint32_t z = (pair >> 32) == 0; From patchwork Fri Jan 24 16:27:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859589 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp884136wrq; Fri, 24 Jan 2025 08:37:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXRuI5oOt+Oq4WgjLoXqRoVb3Febmgq3G5gWovDHxoxDFXFYZbasOHxBA/0VAUfikScie893g==@linaro.org X-Google-Smtp-Source: AGHT+IFZO+OjqX9j1kvFM2MWiS4aMvfwsGFxEhWQIf83GuzerTvydgPW0lLfFr59c4lKh4PiZD+d X-Received: by 2002:a05:620a:2b47:b0:7b6:f595:7550 with SMTP id af79cd13be357-7be6325fba1mr6496961885a.36.1737736659583; Fri, 24 Jan 2025 08:37:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736659; cv=none; d=google.com; s=arc-20240605; b=Gd/wO2+q3tiySCtLaRvqEHhWBYaROQjf4e1XgyqIOBhB7rpPPbeJ46v2Ux0CSnbHm7 jzaONV3wO1cYZp3EN4Bp32pZbgNQv5XLiZFJ3eWh9mMRJvM0toZZ5MvMNnT0rlZIcLQL zLBA7bMpkPN6crcWLFH++aJ7ztoNsrTLhC0Ki27uLOn05qhQnZwcIJXKBUfY1pAgYXqD EfvGjDWDAAYBNq9lx6IXnmdnAFWy83cwZuu1rkBxOnGmHrpYW9MOVz0T853zxxUvmuWF kzPPd709Lcgd0orSZ+HeasN+TCh+hy01EU/0iYwv96fQQHwCCdwrAJ+8Hinf0tUvzEAr hFYA== 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=VV3/bjL+L2GYg3BGKCSiBTft5KK2gRABV/uDNOnPfr0=; fh=1/5eCJiC3WL+rtC4Wjf/5PSl9kJdW28jssyyvcg3FAs=; b=cWenGHFAwwweplMnGgm3mDx7ZIKajJhocejSzs14eZZN7XRt20ye2KURL8ntXkTql/ 7PVfjmgJNEpjBwTcJ+RxvcUIJOyvr2B6ZTv9Zc+ZV1dzeuuFuMywLT3tf5tm/PKjNnb3 Un8ZltKlyLA3oHRI4BmKJuo+QNMUXlhirybN32iki9OdncefC0EO/VXEUTC98BWVX401 /RgWz+1EzOJGGJRZPnG7u1+7rC+GST1fXCEeOyZjeQ7qJRL5Ptw6me05kBtuXgsRDZpo Fv0jhELTFTPvmU4FDLAR0jMWHSonR2YBiQ0ex4lTvJi49E8KsJcRUJiXfJspEg/5CL6H m6Tw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r+ltMcYY; 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-7be9ae83381si266879885a.122.2025.01.24.08.37.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:37:39 -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=r+ltMcYY; 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 1tbMYd-0004El-6x; Fri, 24 Jan 2025 11:29:23 -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 1tbMYE-0003hD-Oz for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:59 -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 1tbMY7-0005OV-Fs for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:56 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-43635796b48so15503355e9.0 for ; Fri, 24 Jan 2025 08:28:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736129; x=1738340929; 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=VV3/bjL+L2GYg3BGKCSiBTft5KK2gRABV/uDNOnPfr0=; b=r+ltMcYYV7BisqC7NqaVa+pBAejxm0grKgQghnBWOxH6V/SeIw73NVAY4JXgcJbT7j Nrh5354ZQ6IF4kPZ7dzz52jHyecbXNtvwJpb3BsQ9TfGNNSVZ72Ax8rCxqf1w82kDj/l LkeThlijJdol3XEoZQy1Zwx408GoTCuzN9b5SIeyXJIYljymmsjZswkdrJPk6LYtFEMz n27HAQEPRDVzrmbczu/ZicTyD8yMVHYvx1tTJGUV2NmwTunYbQT/8oDdtLUXfWcYQy0Q CfST1LJoybr9jSMo6TOQ5CZAvF/vvv9Jv/uNTcNmADHNi3+3Rt51SjH/9lRW1DZNMHgd np4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736129; x=1738340929; 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=VV3/bjL+L2GYg3BGKCSiBTft5KK2gRABV/uDNOnPfr0=; b=SjNsb4lMjM5OwZUK6A0+Agsrnbo8wRQCgWmh32/XqZ0Lfy9shnDZxUr1XSzrlFYtn1 w3Q5Pcc7B9bhiJuG5HRhwcveIDVDh89KqQ0G74peab5TQccgD7U+i6jwf87P9MR60sLX ydpRaVLcYvDxWJ8yLhjtrMosj8diHXoZjBnc6VhqB7QynhwRxbs3JUMiqyGqtXs5bav7 wkLHHDayg7KdHgAz2/TU/szrZVVvATzs5jpsmxMWrzS5A5UnNmzvb8o79xjcYUjiQAKD XU5P14eG8XrnjgLU8VU9TjsAgs2HHEaRZK8FBVbw45aX4q4+YrrvkSDRjITqCFOThLW3 SGRQ== X-Forwarded-Encrypted: i=1; AJvYcCXS1zaDWs4jX+z3d9fY5TOQVxeDywKS0NtFZjXuwri4LGDukXs0Iojrqoe2FPpvzz5fE7Lk2GHiFkVy@nongnu.org X-Gm-Message-State: AOJu0Yzpjb8szJpKeeUeRZ1JMkhNJLgHxI0BYaWMSHMQu5jsGjoUNlVE cHZBAAVWxVnrxI0rHxDsS3mjydAj8ComNe4d6TUX/xFI/s68UKVPiU5j15PUojw= X-Gm-Gg: ASbGnctMK2djNG7xY23djmRW/a3GNvHyV+GRKE2jOXn1pPrQ7QU1jL6awQgQ+NhWWVm Xs+UkL/ktKDBvDGYFCSXSa4NoeH5489J0kBH1vt6xwaSl+DuWo4HIDPv1Fce8S2xw50H1q0BnfJ 9UoV94mhOYlbK6YgvErCPOb1g6WqNCyKodSfce52OwAMHOe0HzWHsHF97GB/BR4kLxuQ8qS/3vl HJ25OW1719vGAIcPF6ner0D8bNVqOgmcK7UgPaEYcetAbJELeF39wfs4Cr3D490cNBfVikDdCM6 e5VTEGVrhLc= X-Received: by 2002:a05:600c:1c14:b0:434:fddf:5c06 with SMTP id 5b1f17b1804b1-438b8841d5amr75426785e9.1.1737736129298; Fri, 24 Jan 2025 08:28:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:48 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 09/76] target/arm: Use fp_status_a32 in vfp_cmp helpers Date: Fri, 24 Jan 2025 16:27:29 +0000 Message-Id: <20250124162836.2332150-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-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, T_SCC_BODY_TEXT_LINE=-0.01 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 helpers vfp_cmps, vfp_cmpes, vfp_cmpd, vfp_cmped are used only from the A32 decoder; the A64 decoder uses separate vfp_cmps_a64 etc helpers (because for A64 we update the main NZCV flags and for A32 we update the FPSCR NZCV flags). So we can make these helpers use the fp_status_a32 field instead of fp_status. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- We could in theory make A32 use the a64 helpers and do the setting of vfp.fpsr NZCV in the generated code from the helper return value, but it doesn't seem worthwhile to me. --- target/arm/vfp_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 0671ba3a88b..034f26e5daa 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -373,8 +373,8 @@ void VFP_HELPER(cmpe, P)(ARGTYPE a, ARGTYPE b, CPUARMState *env) \ FLOATTYPE ## _compare(a, b, &env->vfp.FPST)); \ } DO_VFP_cmp(h, float16, dh_ctype_f16, fp_status_f16) -DO_VFP_cmp(s, float32, float32, fp_status) -DO_VFP_cmp(d, float64, float64, fp_status) +DO_VFP_cmp(s, float32, float32, fp_status_a32) +DO_VFP_cmp(d, float64, float64, fp_status_a32) #undef DO_VFP_cmp /* Integer to float and float to integer conversions */ From patchwork Fri Jan 24 16:27:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859579 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp882619wrq; Fri, 24 Jan 2025 08:34:25 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWhs1vMcTFK+sXx9iA3k+ND1+W+MHZLxBGSVKjxL4QNQdAScKcurSrTnpqU+1e5/FIfrvnT1w==@linaro.org X-Google-Smtp-Source: AGHT+IF/krho4EI2e0nu3nHq6pRRXfbeYj+YUu5U/HlLMo0g6pQVV5ivnfco/94mZen0/x3cSx7H X-Received: by 2002:a05:6122:d88:b0:515:4b68:c37f with SMTP id 71dfb90a1353d-51d5b2e7e9amr26886007e0c.6.1737736464842; Fri, 24 Jan 2025 08:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736464; cv=none; d=google.com; s=arc-20240605; b=iu+MPDxkkgIpwSptOqKaSoeZZLrJms0xUIdAvgCWlVVz1/Q+e7hb1HYRKUvTaBcmKR NIX8fMEzFAoqOKDtTFDPVVV/csacPFr3ertQtOJp+m0r2r7qiutYI5020LpuaZe1LOh5 4fT4iPPfNKq783kzKfpDXyRKFvooJua2HF5yqjJ0rMqDylux/U0A2liDVJy6RTAMA+Lb 8I8IbWd2hU3pps95SxfGVc0s1oojhLI/tAvaxGZ03tdXstjek78obapKuzgcZEXT1+AF LliS+eY8fmf2CwFNfDz+/oOigph2OBqwimtoJ9Hr7iSZQW/uvmSMzS6O7Xiaa7mI16Hk 7TEA== 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=QIlQY0ATcG2mPnShBCA6UPBVn+UDLQMzHJbHdp60Tp8=; fh=xCRUq1M/MFeQhFJKlFbSCUCT+rZc+0s5LqpazM60Yqg=; b=GvmObyb1PC3l21PbdC3XS1pWie9/SOZREf/lCdtL8eUfhhKHA5rleWIhY9Nd8DD4B1 uqsaEnTwVYVQPw0R4akmDoHZv7HW+RuQMzqG09YZLfdaY1y+nGxu4WqyQ5a35DulKMNx UPs4wML5u6+ZBQcGIbzm679UyJjk2pYBmaNHwY5UfCCoKAR5S0pnA5cEH66+DSgGOuhp 2G9yXGl6Topkky9pbQjQg6iOODOXASak7azHxEPvFALZSJTsF1viCcl313wiC6pIbjJo eYUO4hYzHdL4Cz3f9o15ahRm+1epdPKCI9l+4XZK3OMU8EcrIEWmT6Sz8F5SzEGmZqV2 GsSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y+rJorE1; 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 71dfb90a1353d-51e4ea3774csi919416e0c.28.2025.01.24.08.34.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:34:24 -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=Y+rJorE1; 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 1tbMYc-0004DW-Pl; Fri, 24 Jan 2025 11:29:23 -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 1tbMYH-0003nX-2Q for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:01 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYC-0005Oz-PH for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:00 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-43635796b48so15503435e9.0 for ; Fri, 24 Jan 2025 08:28:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736130; x=1738340930; 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=QIlQY0ATcG2mPnShBCA6UPBVn+UDLQMzHJbHdp60Tp8=; b=Y+rJorE19Ea/GHXwuCpsOoPfPuYdC5qQ8MxVSKf39kwK+Kryf2ZAFXul4m2IPfxS/m /ldf2ZfQIx8tcwXJxbnPUbag3ZlWbHI/FpE8cTntJIWsZLlJmI1+vkfCNwNHqqxgjXxh oFixjWQ6gkdlSFBPQBriIKeWhUXeE0nDYfdEO5iws4M6vZYNSY/nrl3w/21MFjyyoIHH O+RlNaDx4Lbzk/M5AqFBS/mrUozCDXvWi3nvcBEgQwo1XcAPv5VF8L7Lc/slZyEqxok2 ICczKE/QK1eP4S0KbNRHW6QGluIx8oB6fjodYv+b43AWxEQI06PDVgsSJqJfLFQkwyKC PLiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736130; x=1738340930; 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=QIlQY0ATcG2mPnShBCA6UPBVn+UDLQMzHJbHdp60Tp8=; b=X9kqUjX5UYlLHRzscXzpBsnSaTviouqCdZeMhu6DL+2BK0ww4kLHrwStpse6mumxUP viLp8c9xlplJwh4EZBKPVZWIL3UWbZMdjoTf7eVIz15xPM/Mk6OqdTvSQaZiZkkJQwU3 rYv/Qe2ljgYLZjz7cy6Kw6vAnkGuH8mVO2E7T8uNaFXUUKzDQ1/w+wJNNKzGlrSh2z/T U3qdYKsMpazC2nFjj0dmmu/koZ2ivg+gVAG2wb9sQrbMC+Pnr0pxRzAhomCnLsSFKUA4 ULDVxqBH+I9OIf+i4PXm9Wr8YEvUCEUwIBiYu3G2A1wR2c7GUax1satPqA8ThN+u1s8k UQyg== X-Forwarded-Encrypted: i=1; AJvYcCXQmMj9DIobP6s6yViBz0zcNZacB1+2+pSoBH7+RpbaXFoE7NJQ1Ja//7G00WPyp5j3zI37keZJA3DB@nongnu.org X-Gm-Message-State: AOJu0Yx4Kf/3d0wnzzb9uVtvhDgsYu8qPkF+MgQOHEkUA+iEoqiV7ubr 9zMnNKIidplndtgQsVZO0CW2vSQuVbOGz/x9+y/M+cLVhsVOoNN1NL3yZv+7tLhQE2K2MzSS1cl T X-Gm-Gg: ASbGncs6ul4l18tnpHmiHkE5hhE5aPX3WrRdKUzqBaARzddaLq7ybvNpg/oDKV7c2kK hHqfYOQMAUzOquXAaHGNc92GE+dxPj7DrfMOn15WaTcVfERwVa6x8ORuLmPZXrSeE/D0MjKngMo zYOONcWD8WK+ePVBMoMfJZTdRGHf+rX/n7IRcHKcEOEd0AbCxAp1ouW7xIT2sInkF759BZyotfB ajcfXNCm0mVFZK9JnlRshyXWACAvIYT85pdiMlT6IDZ9QlaRQna/LA4yboybur+7eVF18Hjd4Dw 01xNZuLjmCg= X-Received: by 2002:a05:600c:1e8e:b0:434:e65e:457b with SMTP id 5b1f17b1804b1-438bd67f134mr35054145e9.3.1737736130314; Fri, 24 Jan 2025 08:28:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:49 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 10/76] target/arm: Use FPST_FPCR_A32 in A32 decoder Date: Fri, 24 Jan 2025 16:27:30 +0000 Message-Id: <20250124162836.2332150-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 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 In the A32 decoder, use FPST_FPCR_A32 rather than FPST_FPCR. By doing an automated conversion of the whole file we avoid possibly using more than one fpst value in a set_rmode/op/restore_rmode sequence. Patch created with perl -p -i -e 's/FPST_FPCR(?!_)/FPST_FPCR_A32/g' target/arm/tcg/translate-vfp.c Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-vfp.c | 54 +++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c index 3cbe9a7418d..e1b8243c5d9 100644 --- a/target/arm/tcg/translate-vfp.c +++ b/target/arm/tcg/translate-vfp.c @@ -462,7 +462,7 @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) if (sz == 1) { fpst = fpstatus_ptr(FPST_FPCR_F16); } else { - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); } tcg_rmode = gen_set_rmode(rounding, fpst); @@ -529,7 +529,7 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) if (sz == 1) { fpst = fpstatus_ptr(FPST_FPCR_F16); } else { - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); } tcg_shift = tcg_constant_i32(0); @@ -1398,7 +1398,7 @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn, f0 = tcg_temp_new_i32(); f1 = tcg_temp_new_i32(); fd = tcg_temp_new_i32(); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); vfp_load_reg32(f0, vn); vfp_load_reg32(f1, vm); @@ -1517,7 +1517,7 @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, f0 = tcg_temp_new_i64(); f1 = tcg_temp_new_i64(); fd = tcg_temp_new_i64(); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); vfp_load_reg64(f0, vn); vfp_load_reg64(f1, vm); @@ -2181,7 +2181,7 @@ static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d) /* VFNMA, VFNMS */ gen_vfp_negs(vd, vd); } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); gen_helper_vfp_muladds(vd, vn, vm, vd, fpst); vfp_store_reg32(vd, a->vd); return true; @@ -2246,7 +2246,7 @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d) /* VFNMA, VFNMS */ gen_vfp_negd(vd, vd); } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); gen_helper_vfp_muladdd(vd, vn, vm, vd, fpst); vfp_store_reg64(vd, a->vd); return true; @@ -2429,12 +2429,12 @@ static void gen_VSQRT_hp(TCGv_i32 vd, TCGv_i32 vm) static void gen_VSQRT_sp(TCGv_i32 vd, TCGv_i32 vm) { - gen_helper_vfp_sqrts(vd, vm, fpstatus_ptr(FPST_FPCR)); + gen_helper_vfp_sqrts(vd, vm, fpstatus_ptr(FPST_FPCR_A32)); } static void gen_VSQRT_dp(TCGv_i64 vd, TCGv_i64 vm) { - gen_helper_vfp_sqrtd(vd, vm, fpstatus_ptr(FPST_FPCR)); + gen_helper_vfp_sqrtd(vd, vm, fpstatus_ptr(FPST_FPCR_A32)); } DO_VFP_2OP(VSQRT, hp, gen_VSQRT_hp, aa32_fp16_arith) @@ -2565,7 +2565,7 @@ static bool trans_VCVT_f32_f16(DisasContext *s, arg_VCVT_f32_f16 *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); ahp_mode = get_ahp_flag(); tmp = tcg_temp_new_i32(); /* The T bit tells us if we want the low or high 16 bits of Vm */ @@ -2599,7 +2599,7 @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); ahp_mode = get_ahp_flag(); tmp = tcg_temp_new_i32(); /* The T bit tells us if we want the low or high 16 bits of Vm */ @@ -2623,7 +2623,7 @@ static bool trans_VCVT_b16_f32(DisasContext *s, arg_VCVT_b16_f32 *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); tmp = tcg_temp_new_i32(); vfp_load_reg32(tmp, a->vm); @@ -2646,7 +2646,7 @@ static bool trans_VCVT_f16_f32(DisasContext *s, arg_VCVT_f16_f32 *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); ahp_mode = get_ahp_flag(); tmp = tcg_temp_new_i32(); @@ -2680,7 +2680,7 @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); ahp_mode = get_ahp_flag(); tmp = tcg_temp_new_i32(); vm = tcg_temp_new_i64(); @@ -2727,7 +2727,7 @@ static bool trans_VRINTR_sp(DisasContext *s, arg_VRINTR_sp *a) tmp = tcg_temp_new_i32(); vfp_load_reg32(tmp, a->vm); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); gen_helper_rints(tmp, tmp, fpst); vfp_store_reg32(tmp, a->vd); return true; @@ -2757,7 +2757,7 @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a) tmp = tcg_temp_new_i64(); vfp_load_reg64(tmp, a->vm); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); gen_helper_rintd(tmp, tmp, fpst); vfp_store_reg64(tmp, a->vd); return true; @@ -2803,7 +2803,7 @@ static bool trans_VRINTZ_sp(DisasContext *s, arg_VRINTZ_sp *a) tmp = tcg_temp_new_i32(); vfp_load_reg32(tmp, a->vm); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); tcg_rmode = gen_set_rmode(FPROUNDING_ZERO, fpst); gen_helper_rints(tmp, tmp, fpst); gen_restore_rmode(tcg_rmode, fpst); @@ -2836,7 +2836,7 @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a) tmp = tcg_temp_new_i64(); vfp_load_reg64(tmp, a->vm); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); tcg_rmode = gen_set_rmode(FPROUNDING_ZERO, fpst); gen_helper_rintd(tmp, tmp, fpst); gen_restore_rmode(tcg_rmode, fpst); @@ -2880,7 +2880,7 @@ static bool trans_VRINTX_sp(DisasContext *s, arg_VRINTX_sp *a) tmp = tcg_temp_new_i32(); vfp_load_reg32(tmp, a->vm); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); gen_helper_rints_exact(tmp, tmp, fpst); vfp_store_reg32(tmp, a->vd); return true; @@ -2910,7 +2910,7 @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a) tmp = tcg_temp_new_i64(); vfp_load_reg64(tmp, a->vm); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); gen_helper_rintd_exact(tmp, tmp, fpst); vfp_store_reg64(tmp, a->vd); return true; @@ -2937,7 +2937,7 @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a) vm = tcg_temp_new_i32(); vd = tcg_temp_new_i64(); vfp_load_reg32(vm, a->vm); - gen_helper_vfp_fcvtds(vd, vm, fpstatus_ptr(FPST_FPCR)); + gen_helper_vfp_fcvtds(vd, vm, fpstatus_ptr(FPST_FPCR_A32)); vfp_store_reg64(vd, a->vd); return true; } @@ -2963,7 +2963,7 @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a) vd = tcg_temp_new_i32(); vm = tcg_temp_new_i64(); vfp_load_reg64(vm, a->vm); - gen_helper_vfp_fcvtsd(vd, vm, fpstatus_ptr(FPST_FPCR)); + gen_helper_vfp_fcvtsd(vd, vm, fpstatus_ptr(FPST_FPCR_A32)); vfp_store_reg32(vd, a->vd); return true; } @@ -3010,7 +3010,7 @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a) vm = tcg_temp_new_i32(); vfp_load_reg32(vm, a->vm); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); if (a->s) { /* i32 -> f32 */ gen_helper_vfp_sitos(vm, vm, fpst); @@ -3044,7 +3044,7 @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a) vm = tcg_temp_new_i32(); vd = tcg_temp_new_i64(); vfp_load_reg32(vm, a->vm); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); if (a->s) { /* i32 -> f64 */ gen_helper_vfp_sitod(vd, vm, fpst); @@ -3161,7 +3161,7 @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) vd = tcg_temp_new_i32(); vfp_load_reg32(vd, a->vd); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); shift = tcg_constant_i32(frac_bits); /* Switch on op:U:sx bits */ @@ -3223,7 +3223,7 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) vd = tcg_temp_new_i64(); vfp_load_reg64(vd, a->vd); - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); shift = tcg_constant_i32(frac_bits); /* Switch on op:U:sx bits */ @@ -3307,7 +3307,7 @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); vm = tcg_temp_new_i32(); vfp_load_reg32(vm, a->vm); @@ -3347,7 +3347,7 @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A32); vm = tcg_temp_new_i64(); vd = tcg_temp_new_i32(); vfp_load_reg64(vm, a->vm); From patchwork Fri Jan 24 16:27:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859587 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp883777wrq; Fri, 24 Jan 2025 08:36:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUpDrwgG3zEyrzSzMehLOOci8ruEgicw/YPErqX7Pj+u8VTt/b5OaI3yDd1NUO2DANVwWdsbQ==@linaro.org X-Google-Smtp-Source: AGHT+IGOMnH+Jo5A6sWxfAtme0fhEaG1mh+WA1FkGRl4LrigE4mn4LK+SyyXkk/tRhEH5O/Dj7eX X-Received: by 2002:a05:620a:24c8:b0:7b7:142d:53a4 with SMTP id af79cd13be357-7be6325bfbdmr4557377385a.51.1737736613183; Fri, 24 Jan 2025 08:36:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736613; cv=none; d=google.com; s=arc-20240605; b=TGHEYVpNfruHHUKQTjgV0wfIkxDruhta9AXAb3ZSqx73fNTEW7AfRjCKNMN9SusVta fsFR+2jKixXr0u4xkP3MrAOwhr9VhqUwrj4qTpfhiW5+75TMF5APntG87s6nsxrE7WMa 2aLNYyYnK9zdQmm9UPNXsGXPIFVnzGl2lYO+CSrkS/FvvlWrMqfk2bZrdEoJcVxohngg y4Dc3g0nJM/YRitqK6TOQJRk7lIR84X5KfU1IoFVknnvoRqlQpT90u+EdoPx7YQWE69i LIse3grT4B6gc1bhWi/6E/I3Ep9hx5CO5qvHRjMT1B4eRXEv2fTZnjuJQhKYh+u+24Xo 9xSg== 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=aDrqjnSMD8VCp3pbInsURFBfjEWrYrGNfb1mCaoy29Y=; fh=12R7EE9kCXuOP337v1QOGWv9wiFoonGJICd/9PfIqcw=; b=OGQRfpwMRBBxmYM3xxFvnLG6Q2lB5pczGY6gWnsSzmwhbB1lVACYIfk7GLUq2duUXB Cz3wv4AsUTD4EkyKrKazteAkkReiNvVPp05UFDbOVfTUNtT3vSamWmwXgIl/vZ5YYEwU /R7XXCwQVdhkEjNvvAFzLQBn30fWd0D6zxCdc6iMSpTIk7c4yFc/wdvm051W4p/oHHIO oT9yqSFN22o2Ami3qh7+TdJmt5oNbg0oN3g/UjdD7ZReErRn8kR4GW0uGaIAXIhxYWxr YGw7bUjoMyqOFENU1uTNRzU7X2YCDmLvCCTllJM8igsuP4H8psXk+FvA9szXLxNuLbku tDJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UPbsISyC; 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-7be9aee091esi263771485a.240.2025.01.24.08.36.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:36:53 -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=UPbsISyC; 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 1tbMaH-0007UM-EY; Fri, 24 Jan 2025 11:31:05 -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 1tbMYN-0003t3-59 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:08 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYE-0005Pf-K2 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:04 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-436345cc17bso16859285e9.0 for ; Fri, 24 Jan 2025 08:28:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736131; x=1738340931; 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=aDrqjnSMD8VCp3pbInsURFBfjEWrYrGNfb1mCaoy29Y=; b=UPbsISyCX93Gu8U/eewLCy+NAkIR2ouPx/S26vI8icXX0sDxt+Cvd6EgJX1BRoCr/p isly/wbfZCzG/+IG+8ZGyfbyaASX+p+le8QPTv4do+tO4mGc1YT4e4i3WPKmwdeS4oh4 rObreRJj5HcdrV9qR7MuRc1Y0M1qDrVK1brxB5/acC4Hl51s5YS05HScF5qlry6RgqPi NOLUOrySnYsdPuQsIJYoiGLDWSpN8PqvqJbUbQw++Rw+TAqYcI/rQO6n1MHkrJRyIXg5 wkS9JqZMqhMg4MeuDPV0WiVgKvIcWsogoDZWadzAGjcyjI91h1C/zuth+TMaXHsPoX0+ uVdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736131; x=1738340931; 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=aDrqjnSMD8VCp3pbInsURFBfjEWrYrGNfb1mCaoy29Y=; b=GKNuPFakW/9FEE+6JqBF3ZtjSKnBiM9lWpovAyN6pCgYHwENCFHA/T1gGyPlBSGYms 0NJMR+t6kz/fLnf18fBXDlFKT+6I0T/9IiXK7lMdOMVl9EUmobjzgzFv4l9dbpAQ21s+ 7I+PQEn+UEmmXYHTQeeZpzfm00KMH93aHdkjINdNA2IjI1/A7lcsWAyo13G8MSdr32UU zpK3GGzi22AVGuo15CO6WnJemN5nO2YWJyWP/jRkb3MHwDPsNG2psHZPbR2XfqoeFLMm gbRsqLQCTM3qadcvy68kdTEK6jh+zTIkaUdGvCsLrC82wNnLrKvqfAnipxJoX+5gPvTU fAzg== X-Forwarded-Encrypted: i=1; AJvYcCXo+xkiGa/B2+reFqsHDDrnkmyTl4PCTnBGhYxLI+8fL++7qB/dXM/RgEsUug2Ddvs/AkQMyRTBkg6M@nongnu.org X-Gm-Message-State: AOJu0YwsTdsT9dacyPMlQQ7d92yyFwayAfUAbpAw1t0M+cPkW6pwya9t c0pDJ4uxlCp56K6ZeUOkfdOXPhLx0R8rGpIR9AN8DzZY+AM5Hlsa9ftJND/TAyb+dsAFv6K/c5Z 3 X-Gm-Gg: ASbGncuwJJeE7Duzxhd2Jp5td2yYqz/5l8/rT9sftlLxepeS5g/Z3Y8RZk0279JhK1V FF51qIIkPUeBfiBa33Xf0DzWnBTzo3lfjOk0rmNUzrAZdazi2vI1sCfhp0Y0luoiSW9HtZenSTm qqmb1fp97MvbhTcojm6Bp6QbpkjlJLJjOWWY/pcJC4Ghsa3jRAj7cdok0si6PS9i4s4DRpOOZFe pvtC/U5e4gxu0HIQ5gApXuONHTRtVG6Z5q106y6xNc7wPyfO5q0fusd2geOEsTYEU5LBz4C6MHf SNM0Og2wchDcJ6KT1mFzGA== X-Received: by 2002:a05:600c:1d07:b0:434:a929:42bb with SMTP id 5b1f17b1804b1-438913e2cbfmr318485315e9.18.1737736131395; Fri, 24 Jan 2025 08:28:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:50 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 11/76] target/arm: Use FPST_FPCR_A64 in A64 decoder Date: Fri, 24 Jan 2025 16:27:31 +0000 Message-Id: <20250124162836.2332150-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 In the A64 decoder, use FPST_FPCR_A32 rather than FPST_FPCR. By doing an automated conversion of the whole file we avoid possibly using more than one fpst value in a set_rmode/op/restore_rmode sequence. Patch created with perl -p -i -e 's/FPST_FPCR(?!_)/FPST_FPCR_A64/g' target/arm/tcg/translate-{a64,sve,sme}.c Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 70 +++++++++++----------- target/arm/tcg/translate-sme.c | 4 +- target/arm/tcg/translate-sve.c | 106 ++++++++++++++++----------------- 3 files changed, 90 insertions(+), 90 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index bd814849c19..9f10b2b2e6a 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -726,7 +726,7 @@ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn, int rm, bool is_fp16, int data, gen_helper_gvec_3_ptr *fn) { - TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR_A64); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), vec_full_reg_offset(s, rm), fpst, @@ -768,7 +768,7 @@ static void gen_gvec_op4_fpst(DisasContext *s, bool is_q, int rd, int rn, int rm, int ra, bool is_fp16, int data, gen_helper_gvec_4_ptr *fn) { - TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR_A64); tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), vec_full_reg_offset(s, rm), @@ -5043,7 +5043,7 @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f) if (fp_access_check(s)) { TCGv_i64 t0 = read_fp_dreg(s, a->rn); TCGv_i64 t1 = read_fp_dreg(s, a->rm); - f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); write_fp_dreg(s, a->rd, t0); } break; @@ -5051,7 +5051,7 @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f) if (fp_access_check(s)) { TCGv_i32 t0 = read_fp_sreg(s, a->rn); TCGv_i32 t1 = read_fp_sreg(s, a->rm); - f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); write_fp_sreg(s, a->rd, t0); } break; @@ -5243,9 +5243,9 @@ static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a, TCGv_i64 t0 = read_fp_dreg(s, a->rn); TCGv_i64 t1 = tcg_constant_i64(0); if (swap) { - f->gen_d(t0, t1, t0, fpstatus_ptr(FPST_FPCR)); + f->gen_d(t0, t1, t0, fpstatus_ptr(FPST_FPCR_A64)); } else { - f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); } write_fp_dreg(s, a->rd, t0); } @@ -5255,9 +5255,9 @@ static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a, TCGv_i32 t0 = read_fp_sreg(s, a->rn); TCGv_i32 t1 = tcg_constant_i32(0); if (swap) { - f->gen_s(t0, t1, t0, fpstatus_ptr(FPST_FPCR)); + f->gen_s(t0, t1, t0, fpstatus_ptr(FPST_FPCR_A64)); } else { - f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); } write_fp_sreg(s, a->rd, t0); } @@ -6207,7 +6207,7 @@ static bool do_fp3_scalar_idx(DisasContext *s, arg_rrx_e *a, const FPScalar *f) TCGv_i64 t1 = tcg_temp_new_i64(); read_vec_element(s, t1, a->rm, a->idx, MO_64); - f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); write_fp_dreg(s, a->rd, t0); } break; @@ -6217,7 +6217,7 @@ static bool do_fp3_scalar_idx(DisasContext *s, arg_rrx_e *a, const FPScalar *f) TCGv_i32 t1 = tcg_temp_new_i32(); read_vec_element_i32(s, t1, a->rm, a->idx, MO_32); - f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); write_fp_sreg(s, a->rd, t0); } break; @@ -6256,7 +6256,7 @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg) if (neg) { gen_vfp_negd(t1, t1); } - gen_helper_vfp_muladdd(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR)); + gen_helper_vfp_muladdd(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR_A64)); write_fp_dreg(s, a->rd, t0); } break; @@ -6270,7 +6270,7 @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg) if (neg) { gen_vfp_negs(t1, t1); } - gen_helper_vfp_muladds(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR)); + gen_helper_vfp_muladds(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR_A64)); write_fp_sreg(s, a->rd, t0); } break; @@ -6601,7 +6601,7 @@ static bool do_fp3_scalar_pair(DisasContext *s, arg_rr_e *a, const FPScalar *f) read_vec_element(s, t0, a->rn, 0, MO_64); read_vec_element(s, t1, a->rn, 1, MO_64); - f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); write_fp_dreg(s, a->rd, t0); } break; @@ -6612,7 +6612,7 @@ static bool do_fp3_scalar_pair(DisasContext *s, arg_rr_e *a, const FPScalar *f) read_vec_element_i32(s, t0, a->rn, 0, MO_32); read_vec_element_i32(s, t1, a->rn, 1, MO_32); - f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR)); + f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); write_fp_sreg(s, a->rd, t0); } break; @@ -6762,7 +6762,7 @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n) if (neg_n) { gen_vfp_negd(tn, tn); } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_muladdd(ta, tn, tm, ta, fpst); write_fp_dreg(s, a->rd, ta); } @@ -6780,7 +6780,7 @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n) if (neg_n) { gen_vfp_negs(tn, tn); } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_muladds(ta, tn, tm, ta, fpst); write_fp_sreg(s, a->rd, ta); } @@ -6895,7 +6895,7 @@ static bool do_fp_reduction(DisasContext *s, arg_qrr_e *a, if (fp_access_check(s)) { MemOp esz = a->esz; int elts = (a->q ? 16 : 8) >> esz; - TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); TCGv_i32 res = do_reduction_op(s, a->rn, esz, 0, elts, fpst, fn); write_fp_sreg(s, a->rd, res); } @@ -6939,7 +6939,7 @@ static void handle_fp_compare(DisasContext *s, int size, bool cmp_with_zero, bool signal_all_nans) { TCGv_i64 tcg_flags = tcg_temp_new_i64(); - TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); if (size == MO_64) { TCGv_i64 tcg_vn, tcg_vm; @@ -8407,7 +8407,7 @@ static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a, return check == 0; } - fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); if (rmode >= 0) { tcg_rmode = gen_set_rmode(rmode, fpst); } @@ -8513,7 +8513,7 @@ static bool trans_FCVT_s_ds(DisasContext *s, arg_rr *a) if (fp_access_check(s)) { TCGv_i32 tcg_rn = read_fp_sreg(s, a->rn); TCGv_i64 tcg_rd = tcg_temp_new_i64(); - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_fcvtds(tcg_rd, tcg_rn, fpst); write_fp_dreg(s, a->rd, tcg_rd); @@ -8526,7 +8526,7 @@ static bool trans_FCVT_s_hs(DisasContext *s, arg_rr *a) if (fp_access_check(s)) { TCGv_i32 tmp = read_fp_sreg(s, a->rn); TCGv_i32 ahp = get_ahp_flag(); - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); /* write_fp_sreg is OK here because top half of result is zero */ @@ -8540,7 +8540,7 @@ static bool trans_FCVT_s_sd(DisasContext *s, arg_rr *a) if (fp_access_check(s)) { TCGv_i64 tcg_rn = read_fp_dreg(s, a->rn); TCGv_i32 tcg_rd = tcg_temp_new_i32(); - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_fcvtsd(tcg_rd, tcg_rn, fpst); write_fp_sreg(s, a->rd, tcg_rd); @@ -8554,7 +8554,7 @@ static bool trans_FCVT_s_hd(DisasContext *s, arg_rr *a) TCGv_i64 tcg_rn = read_fp_dreg(s, a->rn); TCGv_i32 tcg_rd = tcg_temp_new_i32(); TCGv_i32 ahp = get_ahp_flag(); - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_fcvt_f64_to_f16(tcg_rd, tcg_rn, fpst, ahp); /* write_fp_sreg is OK here because top half of tcg_rd is zero */ @@ -8568,7 +8568,7 @@ static bool trans_FCVT_s_sh(DisasContext *s, arg_rr *a) if (fp_access_check(s)) { TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn); TCGv_i32 tcg_rd = tcg_temp_new_i32(); - TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR); + TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR_A64); TCGv_i32 tcg_ahp = get_ahp_flag(); gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); @@ -8582,7 +8582,7 @@ static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a) if (fp_access_check(s)) { TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn); TCGv_i64 tcg_rd = tcg_temp_new_i64(); - TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR); + TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR_A64); TCGv_i32 tcg_ahp = get_ahp_flag(); gen_helper_vfp_fcvt_f16_to_f64(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); @@ -8598,7 +8598,7 @@ static bool do_cvtf_scalar(DisasContext *s, MemOp esz, int rd, int shift, TCGv_i32 tcg_shift, tcg_single; TCGv_i64 tcg_double; - tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); tcg_shift = tcg_constant_i32(shift); switch (esz) { @@ -8693,7 +8693,7 @@ static void do_fcvt_scalar(DisasContext *s, MemOp out, MemOp esz, TCGv_ptr tcg_fpstatus; TCGv_i32 tcg_shift, tcg_rmode, tcg_single; - tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); tcg_shift = tcg_constant_i32(shift); tcg_rmode = gen_set_rmode(rmode, tcg_fpstatus); @@ -8857,7 +8857,7 @@ static bool trans_FJCVTZS(DisasContext *s, arg_FJCVTZS *a) } if (fp_access_check(s)) { TCGv_i64 t = read_fp_dreg(s, a->rn); - TCGv_ptr fpstatus = fpstatus_ptr(FPST_FPCR); + TCGv_ptr fpstatus = fpstatus_ptr(FPST_FPCR_A64); gen_helper_fjcvtzs(t, t, fpstatus); @@ -9115,7 +9115,7 @@ static void gen_fcvtxn_sd(TCGv_i64 d, TCGv_i64 n) * with von Neumann rounding (round to odd) */ TCGv_i32 tmp = tcg_temp_new_i32(); - gen_helper_fcvtx_f64_to_f32(tmp, n, fpstatus_ptr(FPST_FPCR)); + gen_helper_fcvtx_f64_to_f32(tmp, n, fpstatus_ptr(FPST_FPCR_A64)); tcg_gen_extu_i32_i64(d, tmp); } @@ -9208,7 +9208,7 @@ static void gen_fcvtn_hs(TCGv_i64 d, TCGv_i64 n) { TCGv_i32 tcg_lo = tcg_temp_new_i32(); TCGv_i32 tcg_hi = tcg_temp_new_i32(); - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); TCGv_i32 ahp = get_ahp_flag(); tcg_gen_extr_i64_i32(tcg_lo, tcg_hi, n); @@ -9221,7 +9221,7 @@ static void gen_fcvtn_hs(TCGv_i64 d, TCGv_i64 n) static void gen_fcvtn_sd(TCGv_i64 d, TCGv_i64 n) { TCGv_i32 tmp = tcg_temp_new_i32(); - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_fcvtsd(tmp, n, fpst); tcg_gen_extu_i32_i64(d, tmp); @@ -9237,7 +9237,7 @@ TRANS(FCVTXN_v, do_2misc_narrow_vector, a, f_scalar_fcvtxn) static void gen_bfcvtn_hs(TCGv_i64 d, TCGv_i64 n) { - TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR); + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); TCGv_i32 tmp = tcg_temp_new_i32(); gen_helper_bfcvt_pair(tmp, n, fpst); tcg_gen_extu_i32_i64(d, tmp); @@ -9312,7 +9312,7 @@ static bool do_fp1_vector(DisasContext *s, arg_qrr_e *a, return check == 0; } - fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); if (rmode >= 0) { tcg_rmode = gen_set_rmode(rmode, fpst); } @@ -9372,7 +9372,7 @@ static bool do_gvec_op2_fpst(DisasContext *s, MemOp esz, bool is_q, return check == 0; } - fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), fpst, is_q ? 16 : 8, vec_full_reg_size(s), @@ -9511,7 +9511,7 @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR); + fpst = fpstatus_ptr(FPST_FPCR_A64); if (a->esz == MO_64) { /* 32 -> 64 bit fp conversion */ TCGv_i64 tcg_res[2]; diff --git a/target/arm/tcg/translate-sme.c b/target/arm/tcg/translate-sme.c index 01ece570164..29bec7dd7bb 100644 --- a/target/arm/tcg/translate-sme.c +++ b/target/arm/tcg/translate-sme.c @@ -358,9 +358,9 @@ static bool do_outprod_env(DisasContext *s, arg_op *a, MemOp esz, TRANS_FEAT(FMOPA_h, aa64_sme, do_outprod_env, a, MO_32, gen_helper_sme_fmopa_h) TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, - MO_32, FPST_FPCR, gen_helper_sme_fmopa_s) + MO_32, FPST_FPCR_A64, gen_helper_sme_fmopa_s) TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, - MO_64, FPST_FPCR, gen_helper_sme_fmopa_d) + MO_64, FPST_FPCR_A64, gen_helper_sme_fmopa_d) TRANS_FEAT(BFMOPA, aa64_sme, do_outprod_env, a, MO_32, gen_helper_sme_bfmopa) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index e3031965920..caf8ea18328 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -141,7 +141,7 @@ static bool gen_gvec_fpst_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn, arg_rr_esz *a, int data) { return gen_gvec_fpst_zz(s, fn, a->rd, a->rn, data, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); } /* Invoke an out-of-line helper on 3 Zregs. */ @@ -191,7 +191,7 @@ static bool gen_gvec_fpst_arg_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn, arg_rrr_esz *a, int data) { return gen_gvec_fpst_zzz(s, fn, a->rd, a->rn, a->rm, data, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); } /* Invoke an out-of-line helper on 4 Zregs. */ @@ -397,7 +397,7 @@ static bool gen_gvec_fpst_arg_zpzz(DisasContext *s, gen_helper_gvec_4_ptr *fn, arg_rprr_esz *a) { return gen_gvec_fpst_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); } /* Invoke a vector expander on two Zregs and an immediate. */ @@ -3517,7 +3517,7 @@ static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub) }; return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, (a->index << 1) | sub, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); } TRANS_FEAT(FMLA_zzxz, aa64_sve, do_FMLA_zzxz, a, false) @@ -3533,7 +3533,7 @@ static gen_helper_gvec_3_ptr * const fmul_idx_fns[4] = { }; TRANS_FEAT(FMUL_zzx, aa64_sve, gen_gvec_fpst_zzz, fmul_idx_fns[a->esz], a->rd, a->rn, a->rm, a->index, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) /* *** SVE Floating Point Fast Reduction Group @@ -3566,7 +3566,7 @@ static bool do_reduce(DisasContext *s, arg_rpr_esz *a, tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, a->rn)); tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg)); - status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); fn(temp, t_zn, t_pg, status, t_desc); @@ -3618,7 +3618,7 @@ static bool do_ppz_fp(DisasContext *s, arg_rpr_esz *a, if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); TCGv_ptr status = - fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); tcg_gen_gvec_3_ptr(pred_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), @@ -3654,7 +3654,7 @@ static gen_helper_gvec_3_ptr * const ftmad_fns[4] = { }; TRANS_FEAT_NONSTREAMING(FTMAD, aa64_sve, gen_gvec_fpst_zzz, ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) /* *** SVE Floating Point Accumulating Reduction Group @@ -3687,7 +3687,7 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) t_pg = tcg_temp_new_ptr(); tcg_gen_addi_ptr(t_rm, tcg_env, vec_full_reg_offset(s, a->rm)); tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg)); - t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); t_desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); fns[a->esz - 1](t_val, t_val, t_rm, t_pg, t_fpst, t_desc); @@ -3762,7 +3762,7 @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16, tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, zn)); tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg)); - status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); + status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR_A64); desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); fn(t_zd, t_zn, t_pg, scalar, status, desc); } @@ -3814,7 +3814,7 @@ static bool do_fp_cmp(DisasContext *s, arg_rprr_esz *a, } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); tcg_gen_gvec_4_ptr(pred_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -3847,7 +3847,7 @@ static gen_helper_gvec_4_ptr * const fcadd_fns[] = { }; TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz], a->rd, a->rn, a->rm, a->pg, a->rot, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) #define DO_FMLA(NAME, name) \ static gen_helper_gvec_5_ptr * const name##_fns[4] = { \ @@ -3856,7 +3856,7 @@ TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz], }; \ TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_zzzzp, name##_fns[a->esz], \ a->rd, a->rn, a->rm, a->ra, a->pg, 0, \ - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) DO_FMLA(FMLA_zpzzz, fmla_zpzzz) DO_FMLA(FMLS_zpzzz, fmls_zpzzz) @@ -3871,35 +3871,35 @@ static gen_helper_gvec_5_ptr * const fcmla_fns[4] = { }; TRANS_FEAT(FCMLA_zpzzz, aa64_sve, gen_gvec_fpst_zzzzp, fcmla_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->pg, a->rot, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) static gen_helper_gvec_4_ptr * const fcmla_idx_fns[4] = { NULL, gen_helper_gvec_fcmlah_idx, gen_helper_gvec_fcmlas_idx, NULL }; TRANS_FEAT(FCMLA_zzxz, aa64_sve, gen_gvec_fpst_zzzz, fcmla_idx_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->index * 4 + a->rot, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) /* *** SVE Floating Point Unary Operations Predicated Group */ TRANS_FEAT(FCVT_sh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvt_sh, a, 0, FPST_FPCR) + gen_helper_sve_fcvt_sh, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVT_hs, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvt_hs, a, 0, FPST_FPCR) + gen_helper_sve_fcvt_hs, a, 0, FPST_FPCR_A64) TRANS_FEAT(BFCVT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, - gen_helper_sve_bfcvt, a, 0, FPST_FPCR) + gen_helper_sve_bfcvt, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVT_dh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvt_dh, a, 0, FPST_FPCR) + gen_helper_sve_fcvt_dh, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVT_hd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvt_hd, a, 0, FPST_FPCR) + gen_helper_sve_fcvt_hd, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVT_ds, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvt_ds, a, 0, FPST_FPCR) + gen_helper_sve_fcvt_ds, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVT_sd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvt_sd, a, 0, FPST_FPCR) + gen_helper_sve_fcvt_sd, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTZS_hh, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_fcvtzs_hh, a, 0, FPST_FPCR_F16) @@ -3915,22 +3915,22 @@ TRANS_FEAT(FCVTZU_hd, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_fcvtzu_hd, a, 0, FPST_FPCR_F16) TRANS_FEAT(FCVTZS_ss, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzs_ss, a, 0, FPST_FPCR) + gen_helper_sve_fcvtzs_ss, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTZU_ss, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzu_ss, a, 0, FPST_FPCR) + gen_helper_sve_fcvtzu_ss, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTZS_sd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzs_sd, a, 0, FPST_FPCR) + gen_helper_sve_fcvtzs_sd, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTZU_sd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzu_sd, a, 0, FPST_FPCR) + gen_helper_sve_fcvtzu_sd, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTZS_ds, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzs_ds, a, 0, FPST_FPCR) + gen_helper_sve_fcvtzs_ds, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTZU_ds, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzu_ds, a, 0, FPST_FPCR) + gen_helper_sve_fcvtzu_ds, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTZS_dd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzs_dd, a, 0, FPST_FPCR) + gen_helper_sve_fcvtzs_dd, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTZU_dd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzu_dd, a, 0, FPST_FPCR) + gen_helper_sve_fcvtzu_dd, a, 0, FPST_FPCR_A64) static gen_helper_gvec_3_ptr * const frint_fns[] = { NULL, @@ -3939,7 +3939,7 @@ static gen_helper_gvec_3_ptr * const frint_fns[] = { gen_helper_sve_frint_d }; TRANS_FEAT(FRINTI, aa64_sve, gen_gvec_fpst_arg_zpz, frint_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) static gen_helper_gvec_3_ptr * const frintx_fns[] = { NULL, @@ -3948,7 +3948,7 @@ static gen_helper_gvec_3_ptr * const frintx_fns[] = { gen_helper_sve_frintx_d }; TRANS_FEAT(FRINTX, aa64_sve, gen_gvec_fpst_arg_zpz, frintx_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, ARMFPRounding mode, gen_helper_gvec_3_ptr *fn) @@ -3965,7 +3965,7 @@ static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, } vsz = vec_full_reg_size(s); - status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); + status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); tmode = gen_set_rmode(mode, status); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), @@ -3993,14 +3993,14 @@ static gen_helper_gvec_3_ptr * const frecpx_fns[] = { gen_helper_sve_frecpx_s, gen_helper_sve_frecpx_d, }; TRANS_FEAT(FRECPX, aa64_sve, gen_gvec_fpst_arg_zpz, frecpx_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) static gen_helper_gvec_3_ptr * const fsqrt_fns[] = { NULL, gen_helper_sve_fsqrt_h, gen_helper_sve_fsqrt_s, gen_helper_sve_fsqrt_d, }; TRANS_FEAT(FSQRT, aa64_sve, gen_gvec_fpst_arg_zpz, fsqrt_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) TRANS_FEAT(SCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_scvt_hh, a, 0, FPST_FPCR_F16) @@ -4010,14 +4010,14 @@ TRANS_FEAT(SCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_scvt_dh, a, 0, FPST_FPCR_F16) TRANS_FEAT(SCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_scvt_ss, a, 0, FPST_FPCR) + gen_helper_sve_scvt_ss, a, 0, FPST_FPCR_A64) TRANS_FEAT(SCVTF_ds, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_scvt_ds, a, 0, FPST_FPCR) + gen_helper_sve_scvt_ds, a, 0, FPST_FPCR_A64) TRANS_FEAT(SCVTF_sd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_scvt_sd, a, 0, FPST_FPCR) + gen_helper_sve_scvt_sd, a, 0, FPST_FPCR_A64) TRANS_FEAT(SCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_scvt_dd, a, 0, FPST_FPCR) + gen_helper_sve_scvt_dd, a, 0, FPST_FPCR_A64) TRANS_FEAT(UCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_ucvt_hh, a, 0, FPST_FPCR_F16) @@ -4027,14 +4027,14 @@ TRANS_FEAT(UCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_ucvt_dh, a, 0, FPST_FPCR_F16) TRANS_FEAT(UCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_ucvt_ss, a, 0, FPST_FPCR) + gen_helper_sve_ucvt_ss, a, 0, FPST_FPCR_A64) TRANS_FEAT(UCVTF_ds, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_ucvt_ds, a, 0, FPST_FPCR) + gen_helper_sve_ucvt_ds, a, 0, FPST_FPCR_A64) TRANS_FEAT(UCVTF_sd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_ucvt_sd, a, 0, FPST_FPCR) + gen_helper_sve_ucvt_sd, a, 0, FPST_FPCR_A64) TRANS_FEAT(UCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_ucvt_dd, a, 0, FPST_FPCR) + gen_helper_sve_ucvt_dd, a, 0, FPST_FPCR_A64) /* *** SVE Memory - 32-bit Gather and Unsized Contiguous Group @@ -6916,10 +6916,10 @@ DO_ZPZZ_FP(FMINP, aa64_sve2, sve2_fminp_zpzz) TRANS_FEAT_NONSTREAMING(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_s, a->rd, a->rn, a->rm, a->ra, - 0, FPST_FPCR) + 0, FPST_FPCR_A64) TRANS_FEAT_NONSTREAMING(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_d, a->rd, a->rn, a->rm, a->ra, - 0, FPST_FPCR) + 0, FPST_FPCR_A64) static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = { NULL, gen_helper_sve2_sqdmlal_zzzw_h, @@ -7035,17 +7035,17 @@ TRANS_FEAT_NONSTREAMING(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz, gen_gvec_rax1, a) TRANS_FEAT(FCVTNT_sh, aa64_sve2, gen_gvec_fpst_arg_zpz, - gen_helper_sve2_fcvtnt_sh, a, 0, FPST_FPCR) + gen_helper_sve2_fcvtnt_sh, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTNT_ds, aa64_sve2, gen_gvec_fpst_arg_zpz, - gen_helper_sve2_fcvtnt_ds, a, 0, FPST_FPCR) + gen_helper_sve2_fcvtnt_ds, a, 0, FPST_FPCR_A64) TRANS_FEAT(BFCVTNT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, - gen_helper_sve_bfcvtnt, a, 0, FPST_FPCR) + gen_helper_sve_bfcvtnt, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTLT_hs, aa64_sve2, gen_gvec_fpst_arg_zpz, - gen_helper_sve2_fcvtlt_hs, a, 0, FPST_FPCR) + gen_helper_sve2_fcvtlt_hs, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTLT_sd, aa64_sve2, gen_gvec_fpst_arg_zpz, - gen_helper_sve2_fcvtlt_sd, a, 0, FPST_FPCR) + gen_helper_sve2_fcvtlt_sd, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTX_ds, aa64_sve2, do_frint_mode, a, FPROUNDING_ODD, gen_helper_sve_fcvt_ds) @@ -7057,7 +7057,7 @@ static gen_helper_gvec_3_ptr * const flogb_fns[] = { gen_helper_flogb_s, gen_helper_flogb_d }; TRANS_FEAT(FLOGB, aa64_sve2, gen_gvec_fpst_arg_zpz, flogb_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) static bool do_FMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sub, bool sel) { @@ -7101,7 +7101,7 @@ TRANS_FEAT_NONSTREAMING(BFMMLA, aa64_sve_bf16, gen_gvec_env_arg_zzzz, static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) { return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal, - a->rd, a->rn, a->rm, a->ra, sel, FPST_FPCR); + a->rd, a->rn, a->rm, a->ra, sel, FPST_FPCR_A64); } TRANS_FEAT(BFMLALB_zzzw, aa64_sve_bf16, do_BFMLAL_zzzw, a, false) @@ -7111,7 +7111,7 @@ static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sel) { return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal_idx, a->rd, a->rn, a->rm, a->ra, - (a->index << 1) | sel, FPST_FPCR); + (a->index << 1) | sel, FPST_FPCR_A64); } TRANS_FEAT(BFMLALB_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, false) From patchwork Fri Jan 24 16:27:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859569 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881773wrq; Fri, 24 Jan 2025 08:32:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVBCW5uMHpWYdgk/z01iMOm9H77uqrLO5wjnW9Z+79pWy2TMZYlSwQeodcGJ0aviju5Qqbllg==@linaro.org X-Google-Smtp-Source: AGHT+IGYAtJ40+hZH6Q5826ARs8LtgjZyd7W6U+a5hsPmQ+UfUWcPkVIr6mKz6o0NRJN8JX3uuAl X-Received: by 2002:a05:622a:241:b0:467:61da:1ce2 with SMTP id d75a77b69052e-46e12a5718fmr501928581cf.16.1737736370621; Fri, 24 Jan 2025 08:32:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736370; cv=none; d=google.com; s=arc-20240605; b=CgjKVCyGQ2gQwu4te0i0kvlkL5ZyKqzK3a+vUNBOXMoeQFPUVy0S5BlY1PGGdskYMb w51J310I15orNN1etVNCSJdfhFlRZ0aRSwqk6nL/h+KSQ+9vE9LPpMoVV3MYfJZgJwgk wbQr3RKDK77EOZ71l2z8itTqqO4vaXqEapE+7qs5EqrX6WvIlrXiguhlQK7TGYXzN61v yEhBDEIK+3YyMx9AcX+O+H0i7s7xokJS5LvZJKIB98cXhO7IMOGcTgI8QWX43SaE6pcD v9ModmKYOX7xiEx0JNM+npAbUblHrgNVUanmub8EAH1KgnWXZRD0UFsqnI7t+cXpsq1S 7O5A== 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=7RHGAgr/hKGQtSL5QHgoLI2mVD1OoVEOmdEQ9/ADY9s=; fh=kmRLUmvz4NcdkjhcOaH+8Ag5pB5XyxoPtq6UvrocoPY=; b=layFq1+sKgi2Xd9/9t3X8KF5Hy6qf6ps6JtPsofQNJsMURhBDIiAokPV6guq8FXwop N+YzU8tPpaYIMUoMWzUlkU/NMVgiIimDVAg+PWxP37DCVtKioEmy1mUF3Tr9RIXBpByX b59GjuhA324zCVUajlUtLjaRp7MpjNwlg0X1bqhbqEHRcAsjGmshN+iRE2VfAnHb1hhy EhxBhyIN2C7XmUka8sf24eGCRO5FBZWwpQnEE8MmGdyNiDdc3ihkjTDVXTJlPOFiACLt SLlrhGhmSAAKQc8S1rcXFNzoOnI2co3nDQ1PSKtLQi71YddawkcL1uV7J3cl6enUoSJE 64bA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u0Q642vQ; 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-46e66887aa1si31135361cf.168.2025.01.24.08.32.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:32:50 -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=u0Q642vQ; 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 1tbMYl-0004mZ-L7; Fri, 24 Jan 2025 11:29:31 -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 1tbMYH-0003nY-2W for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:01 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYC-0005QD-PY for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:00 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43622267b2eso23692215e9.0 for ; Fri, 24 Jan 2025 08:28:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736134; x=1738340934; 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=7RHGAgr/hKGQtSL5QHgoLI2mVD1OoVEOmdEQ9/ADY9s=; b=u0Q642vQr0XdhByY/epgBqUytV3Y46pSmjK2FSRbBobReesQptcAvTIOM/sFOSK81y 2ShHHnI22aM87u200yCcA0rYNRDWcH+xW/SOrp0aZ6tmRMui8Hq8ZisUuiZdW5B7I6b3 DnkuoS3oGMcKyDkxLUQgy+uouj2tuFudZGISvNViJ73yGtx4HtPyZZ4rGTuGB7f850EX qwKs1730K6iSOe7XEvPnwCxUhrLA2FJC+6jLvj0TCYrhd5Dhw9WYLj8QohEmNheGuVHv 74SHJHAp+XMmI3Do1RnIpin1pZpUDvoc9wEfAB/7kICyO6R9Q5wlmxnhgv5e3BNK5oCO bkLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736134; x=1738340934; 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=7RHGAgr/hKGQtSL5QHgoLI2mVD1OoVEOmdEQ9/ADY9s=; b=f/xULUoIf8j6oKF44D3epMaEw/qWMebfkODO4U3BJ7lQ+9fEYr0z8s4NePNJ8BYJku 1zqUCF7CDO10qPxLkbNoNrdwjXOIr+uGmFz24SYELRYfdrOHcNdTjH5LcIPKpcGi7wbL UdOAhmCDZIZHPXk2/LInRXtu9IeIuwouq5NpIodaIXN1Ad6t4Y4fV74isKAwCEcSVfwo 2Nd3VOjqtAaPtBfLEtGd7vvc0xaRBOhg9KjikoWn00D+llv9ujpAhrpTrYobv3/Y1GS7 vmu5aIbf6P088lY1R/u+10HmYYpCPDzNnUbmuPCLWHZdLQ7laNwm9a8smxJuWdcQQWGB 5SKg== X-Forwarded-Encrypted: i=1; AJvYcCWnnT2RtxOhq6myHGxDDKbv816CuFYRiPpked+6MC6OoEE/V0N6ydb7KAupY7ySgqV8Ww/vEq4WCCtL@nongnu.org X-Gm-Message-State: AOJu0Yw1C6Qc3eTo29VcAurSo9VQg76eqAPanF6dKBXTpzZOZ9jVVSLM Z/PCZ7JaIt6k2OUbyXArgl1EMmMEPllsw1gASz4LyQb7z8xHCKNC6sLgcf9wxAw= X-Gm-Gg: ASbGnctXv+j0wzYL6OO2IsLrvNjLxYIuZcVGPOu2gDKOeeiJ+XsUrKajG5Fx1mjBkLw iptYxDl8LZ0KOL8m02GNXW5qt3738dSRFbNzbWPcNjlwMHkG7qhM+Xz6Q6sNHz7xFyMWYFsRT92 sQq9OJkBRj0bk4rO2WszrcrBc45DglJzCuY0rAI+H2ogz+RPO5zJHNvd/FT2S6X42EpLlyNomZI IAxwX8ctqR6lCIKy4R13lvv8W3NprJyRTE4OcTrDdBHPaWh9jYWRATAJG5XSgVR38uk8Cd52Fmb F5k/bLL9t9s= X-Received: by 2002:a05:600c:4e52:b0:436:e751:e445 with SMTP id 5b1f17b1804b1-438a079c1e7mr275279235e9.5.1737736132377; Fri, 24 Jan 2025 08:28:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:51 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 12/76] target/arm: Remove now-unused vfp.fp_status and FPST_FPCR Date: Fri, 24 Jan 2025 16:27:32 +0000 Message-Id: <20250124162836.2332150-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Now we have moved all the uses of vfp.fp_status and FPST_FPCR to either the A32 or A64 fields, we can remove these. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 2 -- target/arm/tcg/translate.h | 6 ------ target/arm/cpu.c | 1 - target/arm/vfp_helper.c | 8 +------- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 337c5383748..7b967bbd1d2 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -633,7 +633,6 @@ typedef struct CPUArchState { /* There are a number of distinct float control structures: * - * fp_status: is the "normal" fp status. * fp_status_a32: is the "normal" fp status for AArch32 insns * fp_status_a64: is the "normal" fp status for AArch64 insns * fp_status_fp16: used for half-precision calculations @@ -660,7 +659,6 @@ typedef struct CPUArchState { * only thing which needs to read the exception flags being * an explicit FPSCR read. */ - float_status fp_status; float_status fp_status_a32; float_status fp_status_a64; float_status fp_status_f16; diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index a7509b314b0..197772eb13d 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -670,7 +670,6 @@ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb) * Enum for argument to fpstatus_ptr(). */ typedef enum ARMFPStatusFlavour { - FPST_FPCR, FPST_FPCR_A32, FPST_FPCR_A64, FPST_FPCR_F16, @@ -686,8 +685,6 @@ typedef enum ARMFPStatusFlavour { * been set up to point to the requested field in the CPU state struct. * The options are: * - * FPST_FPCR - * for non-FP16 operations controlled by the FPCR * FPST_FPCR_A32 * for AArch32 non-FP16 operations controlled by the FPCR * FPST_FPCR_A64 @@ -705,9 +702,6 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) int offset; switch (flavour) { - case FPST_FPCR: - offset = offsetof(CPUARMState, vfp.fp_status); - break; case FPST_FPCR_A32: offset = offsetof(CPUARMState, vfp.fp_status_a32); break; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 8bdd535db95..a2b9bd3fb9d 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -572,7 +572,6 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type) set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status); set_default_nan_mode(1, &env->vfp.standard_fp_status); set_default_nan_mode(1, &env->vfp.standard_fp_status_f16); - arm_set_default_fp_behaviours(&env->vfp.fp_status); arm_set_default_fp_behaviours(&env->vfp.fp_status_a32); arm_set_default_fp_behaviours(&env->vfp.fp_status_a64); arm_set_default_fp_behaviours(&env->vfp.standard_fp_status); diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 034f26e5daa..9fee6265f20 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -61,9 +61,8 @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits) static uint32_t vfp_get_fpsr_from_host(CPUARMState *env) { - uint32_t i; + uint32_t i = 0; - i = get_float_exception_flags(&env->vfp.fp_status); i |= get_float_exception_flags(&env->vfp.fp_status_a32); i |= get_float_exception_flags(&env->vfp.fp_status_a64); i |= get_float_exception_flags(&env->vfp.standard_fp_status); @@ -82,7 +81,6 @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env) * values. The caller should have arranged for env->vfp.fpsr to * be the architecturally up-to-date exception flag information first. */ - set_float_exception_flags(0, &env->vfp.fp_status); set_float_exception_flags(0, &env->vfp.fp_status_a32); set_float_exception_flags(0, &env->vfp.fp_status_a64); set_float_exception_flags(0, &env->vfp.fp_status_f16); @@ -112,7 +110,6 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) i = float_round_to_zero; break; } - set_float_rounding_mode(i, &env->vfp.fp_status); set_float_rounding_mode(i, &env->vfp.fp_status_a32); set_float_rounding_mode(i, &env->vfp.fp_status_a64); set_float_rounding_mode(i, &env->vfp.fp_status_f16); @@ -126,8 +123,6 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) } if (changed & FPCR_FZ) { bool ftz_enabled = val & FPCR_FZ; - set_flush_to_zero(ftz_enabled, &env->vfp.fp_status); - set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status); set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a32); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a32); set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a64); @@ -135,7 +130,6 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) } if (changed & FPCR_DN) { bool dnan_enabled = val & FPCR_DN; - set_default_nan_mode(dnan_enabled, &env->vfp.fp_status); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16); From patchwork Fri Jan 24 16:27:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859592 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp885032wrq; Fri, 24 Jan 2025 08:39:47 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXo0ugx9SLV4aroy6P0vUL9werkeoM/gfGt2wzaLspobrFgih/FTp5F9Sl5Qogf39Juyknr7g==@linaro.org X-Google-Smtp-Source: AGHT+IGo8w6vHEeBNQNYbZC3x6sBbBZNyb0k3p55hTl9Z6hOBgSfLc5wa2CRxJcWqCobTvYsP3mZ X-Received: by 2002:a05:6214:20a6:b0:6d8:99cf:d2e3 with SMTP id 6a1803df08f44-6e1b2180eafmr421491746d6.22.1737736786899; Fri, 24 Jan 2025 08:39:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736786; cv=none; d=google.com; s=arc-20240605; b=G2y3kibfGuSzDoRADuQytY3sdVJ6bWmkrGPD+IfHANIbNGuoG0IqyRvHnaQalQlBWG ZDfzMjbkfQHREgfUAVSkDnwNKi6R4mEsxd4wqSCK2njhn8xOd4pTd7ihPgx72z4EKIGY qTDSGAYfmHBnCjCXs/LDEm4iujz+ZW7lNMXlrkEFlvoVm0FW43/4S/rFTkpYq4jnEFyc 9r0Dm3+CxsaXOaLDKEnfjAVKXjxz2arOxPluL3THoVPtuRlMNrmrm9m5wcQLe46XxZsC XCFIbFmlBb9eHIRaCCjLymPVP2tRBApZlAOmDQq+l2qjE6ktS5AmMn6gbeYQKXyjMGek 6WSQ== 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=1fTQgZA5aAX5RMS6PA5fZD0DXJXNgm9B+ZdvixNCRKw=; fh=oWZ7aQz/7y/PxdQuBQbeXQuYjm5pBTu3y+DHU4vkuJQ=; b=kLBAzlvjv5fHw6ytZjd5HneC5DHblb/y32QKOQQlmVQNKSbR1PANASRu7TRADfTBnn DjfeaqeQP6hXigkn5FbpU58qorctiMGP56XB6lmwQ4N2IdB6nefZ17JOrzZToQJTIuuZ 9kz/+F7F4wkhTNMKBnowN4MWWu8bw3LgsLzoYWmNriLlg2poiLGvYClSBasUcWRma859 VTL2SsspNfaCQE9SwjgO6NkQq0W7Py830DCTPbmUL9CE92U2vv1LUIPi/OtQe0P/OmBf HD/KH/VzuzIHM3nvmMvDN0+Fs0XTZ6dt66DI8osKUligTFg27CL8bs6862EU+sKtK4Za eHZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o09kNWa6; 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-6e206135052si26275146d6.507.2025.01.24.08.39.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:39:46 -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=o09kNWa6; 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 1tbMYp-00051m-Lg; Fri, 24 Jan 2025 11:29: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 1tbMYG-0003lq-IF for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:01 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYB-0005Q7-3m for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:28:59 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-38a34e8410bso1244340f8f.2 for ; Fri, 24 Jan 2025 08:28:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736133; x=1738340933; 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=1fTQgZA5aAX5RMS6PA5fZD0DXJXNgm9B+ZdvixNCRKw=; b=o09kNWa6pNO6rX6VjpKAikb89ru65Qjl9GlHvQNy+3E5Vfnp2eRZpuuFgVbWB+Ihor nszwDQsuXX+275Js/WaeIPNNt5Bw+0M6X3za9/so5/8wHXql5bwvXiKE7HW0274Z7ctz PBKkXufVMpDHKbDzQyD8vPIItaxCqlnso9I2RoYFIBMP3Sl6XkIWuaCifLjDE7VJdrM+ 7mVH9M0H1AQc1bA5G/w85eoametafvrTT7Mh1zjMRrOLjmj6YGZdehG7t6TVRc13/aVx pDki3PXud8qtvNfkzidDkBWdLT+JKPkPXMByNJ7B7bdjZ07X5jDxoAdpAuR1nLoDe6bF kBrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736133; x=1738340933; 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=1fTQgZA5aAX5RMS6PA5fZD0DXJXNgm9B+ZdvixNCRKw=; b=HcbtNNg/1xOFQvKVgDghZYtlJM91Kz9CM3kh7GvplpGqo74xrCtTKt0m7yRpYrXiSV sMZduiWGz7g0Y4/XEBoIYZ00RIkUc53E3Q3u7f/uBuYO6hieNzl6b53S9yaXwR41EOO5 AsGRKkY5V0ZrlpzBYjeSeKkzwletVIFZH956zduLcjvICqrYolXDMBCa3KPddgAri+Mm PuNenNLpKsSQoHfWlJOOpwsI1YPgjGaPCeppIQSeOe+NcOoh/Uv9uTmFzbV+6TZqrbGY s6SVBE3l+gDIQGi9yvVR459DPUSdlwasRzNuPmqL7F4ukKBJMAzAhP+Qpj077sQ/1Yv7 Xvfg== X-Forwarded-Encrypted: i=1; AJvYcCVoyCsl32rjyclkylzA58Ot7Fp6qv0J9UHB0uD/tSVJ4ZE9DLOoF5klCjImMzxTKOPPi01fW9twU4ma@nongnu.org X-Gm-Message-State: AOJu0YzJJCnFfXnWBi/q8PNxfjEf2NAKCr8hSMzYqzA5DsSKWLYo2p+G 4AzF8FtS0AokjTXUrE4Nu4xnV/EdW0bh9e/NPptNyMFnZax50DPZVm4rL3iY9Gg= X-Gm-Gg: ASbGncvB1fioPA+QVBIBhBfvA3muXySQ/ui6rcoco/fmw5fpboJjQJTaicgk/lXYC6A gYGSYfYs6wYXa0QUfdRwMSJDsL8egHxR71fhb9BySd7PXImufR8PfogDHpL5h6O44NFGQgYMtQU RdGQAXziiADnC6seFcXt6u85ntRklLUw5TC6cUpd8eHpUPjZcKDQk0x6qMbx2L38UTNU8nG6vFZ Tinc5IHiZBo4LQXegFsg1cxZHrVf5oTDyjophF25nBu/wtwzsK/mvNlm3YpTuRKoWEsjU2OJJ9Y Vv15K3aCttBWUDmticMPpw== X-Received: by 2002:a5d:6d87:0:b0:385:e1eb:a7af with SMTP id ffacd0b85a97d-38bf59eff3bmr33316174f8f.48.1737736133376; Fri, 24 Jan 2025 08:28:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:52 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 13/76] target/arm: Define new fp_status_f16_a32 and fp_status_f16_a64 Date: Fri, 24 Jan 2025 16:27:33 +0000 Message-Id: <20250124162836.2332150-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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, T_SCC_BODY_TEXT_LINE=-0.01 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 As the first part of splitting the existing fp_status_f16 into separate float_status fields for AArch32 and AArch64 (so that we can make FEAT_AFP control bits apply only for AArch64), define the two new fp_status_f16_a32 and fp_status_f16_a64 fields, but don't use them yet. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 4 ++++ target/arm/tcg/translate.h | 12 ++++++++++++ target/arm/cpu.c | 2 ++ target/arm/vfp_helper.c | 14 ++++++++++++++ 4 files changed, 32 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 7b967bbd1d2..be409c5c76e 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -636,6 +636,8 @@ typedef struct CPUArchState { * fp_status_a32: is the "normal" fp status for AArch32 insns * fp_status_a64: is the "normal" fp status for AArch64 insns * fp_status_fp16: used for half-precision calculations + * fp_status_fp16_a32: used for AArch32 half-precision calculations + * fp_status_fp16_a64: used for AArch64 half-precision calculations * standard_fp_status : the ARM "Standard FPSCR Value" * standard_fp_status_fp16 : used for half-precision * calculations with the ARM "Standard FPSCR Value" @@ -662,6 +664,8 @@ typedef struct CPUArchState { float_status fp_status_a32; float_status fp_status_a64; float_status fp_status_f16; + float_status fp_status_f16_a32; + float_status fp_status_f16_a64; float_status standard_fp_status; float_status standard_fp_status_f16; diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 197772eb13d..57e5d92cd60 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -673,6 +673,8 @@ typedef enum ARMFPStatusFlavour { FPST_FPCR_A32, FPST_FPCR_A64, FPST_FPCR_F16, + FPST_FPCR_F16_A32, + FPST_FPCR_F16_A64, FPST_STD, FPST_STD_F16, } ARMFPStatusFlavour; @@ -691,6 +693,10 @@ typedef enum ARMFPStatusFlavour { * for AArch64 non-FP16 operations controlled by the FPCR * FPST_FPCR_F16 * for operations controlled by the FPCR where FPCR.FZ16 is to be used + * FPST_FPCR_F16_A32 + * for AArch32 operations controlled by the FPCR where FPCR.FZ16 is to be used + * FPST_FPCR_F16_A64 + * for AArch64 operations controlled by the FPCR where FPCR.FZ16 is to be used * FPST_STD * for A32/T32 Neon operations using the "standard FPSCR value" * FPST_STD_F16 @@ -711,6 +717,12 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) case FPST_FPCR_F16: offset = offsetof(CPUARMState, vfp.fp_status_f16); break; + case FPST_FPCR_F16_A32: + offset = offsetof(CPUARMState, vfp.fp_status_f16_a32); + break; + case FPST_FPCR_F16_A64: + offset = offsetof(CPUARMState, vfp.fp_status_f16_a64); + break; case FPST_STD: offset = offsetof(CPUARMState, vfp.standard_fp_status); break; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index a2b9bd3fb9d..ff8514edc6d 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -576,6 +576,8 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type) arm_set_default_fp_behaviours(&env->vfp.fp_status_a64); arm_set_default_fp_behaviours(&env->vfp.standard_fp_status); arm_set_default_fp_behaviours(&env->vfp.fp_status_f16); + arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a32); + arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a64); arm_set_default_fp_behaviours(&env->vfp.standard_fp_status_f16); #ifndef CONFIG_USER_ONLY diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 9fee6265f20..45f9dfc8861 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -69,6 +69,10 @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env) /* FZ16 does not generate an input denormal exception. */ i |= (get_float_exception_flags(&env->vfp.fp_status_f16) & ~float_flag_input_denormal); + i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a32) + & ~float_flag_input_denormal); + i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64) + & ~float_flag_input_denormal); i |= (get_float_exception_flags(&env->vfp.standard_fp_status_f16) & ~float_flag_input_denormal); return vfp_exceptbits_from_host(i); @@ -84,6 +88,8 @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env) set_float_exception_flags(0, &env->vfp.fp_status_a32); set_float_exception_flags(0, &env->vfp.fp_status_a64); set_float_exception_flags(0, &env->vfp.fp_status_f16); + set_float_exception_flags(0, &env->vfp.fp_status_f16_a32); + set_float_exception_flags(0, &env->vfp.fp_status_f16_a64); set_float_exception_flags(0, &env->vfp.standard_fp_status); set_float_exception_flags(0, &env->vfp.standard_fp_status_f16); } @@ -113,12 +119,18 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) set_float_rounding_mode(i, &env->vfp.fp_status_a32); set_float_rounding_mode(i, &env->vfp.fp_status_a64); set_float_rounding_mode(i, &env->vfp.fp_status_f16); + set_float_rounding_mode(i, &env->vfp.fp_status_f16_a32); + set_float_rounding_mode(i, &env->vfp.fp_status_f16_a64); } if (changed & FPCR_FZ16) { bool ftz_enabled = val & FPCR_FZ16; set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16); + set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32); + set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64); set_flush_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16); + set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32); + set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16); } if (changed & FPCR_FZ) { @@ -133,6 +145,8 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16); + set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32); + set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64); } } From patchwork Fri Jan 24 16:27:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859573 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881858wrq; Fri, 24 Jan 2025 08:33:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXzLX0tFnD5rxGUJlbXmlmptTIQ8WbBJYOXNgsSxxaKV4xgKNQeB2os9RDUH5ydIOVqWR+siw==@linaro.org X-Google-Smtp-Source: AGHT+IEtatzgfUAsAw7/qJ7ZCG46VMMo8vIL7mndwZ8Eqz/6gqZ6rFGKnQKasgK8Kbt3v5nONl9p X-Received: by 2002:a67:e70d:0:b0:4b2:cc94:187a with SMTP id ada2fe7eead31-4b690bb130fmr27356318137.1.1737736381216; Fri, 24 Jan 2025 08:33:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736381; cv=none; d=google.com; s=arc-20240605; b=K+or45AcrTnIkWkqMmTxi+jkl925FEccWE7yeUjTx5WECeb+xdi9aMylF0eKVCjZRM bRefqmMXBaRwZ1ULhqqG3K3TO6JwDcJLqJuKER2xZn//jas2okdrs8Ok/PflE80sV4hd lQta9dgRCCi1QPhEvvcYq3rEvQgg+W7Rh/q4WErEuMONrIDZwsonmAULs6SYreZXWyaB fBHxLDjAKDgLbv5OysPuxhL5GU1FwSrWzu2Atdtilgm1JmQu/CpWViE97xocY6QQrYuR swPCAovWuwzLMGtAZUd6WZFE2cPKTXDSF1AwOFhJ0YxAiaawgI072n1d/JutCDXi3gr6 U+mg== 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=OtS+w3ShI/UCJ8br92Bpn5fDuc7OgrxDrAhBJJSSdts=; fh=8776w9KUuNEO4oLO0EHLJKcapMHHBHpLhwVo0b0S/k8=; b=VS7isplEtCivta8gC1gEXj4TK8hNY5+dRogUTG4X+jjOapHs88pY8d7ZLDB9nZbJvA jcFqpcRc2THfKBRsxl76Ksx+/b0gpOgEhU1La9mDK8gAT7QI8JythhS4g54d/lK3OTOR 2en8q//PdJNSDWAmcQlGT5Wk851oFEho8DGa+DLyxAUwHFyNKFzAnPFoBIEiaDX+UfmZ P3r+dJ7F2lwGvvj+CwR+5maVwjhXffSXscO0SlvvZKR09//Rm1SQKazVQiDAKJWwflBR sB060NnEqZxY65DCimuILG6NNojo49eAdkfpcfgw664hRRxf/cCADIBqSfhHVZgm9xNm scWw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g18EzRDW; 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 ada2fe7eead31-4b7099abdc5si999020137.442.2025.01.24.08.33.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:33:01 -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=g18EzRDW; 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 1tbMZf-0005xd-13; Fri, 24 Jan 2025 11:30:31 -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 1tbMYK-0003sD-90 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:06 -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 1tbMYE-0005Qm-Ru for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:03 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso24065665e9.0 for ; Fri, 24 Jan 2025 08:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736135; x=1738340935; 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=OtS+w3ShI/UCJ8br92Bpn5fDuc7OgrxDrAhBJJSSdts=; b=g18EzRDW/QDzbGYc/Dt+BAu3XSZ8WfH2Q5whGZ/mLqbf3kPk/8hyflV4TBxeU1r6xZ +RIPZHxqGoslh+HNWrUs/s5Zmr9AmU9CLjkE3K55GQu8umc4zToW7n5J2Y7fCDlpj1Il dfbpR/Yk1G0LkTYwD4cnl8cnLLgmNLmOcQ99i0tS7WDEs8XFKuwqWGRQtnUTRARjI/Zh dY6mMgwTTfDaJB94YRmTO9RdWiQg+Y7QbLMoQAOqwj1bu48OQvwI9X3dCPnEBMn8il+L ONJN4M4Vtdllw69KndgCWg+zwoHug8yD1rhhw8lBNMQYedouZ8RFzk5dS8dg4CuomMh2 JIGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736135; x=1738340935; 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=OtS+w3ShI/UCJ8br92Bpn5fDuc7OgrxDrAhBJJSSdts=; b=l1bUHKyqy51bZsojSdRfE5PjAx79XcbMAwlWi1rD5vsnuwWB5KglQcQOglomOOKl0a vTzej3NCRGqy56PbuAEFPV0YBf5CzP9UL1paL1uu/HAXSflnqDf8Czc6bsoCw0vUe8Ce Tj/rWNkQd0etvfB8+CVkBLPJb+bJNOhtNkOHFJpF1mOZkJN82dWtFWXnE03sNrMA99Xc PumM7fZThjIHeVp5aGeznw1Fu2hEh5SNrz2bJP6gU1kJO9ohGCBrYSf/sL+cuEn097dp Ge/0pHQaWDepTi6UyUcynJRK/rEqFgMDR+A4yNafGVwxAbcpkU39Qr0KxMkdetSyda1X czYw== X-Forwarded-Encrypted: i=1; AJvYcCV/OTl4PCZinZGUAw2Qg8uosNF8t6pCjrF8FG36obWudCc59kzRHFuXs5SvgbGdUoLQbC6wrb9I402J@nongnu.org X-Gm-Message-State: AOJu0YyyLChnxAAzBJgLVfh7W7Bgsjho9//eYBTj+z3w+dnQVyQR6W0b bIJQdBxklYUXe1/oqf0UbHE3j/K65zX6oSCDEatbhVLfvYTgMxJyVVy+0DaIU0wSRm4lhm7WjqV H X-Gm-Gg: ASbGncusuTKy+3lQ5EW4CO8wmXAHBM0ou+WvAOEeZ4uJewzmfxGpRV3rOOdOlLSvppj QHO16zslY7E+hCXdAh03JZT8zzQR+u5Gjdec1kwDjc7/RygHjl1rVBIg5Asuw1+jH3k9nCBQ1fG dqw57w67VI7JjKBl+6NJipR/SO9y6Oq6jnoKWONIoG9sXS3Wev5H5zsK3kP7EWvQaKHkfV64fsZ x5QXeg9XaYWxrGU146Xfjblqpt+Acc/QMRL85lLiGUqmrPamRtjuTrCKnYwanatEVFapf6a6d3O WsNigaOXlcg= X-Received: by 2002:a05:600c:a01:b0:436:ed38:5c7f with SMTP id 5b1f17b1804b1-438913db8b0mr279746685e9.12.1737736135067; Fri, 24 Jan 2025 08:28:55 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:54 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 14/76] target/arm: Use fp_status_f16_a32 in AArch32-only helpers Date: Fri, 24 Jan 2025 16:27:34 +0000 Message-Id: <20250124162836.2332150-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 We directly use fp_status_f16 in a handful of helpers that are AArch32-specific; switch to fp_status_f16_a32 for these. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/vec_helper.c | 4 ++-- target/arm/vfp_helper.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 44ee2c81fad..aaad947e506 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2060,7 +2060,7 @@ void HELPER(gvec_fmlal_a32)(void *vd, void *vn, void *vm, CPUARMState *env, uint32_t desc) { do_fmlal(vd, vn, vm, &env->vfp.standard_fp_status, desc, - get_flush_inputs_to_zero(&env->vfp.fp_status_f16)); + get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a32)); } void HELPER(gvec_fmlal_a64)(void *vd, void *vn, void *vm, @@ -2122,7 +2122,7 @@ void HELPER(gvec_fmlal_idx_a32)(void *vd, void *vn, void *vm, CPUARMState *env, uint32_t desc) { do_fmlal_idx(vd, vn, vm, &env->vfp.standard_fp_status, desc, - get_flush_inputs_to_zero(&env->vfp.fp_status_f16)); + get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a32)); } void HELPER(gvec_fmlal_idx_a64)(void *vd, void *vn, void *vm, diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 45f9dfc8861..f3aa80bbfb6 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -380,7 +380,7 @@ void VFP_HELPER(cmpe, P)(ARGTYPE a, ARGTYPE b, CPUARMState *env) \ softfloat_to_vfp_compare(env, \ FLOATTYPE ## _compare(a, b, &env->vfp.FPST)); \ } -DO_VFP_cmp(h, float16, dh_ctype_f16, fp_status_f16) +DO_VFP_cmp(h, float16, dh_ctype_f16, fp_status_f16_a32) DO_VFP_cmp(s, float32, float32, fp_status_a32) DO_VFP_cmp(d, float64, float64, fp_status_a32) #undef DO_VFP_cmp From patchwork Fri Jan 24 16:27:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859614 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp888879wrq; Fri, 24 Jan 2025 08:48:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWxDCfFP2F/A3Y74Tb+f2QQz0P8A3GLe7oiWPxyuJurgJKIv3dXkxPLmbgS3n+usjt0ENWf0w==@linaro.org X-Google-Smtp-Source: AGHT+IFgx7csdQI7yUK35Shm6DftPEru3Fe1ZqZEZqrQlCQRq8xtzO9i69Ehh/bHGTi/JjWz+Dkn X-Received: by 2002:a05:6102:3a11:b0:4b2:bc9f:3f91 with SMTP id ada2fe7eead31-4b690cd510bmr24275247137.21.1737737335612; Fri, 24 Jan 2025 08:48:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737335; cv=none; d=google.com; s=arc-20240605; b=OWFspev8uCT5AsvXzijed1dCMU83Q28CQfXdboUCKnnAQ3eaMDNgXGYGguXLKRn9YN jHfKM2AY/u32io+WgY2oy0/1sKemOQpoBwBm//2GmVHuhsg6dUZ0ugpi1EDkXLhYjxeS BA3RCQ+/TuTpRigFBIOAxOpEb+V5hX15hf1qL9KYC2VIzK3ZGIPGSR9vKKFoE8eqT25F EZ26D1HvrGC6JRgIuLFpt6KlNftzXTydvFdbCkJC1OXIztFmW/aVlIXsG2/lvDPTjP9f k+wtgT2TNedaYD/q9CgQKxv6AYbOapVPs/L199tYjD9KDYaoyQI0OJGm4Epsqs89EJ/e uLOQ== 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=6JkebY7aHBt5+Ow5GGAKlfmA8fph3Hd4QWwYFSpEozU=; fh=CafwHeU/FDxnLJJPZiojRXCj+g2vY3e0pBTO0rxLrP4=; b=fMkxyXkICtML6Ic9nJDJhMZSuM59zVortK+XfBHQJV1DgteCsVPDhWwQEL23vNiVVJ gVqs03SCn+B67wxi5Y2DXI1kXBWR73C7bMOXbp/Py6g5S4eCoqWFc+XruSJv5IHTriky 8ye9c2N2ea0jqQuk3qYQuBKdvGkS6Oa+j/hAtY+pYxb7WhXlEbLLpyYigXN9Km8YrHM4 Nx8roIUQx46NKlf62tMGMCeqev4mb4h/Qcj2IkiSjQyvIB/d/S9N16IpYbXJpUoE6Hon L5x4TrY4DGduSi1qSIO0tFQoBhS/s0CYbgrul68JasWtC5Eg+lOKNple7Lf+dbIzyM3E iX8Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CFVAX6je; 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 ada2fe7eead31-4b709981fe3si916420137.297.2025.01.24.08.48.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:48: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=CFVAX6je; 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 1tbMa5-0006l7-KG; Fri, 24 Jan 2025 11:30:54 -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 1tbMYI-0003rU-Fg for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:04 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYE-0005R3-H0 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:01 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4363dc916ceso22307665e9.0 for ; Fri, 24 Jan 2025 08:28:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736136; x=1738340936; 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=6JkebY7aHBt5+Ow5GGAKlfmA8fph3Hd4QWwYFSpEozU=; b=CFVAX6je7XhjM1owNryTwHLqfHcDeCl01qto9TvhLfavMY0lyOiWrZ6HadogQhf11r V+69BMooARVcib4x3+temzoDTuYTkk0EHHeGTrPcu0G+q70zteKrNKsoxPTsHOaCWdjP rnffCQZVL1X/Q+kruQMkA46Gsy7y7eewHwijqsN0XgQBueRdN8ta0CCV7O8o4WxlMjg4 1kOVP+f4WCiwCfl98duN+zHqL5zR48WOk3dV1bdIn6Q4SYs8PefUaC3eYmzwfO9RG8/z dQViVV9g7XQhfp0d/F0lfGEgCA5Kb1udFLa1fhoNTV0NP/9xnREQF7d2yaaFbripwcMO FBtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736136; x=1738340936; 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=6JkebY7aHBt5+Ow5GGAKlfmA8fph3Hd4QWwYFSpEozU=; b=FCAp7drasuBjkW49MCPnlvn/m826WIBeYZYcDc5te/VL4WEIFZazY3DTSggCyWBjST whlQ9E/rW7X6ReT6goO6oGGtIC2UxRpIy44qKIdtFsoKgqnLQ7v9hYQKGtb/Cf5tmRku N1nosMBcqo7i6efFD4ZkWzqEMHQgCPGtJCbBkXAdQ6mHdXrNltoJqUE4ps+/4+0yP2I8 bzdzWvTyDBbF25u0UHknI1Pb2thRK85F2rgbs7OUmH7olK0JAryckLs2ibjs+aClZj7l k8Y4bqTVDLu7INUmEwtX481UD+Dp+oGWV9KptwHZSBztffj+nXvh07afmTWlnUm1AgTY eDHA== X-Forwarded-Encrypted: i=1; AJvYcCVLKNPDyBLlJ01Ps7DoSLABiHF1CPnCiBXDzFTWDDMJPsrMl4l2TOfPwAUhp5X57p91S8JwAHAxcvOX@nongnu.org X-Gm-Message-State: AOJu0YzBp9aFd8Rj1pr0g+n0SFDWB3EZgttRRuHqMYwiYvpIqO1Z+aAF vG/mOyXWTpD8FR9D1LSySJHqxvTCpmeF/JKjd+zNZhfm6zIJp+xGvQk8mnoJnMU= X-Gm-Gg: ASbGncvqbmGUrVFp8v/g9aITZw/M8/M47ivi3yaNqKHhV7JE3amtr0PeHwgJn97oe7t vJ80OK7E+qAjG5mcFlXEMTCKrsZzJgRmXvlVxhYIckycnegESQqfiqUVcQ/5JR4fC/LRFcx7CK1 n3U+acthCtBPpNxMzV8k91Y7ZMFBrQIY/UG9y0t8weAqekmCRwWOiVKq1ZoDLRx/nRUaG9MAQuJ qoYwqmTMTNUYkydNxkBJuKanqgDgVxPB7ANvBdjZt8DInzZ1zcDolkIVw9DKHxoI15fYsCDpa7p P+2V5o8CfvE= X-Received: by 2002:a05:600c:3153:b0:436:76bf:51cc with SMTP id 5b1f17b1804b1-438bd0a875emr36686715e9.12.1737736136189; Fri, 24 Jan 2025 08:28:56 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:55 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 15/76] target/arm: Use fp_status_f16_a64 in AArch64-only helpers Date: Fri, 24 Jan 2025 16:27:35 +0000 Message-Id: <20250124162836.2332150-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 We directly use fp_status_f16 in a handful of helpers that are AArch64-specific; switch to fp_status_f16_a64 for these. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/sme_helper.c | 4 ++-- target/arm/tcg/vec_helper.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c index 2aad00d3ad9..727c085f374 100644 --- a/target/arm/tcg/sme_helper.c +++ b/target/arm/tcg/sme_helper.c @@ -1038,12 +1038,12 @@ void HELPER(sme_fmopa_h)(void *vza, void *vzn, void *vzm, void *vpn, float_status fpst_odd, fpst_std, fpst_f16; /* - * Make copies of fp_status and fp_status_f16, because this operation + * Make copies of the fp status fields we use, because this operation * does not update the cumulative fp exception status. It also * produces default NaNs. We also need a second copy of fp_status with * round-to-odd -- see above. */ - fpst_f16 = env->vfp.fp_status_f16; + fpst_f16 = env->vfp.fp_status_f16_a64; fpst_std = env->vfp.fp_status_a64; set_default_nan_mode(true, &fpst_std); set_default_nan_mode(true, &fpst_f16); diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index aaad947e506..3fbca8bc8bf 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2067,7 +2067,7 @@ void HELPER(gvec_fmlal_a64)(void *vd, void *vn, void *vm, CPUARMState *env, uint32_t desc) { do_fmlal(vd, vn, vm, &env->vfp.fp_status_a64, desc, - get_flush_inputs_to_zero(&env->vfp.fp_status_f16)); + get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64)); } void HELPER(sve2_fmlal_zzzw_s)(void *vd, void *vn, void *vm, void *va, @@ -2077,7 +2077,7 @@ void HELPER(sve2_fmlal_zzzw_s)(void *vd, void *vn, void *vm, void *va, uint16_t negn = extract32(desc, SIMD_DATA_SHIFT, 1) << 15; intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16); float_status *status = &env->vfp.fp_status_a64; - bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16); + bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64); for (i = 0; i < oprsz; i += sizeof(float32)) { float16 nn_16 = *(float16 *)(vn + H1_2(i + sel)) ^ negn; @@ -2129,7 +2129,7 @@ void HELPER(gvec_fmlal_idx_a64)(void *vd, void *vn, void *vm, CPUARMState *env, uint32_t desc) { do_fmlal_idx(vd, vn, vm, &env->vfp.fp_status_a64, desc, - get_flush_inputs_to_zero(&env->vfp.fp_status_f16)); + get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64)); } void HELPER(sve2_fmlal_zzxw_s)(void *vd, void *vn, void *vm, void *va, @@ -2140,7 +2140,7 @@ void HELPER(sve2_fmlal_zzxw_s)(void *vd, void *vn, void *vm, void *va, intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16); intptr_t idx = extract32(desc, SIMD_DATA_SHIFT + 2, 3) * sizeof(float16); float_status *status = &env->vfp.fp_status_a64; - bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16); + bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64); for (i = 0; i < oprsz; i += 16) { float16 mm_16 = *(float16 *)(vm + i + idx); From patchwork Fri Jan 24 16:27:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859585 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp883617wrq; Fri, 24 Jan 2025 08:36:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWB67tbyJhFDUe1637WObVXdJsyomIqe/poUdkfhNwdQWicRmJwLxCMoaqkexi+gy0P2W2pow==@linaro.org X-Google-Smtp-Source: AGHT+IHdMd0wGiXOoIeDdyF0t+fdvU/Eqci7N6NS1+pbtfhJq9OmKMLAUIU+GcRQPolSe1yW+xr9 X-Received: by 2002:a05:620a:84c8:b0:7b6:773f:4bd5 with SMTP id af79cd13be357-7be63202501mr4716959885a.20.1737736592060; Fri, 24 Jan 2025 08:36:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736592; cv=none; d=google.com; s=arc-20240605; b=WjP2DegK3kwUQBmFDKTKxJoq64JgtctCaEEGKPQtNGi5R1lFX7J6eju3W3jK2+1Zfp 8pbSOAuksrh9vIZgn23gfC3gFqNrlE3ZWs+mVx6+1Z+CPqY8puL7Ws2z5zXPTqcTMoLF YMYbKofBS4ScnnJvuNAU06YR2VR0Mtti7L3zV4ocUpRB44LXJIydO9A/WYyRX5CMtJc2 3C4E4ZEyyBbZFLOiGciU4aPEGgITtjwZqyFU4rQY23yblMMYnw/FqGK7AJYpnN4EzPwV XqYmTXM91XjmUm96rcQ46+bL6+h/q0ZeSw2MpFciGwLH5/OULloJE149ZpPSUYBDnZMD t9Ow== 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=hvxFIxBSlWCivkIbjXPJQuTkInwCZsZuntD1e414ySM=; fh=d/crpNq5ffhancmqn5E5xP1vM9PF4Uj+WKyVzr18TEw=; b=WlhT1OWrP7FzjznfyY035Va61SJEYGKRvfaCPsBQo+ERAaRwUk5zbWZhzsqKJdReFR qoXClTt9/1OcW16+S5F7nnQTKgq39ZeAfG/UUEyX3NgGkOmMfmBuHlR5kuJ91egPPJym rrIG/xWsRpX6ZyNMAySsW4ofR9oLeyXN2E8Z+sm5+SJETb9OPqJF704Fn54hDtuZ2O1q FTajgx2PnNkSqBDycctdht08j9LBMBDmYrtM3iyEWim9yUv1gjAH1puUjIBtBgVxJ6MG 3TAOe6RkLSqsQjPCJFpBSJYoP2Uxnn2MB41q/PTgXv3MmcbsuW8UIAsQbJG4APYYEkzn 1AyA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ndyae6lR; 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-7be9aee1171si315501585a.248.2025.01.24.08.36.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:36:32 -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=Ndyae6lR; 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 1tbMah-00089Z-UW; Fri, 24 Jan 2025 11:31:34 -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 1tbMYK-0003sE-9W for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:06 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYE-0005Rb-Nn for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:03 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4361e89b6daso15006575e9.3 for ; Fri, 24 Jan 2025 08:28:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736137; x=1738340937; 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=hvxFIxBSlWCivkIbjXPJQuTkInwCZsZuntD1e414ySM=; b=Ndyae6lRTgiJ637HzHBLun3Ik2jdHQCuJW2PaHqT6XcMEJ8TdXoZj2bTD4BofT+4xn Rj+Zmkd0Jjcv/tKgbe5Oo7JXVvIfaTyOiAaRMzdJUaiY+5K5WP5/ZXirWIIDXBfNdm+u iA5o/DcE6bmQx8e+RrvGbhmDJhUPSPvYuBVttA/cE7mC3ZSIkbfDTWgbvm5N6dwF7gpi DQ9WgMvFhZfaNgiyilQWcGNRkLEyy2a4BNHAUTcHQvlDyrNRGulYmnW56YgjcGTEKjoA 0k1Fla7cdMNk75wHZR2dXEAWNQaYN729DaQwgIXjaPM/6qG5irsiV0qHycdDbrO6dNu2 20CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736137; x=1738340937; 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=hvxFIxBSlWCivkIbjXPJQuTkInwCZsZuntD1e414ySM=; b=gItReB+AGyl0xEP0kMQGAh6qkGRjrz8KOGx3YYd6gMyyeA1lveFceFj14xfHO4KxPB r/KRuQNK3rFEa5jO3EQi2cjQCprlBSYZZIwYGen6A20t8zptixMsgL2Vnr+zq7NqeARN TgO98uNkpd+nGZlFzP4LYtCMeFfsBkYPSpUzDnR/Vne0b65jpEILf00Xvpe9/z18QUnd So9Dm3UlENL1/Rl1YaEFxF2VfpdItOaAd0AsKpti+/h/uQ5JSGiwdz97E5GPFt52gZMb yCYiM1J8Ubtq5zy2tWq5rr+J9BXL6RRmyOaBnzFy9HdJ+LaqWMhJyNcSGdqMvzWspEG3 7LoA== X-Forwarded-Encrypted: i=1; AJvYcCWpjghYDw7kKloneIasKFvdYmeaCmaklp0ruHC3TK5keQP342rzvQEyzxVy21Pa5A9HQeSawf2H0HTO@nongnu.org X-Gm-Message-State: AOJu0Yye4kUvfF++TMsm/kE0ty7N2PeboKqopuZfTFuFbuyjLDNgJpDx SFZfukM+Z55bk7APi3K2VmfVhYPqXb1oKcz0FqJVI7CXgiCuCfTAGH2fF6EDrFo= X-Gm-Gg: ASbGncsXoLiP/L2w0UQDVVt60OYVYJodff9geigAqUuWlp2CV5Nlc488+paHZmdqF5m /m+pCxcYmhsW/t3oc0euB68BbBxI2R88RnxLsoEpn4mnCJ6X2v5FNe1uuKp1FeA1zTseVZgXRnn GMHziuJD2aTl1Ih8/SqnN7qBA0G1JCO0Q2lNkjyEXr57IYKyFtTLZyZTXKKULbNsbkrO/ild22u NAJvnvHSVoZq+rvKqkJWDnvqdhqf5pCJ7UPkJMVy7FoWHI4bGDtA4Rf9qRGaIFLDg2BLV7Wi5D2 7upyzpY7t0uydvmu3rZLcA== X-Received: by 2002:a05:600c:138f:b0:436:ed50:4f8a with SMTP id 5b1f17b1804b1-438913caeb9mr326394245e9.10.1737736137213; Fri, 24 Jan 2025 08:28:57 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:56 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 16/76] target/arm: Use FPST_FPCR_F16_A32 in A32 decoder Date: Fri, 24 Jan 2025 16:27:36 +0000 Message-Id: <20250124162836.2332150-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 In the A32 decoder, use FPST_FPCR_F16_A32 rather than FPST_FPCR_F16. By doing an automated conversion of the whole file we avoid possibly using more than one fpst value in a set_rmode/op/restore_rmode sequence. Patch created with perl -p -i -e 's/FPST_FPCR_F16(?!_)/FPST_FPCR_F16_A32/g' target/arm/tcg/translate-vfp.c Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-vfp.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c index e1b8243c5d9..8eebba0f272 100644 --- a/target/arm/tcg/translate-vfp.c +++ b/target/arm/tcg/translate-vfp.c @@ -460,7 +460,7 @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) } if (sz == 1) { - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); } else { fpst = fpstatus_ptr(FPST_FPCR_A32); } @@ -527,7 +527,7 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) } if (sz == 1) { - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); } else { fpst = fpstatus_ptr(FPST_FPCR_A32); } @@ -1433,7 +1433,7 @@ static bool do_vfp_3op_hp(DisasContext *s, VFPGen3OpSPFn *fn, /* * Do a half-precision operation. Functionally this is * the same as do_vfp_3op_sp(), except: - * - it uses the FPST_FPCR_F16 + * - it uses the FPST_FPCR_F16_A32 * - it doesn't need the VFP vector handling (fp16 is a * v8 feature, and in v8 VFP vectors don't exist) * - it does the aa32_fp16_arith feature test @@ -1456,7 +1456,7 @@ static bool do_vfp_3op_hp(DisasContext *s, VFPGen3OpSPFn *fn, f0 = tcg_temp_new_i32(); f1 = tcg_temp_new_i32(); fd = tcg_temp_new_i32(); - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); vfp_load_reg16(f0, vn); vfp_load_reg16(f1, vm); @@ -2122,7 +2122,7 @@ static bool do_vfm_hp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d) /* VFNMA, VFNMS */ gen_vfp_negh(vd, vd); } - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); gen_helper_vfp_muladdh(vd, vn, vm, vd, fpst); vfp_store_reg32(vd, a->vd); return true; @@ -2424,7 +2424,7 @@ DO_VFP_2OP(VNEG, dp, gen_vfp_negd, aa32_fpdp_v2) static void gen_VSQRT_hp(TCGv_i32 vd, TCGv_i32 vm) { - gen_helper_vfp_sqrth(vd, vm, fpstatus_ptr(FPST_FPCR_F16)); + gen_helper_vfp_sqrth(vd, vm, fpstatus_ptr(FPST_FPCR_F16_A32)); } static void gen_VSQRT_sp(TCGv_i32 vd, TCGv_i32 vm) @@ -2706,7 +2706,7 @@ static bool trans_VRINTR_hp(DisasContext *s, arg_VRINTR_sp *a) tmp = tcg_temp_new_i32(); vfp_load_reg16(tmp, a->vm); - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); gen_helper_rinth(tmp, tmp, fpst); vfp_store_reg32(tmp, a->vd); return true; @@ -2779,7 +2779,7 @@ static bool trans_VRINTZ_hp(DisasContext *s, arg_VRINTZ_sp *a) tmp = tcg_temp_new_i32(); vfp_load_reg16(tmp, a->vm); - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); tcg_rmode = gen_set_rmode(FPROUNDING_ZERO, fpst); gen_helper_rinth(tmp, tmp, fpst); gen_restore_rmode(tcg_rmode, fpst); @@ -2859,7 +2859,7 @@ static bool trans_VRINTX_hp(DisasContext *s, arg_VRINTX_sp *a) tmp = tcg_temp_new_i32(); vfp_load_reg16(tmp, a->vm); - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); gen_helper_rinth_exact(tmp, tmp, fpst); vfp_store_reg32(tmp, a->vd); return true; @@ -2983,7 +2983,7 @@ static bool trans_VCVT_int_hp(DisasContext *s, arg_VCVT_int_sp *a) vm = tcg_temp_new_i32(); vfp_load_reg32(vm, a->vm); - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); if (a->s) { /* i32 -> f16 */ gen_helper_vfp_sitoh(vm, vm, fpst); @@ -3105,7 +3105,7 @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a) vd = tcg_temp_new_i32(); vfp_load_reg32(vd, a->vd); - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); shift = tcg_constant_i32(frac_bits); /* Switch on op:U:sx bits */ @@ -3273,7 +3273,7 @@ static bool trans_VCVT_hp_int(DisasContext *s, arg_VCVT_sp_int *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A32); vm = tcg_temp_new_i32(); vfp_load_reg16(vm, a->vm); From patchwork Fri Jan 24 16:27:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859562 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp880772wrq; Fri, 24 Jan 2025 08:31:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWXg8tYqd7GUrh+3uaQjlY5gWaPqbvL2NB+fa/6Hci85/C4nM2jbn+YnKthePGJ1tNIQcLLeg==@linaro.org X-Google-Smtp-Source: AGHT+IE8hWhseKhipRDcJODQtpKPHglGqW473dDW5YbUdT+QYvBscumth7tYNemEKp4nBmUWyN9e X-Received: by 2002:a05:620a:28c9:b0:7ac:c348:6a52 with SMTP id af79cd13be357-7be6323ea75mr4412441485a.34.1737736273756; Fri, 24 Jan 2025 08:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736273; cv=none; d=google.com; s=arc-20240605; b=YsXxRvPKunTrXJJtguwIS4lLoWTRM1JovC52Z8opVzgMMVKqLX7Xc7RZh4dhL1sWoY 9vZ4jq9N7bNAuM9TGM67TaS9QFLvZ64TAbqJud7+V34fQVnLDLccGrHySJAR26RikaEt dzO9K66A8V9003QBMf1LvnAhGZDI1qqV+SPTtbW1NbrOvEfw07rnkneRFAWlZf9lp03g HrTY0QnCdAwDI7NJ0wkYWGBpGKE7p3CqMQHcOFKaSYgxkJlaQmwnENXX+ePqCFxQOcNp KhgcjIKkCM0uP+vVcoxZvGwrdo9ldlI2/aL/G6ttM2LYTg8VxHaSav78hqS2IQRGGfo6 nLeQ== 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=9SD9SO5LCP25e7fb/iGaRdiCK9e0Vue8v7YEc3GCsWk=; fh=v1IZGzhh3MiGud8evkTsv+vcrvWfJDrJ75XTxCTUrMI=; b=S2NMx71BMN7Cg1O4B+DKAyzTf3qt51PvyHvESkjQPcP8h7WZjvcdCWKLg8iFSPG6Td Wxt9/IiYt0JGNBczrR3oFfPWiPSo0+hODAkgd2QsOsXk1P+aknuSE2hZA6V55c4cpf7C PGPgfjfD/A+GakKsR8SlzjafrwPCfaB1H9Mx4iI6fQzC1YaMb8tSddsePhvHae3LznuT iiWEa1391AnaxVwZzD+Fee8ugHdfyjolWCyFyQLH21ymCcexauDlwYWHjITxlQIJIfmx 80gS788tLfv+mEzM/dXxXvrU0VwnLTuS+KW5TnQiF3ZKAt3g+4ljl1/NEP9pexbEmwJK kAOg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MaFL5hTq; 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-7be9af101f3si254102185a.468.2025.01.24.08.31.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:31:13 -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=MaFL5hTq; 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 1tbMa1-0006X9-FT; Fri, 24 Jan 2025 11:30: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 1tbMYN-0003ta-7I for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:08 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYG-0005SL-9b for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:05 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4361e89b6daso15006755e9.3 for ; Fri, 24 Jan 2025 08:28:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736138; x=1738340938; 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=9SD9SO5LCP25e7fb/iGaRdiCK9e0Vue8v7YEc3GCsWk=; b=MaFL5hTqXW0qRM0rwX/ZpvV/hXI0M9yPxL8qlccAR3pq40t0DJQBeEbbgZyE0wtAzP frAk2EsH3sRZg9T83SYn0KzkcYk55O0ECNrWEolSW+NyvLJh2xg8PrtprHC9GSILAymQ Jea83qRDNobxwSZcAxBXWF5J7bHiqtg4yGjTAOIW5Fq+0YvnfPLUaSC68afY7nBP1PW1 R3TdQ9hBd3RbFDIRguHOr/8Kc+PyU/paRid8twtZGCItM/ZgPk6KRnXoD0A0kO7xM6QD bs7pDKJi72TC1SEoMvFEnEGS9ySx0GQbCO23DMdqf+ECMWLc2KBX34wSVhTYheo22UjY nvYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736138; x=1738340938; 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=9SD9SO5LCP25e7fb/iGaRdiCK9e0Vue8v7YEc3GCsWk=; b=vX19Jzch3/1h/1YSLsqFj3T2eURsTjA8ySica/bYFigsJSXzGkGYkejEMBpZttBYcv I/0Lyn/3KuXjhwUt7Um73aBYpn/cgKHNRUto3SZBXYyoH9X65rl+qUfAhaZi4vw3xrO2 hU+BS5xGYP7t9lL2Q9SNaDQ4U9oUE1vIUl9CrgWENxJHG6DKwq/z2h3Lib5ykJKWNXiR I8g+rpmfDjt1zkdfgCoN5NXRv366bfY7bRBUk7DaJaKSs9iHeOs1SXHWiSTIBJeD7GFe sUa2Ig8UU646rImlHMl4P6q0XShfP8vzLyX1+wmr20NO2pG99uIWu4tn5eqATeg5keH+ g0mA== X-Forwarded-Encrypted: i=1; AJvYcCWGjexRad+sJmRaNizqnEnS/ulx+OpZdNZqyelCWplsWP+WkbfBkS4mmcMRxubeZCZpmfS2K1fq1/aE@nongnu.org X-Gm-Message-State: AOJu0Yw3MO2r9yBO5wg4kqNamuFZop7EpVaZa1nXv1z6L6DghOI76TH4 jQnrp2E42y2/7wsby37OeHSgOB/hpUVN/Es0sS+z/ZHRNjFyUHs7kmT0F4/zivjKagBsPfceAaL 2 X-Gm-Gg: ASbGnct6Ll/2CYoESS9cxXVeoNXlbrQ+HyfdUNw1HH1DOYTBBVBbxpPh6Wl41ao5tk4 dfOxDy7pkZ7tlv2c7piFo83+hJu8ZWrbnht5yS1gBg7CrhJexwhT1HPrRn0+cb7vXTEiypD6xFe 56AAKWMsW3WxoQ9qE7YTw3x3+GiZQ4WwSqibI7kxwX8pB4zUE3BizchQ0Gk/fd9Q2rgyN3i7zI1 tBc3F6ROHUmJjgATfVTp2MBLlzNDfAdYznuUeoWoFIYnWasg3Iyp0qLqNg5XLayQJOlUQ7J4Yo/ 8DSvuRfs9/oFtPV6OUJV8A== X-Received: by 2002:a05:600c:3844:b0:434:ff08:202b with SMTP id 5b1f17b1804b1-438913dbc09mr299117405e9.12.1737736138358; Fri, 24 Jan 2025 08:28:58 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:57 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 17/76] target/arm: Use FPST_FPCR_F16_A64 in A64 decoder Date: Fri, 24 Jan 2025 16:27:37 +0000 Message-Id: <20250124162836.2332150-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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 In the A32 decoder, use FPST_FPCR_F16_A32 rather than FPST_FPCR_F16. By doing an automated conversion of the whole file we avoid possibly using more than one fpst value in a set_rmode/op/restore_rmode sequence. Patch created with perl -p -i -e 's/FPST_FPCR_F16(?!_)/FPST_FPCR_F16_A64/g' target/arm/tcg/translate-{a64,sve,sme}.c Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 32 ++++++++--------- target/arm/tcg/translate-sve.c | 66 +++++++++++++++++----------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 9f10b2b2e6a..b713a5f6025 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -726,7 +726,7 @@ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn, int rm, bool is_fp16, int data, gen_helper_gvec_3_ptr *fn) { - TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), vec_full_reg_offset(s, rm), fpst, @@ -768,7 +768,7 @@ static void gen_gvec_op4_fpst(DisasContext *s, bool is_q, int rd, int rn, int rm, int ra, bool is_fp16, int data, gen_helper_gvec_4_ptr *fn) { - TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), vec_full_reg_offset(s, rm), @@ -5062,7 +5062,7 @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f) if (fp_access_check(s)) { TCGv_i32 t0 = read_fp_hreg(s, a->rn); TCGv_i32 t1 = read_fp_hreg(s, a->rm); - f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16)); + f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16_A64)); write_fp_sreg(s, a->rd, t0); } break; @@ -5270,9 +5270,9 @@ static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a, TCGv_i32 t0 = read_fp_hreg(s, a->rn); TCGv_i32 t1 = tcg_constant_i32(0); if (swap) { - f->gen_h(t0, t1, t0, fpstatus_ptr(FPST_FPCR_F16)); + f->gen_h(t0, t1, t0, fpstatus_ptr(FPST_FPCR_F16_A64)); } else { - f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16)); + f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16_A64)); } write_fp_sreg(s, a->rd, t0); } @@ -6230,7 +6230,7 @@ static bool do_fp3_scalar_idx(DisasContext *s, arg_rrx_e *a, const FPScalar *f) TCGv_i32 t1 = tcg_temp_new_i32(); read_vec_element_i32(s, t1, a->rm, a->idx, MO_16); - f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16)); + f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16_A64)); write_fp_sreg(s, a->rd, t0); } break; @@ -6288,7 +6288,7 @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg) gen_vfp_negh(t1, t1); } gen_helper_advsimd_muladdh(t0, t1, t2, t0, - fpstatus_ptr(FPST_FPCR_F16)); + fpstatus_ptr(FPST_FPCR_F16_A64)); write_fp_sreg(s, a->rd, t0); } break; @@ -6626,7 +6626,7 @@ static bool do_fp3_scalar_pair(DisasContext *s, arg_rr_e *a, const FPScalar *f) read_vec_element_i32(s, t0, a->rn, 0, MO_16); read_vec_element_i32(s, t1, a->rn, 1, MO_16); - f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16)); + f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16_A64)); write_fp_sreg(s, a->rd, t0); } break; @@ -6801,7 +6801,7 @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n) if (neg_n) { gen_vfp_negh(tn, tn); } - fpst = fpstatus_ptr(FPST_FPCR_F16); + fpst = fpstatus_ptr(FPST_FPCR_F16_A64); gen_helper_advsimd_muladdh(ta, tn, tm, ta, fpst); write_fp_sreg(s, a->rd, ta); } @@ -6895,7 +6895,7 @@ static bool do_fp_reduction(DisasContext *s, arg_qrr_e *a, if (fp_access_check(s)) { MemOp esz = a->esz; int elts = (a->q ? 16 : 8) >> esz; - TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); TCGv_i32 res = do_reduction_op(s, a->rn, esz, 0, elts, fpst, fn); write_fp_sreg(s, a->rd, res); } @@ -6939,7 +6939,7 @@ static void handle_fp_compare(DisasContext *s, int size, bool cmp_with_zero, bool signal_all_nans) { TCGv_i64 tcg_flags = tcg_temp_new_i64(); - TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); if (size == MO_64) { TCGv_i64 tcg_vn, tcg_vm; @@ -8407,7 +8407,7 @@ static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a, return check == 0; } - fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); if (rmode >= 0) { tcg_rmode = gen_set_rmode(rmode, fpst); } @@ -8598,7 +8598,7 @@ static bool do_cvtf_scalar(DisasContext *s, MemOp esz, int rd, int shift, TCGv_i32 tcg_shift, tcg_single; TCGv_i64 tcg_double; - tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); tcg_shift = tcg_constant_i32(shift); switch (esz) { @@ -8693,7 +8693,7 @@ static void do_fcvt_scalar(DisasContext *s, MemOp out, MemOp esz, TCGv_ptr tcg_fpstatus; TCGv_i32 tcg_shift, tcg_rmode, tcg_single; - tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); tcg_shift = tcg_constant_i32(shift); tcg_rmode = gen_set_rmode(rmode, tcg_fpstatus); @@ -9312,7 +9312,7 @@ static bool do_fp1_vector(DisasContext *s, arg_qrr_e *a, return check == 0; } - fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); if (rmode >= 0) { tcg_rmode = gen_set_rmode(rmode, fpst); } @@ -9372,7 +9372,7 @@ static bool do_gvec_op2_fpst(DisasContext *s, MemOp esz, bool is_q, return check == 0; } - fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), fpst, is_q ? 16 : 8, vec_full_reg_size(s), diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index caf8ea18328..37de816964a 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -141,7 +141,7 @@ static bool gen_gvec_fpst_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn, arg_rr_esz *a, int data) { return gen_gvec_fpst_zz(s, fn, a->rd, a->rn, data, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); } /* Invoke an out-of-line helper on 3 Zregs. */ @@ -191,7 +191,7 @@ static bool gen_gvec_fpst_arg_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn, arg_rrr_esz *a, int data) { return gen_gvec_fpst_zzz(s, fn, a->rd, a->rn, a->rm, data, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); } /* Invoke an out-of-line helper on 4 Zregs. */ @@ -397,7 +397,7 @@ static bool gen_gvec_fpst_arg_zpzz(DisasContext *s, gen_helper_gvec_4_ptr *fn, arg_rprr_esz *a) { return gen_gvec_fpst_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); } /* Invoke a vector expander on two Zregs and an immediate. */ @@ -3517,7 +3517,7 @@ static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub) }; return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, (a->index << 1) | sub, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); } TRANS_FEAT(FMLA_zzxz, aa64_sve, do_FMLA_zzxz, a, false) @@ -3533,7 +3533,7 @@ static gen_helper_gvec_3_ptr * const fmul_idx_fns[4] = { }; TRANS_FEAT(FMUL_zzx, aa64_sve, gen_gvec_fpst_zzz, fmul_idx_fns[a->esz], a->rd, a->rn, a->rm, a->index, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) /* *** SVE Floating Point Fast Reduction Group @@ -3566,7 +3566,7 @@ static bool do_reduce(DisasContext *s, arg_rpr_esz *a, tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, a->rn)); tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg)); - status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); fn(temp, t_zn, t_pg, status, t_desc); @@ -3618,7 +3618,7 @@ static bool do_ppz_fp(DisasContext *s, arg_rpr_esz *a, if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); TCGv_ptr status = - fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); tcg_gen_gvec_3_ptr(pred_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), @@ -3654,7 +3654,7 @@ static gen_helper_gvec_3_ptr * const ftmad_fns[4] = { }; TRANS_FEAT_NONSTREAMING(FTMAD, aa64_sve, gen_gvec_fpst_zzz, ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) /* *** SVE Floating Point Accumulating Reduction Group @@ -3687,7 +3687,7 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) t_pg = tcg_temp_new_ptr(); tcg_gen_addi_ptr(t_rm, tcg_env, vec_full_reg_offset(s, a->rm)); tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg)); - t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); t_desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); fns[a->esz - 1](t_val, t_val, t_rm, t_pg, t_fpst, t_desc); @@ -3762,7 +3762,7 @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16, tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, zn)); tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg)); - status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); fn(t_zd, t_zn, t_pg, scalar, status, desc); } @@ -3814,7 +3814,7 @@ static bool do_fp_cmp(DisasContext *s, arg_rprr_esz *a, } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); tcg_gen_gvec_4_ptr(pred_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), @@ -3847,7 +3847,7 @@ static gen_helper_gvec_4_ptr * const fcadd_fns[] = { }; TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz], a->rd, a->rn, a->rm, a->pg, a->rot, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) #define DO_FMLA(NAME, name) \ static gen_helper_gvec_5_ptr * const name##_fns[4] = { \ @@ -3856,7 +3856,7 @@ TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz], }; \ TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_zzzzp, name##_fns[a->esz], \ a->rd, a->rn, a->rm, a->ra, a->pg, 0, \ - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) DO_FMLA(FMLA_zpzzz, fmla_zpzzz) DO_FMLA(FMLS_zpzzz, fmls_zpzzz) @@ -3871,14 +3871,14 @@ static gen_helper_gvec_5_ptr * const fcmla_fns[4] = { }; TRANS_FEAT(FCMLA_zpzzz, aa64_sve, gen_gvec_fpst_zzzzp, fcmla_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->pg, a->rot, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) static gen_helper_gvec_4_ptr * const fcmla_idx_fns[4] = { NULL, gen_helper_gvec_fcmlah_idx, gen_helper_gvec_fcmlas_idx, NULL }; TRANS_FEAT(FCMLA_zzxz, aa64_sve, gen_gvec_fpst_zzzz, fcmla_idx_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->index * 4 + a->rot, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) /* *** SVE Floating Point Unary Operations Predicated Group @@ -3902,17 +3902,17 @@ TRANS_FEAT(FCVT_sd, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_fcvt_sd, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVTZS_hh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzs_hh, a, 0, FPST_FPCR_F16) + gen_helper_sve_fcvtzs_hh, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(FCVTZU_hh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzu_hh, a, 0, FPST_FPCR_F16) + gen_helper_sve_fcvtzu_hh, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(FCVTZS_hs, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzs_hs, a, 0, FPST_FPCR_F16) + gen_helper_sve_fcvtzs_hs, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(FCVTZU_hs, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzu_hs, a, 0, FPST_FPCR_F16) + gen_helper_sve_fcvtzu_hs, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(FCVTZS_hd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzs_hd, a, 0, FPST_FPCR_F16) + gen_helper_sve_fcvtzs_hd, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(FCVTZU_hd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvtzu_hd, a, 0, FPST_FPCR_F16) + gen_helper_sve_fcvtzu_hd, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(FCVTZS_ss, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_fcvtzs_ss, a, 0, FPST_FPCR_A64) @@ -3939,7 +3939,7 @@ static gen_helper_gvec_3_ptr * const frint_fns[] = { gen_helper_sve_frint_d }; TRANS_FEAT(FRINTI, aa64_sve, gen_gvec_fpst_arg_zpz, frint_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a, 0, a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) static gen_helper_gvec_3_ptr * const frintx_fns[] = { NULL, @@ -3948,7 +3948,7 @@ static gen_helper_gvec_3_ptr * const frintx_fns[] = { gen_helper_sve_frintx_d }; TRANS_FEAT(FRINTX, aa64_sve, gen_gvec_fpst_arg_zpz, frintx_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + a, 0, a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, ARMFPRounding mode, gen_helper_gvec_3_ptr *fn) @@ -3965,7 +3965,7 @@ static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, } vsz = vec_full_reg_size(s); - status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64); + status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); tmode = gen_set_rmode(mode, status); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), @@ -3993,21 +3993,21 @@ static gen_helper_gvec_3_ptr * const frecpx_fns[] = { gen_helper_sve_frecpx_s, gen_helper_sve_frecpx_d, }; TRANS_FEAT(FRECPX, aa64_sve, gen_gvec_fpst_arg_zpz, frecpx_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a, 0, a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) static gen_helper_gvec_3_ptr * const fsqrt_fns[] = { NULL, gen_helper_sve_fsqrt_h, gen_helper_sve_fsqrt_s, gen_helper_sve_fsqrt_d, }; TRANS_FEAT(FSQRT, aa64_sve, gen_gvec_fpst_arg_zpz, fsqrt_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a, 0, a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) TRANS_FEAT(SCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_scvt_hh, a, 0, FPST_FPCR_F16) + gen_helper_sve_scvt_hh, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(SCVTF_sh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_scvt_sh, a, 0, FPST_FPCR_F16) + gen_helper_sve_scvt_sh, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(SCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_scvt_dh, a, 0, FPST_FPCR_F16) + gen_helper_sve_scvt_dh, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(SCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_scvt_ss, a, 0, FPST_FPCR_A64) @@ -4020,11 +4020,11 @@ TRANS_FEAT(SCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_scvt_dd, a, 0, FPST_FPCR_A64) TRANS_FEAT(UCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_ucvt_hh, a, 0, FPST_FPCR_F16) + gen_helper_sve_ucvt_hh, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(UCVTF_sh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_ucvt_sh, a, 0, FPST_FPCR_F16) + gen_helper_sve_ucvt_sh, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(UCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_ucvt_dh, a, 0, FPST_FPCR_F16) + gen_helper_sve_ucvt_dh, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(UCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_ucvt_ss, a, 0, FPST_FPCR_A64) @@ -7057,7 +7057,7 @@ static gen_helper_gvec_3_ptr * const flogb_fns[] = { gen_helper_flogb_s, gen_helper_flogb_d }; TRANS_FEAT(FLOGB, aa64_sve2, gen_gvec_fpst_arg_zpz, flogb_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR_A64) + a, 0, a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) static bool do_FMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sub, bool sel) { From patchwork Fri Jan 24 16:27:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859611 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp888353wrq; Fri, 24 Jan 2025 08:47:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXyvAUvR/h6SfT+r9P2REA/GX6IFhDD4tamVsHuyUBKMTuQC60G2nFOPpZzOyV/ur9rSVHSug==@linaro.org X-Google-Smtp-Source: AGHT+IGgiA49HPK0YDnNPemxmErhPatmGIyEC+6V9vzVqgJdu1PTlcbY1Muvl/mwD4UXBsGt/pI+ X-Received: by 2002:a05:6122:2396:b0:518:78c7:9b4f with SMTP id 71dfb90a1353d-51d59d54caamr27190935e0c.3.1737737258516; Fri, 24 Jan 2025 08:47:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737258; cv=none; d=google.com; s=arc-20240605; b=SuH2BQ941MPyIsDWA7jqbWBfXdsx292hvVYaYRGZ8rRV10xH6EXFM+jGf145UGWP+v xHRS8DQnDbYS5osGYSjj3y2ijzhzjR4opa7CJBpGI7Mh7pkZboSlRrGNoFCnJxX0Uzw+ wbaa/sBYejdnkAR9cBANgsi6+gxwpBhG6WIaWLax4E6N6ShuVIq+zRQnVTmEC9Jmn+rU PhQecDh2DPW8zWfqhYgXoOfTjTl0vV2kKKw8xjKKFl6FdrfnOg4fQec+jfs0uqKpTZ5E LLK6xdm7mZI4kZDVQKwKIuOaeA4qtNJ0pMikGlMXtdDImhYeZxB0l3mdbrQkphv2WPFW RjNw== 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=9M2O1KEVojOtqpm5b8dMJlhsf6kXCrNVO2nLRJ4F4OM=; fh=MJgFeeE/u2ZgNYGGAO4i6BaVPr05yYUcBbeGOnalpMc=; b=HqhSN5r048Ux/S4t1+AGPGzIhHQLbpTTjbT56Eo5UK1SdPfepRpdDaQSRrTmkFqZ4M aPJ6KMDBQ0r/8pRj0KQyy3BPsVBipeO7KnoiVruyHYOyRDCkvnYQ7dZVUF3HYR0bM10C 0K++i+nPokQj+eLyOBjDBLIA1NvToHPSOKEl2aIstdDQCBgURjdSuOwtCO85NsdxufNZ DYO4REuIMfaaD84mu1V6+sN4xP6tYdUVYej1gXIhTxPbDRI4ZpHGpcpKqlrN1hzWGYgk FCl3axFiT/yJeCcnP+Q16b4NEEq7ZNQlCziJInUeAAlXLv0k2hdyjb9+xMda5bUbbt4A jX4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YzZ66sCu; 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 71dfb90a1353d-51e4ec82b8dsi1194235e0c.191.2025.01.24.08.47.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:47:38 -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=YzZ66sCu; 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 1tbMYn-0004th-AN; Fri, 24 Jan 2025 11:29:33 -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 1tbMYN-0003t2-53 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:08 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYI-0005TH-4o for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:04 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso15346535e9.1 for ; Fri, 24 Jan 2025 08:29:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736140; x=1738340940; 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=9M2O1KEVojOtqpm5b8dMJlhsf6kXCrNVO2nLRJ4F4OM=; b=YzZ66sCunxTOwsAmD0Gp0q47o7oxWtQ4ZEsiiBNSTOCz6e+0AwgssE0cfy+2wQKf0D GazWwp+bj6+/5ipVO0bdHTdn3YqiCoEb5EKzncAYoYMw3A0TeF6pa88UR1HZ8sTxYlEL yU5Z87MmqC8oa/p7R53OUpeUMFzL1L8JgtN9R5zomI0Wf05378cnE3disXTsclP6eaUg wYlwt2IzXQ+TMr4VNTbsgGbDjupHQi6Zi1lIuJamgyX1zaC+Hb1hih3grV7LsONFWgqT zMVBrcPwdQluwXLIdIYVoems4p33mhGDKMn8Aw3vMeKS4E3VlnLRZ7uu5MZtccUfumPc JcVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736140; x=1738340940; 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=9M2O1KEVojOtqpm5b8dMJlhsf6kXCrNVO2nLRJ4F4OM=; b=ckNlzqbQoOF2fmG9dPImCpzd5Z7rfMoNxTNQv6YgL7c30TObxnKsj88RSOkilD6361 YX7m4oZSk70sp9YowBMvrK8lVApVW/kdvTPx1Lopnh57Yj3aNcbzLaAXF+FQlv6eG7Rj eCoc1dwpCRm+bpFj/uV/moSslW2k68u5sNM9t43gAB+VEIPVfyLVDalkxJ2/EzbfFqjT w1bnXkrkZKLt6mRnr8DvcrCaEBz/yDrdxWp3PBaYM5NwG7Bq/1kTbMraiQL9skeoNO1b wSp6LM7GISvifypJmInYF99qtJRtD1R+dC0Mm18ipR5L0fZTsYSE7J/c9gAPHizOTAcU 7l+Q== X-Forwarded-Encrypted: i=1; AJvYcCUwQnyN6hFtv/Y+zYbVPw91a7r9Ice3BFFfItUeuvV697uFuyaMUm7X2TlseyPHIL7VqkuXHyyl8ryA@nongnu.org X-Gm-Message-State: AOJu0Yxz/HfS0v5vKxGYCvI1Ev1NsGdEtkHTnZz4lbk1+I8BvurC8U5j FI08fOHcA3a2SB7Q+FngoCaOQyfwnwlk1w0O4WXU4cJmCVz1dLOeuNOMPWppLLyTZzdt73QX0Fo 3 X-Gm-Gg: ASbGnctu0rguTqFnmD89fiKFeZuT79M653jOIDHTLUI2yP7OqJR4cFNMRn8lqYXyuyA 98LjE11fphqbWb8fACJAzSGC89g5oP9V9/osH3PLmnijw4qN9IWEx7AyB72aZs0gCN5EF8BucgV MEqRyQvBpbgQU3nciT7ybtj2wjqXTsm0MW2pStzhs51iW+lsdjvd+NOqE3tfgJu29azJbT2CAlW quP5JzkWX3SJpeJ8x+Yq3Mz5TvgxnUq0z+QVS2Y83PmkLKKrd0Vvbm8cVsWgTyLhhmzf+hWefxL 97D6RKOMbOI= X-Received: by 2002:a05:600c:4712:b0:436:e69a:7341 with SMTP id 5b1f17b1804b1-438b8841d69mr79410825e9.3.1737736140212; Fri, 24 Jan 2025 08:29: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-438bd47eecasm31683025e9.6.2025.01.24.08.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:28:58 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 18/76] target/arm: Remove now-unused vfp.fp_status_f16 and FPST_FPCR_F16 Date: Fri, 24 Jan 2025 16:27:38 +0000 Message-Id: <20250124162836.2332150-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Now we have moved all the uses of vfp.fp_status_f16 and FPST_FPCR_F16 to the new A32 or A64 fields, we can remove these. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 2 -- target/arm/tcg/translate.h | 6 ------ target/arm/cpu.c | 1 - target/arm/vfp_helper.c | 7 ------- 4 files changed, 16 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index be409c5c76e..2213c277348 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -635,7 +635,6 @@ typedef struct CPUArchState { * * fp_status_a32: is the "normal" fp status for AArch32 insns * fp_status_a64: is the "normal" fp status for AArch64 insns - * fp_status_fp16: used for half-precision calculations * fp_status_fp16_a32: used for AArch32 half-precision calculations * fp_status_fp16_a64: used for AArch64 half-precision calculations * standard_fp_status : the ARM "Standard FPSCR Value" @@ -663,7 +662,6 @@ typedef struct CPUArchState { */ float_status fp_status_a32; float_status fp_status_a64; - float_status fp_status_f16; float_status fp_status_f16_a32; float_status fp_status_f16_a64; float_status standard_fp_status; diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 57e5d92cd60..ec4c0cf03fc 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -672,7 +672,6 @@ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb) typedef enum ARMFPStatusFlavour { FPST_FPCR_A32, FPST_FPCR_A64, - FPST_FPCR_F16, FPST_FPCR_F16_A32, FPST_FPCR_F16_A64, FPST_STD, @@ -691,8 +690,6 @@ typedef enum ARMFPStatusFlavour { * for AArch32 non-FP16 operations controlled by the FPCR * FPST_FPCR_A64 * for AArch64 non-FP16 operations controlled by the FPCR - * FPST_FPCR_F16 - * for operations controlled by the FPCR where FPCR.FZ16 is to be used * FPST_FPCR_F16_A32 * for AArch32 operations controlled by the FPCR where FPCR.FZ16 is to be used * FPST_FPCR_F16_A64 @@ -714,9 +711,6 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) case FPST_FPCR_A64: offset = offsetof(CPUARMState, vfp.fp_status_a64); break; - case FPST_FPCR_F16: - offset = offsetof(CPUARMState, vfp.fp_status_f16); - break; case FPST_FPCR_F16_A32: offset = offsetof(CPUARMState, vfp.fp_status_f16_a32); break; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index ff8514edc6d..7a83b9ee34f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -575,7 +575,6 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type) arm_set_default_fp_behaviours(&env->vfp.fp_status_a32); arm_set_default_fp_behaviours(&env->vfp.fp_status_a64); arm_set_default_fp_behaviours(&env->vfp.standard_fp_status); - arm_set_default_fp_behaviours(&env->vfp.fp_status_f16); arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a32); arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a64); arm_set_default_fp_behaviours(&env->vfp.standard_fp_status_f16); diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index f3aa80bbfb6..3ed69d73698 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -67,8 +67,6 @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env) i |= get_float_exception_flags(&env->vfp.fp_status_a64); i |= get_float_exception_flags(&env->vfp.standard_fp_status); /* FZ16 does not generate an input denormal exception. */ - i |= (get_float_exception_flags(&env->vfp.fp_status_f16) - & ~float_flag_input_denormal); i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a32) & ~float_flag_input_denormal); i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64) @@ -87,7 +85,6 @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env) */ set_float_exception_flags(0, &env->vfp.fp_status_a32); set_float_exception_flags(0, &env->vfp.fp_status_a64); - set_float_exception_flags(0, &env->vfp.fp_status_f16); set_float_exception_flags(0, &env->vfp.fp_status_f16_a32); set_float_exception_flags(0, &env->vfp.fp_status_f16_a64); set_float_exception_flags(0, &env->vfp.standard_fp_status); @@ -118,17 +115,14 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) } set_float_rounding_mode(i, &env->vfp.fp_status_a32); set_float_rounding_mode(i, &env->vfp.fp_status_a64); - set_float_rounding_mode(i, &env->vfp.fp_status_f16); set_float_rounding_mode(i, &env->vfp.fp_status_f16_a32); set_float_rounding_mode(i, &env->vfp.fp_status_f16_a64); } if (changed & FPCR_FZ16) { bool ftz_enabled = val & FPCR_FZ16; - set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16); set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32); set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64); set_flush_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16); - set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16); @@ -144,7 +138,6 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) bool dnan_enabled = val & FPCR_DN; set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64); - set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64); } From patchwork Fri Jan 24 16:27:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859565 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881220wrq; Fri, 24 Jan 2025 08:31:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUu+NYs38kyN66u6qWNUQLDDUwBisgKRhUfEezw+KOOooLkfvZ2CAjBwFxQZpk+uHpTKnQP/g==@linaro.org X-Google-Smtp-Source: AGHT+IGs/snX3y/3nQwgsSX5QDD/kjvKguN8ZJyCpRgi1p/t0qkqNeJtpCGFD4O4KC8mBSUaZtHw X-Received: by 2002:a05:6102:32c4:b0:4b2:cca7:7d51 with SMTP id ada2fe7eead31-4b690c6a5abmr27907835137.19.1737736314535; Fri, 24 Jan 2025 08:31:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736314; cv=none; d=google.com; s=arc-20240605; b=Y4qHloJF+XHgtqBckVfKFPU+1UyfP8U/QD+ZpNj8HSRw4u6pvvf8sjaWZ9P8wbjMTS uOlz7KUBRIrdFnjlZrpO0bCqtgSa4nvDo+RcDAnMrztWo8vUwF+pXyf82CjDSnY2f2Ju PPUEqdNPKkMMxk+/O2q7wRB61mCYfDuz7Jook4rcjvrVMia+UP7u5DfNmodCaSuRC/Ab fWM8OqaRE4J6ZtVtHc0o1SzzeMUvXBy99vXTrJYTLeEyUhsWqyDvlAgBH/X+eDNKGy8a N4ouhEk8UCl1hNnZCdNdv0GARKkHXN/6/Hc3VjsijLaGHkzgSskbLRl7rI4hiiM/GqR7 S+ug== 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=yzojriWazlUo5BpsMATktHytz8JColu0+OBr+77Yv4A=; fh=PUyOBZ9L5B8zsqW1Fc8zRAUOqmFTxCvnh8pBUQMFunc=; b=MsEJxNfq8fFZGuU0VcM4lkNGrGN+Gq7MZR4Vh2LEBS0mKTEm34GiSjG+O1kNkcyqQV OAJBdNZXPSqnwLmtnCmq/Dk4BQhM9J5/yQi3DCD0vHloeR28sN3ABlb2Mz4Oh2rxJ/2R K+NFUrULh0nraDCnoIfA5jzSxjHfGRrv4pEVVUrG+qhfY4j8AVGe4IXAyKDLNUTZ4kSJ uzcFU3F/7d0K01KBRevYg4OBAhDPJlOk0h6hUBHpIxFwaPL+LxVvklFa31EtIDHCkMzp l+QGhxgHhDbH55G1/oUOXRtlvxfjLBBFTBhwFym80hx+BGVSNUzdqRnBpuDjUDv9OPxw m3HA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yz+smkr1; 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 ada2fe7eead31-4b709792d66si857693137.196.2025.01.24.08.31.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:31:54 -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=Yz+smkr1; 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 1tbMYj-0004Zl-3q; Fri, 24 Jan 2025 11:29:29 -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 1tbMYN-0003tZ-7N for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:08 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYI-0005Tk-Vu for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:06 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso16642405e9.1 for ; Fri, 24 Jan 2025 08:29:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736141; x=1738340941; 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=yzojriWazlUo5BpsMATktHytz8JColu0+OBr+77Yv4A=; b=Yz+smkr1XJG3Dmvnr3EUgdTXG3LCiOqPOV9idS/ZiytoEF+0TuOGePWPHROee1Bkjw bJiczfAXXMKcv7VZMGcEP5he81+tZcOIjuKF+gnHvoxxKXej7uCn+BAyBhAkm2hI4H43 ho55PvZf22LaAoWW327uUW5GGPVvrHN9/4W42T2K+BW89zDhrXdD0Uqh6EipMMcCOO8a mSg4md6HPlizp/9LKOVYLRMmkeGCYEia6BAgL7gbuM7e8Po7og0q9RZDWHdQJ6nL63cQ FaD+RgE6xU/9D93k0MHb3sgemfNOb7h9yatH6Mah6VIGplsTHNXhwX/8mq/8PlnshkEc QSpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736141; x=1738340941; 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=yzojriWazlUo5BpsMATktHytz8JColu0+OBr+77Yv4A=; b=Hz+zk6PGoSWJJbO2zfPkfqGH8NWY8n9vOFo/k/dltbht/60z94Th/dvZBot/DFOqjG lVLjd0xjOq9OL7P2DN3/QU1Hp+8jmrFSRwtLOcyucaR+TWqSjiXzmkcV6bHrh0DxmmHO 85WpUFsbkUdYHAbGc3w9XTbJteB+uY3pZTzwRTKs0UDx//fkVRkwHfN2ZS54U0nK8sPq 5ZWeVLceqO8r1bzRryzUngtMURl0Ml13KykQMDpR+Rk9fMUfwTBaM1vCxVfPRUh5xXNQ 7/Os6eErEoGCgJRkvodN00X/PaXaRXBoFPqbkz7D2HDDribHpuxo9qn+qx2CCDiHb0q4 tpCA== X-Forwarded-Encrypted: i=1; AJvYcCWYDtDK/muof2ECSAV8I15NlJcZy5hW2kUKzvqaY10Q5lofpfaioIhzL4HPNJr8uTtYQszq2v/599dN@nongnu.org X-Gm-Message-State: AOJu0YxVtCr8y8fbMmG7TjEvfY2OUCKMtfDHCl1m5S+ljsGN1InvMilt Fut3P/I7TDl53ts2v9Q4Dh0OHaEK1i31R78fKfbyw9vClq8N8G0oSwO6SWgFnmlh2InzNOu4LBg u X-Gm-Gg: ASbGncs3Eh4F8/PRrk2UMWgV20NlKvTR1oWtcsmItif/GYnIxKOdOqQeGafGp9GVxzJ OXM0+56Vik2kyoyDNsOmtf/sJ0AhKsc4pq7gY80f/3aMJx4gcxd8Xy5tJ3qdogY+Iry0st+l4Yo Hq+BW57YlZPm1KCjZJO1mNgxHOQ0PcFftGWENX2r73SNMaScW24LNqG/6le2a7LWb+LDrQZTo54 fBR1e5R8ScVG6MHERLbPp1lVwSt3jEuwhKFP3ofP8YCCsL8d9lP3SyKNcabUDOM8HusP/2j0QNa u7FjeQqXsJk= X-Received: by 2002:a05:600c:5112:b0:434:a5bc:70fc with SMTP id 5b1f17b1804b1-438913cfa0emr282087645e9.8.1737736141481; Fri, 24 Jan 2025 08:29:01 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:00 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 19/76] fpu: Rename float_flag_input_denormal to float_flag_input_denormal_flushed Date: Fri, 24 Jan 2025 16:27:39 +0000 Message-Id: <20250124162836.2332150-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Our float_flag_input_denormal exception flag is set when the fpu code flushes an input denormal to zero. This is what many guest architectures (eg classic Arm behaviour) require, but it is not the only donarmal-related reason we might want to set an exception flag. The x86 behaviour (which we do not currently model correctly) wants to see an exception flag when a denormal input is *not* flushed to zero and is actually used in an arithmetic operation. Arm's FEAT_AFP also wants these semantics. Rename float_flag_input_denormal to float_flag_input_denormal_flushed to make it clearer when it is set and to allow us to add a new float_flag_input_denormal_used next to it for the x86/FEAT_AFP semantics. Commit created with for f in `git grep -l float_flag_input_denormal`; do sed -i -e 's/float_flag_input_denormal/float_flag_input_denormal_flushed/' $f; done and manual editing of softfloat-types.h and softfloat.c to clean up the indentation afterwards and to fix a comment which wasn't using the full name of the flag. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- include/fpu/softfloat-types.h | 5 +++-- fpu/softfloat.c | 4 ++-- target/arm/tcg/sve_helper.c | 6 +++--- target/arm/vfp_helper.c | 10 +++++----- target/i386/tcg/fpu_helper.c | 6 +++--- target/mips/tcg/msa_helper.c | 2 +- target/rx/op_helper.c | 2 +- fpu/softfloat-parts.c.inc | 2 +- 8 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index d8f831c331d..77bc172a074 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -154,7 +154,8 @@ enum { float_flag_overflow = 0x0004, float_flag_underflow = 0x0008, float_flag_inexact = 0x0010, - float_flag_input_denormal = 0x0020, + /* We flushed an input denormal to 0 (because of flush_inputs_to_zero) */ + float_flag_input_denormal_flushed = 0x0020, float_flag_output_denormal = 0x0040, float_flag_invalid_isi = 0x0080, /* inf - inf */ float_flag_invalid_imz = 0x0100, /* inf * 0 */ @@ -312,7 +313,7 @@ typedef struct float_status { bool tininess_before_rounding; /* should denormalised results go to zero and set the inexact flag? */ bool flush_to_zero; - /* should denormalised inputs go to zero and set the input_denormal flag? */ + /* should denormalised inputs go to zero and set input_denormal_flushed? */ bool flush_inputs_to_zero; bool default_nan_mode; /* diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 8d75d668172..648050be6fb 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -132,7 +132,7 @@ this code that are retained. if (unlikely(soft_t ## _is_denormal(*a))) { \ *a = soft_t ## _set_sign(soft_t ## _zero, \ soft_t ## _is_neg(*a)); \ - float_raise(float_flag_input_denormal, s); \ + float_raise(float_flag_input_denormal_flushed, s); \ } \ } @@ -4848,7 +4848,7 @@ float128 float128_silence_nan(float128 a, float_status *status) static bool parts_squash_denormal(FloatParts64 p, float_status *status) { if (p.exp == 0 && p.frac != 0) { - float_raise(float_flag_input_denormal, status); + float_raise(float_flag_input_denormal_flushed, status); return true; } diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index d0865dece35..9837c5bc7ac 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -4658,7 +4658,7 @@ static int16_t do_float16_logb_as_int(float16 a, float_status *s) return -15 - clz32(frac); } /* flush to zero */ - float_raise(float_flag_input_denormal, s); + float_raise(float_flag_input_denormal_flushed, s); } } else if (unlikely(exp == 0x1f)) { if (frac == 0) { @@ -4686,7 +4686,7 @@ static int32_t do_float32_logb_as_int(float32 a, float_status *s) return -127 - clz32(frac); } /* flush to zero */ - float_raise(float_flag_input_denormal, s); + float_raise(float_flag_input_denormal_flushed, s); } } else if (unlikely(exp == 0xff)) { if (frac == 0) { @@ -4714,7 +4714,7 @@ static int64_t do_float64_logb_as_int(float64 a, float_status *s) return -1023 - clz64(frac); } /* flush to zero */ - float_raise(float_flag_input_denormal, s); + float_raise(float_flag_input_denormal_flushed, s); } } else if (unlikely(exp == 0x7ff)) { if (frac == 0) { diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 3ed69d73698..444702a4600 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -53,7 +53,7 @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits) if (host_bits & float_flag_inexact) { target_bits |= FPSR_IXC; } - if (host_bits & float_flag_input_denormal) { + if (host_bits & float_flag_input_denormal_flushed) { target_bits |= FPSR_IDC; } return target_bits; @@ -68,11 +68,11 @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env) i |= get_float_exception_flags(&env->vfp.standard_fp_status); /* FZ16 does not generate an input denormal exception. */ i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a32) - & ~float_flag_input_denormal); + & ~float_flag_input_denormal_flushed); i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64) - & ~float_flag_input_denormal); + & ~float_flag_input_denormal_flushed); i |= (get_float_exception_flags(&env->vfp.standard_fp_status_f16) - & ~float_flag_input_denormal); + & ~float_flag_input_denormal_flushed); return vfp_exceptbits_from_host(i); } @@ -1133,7 +1133,7 @@ uint64_t HELPER(fjcvtzs)(float64 value, float_status *status) /* Normal inexact, denormal with flush-to-zero, or overflow or NaN */ inexact = e_new & (float_flag_inexact | - float_flag_input_denormal | + float_flag_input_denormal_flushed | float_flag_invalid); /* While not inexact for IEEE FP, -0.0 is inexact for JavaScript. */ diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index e0a072b4ebc..7151e809643 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -207,7 +207,7 @@ static void merge_exception_flags(CPUX86State *env, uint8_t old_flags) (new_flags & float_flag_overflow ? FPUS_OE : 0) | (new_flags & float_flag_underflow ? FPUS_UE : 0) | (new_flags & float_flag_inexact ? FPUS_PE : 0) | - (new_flags & float_flag_input_denormal ? FPUS_DE : 0))); + (new_flags & float_flag_input_denormal_flushed ? FPUS_DE : 0))); } static inline floatx80 helper_fdiv(CPUX86State *env, floatx80 a, floatx80 b) @@ -1832,7 +1832,7 @@ void helper_fxtract(CPUX86State *env) int shift = clz64(temp.l.lower); temp.l.lower <<= shift; expdif = 1 - EXPBIAS - shift; - float_raise(float_flag_input_denormal, &env->fp_status); + float_raise(float_flag_input_denormal_flushed, &env->fp_status); } else { expdif = EXPD(temp) - EXPBIAS; } @@ -3261,7 +3261,7 @@ void update_mxcsr_from_sse_status(CPUX86State *env) uint8_t flags = get_float_exception_flags(&env->sse_status); /* * The MXCSR denormal flag has opposite semantics to - * float_flag_input_denormal (the softfloat code sets that flag + * float_flag_input_denormal_flushed (the softfloat code sets that flag * only when flushing input denormals to zero, but SSE sets it * only when not flushing them to zero), so is not converted * here. diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c index 1d40383ca4f..aeab6a1d8b3 100644 --- a/target/mips/tcg/msa_helper.c +++ b/target/mips/tcg/msa_helper.c @@ -6231,7 +6231,7 @@ static inline int update_msacsr(CPUMIPSState *env, int action, int denormal) enable = GET_FP_ENABLE(env->active_tc.msacsr) | FP_UNIMPLEMENTED; /* Set Inexact (I) when flushing inputs to zero */ - if ((ieee_exception_flags & float_flag_input_denormal) && + if ((ieee_exception_flags & float_flag_input_denormal_flushed) && (env->active_tc.msacsr & MSACSR_FS_MASK) != 0) { if (action & CLEAR_IS_INEXACT) { mips_exception_flags &= ~FP_INEXACT; diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c index 691a12b2be1..59dd1ae6128 100644 --- a/target/rx/op_helper.c +++ b/target/rx/op_helper.c @@ -99,7 +99,7 @@ static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr) if (xcpt & float_flag_inexact) { SET_FPSW(X); } - if ((xcpt & (float_flag_input_denormal + if ((xcpt & (float_flag_input_denormal_flushed | float_flag_output_denormal)) && !FIELD_EX32(env->fpsw, FPSW, DN)) { env->fpsw = FIELD_DP32(env->fpsw, FPSW, CE, 1); diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 4bb341b2f94..ec2467e9fff 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -199,7 +199,7 @@ static void partsN(canonicalize)(FloatPartsN *p, float_status *status, if (likely(frac_eqz(p))) { p->cls = float_class_zero; } else if (status->flush_inputs_to_zero) { - float_raise(float_flag_input_denormal, status); + float_raise(float_flag_input_denormal_flushed, status); p->cls = float_class_zero; frac_clear(p); } else { From patchwork Fri Jan 24 16:27:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859574 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881915wrq; Fri, 24 Jan 2025 08:33:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUldHea0cB9vYSddhZGcRlybpTWFa4cJoCUFQcoGWyIKq//zsIF84oot2+3B5Ts0woETquZlQ==@linaro.org X-Google-Smtp-Source: AGHT+IEjRjJCdzlkeoVCucDg2R7xpyt7daSPwK/kfLitq2eaA8iqfUSJ2bzFGSchtWmmg7klIYo6 X-Received: by 2002:a67:e715:0:b0:4b2:5ca2:48fe with SMTP id ada2fe7eead31-4b690c1bb38mr26732030137.15.1737736379939; Fri, 24 Jan 2025 08:32:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736379; cv=none; d=google.com; s=arc-20240605; b=k+i2/IEgXUywAEYpcaKDC3fJav76Ufzvly2/2UZn5Y5VjZ97Tl0LPR03B4bdzx19Wx Xjvpmz0PIFd9yCAKIs7U02lk8V8fMs6JFiSvumuGpxW2txkcXwdO/ZItsGPShZOarUVo Duy+ps/oaWPcAONXVbyYdYVcdyh6s4TwH7hpKwcuOA+hU8gZP9HOeRQmjKYi3TLUrTNM P1LoKJOcV0GbMIQ251oHBCPXfP4ELM7xAelYx1qaTYxLGzqrxfRuZXTe85nzerd4m2vf mhUtW+5Ropz6YcswrP+ZOaVomfPefTipOI9B2rPGwE6huFr1a0Nc6BbTn8RzX98cGzkw eDCw== 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=yjfFM7NxtDggNO5IBBuH0wlbLUygYweJvaw+Q44Pxo4=; fh=RCzFtjL3oqcRlMDKetHf/ARRWnOFoEL/Db2vRkglgA4=; b=Ar1YKRiXPVTJFXqEnibtM6XqJ90JFLrwB1oLAm1JpxoOdgaMfOUHwVo/3Qbn/3ekyc dMyMp+xb6XOevbnx+P3grdCq9d3b6RdQo1AhABLy/UTLIN81JGACizRHTHPpEJtz0FP8 pfpAvDyZGXlwvtNxrT63DudKdHL+G7s2Y5kzCUU3HG30sutBLfPV2Hp3pc6fxde7i7Qd 2QQ506bclQbint+rM4UOt730kUHlLfHGFIZWNIk/tcE6qrhwkqn4LNN5TOXn5KV19oyC h6gEMw4aJ0IYpnkkwFwkjaEIYTGG6kForZmNlzob5bykPFhyRUlS39jOSuN2mpJfMOvA eoKg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hw0TzH0H; 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 ada2fe7eead31-4b709983ce1si1006563137.242.2025.01.24.08.32.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:32:59 -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=Hw0TzH0H; 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 1tbMYg-0004Ij-7R; Fri, 24 Jan 2025 11:29:26 -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 1tbMYO-0003ui-O2 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:10 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYK-0005UZ-6A for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:08 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-436345cc17bso16860555e9.0 for ; Fri, 24 Jan 2025 08:29:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736143; x=1738340943; 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=yjfFM7NxtDggNO5IBBuH0wlbLUygYweJvaw+Q44Pxo4=; b=Hw0TzH0HySD0qd37gOeRKUmAO32bVE4Np8Q88M3dI+Lw+xSl+VTqEHZCv8V8yB2Skr sT9ID7AsWbSUXIzg5W8EurHVJzMAonTG3fL7WxqzdIYeCEbvUy3hoass5E/xT3XgNRMQ +SdhLpSxP1v2OSm8ZPRu8lmDdEjvgjLO/qNzv7frs9fVUvRbxb6XzESejHQsxRyrBgPa vTJ9t4UAGDfBx5uGyHgJi0gLSumegbPc/q8yINeS0ewV5jkQ3/1gT9k+ucPNuV0csemf R6CR5Lj4ZnGnd104rctp+GN2SRsbAI3lAgBqCuoevKhxX+8GyOA89JNznaAfanlu6xTb UVIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736143; x=1738340943; 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=yjfFM7NxtDggNO5IBBuH0wlbLUygYweJvaw+Q44Pxo4=; b=p/oOn0Qd5md0dqlut/4Le4rNx6TGh1v3J68vAM2r9TVJC25KLA83G3ldRZJ7fTTVk3 FrEHHFf1jlfskZ4hudQ19aFRVsWSmpaWD40h9auEvX1MbKbcJ5kZuICU9Dmevt4/hTyw cXducero+4+c7w0f5hL8Chw8suHd7pe1kvvJkUNn2HGbAPP4TtINP+ZLuKzg42NHsDOa uxNckYokh54XS21C83I/16cAd6bs7u/aRm+NJ7nPFyMjXnHDv9iL2L5q5GiL5iwu+YXq dcSe5KsXN3a99fztreriLSvQcdzLBWhu1K8MgYdW+egK+/ldAsMhBSmTjwwtWPWe9LNq GWUg== X-Forwarded-Encrypted: i=1; AJvYcCVNqya/0KQjT5hOWc4ZNp4hy/TLXo2U9E2huGJf7GjXgQpUw7LXHISIbqb+7Sbxcu5qRjsBJFHmjwdu@nongnu.org X-Gm-Message-State: AOJu0Yy8y22XshOdRc3qUVnVFCj3cN4/Vy6/CEPCat4Jic5MIMxiaSS8 /TYPIr1Fo2NKxsexsAc/5Kh9LcPSOFStEwASnX9otlZui4tSTMYTEt8gV8Q9ewg= X-Gm-Gg: ASbGncsmOw4nKglUBTV3LMuddpz/YMJdbUg5iXszZmPF8XYoDkIPd31D4qWopneF2X9 pVnfqHSO9qnd3XXKoehJITSS5WOugnVvGXP3YNFC+9J9FKo+u65Pyz8LRCbYd1xu2QoTs4V15+t k/zFuLkp5Zm8h1NZt7G002X68J85J5bgGHY+jywrqC5/StbZE8ww4T3d6avulnYK816pZUtNVxT tDJK7ydvvtfLsxzZc+CH+LMgxw9XYgRzJY836bBnqFHyKr6mM6OhTJ3+4+GC04RENWTMVQKt4GC /3nqNRUVu2M= X-Received: by 2002:a05:600c:3b94:b0:434:9934:575 with SMTP id 5b1f17b1804b1-438913e02f8mr354713945e9.16.1737736142758; Fri, 24 Jan 2025 08:29:02 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:01 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 20/76] fpu: Rename float_flag_output_denormal to float_flag_output_denormal_flushed Date: Fri, 24 Jan 2025 16:27:40 +0000 Message-Id: <20250124162836.2332150-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Our float_flag_output_denormal exception flag is set when the fpu code flushes an output denormal to zero. Rename it to float_flag_output_denormal_flushed: * this keeps it parallel with the flag for flushing input denormals, which we just renamed * it makes it clearer that it doesn't mean "set when the output is a denormal" Commit created with for f in `git grep -l float_flag_output_denormal`; do sed -i -e 's/float_flag_output_denormal/float_flag_output_denormal_flushed/' $f; done Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- include/fpu/softfloat-types.h | 3 ++- fpu/softfloat.c | 2 +- target/arm/vfp_helper.c | 2 +- target/i386/tcg/fpu_helper.c | 2 +- target/m68k/fpu_helper.c | 2 +- target/mips/tcg/msa_helper.c | 2 +- target/rx/op_helper.c | 2 +- target/tricore/fpu_helper.c | 6 +++--- fpu/softfloat-parts.c.inc | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index 77bc172a074..4a806e3981a 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -156,7 +156,8 @@ enum { float_flag_inexact = 0x0010, /* We flushed an input denormal to 0 (because of flush_inputs_to_zero) */ float_flag_input_denormal_flushed = 0x0020, - float_flag_output_denormal = 0x0040, + /* We flushed an output denormal to 0 (because of flush_to_zero) */ + float_flag_output_denormal_flushed = 0x0040, float_flag_invalid_isi = 0x0080, /* inf - inf */ float_flag_invalid_imz = 0x0100, /* inf * 0 */ float_flag_invalid_idi = 0x0200, /* inf / inf */ diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 648050be6fb..26f3a8dc87e 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -5017,7 +5017,7 @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec roundingPrecision, bool zSign, } if ( zExp <= 0 ) { if (status->flush_to_zero) { - float_raise(float_flag_output_denormal, status); + float_raise(float_flag_output_denormal_flushed, status); return packFloatx80(zSign, 0, 0); } isTiny = status->tininess_before_rounding diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 444702a4600..3c8f3e65887 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -47,7 +47,7 @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits) if (host_bits & float_flag_overflow) { target_bits |= FPSR_OFC; } - if (host_bits & (float_flag_underflow | float_flag_output_denormal)) { + if (host_bits & (float_flag_underflow | float_flag_output_denormal_flushed)) { target_bits |= FPSR_UFC; } if (host_bits & float_flag_inexact) { diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index 7151e809643..de6d0b252ec 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -3271,7 +3271,7 @@ void update_mxcsr_from_sse_status(CPUX86State *env) (flags & float_flag_overflow ? FPUS_OE : 0) | (flags & float_flag_underflow ? FPUS_UE : 0) | (flags & float_flag_inexact ? FPUS_PE : 0) | - (flags & float_flag_output_denormal ? FPUS_UE | FPUS_PE : + (flags & float_flag_output_denormal_flushed ? FPUS_UE | FPUS_PE : 0)); } diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index e3f4a188501..339b73ad7dc 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -175,7 +175,7 @@ static int cpu_m68k_exceptbits_from_host(int host_bits) if (host_bits & float_flag_overflow) { target_bits |= 0x40; } - if (host_bits & (float_flag_underflow | float_flag_output_denormal)) { + if (host_bits & (float_flag_underflow | float_flag_output_denormal_flushed)) { target_bits |= 0x20; } if (host_bits & float_flag_divbyzero) { diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c index aeab6a1d8b3..ec38d9fde5e 100644 --- a/target/mips/tcg/msa_helper.c +++ b/target/mips/tcg/msa_helper.c @@ -6241,7 +6241,7 @@ static inline int update_msacsr(CPUMIPSState *env, int action, int denormal) } /* Set Inexact (I) and Underflow (U) when flushing outputs to zero */ - if ((ieee_exception_flags & float_flag_output_denormal) && + if ((ieee_exception_flags & float_flag_output_denormal_flushed) && (env->active_tc.msacsr & MSACSR_FS_MASK) != 0) { mips_exception_flags |= FP_INEXACT; if (action & CLEAR_FS_UNDERFLOW) { diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c index 59dd1ae6128..b3ed822dd11 100644 --- a/target/rx/op_helper.c +++ b/target/rx/op_helper.c @@ -100,7 +100,7 @@ static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr) SET_FPSW(X); } if ((xcpt & (float_flag_input_denormal_flushed - | float_flag_output_denormal)) + | float_flag_output_denormal_flushed)) && !FIELD_EX32(env->fpsw, FPSW, DN)) { env->fpsw = FIELD_DP32(env->fpsw, FPSW, CE, 1); } diff --git a/target/tricore/fpu_helper.c b/target/tricore/fpu_helper.c index 5d38aea143a..1b72dcc5f5c 100644 --- a/target/tricore/fpu_helper.c +++ b/target/tricore/fpu_helper.c @@ -43,7 +43,7 @@ static inline uint8_t f_get_excp_flags(CPUTriCoreState *env) & (float_flag_invalid | float_flag_overflow | float_flag_underflow - | float_flag_output_denormal + | float_flag_output_denormal_flushed | float_flag_divbyzero | float_flag_inexact); } @@ -99,7 +99,7 @@ static void f_update_psw_flags(CPUTriCoreState *env, uint8_t flags) some_excp = 1; } - if (flags & float_flag_underflow || flags & float_flag_output_denormal) { + if (flags & float_flag_underflow || flags & float_flag_output_denormal_flushed) { env->FPU_FU = 1 << 31; some_excp = 1; } @@ -109,7 +109,7 @@ static void f_update_psw_flags(CPUTriCoreState *env, uint8_t flags) some_excp = 1; } - if (flags & float_flag_inexact || flags & float_flag_output_denormal) { + if (flags & float_flag_inexact || flags & float_flag_output_denormal_flushed) { env->PSW |= 1 << 26; some_excp = 1; } diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index ec2467e9fff..73621f4a970 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -335,7 +335,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s, } frac_shr(p, frac_shift); } else if (s->flush_to_zero) { - flags |= float_flag_output_denormal; + flags |= float_flag_output_denormal_flushed; p->cls = float_class_zero; exp = 0; frac_clear(p); From patchwork Fri Jan 24 16:27:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859591 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp884936wrq; Fri, 24 Jan 2025 08:39:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVBGcPiK3zkRDU3G8TWx28pM7Dci/iyA2tFX8BhbvH7qrfJXjnibiu403DT9q1MnnKDR2DeZQ==@linaro.org X-Google-Smtp-Source: AGHT+IGR1ddtTFCX28A2rxehGcGrmNjnUjyeC/+E57mZ9rWu4NU86uxpdKJxv/QFHQmsCX+9Nq51 X-Received: by 2002:a05:6102:3f51:b0:4b1:1232:def with SMTP id ada2fe7eead31-4b690bb15fdmr27547979137.4.1737736771938; Fri, 24 Jan 2025 08:39:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736771; cv=none; d=google.com; s=arc-20240605; b=A1Cl9OEjBL1qJ2BCoRTkcvHFz5Wpa4OOnY1xwzifFVAphLldmTNxfm5qBgmeArVGxC NukzT/oe4UUhwb8drus1+CffoRKkzJzPQIMVK56/W7P5UoVnmEakMSuDjpheXpQS6Rmq qrj3ip/zLeWPnwFm1Uzm7VPwpjkA2byEi20ROc23mxtqUQlJkTxcCKSZ8bZFQOFySnv/ 9QmyxDldwkksDLTJFEk7h1dq30GpZz1r+2wJESVO2WZDYpf0a6q7z0Ys7+eRJPl3fQ8e Hpds3iFlX1ghn9JrvK087ZuKhB9Y2pe4LYxeWPfMaSobuPaMtCbuvXKWwL+ZxeDSOf2y 5BEQ== 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=ctBdNSCgNxxr/c+03Jcl4N1Ew17aMUfE9iGYWizzwVk=; fh=B8XIJNnMFO8Hf+WSAUEqUa0lyx0YLLSiANO27xsI9SQ=; b=fmG4N2nmsfDEVPDQpaoVuX0UIX3vWphFBeY1z+EOfz8uJZp/ma4PHZEfZRZN1G7eOr zEVskFmP2uM784pxhoM0hRhSUwfJiXo0CybzfvBfvI407G8vToBGDNmzhISF0oFiDwMV OltA5CUva6aPJJs9D+GknjEvSL1NItNX+VQkPsFT/Xc+29vNKG6gFqHU+nu8Se5VJm0E fEwCDH/tFcNZkY7kpsXF+2sH/uD1FIhlCf4/dMXSozbNshjhG5MO2v07/nabQfqoBeXn 4NW0ydDga8y7Zqgfpqup+RQAWQ8AL+hLExzCNb0HXZP70Yc6axanK27CkmfDQ6UkQ06T iYGA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YxKEfvmX; 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 ada2fe7eead31-4b7099fcd86si879289137.518.2025.01.24.08.39.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:39:31 -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=YxKEfvmX; 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 1tbMaA-0006xx-0Z; Fri, 24 Jan 2025 11:30:58 -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 1tbMYQ-0003vs-HS for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:12 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYM-0005V4-T8 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:09 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-436202dd730so16567515e9.2 for ; Fri, 24 Jan 2025 08:29:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736144; x=1738340944; 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=ctBdNSCgNxxr/c+03Jcl4N1Ew17aMUfE9iGYWizzwVk=; b=YxKEfvmXa9Y9G64ZnuDpcY9yti4X5TcJ4OeKS7yeUa+t9Xqw6jKjckSLjqS1X/AjWO pSKJy3HtVwrJdJUw8YT3Gamyr+Nytk+CJNLuksxUfmwbO+a+7JwJA8v/S+88YxSloW7b mpX56ixk1biWCHRGwtyDMLRmPZOrAZnif2D1rrpGRaZFPzxFyhKF70tpxJwHjFzzV5ZC VVSBRzdZCTUeRTIGKj/vkCskxjkc0yoG0zSFWexB/A/WvxqABxGs2rPUi3Q0Q9gJZLol Tjj4YyFbpItr5ur1hSIcGvhuZogBcQm9nLrf//9Tsd+WOmfvQIiPQPTDkXKSPYClMVWW 6a1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736144; x=1738340944; 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=ctBdNSCgNxxr/c+03Jcl4N1Ew17aMUfE9iGYWizzwVk=; b=SVA5M5Vjph+0Uw5kxnWlM8BRYiACFYHLJExScBHG3noWehudR4cn15b3oFHO4YmsgI YVJmNZh25EMTMd69iOkrwOdqUVlD2C+NuwZAuMdGbQpeHbIdg/vl25+NKDNCeyWT7zdO 6K6QTozzQ9HBC5Xi4u9gGtmTHz30SZHJFISP+PGwLTO0DYOs/LGwlzT0gYYZptQBT0p8 +b4UZ3kJh2W7SOMEq7fIspdVP7T3rfhmlCbSftmQBehyaExvovYmA+MKFBysWUj15B0j TH5qh37JJEl9tmnIYc5P9QXWL27QnuKue+o2uHkmm2x5cMPxoEPJOVgNXQm5Gn8IsTXa Pqug== X-Forwarded-Encrypted: i=1; AJvYcCWmdlWtBXHZXlsk/x+zHDCuB1kZw5A+4LQH/vw9koXwhBdYjHzECJ3OQ3XcH+3PD+G3aT93elRjlNPA@nongnu.org X-Gm-Message-State: AOJu0YxjTuxiAk82OpQLy2ele7v++O3WxRBYZaHVn0z7yrtm6ZY24mtJ PlZtwtOSgQJ0QndEnKto9IKL4Eo7Uq1Qlonkkpo2OWzpEjA01BBLqEwXlmToyUxbD2N2vzuHHRM u X-Gm-Gg: ASbGncsjAAvHBh0Nsu03KuOdILtSQROW4kkuEXd5jvAiCwgNBr3CNMzFbJNjh6RW/GI TV7u7YPPaUEsyjznjfpF1V3cPeyh7WYIbKfAGPkOtJF4R4LYnvQFLXKHQPmxhw1cdd0xtgCPmuZ 7fwWYaAOUNxejKrbwQM6EH4yoFtczh14+8F7nW1blh0TtB2H/kQUfFiNhAli3997gNwF34hBib0 849tBQrba+dWtK0QN9uZGsTJuuAQdYxM69zyBpRp4uyD/jQ2mXkXLcdPe7pDUSLldOrt/YqJ1uU wbZk88EXa3U= X-Received: by 2002:a05:600c:5112:b0:434:a5bc:70fc with SMTP id 5b1f17b1804b1-438913cfa0emr282088945e9.8.1737736143921; Fri, 24 Jan 2025 08:29:03 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:03 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 21/76] fpu: Fix a comment in softfloat-types.h Date: Fri, 24 Jan 2025 16:27:41 +0000 Message-Id: <20250124162836.2332150-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 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 In softfloat-types.h a comment documents that if the float_status field flush_to_zero is set then we flush denormalised results to 0 and set the inexact flag. This isn't correct: the status flag that we set when flush_to_zero causes us to flush an output to zero is float_flag_output_denormal_flushed. Correct the comment. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- include/fpu/softfloat-types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index 4a806e3981a..c177923e319 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -312,7 +312,7 @@ typedef struct float_status { Float3NaNPropRule float_3nan_prop_rule; FloatInfZeroNaNRule float_infzeronan_rule; bool tininess_before_rounding; - /* should denormalised results go to zero and set the inexact flag? */ + /* should denormalised results go to zero and set output_denormal_flushed? */ bool flush_to_zero; /* should denormalised inputs go to zero and set input_denormal_flushed? */ bool flush_inputs_to_zero; From patchwork Fri Jan 24 16:27:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859568 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881772wrq; Fri, 24 Jan 2025 08:32:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVUaNTH9oZ6lPuNihVoVVt9c/k1W3e4V5aRDc6fDtJSKx+XAiy+zFoa51TvLMFtBE/w4mSjVA==@linaro.org X-Google-Smtp-Source: AGHT+IHacRXkrFuZcMHGTjaHkZBIrOW3XqpaxRq+e+phfTUulOEt5jwUuQ/Z8E9BSIlbDEBFDTcv X-Received: by 2002:a05:622a:c:b0:467:6553:a85d with SMTP id d75a77b69052e-46e12b96da1mr514427451cf.50.1737736370542; Fri, 24 Jan 2025 08:32:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736370; cv=none; d=google.com; s=arc-20240605; b=K1XgaaFkvPsXiDCistf57mVtUutk4umm68Tuk2PeMWv2WbOdOeiDKFqa/VQToiauuN Tqn4n9GGNtpLJ3CbCarp3HZXhIIV66DKaNCHd/9bz62AoH1dVR7UkhZvVjzi8+HAz8JZ eHKfFTspZVqrZoba1VNRyrbDKdEb0FP5Ayc+g1DQ+2mKMszAnvuYp/wWUoNW6rwwMPKX PV2cTOxflKSc2z02iO5DUiBXiz+Oz2ORop5QnR4nGANJHkd69NWwS4IDWmybBPysK/Aj N6j+iZuY497CoSOAQ4mV5R7W74LpiEQyCmTaKqqGTbUCWJjlyic92MkxhvwiNFeww/+a gh7g== 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=ek2FKZlEFWiY6rarba+/bALZAZmBGmoLbiL6TynZjl8=; fh=cN6eDlzdZ70gI3Gcrh/yU9S2GYJ5tGy1zdgcd0jYM7I=; b=VBqpONcIy4S+ZHADjvEn7Ktnl8Iq7CcbutJYqD0KyqGlqGy/7taDTgZQDVTtuGgINB u1kD7qymWjY4oct3Qwz4H3c8UkbF8sjA5mFX0K3pqnxni3vwx9Fqfn4sKWZdnxg+T919 txJF4hrstLTMOGWObWkvOkiAEngO5eYLs38KUjE6rXt/PC1sCrYHSNFE4JpHHyOT5GYC cUvTjArK5PXlTEmCdPPkW31dALkNW4jbRdMYyZB2pgZVIOCOh5Jg0O39bI7qP1VqRGZD din4Wh3T9aSBC4IBH7DpcxwwHkM6+5dyH8mD7QTRnXahqd2+a+BJYSUhvg1THhL1QKjb ZKcQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gwzSe0O4; 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 a1e0cc1a2514c-864a9d41020si700539241.182.2025.01.24.08.32.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:32:50 -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=gwzSe0O4; 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 1tbMYj-0004b1-FJ; Fri, 24 Jan 2025 11:29:29 -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 1tbMYQ-0003w2-P3 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:12 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYN-0005VW-WA for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:10 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-436ce2ab251so15088935e9.1 for ; Fri, 24 Jan 2025 08:29:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736146; x=1738340946; 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=ek2FKZlEFWiY6rarba+/bALZAZmBGmoLbiL6TynZjl8=; b=gwzSe0O4b3zSQTpCmISgn2EOrtpi+IRknAG4hxKVG7g4n3QiJM/wyStV3wSWDSt66G uq5HBu5GsTC0JGSJODxyR4UPBAGiSMgiLu4Nvg2iXjEGJ7IHT00+V3u/arS9VKeZzfly 4LkL63Vc/y7vqIXpEnZV08lyWF5auBgkpmPcb/koX78goQo2F5onj6olaxgIK350UGF2 ycIm8S3F6YpDM08VpUJfrcwNIup/x1TR3h9eXrw0+tWTB6HtkEu0kr9Sz9XDZgA1QmfM unMIywwfSj398Remknk5a3CMsMmsEPXijp2JJcM1HN+LzJgw6ypLHJ8VBYDBGD1sexzF o10g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736146; x=1738340946; 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=ek2FKZlEFWiY6rarba+/bALZAZmBGmoLbiL6TynZjl8=; b=ZbwwD/HaOR1A6ySe5zzVq19+qXMZfyQePkISksn1XMXh4GcJ0lCme3bYt2Cqmkyowd 5l6drdBnHi4QHKlPHo2R4ro1O1SAGHufQh9S1BLuKhhiX4M+ev/RZLGRm2xaZF63scU2 ePGtAr/veQMT+jazrKKzc7atsx2yitTq2KCBRUa3FL71CE0fxIBN69SHkOYNIAJELV30 0AE34F/GaOLIE1/JpOJXYb1bfkyuwODUv3xq/aTNDfGzqVjkihL64ALqpb8Z/v8cYw+i nGIFZftCKUQWTYjQai7LKh6ghu0g905rwNKu5kAE+GNAaQBGGY3HnXl3pQec3Ieva92+ x2dw== X-Forwarded-Encrypted: i=1; AJvYcCXx7BUmBcE1GQJRry1Z6dZo0ghxKLT7FLMFCUBaKgIX2OmEU8j/UXLftIs6dVsx3YrEPS9+GgxZHiig@nongnu.org X-Gm-Message-State: AOJu0Yx+ugE6r/tcMS5LOlZ/Q8+4R8RQwQ8C+5864bhAwu09XeeB5qmZ fY998WirDjpaOdBk/PyO2b/QcctCmssbptfCiOaPpWmenKaU9FfEPdMb3WGEzIfqXNIZZvv+ZVC V X-Gm-Gg: ASbGnctUuaUtVEvGBnw4PwbSztGM0Uyiosq+NyO/aAax1p6LloUHjrN6IeMWImAFrML cbmjOLPtD7iokvXwJXDmBxAvwQE0AXIx2qmqXY/TpVtYNAROEf+apJN7Etjk6fEpNg1EPJyPjVJ H3YCItJMT4AXTLDGouWnWP+XCVONny3lDgx03axCzVcHMT4mQAxl0UJRjyJMXN7V+oN4u9ZaHSb lFwvparCF337pvzru977DfgXnHqSlGXXiSt2bAP0z/ryHnehDAqoGEBOKMY9f46TCsnIIhfs8cc iUWZZSRjRMo= X-Received: by 2002:a05:600c:218b:b0:436:51bb:7a43 with SMTP id 5b1f17b1804b1-438919191f6mr309720065e9.5.1737736146017; Fri, 24 Jan 2025 08:29:06 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:04 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 22/76] fpu: Add float_class_denormal Date: Fri, 24 Jan 2025 16:27:42 +0000 Message-Id: <20250124162836.2332150-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Currently in softfloat we canonicalize input denormals and so the code that implements floating point operations does not need to care whether the input value was originally normal or denormal. However, both x86 and Arm FEAT_AFP require that an exception flag is set if: * an input is denormal * that input is not squashed to zero * that input is actually used in the calculation (e.g. we did not find the other input was a NaN) So we need to track that the input was a non-squashed denormal. To do this we add a new value to the FloatClass enum. In this commit we add the value and adjust the code everywhere that looks at FloatClass values so that the new float_class_denormal behaves identically to float_class_normal. We will add the code that does the "raise a new float exception flag if an input was an unsquashed denormal and we used it" in a subsequent commit. There should be no behavioural change in this commit. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- fpu/softfloat.c | 32 ++++++++++++++++++++++++++++--- fpu/softfloat-parts.c.inc | 40 ++++++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 18 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 26f3a8dc87e..03a604c38ec 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -404,12 +404,16 @@ float64_gen2(float64 xa, float64 xb, float_status *s, /* * Classify a floating point number. Everything above float_class_qnan * is a NaN so cls >= float_class_qnan is any NaN. + * + * Note that we canonicalize denormals, so most code should treat + * class_normal and class_denormal identically. */ typedef enum __attribute__ ((__packed__)) { float_class_unclassified, float_class_zero, float_class_normal, + float_class_denormal, /* input was a non-squashed denormal */ float_class_inf, float_class_qnan, /* all NaNs from here */ float_class_snan, @@ -420,12 +424,14 @@ typedef enum __attribute__ ((__packed__)) { enum { float_cmask_zero = float_cmask(float_class_zero), float_cmask_normal = float_cmask(float_class_normal), + float_cmask_denormal = float_cmask(float_class_denormal), float_cmask_inf = float_cmask(float_class_inf), float_cmask_qnan = float_cmask(float_class_qnan), float_cmask_snan = float_cmask(float_class_snan), float_cmask_infzero = float_cmask_zero | float_cmask_inf, float_cmask_anynan = float_cmask_qnan | float_cmask_snan, + float_cmask_anynorm = float_cmask_normal | float_cmask_denormal, }; /* Flags for parts_minmax. */ @@ -459,6 +465,20 @@ static inline __attribute__((unused)) bool is_qnan(FloatClass c) return c == float_class_qnan; } +/* + * Return true if the float_cmask has only normals in it + * (including input denormals that were canonicalized) + */ +static inline bool cmask_is_only_normals(int cmask) +{ + return !(cmask & ~float_cmask_anynorm); +} + +static inline bool is_anynorm(FloatClass c) +{ + return float_cmask(c) & float_cmask_anynorm; +} + /* * Structure holding all of the decomposed parts of a float. * The exponent is unbiased and the fraction is normalized. @@ -1729,6 +1749,7 @@ static float64 float64r32_round_pack_canonical(FloatParts64 *p, */ switch (p->cls) { case float_class_normal: + case float_class_denormal: if (unlikely(p->exp == 0)) { /* * The result is denormal for float32, but can be represented @@ -1817,6 +1838,7 @@ static floatx80 floatx80_round_pack_canonical(FloatParts128 *p, switch (p->cls) { case float_class_normal: + case float_class_denormal: if (s->floatx80_rounding_precision == floatx80_precision_x) { parts_uncanon_normal(p, s, fmt); frac = p->frac_hi; @@ -2697,6 +2719,7 @@ static void parts_float_to_ahp(FloatParts64 *a, float_status *s) break; case float_class_normal: + case float_class_denormal: case float_class_zero: break; @@ -2729,7 +2752,7 @@ static void parts_float_to_float_narrow(FloatParts64 *a, FloatParts128 *b, a->sign = b->sign; a->exp = b->exp; - if (a->cls == float_class_normal) { + if (is_anynorm(a->cls)) { frac_truncjam(a, b); } else if (is_nan(a->cls)) { /* Discard the low bits of the NaN. */ @@ -3218,6 +3241,7 @@ static Int128 float128_to_int128_scalbn(float128 a, FloatRoundMode rmode, return int128_zero(); case float_class_normal: + case float_class_denormal: if (parts_round_to_int_normal(&p, rmode, scale, 128 - 2)) { flags = float_flag_inexact; } @@ -3645,6 +3669,7 @@ static Int128 float128_to_uint128_scalbn(float128 a, FloatRoundMode rmode, return int128_zero(); case float_class_normal: + case float_class_denormal: if (parts_round_to_int_normal(&p, rmode, scale, 128 - 2)) { flags = float_flag_inexact; if (p.cls == float_class_zero) { @@ -5231,6 +5256,8 @@ float32 float32_exp2(float32 a, float_status *status) float32_unpack_canonical(&xp, a, status); if (unlikely(xp.cls != float_class_normal)) { switch (xp.cls) { + case float_class_denormal: + break; case float_class_snan: case float_class_qnan: parts_return_nan(&xp, status); @@ -5240,9 +5267,8 @@ float32 float32_exp2(float32 a, float_status *status) case float_class_zero: return float32_one; default: - break; + g_assert_not_reached(); } - g_assert_not_reached(); } float_raise(float_flag_inexact, status); diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 73621f4a970..8621cb87185 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -204,7 +204,7 @@ static void partsN(canonicalize)(FloatPartsN *p, float_status *status, frac_clear(p); } else { int shift = frac_normalize(p); - p->cls = float_class_normal; + p->cls = float_class_denormal; p->exp = fmt->frac_shift - fmt->exp_bias - shift + !fmt->m68k_denormal; } @@ -395,7 +395,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s, static void partsN(uncanon)(FloatPartsN *p, float_status *s, const FloatFmt *fmt) { - if (likely(p->cls == float_class_normal)) { + if (likely(is_anynorm(p->cls))) { parts_uncanon_normal(p, s, fmt); } else { switch (p->cls) { @@ -435,7 +435,7 @@ static FloatPartsN *partsN(addsub)(FloatPartsN *a, FloatPartsN *b, if (a->sign != b_sign) { /* Subtraction */ - if (likely(ab_mask == float_cmask_normal)) { + if (likely(cmask_is_only_normals(ab_mask))) { if (parts_sub_normal(a, b)) { return a; } @@ -468,7 +468,7 @@ static FloatPartsN *partsN(addsub)(FloatPartsN *a, FloatPartsN *b, } } else { /* Addition */ - if (likely(ab_mask == float_cmask_normal)) { + if (likely(cmask_is_only_normals(ab_mask))) { parts_add_normal(a, b); return a; } @@ -488,12 +488,12 @@ static FloatPartsN *partsN(addsub)(FloatPartsN *a, FloatPartsN *b, } if (b->cls == float_class_zero) { - g_assert(a->cls == float_class_normal); + g_assert(is_anynorm(a->cls)); return a; } g_assert(a->cls == float_class_zero); - g_assert(b->cls == float_class_normal); + g_assert(is_anynorm(b->cls)); return_b: b->sign = b_sign; return b; @@ -513,7 +513,7 @@ static FloatPartsN *partsN(mul)(FloatPartsN *a, FloatPartsN *b, int ab_mask = float_cmask(a->cls) | float_cmask(b->cls); bool sign = a->sign ^ b->sign; - if (likely(ab_mask == float_cmask_normal)) { + if (likely(cmask_is_only_normals(ab_mask))) { FloatPartsW tmp; frac_mulw(&tmp, a, b); @@ -596,7 +596,7 @@ static FloatPartsN *partsN(muladd_scalbn)(FloatPartsN *a, FloatPartsN *b, a->sign ^= 1; } - if (unlikely(ab_mask != float_cmask_normal)) { + if (unlikely(!cmask_is_only_normals(ab_mask))) { if (unlikely(ab_mask == float_cmask_infzero)) { float_raise(float_flag_invalid | float_flag_invalid_imz, s); goto d_nan; @@ -611,7 +611,7 @@ static FloatPartsN *partsN(muladd_scalbn)(FloatPartsN *a, FloatPartsN *b, } g_assert(ab_mask & float_cmask_zero); - if (c->cls == float_class_normal) { + if (is_anynorm(c->cls)) { *a = *c; goto return_normal; } @@ -692,7 +692,7 @@ static FloatPartsN *partsN(div)(FloatPartsN *a, FloatPartsN *b, int ab_mask = float_cmask(a->cls) | float_cmask(b->cls); bool sign = a->sign ^ b->sign; - if (likely(ab_mask == float_cmask_normal)) { + if (likely(cmask_is_only_normals(ab_mask))) { a->sign = sign; a->exp -= b->exp + frac_div(a, b); return a; @@ -750,7 +750,7 @@ static FloatPartsN *partsN(modrem)(FloatPartsN *a, FloatPartsN *b, { int ab_mask = float_cmask(a->cls) | float_cmask(b->cls); - if (likely(ab_mask == float_cmask_normal)) { + if (likely(cmask_is_only_normals(ab_mask))) { frac_modrem(a, b, mod_quot); return a; } @@ -800,6 +800,8 @@ static void partsN(sqrt)(FloatPartsN *a, float_status *status, if (unlikely(a->cls != float_class_normal)) { switch (a->cls) { + case float_class_denormal: + break; case float_class_snan: case float_class_qnan: parts_return_nan(a, status); @@ -1130,6 +1132,7 @@ static void partsN(round_to_int)(FloatPartsN *a, FloatRoundMode rmode, case float_class_inf: break; case float_class_normal: + case float_class_denormal: if (parts_round_to_int_normal(a, rmode, scale, fmt->frac_size)) { float_raise(float_flag_inexact, s); } @@ -1174,6 +1177,7 @@ static int64_t partsN(float_to_sint)(FloatPartsN *p, FloatRoundMode rmode, return 0; case float_class_normal: + case float_class_denormal: /* TODO: N - 2 is frac_size for rounding; could use input fmt. */ if (parts_round_to_int_normal(p, rmode, scale, N - 2)) { flags = float_flag_inexact; @@ -1241,6 +1245,7 @@ static uint64_t partsN(float_to_uint)(FloatPartsN *p, FloatRoundMode rmode, return 0; case float_class_normal: + case float_class_denormal: /* TODO: N - 2 is frac_size for rounding; could use input fmt. */ if (parts_round_to_int_normal(p, rmode, scale, N - 2)) { flags = float_flag_inexact; @@ -1304,6 +1309,7 @@ static int64_t partsN(float_to_sint_modulo)(FloatPartsN *p, return 0; case float_class_normal: + case float_class_denormal: /* TODO: N - 2 is frac_size for rounding; could use input fmt. */ if (parts_round_to_int_normal(p, rmode, 0, N - 2)) { flags = float_flag_inexact; @@ -1452,9 +1458,10 @@ static FloatPartsN *partsN(minmax)(FloatPartsN *a, FloatPartsN *b, a_exp = a->exp; b_exp = b->exp; - if (unlikely(ab_mask != float_cmask_normal)) { + if (unlikely(!cmask_is_only_normals(ab_mask))) { switch (a->cls) { case float_class_normal: + case float_class_denormal: break; case float_class_inf: a_exp = INT16_MAX; @@ -1467,6 +1474,7 @@ static FloatPartsN *partsN(minmax)(FloatPartsN *a, FloatPartsN *b, } switch (b->cls) { case float_class_normal: + case float_class_denormal: break; case float_class_inf: b_exp = INT16_MAX; @@ -1513,7 +1521,7 @@ static FloatRelation partsN(compare)(FloatPartsN *a, FloatPartsN *b, { int ab_mask = float_cmask(a->cls) | float_cmask(b->cls); - if (likely(ab_mask == float_cmask_normal)) { + if (likely(cmask_is_only_normals(ab_mask))) { FloatRelation cmp; if (a->sign != b->sign) { @@ -1581,6 +1589,7 @@ static void partsN(scalbn)(FloatPartsN *a, int n, float_status *s) case float_class_inf: break; case float_class_normal: + case float_class_denormal: a->exp += MIN(MAX(n, -0x10000), 0x10000); break; default: @@ -1599,6 +1608,8 @@ static void partsN(log2)(FloatPartsN *a, float_status *s, const FloatFmt *fmt) if (unlikely(a->cls != float_class_normal)) { switch (a->cls) { + case float_class_denormal: + break; case float_class_snan: case float_class_qnan: parts_return_nan(a, s); @@ -1615,9 +1626,8 @@ static void partsN(log2)(FloatPartsN *a, float_status *s, const FloatFmt *fmt) } return; default: - break; + g_assert_not_reached(); } - g_assert_not_reached(); } if (unlikely(a->sign)) { goto d_nan; From patchwork Fri Jan 24 16:27:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859578 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp882617wrq; Fri, 24 Jan 2025 08:34:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWLodcahljgsp3rBtiBcv112ohGT1ifaeWcPvx0D6/8z4YHqDoFi3BwuyGNOCMpQiVq8HDKZg==@linaro.org X-Google-Smtp-Source: AGHT+IFdniSCFBdgc+iMcGjBisCpI3sYagzkKH9fEsR/JQ9Ql6SX26Rc3+R4X/SA2D3uyvLysbwU X-Received: by 2002:a05:6102:3b86:b0:4b2:bc6b:c73c with SMTP id ada2fe7eead31-4b709bc9ff8mr3659292137.6.1737736464700; Fri, 24 Jan 2025 08:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736464; cv=none; d=google.com; s=arc-20240605; b=fqY4kEqIjaQh7L8zIg1qdlfppPpX2tlH+KbIJ7Gxp2xhU/MPEkxPkGJnAcKl2KjDw2 PJ5Abe/Ntwj8j6UQz/v/ojeKmbzw6DkfIVDF/zJQGTpRg13cL1gEon7JPds4+vx3KWvJ KgOsUfEnWUyyULJIwsjYNc9ViiMiE20p/8AbuWJcDP6UNtWKnAcRBk601+FMLzsy2fTh xB+MfHNIJ2mgyNQpPdaw2qWsoPHkQbg4DNyuLxI+BOs5jtadU2RmBXX3T9rdR8kGJ8KN CTJ/qNMkyOkSZOjKhfNWe/qT9eaupwPo75eh7B400ZkLFGlIPt/MrtryV/gH6Eqm7HPZ fyAA== 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=9vOW3vjTeJp39sy4OsCwvMlVmTE6vsBeLOiYEKAZ7/E=; fh=vAjDKhWG2H0thFNX+75au94WBnSp3B6z+NwN13Igj74=; b=UoVacZgfoGjQPX0Op8U0YuytR1jbmTmFcBgFpUdhfDctdGP5iBhKRk8iXOj9B+10kH 7WCowiYMX/Iu55lPo0wa6E/a4aKUeX0/jw2BmnYP/WTQC6w7h9RT5pOqesKayAK6AEDE RO6cEiw7AjyFX1cVXxMWsBnFfSNLVNDZEQ0zR5Hiq6OdpUdaz9liCWYC7uqAfa9vlz7L kVj4svpau8zYj1+obcAKsNCB5qP6SKv2hdtkUlTa3GMtoNS/7MRJcg/qhsOUogbahoy4 QLJUoCf/CWujfQWvAxn4E1MoSGXHLJ1CnLawVNKeU4aUdk78zsjRyNx5lAihWQktY4f8 MPsQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qwHXbkY8; 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 ada2fe7eead31-4b7099fb5e8si858985137.531.2025.01.24.08.34.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:34:24 -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=qwHXbkY8; 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 1tbMal-00089v-S4; Fri, 24 Jan 2025 11:31:37 -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 1tbMYS-0003xi-IW for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:15 -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 1tbMYO-0005WC-E4 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:11 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4361f664af5so25670765e9.1 for ; Fri, 24 Jan 2025 08:29:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736147; x=1738340947; 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=9vOW3vjTeJp39sy4OsCwvMlVmTE6vsBeLOiYEKAZ7/E=; b=qwHXbkY8I90WENTXp1qepXef0a386Ob8O1pZN/BVLnqC9byZEFTl9yd/A3Lye6CeUS ZVM5dXWlwaLDXpaXeZimiZhhFJBMHNLxHPYdJHdijqXPnaDhSeSS/ejk305IHf8KtEgM PSBSlhOqXkoUmIx2tsOtIQgNgG0DVtbLPeIYQuzgq9ttipZUOG9WDMzURMLFLJb6MG2g 0wk5h+sDHYHaitf4CcnvWGkdKeTgkgFa0laHoPTEpl7cNrPpNCQhJ/Vg0jYuQjPLEPnH 2zmQJNU+9wS3wWZ0sDm1Y5w52/Fb26qwW3T8O3ueTNOPKEi3ghXXdTb7nLjEtEgkNtbt l4pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736147; x=1738340947; 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=9vOW3vjTeJp39sy4OsCwvMlVmTE6vsBeLOiYEKAZ7/E=; b=B4jb4VsVj38tH1uE1v1j80wvqGFyZfM7wjT03Z+c6RU9/BnAq8VmSkcipg+nhNPxxG 1EJ26uJOi8OHCqS37ZNH896ErdwN6Dyzi1lQ2n6hPVxJvnowTHDjdHCwSchKSiWa2JUP Y3HHP4kG6Ezk7dOFnSpoqYXt5H2XJZJwRFfSjt27EDV8CsTTYwhBQN57OjsGeVxc8AzV MyOdsZKT/n49S+wsPulUhsUbVUQC4+HtdbvMv6DJpTt3uqa+5P9ZJe6WJt7sH3wtU6mQ P6iQ76kpG0yQ2ThtBvubR09t/l5f0jG79HDEXv0VKwdgpzMxwcDIoChbqQxQvagB/rfx PKMA== X-Forwarded-Encrypted: i=1; AJvYcCXIsycZ7jB3cUQpDkXTLTfAtPsCnZFyeL4JCxVurn20ZsrF91YVDb2TWgsYjRU/O/kAuua2ASolA5II@nongnu.org X-Gm-Message-State: AOJu0Yx/MgugDXFMlxn/M6dsgRE12nrCKnv+SMSTJLOjwE9zzWJGlYJH LuoRrYKwDZChEIiY4uKBKVFdVAwGIVfO7cG2ZRqhDoS/ejgOb/6MwdNZAP5ICyWVW4gmvrSzMVD 0 X-Gm-Gg: ASbGncuLUne4Zdq9ghYnHYxjVxaoSLyFhmTFjjFGmyDfL1zqcBuDrSRi+mol0E4wpUm 63Zw98haNmzSfrM9pNzNQ8wNNc5k+wKA42LTBkPz65YPKK2/u3VRh6gXPQpLU3Yq4GZKQ8xdD62 IavNRGNNkAWFKgmPmO82DOEEegex54hffY9KIrW2WuPS7Th//rGzGKllrk5r/WWQt63kQyOP2uE gYZgTLCwJKhoiiTQwChAqQFjkumwkYTbmvJzwidbng/lfytBYDbzRIjyBErmcrNYiIzOu+HFQaJ hdnM0W9NDkw= X-Received: by 2002:a05:600c:1d1d:b0:434:a815:2b5d with SMTP id 5b1f17b1804b1-4389141c211mr253299595e9.24.1737736147035; Fri, 24 Jan 2025 08:29:07 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:06 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 23/76] fpu: Implement float_flag_input_denormal_used Date: Fri, 24 Jan 2025 16:27:43 +0000 Message-Id: <20250124162836.2332150-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-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, T_SCC_BODY_TEXT_LINE=-0.01 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 For the x86 and the Arm FEAT_AFP semantics, we need to be able to tell the target code that the FPU operation has used an input denormal. Implement this; when it happens we set the new float_flag_denormal_input_used. Note that we only set this when an input denormal is actually used by the operation: if the operation results in Invalid Operation or Divide By Zero or the result is a NaN because some other input was a NaN then we never needed to look at the input denormal and do not set denormal_input_used. We mostly do not need to adjust the hardfloat codepaths to deal with this flag, because almost all hardfloat operations are already gated on the input not being a denormal, and will fall back to softfloat for a denormal input. The only exception is the comparison operations, where we need to add the check for input denormals, which must now fall back to softfloat where they did not before. Signed-off-by: Peter Maydell --- include/fpu/softfloat-types.h | 7 ++++ fpu/softfloat.c | 37 +++++++++++++++++-- fpu/softfloat-parts.c.inc | 68 ++++++++++++++++++++++++++++++++++- 3 files changed, 108 insertions(+), 4 deletions(-) diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index c177923e319..b9b4e8e55fc 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -165,6 +165,13 @@ enum { float_flag_invalid_sqrt = 0x0800, /* sqrt(-x) */ float_flag_invalid_cvti = 0x1000, /* non-nan to integer */ float_flag_invalid_snan = 0x2000, /* any operand was snan */ + /* + * An input was denormal and we used it (without flushing it to zero). + * Not set if we do not actually use the denormal input (e.g. + * because some other input was a NaN, or because the operation + * wasn't actually carried out (divide-by-zero; invalid)) + */ + float_flag_input_denormal_used = 0x4000, }; /* diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 03a604c38ec..1b4046e81a9 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -2718,8 +2718,10 @@ static void parts_float_to_ahp(FloatParts64 *a, float_status *s) float16_params_ahp.frac_size + 1); break; - case float_class_normal: case float_class_denormal: + float_raise(float_flag_input_denormal_used, s); + break; + case float_class_normal: case float_class_zero: break; @@ -2733,6 +2735,9 @@ static void parts64_float_to_float(FloatParts64 *a, float_status *s) if (is_nan(a->cls)) { parts_return_nan(a, s); } + if (a->cls == float_class_denormal) { + float_raise(float_flag_input_denormal_used, s); + } } static void parts128_float_to_float(FloatParts128 *a, float_status *s) @@ -2740,6 +2745,9 @@ static void parts128_float_to_float(FloatParts128 *a, float_status *s) if (is_nan(a->cls)) { parts_return_nan(a, s); } + if (a->cls == float_class_denormal) { + float_raise(float_flag_input_denormal_used, s); + } } #define parts_float_to_float(P, S) \ @@ -2752,12 +2760,21 @@ static void parts_float_to_float_narrow(FloatParts64 *a, FloatParts128 *b, a->sign = b->sign; a->exp = b->exp; - if (is_anynorm(a->cls)) { + switch (a->cls) { + case float_class_denormal: + float_raise(float_flag_input_denormal_used, s); + /* fall through */ + case float_class_normal: frac_truncjam(a, b); - } else if (is_nan(a->cls)) { + break; + case float_class_snan: + case float_class_qnan: /* Discard the low bits of the NaN. */ a->frac = b->frac_hi; parts_return_nan(a, s); + break; + default: + break; } } @@ -2772,6 +2789,9 @@ static void parts_float_to_float_widen(FloatParts128 *a, FloatParts64 *b, if (is_nan(a->cls)) { parts_return_nan(a, s); } + if (a->cls == float_class_denormal) { + float_raise(float_flag_input_denormal_used, s); + } } float32 float16_to_float32(float16 a, bool ieee, float_status *s) @@ -4411,6 +4431,11 @@ float32_hs_compare(float32 xa, float32 xb, float_status *s, bool is_quiet) goto soft; } + if (unlikely(float32_is_denormal(ua.s) || float32_is_denormal(ub.s))) { + /* We may need to set the input_denormal_used flag */ + goto soft; + } + float32_input_flush2(&ua.s, &ub.s, s); if (isgreaterequal(ua.h, ub.h)) { if (isgreater(ua.h, ub.h)) { @@ -4462,6 +4487,12 @@ float64_hs_compare(float64 xa, float64 xb, float_status *s, bool is_quiet) } float64_input_flush2(&ua.s, &ub.s, s); + + if (unlikely(float64_is_denormal(ua.s) || float64_is_denormal(ub.s))) { + /* We may need to set the input_denormal_used flag */ + goto soft; + } + if (isgreaterequal(ua.h, ub.h)) { if (isgreater(ua.h, ub.h)) { return float_relation_greater; diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 8621cb87185..0122b35008a 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -433,6 +433,15 @@ static FloatPartsN *partsN(addsub)(FloatPartsN *a, FloatPartsN *b, bool b_sign = b->sign ^ subtract; int ab_mask = float_cmask(a->cls) | float_cmask(b->cls); + /* + * For addition and subtraction, we will consume an + * input denormal unless the other input is a NaN. + */ + if ((ab_mask & (float_cmask_denormal | float_cmask_anynan)) == + float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } + if (a->sign != b_sign) { /* Subtraction */ if (likely(cmask_is_only_normals(ab_mask))) { @@ -516,6 +525,10 @@ static FloatPartsN *partsN(mul)(FloatPartsN *a, FloatPartsN *b, if (likely(cmask_is_only_normals(ab_mask))) { FloatPartsW tmp; + if (ab_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } + frac_mulw(&tmp, a, b); frac_truncjam(a, &tmp); @@ -541,6 +554,10 @@ static FloatPartsN *partsN(mul)(FloatPartsN *a, FloatPartsN *b, } /* Multiply by 0 or Inf */ + if (ab_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } + if (ab_mask & float_cmask_inf) { a->cls = float_class_inf; a->sign = sign; @@ -664,6 +681,16 @@ static FloatPartsN *partsN(muladd_scalbn)(FloatPartsN *a, FloatPartsN *b, if (flags & float_muladd_negate_result) { a->sign ^= 1; } + + /* + * All result types except for "return the default NaN + * because this is an Invalid Operation" go through here; + * this matches the set of cases where we consumed a + * denormal input. + */ + if (abc_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } return a; return_sub_zero: @@ -693,6 +720,9 @@ static FloatPartsN *partsN(div)(FloatPartsN *a, FloatPartsN *b, bool sign = a->sign ^ b->sign; if (likely(cmask_is_only_normals(ab_mask))) { + if (ab_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } a->sign = sign; a->exp -= b->exp + frac_div(a, b); return a; @@ -713,6 +743,10 @@ static FloatPartsN *partsN(div)(FloatPartsN *a, FloatPartsN *b, return parts_pick_nan(a, b, s); } + if ((ab_mask & float_cmask_denormal) && b->cls != float_class_zero) { + float_raise(float_flag_input_denormal_used, s); + } + a->sign = sign; /* Inf / X */ @@ -751,6 +785,9 @@ static FloatPartsN *partsN(modrem)(FloatPartsN *a, FloatPartsN *b, int ab_mask = float_cmask(a->cls) | float_cmask(b->cls); if (likely(cmask_is_only_normals(ab_mask))) { + if (ab_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } frac_modrem(a, b, mod_quot); return a; } @@ -771,6 +808,10 @@ static FloatPartsN *partsN(modrem)(FloatPartsN *a, FloatPartsN *b, return a; } + if (ab_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } + /* N % Inf; 0 % N */ g_assert(b->cls == float_class_inf || a->cls == float_class_zero); return a; @@ -801,6 +842,10 @@ static void partsN(sqrt)(FloatPartsN *a, float_status *status, if (unlikely(a->cls != float_class_normal)) { switch (a->cls) { case float_class_denormal: + if (!a->sign) { + /* -ve denormal will be InvalidOperation */ + float_raise(float_flag_input_denormal_used, status); + } break; case float_class_snan: case float_class_qnan: @@ -1431,6 +1476,9 @@ static FloatPartsN *partsN(minmax)(FloatPartsN *a, FloatPartsN *b, if ((flags & (minmax_isnum | minmax_isnumber)) && !(ab_mask & float_cmask_snan) && (ab_mask & ~float_cmask_qnan)) { + if (ab_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } return is_nan(a->cls) ? b : a; } @@ -1455,6 +1503,10 @@ static FloatPartsN *partsN(minmax)(FloatPartsN *a, FloatPartsN *b, return parts_pick_nan(a, b, s); } + if (ab_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } + a_exp = a->exp; b_exp = b->exp; @@ -1524,6 +1576,10 @@ static FloatRelation partsN(compare)(FloatPartsN *a, FloatPartsN *b, if (likely(cmask_is_only_normals(ab_mask))) { FloatRelation cmp; + if (ab_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } + if (a->sign != b->sign) { goto a_sign; } @@ -1549,6 +1605,10 @@ static FloatRelation partsN(compare)(FloatPartsN *a, FloatPartsN *b, return float_relation_unordered; } + if (ab_mask & float_cmask_denormal) { + float_raise(float_flag_input_denormal_used, s); + } + if (ab_mask & float_cmask_zero) { if (ab_mask == float_cmask_zero) { return float_relation_equal; @@ -1588,8 +1648,10 @@ static void partsN(scalbn)(FloatPartsN *a, int n, float_status *s) case float_class_zero: case float_class_inf: break; - case float_class_normal: case float_class_denormal: + float_raise(float_flag_input_denormal_used, s); + /* fall through */ + case float_class_normal: a->exp += MIN(MAX(n, -0x10000), 0x10000); break; default: @@ -1609,6 +1671,10 @@ static void partsN(log2)(FloatPartsN *a, float_status *s, const FloatFmt *fmt) if (unlikely(a->cls != float_class_normal)) { switch (a->cls) { case float_class_denormal: + if (!a->sign) { + /* -ve denormal will be InvalidOperation */ + float_raise(float_flag_input_denormal_used, s); + } break; case float_class_snan: case float_class_qnan: From patchwork Fri Jan 24 16:27:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859577 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp882327wrq; Fri, 24 Jan 2025 08:33:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV7eLG2wZG7E/ISwVByBcJiiH5ZkhsVdBA9W4fsHOcJ5/UOMi9FYNCjfCqZqPaFAOmCeqkLmA==@linaro.org X-Google-Smtp-Source: AGHT+IFg9v9JYQGBcwaJZQE7p3EFiRJLr20SzWt+ik57k8YeHx5unsNOlQFJfntdWa350s9hHQG3 X-Received: by 2002:a05:6102:162b:b0:4b2:75a3:2267 with SMTP id ada2fe7eead31-4b690bb50f1mr25609875137.10.1737736430419; Fri, 24 Jan 2025 08:33:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736430; cv=none; d=google.com; s=arc-20240605; b=XEoDN1YdlOsO8LKAH8/AqyZ+eFI7uvtQiGj6GaQbdd9HV1dGkTmGTXmKJ4xE1oMFAz jwZBNqLARpWMfGBdD7s0As/1pXjUUKV6rtilCDOjhNlLL0vDNuJW/2py8o4DeDW2gHwb BljmbTtR4f0OLHRE7WTtRPGpDNg8hEI9vA700BqDjRVugMTMC83eEYZlPaR+2wX8W6L9 b+hEOXPcYWlTNrW8M23JfPDSBKCPu+Vcaaatc9hbNWB76fMcs/DSTw6/gqQxNi9rZlEP hOKLTc+F9M1UnKwDkvie/D7C127Gh5Q1uHtufwVTpcSuytfpOjlV91Le4GucD7fJxomj JFVw== 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=gZ6IdqjZTMtT9i1P8z73tgMhGJyOC5w6Tv1r6kxZ+uQ=; fh=u91miQEVg+XzQRaQtdHj0EbAhTPMXVety/ICJpi6XiI=; b=QeVLFkmYL1LXNJebxLEOhbvkEKq7Udf71Btr8Vx0RkHUYOWsJ3rngeR37tQHmVtDDi yPkIBEDLWUzzaUpmDfcv+ICDMWt2rKnIZV8CYYRWSo1zDGGrODerEpjQef7NkbPPYDk1 dfPuDvLfPxLXDOKmoNxrIkevs+MUSN0hJ8ylaXSQ8hfZMO+9vzDC2kt9oOWsz9X3C/Mk G4tWjhm0GBSgCWzAHzHiYMAk9Io4fcqZyFoTxvg9bSsgaA5KQkRqq68YmA0aCbhrdZFG b4Cpob+5gwYhkufGvlHB6jqx2Wgf8585c4HAyEZcymBeGYCrwTGF6QNZbPwGE8z9uAgZ vQgg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XmCuZC7w; 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 ada2fe7eead31-4b7099aa4cbsi1020610137.363.2025.01.24.08.33.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:33:50 -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=XmCuZC7w; 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 1tbMYo-0004zB-TA; Fri, 24 Jan 2025 11:29:34 -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 1tbMYS-0003xo-M9 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:15 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYP-0005Wx-JG for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:12 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-437a92d7b96so23500885e9.2 for ; Fri, 24 Jan 2025 08:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736148; x=1738340948; 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=gZ6IdqjZTMtT9i1P8z73tgMhGJyOC5w6Tv1r6kxZ+uQ=; b=XmCuZC7w9hCnKomZVzIqjh3MoIYP5SCBAD3XzbVP+/IE1MatDWwWitSQYqJKjoPb+c LoqcgRh7OnD1szYCP8kxR80XO1WKJgT0APFilb5X55BO42YIWF4DXTP0ZlKCPP2VMKdC UZ+/GZRLjdhh71tsFfO51QZN33NOV567rEcm/5cqzo8fiEGA3pavAGzEq0M7zl/mfJxZ zJ6T0oCXJQOhN3JE3lwC51886MFpIvvL8mRmTMK6hRjrJgIRMt2DQli8EghrJnH4/d8x g9igOj/O6ZEFqIO9YnmQcCgfXClTYEkR7NngjEv4S62nW2GAAqU0YNYaLprfNFhE2bq8 ebcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736148; x=1738340948; 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=gZ6IdqjZTMtT9i1P8z73tgMhGJyOC5w6Tv1r6kxZ+uQ=; b=K8IpNNyXKsSp7P59g13KDop5dJCKLPTi0mZ9srHrpVmDbtfYGLj9aUcTBM9e57CVJz DCIfgjLypUrJ6ZuccspGtiNlLqYVN1QRzDsXYCCOpk0Gm/XIxhn8cWE6ua4SQcWjxZCS CIhcjoHEK8LNl61rYddXBbq2dqIzibaoAthTV/EV1c6S/PQlMJR+aqhqI7ulRppKX9fJ a8Fu+Y9naKjMOE3nAJyw6oyHpmHxLVpq0V9DNU4hQFwyvLmKrCdwo1jcmloBvHRQfrAX ymwt7u47L8+sEpmA+kWTq4nVnkDoT8wL690sh+KcLyrmVGpYKXbo6/rCmHM7IKiKgh4h oVmg== X-Forwarded-Encrypted: i=1; AJvYcCWXW/SCFOhI12a30BVmfND+gQKbe0ChaXBPascPVE9gr46mu0ZzTEc4zB/LhS5Pz9ZDdc4gsFeeRJpd@nongnu.org X-Gm-Message-State: AOJu0Yz+0EzaFPG/7I1AtTe+NKm0EDqaVTo5o12OwjQGixRMT01kkgtz HbG819er9/5UQDLEOdHqXgqkemRh+ztPWI7roqS67fHDHppv6lWBExFm8CvWOSoBJTz0Uxz3pBT D X-Gm-Gg: ASbGncuY7TPkEVYvGhXwiLJIzfIupJFP79e5UuP+hHlrip7/DTDiVTaoAjod+A1Zs8z +OpbT2TAPOWmuCbUBl9wd0H2vuvKvX1hJRkzNGG9wDU+jl9/ILpbZDG154Buu2q5BNnzWB+tOBV adegbwqGOZcKeqJ/4C09j3uINVa6FuraSOL9K6PT4rXNMU8+ol8tzHlUVBDv304cv0UZx5nTxCk 4fJFa0xmPc00rkMht2MTmPockrOxW029smjcdiGqocHfYViRTvlgdDspL2J8ZLvzPrf1/iQCPAD LcnriAHGXeg= X-Received: by 2002:a05:600c:4510:b0:434:a30b:5455 with SMTP id 5b1f17b1804b1-4389144f671mr268549065e9.27.1737736148060; Fri, 24 Jan 2025 08:29:08 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:07 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 24/76] fpu: allow flushing of output denormals to be after rounding Date: Fri, 24 Jan 2025 16:27:44 +0000 Message-Id: <20250124162836.2332150-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Currently we handle flushing of output denormals in uncanon_normal always before we deal with rounding. This works for architectures that detect tininess before rounding, but is usually not the right place when the architecture detects tininess after rounding. For example, for x86 the SDM states that the MXCSR FTZ control bit causes outputs to be flushed to zero "when it detects a floating-point underflow condition". This means that we mustn't flush to zero if the input is such that after rounding it is no longer tiny. At least one of our guest architectures does underflow detection after rounding but flushing of denormals before rounding (MIPS MSA); this means we need to have a config knob for this that is separate from our existing tininess_before_rounding setting. Add an ftz_detection flag. For consistency with tininess_before_rounding, we make it default to "detect ftz after rounding"; this means that we need to explicitly set the flag to "detect ftz before rounding" on every existing architecture that sets flush_to_zero, so that this commit has no behaviour change. (This means more code change here but for the long term a less confusing API.) For several architectures the current behaviour is either definitely or possibly wrong; annotate those with TODO comments. These architectures are definitely wrong (and should detect ftz after rounding): * x86 * Alpha For these architectures the spec is unclear: * MIPS (for non-MSA) * RX * SH4 PA-RISC makes ftz detection IMPDEF, but we aren't setting the "tininess before rounding" setting that we ought to. Signed-off-by: Peter Maydell --- include/fpu/softfloat-helpers.h | 11 +++++++++++ include/fpu/softfloat-types.h | 18 ++++++++++++++++++ target/mips/fpu_helper.h | 6 ++++++ target/alpha/cpu.c | 7 +++++++ target/arm/cpu.c | 1 + target/hppa/fpu_helper.c | 11 +++++++++++ target/i386/tcg/fpu_helper.c | 8 ++++++++ target/mips/msa.c | 9 +++++++++ target/ppc/cpu_init.c | 3 +++ target/rx/cpu.c | 8 ++++++++ target/sh4/cpu.c | 8 ++++++++ target/tricore/helper.c | 1 + tests/fp/fp-bench.c | 1 + fpu/softfloat-parts.c.inc | 21 +++++++++++++++------ 14 files changed, 107 insertions(+), 6 deletions(-) diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h index 4cb30a48220..a4c1a4fa3b8 100644 --- a/include/fpu/softfloat-helpers.h +++ b/include/fpu/softfloat-helpers.h @@ -109,6 +109,12 @@ static inline void set_flush_inputs_to_zero(bool val, float_status *status) status->flush_inputs_to_zero = val; } +static inline void set_float_detect_ftz(FloatFTZDetection d, + float_status *status) +{ + status->ftz_detection = d; +} + static inline void set_default_nan_mode(bool val, float_status *status) { status->default_nan_mode = val; @@ -183,4 +189,9 @@ static inline bool get_default_nan_mode(const float_status *status) return status->default_nan_mode; } +static inline FloatFTZDetection get_float_detect_ftz(const float_status *status) +{ + return status->ftz_detection; +} + #endif /* SOFTFLOAT_HELPERS_H */ diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index b9b4e8e55fc..77cfed9d52e 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -304,6 +304,22 @@ typedef enum __attribute__((__packed__)) { float_infzeronan_suppress_invalid = (1 << 2), } FloatInfZeroNaNRule; +/* + * When flush_to_zero is set, should we detect denormal results to + * be flushed before or after rounding? For most architectures this + * should be set to match the tininess_before_rounding setting, + * but a few architectures, e.g. MIPS MSA, detect FTZ before + * rounding but tininess after rounding. + * + * This enum is arranged so that the default if the target doesn't + * configure it matches the default for tininess_before_rounding + * (i.e. "after rounding"). + */ +typedef enum __attribute__((__packed__)) { + detect_ftz_after_rounding = 0, + detect_ftz_before_rounding = 1, +} FloatFTZDetection; + /* * Floating Point Status. Individual architectures may maintain * several versions of float_status for different functions. The @@ -321,6 +337,8 @@ typedef struct float_status { bool tininess_before_rounding; /* should denormalised results go to zero and set output_denormal_flushed? */ bool flush_to_zero; + /* do we detect and flush denormal results before or after rounding? */ + FloatFTZDetection ftz_detection; /* should denormalised inputs go to zero and set input_denormal_flushed? */ bool flush_inputs_to_zero; bool default_nan_mode; diff --git a/target/mips/fpu_helper.h b/target/mips/fpu_helper.h index 6ad1e466cfd..042f7e02c03 100644 --- a/target/mips/fpu_helper.h +++ b/target/mips/fpu_helper.h @@ -84,6 +84,12 @@ static inline void fp_reset(CPUMIPSState *env) */ set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->active_fpu.fp_status); + /* + * TODO: the spec does't say clearly whether FTZ happens before + * or after rounding for normal FPU operations. + */ + set_float_detect_ftz(detect_ftz_before_rounding, + &env->active_fpu.fp_status); } /* MSA */ diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index e1b898e5755..d4bffd58834 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -202,6 +202,13 @@ static void alpha_cpu_initfn(Object *obj) set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status); /* Default NaN: sign bit clear, msb frac bit set */ set_float_default_nan_pattern(0b01000000, &env->fp_status); + /* + * TODO: this is incorrect. The Alpha Architecture Handbook version 4 + * section 4.7.7.11 says that we flush to zero for underflow cases, so + * this should be detect_ftz_after_rounding to match the + * tininess_after_rounding (which is specified in section 4.7.5). + */ + set_float_detect_ftz(detect_ftz_before_rounding, &env->fp_status); #if defined(CONFIG_USER_ONLY) env->flags = ENV_FLAG_PS_USER | ENV_FLAG_FEN; cpu_alpha_store_fpcr(env, (uint64_t)(FPCR_INVD | FPCR_DZED | FPCR_OVFD diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 7a83b9ee34f..0b4cd872d27 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -185,6 +185,7 @@ void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, static void arm_set_default_fp_behaviours(float_status *s) { set_float_detect_tininess(float_tininess_before_rounding, s); + set_float_detect_ftz(detect_ftz_before_rounding, s); set_float_2nan_prop_rule(float_2nan_prop_s_ab, s); set_float_3nan_prop_rule(float_3nan_prop_s_cab, s); set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, s); diff --git a/target/hppa/fpu_helper.c b/target/hppa/fpu_helper.c index 239c027ec52..a0f01e3e734 100644 --- a/target/hppa/fpu_helper.c +++ b/target/hppa/fpu_helper.c @@ -67,6 +67,17 @@ void HELPER(loaded_fr0)(CPUHPPAState *env) set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status); /* Default NaN: sign bit clear, msb-1 frac bit set */ set_float_default_nan_pattern(0b00100000, &env->fp_status); + /* + * "PA-RISC 2.0 Architecture" says it is IMPDEF whether the flushing + * enabled by FPSR.D happens before or after rounding. We pick "before" + * for consistency with tininess detection. + */ + set_float_detect_ftz(detect_ftz_before_rounding, &env->fp_status); + /* + * TODO: "PA-RISC 2.0 Architecture" chapter 10 says that we should + * detect tininess before rounding, but we don't set that here so we + * get the default tininess after rounding. + */ } void cpu_hppa_loaded_fr0(CPUHPPAState *env) diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index de6d0b252ec..9bf23fdd0f6 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -188,6 +188,14 @@ void cpu_init_fp_statuses(CPUX86State *env) set_float_default_nan_pattern(0b11000000, &env->fp_status); set_float_default_nan_pattern(0b11000000, &env->mmx_status); set_float_default_nan_pattern(0b11000000, &env->sse_status); + /* + * TODO: x86 does flush-to-zero detection after rounding (the SDM + * section 10.2.3.3 on the FTZ bit of MXCSR says that we flush + * when we detect underflow, which x86 does after rounding). + */ + set_float_detect_ftz(detect_ftz_before_rounding, &env->fp_status); + set_float_detect_ftz(detect_ftz_before_rounding, &env->mmx_status); + set_float_detect_ftz(detect_ftz_before_rounding, &env->sse_status); } static inline uint8_t save_exception_flags(CPUX86State *env) diff --git a/target/mips/msa.c b/target/mips/msa.c index fc77bfc7b9a..2899577e8e5 100644 --- a/target/mips/msa.c +++ b/target/mips/msa.c @@ -48,6 +48,15 @@ void msa_reset(CPUMIPSState *env) /* tininess detected after rounding.*/ set_float_detect_tininess(float_tininess_after_rounding, &env->active_tc.msa_fp_status); + /* + * MSACSR.FS detects tiny results to flush to zero before rounding + * (per "MIPS Architecture for Programmers Volume IV-j: The MIPS64 SIMD + * Architecture Module, Revision 1.1" section 3.5.4), even though it + * detects tininess after rounding for underflow purposes (section 3.4.2 + * table 3.3). + */ + set_float_detect_ftz(detect_ftz_before_rounding, + &env->active_tc.msa_fp_status); /* * According to MIPS specifications, if one of the two operands is diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index c05c2dc42dc..8fa41307370 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7262,6 +7262,9 @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type) /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, &env->fp_status); + /* Similarly for flush-to-zero */ + set_float_detect_ftz(detect_ftz_before_rounding, &env->fp_status); + /* * PowerPC propagation rules: * 1. A if it sNaN or qNaN diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 8c50c7a1bc8..a18c3d81e38 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -103,6 +103,14 @@ static void rx_cpu_reset_hold(Object *obj, ResetType type) set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status); /* Default NaN value: sign bit clear, set frac msb */ set_float_default_nan_pattern(0b01000000, &env->fp_status); + /* + * TODO: "RX Family RXv1 Instruction Set Architecture" is not 100% clear + * on whether flush-to-zero should happen before or after rounding, but + * section 1.3.2 says that it happens when underflow is detected, and + * implies that underflow is detected after rounding. So this may not + * be the correct setting. + */ + set_float_detect_ftz(detect_ftz_before_rounding, &env->fp_status); } static ObjectClass *rx_cpu_class_by_name(const char *cpu_model) diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 24a22724c61..cade4463119 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -130,6 +130,14 @@ static void superh_cpu_reset_hold(Object *obj, ResetType type) set_default_nan_mode(1, &env->fp_status); /* sign bit clear, set all frac bits other than msb */ set_float_default_nan_pattern(0b00111111, &env->fp_status); + /* + * TODO: "SH-4 CPU Core Architecture ADCS 7182230F" doesn't say whether + * it detects tininess before or after rounding. Section 6.4 is clear + * that flush-to-zero happens when the result underflows, though, so + * either this should be "detect ftz after rounding" or else we should + * be setting "detect tininess before rounding". + */ + set_float_detect_ftz(detect_ftz_before_rounding, &env->fp_status); } static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) diff --git a/target/tricore/helper.c b/target/tricore/helper.c index e8b0ec51611..df4a2b5b9d8 100644 --- a/target/tricore/helper.c +++ b/target/tricore/helper.c @@ -116,6 +116,7 @@ void fpu_set_state(CPUTriCoreState *env) set_flush_inputs_to_zero(1, &env->fp_status); set_flush_to_zero(1, &env->fp_status); set_float_detect_tininess(float_tininess_before_rounding, &env->fp_status); + set_float_detect_ftz(detect_ftz_before_rounding, &env->fp_status); set_default_nan_mode(1, &env->fp_status); /* Default NaN pattern: sign bit clear, frac msb set */ set_float_default_nan_pattern(0b01000000, &env->fp_status); diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c index eacb39b99cb..9e3694bc4e1 100644 --- a/tests/fp/fp-bench.c +++ b/tests/fp/fp-bench.c @@ -496,6 +496,7 @@ static void run_bench(void) set_float_3nan_prop_rule(float_3nan_prop_s_cab, &soft_status); set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, &soft_status); set_float_default_nan_pattern(0b01000000, &soft_status); + set_float_detect_ftz(detect_ftz_before_rounding, &soft_status); f = bench_funcs[operation][precision]; g_assert(f); diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 0122b35008a..324e67de259 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -334,7 +334,8 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s, p->frac_lo &= ~round_mask; } frac_shr(p, frac_shift); - } else if (s->flush_to_zero) { + } else if (s->flush_to_zero && + s->ftz_detection == detect_ftz_before_rounding) { flags |= float_flag_output_denormal_flushed; p->cls = float_class_zero; exp = 0; @@ -381,11 +382,19 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s, exp = (p->frac_hi & DECOMPOSED_IMPLICIT_BIT) && !fmt->m68k_denormal; frac_shr(p, frac_shift); - if (is_tiny && (flags & float_flag_inexact)) { - flags |= float_flag_underflow; - } - if (exp == 0 && frac_eqz(p)) { - p->cls = float_class_zero; + if (is_tiny) { + if (s->flush_to_zero) { + assert(s->ftz_detection == detect_ftz_after_rounding); + flags |= float_flag_output_denormal_flushed; + p->cls = float_class_zero; + exp = 0; + frac_clear(p); + } else if (flags & float_flag_inexact) { + flags |= float_flag_underflow; + } + if (exp == 0 && frac_eqz(p)) { + p->cls = float_class_zero; + } } } p->exp = exp; From patchwork Fri Jan 24 16:27:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859566 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881230wrq; Fri, 24 Jan 2025 08:31:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXKVWFS5iD22PVwMYeAmkLdZXEz6pnd/vp196q7i5qAQhDAHfPKtXEfWBESOy+LNwM3TN/Ayw==@linaro.org X-Google-Smtp-Source: AGHT+IGJJ04mNm1A8mtF9Hl4KJ30SiwAPVTGJhcMMRvZyqgpE0eEGhnx4jkWLFZfIYOswYZnjGCz X-Received: by 2002:a17:907:2ce3:b0:aa6:8d51:8fdb with SMTP id a640c23a62f3a-ab38b240a67mr2632867266b.19.1737736314978; Fri, 24 Jan 2025 08:31:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736314; cv=none; d=google.com; s=arc-20240605; b=kyftDSSR8f4OG8p1KzP9lOIS7r++LZpZNCWixr7FpJd+v5MhbUZzhtRa5xzzPnlX4L Fa+FX8r11oAPiuJdQkue/tZjfwwuWQnaj5Fy1Vh2qwC0C7DxI2gng5RksTQ0Qxs/4/Hp d02TkPvIXzkaaXhecrx0bDhUcswMPzfVrBqbcQr/fvMWaFS4fU8KKSrDBrt+YCqhwIj3 ucZetx7zYh9EmBdkvNGdNmuJGTTAd1PSIsC1pYX2aqICAOGMNzeSwUmue3nTYcUQOoOt XB0916S1eCn8gdsShMZ7RCvyWUXR5Qlpm4NswsBUDyAaKFkR3SdHbkDC9xeQQSPLHPb0 AQcQ== 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=mQ+MesFMM2ApsJ2GrGgUSXkLejzsErzMzyZWYfNz8WQ=; fh=WYlKCJdHe4t9AdRYfP+8+6nUXZme7Y3FkMr1IxHjVFA=; b=YNO5aGLeSCg3CRyq5xQFaAt5EOIwQLtHc5dMDb7a4PKaUYLkkHGEdBP94JX0wp/Jsb TMJARSUtIQDTOO2dvAdCey89vRrk+50txoCrEp9dvnk9xzPr/S73a1QqeGFfH1Z20ODi 4QsoNaE1lNLHnOIImT+Rh4NK4334pu7m1p1dNQ/JGQgK8DhBXkU7ngdjDOYyelLkZKOf C/Gd5FaPBU24mKBVVU088hGDoxKki1bMRPDNiz+VGMP9oWxDiM4RxHyjucy3UdC29CRK EpIdmPId4j7VlsvSGLSiBHA7Xi4iK81nrGAs+GvwjoKvGBKqH39Id0Prxh6V8FfQtbom kErw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OltzrKIy; 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 a640c23a62f3a-ab67aae7ee1si109958766b.349.2025.01.24.08.31.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:31:54 -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=OltzrKIy; 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 1tbMYl-0004mR-LE; Fri, 24 Jan 2025 11:29:31 -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 1tbMYU-0003yT-7q for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:15 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYS-0005XG-A8 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:13 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4361815b96cso15918845e9.1 for ; Fri, 24 Jan 2025 08:29:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736149; x=1738340949; 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=mQ+MesFMM2ApsJ2GrGgUSXkLejzsErzMzyZWYfNz8WQ=; b=OltzrKIyCxf99ZZdS+PRnOa40NZOEtscfmGn33eoW6CluYEGHE1N9EHZfaqUUfpWCR VW0J6haQFl+duXNLFfGiz94vxMbCFeqmYPhnFf9WQgVA8wKaPE//RDvHcRmLBCdfqv1O 8oKHZbSCkpoemH3PQMOpZkeYri8aIJz9g6NGvcu16NVRhX6qpQOoNejAx9ZGjx6lWgyU 7vg5W0YBTRBjYQuE0wzftR9jrK4L6nYXIqU0WgEhzVD0br/nA0nYQCFyL5UCJLn6v36R vRO+P3+hG1Omn6AONAc+P9SeihuIER7H0ZI0FUhjiP4znRW2U1bQ/HP2IFK0TktG3pZg mRRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736149; x=1738340949; 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=mQ+MesFMM2ApsJ2GrGgUSXkLejzsErzMzyZWYfNz8WQ=; b=J04oKE9LxFtdQHeAKMQNnqo6KfFD/x9Q/rzpnVFkkiaDURwS0UgDUKvKayqbQRKG7t rbeqzt8ih2/d7ReUhDnTiqOX6wKqDW2sejBAWyGGlxhisoINkjl67eXWoubZngqOhUXz eoCtCqjWITr6pSVKLQpV5+X8whvqacCkkdvnupy3Oqa2Nbh3N8cUtfh+LPZtPvYubf+7 aarx1aJ6DyfSAZyyuYPEUWVIIXhxYPIYA0NUTib9/i8Wj+4c9Wj/inG8Yi8aZXIyo7of jPHrf/OJ0jtFpFbDn49mgDUxgfIswid5Qn1HzzowpfjtsBa1BORwdDK+uyKjMo01yZ2N kgyg== X-Forwarded-Encrypted: i=1; AJvYcCUpe7CYUUd4IlFoRdDnBv0dHXTQMWG1T3B70YkPBctucA6RpGwW1wcbzwPLvYuhTvp8Qmas2XBPUtzO@nongnu.org X-Gm-Message-State: AOJu0YyAgIUNTS+LAzl8PBf8AOJsvfPdp0G4AhJYP4ew7aw83bU3xQNb DL2n2JxIkyQ4Gns9M94IgKw0rA8y45sfqvY0Vrqg85ZvoE6KIheDIa+1cg33JophTE0NFm+bFeE M X-Gm-Gg: ASbGnctpnKSQ0f2i6ofVR33gP/qQD8dyLMvxICuhhaPf892cAw/xfrMtkLvWVm5ACK+ scNB5cHhg4OOKSomQXzM8+Aa82FnF9XmmSic/WwYpMUjHRd8RrdzDaiNLaLP7mSB00+POuszrJr VYBt96exK6pYcTcZaHBQILJ4AqsFPfIpaNpa+TQXlIqkEAVpIFOYi4ii3574n2Vqnxw/+gg9gnm oQRHnF/6ZTAdgmPRQWfgp4dP4EPRlsJkf7Si8JPtMd96IhoLnAHRNP8O3yCl9P2NYAO4+o+CVMs TnDx+V51Mos= X-Received: by 2002:a05:600c:1e02:b0:438:ad4d:cf09 with SMTP id 5b1f17b1804b1-438ad4dd134mr157996455e9.9.1737736149294; Fri, 24 Jan 2025 08:29:09 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:08 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 25/76] target/arm: Remove redundant advsimd float16 helpers Date: Fri, 24 Jan 2025 16:27:45 +0000 Message-Id: <20250124162836.2332150-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 advsimd_addh etc helpers defined in helper-a64.c are identical to the vfp_addh etc helpers defined in helper-vfp.c: both take two float16 inputs (in a uint32_t type) plus a float_status* and are simple wrappers around the softfloat float16_* functions. (The duplication seems to be a historical accident: we added the advsimd helpers in 2018 as part of the A64 implementation, and at that time there was no f16 emulation in A32. Then later we added the A32 f16 handling by extending the existing VFP helper macros to generate f16 versions as well as f32 and f64, and didn't realise we could clean things up.) Remove the now-unnecessary advsimd helpers and make the places that generated calls to them use the vfp helpers instead. Many of the helper functions were already unused. (The remaining advsimd_ helpers are those which don't have vfp versions.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/helper-a64.h | 8 -------- target/arm/tcg/helper-a64.c | 9 --------- target/arm/tcg/translate-a64.c | 16 ++++++++-------- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h index 0c120bf3883..bac12fbe55b 100644 --- a/target/arm/tcg/helper-a64.h +++ b/target/arm/tcg/helper-a64.h @@ -47,14 +47,6 @@ DEF_HELPER_FLAGS_2(frecpx_f16, TCG_CALL_NO_RWG, f16, f16, fpst) DEF_HELPER_FLAGS_2(fcvtx_f64_to_f32, TCG_CALL_NO_RWG, f32, f64, fpst) DEF_HELPER_FLAGS_3(crc32_64, TCG_CALL_NO_RWG_SE, i64, i64, i64, i32) DEF_HELPER_FLAGS_3(crc32c_64, TCG_CALL_NO_RWG_SE, i64, i64, i64, i32) -DEF_HELPER_FLAGS_3(advsimd_maxh, TCG_CALL_NO_RWG, f16, f16, f16, fpst) -DEF_HELPER_FLAGS_3(advsimd_minh, TCG_CALL_NO_RWG, f16, f16, f16, fpst) -DEF_HELPER_FLAGS_3(advsimd_maxnumh, TCG_CALL_NO_RWG, f16, f16, f16, fpst) -DEF_HELPER_FLAGS_3(advsimd_minnumh, TCG_CALL_NO_RWG, f16, f16, f16, fpst) -DEF_HELPER_3(advsimd_addh, f16, f16, f16, fpst) -DEF_HELPER_3(advsimd_subh, f16, f16, f16, fpst) -DEF_HELPER_3(advsimd_mulh, f16, f16, f16, fpst) -DEF_HELPER_3(advsimd_divh, f16, f16, f16, fpst) DEF_HELPER_3(advsimd_ceq_f16, i32, f16, f16, fpst) DEF_HELPER_3(advsimd_cge_f16, i32, f16, f16, fpst) DEF_HELPER_3(advsimd_cgt_f16, i32, f16, f16, fpst) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 3b226daee78..05036089dd7 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -439,15 +439,6 @@ uint32_t ADVSIMD_HELPER(name, h)(uint32_t a, uint32_t b, float_status *fpst) \ return float16_ ## name(a, b, fpst); \ } -ADVSIMD_HALFOP(add) -ADVSIMD_HALFOP(sub) -ADVSIMD_HALFOP(mul) -ADVSIMD_HALFOP(div) -ADVSIMD_HALFOP(min) -ADVSIMD_HALFOP(max) -ADVSIMD_HALFOP(minnum) -ADVSIMD_HALFOP(maxnum) - #define ADVSIMD_TWOHALFOP(name) \ uint32_t ADVSIMD_HELPER(name, 2h)(uint32_t two_a, uint32_t two_b, \ float_status *fpst) \ diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index b713a5f6025..74766a0bc47 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5101,28 +5101,28 @@ static const FPScalar f_scalar_fmul = { TRANS(FMUL_s, do_fp3_scalar, a, &f_scalar_fmul) static const FPScalar f_scalar_fmax = { - gen_helper_advsimd_maxh, + gen_helper_vfp_maxh, gen_helper_vfp_maxs, gen_helper_vfp_maxd, }; TRANS(FMAX_s, do_fp3_scalar, a, &f_scalar_fmax) static const FPScalar f_scalar_fmin = { - gen_helper_advsimd_minh, + gen_helper_vfp_minh, gen_helper_vfp_mins, gen_helper_vfp_mind, }; TRANS(FMIN_s, do_fp3_scalar, a, &f_scalar_fmin) static const FPScalar f_scalar_fmaxnm = { - gen_helper_advsimd_maxnumh, + gen_helper_vfp_maxnumh, gen_helper_vfp_maxnums, gen_helper_vfp_maxnumd, }; TRANS(FMAXNM_s, do_fp3_scalar, a, &f_scalar_fmaxnm) static const FPScalar f_scalar_fminnm = { - gen_helper_advsimd_minnumh, + gen_helper_vfp_minnumh, gen_helper_vfp_minnums, gen_helper_vfp_minnumd, }; @@ -6902,10 +6902,10 @@ static bool do_fp_reduction(DisasContext *s, arg_qrr_e *a, return true; } -TRANS_FEAT(FMAXNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_maxnumh) -TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_minnumh) -TRANS_FEAT(FMAXV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_maxh) -TRANS_FEAT(FMINV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_minh) +TRANS_FEAT(FMAXNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_maxnumh) +TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_minnumh) +TRANS_FEAT(FMAXV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_maxh) +TRANS_FEAT(FMINV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_minh) TRANS(FMAXNMV_s, do_fp_reduction, a, gen_helper_vfp_maxnums) TRANS(FMINNMV_s, do_fp_reduction, a, gen_helper_vfp_minnums) From patchwork Fri Jan 24 16:27:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859586 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp883655wrq; Fri, 24 Jan 2025 08:36:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXTG4bj6i2cKvf9VT/U+u1LbXfsxfqndT2vcs5+J86GNiCdjZmZzuj6NjN9NCsIxM1FNi7EGw==@linaro.org X-Google-Smtp-Source: AGHT+IE1AyzobMHkQnuzRddk70s5st9gFS3bQw5KRgykskoc+4epSuounsluDRHaixcJHnoaQlz/ X-Received: by 2002:a05:620a:2b47:b0:7b6:f595:7550 with SMTP id af79cd13be357-7be6325fba1mr6496216585a.36.1737736596409; Fri, 24 Jan 2025 08:36:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736596; cv=none; d=google.com; s=arc-20240605; b=dxdmuAsL5bo/vH6Bmd2nJb0lypzDI6CJCxIU8AqT0BgGJOQSJRKrKgLyEb5Hfs+1jz aQogVanGMJB6xeP9xk7kNczUpnpZ9c/BN+I73LVvCkubZYS3V7YaahegEm/uqEc7FwZO ppNoA6RHZ0ryB7wHqy7Y1KRd86Ue5y0OYiixFUww+grJePk1m9YPypet114Au3QryEbz W4r/3XGJJp6QYbaZ3yLkDdnMv1gy4O7o2OboCrpexB8ntv/hPcH/K/kkJIIv719RlDkw ldyaav6hGDmCQaqoLZDCe4eP7hPtMtUFKF2bE3WfRgQn/sT1MWHzXSENVQKgB+meaCVU M4Ig== 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=e2iz1ymTg5b9+bCfwCSDZDBGdLz/53i8ds01lMabmII=; fh=jwjdW24xtcOChs4DVPZYTFKh+xCcFVZ9+1eIKxxhnBQ=; b=BR4SBneg6cyZmaGziZ+wV9gJLW9xnSZXA3ACcZGi/PQeJitUtSJE2B4MPi0N35FfMq Qk/n9ED5CO2VyEfBmYzwSDU27aY07nR+J5rH6UsZcywTumSwWaCgDGYmiirhDwpKIu7i DtKtDo7MQVuz0t9EonEEP8P5r+P6/CsYQtnIgtVwZkTvwxdnM7dm8a0yBXXptGgtZ2KT l2u1o3K5sW0+KLPgMIot7BajMjaBaHwgfacJElD0EU5p2NqLvt4eDCH6TWMP3aoMWTpI GtjntxBYcwjiyRsKJU8Ir/H8NFb93+oxcr7Afd+nseDHCHaSgbsR9B+yq9+WM0zyY0Ag YyVw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lBJZDrvK; 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-7be9aeee9acsi256453485a.456.2025.01.24.08.36.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:36:36 -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=lBJZDrvK; 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 1tbMbu-0002nL-7D; Fri, 24 Jan 2025 11:32:46 -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 1tbMYU-0003yV-8c for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:15 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYS-0005Xo-Ey for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:13 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-43618283dedso23825175e9.3 for ; Fri, 24 Jan 2025 08:29:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736151; x=1738340951; 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=e2iz1ymTg5b9+bCfwCSDZDBGdLz/53i8ds01lMabmII=; b=lBJZDrvKFa+N/IdQgh8q9hVmaG6HyyJemkgeBvRDroCKMqvCWfIFhCszggnnLa/s4I 1n0hVzYKvmwvMaRHiifP5ISMQ55/WtKJyF9NYhtODDUxNSxIBORlfdGgvzYrZtC7QAF8 SFLAWaGC7rbNvsjMXBz1maAInrX5vl5f/yUDolR3P9uKDsnDsJypHp6TM2IKSWep/j4o wuNWj7CPoNi9GioyaF8wlMJy0JQBNwa/OwTk5QPwj08A6qXi8gGTd8la1DGX8iK/xciZ AO5Kuy+fuhM5sHeYTPeHCJPgeWfppAI6hxEGHGZdU/25ewvpPudmu01m5BPGVueoId4Y 7v5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736151; x=1738340951; 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=e2iz1ymTg5b9+bCfwCSDZDBGdLz/53i8ds01lMabmII=; b=Qet6dHDFBna6s94lSUeGHvz7LgFVem7a78OQ/SQu3ZQ4+wS8ggmkMoqKmhtsfJM72j I9urvCp7BEzUDYPIvVzAYk2a9dZQaRbNQHul4pSd72u/zhSfco6DF5CeHma7Ig7HXZo4 SN89jxBkSINojVPORzX4y9w6r9wu1zKgif3EjAiBnzl9aBZLGrjPNWKVNodTyj+UwkD0 ummBcaSOhWsppbmoBFTT6GL5yzyNx9UgEXgbmUZVskNAtu9AXdF8Ko9+W3DXsdJOVkd4 cTXw6uI9SiHjrnrONndnNe1zhCbre4U/0g/tgPINc2xmNkneD9kztF418sp94ufdNDH/ u5Tg== X-Forwarded-Encrypted: i=1; AJvYcCVyhW66M7/etitWPCgRToVxay8yyBUpNnk0AAxxTjgpfLMYJfU+l3nJbWgnJA2n21zIE1RMKakkJjDz@nongnu.org X-Gm-Message-State: AOJu0YzKBGYjG0zjNEfuIjvQNBsmxS0O+t9+39i4DJL3Qu9vTYHRwxJ+ UOe9tophzsRYZMUtmgHAj5/uBmLoxUULxFDJcCcOJWrNuAWRW648DFCRekeP/D0= X-Gm-Gg: ASbGncuL9qDdiWm680byFrp1w/C/erYEgBn0gWBCuACXl6nzR8jMM7kFCatAxW1qNbT vPkdG1t+Pftxx8iB815t/0AADoF3INoxLo81BBbg4X0s8FzxUMQf1ppnTgOH6OnFGlCAUS2LgAJ 6IWdLlSVj0TVo2uIdy1tym0oqWpvUTHFhX22iELen82BtNfu3KrOGNGHllKFg+22/1Tpw4Bmdiu GPKlmoVBq9VswcuWyFwuNNkChKSvGg9e/NgeuupCV49hECqIhDpCX38Vqyu3D9Fayzi15tKau/a FWrJaohhVhU= X-Received: by 2002:a05:600c:468e:b0:436:5165:f1ec with SMTP id 5b1f17b1804b1-4389143145bmr300790185e9.30.1737736151068; Fri, 24 Jan 2025 08:29:11 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:10 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 26/76] target/arm: Use FPST_FPCR_F16_A64 for halfprec-to-other conversions Date: Fri, 24 Jan 2025 16:27:46 +0000 Message-Id: <20250124162836.2332150-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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, T_SCC_BODY_TEXT_LINE=-0.01 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 We should be using the F16-specific float_status for conversions from half-precision, because halfprec inputs never set Input Denormal. Without FEAT_AHP, using the wrong fpst here had no effect, because the only difference between the F16_A64 and A64 fpst is its handling of flush-to-zero on input and output, and the helper functions vfp_fcvt_f16_to_* and vfp_fcvt_*_to_f16 all explicitly squash the relevant flushing flags, and flush_inputs_to_zero was the only way that IDC could be set. With FEAT_AHP, the FPCR.AH=1 behaviour sets IDC for input_denormal_used, which we will only ignore in vfp_get_fpsr_from_host() for the F16_A64 fpst; so it matters that we use that one for f16 inputs (and the normal one for single/double to f16 conversions). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 9 ++++++--- target/arm/tcg/translate-sve.c | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 74766a0bc47..a47fdcd2e48 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8568,7 +8568,7 @@ static bool trans_FCVT_s_sh(DisasContext *s, arg_rr *a) if (fp_access_check(s)) { TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn); TCGv_i32 tcg_rd = tcg_temp_new_i32(); - TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR_A64); + TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR_F16_A64); TCGv_i32 tcg_ahp = get_ahp_flag(); gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); @@ -8582,7 +8582,7 @@ static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a) if (fp_access_check(s)) { TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn); TCGv_i64 tcg_rd = tcg_temp_new_i64(); - TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR_A64); + TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR_F16_A64); TCGv_i32 tcg_ahp = get_ahp_flag(); gen_helper_vfp_fcvt_f16_to_f64(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); @@ -9511,13 +9511,14 @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a) return true; } - fpst = fpstatus_ptr(FPST_FPCR_A64); if (a->esz == MO_64) { /* 32 -> 64 bit fp conversion */ TCGv_i64 tcg_res[2]; TCGv_i32 tcg_op = tcg_temp_new_i32(); int srcelt = a->q ? 2 : 0; + fpst = fpstatus_ptr(FPST_FPCR_A64); + for (pass = 0; pass < 2; pass++) { tcg_res[pass] = tcg_temp_new_i64(); read_vec_element_i32(s, tcg_op, a->rn, srcelt + pass, MO_32); @@ -9532,6 +9533,8 @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a) TCGv_i32 tcg_res[4]; TCGv_i32 ahp = get_ahp_flag(); + fpst = fpstatus_ptr(FPST_FPCR_F16_A64); + for (pass = 0; pass < 4; pass++) { tcg_res[pass] = tcg_temp_new_i32(); read_vec_element_i32(s, tcg_res[pass], a->rn, srcelt + pass, MO_16); diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 37de816964a..fc7f0d077a5 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3887,7 +3887,7 @@ TRANS_FEAT(FCMLA_zzxz, aa64_sve, gen_gvec_fpst_zzzz, fcmla_idx_fns[a->esz], TRANS_FEAT(FCVT_sh, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_fcvt_sh, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVT_hs, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvt_hs, a, 0, FPST_FPCR_A64) + gen_helper_sve_fcvt_hs, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(BFCVT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, gen_helper_sve_bfcvt, a, 0, FPST_FPCR_A64) @@ -3895,7 +3895,7 @@ TRANS_FEAT(BFCVT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, TRANS_FEAT(FCVT_dh, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_fcvt_dh, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVT_hd, aa64_sve, gen_gvec_fpst_arg_zpz, - gen_helper_sve_fcvt_hd, a, 0, FPST_FPCR_A64) + gen_helper_sve_fcvt_hd, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(FCVT_ds, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_fcvt_ds, a, 0, FPST_FPCR_A64) TRANS_FEAT(FCVT_sd, aa64_sve, gen_gvec_fpst_arg_zpz, From patchwork Fri Jan 24 16:27:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859571 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881823wrq; Fri, 24 Jan 2025 08:32:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUjeB76VatNXDJmzmfwcRiGmavryPNnwa61rWLkM5DyS5tTw4EJYbPP+yT4jrx8ge0pAVeGjg==@linaro.org X-Google-Smtp-Source: AGHT+IFT5bIVwjfn94ghNx55pw2G78dF5xGBhqTOjZXkVnIWqiSiuTPLYgpiidviDLiFIjrzjs69 X-Received: by 2002:a05:6122:6090:b0:50a:c70b:9453 with SMTP id 71dfb90a1353d-51d5b374d74mr25777293e0c.10.1737736376322; Fri, 24 Jan 2025 08:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736376; cv=none; d=google.com; s=arc-20240605; b=QtYJjbUo9cJ8c5P4VaxXCq2rx4Lt3IEy8ZfAaQnL6FSU7w/ZqFvCVNAFI62+ir3HO1 BqQKPHLty4lRI3uf/5mLlUdc2CWDYaVY4ajvmV5+dY6/BITemeaCvQFNpLgfobtlmMgH /NIyiAannhja5SPj4e30ooiTUoceiKBfPY4U0kOYd08OFNnDCR4kQ3YKfVn96/D+Sjz1 /Vq4NxPJDqd6l+k3pX6fVLKWCxZkuf4Fr5iZUX/OAJPr2o4QJdzKjKgmJ99yYoX/Cbww dDvGsnS+pgh61cztn37Syt55gfidtzlmyoJC6fEAwhqXbJG74mIfqmWra3t6yj0F3efB qpRw== 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=hR3/G2BdnpgL0DkgE9KDbKtJdTUbStqQyabHgGIFImE=; fh=MHSvWd5J1q5ee3SUN9MzWmENM4gOtFNOAVutYx412+8=; b=USU2tNVIuqLAV1PsR4S/gYBO7ensWhMI8dEkOrn52mzhIoTbCuv7o+MaG2z5NbFqld C3RnBICckgt5mpfe3Gqdz/CT4f8W2DTrHNlVkIqPp7kU5O9xiT2yPvYdSVtNpyxvKn9+ pOSmxA0PA1+eIUQHZT8Z1RARBG7POh3BG4QXU05eu+O/JKnxtEevcL/lz867idD5clM4 nc6rKCsVhNKR1ls6nQpetW6QbrGUzkXZKcDg1/ycRPQKDKqmiCI4CvDCINEj4aEWAPX/ 6lIndWCuhkPkIg03MbA5M7lDxKKUqDzOoLyJd/au3MuaZG4oZ7chFDhZb6lA2zz7HTFF rbKQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BqawQewJ; 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 71dfb90a1353d-51e4ecc0186si967410e0c.241.2025.01.24.08.32.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:32:56 -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=BqawQewJ; 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 1tbMYq-00055P-Em; Fri, 24 Jan 2025 11:29: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 1tbMYV-0003zD-L5 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:16 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYT-0005YR-MB for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:15 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-38be3bfb045so2349381f8f.0 for ; Fri, 24 Jan 2025 08:29:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736152; x=1738340952; 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=hR3/G2BdnpgL0DkgE9KDbKtJdTUbStqQyabHgGIFImE=; b=BqawQewJmdoUjvBTmDvtAcP7m+0MOpg0+JmaDt7gkO0F6NggdJlf6ylyS63+/0p73s Y5MHsj6k5TrSPG6xl/NdSpLeVTu50DdmD7Mj2LbYl9Nf/RGNWZYXgMxtA1471HFPjryQ Rz+yJ0EDSn6wcSZfYb/4o3sV2bYLoE61JIogx3kFO+sVwzLm6+mmZ9zSTNhidF9pq1i4 c6eJTOFy3qw3tRq64XLe908hAgHTSozo9tfBNovl6gu5W6CMM2pjdJOmyLqS6GyWag6g byja2lGqUNHpS2uE5iyKUYss/koA6wFUSYJolDueVqg6QF42ZOLgvlWU3xklLiPztVIS GW7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736152; x=1738340952; 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=hR3/G2BdnpgL0DkgE9KDbKtJdTUbStqQyabHgGIFImE=; b=SCQqvwGwzOtkmuPm6DB+pglueSeDlF1SROGtdjsFsV95j7Zlp8gjdzvyJ5Juu6Grho 2YwyAH5ztr1DzpG9cxPuyez3hkSlSJh0NMASop/8FlhaWOT8u/L3ZRDwAFpxLMgBg7AF /SFin06Dpelvkmb4gIVN97zUhhRvYn7aI3AywCVHgysNDFoO3Hwhrg/VzK/2EqoSfD5+ DuEVU0t1nf8iNm7Wm5HzOvUDrp0DFAsP8ANW/uacoBgxHbnwV6ERtYzDjKdNTof8qKqi N0URO8bvR2hNVJITPT8tBhg8vZOTDKj1YhD25ADvOVthZuU8mtFXla2CEd6SSTJ7OPHP znYQ== X-Forwarded-Encrypted: i=1; AJvYcCWlG7cHT/gcIpNEH2BHmEji7xXOoTy/YYZYEtcXY+Jsyc5t6jxiIjEm8tNOW6+zjEzgdfEzjQQkBJIU@nongnu.org X-Gm-Message-State: AOJu0Yxf2SV3zS3nJCcb8jtbjK6eHiwKOGb5oVlYBDraVjPFN/A/Mel4 hKU36tkR//EBp48AQGgSAfDstp6Kv/1qEng+B4bVxYRf8Lb1jWGoI98cqZ6Wf3zU2CO35oQK3ka O X-Gm-Gg: ASbGncvqrXdzGQs4IUp62SKhryxYrwKVZoBxwHHQFh6M3h0KcxBgnvVQ/EjcAwcKH0n 76Tj9lkXFIKCgAIKTLS1U8/Akb/0EbpsFv6KF4RqneJciKWTdU0lHf6LbbvRyfVZrODzcnDF9F8 UIXPqyUUvVp7bqVreoCnAe7R3awa0cZUbQOujv7kQzR+61dfiE1HDK2e8hWujR4X4F6sPd8n5qe wQsF/5pqoj9mQiMjlrWXafzm61aR0rWkU6pbPWAJA6Xk/TeKPIyETP8BjdhmhrvIgVXk1rme3jc fcfWkA1oNmI= X-Received: by 2002:a05:6000:2a3:b0:38a:906e:16d0 with SMTP id ffacd0b85a97d-38c2b7c17bbmr4053814f8f.21.1737736152082; Fri, 24 Jan 2025 08:29:12 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:11 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 27/76] target/arm: Define FPCR AH, FIZ, NEP bits Date: Fri, 24 Jan 2025 16:27:47 +0000 Message-Id: <20250124162836.2332150-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Armv8.7 FEAT_AFP feature defines three new control bits in the FPCR: * FPCR.AH: "alternate floating point mode"; this changes floating point behaviour in a variety of ways, including: - the sign of a default NaN is 1, not 0 - if FPCR.FZ is also 1, denormals detected after rounding with an unbounded exponent has been applied are flushed to zero - FPCR.FZ does not cause denormalized inputs to be flushed to zero - miscellaneous other corner-case behaviour changes * FPCR.FIZ: flush denormalized numbers to zero on input for most instructions * FPCR.NEP: makes scalar SIMD operations merge the result with higher vector elements in one of the source registers, instead of zeroing the higher elements of the destination This commit defines the new bits in the FPCR, and allows them to be read or written when FEAT_AFP is implemented. Actual behaviour changes will be implemented in subsequent commits. Note that these are the first FPCR bits which don't appear in the AArch32 FPSCR view of the register, and which share bit positions with FPSR bits. Signed-off-by: Peter Maydell --- target/arm/cpu-features.h | 5 +++++ target/arm/cpu.h | 3 +++ target/arm/vfp_helper.c | 11 ++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h index 30302d6c5b4..7bf24c506b3 100644 --- a/target/arm/cpu-features.h +++ b/target/arm/cpu-features.h @@ -802,6 +802,11 @@ static inline bool isar_feature_aa64_hcx(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HCX) != 0; } +static inline bool isar_feature_aa64_afp(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, AFP) != 0; +} + static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, TIDCP1) != 0; diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2213c277348..7ba227ac4c5 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1713,6 +1713,9 @@ void vfp_set_fpscr(CPUARMState *env, uint32_t val); */ /* FPCR bits */ +#define FPCR_FIZ (1 << 0) /* Flush Inputs to Zero (FEAT_AFP) */ +#define FPCR_AH (1 << 1) /* Alternate Handling (FEAT_AFP) */ +#define FPCR_NEP (1 << 2) /* SIMD scalar ops preserve elts (FEAT_AFP) */ #define FPCR_IOE (1 << 8) /* Invalid Operation exception trap enable */ #define FPCR_DZE (1 << 9) /* Divide by Zero exception trap enable */ #define FPCR_OFE (1 << 10) /* Overflow exception trap enable */ diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 3c8f3e65887..8c79ab4fc8a 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -242,6 +242,9 @@ static void vfp_set_fpcr_masked(CPUARMState *env, uint32_t val, uint32_t mask) if (!cpu_isar_feature(any_fp16, cpu)) { val &= ~FPCR_FZ16; } + if (!cpu_isar_feature(aa64_afp, cpu)) { + val &= ~(FPCR_FIZ | FPCR_AH | FPCR_NEP); + } if (!cpu_isar_feature(aa64_ebf16, cpu)) { val &= ~FPCR_EBF; @@ -271,12 +274,14 @@ static void vfp_set_fpcr_masked(CPUARMState *env, uint32_t val, uint32_t mask) * We don't implement trapped exception handling, so the * trap enable bits, IDE|IXE|UFE|OFE|DZE|IOE are all RAZ/WI (not RES0!) * - * The FPCR bits we keep in vfp.fpcr are AHP, DN, FZ, RMode, EBF - * and FZ16. Len, Stride and LTPSIZE we just handled. Store those bits + * The FPCR bits we keep in vfp.fpcr are AHP, DN, FZ, RMode, EBF, FZ16, + * FIZ, AH, and NEP. + * Len, Stride and LTPSIZE we just handled. Store those bits * there, and zero any of the other FPCR bits and the RES0 and RAZ/WI * bits. */ - val &= FPCR_AHP | FPCR_DN | FPCR_FZ | FPCR_RMODE_MASK | FPCR_FZ16 | FPCR_EBF; + val &= FPCR_AHP | FPCR_DN | FPCR_FZ | FPCR_RMODE_MASK | FPCR_FZ16 | + FPCR_EBF | FPCR_FIZ | FPCR_AH | FPCR_NEP; env->vfp.fpcr &= ~mask; env->vfp.fpcr |= val; } From patchwork Fri Jan 24 16:27:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859572 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881847wrq; Fri, 24 Jan 2025 08:33:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWOw0z/OYLfOfSosMyOmJtP4G4wHDTjwU6Ob0DiSgs8PibGa/h2C45ne1tVfvB6sPiAwIm28g==@linaro.org X-Google-Smtp-Source: AGHT+IGAcNxquxxD9KyYCddwupSGW7XZ7h01N/mLSxB6/h/nGa8f8On4SSKSNhgZuv6i4ui/e/DD X-Received: by 2002:a05:6214:2aa7:b0:6d8:7ed4:336a with SMTP id 6a1803df08f44-6e1b224c1a1mr524349526d6.31.1737736380523; Fri, 24 Jan 2025 08:33:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736380; cv=none; d=google.com; s=arc-20240605; b=dh+JUI16o1BaladgaDT3eyzlf+w0jFbNO5fiva40D/LAZoa+UfgMLuDfVv7dLDF9LX HA4t8OqSBpuQSGqf7i+kCGirbADadMc/4kFgesrIfeGYxW8DFXMOq3/BAx+cBINEwpbw UP8LTDOx0T2qya2jT9TrHKQWecLStQvZMTiknqT1IOrmH+mb0qvr2eab/3aOdxjRiByw hAQUgk3ENYU9OixbWzB83pdDrw5q8syKRggaWvWbgnROC8ugfKoVAUd1vEAHw1igoIWi x9qDyBH9L/+KsPom2+e0XdpG1vdknjQlyAEVUNTEtAFlrjsjK2u5aaRXSDNUn6w4G34Y AF+g== 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=Y5oz9pArMzFfW9wvGP0yBGuc3ozPKdEsvW7lbByV5HM=; fh=j9FZccu3U3fvahnYIRG6KGiyRRgYYnt0DNljEXnTRA8=; b=AO/UkuecLD0RKauKw8gEjTrxT+PY3+DKYPYtTqFer7j8iqh2xWA0fqMao9Ryg09QiH yRxjWEHFS5+bpwBZRHPAhg7pPfrqU3VG5WrDk0LcNRzr0A50g6TjkygvsUxZLNwZIQVp XhaFhxpWfVPAwnDTpJ4vdgFwaeB3wAd9UAy6wFDWrrHEu7qOHB28siyoIs3qS5rx/1WG f1IIKnx5ugQIt1//zBJlQegJBnJBn300l/nxk/q1dBL23AHORAUCJt9PaWi+P1AFQuPk zA+/4RcBohHlM4PCeqabQkD9cZzlfuwDgP4Z6js/UdnpFo88guUqXzO6H4GR/ySPk4YE GgqQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Da0PXiFO; 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-46e66ba75edsi30419501cf.520.2025.01.24.08.33.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:33: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=Da0PXiFO; 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 1tbMYr-0005CW-Lx; Fri, 24 Jan 2025 11:29:37 -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 1tbMYW-0003zW-FF for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:17 -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 1tbMYU-0005Yi-Mj for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:16 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-436326dcb1cso16014235e9.0 for ; Fri, 24 Jan 2025 08:29:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736153; x=1738340953; 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=Y5oz9pArMzFfW9wvGP0yBGuc3ozPKdEsvW7lbByV5HM=; b=Da0PXiFOAGUwhSarHIHL66ST5LgrJE7FWjOTKc1j10+UA1Wi18+Q2eVDx1YkXRNI/B Y8p1eUvx3fqSMQp2E1lbavFrFqJ79TWxFVgtDuPoG/+kk3Y8raVU0FJl/Siq3eDZGcr9 Psc72TrvcyfiZBKI+nQDXqqJXurMmGmaKvPwSkXGmNpKIRFQohRc/QvbOZEINTstZO1S AEmYrtlpPoY1ZU1g87deTmTdnNbNf09Rp6Un5skvS9c7YLrM3NnxtDcOmhA1OimQQFTP 1vY0j8B1Tp4A2xBvWOlmjFPwfmLveeb3k44qPmYLzSvqtKdgXG/rkQTjTHigYVASA6Ly bRng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736153; x=1738340953; 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=Y5oz9pArMzFfW9wvGP0yBGuc3ozPKdEsvW7lbByV5HM=; b=F/mnUrrkDwfwgYLu+5XD2AYzyFkR+vtQZv7ezFYuQx++pzr4xCy02q72iL2SVWMLkv 5jr7rDo+afE7q0h+i5cV2SF2jtCvwsOSVyIBPsy+sibgEw2GVfd1TX0jYkT+mKDWz4s2 8AVHYRDPCR6o4NUfV/pFF2kL9Fe7v7vH7ZaIXzaCoJi20a8w1Ljo9tdBrNIQ9SYZ0Hmu rfVxwuR4BuTJm/6REZtfK6MIrSDZKLvG1qZkkgmbvDtwxlz2cmZGCf1uCLsc4MYQICAh S6n1apH6ElU+tXKx/7dfGWMqZ935+oXOD7tZ4xusmpVvGYsKJJKVE/1b3E6uCzkrOTGP dupA== X-Forwarded-Encrypted: i=1; AJvYcCWOL8JXh8tVg8vO6ASOzpSBm+v0O51RJO8iyiknJdgwNLGO/EJoq5Zuvsyr7j/yAHPeeUhZNnI4Tiky@nongnu.org X-Gm-Message-State: AOJu0Yyqjg4aixGCnOchL7aAk0GS9RXs1esV5tx2t6pP5P6c1A5RrqJg UUrTIwXBhyextHx304ByzyL4zVqfx6jfhM072rP0nvic9kJoFp4527urfseP794= X-Gm-Gg: ASbGncsSxyL6lwrgJEmlDEzURopcDJV/Q3GZwn15CCEa52adGgSJ5Clwg85T+Y6UKcX hBY8N+y1U1sXQLCna24Fr7fxygmqT+bJICbmBVru3kaZp6U2zRnLWHV4PmGlJeN5TRYRPuB+GWg ltEOl7OPZqDv4PSUkQnA6sCcaWxwi3oNP+DqFWP5To/NG+Qjcqywm0aAh2U9mc1BJ84iTvo/P+i vCTdhVvhIinq1ExzvFR02tEsS+nwPEjnpusHtiKkRSr4ugCHajCqQNcXyfxr/wTNP53DyReO4PX 3TbdD6lxowQ= X-Received: by 2002:a7b:cb43:0:b0:434:fafe:edb with SMTP id 5b1f17b1804b1-43891427757mr260174695e9.24.1737736153235; Fri, 24 Jan 2025 08:29:13 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:12 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 28/76] target/arm: Implement FPCR.FIZ handling Date: Fri, 24 Jan 2025 16:27:48 +0000 Message-Id: <20250124162836.2332150-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Part of FEAT_AFP is the new control bit FPCR.FIZ. This bit affects flushing of single and double precision denormal inputs to zero for AArch64 floating point instructions. (For half-precision, the existing FPCR.FZ16 control remains the only one.) FPCR.FIZ differs from FPCR.FZ in that if we flush an input denormal only because of FPCR.FIZ then we should *not* set the cumulative exception bit FPSR.IDC. FEAT_AFP also defines that in AArch64 the existing FPCR.FZ only applies when FPCR.AH is 0. We can implement this by setting the "flush inputs to zero" state appropriately when FPCR is written, and by not reflecting the float_flag_input_denormal status flag into FPSR reads when it is the result only of FPSR.FIZ. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/vfp_helper.c | 58 ++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 8c79ab4fc8a..5a0b389f7a3 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -61,19 +61,29 @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits) static uint32_t vfp_get_fpsr_from_host(CPUARMState *env) { - uint32_t i = 0; + uint32_t a32_flags = 0, a64_flags = 0; - i |= get_float_exception_flags(&env->vfp.fp_status_a32); - i |= get_float_exception_flags(&env->vfp.fp_status_a64); - i |= get_float_exception_flags(&env->vfp.standard_fp_status); + a32_flags |= get_float_exception_flags(&env->vfp.fp_status_a32); + a32_flags |= get_float_exception_flags(&env->vfp.standard_fp_status); /* FZ16 does not generate an input denormal exception. */ - i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a32) + a32_flags |= (get_float_exception_flags(&env->vfp.fp_status_f16_a32) & ~float_flag_input_denormal_flushed); - i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64) + a32_flags |= (get_float_exception_flags(&env->vfp.standard_fp_status_f16) & ~float_flag_input_denormal_flushed); - i |= (get_float_exception_flags(&env->vfp.standard_fp_status_f16) + + a64_flags |= get_float_exception_flags(&env->vfp.fp_status_a64); + a64_flags |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64) & ~float_flag_input_denormal_flushed); - return vfp_exceptbits_from_host(i); + /* + * Flushing an input denormal only because FPCR.FIZ == 1 does + * not set FPSR.IDC. So squash it unless (FPCR.AH == 0 && FPCR.FZ == 1). + * We only do this for the a64 flags because FIZ has no effect + * on AArch32 even if it is set. + */ + if ((env->vfp.fpcr & (FPCR_FZ | FPCR_AH)) != FPCR_FZ) { + a64_flags &= ~float_flag_input_denormal_flushed; + } + return vfp_exceptbits_from_host(a32_flags | a64_flags); } static void vfp_clear_float_status_exc_flags(CPUARMState *env) @@ -91,6 +101,17 @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env) set_float_exception_flags(0, &env->vfp.standard_fp_status_f16); } +static void vfp_sync_and_clear_float_status_exc_flags(CPUARMState *env) +{ + /* + * Synchronize any pending exception-flag information in the + * float_status values into env->vfp.fpsr, and then clear out + * the float_status data. + */ + env->vfp.fpsr |= vfp_get_fpsr_from_host(env); + vfp_clear_float_status_exc_flags(env); +} + static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) { uint64_t changed = env->vfp.fpcr; @@ -130,9 +151,18 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) if (changed & FPCR_FZ) { bool ftz_enabled = val & FPCR_FZ; set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a32); - set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a32); set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a64); - set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a64); + /* FIZ is A64 only so FZ always makes A32 code flush inputs to zero */ + set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a32); + } + if (changed & (FPCR_FZ | FPCR_AH | FPCR_FIZ)) { + /* + * A64: Flush denormalized inputs to zero if FPCR.FIZ = 1, or + * both FPCR.AH = 0 and FPCR.FZ = 1. + */ + bool fitz_enabled = (val & FPCR_FIZ) || + (val & (FPCR_FZ | FPCR_AH)) == FPCR_FZ; + set_flush_inputs_to_zero(fitz_enabled, &env->vfp.fp_status_a64); } if (changed & FPCR_DN) { bool dnan_enabled = val & FPCR_DN; @@ -141,6 +171,14 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64); } + /* + * If any bits changed that we look at in vfp_get_fpsr_from_host(), + * we must sync the float_status flags into vfp.fpsr now (under the + * old regime) before we update vfp.fpcr. + */ + if (changed & (FPCR_FZ | FPCR_AH | FPCR_FIZ)) { + vfp_sync_and_clear_float_status_exc_flags(env); + } } #else From patchwork Fri Jan 24 16:27:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859582 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp882928wrq; Fri, 24 Jan 2025 08:35:02 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVyg2bSNooDgw9FE7JFmVFvyaLSvr4qQ66jHtd1pAhlKjLsDizZYeizND4Vqw1CMsmPkXuXww==@linaro.org X-Google-Smtp-Source: AGHT+IH/a2vnKd/ryVwi5VphV1bd18rnA0XCWjarunhPZniUi2ybX3+hu9cFiEybGMhUHE3c+TO4 X-Received: by 2002:a05:6214:5349:b0:6d4:2910:7f13 with SMTP id 6a1803df08f44-6e1b2213dd2mr502109866d6.32.1737736501918; Fri, 24 Jan 2025 08:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736501; cv=none; d=google.com; s=arc-20240605; b=FxawszhPOIh05ABdidAS6xyLXqeGQ4IHxNBWwrT5nhcwVVLCHByZkfNAjXTVwU0eVk ez41MCuYkR3aa8l1Nk+OXjLX+L9fAO8P5H2OIOQK4W+v5h4SrYGItO6i1R+mCssPXTM1 MWng8D8jz0C3k1qZq9ocdH802vVVe0DAoBHWS6X0vhIX++o8IlOOTyoR02cQR1wwAmm7 cPpdWMxqXjvnkqsQ7SCSt2SEyaREx8ZLvyhpfq+rCnRUUhgid172CxTUw2TgHwvMWONS mmC6Peo72OSpTQmj0JDL5oNEJBp6W5LNb3DC2uuXTJFzOoHJyQsKzlyX0lmBr/PzTFdf Qo3Q== 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=jN3mFnktaZqVK11S456/SP/OoMEiasYt5k58IjHmWbU=; fh=KpQbRh7YWqf/a3e5lbFYF+K5XzsW6nj4oNq+LPEP5mw=; b=Q9+Y4PHlazWYzsNxReqcQQRj7EjVpJnxrQc62pa9/XBqi4NK0H20gFyRifHg2HDjvW askHXtT3tDoT1x7lE+C6QFCiybyuvftKrwZIex9gXuAhAkJGPRFyOPXnRYmk7Ms4seJD x/ru9BktBhxSspx7hW7CuulPe6hi+d1D7dsBUbQ4wIZ2+TFN67SBGdZnHmBG3hLR69jO G522/0NiWT2433kzPp7HpaCFLpgWMiAEVAZy3WC5imho/uyN9YkGNgoSG9zR9l7dA0I2 RfeiCkCs4eOpvKAj1ULJ/47CsaCxjf4wk5jQZmWiPxPEYQl5J6zi42xTPZSkRM8E6oLi f5yw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eryf4Qoe; 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-46e6686cb51si26138241cf.69.2025.01.24.08.35.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:35:01 -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=eryf4Qoe; 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 1tbMah-00089L-Ut; Fri, 24 Jan 2025 11:31:34 -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 1tbMYX-00040E-Rq for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:19 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYV-0005ZF-V7 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:17 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4363ae65100so24852005e9.0 for ; Fri, 24 Jan 2025 08:29:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736154; x=1738340954; 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=jN3mFnktaZqVK11S456/SP/OoMEiasYt5k58IjHmWbU=; b=eryf4QoeJnKBtq5craoip97NvTILEp5Dqy3hbwhgSDDs73DRxGHxVyWquh+oBHQACx dnJDki1ZsxsXfUIvXaGPmibO/KlSC12i/t/QZF570ihWUUIjjCOjQv9Tmhtf15UvGDAj quWogAvqqubs/jOqRzP6u2zQSV0oEuslu+/fs0Ou7OlIYMmxspe/flkFsU1IqfuW55hU 1/R9YpjT1WnmSXLbP2Ni4RhwIIpfeIRA8thqCrMAEMAgL+ddYew8aUWM1evsfAcdBzYf Rn5ncMa1y5nOqR/yJPzUUmwbnfl76ubdvbVMuNLlwr7DzwxYMsm2cGasD3bJK+IEyppL lYxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736154; x=1738340954; 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=jN3mFnktaZqVK11S456/SP/OoMEiasYt5k58IjHmWbU=; b=tdbkUF0HGQbglN329XqJ35T/F/XEfsT6CkkZojwC+6xXUqlc0iFKbQfnrhya7y1Lk9 Pq2TF92hIDXZiIfrAogeSwS/qyOaYocdBLtj8a0m74iffVaG5c6+2bylI+aEy5NQOA+S xjSclAXCYR5h61DUWov1wuDOw0JGEy1v6nqI4Kjl7NZXvb9ksLlb1QvKYWN8Nl4hn2nM 8NdGFX5R7u8Wb6mkP9IiodNRhMb4lpRXbkketYIBvsx4ClX4fLs7JQLWbs6EwRpDCV2/ 8WUnzt4Si7bUxDtLbEZPUCZjfsqqHjEEHMSTlqf5Qo85WPNH+XqHvxqXo1znXcw+5MYD W6Tw== X-Forwarded-Encrypted: i=1; AJvYcCUBC+zyVs18KBMkieZFiadrXBUlQlEqd8czV6vCWqtty3qeBUQfixZCNZq+txpjjw7YPuSMRAApRNz+@nongnu.org X-Gm-Message-State: AOJu0YyXTxZrAeZZIJE7sNqIbJdKtJCbRMV5kHo/+jetM80fxsUIygGu SlH5W99yy08oK/pB1N4NTWQ0/Y9QI93wKWCgUjh3GTLrC9hBkJ8FSvvCzmhe/DM= X-Gm-Gg: ASbGnctAvPX2AnBLyTj3uwUg9w9BtRHTj7jcyJgQn13lnN/+zcuj/054QgllbPQcIbj QU7v1ZrHLcBcfs7D7iR1gMNDNEKNMUqOr4R3kBVLa2nXWqMgXSuTIqv8G0a/Rs8/Eb7BosObepC Jy69uuKZc4lmsFJXhoYt+uO9EZX6hLmKfNaSKb42NtOmmW1NT7XNmbf5TFhPQdQAlEWJiw7ugQ0 ZtG1fICI9hFimHSpTz68T3QGbrTvsC+zbHcTN4WmkzZJ7CcmOAq/roetjr+opwjHEvQge9zypV5 QrtdvrmcAoA= X-Received: by 2002:a05:600c:1c1e:b0:436:6460:e67a with SMTP id 5b1f17b1804b1-43891452899mr251172675e9.25.1737736154514; Fri, 24 Jan 2025 08:29:14 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:13 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 29/76] target/arm: Adjust FP behaviour for FPCR.AH = 1 Date: Fri, 24 Jan 2025 16:27:49 +0000 Message-Id: <20250124162836.2332150-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 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 When FPCR.AH is set, various behaviours of AArch64 floating point operations which are controlled by softfloat config settings change: * tininess and ftz detection before/after rounding * NaN propagation order * result of 0 * Inf + NaN * default NaN value When the guest changes the value of the AH bit, switch these config settings on the fp_status_a64 and fp_status_f16_a64 float_status fields. This requires us to make the arm_set_default_fp_behaviours() function global, since we now need to call it from cpu.c and vfp_helper.c; we move it to vfp_helper.c so it can be next to the new arm_set_ah_fp_behaviours(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/internals.h | 4 +++ target/arm/cpu.c | 23 ----------------- target/arm/vfp_helper.c | 56 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 863a84edf81..98073acc276 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1828,4 +1828,8 @@ uint64_t gt_virt_cnt_offset(CPUARMState *env); * all EL1" scope; this covers stage 1 and stage 2. */ int alle1_tlbmask(CPUARMState *env); + +/* Set the float_status behaviour to match the Arm defaults */ +void arm_set_default_fp_behaviours(float_status *s); + #endif diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 0b4cd872d27..1ba22c4c7aa 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -169,29 +169,6 @@ void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, QLIST_INSERT_HEAD(&cpu->el_change_hooks, entry, node); } -/* - * Set the float_status behaviour to match the Arm defaults: - * * tininess-before-rounding - * * 2-input NaN propagation prefers SNaN over QNaN, and then - * operand A over operand B (see FPProcessNaNs() pseudocode) - * * 3-input NaN propagation prefers SNaN over QNaN, and then - * operand C over A over B (see FPProcessNaNs3() pseudocode, - * but note that for QEMU muladd is a * b + c, whereas for - * the pseudocode function the arguments are in the order c, a, b. - * * 0 * Inf + NaN returns the default NaN if the input NaN is quiet, - * and the input NaN if it is signalling - * * Default NaN has sign bit clear, msb frac bit set - */ -static void arm_set_default_fp_behaviours(float_status *s) -{ - set_float_detect_tininess(float_tininess_before_rounding, s); - set_float_detect_ftz(detect_ftz_before_rounding, s); - set_float_2nan_prop_rule(float_2nan_prop_s_ab, s); - set_float_3nan_prop_rule(float_3nan_prop_s_cab, s); - set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, s); - set_float_default_nan_pattern(0b01000000, s); -} - static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque) { /* Reset a single ARMCPRegInfo register */ diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 5a0b389f7a3..7507ff24bc0 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -31,6 +31,50 @@ Single precision routines have a "s" suffix, double precision a "d" suffix. */ +/* + * Set the float_status behaviour to match the Arm defaults: + * * tininess-before-rounding + * * 2-input NaN propagation prefers SNaN over QNaN, and then + * operand A over operand B (see FPProcessNaNs() pseudocode) + * * 3-input NaN propagation prefers SNaN over QNaN, and then + * operand C over A over B (see FPProcessNaNs3() pseudocode, + * but note that for QEMU muladd is a * b + c, whereas for + * the pseudocode function the arguments are in the order c, a, b. + * * 0 * Inf + NaN returns the default NaN if the input NaN is quiet, + * and the input NaN if it is signalling + * * Default NaN has sign bit clear, msb frac bit set + */ +void arm_set_default_fp_behaviours(float_status *s) +{ + set_float_detect_tininess(float_tininess_before_rounding, s); + set_float_detect_ftz(detect_ftz_before_rounding, s); + set_float_2nan_prop_rule(float_2nan_prop_s_ab, s); + set_float_3nan_prop_rule(float_3nan_prop_s_cab, s); + set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, s); + set_float_default_nan_pattern(0b01000000, s); +} + +/* + * Set the float_status behaviour to match the FEAT_AFP + * FPCR.AH=1 requirements: + * * tininess-after-rounding + * * 2-input NaN propagation prefers the first NaN + * * 3-input NaN propagation prefers a over b over c + * * 0 * Inf + NaN always returns the input NaN and doesn't + * set Invalid for a QNaN + * * default NaN has sign bit set, msb frac bit set + */ +static void arm_set_ah_fp_behaviours(float_status *s) +{ + set_float_detect_tininess(float_tininess_after_rounding, s); + set_float_detect_ftz(detect_ftz_after_rounding, s); + set_float_2nan_prop_rule(float_2nan_prop_ab, s); + set_float_3nan_prop_rule(float_3nan_prop_abc, s); + set_float_infzeronan_rule(float_infzeronan_dnan_never | + float_infzeronan_suppress_invalid, s); + set_float_default_nan_pattern(0b11000000, s); +} + #ifdef CONFIG_TCG /* Convert host exception flags to vfp form. */ @@ -171,6 +215,18 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64); } + if (changed & FPCR_AH) { + bool ah_enabled = val & FPCR_AH; + + if (ah_enabled) { + /* Change behaviours for A64 FP operations */ + arm_set_ah_fp_behaviours(&env->vfp.fp_status_a64); + arm_set_ah_fp_behaviours(&env->vfp.fp_status_f16_a64); + } else { + arm_set_default_fp_behaviours(&env->vfp.fp_status_a64); + arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a64); + } + } /* * If any bits changed that we look at in vfp_get_fpsr_from_host(), * we must sync the float_status flags into vfp.fpsr now (under the From patchwork Fri Jan 24 16:27:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859567 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881713wrq; Fri, 24 Jan 2025 08:32:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXVEIHbwFp50x8CvM+22E7Nl81RiKrEEJknwfPBczpQlRWdl30npXa31jx1LmUaizfBY/CJvg==@linaro.org X-Google-Smtp-Source: AGHT+IFTq+Nk8tBv+EMow+6H2uwxMwNc2aZm0MsXqyiXQWM5hYCwaZ8ytwRcwqBN/VqyDWETmTZY X-Received: by 2002:a05:620a:3947:b0:7b6:e47a:8e1d with SMTP id af79cd13be357-7be6320c40dmr4637284685a.31.1737736364309; Fri, 24 Jan 2025 08:32:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736364; cv=none; d=google.com; s=arc-20240605; b=GQhyB5d+/uaVTACwdQoV35baIOPX8wTUZVgbclZOmQdWuon8GVtiTNtflymwkvYK6R iF5oAeyRP/tezuo3d7+f/1c79t1uW4qY8MqoJY3K403Km8ruk3KhyKvH4ZZLyEYBfwmo CCWn5YzM/VswKDKMLlEBT6HTraZGMbzW//SB2KE3zBmrlj8h7uNnnepEJzdjo4ft9mCD MheJCu3LD8YeOtwotA7RB+6pMN+1VXL3XzAp2smK+M8DFxH8i8PR6CjVuYkGV0dgxdOd VtM3lJz4RxxxEYFiCQ/x4o+8usL4tiCsplszlwjtQYlXWMYKPN2hcs2HicRORNX66jr9 GhSQ== 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=lnkT6ulKHq7dxxtpiNjIKSKMJRk+cdNio8Qkq1PdbQY=; fh=p4KiR89ld/GNb0OGHboAOLXiCvMne43CVqs0bTyY+KM=; b=ge8ukLE3WG63A3NTKBLD0ev9vXAVbBNhB1vFdZexT3DfOWNQuJ2BQuCm8TXO3zMrj5 eMcv0wx9EqOgvzIAoES2H5FEegnlo8y8XwLaBFnH3CZ7mXaYqP5rvVILDKiuGIIJeuDy o1PwVIYmMOK92giefemIAaQ/4IfReA6qgK/W6d0zQvdmYfSP/xhKiC/yNP6iVurKpcFs C6vrrUEdFXTtp2WTPpuYP5Xgk+pgIiSppEJ1mvWI5ID95NmWzBHQYwneaUGIn32TToTZ G3iAcsNmDMq0EsXF8OEyzqRZEG9dc0Lbqf9lauPCgJkl9bZJEEIr/xvL0ZyDAosdW3Bt XM5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oBn3PmHU; 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-7be9aee13a2si264461985a.249.2025.01.24.08.32.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:32:44 -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=oBn3PmHU; 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 1tbMYr-0005C0-KE; Fri, 24 Jan 2025 11:29:37 -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 1tbMYa-00041S-3O for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:20 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYX-0005Zp-UG for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:19 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3862d161947so1270888f8f.3 for ; Fri, 24 Jan 2025 08:29:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736156; x=1738340956; 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=lnkT6ulKHq7dxxtpiNjIKSKMJRk+cdNio8Qkq1PdbQY=; b=oBn3PmHUwNg/QGxLVHk/WDVxZ5JQpspjVy1c/S7EGMJO2tqoA9EL9FEOMhQrBAbtQE KjmSa6QhbgSdB2SgFh+JjXJe1BYxxNrWDPrKhwKOaumhZtbpLeys9DT9MHkJFIBJ8xMK UTc+qf8ueGoaRxN4k0TM8wHTDD4YjSIfKGG7uR7kaPRZfWy8vRtET343KJp4UTynqazj uPiSrKfjHYBFWIWnajpKqajoCjZLEzTu0dfjZkGGE0KQFkR1M/fCxmKfHkd5wivT38ur Jl4N0F5k1GVCtzpdLz/+xyDi63wQoYvJbpuyBYBSLJqNLG1VuHpMXiHz4yFO3bHWTNGo EoIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736156; x=1738340956; 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=lnkT6ulKHq7dxxtpiNjIKSKMJRk+cdNio8Qkq1PdbQY=; b=ncpz3WEnPwn9C5u3OzkE1PyI1117Lax2YMGWw7idNWgu6PDq/ZqIWZLEcErFXrtT3B 2ZjM1ioqA6ldwqi+TLcIsHrqgC8euM9CSHJJwBBM0O77RDRXXfDJ271W7iivUpZIlSQA r7KzgTOgM0ipKLdOwb6+dbJ9L896BrVLcHbdzW0jcwbr25Jton4lXHy7e2v212GvA8hU 1C1vSu56LGoq336FuXJ3ocEk0LWcW4keu/GMG90TYMpkg9/Hdb0Kd7n9WjEU57Sd2wGy 5T9SKycwlvpA8iiwYYsAshMrW9pSYPDEx9ulv13LDSFnCJyRM8KEtfSYXltU/+UqZoX9 W/LA== X-Forwarded-Encrypted: i=1; AJvYcCWgF6IK/HwwXw84rhFuotCjGWfuQ37q1LoJ7e6ovThWirUMTKX0zXvhx1Hu1q6ixBr+UT3HiIwriO/3@nongnu.org X-Gm-Message-State: AOJu0YzgL8DPdf/mxkA6ByjucElWJoQgaU2iks1e0f+R2FiCwvFz1Kxx dq6tX9ilBOGooOo5MIJVPAc9PKbB0e5PS9/qAGeQJPHioQAzPSO3xYPl2qVMWJ5rLB3bM96BwNf N X-Gm-Gg: ASbGncsx3BvRAN+eLtYxybpXP8w1CJ0ZlG+0uO35Ngm9tV1rPf8OCrza5jAPszHSS+H spkpzg8MyouTTz/pA+Cn3PQhWKsTseB90Iw+XZTjHfQ70Dnf1OvUopqYlhYAIE1UIbPMaso3uaj k174TwYXvs/v4akgCzkUWtcPQ9fzPJXD/4I/pBFoAnxC13D/ORkdKBnyBRxhRH8v7eCcj2HJfyf jlScRFdhVtGvyGicdPoxWOzxv4b10K61xoPceVgGZGFCj1I1ezKE3g/UQ5cgziIb3MXk0t2In9x YTvqpF5+Og8= X-Received: by 2002:a5d:59a8:0:b0:385:fa26:f0d8 with SMTP id ffacd0b85a97d-38bf5655a0amr27922080f8f.8.1737736156326; Fri, 24 Jan 2025 08:29:16 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:14 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 30/76] target/arm: Adjust exception flag handling for AH = 1 Date: Fri, 24 Jan 2025 16:27:50 +0000 Message-Id: <20250124162836.2332150-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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, T_SCC_BODY_TEXT_LINE=-0.01 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 When FPCR.AH = 1, some of the cumulative exception flags in the FPSR behave slightly differently for A64 operations: * IDC is set when a denormal input is used without flushing * IXC (Inexact) is set when an output denormal is flushed to zero Update vfp_get_fpsr_from_host() to do this. Note that because half-precision operations never set IDC, we now need to add float_flag_input_denormal_used to the set we mask out of fp_status_f16_a64. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/vfp_helper.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 7507ff24bc0..2eb75bd7ecc 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -78,7 +78,7 @@ static void arm_set_ah_fp_behaviours(float_status *s) #ifdef CONFIG_TCG /* Convert host exception flags to vfp form. */ -static inline uint32_t vfp_exceptbits_from_host(int host_bits) +static inline uint32_t vfp_exceptbits_from_host(int host_bits, bool ah) { uint32_t target_bits = 0; @@ -100,6 +100,16 @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits) if (host_bits & float_flag_input_denormal_flushed) { target_bits |= FPSR_IDC; } + /* + * With FPCR.AH, IDC is set when an input denormal is used, + * and flushing an output denormal to zero sets both IXC and UFC. + */ + if (ah && (host_bits & float_flag_input_denormal_used)) { + target_bits |= FPSR_IDC; + } + if (ah && (host_bits & float_flag_output_denormal_flushed)) { + target_bits |= FPSR_IXC; + } return target_bits; } @@ -117,7 +127,7 @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env) a64_flags |= get_float_exception_flags(&env->vfp.fp_status_a64); a64_flags |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64) - & ~float_flag_input_denormal_flushed); + & ~(float_flag_input_denormal_flushed | float_flag_input_denormal_used)); /* * Flushing an input denormal only because FPCR.FIZ == 1 does * not set FPSR.IDC. So squash it unless (FPCR.AH == 0 && FPCR.FZ == 1). @@ -127,7 +137,8 @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env) if ((env->vfp.fpcr & (FPCR_FZ | FPCR_AH)) != FPCR_FZ) { a64_flags &= ~float_flag_input_denormal_flushed; } - return vfp_exceptbits_from_host(a32_flags | a64_flags); + return vfp_exceptbits_from_host(a64_flags, env->vfp.fpcr & FPCR_AH) | + vfp_exceptbits_from_host(a32_flags, false); } static void vfp_clear_float_status_exc_flags(CPUARMState *env) From patchwork Fri Jan 24 16:27:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859576 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp882250wrq; Fri, 24 Jan 2025 08:33:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU3RWuaKCa68bQhruKn/Nf9t42SerIveLCNNpns9oAu2jjg5m9lmZGqjcO7YWytn+oU8ogHeA==@linaro.org X-Google-Smtp-Source: AGHT+IGVqFKDJwrlxI7bJb2XCsRNgbAYHX+OQQvOVKXAgkq8Mo/XmVp0glX4a4fTHnF70EQageUm X-Received: by 2002:a05:620a:248:b0:7be:73b5:b303 with SMTP id af79cd13be357-7be73b5b466mr3285060885a.31.1737736422256; Fri, 24 Jan 2025 08:33:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736422; cv=none; d=google.com; s=arc-20240605; b=HlA5hM+EWl/81tvVbrS/UwizfNn/Gfr6hmsrSIEME2hGXrlOeajIiSrDKJgp1DJfir YHQXNF0mchlvr/RrKnUs3dBH0AjZrIYvQ6rC6xpNuXL1yMoqXXbPGNJqM1gg0nDS5jG8 TudR1EfX1ck5rbyOpn4rx23DQ75zrCYpeXKjCe9DiMtARwYRadK4ipzweMEivGw6yLSl lpJvG3i+Pa+R4esTegAjsKbkHdn7NeNWSWkcR2Tgx/AIGUqk+XbzvhKeBlYBCSdtupMg YJru+t/2TA9kMXDeiQbpOeak8LRMV8iJcAW5t2elDuUbrX4SLhtWaqu/w9/cbrOnTCiT gehw== 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=PiLPZstDGoHVEw4k0zndELCSvoWxaQNvBqkGl85q8fo=; fh=fyw2Z14Jpd8i9eGhjv7m3/JIOlmzmPmy8zKvS3ncqkc=; b=g2yDa/LgkUsWJOUvAKwbmbE8oc4aeTxPDuIuYRVH+O8ZH5g+KCbUPaOGt+ltaJojMU bfh4Vkr67g+UO5xmiIazO6f7AAGLu1e2WYWAuRGkouK04KEeKXEmTgj7yBWn1nk83LTK 4nqLBmTJLt5qiHpaM3ReXr7tQ2rD+xF8fk3jCKyFFPIH9rZE8S9JRpf5rk+XZ/XDKP1B 5nnVBUV7E+8upR7/utIwlo27aluQZkcvng7X8Y/mIUtGO4sRIJmgh1UevpxN5LZ2yEgK y33gWGnl5C+q+vg5qI9AVLcSI9oh2mLHXu5OqDQtywv6nAOOFakWDQhUROnmBk+t6d9n dQ7g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PDEil/hn"; 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-7be9ae9339bsi253902385a.153.2025.01.24.08.33.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:33:42 -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="PDEil/hn"; 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 1tbMZf-0005xo-3W; Fri, 24 Jan 2025 11:30:32 -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 1tbMYb-00046u-NL for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:21 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYZ-0005aE-Qw for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:21 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-436345cc17bso16862125e9.0 for ; Fri, 24 Jan 2025 08:29:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736157; x=1738340957; 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=PiLPZstDGoHVEw4k0zndELCSvoWxaQNvBqkGl85q8fo=; b=PDEil/hnVZBwb7un3GVKnymTi/m65MuAVOaov9sAVVQrTn9G0Mq9BoErkjn6g0oyeB zgMi5B52KCA7MugR00CyKQ9ImI4lmlegkdieJrGBP4QHWKjWm1tWBggsRjkziT8MDNrm SNJzIx/DaKY+acNgkVRLpZzTFbFw0t5vYrw8HM+MTKOTAfY6x2pXZRXqqcVVfviQeX6G iOkKuLndU8sd86vkx6xmKSLvSar+wP5xsJbqgNPZBlAGnFVICBlxEjvYgc3mHLaONtAh 9x7PDSxf5fTSOxZgepQVmxFckV49+n1bbCLTeOO6/NYJnhMbm6voxa8aG4FQcM1iyhw3 fkrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736157; x=1738340957; 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=PiLPZstDGoHVEw4k0zndELCSvoWxaQNvBqkGl85q8fo=; b=jJVhNVnGNFlN5LZT/pRO5himEuUWvCF4ixDZDfWS4pjuoxlesXOnmZcAOIs5lDACAq kzADaR3PAYo8fu1Nfx0sQrMiHACg2H1MFOlRuAdd2dekjS4wFEHR2fyHsvM8dGjewozd J/lJRJwCkZ6xGhu6bLI5fDAcREN5CqOEEZXDspK6DgwW0qAkEvHSp7I7xyFbEYjPRB0U pWmP/D+NyhkeLMNlV5UK7HhQOST+l5yHr/SLrG1WQH/yy2NyHHaG3vr8I+Cjv9MVtDwr ADS7yeQQJtYAfFHB0CqVFOACeKi9ual6NRFdeOrk3U2GyCCOzsF3K9JPhJbckbg3GO8W 5UAQ== X-Forwarded-Encrypted: i=1; AJvYcCVoNiy6A2bjGymPaCcSzcHa78JF9DUqYXR8ABNE3e3V/OA7aAvmxSJrg77Mw/QUzlaWvcWUD4nfnXkT@nongnu.org X-Gm-Message-State: AOJu0Yx/6LG19L0jVtVLX0/LHyEud1QMCjMZS4y2Y0v4Uc/9AChLDkZI o9GCLr2J8t8ZlbQYNcBuyJ2qurVbzeuupwc+WPYU73t8iNsFiN9eWdAAq9vtC1Y= X-Gm-Gg: ASbGncs8IbBou1sW2827oBA0q/U8kQONfjDMF6G/LKuNWPyGEy8tpfxHxsVEp5IByPt sq35l6ThCQo/AiISmfgk8YwTpzvAL/KsWi9hCgA33Hk30mJFH4Ndaybhv32O7jYnLjI8VVrUTCv 4Jg1qv/UG2/xaemGUGSFg0QXm5EJK1eSxw/uzTrQLb7+28D0jfdqHRLaQ1PZMpDxkEqNI9lFrDe GBIshzO1b3J5WPmEyXgKsvldpG3agJTKgcBZVq18Eiar0lkmT4UtGoynrcXu+neZjJ6oyQO1Tf3 3mbowICEiaw= X-Received: by 2002:a05:600c:3d05:b0:434:f767:68ea with SMTP id 5b1f17b1804b1-438b0dc9532mr152363795e9.5.1737736157421; Fri, 24 Jan 2025 08:29:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:16 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 31/76] target/arm: Add FPCR.AH to tbflags Date: Fri, 24 Jan 2025 16:27:51 +0000 Message-Id: <20250124162836.2332150-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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 We are going to need to generate different code in some cases when FPCR.AH is 1. For example: * Floating point neg and abs must not flip the sign bit of NaNs * some insns (FRECPE, FRECPS, FRECPX, FRSQRTE, FRSQRTS, and various BFCVT and BFM bfloat16 ops) need to use a different float_status to the usual one Encode FPCR.AH into the A64 tbflags, so we can refer to it at translate time. Because we now have a bit in FPCR that affects codegen, we can't mark the AArch64 FPCR register as being SUPPRESS_TB_END any more; writes to it will now end the TB and trigger a regeneration of hflags. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 1 + target/arm/tcg/translate.h | 2 ++ target/arm/helper.c | 2 +- target/arm/tcg/hflags.c | 4 ++++ target/arm/tcg/translate-a64.c | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 7ba227ac4c5..c8b44c725d0 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3197,6 +3197,7 @@ FIELD(TBFLAG_A64, NV2, 34, 1) FIELD(TBFLAG_A64, NV2_MEM_E20, 35, 1) /* Set if FEAT_NV2 RAM accesses are big-endian */ FIELD(TBFLAG_A64, NV2_MEM_BE, 36, 1) +FIELD(TBFLAG_A64, AH, 37, 1) /* FPCR.AH */ /* * Helpers for using the above. Note that only the A64 accessors use diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index ec4c0cf03fc..c37c0b539e2 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -155,6 +155,8 @@ typedef struct DisasContext { bool nv2_mem_e20; /* True if NV2 enabled and NV2 RAM accesses are big-endian */ bool nv2_mem_be; + /* True if FPCR.AH is 1 (alternate floating point handling) */ + bool fpcr_ah; /* * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. * < 0, set by the current instruction. diff --git a/target/arm/helper.c b/target/arm/helper.c index 40bdfc851a5..7d95eae9971 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4848,7 +4848,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .writefn = aa64_daif_write, .resetfn = arm_cp_reset_ignore }, { .name = "FPCR", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 0, .crn = 4, .crm = 4, - .access = PL0_RW, .type = ARM_CP_FPU | ARM_CP_SUPPRESS_TB_END, + .access = PL0_RW, .type = ARM_CP_FPU, .readfn = aa64_fpcr_read, .writefn = aa64_fpcr_write }, { .name = "FPSR", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 1, .crn = 4, .crm = 4, diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c index f03977b4b00..b3a78564ec1 100644 --- a/target/arm/tcg/hflags.c +++ b/target/arm/tcg/hflags.c @@ -404,6 +404,10 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, DP_TBFLAG_A64(flags, TCMA, aa64_va_parameter_tcma(tcr, mmu_idx)); } + if (env->vfp.fpcr & FPCR_AH) { + DP_TBFLAG_A64(flags, AH, 1); + } + return rebuild_hflags_common(env, fp_el, mmu_idx, flags); } diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index a47fdcd2e48..556da6d23cd 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9666,6 +9666,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->nv2 = EX_TBFLAG_A64(tb_flags, NV2); dc->nv2_mem_e20 = EX_TBFLAG_A64(tb_flags, NV2_MEM_E20); dc->nv2_mem_be = EX_TBFLAG_A64(tb_flags, NV2_MEM_BE); + dc->fpcr_ah = EX_TBFLAG_A64(tb_flags, AH); dc->vec_len = 0; dc->vec_stride = 0; dc->cp_regs = arm_cpu->cp_regs; From patchwork Fri Jan 24 16:27:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859563 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp881206wrq; Fri, 24 Jan 2025 08:31:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUK3xTe3x+B/xp70AXm9cVjaI0EWkRgjKUg2rAbdAhXA9a0n9yi4YDRlzv06T9UuTD7OxZqZQ==@linaro.org X-Google-Smtp-Source: AGHT+IFoCEPfonZyeipJm8Es4YHdEqGKhfzjdVMn9css06ZFRWe8BbS2CmnyGZ9xqe8+Kghk5KJl X-Received: by 2002:a05:6122:2a4f:b0:518:8ac7:396b with SMTP id 71dfb90a1353d-51d5b3691b4mr22922816e0c.8.1737736312431; Fri, 24 Jan 2025 08:31:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736312; cv=none; d=google.com; s=arc-20240605; b=RsrXyBhKoBppP4Ur3fbacZx5YlfMtj5noCt8jGSf/wSUB5G8fy4ehM2ywbmF+Iprpc PBJGs6Pad5t3/OKHGcylomZwK0lGEYqBntIqlzu4cOqj23uojRLFv5aN7bmBpc7X4UY5 rOtwXALdzoxY2rGUmb/p6nwvB/lEPk8BCvtXI93WyuGtypzQ0Mx1jZpDxyqttpPRpcBV nrnKzXFrIunivxzxfeGtRszOGmqpXXQ1tqm+CHypj27QK0Izvk9urX6GIaYCik62FHk4 WVm/7nWEe/bqDKd5wrlrk5A6cw7r1Nn4RAb8W4PSWaEEygihU7t3xa+5a3rZ29ZYTu4I j04Q== 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=4Bgl+ZIxVXe0JFRcnJx8Zd9vTtPNDxDGEduc3gMGLhE=; fh=pPTIaZZGup33LJtNnacs1whkDctj7a4O9chSysYouHY=; b=UC+ddkCJYcgANaQMma9P4qYDFXNj6jFyA48Zk7LeUwbkcqObntdTBNbpP0NttVCBTK Vzr/uQDlnUW/ouWCY6gVV1FElkE15yHK1otqJVJdpZ4P9MVHr6E/+irClqIInMoFofg6 vS9dsZTcMXsi0LQtb1IEjoc8kvcb+HWDBfh6cTICYe0qle99mR7+OnO4LaQ7LffkY+qN XiaJ4vfvhVy8sWHZYT6d8mWBWAm0h1n+ffqFFKqThTU/vyKL1bXxW8QaPuT53baKPUWv d44dSX+IAE0J0Tr3fw23V+qS4KrNHkPlseiidbiDZskdkjIz/4gd56LOnNk5cjmT6kVw rpIA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NbObekRE; 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 71dfb90a1353d-51e4eccf1e6si923752e0c.267.2025.01.24.08.31.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:31:52 -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=NbObekRE; 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 1tbMYt-0005OV-Fl; Fri, 24 Jan 2025 11:29:39 -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 1tbMYd-0004Fs-LS for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:24 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYa-0005aV-3v for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:23 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4364a37a1d7so23481905e9.3 for ; Fri, 24 Jan 2025 08:29:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736159; x=1738340959; 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=4Bgl+ZIxVXe0JFRcnJx8Zd9vTtPNDxDGEduc3gMGLhE=; b=NbObekREb4g8E2a3l5qsq/7B7njOfV9rH1b/uffiCkBcjjUhwzKVWxXEYBno9zEdyY XyONPkttvd8xazHwWDU3Sq3v/0j9K4dFQ3mz1NVcko7R+Vtl+zdPDFs3ZwOoBAA/mlyk J7GbwD90y4QHN1ue2M7J1cXQ5oTJun0Nn4Xm7+yCs2sg4uxkZgV2nsxo4zBhnPaEomm5 pmd7inscEtHJp51I2yMk91H6lTrEc5C6yQeqDUk6VftEf+DWJ6hM/nOVHIZrj7FNAYru 7EMiuWQu9jbhyNUnkE2ZIaF1rdw5LFfgH8szJKKcIUW2P0BfOmgAfvsWTwQLtFpfEug2 kgQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736159; x=1738340959; 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=4Bgl+ZIxVXe0JFRcnJx8Zd9vTtPNDxDGEduc3gMGLhE=; b=sMSQSMSVn7jlsPtpJ8bHnVmAQgb588eEZKMTmLbHV0+CzrCm9GXcLkXGrtLelitHAe g27Mmaxi7xiloiPibUUVt7r08TsUOY4OiPyxyPV/cnaJJbsaQZTuzNmWQDvGhqL4v2Mh ZYIP/n8bK62Do1udMaIXXjo+L3CWQZt5+uxFoN4XH9uGD12dR9CNNHkITOyMQEviHRwY HIFQZW0CeNNwF2EnBBkJhVgfMrhFA6hYnHznrBhLGvjOVPiobxbHhSujiOnMRgcHv1+U 8MDxJ7MfunSePYd05UUFBRKk7VfbQA2twinLQZRqTLq5GPCdaHal8CE5Gsits52RIU5U 6vOg== X-Forwarded-Encrypted: i=1; AJvYcCVONy8Hx5z7DZbcbQGyaopDrBRv8nAzxfIUJEOuvzK0hGAArMpEE4h2lJe2gQ0Diw0J4Fhknh0+0tan@nongnu.org X-Gm-Message-State: AOJu0YxQ4qO6kLxEkuCUotqKGaD0mzS6P3KWeIcp78MVLVJ6EwIz0tSF Dcsk0+fvfpiKYVTJ9Fy7PHsRk7fNTNpR4PxMYuTntgY/uPkQUfu9gd7dtrmVGos= X-Gm-Gg: ASbGncvLLahT+sJtwI+vrnn/Yk+DGurSczxV9WSv+NPepFSZEaf4A0p0RMLrcDytV0V N4HAyC05XGQjxBBf7k54I5DgENkDM4P1EG+eN3536HbJI5HfBX1ZxWYFriKi3HrocICVXPX3ILN 3Qn6EIhMF8/CtwEqOXVsjQmX6H1kaVcsIW7ySSTwBx6cH7kL1cB0gY9QddjX7jEQKXqG7dSH88G HTCk9Upj6qKBBZiVV5+o+VVqJad/lpe3Quf7BCBCxcxadxAejPsmmx3Rq9bKVxPPZQA7IdD+K1A YXM/ZeSKcKc= X-Received: by 2002:a05:600c:34c9:b0:436:f975:29d with SMTP id 5b1f17b1804b1-438913bffd9mr286485905e9.6.1737736158666; Fri, 24 Jan 2025 08:29:18 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:17 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 32/76] target/arm: Set up float_status to use for FPCR.AH=1 behaviour Date: Fri, 24 Jan 2025 16:27:52 +0000 Message-Id: <20250124162836.2332150-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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 When FPCR.AH is 1, the behaviour of some instructions changes: * AdvSIMD BFCVT, BFCVTN, BFCVTN2, BFMLALB, BFMLALT * SVE BFCVT, BFCVTNT, BFMLALB, BFMLALT, BFMLSLB, BFMLSLT * SME BFCVT, BFCVTN, BFMLAL, BFMLSL (these are all in SME2 which QEMU does not yet implement) * FRECPE, FRECPS, FRECPX, FRSQRTE, FRSQRTS The behaviour change is: * the instructions do not update the FPSR cumulative exception flags * trapped floating point exceptions are disabled (a no-op for QEMU, which doesn't implement FPCR.{IDE,IXE,UFE,OFE,DZE,IOE}) * rounding is always round-to-nearest-even regardless of FPCR.RMode * denormalized inputs and outputs are always flushed to zero, as if FPCR.{FZ,FIZ} is {1,1} * FPCR.FZ16 is still honoured for half-precision inputs (See the Arm ARM DDI0487L.a section A1.5.9.) We can provide all these behaviours with another pair of float_status fields which we use only for these insns, when FPCR.AH is 1. These float_status fields will always have: * flush_to_zero and flush_inputs_to_zero set for the non-F16 field * rounding mode set to round-to-nearest-even and so the only FPCR fields they need to honour are DN and FZ16. In this commit we only define the new fp_status fields and give them the required behaviour when FPSR is updated. In subsequent commits we will arrange to use this new fp_status field for the instructions that should be affected by FPCR.AH in this way. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- I'm not super enthusiastic about the ah_fp_status naming, which sort of suggests it's always to be used when AH=1, rather than "for this specific group of insns when AH=1". But I couldn't think of a better name that was still reasonably short... --- target/arm/cpu.h | 15 +++++++++++++++ target/arm/internals.h | 2 ++ target/arm/tcg/translate.h | 14 ++++++++++++++ target/arm/cpu.c | 4 ++++ target/arm/vfp_helper.c | 13 ++++++++++++- 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c8b44c725d0..cfb16151577 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -640,6 +640,13 @@ typedef struct CPUArchState { * standard_fp_status : the ARM "Standard FPSCR Value" * standard_fp_status_fp16 : used for half-precision * calculations with the ARM "Standard FPSCR Value" + * ah_fp_status: used for the A64 insns which change behaviour + * when FPCR.AH == 1 (bfloat16 conversions and multiplies, + * and the reciprocal and square root estimate/step insns) + * ah_fp_status_f16: used for the A64 insns which change behaviour + * when FPCR.AH == 1 (bfloat16 conversions and multiplies, + * and the reciprocal and square root estimate/step insns); + * for half-precision * * Half-precision operations are governed by a separate * flush-to-zero control bit in FPSCR:FZ16. We pass a separate @@ -654,6 +661,12 @@ typedef struct CPUArchState { * the "standard FPSCR" tracks the FPSCR.FZ16 bit rather than * using a fixed value for it. * + * The ah_fp_status is needed because some insns have different + * behaviour when FPCR.AH == 1: they don't update cumulative + * exception flags, they act like FPCR.{FZ,FIZ} = {1,1} and + * they ignore FPCR.RMode. But they don't ignore FPCR.FZ16, + * which means we need an ah_fp_status_f16 as well. + * * To avoid having to transfer exception bits around, we simply * say that the FPSCR cumulative exception flags are the logical * OR of the flags in the four fp statuses. This relies on the @@ -666,6 +679,8 @@ typedef struct CPUArchState { float_status fp_status_f16_a64; float_status standard_fp_status; float_status standard_fp_status_f16; + float_status ah_fp_status; + float_status ah_fp_status_f16; uint64_t zcr_el[4]; /* ZCR_EL[1-3] */ uint64_t smcr_el[4]; /* SMCR_EL[1-3] */ diff --git a/target/arm/internals.h b/target/arm/internals.h index 98073acc276..b3187341456 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1831,5 +1831,7 @@ int alle1_tlbmask(CPUARMState *env); /* Set the float_status behaviour to match the Arm defaults */ void arm_set_default_fp_behaviours(float_status *s); +/* Set the float_status behaviour to match Arm FPCR.AH=1 behaviour */ +void arm_set_ah_fp_behaviours(float_status *s); #endif diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index c37c0b539e2..d6edd8db76b 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -676,6 +676,8 @@ typedef enum ARMFPStatusFlavour { FPST_FPCR_A64, FPST_FPCR_F16_A32, FPST_FPCR_F16_A64, + FPST_FPCR_AH, + FPST_FPCR_AH_F16, FPST_STD, FPST_STD_F16, } ARMFPStatusFlavour; @@ -696,6 +698,12 @@ typedef enum ARMFPStatusFlavour { * for AArch32 operations controlled by the FPCR where FPCR.FZ16 is to be used * FPST_FPCR_F16_A64 * for AArch64 operations controlled by the FPCR where FPCR.FZ16 is to be used + * FPST_FPCR_AH: + * for AArch64 operations which change behaviour when AH=1 (specifically, + * bfloat16 conversions and multiplies, and the reciprocal and square root + * estimate/step insns) + * FPST_FPCR_AH_F16: + * ditto, but for half-precision operations * FPST_STD * for A32/T32 Neon operations using the "standard FPSCR value" * FPST_STD_F16 @@ -719,6 +727,12 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) case FPST_FPCR_F16_A64: offset = offsetof(CPUARMState, vfp.fp_status_f16_a64); break; + case FPST_FPCR_AH: + offset = offsetof(CPUARMState, vfp.ah_fp_status); + break; + case FPST_FPCR_AH_F16: + offset = offsetof(CPUARMState, vfp.ah_fp_status_f16); + break; case FPST_STD: offset = offsetof(CPUARMState, vfp.standard_fp_status); break; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 1ba22c4c7aa..8fa220a7165 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -556,6 +556,10 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type) arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a32); arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a64); arm_set_default_fp_behaviours(&env->vfp.standard_fp_status_f16); + arm_set_ah_fp_behaviours(&env->vfp.ah_fp_status); + set_flush_to_zero(1, &env->vfp.ah_fp_status); + set_flush_inputs_to_zero(1, &env->vfp.ah_fp_status); + arm_set_ah_fp_behaviours(&env->vfp.ah_fp_status_f16); #ifndef CONFIG_USER_ONLY if (kvm_enabled()) { diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 2eb75bd7ecc..50a8a659577 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -64,7 +64,7 @@ void arm_set_default_fp_behaviours(float_status *s) * set Invalid for a QNaN * * default NaN has sign bit set, msb frac bit set */ -static void arm_set_ah_fp_behaviours(float_status *s) +void arm_set_ah_fp_behaviours(float_status *s) { set_float_detect_tininess(float_tininess_after_rounding, s); set_float_detect_ftz(detect_ftz_after_rounding, s); @@ -128,6 +128,11 @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env) a64_flags |= get_float_exception_flags(&env->vfp.fp_status_a64); a64_flags |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64) & ~(float_flag_input_denormal_flushed | float_flag_input_denormal_used)); + /* + * We do not merge in flags from ah_fp_status or ah_fp_status_f16, because + * they are used for insns that must not set the cumulative exception bits. + */ + /* * Flushing an input denormal only because FPCR.FIZ == 1 does * not set FPSR.IDC. So squash it unless (FPCR.AH == 0 && FPCR.FZ == 1). @@ -154,6 +159,8 @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env) set_float_exception_flags(0, &env->vfp.fp_status_f16_a64); set_float_exception_flags(0, &env->vfp.standard_fp_status); set_float_exception_flags(0, &env->vfp.standard_fp_status_f16); + set_float_exception_flags(0, &env->vfp.ah_fp_status); + set_float_exception_flags(0, &env->vfp.ah_fp_status_f16); } static void vfp_sync_and_clear_float_status_exc_flags(CPUARMState *env) @@ -199,9 +206,11 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32); set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64); set_flush_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16); + set_flush_to_zero(ftz_enabled, &env->vfp.ah_fp_status_f16); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64); set_flush_inputs_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16); + set_flush_inputs_to_zero(ftz_enabled, &env->vfp.ah_fp_status_f16); } if (changed & FPCR_FZ) { bool ftz_enabled = val & FPCR_FZ; @@ -225,6 +234,8 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask) set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32); set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64); + set_default_nan_mode(dnan_enabled, &env->vfp.ah_fp_status); + set_default_nan_mode(dnan_enabled, &env->vfp.ah_fp_status_f16); } if (changed & FPCR_AH) { bool ah_enabled = val & FPCR_AH; From patchwork Fri Jan 24 16:27:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859590 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp884494wrq; Fri, 24 Jan 2025 08:38:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX8TrTFjiDdoXqnWaZyZ+yRbSaW4nKCQV/1nAlLcXqkocbZXQ7EsYs3ieTaji4IdGIxKFCwQQ==@linaro.org X-Google-Smtp-Source: AGHT+IHne3loFSl1JAXa1waVDnq0U4wFrqKNxnRknESDjwlODHLPxB/gbwP5ZcsFHSslGvj249GX X-Received: by 2002:a05:622a:eca:b0:46e:541b:c80e with SMTP id d75a77b69052e-46e541bcae0mr145717791cf.20.1737736718944; Fri, 24 Jan 2025 08:38:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736718; cv=none; d=google.com; s=arc-20240605; b=AglW6XHfOW/TKVmyJIiPAmS4mNzgWvT2xXuBldS5+1yV2xxDv40d3ACq56UR9MTRgH XfnvkNAl2tljF6ztWhmBuBnpfZ/DNHWnV010ZI2mMBLdnr4xPrkb4FvVD1ByGq7a1ZEI Ek3uFbiRgSwV2zzBsgVEldH00xc7GBBA3+abvnvdjY0yY0rAqEz3gry0th6c91sIUvyv eEFEubZEvRgTJMgtTwSEWlUayX9QGTTPB61JlLL48fXU25debNXcMp91GCfMNCDAKZke RErTtGzqps2ZqHwRMp45oawA4ygYgUKFBQJv4WhgKkEepqhj3I16viMV357Temxov52P /aYQ== 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=93LX+X4AXwM0qFxvemfPcv53qM21psrPMCC/rMN0XCs=; fh=hSNSKWUlGnFcs+s1SHu1UvQciU0kjNGWvbTmppGcxEA=; b=h9Mwn40xoNzcQ0miao2KOzgSUtlliqlvlPxGRx4ffTYfWA8Lhn75ypkIL3wMR5b5KO v12FO4+hyTLrx8ZFxfzHr4Ih3AaRDCMxj+HUDlgcx2q/bysdZ+LeRNFEsNTjwWgALlaq hqCLzkb4OH5OlnTY2v+glUwfUmaRrPsltP5a2UrQpiMxRmm2TrQKs9OO9Jr45FQcXxjg HDzQ9GEEbHA+w862Exnx8VqHHICU6QUOmsss09Ww9X6DrOxmisTKhsAmgHDi3P/NrVsD KIAewfpHSq6ryaOCVHwsmxSIzOYIjAbU3ES+1A/n+Ji3UFVmRXmzHep0jA3Q6TUjyO6O r0pg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QfEd7mQs; 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-46e66bcd1d1si26274521cf.648.2025.01.24.08.38.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:38:38 -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=QfEd7mQs; 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 1tbMb2-00015M-MV; Fri, 24 Jan 2025 11:31:52 -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 1tbMYe-0004GI-3j for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:24 -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 1tbMYb-0005at-4h for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:23 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-436202dd730so16569225e9.2 for ; Fri, 24 Jan 2025 08:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736160; x=1738340960; 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=93LX+X4AXwM0qFxvemfPcv53qM21psrPMCC/rMN0XCs=; b=QfEd7mQs5rLXHUKJ25Va986mWNQbVrnmJaKT16JYY64+iqSNMIx1JHrVVQtXVHQ2pz lwouNGtWX3aJtOLNqz6h7IbOml2oIQ/3MpWyphWMctnmZSIIp8PLAmNuryRd3vnii7Oz 7mKPuWemvmjlCSoL7+cRFu4On3zikReMlgWFQsKELr/Je+m/4scp9h+eZCsB94uFh0KF ud+kZ6URiri/shW1ZMhYSmWuFtoOh1CoXNCBrQk2rpob+tdDWVwg6bK6JHqqjFozaV0j LX5dOTIi0B8JAmCmcv7UJcvAgn80LHoFxXYN1PrDCvo6P1zkB5UdvkQ7tlA0lEyYzRda ZVGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736160; x=1738340960; 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=93LX+X4AXwM0qFxvemfPcv53qM21psrPMCC/rMN0XCs=; b=ShmQQw5oa0qF1Kd0Wxtic3uHNoiAhsmNBcY5t/zNEWbq1J6A2QpAfY+lHHTCt6rPaZ AX2vVNyLSbcZTzloEc+agcwyRFK8KlYwYF7PAfNKsLwU0RMaT/VpdSlbhj238dcgMvK/ wJN0ijtsP1GCtb2V0yYbTD6Ag7Lzn9K4kiT8fTmJb0/WT5ukaelvTif+QXfn3e7cZNK3 AniY20zJwb7F2vie5dWx5Z2pfupjTALxF980fQz3Qq/+fu3FaCjEMWe67YQ62siao7v/ 5N1tl9LGnvzEAEA7AueZvuMaU/0uQhnjfoszwqC7bI6a8iO+5fZTiuw28Znf637AkCPp KR3Q== X-Forwarded-Encrypted: i=1; AJvYcCVJ2+XfdZCnpPFOwOnGD0s1lA0GQVWtYJf/0OwSi2CUhS6NmEx6NCo688i/RHNQimBUj82ZPl2FCd4W@nongnu.org X-Gm-Message-State: AOJu0YwcgUQcXI3cTE6nqyH18pdmuLTwng7AHPTxfEnY2zFDyHmKjkdH PtxlWiVa5nkp76tT3y4aYnUYgsJaIF/ZvjZgQZCm7gm26I0jqIbd/PB8laJ7R9I= X-Gm-Gg: ASbGncvMG+DZiZyYXf5YSjvDABxCX2/lcWZn0mV3BZmORFsfmmNxwl/AQtH5CTHeC7/ Xrqz/o5jNnosfS6H75+vAY/FEgeRzw9Nj/cNrf1ZJwc8QEas8fiWpFd4gfoz/YoOPIZSPmgwxJ3 2/vuBXwfi+tMyP9yo35kAWkHonLUU51N1EvcqMk/HpYnInoCP8QohA2AnuKpesfN7dCMqmfJ1X/ Ccw321WKO7RyuMEmQx8F7oq4JKPO0csIuDqaLpHwwC7FUZEVzOrikpp7yO6Fup9ss6mQku8VDxJ cGKg+haPmns= X-Received: by 2002:a05:600c:4508:b0:431:547e:81d0 with SMTP id 5b1f17b1804b1-438913e1c00mr334532585e9.11.1737736159695; Fri, 24 Jan 2025 08:29:19 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:18 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 33/76] target/arm: Use FPST_FPCR_AH for FRECPE, FRECPS, FRECPX, FRSQRTE, FRSQRTS Date: Fri, 24 Jan 2025 16:27:53 +0000 Message-Id: <20250124162836.2332150-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-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, T_SCC_BODY_TEXT_LINE=-0.01 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 For the instructions FRECPE, FRECPS, FRECPX, FRSQRTE, FRSQRTS, use FPST_FPCR_AH or FPST_FPCR_AH_F16 when FPCR.AH is 1, so that they get the required behaviour changes. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- select_fpst() is another function I'm not super happy wit hthe naming of, because again it should only be used for the subset of insns which have this particular behaviour, but the current name kind of implies more generality than that. Suggestions welcome. --- target/arm/tcg/translate.h | 13 ++++ target/arm/tcg/translate-a64.c | 119 +++++++++++++++++++++++++-------- target/arm/tcg/translate-sve.c | 30 ++++++--- 3 files changed, 127 insertions(+), 35 deletions(-) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index d6edd8db76b..680ca52a181 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -746,6 +746,19 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) return statusptr; } +/* + * Return the ARMFPStatusFlavour to use based on element size and + * whether FPCR.AH is set. + */ +static inline ARMFPStatusFlavour select_fpst(DisasContext *s, MemOp esz) +{ + if (s->fpcr_ah) { + return esz == MO_16 ? FPST_FPCR_AH_F16 : FPST_FPCR_AH; + } else { + return esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64; + } +} + /** * finalize_memop_atom: * @s: DisasContext diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 556da6d23cd..2a0c5e23e74 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -723,10 +723,10 @@ static void gen_gvec_op3_ool(DisasContext *s, bool is_q, int rd, * an out-of-line helper. */ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn, - int rm, bool is_fp16, int data, + int rm, ARMFPStatusFlavour fpsttype, int data, gen_helper_gvec_3_ptr *fn) { - TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); + TCGv_ptr fpst = fpstatus_ptr(fpsttype); tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), vec_full_reg_offset(s, rm), fpst, @@ -5036,14 +5036,16 @@ typedef struct FPScalar { void (*gen_d)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr); } FPScalar; -static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f) +static bool do_fp3_scalar_with_fpsttype(DisasContext *s, arg_rrr_e *a, + const FPScalar *f, + ARMFPStatusFlavour fpsttype) { switch (a->esz) { case MO_64: if (fp_access_check(s)) { TCGv_i64 t0 = read_fp_dreg(s, a->rn); TCGv_i64 t1 = read_fp_dreg(s, a->rm); - f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); + f->gen_d(t0, t0, t1, fpstatus_ptr(fpsttype)); write_fp_dreg(s, a->rd, t0); } break; @@ -5051,7 +5053,7 @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f) if (fp_access_check(s)) { TCGv_i32 t0 = read_fp_sreg(s, a->rn); TCGv_i32 t1 = read_fp_sreg(s, a->rm); - f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); + f->gen_s(t0, t0, t1, fpstatus_ptr(fpsttype)); write_fp_sreg(s, a->rd, t0); } break; @@ -5062,7 +5064,7 @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f) if (fp_access_check(s)) { TCGv_i32 t0 = read_fp_hreg(s, a->rn); TCGv_i32 t1 = read_fp_hreg(s, a->rm); - f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16_A64)); + f->gen_h(t0, t0, t1, fpstatus_ptr(fpsttype)); write_fp_sreg(s, a->rd, t0); } break; @@ -5072,6 +5074,18 @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f) return true; } +static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f) +{ + return do_fp3_scalar_with_fpsttype(s, a, f, + a->esz == MO_16 ? + FPST_FPCR_F16_A64 : FPST_FPCR_A64); +} + +static bool do_fp3_scalar_ah(DisasContext *s, arg_rrr_e *a, const FPScalar *f) +{ + return do_fp3_scalar_with_fpsttype(s, a, f, select_fpst(s, a->esz)); +} + static const FPScalar f_scalar_fadd = { gen_helper_vfp_addh, gen_helper_vfp_adds, @@ -5225,14 +5239,14 @@ static const FPScalar f_scalar_frecps = { gen_helper_recpsf_f32, gen_helper_recpsf_f64, }; -TRANS(FRECPS_s, do_fp3_scalar, a, &f_scalar_frecps) +TRANS(FRECPS_s, do_fp3_scalar_ah, a, &f_scalar_frecps) static const FPScalar f_scalar_frsqrts = { gen_helper_rsqrtsf_f16, gen_helper_rsqrtsf_f32, gen_helper_rsqrtsf_f64, }; -TRANS(FRSQRTS_s, do_fp3_scalar, a, &f_scalar_frsqrts) +TRANS(FRSQRTS_s, do_fp3_scalar_ah, a, &f_scalar_frsqrts) static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a, const FPScalar *f, bool swap) @@ -5483,8 +5497,10 @@ TRANS(CMHS_s, do_cmop_d, a, TCG_COND_GEU) TRANS(CMEQ_s, do_cmop_d, a, TCG_COND_EQ) TRANS(CMTST_s, do_cmop_d, a, TCG_COND_TSTNE) -static bool do_fp3_vector(DisasContext *s, arg_qrrr_e *a, int data, - gen_helper_gvec_3_ptr * const fns[3]) +static bool do_fp3_vector_with_fpsttype(DisasContext *s, arg_qrrr_e *a, + int data, + gen_helper_gvec_3_ptr * const fns[3], + ARMFPStatusFlavour fpsttype) { MemOp esz = a->esz; int check = fp_access_check_vector_hsd(s, a->q, esz); @@ -5493,11 +5509,26 @@ static bool do_fp3_vector(DisasContext *s, arg_qrrr_e *a, int data, return check == 0; } - gen_gvec_op3_fpst(s, a->q, a->rd, a->rn, a->rm, - esz == MO_16, data, fns[esz - 1]); + gen_gvec_op3_fpst(s, a->q, a->rd, a->rn, a->rm, fpsttype, + data, fns[esz - 1]); return true; } +static bool do_fp3_vector(DisasContext *s, arg_qrrr_e *a, int data, + gen_helper_gvec_3_ptr * const fns[3]) +{ + return do_fp3_vector_with_fpsttype(s, a, data, fns, + a->esz == MO_16 ? + FPST_FPCR_F16_A64 :FPST_FPCR_A64); +} + +static bool do_fp3_vector_ah(DisasContext *s, arg_qrrr_e *a, int data, + gen_helper_gvec_3_ptr * const f[3]) +{ + return do_fp3_vector_with_fpsttype(s, a, data, f, + select_fpst(s, a->esz)); +} + static gen_helper_gvec_3_ptr * const f_vector_fadd[3] = { gen_helper_gvec_fadd_h, gen_helper_gvec_fadd_s, @@ -5622,14 +5653,14 @@ static gen_helper_gvec_3_ptr * const f_vector_frecps[3] = { gen_helper_gvec_recps_s, gen_helper_gvec_recps_d, }; -TRANS(FRECPS_v, do_fp3_vector, a, 0, f_vector_frecps) +TRANS(FRECPS_v, do_fp3_vector_ah, a, 0, f_vector_frecps) static gen_helper_gvec_3_ptr * const f_vector_frsqrts[3] = { gen_helper_gvec_rsqrts_h, gen_helper_gvec_rsqrts_s, gen_helper_gvec_rsqrts_d, }; -TRANS(FRSQRTS_v, do_fp3_vector, a, 0, f_vector_frsqrts) +TRANS(FRSQRTS_v, do_fp3_vector_ah, a, 0, f_vector_frsqrts) static gen_helper_gvec_3_ptr * const f_vector_faddp[3] = { gen_helper_gvec_faddp_h, @@ -6385,7 +6416,8 @@ static bool do_fp3_vector_idx(DisasContext *s, arg_qrrx_e *a, } gen_gvec_op3_fpst(s, a->q, a->rd, a->rn, a->rm, - esz == MO_16, a->idx, fns[esz - 1]); + esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64, + a->idx, fns[esz - 1]); return true; } @@ -8394,8 +8426,9 @@ typedef struct FPScalar1 { void (*gen_d)(TCGv_i64, TCGv_i64, TCGv_ptr); } FPScalar1; -static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a, - const FPScalar1 *f, int rmode) +static bool do_fp1_scalar_with_fpsttype(DisasContext *s, arg_rr_e *a, + const FPScalar1 *f, int rmode, + ARMFPStatusFlavour fpsttype) { TCGv_i32 tcg_rmode = NULL; TCGv_ptr fpst; @@ -8407,7 +8440,7 @@ static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a, return check == 0; } - fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); + fpst = fpstatus_ptr(fpsttype); if (rmode >= 0) { tcg_rmode = gen_set_rmode(rmode, fpst); } @@ -8438,6 +8471,20 @@ static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a, return true; } +static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a, + const FPScalar1 *f, int rmode) +{ + return do_fp1_scalar_with_fpsttype(s, a, f, rmode, + a->esz == MO_16 ? + FPST_FPCR_F16_A64 : FPST_FPCR_A64); +} + +static bool do_fp1_scalar_ah(DisasContext *s, arg_rr_e *a, + const FPScalar1 *f, int rmode) +{ + return do_fp1_scalar_with_fpsttype(s, a, f, rmode, select_fpst(s, a->esz)); +} + static const FPScalar1 f_scalar_fsqrt = { gen_helper_vfp_sqrth, gen_helper_vfp_sqrts, @@ -8492,21 +8539,21 @@ static const FPScalar1 f_scalar_frecpe = { gen_helper_recpe_f32, gen_helper_recpe_f64, }; -TRANS(FRECPE_s, do_fp1_scalar, a, &f_scalar_frecpe, -1) +TRANS(FRECPE_s, do_fp1_scalar_ah, a, &f_scalar_frecpe, -1) static const FPScalar1 f_scalar_frecpx = { gen_helper_frecpx_f16, gen_helper_frecpx_f32, gen_helper_frecpx_f64, }; -TRANS(FRECPX_s, do_fp1_scalar, a, &f_scalar_frecpx, -1) +TRANS(FRECPX_s, do_fp1_scalar_ah, a, &f_scalar_frecpx, -1) static const FPScalar1 f_scalar_frsqrte = { gen_helper_rsqrte_f16, gen_helper_rsqrte_f32, gen_helper_rsqrte_f64, }; -TRANS(FRSQRTE_s, do_fp1_scalar, a, &f_scalar_frsqrte, -1) +TRANS(FRSQRTE_s, do_fp1_scalar_ah, a, &f_scalar_frsqrte, -1) static bool trans_FCVT_s_ds(DisasContext *s, arg_rr *a) { @@ -9361,9 +9408,10 @@ TRANS_FEAT(FRINT64Z_v, aa64_frint, do_fp1_vector, a, &f_scalar_frint64, FPROUNDING_ZERO) TRANS_FEAT(FRINT64X_v, aa64_frint, do_fp1_vector, a, &f_scalar_frint64, -1) -static bool do_gvec_op2_fpst(DisasContext *s, MemOp esz, bool is_q, - int rd, int rn, int data, - gen_helper_gvec_2_ptr * const fns[3]) +static bool do_gvec_op2_fpst_with_fpsttype(DisasContext *s, MemOp esz, + bool is_q, int rd, int rn, int data, + gen_helper_gvec_2_ptr * const fns[3], + ARMFPStatusFlavour fpsttype) { int check = fp_access_check_vector_hsd(s, is_q, esz); TCGv_ptr fpst; @@ -9372,7 +9420,7 @@ static bool do_gvec_op2_fpst(DisasContext *s, MemOp esz, bool is_q, return check == 0; } - fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); + fpst = fpstatus_ptr(fpsttype); tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), fpst, is_q ? 16 : 8, vec_full_reg_size(s), @@ -9380,6 +9428,23 @@ static bool do_gvec_op2_fpst(DisasContext *s, MemOp esz, bool is_q, return true; } +static bool do_gvec_op2_fpst(DisasContext *s, MemOp esz, bool is_q, + int rd, int rn, int data, + gen_helper_gvec_2_ptr * const fns[3]) +{ + return do_gvec_op2_fpst_with_fpsttype(s, esz, is_q, rd, rn, data, fns, + esz == MO_16 ? FPST_FPCR_F16_A64 : + FPST_FPCR_A64); +} + +static bool do_gvec_op2_ah_fpst(DisasContext *s, MemOp esz, bool is_q, + int rd, int rn, int data, + gen_helper_gvec_2_ptr * const fns[3]) +{ + return do_gvec_op2_fpst_with_fpsttype(s, esz, is_q, rd, rn, data, + fns, select_fpst(s, esz)); +} + static gen_helper_gvec_2_ptr * const f_scvtf_v[] = { gen_helper_gvec_vcvt_sh, gen_helper_gvec_vcvt_sf, @@ -9489,14 +9554,14 @@ static gen_helper_gvec_2_ptr * const f_frecpe[] = { gen_helper_gvec_frecpe_s, gen_helper_gvec_frecpe_d, }; -TRANS(FRECPE_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frecpe) +TRANS(FRECPE_v, do_gvec_op2_ah_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frecpe) static gen_helper_gvec_2_ptr * const f_frsqrte[] = { gen_helper_gvec_frsqrte_h, gen_helper_gvec_frsqrte_s, gen_helper_gvec_frsqrte_d, }; -TRANS(FRSQRTE_v, do_gvec_op2_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frsqrte) +TRANS(FRSQRTE_v, do_gvec_op2_ah_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frsqrte) static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a) { diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index fc7f0d077a5..8ed8677baa8 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -137,11 +137,11 @@ static bool gen_gvec_fpst_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn, return true; } -static bool gen_gvec_fpst_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn, - arg_rr_esz *a, int data) +static bool gen_gvec_fpst_ah_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn, + arg_rr_esz *a, int data) { return gen_gvec_fpst_zz(s, fn, a->rd, a->rn, data, - a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); + select_fpst(s, a->esz)); } /* Invoke an out-of-line helper on 3 Zregs. */ @@ -194,6 +194,13 @@ static bool gen_gvec_fpst_arg_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn, a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); } +static bool gen_gvec_fpst_ah_arg_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn, + arg_rrr_esz *a, int data) +{ + return gen_gvec_fpst_zzz(s, fn, a->rd, a->rn, a->rm, data, + select_fpst(s, a->esz)); +} + /* Invoke an out-of-line helper on 4 Zregs. */ static bool gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, int rd, int rn, int rm, int ra, int data) @@ -3597,13 +3604,13 @@ static gen_helper_gvec_2_ptr * const frecpe_fns[] = { NULL, gen_helper_gvec_frecpe_h, gen_helper_gvec_frecpe_s, gen_helper_gvec_frecpe_d, }; -TRANS_FEAT(FRECPE, aa64_sve, gen_gvec_fpst_arg_zz, frecpe_fns[a->esz], a, 0) +TRANS_FEAT(FRECPE, aa64_sve, gen_gvec_fpst_ah_arg_zz, frecpe_fns[a->esz], a, 0) static gen_helper_gvec_2_ptr * const frsqrte_fns[] = { NULL, gen_helper_gvec_frsqrte_h, gen_helper_gvec_frsqrte_s, gen_helper_gvec_frsqrte_d, }; -TRANS_FEAT(FRSQRTE, aa64_sve, gen_gvec_fpst_arg_zz, frsqrte_fns[a->esz], a, 0) +TRANS_FEAT(FRSQRTE, aa64_sve, gen_gvec_fpst_ah_arg_zz, frsqrte_fns[a->esz], a, 0) /* *** SVE Floating Point Compare with Zero Group @@ -3707,11 +3714,18 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) }; \ TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_arg_zzz, name##_fns[a->esz], a, 0) +#define DO_FP3_AH(NAME, name) \ + static gen_helper_gvec_3_ptr * const name##_fns[4] = { \ + NULL, gen_helper_gvec_##name##_h, \ + gen_helper_gvec_##name##_s, gen_helper_gvec_##name##_d \ + }; \ + TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_ah_arg_zzz, name##_fns[a->esz], a, 0) + DO_FP3(FADD_zzz, fadd) DO_FP3(FSUB_zzz, fsub) DO_FP3(FMUL_zzz, fmul) -DO_FP3(FRECPS, recps) -DO_FP3(FRSQRTS, rsqrts) +DO_FP3_AH(FRECPS, recps) +DO_FP3_AH(FRSQRTS, rsqrts) #undef DO_FP3 @@ -3993,7 +4007,7 @@ static gen_helper_gvec_3_ptr * const frecpx_fns[] = { gen_helper_sve_frecpx_s, gen_helper_sve_frecpx_d, }; TRANS_FEAT(FRECPX, aa64_sve, gen_gvec_fpst_arg_zpz, frecpx_fns[a->esz], - a, 0, a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) + a, 0, select_fpst(s, a->esz)) static gen_helper_gvec_3_ptr * const fsqrt_fns[] = { NULL, gen_helper_sve_fsqrt_h, From patchwork Fri Jan 24 16:27:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859627 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp892159wrq; Fri, 24 Jan 2025 08:56:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUDEk9Qf5X5J/mpbxz3noZvk9a3sbXw46c61R8xUMZPJaPSPGHXzeLUE0a20YSV53LohMPmaQ==@linaro.org X-Google-Smtp-Source: AGHT+IH9R2IBCMuqIeJl8tn02tI8xQLkkUNu0cbQuwpLJOBw+jHHEFaMtWwTxGrw5Oy2ydFVgU6A X-Received: by 2002:a05:6102:5043:b0:4b1:1a11:9628 with SMTP id ada2fe7eead31-4b690cf43b7mr29917531137.24.1737737803919; Fri, 24 Jan 2025 08:56:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737803; cv=none; d=google.com; s=arc-20240605; b=BtkRi/wrYjGZlgsLFeZc9pIsW+Emb57zcJ/7erJPSJ+p6A7/45iBSAMEo69jLRHeME nUvMOrIKRbqw45h5Zw2ZJ1XnFdk5xntr+UW8mdZXxXXRuWWFQi24PMLMflYVefb7xLXh AYJK/OHofeTLTZyp27BGhKmENSDiUQgMt6vuXYkkKa/HP8vvKD3oF4TXx0vJ9ZVf7RUJ QkIuZE1M1AKkmcfZaPLQYmXhvvD79p5+vzEaWq+rRuqU2dOjC214p5xoTxWrnBtRdgec /8T6WbSM/tYnGrm7umBrXCaVe779BS47Fhw8lyMNnVzycgOH5+5H1+sE68dXBoRkPFVQ nV5g== 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=TAgJkg+zZafmqGOr1+zR48fm7oDoeLOlWLNiEgXtZlc=; fh=3xAun4NMo6JP+m495W2Uwvwlry/9On+vcMbVPVu+LKM=; b=C8KhHoPUNbkupcr315RBN/L0bxihsoNLwPFPkStqjkzdTanPrSTEdUoTpNIgIEyuGL tnnq0A5L3GIbjT3gBo/KfKZk5y090R+eYuXncrfSQUGCgD5tTdolgEg9krG5S7z7346e wW+XMshaHV/1t0MdOfwoHPIeymqvlCyY1ENAKGpSrJqV6xB3etEpztPqA1t+72Vx2UBL mGiEyI/cJGBWHCpohUjgDgvT40dF5PpgUjNZlLIlUz5x9VkzXuvQ8kBo02Vmv1g90x5i LFTSTGwgokq4lOvxcfQ8+ot7J5hJccci4VV/MWNuNVZJOIf66CWvKVFVcKJM9hlOIYat rOxw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CzYdFop9; 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 a1e0cc1a2514c-864a9d0ae32si685466241.153.2025.01.24.08.56.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:56:43 -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=CzYdFop9; 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 1tbMax-0000Qw-K9; Fri, 24 Jan 2025 11:31:47 -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 1tbMYf-0004Hj-0a for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:25 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYc-0005b6-5b for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:24 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43621d27adeso15731815e9.2 for ; Fri, 24 Jan 2025 08:29:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736161; x=1738340961; 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=TAgJkg+zZafmqGOr1+zR48fm7oDoeLOlWLNiEgXtZlc=; b=CzYdFop9o4W33OuexZDPqeNpYBlYBDcnK1SbFq1MHRtVeoQScxk0cLDIESYuXCkLR8 CZbvPdnorTKCH7jVkeYWVL1t+Hf5lgsAOmK9udxgmx/YADKMG1Xlb1IvDOHqdlkNCXRv HYmAZJ3dsoc+mwi1GKxyWKzyzvuHHRgO2WbF3vXVRc3tedzECblb+YLy8FDSDFsUHsIJ a1nW4P2S7EdTtUGj0qfcmXxVUrIhtC2RgT0Ang2F6DrYh7cs5SqcK71z3UI+9F++xNtL Ub7BxWQOC2rG+jb9Q5AbHfpfshRg5DGiqmetPJhLF0U/DnfRF8rmwty5QF21431L/K2e W/Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736161; x=1738340961; 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=TAgJkg+zZafmqGOr1+zR48fm7oDoeLOlWLNiEgXtZlc=; b=ti50kGtODcmU7EON6c2s2ibyuNx0KH1NDO0AKDNIoUFgX3o9Cpc3Q+MUptVxWlQpC9 5YDear1hasGdCznRobWlWtLGRqEHWj2irdeqnK2/4N323cyU3P+beCo4Ps74TxNXhQsl X3K3JgR5o8x05epVnEajnIFIjKHHPflW1xVJkf18rvRWQ8CUUy2r5J9ab0vvieDRqeM5 pMp4Gu7l3y1A+40/I9Ig0fRNTHgsaZFkPDu0J9htpmxYpEpm7IKSD88/+e35vI71MzD6 dMQTK0rpbHPBvJNl9Biz4JG2MftWXeVgV+yfatyLbcS/hF5wIZ2eDOXe6WB2RG7rJvI/ 6iWA== X-Forwarded-Encrypted: i=1; AJvYcCUOcRnowUDmw96vLJh5h1gF2GVBu2aE5YqyPwLbTiIPoTS2PSz/CTNtHogppDhJl/IOATs5KIDCl7H9@nongnu.org X-Gm-Message-State: AOJu0YzzpvSOQXftCWhyxSN48A7tuf8zOBNdNe7181O1iRdCXzBiflHn l6fi4Zn0cxK1MEn0ZuWu+7ZSnVxiJczBz95mMeAXUEn4xtuVgW3uzMnJb1HJadA= X-Gm-Gg: ASbGncv6xRaLKqTp8XqF7JYXforgc7ZrW7SiVCq9RHwdkJwB2SE1Uw69SKjxKgUkUZP pZ6qNX3BXhYoYMiIFj+TyXkuBT/rFqHfGBVGs6i48z+xcrMZXg7NVDgYPE2MxvnveoMjoM0Df4m fM1iF50owSYda0IWLxpoTUlb3AL1mhhAFxBHOePPHitbS7wgWoNGkYClIf85nHG7OF3y19X/2Zg zC8iivA1XwDC68Gh8J84nLghpoxH32T+8YAo9YXDwLyUV5hjassceu3xbhr57XvzoWMT9hLDnpw as5WytdozXM= X-Received: by 2002:a05:600c:348f:b0:430:563a:b20a with SMTP id 5b1f17b1804b1-438913d693bmr339733895e9.11.1737736160692; Fri, 24 Jan 2025 08:29: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-438bd47eecasm31683025e9.6.2025.01.24.08.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:20 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 34/76] target/arm: Use FPST_FPCR_AH for BFCVT* insns Date: Fri, 24 Jan 2025 16:27:54 +0000 Message-Id: <20250124162836.2332150-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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, T_SCC_BODY_TEXT_LINE=-0.01 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 When FPCR.AH is 1, use FPST_FPCR_AH for: * AdvSIMD BFCVT, BFCVTN, BFCVTN2 * SVE BFCVT, BFCVTNT so that they get the required behaviour changes. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 27 +++++++++++++++++++++------ target/arm/tcg/translate-sve.c | 6 ++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 2a0c5e23e74..d53864ad794 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8514,7 +8514,7 @@ TRANS(FRINTX_s, do_fp1_scalar, a, &f_scalar_frintx, -1) static const FPScalar1 f_scalar_bfcvt = { .gen_s = gen_helper_bfcvt, }; -TRANS_FEAT(BFCVT_s, aa64_bf16, do_fp1_scalar, a, &f_scalar_bfcvt, -1) +TRANS_FEAT(BFCVT_s, aa64_bf16, do_fp1_scalar_ah, a, &f_scalar_bfcvt, -1) static const FPScalar1 f_scalar_frint32 = { NULL, @@ -9290,12 +9290,27 @@ static void gen_bfcvtn_hs(TCGv_i64 d, TCGv_i64 n) tcg_gen_extu_i32_i64(d, tmp); } -static ArithOneOp * const f_vector_bfcvtn[] = { - NULL, - gen_bfcvtn_hs, - NULL, +static void gen_bfcvtn_ah_hs(TCGv_i64 d, TCGv_i64 n) +{ + TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_AH); + TCGv_i32 tmp = tcg_temp_new_i32(); + gen_helper_bfcvt_pair(tmp, n, fpst); + tcg_gen_extu_i32_i64(d, tmp); +} + +static ArithOneOp * const f_vector_bfcvtn[2][3] = { + { + NULL, + gen_bfcvtn_hs, + NULL, + }, { + NULL, + gen_bfcvtn_ah_hs, + NULL, + } }; -TRANS_FEAT(BFCVTN_v, aa64_bf16, do_2misc_narrow_vector, a, f_vector_bfcvtn) +TRANS_FEAT(BFCVTN_v, aa64_bf16, do_2misc_narrow_vector, a, + f_vector_bfcvtn[s->fpcr_ah]) static bool trans_SHLL_v(DisasContext *s, arg_qrr_e *a) { diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 8ed8677baa8..4d77b55d545 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3904,7 +3904,8 @@ TRANS_FEAT(FCVT_hs, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_fcvt_hs, a, 0, FPST_FPCR_F16_A64) TRANS_FEAT(BFCVT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, - gen_helper_sve_bfcvt, a, 0, FPST_FPCR_A64) + gen_helper_sve_bfcvt, a, 0, + s->fpcr_ah ? FPST_FPCR_AH : FPST_FPCR_A64) TRANS_FEAT(FCVT_dh, aa64_sve, gen_gvec_fpst_arg_zpz, gen_helper_sve_fcvt_dh, a, 0, FPST_FPCR_A64) @@ -7054,7 +7055,8 @@ TRANS_FEAT(FCVTNT_ds, aa64_sve2, gen_gvec_fpst_arg_zpz, gen_helper_sve2_fcvtnt_ds, a, 0, FPST_FPCR_A64) TRANS_FEAT(BFCVTNT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, - gen_helper_sve_bfcvtnt, a, 0, FPST_FPCR_A64) + gen_helper_sve_bfcvtnt, a, 0, + s->fpcr_ah ? FPST_FPCR_AH : FPST_FPCR_A64) TRANS_FEAT(FCVTLT_hs, aa64_sve2, gen_gvec_fpst_arg_zpz, gen_helper_sve2_fcvtlt_hs, a, 0, FPST_FPCR_A64) From patchwork Fri Jan 24 16:27:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859604 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp887344wrq; Fri, 24 Jan 2025 08:45:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVr+5n8JrmqK3xC3dslPmQAQOx7dT/qolmELPwKXAP2phcW9v9TbpyCWytDoisqSwW2P3n+dQ==@linaro.org X-Google-Smtp-Source: AGHT+IGRd0lc1SsXeE44I4fPPbeFrCcImC0SienY7CFd9e/RVEmglxQfp1KI1iNaTxZF71NStjb9 X-Received: by 2002:a05:6102:374d:b0:4b6:cf06:f892 with SMTP id ada2fe7eead31-4b6cf06fbccmr16975260137.1.1737737128596; Fri, 24 Jan 2025 08:45:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737128; cv=none; d=google.com; s=arc-20240605; b=MhmxpSVbiXTK6evVoZ4E8RVVmenqBI4KSSJ7q3ibHIlTWQJZcV2xUE/qN3Ok5gIyHX /2MzhBGN9oI5y56vPju8colWrLhpqsW+QfCxtzDfGDhcRleryiMe7BxcwpCymvD1K9aB 5dZN2IWdvpKVmZ2oVdqkVZiA7D3CQE2J2FUdiVbMm67B5LVvmg1SuJkCI27MYZNYWxaR Zql97TNNo6TWAypfGGkjhDY91ypEVTPYvNlsF4mm30yvrgzSVdrTCnj80jCRw7g+Eebx 8TSYvfBZBnQ0R68hKMEBtmAYmkSI/ZAmVCSFiEivPGCYO2/kKOGmoUezhU/Do1wwHa+4 U2sg== 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=2VLdsf7Pn6hVzCCffEPe1bVqQf+9Fb334tfF7e6kw7Y=; fh=FTo1PoN/FSAjvrTc5FWnVXrxRVa9CpkQRy7Vq7nUEB8=; b=Woe88Vp2QxwAzqdjg5n3PMMviYAzwcURuDqBj2xSUFnlL9Lk6R0ysixyoYFbgOVheN EUDWOp8Pu1iL00aLeu4qZcG2K3Ledmq5Jn+IFKGOKbVyXL+AwYfwQAdh/7cMTnGdpMQK NhljSbKuz3mR+cM40nlJVwmrw1NHkHd9ADhjmR4YVqZyQqkyjix5SwnDIi2ZH79B6uXm k94vAYwiS2MpjezB0a4MLRuTeelC94ckl9JvHjLFiaDaTDTbe8MjGsSYgv70qwwe4QbQ wQZzT1QlK+U8li5V/A618Ll+aipgxgm2UPFUb4iqN43bpX+51fYkzHUDpJwG//q5uCO+ 71BQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eHMaIdcV; 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 ada2fe7eead31-4b7097529f9si1004430137.48.2025.01.24.08.45.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:45:28 -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=eHMaIdcV; 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 1tbMbA-00026a-8z; Fri, 24 Jan 2025 11:32:01 -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 1tbMYg-0004P2-Do for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:26 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYe-0005be-7K for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:26 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-43624b2d453so24607945e9.2 for ; Fri, 24 Jan 2025 08:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736162; x=1738340962; 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=2VLdsf7Pn6hVzCCffEPe1bVqQf+9Fb334tfF7e6kw7Y=; b=eHMaIdcVHd+fSZeR0iCvT8uDUnM3PYM0dEwUAiucbKXfwfPRcXmiU2/Jg5H00EvWh3 e+wIZz7whuJpbY1NPv3Ynkfis5n6RlfTYgk8T7PdjZ+Kgkrqtugo+/jppLv+FVX9BSIS d28Ab4x7TBelZ5yAOR407KlGTL0Fgk61Fa+yf42t8nnQFEgkj/4tqQNrpW+nPBtHDNMf OcOvvq3zbDWhxzKVIKK6q3SgkVzsxTLR7j3MK8om/KWW1k1wQY65mQJ5ZJlYz4Z/Dy0r 88lh7HDQQocY6hIvxboD7r2+43HGBnYaeQNKw6S1gfFmO3dETr1saxxbAoKy0Gmi//eD SNQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736162; x=1738340962; 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=2VLdsf7Pn6hVzCCffEPe1bVqQf+9Fb334tfF7e6kw7Y=; b=CKr7t0wx6YYAwVIMqBc/jqEkHoZqlpKXDQuW+4mS7flSvOdPJaRacXFpGEH9Dkbyoi Q0EZUd9/NY7ntixfjEKVGHt7J8zF3SFPgE9pUlVo/h9iX8OyqnmmH6jbymrlyestLHRv mjCAqPvMjo9ygXncoi/5RkjT1X7N6cDlieJ/Nc1S23HPJlK8wqDnT/VZNZo1CmV3D4z6 Z4wGw1QRl1GrwWifq/08wzyNycPGqd0uC3aJun4EoA1akZ2CFsHHACv84+2jAs7l4oAy WnX9RkZ8jeZYz7ow7hvxY1+VXOxSgi+0rGwfmF2RURdHp32c7z5N6bCHQZVRvSevMOqU o7+g== X-Forwarded-Encrypted: i=1; AJvYcCVL9YIkMmuVzLVOKf5R/90sGNvcwObwteFaP0kKM9EmKLA6aNhDaEEuSX6vuFMnLkzYXmiUTvdbsOtC@nongnu.org X-Gm-Message-State: AOJu0YwLDMaMKwXnml6fTAwHtNQXuAtAboRsFRjMkFvY22KdSEL4xcMV 3lgaiUBp4y+vYz/UzOITvAdaAZRsTCoI8HsRaN2nMMVBPNMXDWbZ3c7ACHcsm/eM8K1PtnD1iBi d X-Gm-Gg: ASbGncu72mfrNfEX8XLbTxgdwaXUgqbiJfxwh2rICyA/0vhG7tZuwOhtsiFHe2Qvr/2 c9i1w+1l+Tt4NARiYtvecziplXyJcLsO6Q2gdKtgo5Oia6vU8cNJ2l/JNu+xXRQ7kpTUeYgiRDK oMxheVWwczBUcjLphgKsKqbOTNdQLmMcEojQr8tO7iLajoGJw/GKnxevCiKnynBv8+kBK4Vy4mX qa9stjPyBMtcLgXm9PJzQZmcg7bBctZKAvS00xpc/5W44zP5GkgGCLv7YtYB1uuFEXqcESnvXns vM68Acjglyw= X-Received: by 2002:a05:600c:1c1e:b0:436:6460:e67a with SMTP id 5b1f17b1804b1-43891452899mr251176375e9.25.1737736161721; Fri, 24 Jan 2025 08:29:21 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:21 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 35/76] target/arm: Use FPST_FPCR_AH for BFMLAL*, BFMLSL* insns Date: Fri, 24 Jan 2025 16:27:55 +0000 Message-Id: <20250124162836.2332150-36-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 When FPCR.AH is 1, use FPST_FPCR_AH for: * AdvSIMD BFMLALB, BFMLALT * SVE BFMLALB, BFMLALT, BFMLSLB, BFMLSLT so that they get the required behaviour changes. We do this by making gen_gvec_op4_fpst() take an ARMFPStatusFlavour rather than a bool is_fp16; existing callsites now select FPST_FPCR_F16_A64 vs FPST_FPCR_A64 themselves rather than passing in the boolean. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 20 +++++++++++++------- target/arm/tcg/translate-sve.c | 6 ++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index d53864ad794..0b3e4ec136d 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -765,10 +765,11 @@ static void gen_gvec_op4_env(DisasContext *s, bool is_q, int rd, int rn, * an out-of-line helper. */ static void gen_gvec_op4_fpst(DisasContext *s, bool is_q, int rd, int rn, - int rm, int ra, bool is_fp16, int data, + int rm, int ra, ARMFPStatusFlavour fpsttype, + int data, gen_helper_gvec_4_ptr *fn) { - TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); + TCGv_ptr fpst = fpstatus_ptr(fpsttype); tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, rd), vec_full_reg_offset(s, rn), vec_full_reg_offset(s, rm), @@ -5837,7 +5838,8 @@ static bool trans_BFMLAL_v(DisasContext *s, arg_qrrr_e *a) } if (fp_access_check(s)) { /* Q bit selects BFMLALB vs BFMLALT. */ - gen_gvec_op4_fpst(s, true, a->rd, a->rn, a->rm, a->rd, false, a->q, + gen_gvec_op4_fpst(s, true, a->rd, a->rn, a->rm, a->rd, + s->fpcr_ah ? FPST_FPCR_AH : FPST_FPCR_A64, a->q, gen_helper_gvec_bfmlal); } return true; @@ -5870,7 +5872,8 @@ static bool trans_FCMLA_v(DisasContext *s, arg_FCMLA_v *a) } gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd, - a->esz == MO_16, a->rot, fn[a->esz]); + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64, + a->rot, fn[a->esz]); return true; } @@ -6450,7 +6453,8 @@ static bool do_fmla_vector_idx(DisasContext *s, arg_qrrx_e *a, bool neg) } gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd, - esz == MO_16, (a->idx << 1) | neg, + esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64, + (a->idx << 1) | neg, fns[esz - 1]); return true; } @@ -6585,7 +6589,8 @@ static bool trans_BFMLAL_vi(DisasContext *s, arg_qrrx_e *a) } if (fp_access_check(s)) { /* Q bit selects BFMLALB vs BFMLALT. */ - gen_gvec_op4_fpst(s, true, a->rd, a->rn, a->rm, a->rd, 0, + gen_gvec_op4_fpst(s, true, a->rd, a->rn, a->rm, a->rd, + s->fpcr_ah ? FPST_FPCR_AH : FPST_FPCR_A64, (a->idx << 1) | a->q, gen_helper_gvec_bfmlal_idx); } @@ -6614,7 +6619,8 @@ static bool trans_FCMLA_vi(DisasContext *s, arg_FCMLA_vi *a) } if (fp_access_check(s)) { gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd, - a->esz == MO_16, (a->idx << 2) | a->rot, fn); + a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64, + (a->idx << 2) | a->rot, fn); } return true; } diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 4d77b55d545..ad415c43565 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -7117,7 +7117,8 @@ TRANS_FEAT_NONSTREAMING(BFMMLA, aa64_sve_bf16, gen_gvec_env_arg_zzzz, static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) { return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal, - a->rd, a->rn, a->rm, a->ra, sel, FPST_FPCR_A64); + a->rd, a->rn, a->rm, a->ra, sel, + s->fpcr_ah ? FPST_FPCR_AH : FPST_FPCR_A64); } TRANS_FEAT(BFMLALB_zzzw, aa64_sve_bf16, do_BFMLAL_zzzw, a, false) @@ -7127,7 +7128,8 @@ static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sel) { return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal_idx, a->rd, a->rn, a->rm, a->ra, - (a->index << 1) | sel, FPST_FPCR_A64); + (a->index << 1) | sel, + s->fpcr_ah ? FPST_FPCR_AH : FPST_FPCR_A64); } TRANS_FEAT(BFMLALB_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, false) From patchwork Fri Jan 24 16:27:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859597 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp885971wrq; Fri, 24 Jan 2025 08:42:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV9bJ20aWKi3uhCWUCChLu+eQiOZq1QpG17/NWt2OJMdtXfiVmf0soyLvgVxxcyZA5snykewg==@linaro.org X-Google-Smtp-Source: AGHT+IGz8XbUeF6FBOPT6ednC5QiEeUEqTHpXEyuoGGEkpnwnmFiEDI6PyDLfHHpjWv9GV0YDj/z X-Received: by 2002:ad4:5c8b:0:b0:6d8:9dad:e167 with SMTP id 6a1803df08f44-6e1b2175899mr476960676d6.15.1737736920299; Fri, 24 Jan 2025 08:42:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736920; cv=none; d=google.com; s=arc-20240605; b=e//qARhKM+YoN1B4PmRc1AdTj9771Hl0bIidsigtWDSG7+t91hGQvwNL1KT+FlkIw+ wpiiOnZNqzC4AJHV9lJh2MGcYcRnTkj1kVBk9Ka4Ern4jRIlvfaxbNml5XT9Rqk7bIXW iGvP7pinjcZwTnpzJO4OpHGSlovRXUNoJO+zY7vGeNJzx/LPjeMZ9ukPKCSBKztG1B59 ciZpGgTA2PjK6YtaDzPoerWvNjdp2J97KHUAWxtlNeXBUEedwQwjE3JDnz5EIPgQhYu5 0OdXX1MBokx+D7jH64g8xIGoUCagH+O7AewG7o/azO9fizGRxXxQnv3Ab/XQYIFB/jyq 5npw== 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=qyWI57HjjH2UZcir5oGvHNcHt8Rf9+v9mAHzWsQ/uTM=; fh=DpL6KA462EEk6SSy+o1xgqhb078PpQDs7J7Ae4DNqyY=; b=dpc1pQS/XAWBxUEMW3SxIMklLwhy4EbMG4USFUtyHy2BYs/PwpUTr7r+VFSQ6Nqy24 5SAK+Fpq8k9Q8AvP79xq7vlFLQS6bMaxF38LeeUffuGlN96dMjjs2+5uZuh10zRWniDG ctXKCMlAC6swfUFjuDNR+0HpgiS31whvsRpmGeBmpccQ7texMKrTVpYjEjKroCp7Jbs5 9f0ynschilZ+HxZ2heuwPJM5zxuiozOLIH+gvKtadersiFoqmppcy7KnZ8HsEuOhhdpX vBZaUC/BbBx2pE2reE5BD27Lz32QSf3yprNaPV6koaoAg4gp++afPq4bhtqN0Kzc8rdi MErA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=av9luihH; 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-6e205df6135si27165856d6.233.2025.01.24.08.42.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08: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=av9luihH; 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 1tbMbA-00027c-MP; Fri, 24 Jan 2025 11:32:06 -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 1tbMYg-0004P1-EK for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:26 -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 1tbMYe-0005bc-7g for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:26 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-437a92d7b96so23503265e9.2 for ; Fri, 24 Jan 2025 08:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736163; x=1738340963; 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=qyWI57HjjH2UZcir5oGvHNcHt8Rf9+v9mAHzWsQ/uTM=; b=av9luihHuEU/a3SeTye2+bM2F3N7RcFi48KwaRBVLe1vMaqNJuSsRzRx8RV8HdWIfq 0thOM25gVYYVW+lSEtyISjkbxVM4iXp5SGXHRt78CpP6SKyAlCRrcomPGP9e/uoK6cTy L1x6TsS/njmdMKaxSeAM+gNPi+ZeKHb8PJocG1psKlUvnwHTvFhJmx0AmyNuXa6SVDZq 9lwKRH8Oyc6ai4gAl1sJ1p8nXNyD5BVqu1/q8/leBsGnULpTltC+nRHrLgq03AFqNWKW ssNFETkb0yjyG6LMGG83VzlwTqdBe+AyMGVBM9MfH4MqEWy1p+c1n/EyoonE6ykIt8ji 37SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736163; x=1738340963; 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=qyWI57HjjH2UZcir5oGvHNcHt8Rf9+v9mAHzWsQ/uTM=; b=WvGW9TLmbLyeaGjCVLHEHBc8mh28VCCQe97fzwg4C5YZ2pcNwwwQ7GZuTRlUSTIqaf 6YKq3kPbQj1/6z+X0baVpYeng+DxNg/EaU77sNHsa9EUV6Bf5/iYT3jsr5WfJ6DBjc+y gwyAWLomRMRBpS4tSFddr8xF+VaePH58Jfq3F/Vi3jceElDZtvvjspOE8J7dj5GVGsLe pKDJYs4vHidF8vkbCVMrFNFu+xSVgSDNybo90j7Fvr0xbVTEGh2HQkxfLCNfXYJtMAhH ExEkOyaH2/LXgjcy4m1Q3k9oehGWbki2IYy3NrGXCRvBEwtUCUt+qLLD9zT7gD2CxsIv K/zA== X-Forwarded-Encrypted: i=1; AJvYcCUNZ74clXEpoCJZR0dO+y9eBrTiIb8ekd6aaU+hoCDeuAovghD3xoxe75xUsXgdFAA8CIm6D+T8wdMZ@nongnu.org X-Gm-Message-State: AOJu0Yw7tEW9RQSZIFugTiuxWylPKlK0hSPRMWHEZkHMwOwxMI9CzeuI C1hQRgVv0A33e41nJinHHWQ74zebP9x6mZtOwdqoiAKtw+eqrD4aenZgdjnU0JY= X-Gm-Gg: ASbGncsVjG2AjbykWUDZ2iIcpZxGLf8J2VQSbu5Hvq9ByO1mwKDkBx/Vjwm2vEszfHE MVWxJCw0OjaBkKOSNOGsSx4HW0McY0Y4Wafslrwst5IIDNxm0iphIwkma43Xqckb34zTkbN37NF hInF9p6YQy/cwyutJmoTk2uKFZV6TITCTu/Sj+sMlxT+3YyizWMRFcE1NjD1InffiADUx4FwWHQ kbZqIXHWutLxegf1Dw4bGCqvyy1dsgiWuMzl7tGzcTd7NvY8PlIrXFLMGiKKerw9ICIGOnbayY2 /r4o7XUUkX0= X-Received: by 2002:a05:600c:1f14:b0:434:f623:a004 with SMTP id 5b1f17b1804b1-438913e391fmr335798915e9.16.1737736162825; Fri, 24 Jan 2025 08:29:22 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:22 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 36/76] target/arm: Add FPCR.NEP to TBFLAGS Date: Fri, 24 Jan 2025 16:27:56 +0000 Message-Id: <20250124162836.2332150-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 For FEAT_AFP, we want to emit different code when FPCR.NEP is set, so that instead of zeroing the high elements of a vector register when we write the output of a scalar operation to it, we instead merge in those elements from one of the source registers. Since this affects the generated code, we need to put FPCR.NEP into the TBFLAGS. FPCR.NEP is treated as 0 when in streaming SVE mode and FEAT_SME_FA64 is not implemented or not enabled; we can implement this logic in rebuild_hflags_a64(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 1 + target/arm/tcg/translate.h | 2 ++ target/arm/tcg/hflags.c | 9 +++++++++ target/arm/tcg/translate-a64.c | 1 + 4 files changed, 13 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index cfb16151577..f562e0687c9 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3213,6 +3213,7 @@ FIELD(TBFLAG_A64, NV2_MEM_E20, 35, 1) /* Set if FEAT_NV2 RAM accesses are big-endian */ FIELD(TBFLAG_A64, NV2_MEM_BE, 36, 1) FIELD(TBFLAG_A64, AH, 37, 1) /* FPCR.AH */ +FIELD(TBFLAG_A64, NEP, 38, 1) /* FPCR.NEP */ /* * Helpers for using the above. Note that only the A64 accessors use diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 680ca52a181..59e780df2ee 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -157,6 +157,8 @@ typedef struct DisasContext { bool nv2_mem_be; /* True if FPCR.AH is 1 (alternate floating point handling) */ bool fpcr_ah; + /* True if FPCR.NEP is 1 (FEAT_AFP scalar upper-element result handling) */ + bool fpcr_nep; /* * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. * < 0, set by the current instruction. diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c index b3a78564ec1..9e6a1869f94 100644 --- a/target/arm/tcg/hflags.c +++ b/target/arm/tcg/hflags.c @@ -407,6 +407,15 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, if (env->vfp.fpcr & FPCR_AH) { DP_TBFLAG_A64(flags, AH, 1); } + if (env->vfp.fpcr & FPCR_NEP) { + /* + * In streaming-SVE without FA64, NEP behaves as if zero; + * compare pseudocode IsMerging() + */ + if (!(EX_TBFLAG_A64(flags, PSTATE_SM) && !sme_fa64(env, el))) { + DP_TBFLAG_A64(flags, NEP, 1); + } + } return rebuild_hflags_common(env, fp_el, mmu_idx, flags); } diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 0b3e4ec136d..d34672a8ba6 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9753,6 +9753,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->nv2_mem_e20 = EX_TBFLAG_A64(tb_flags, NV2_MEM_E20); dc->nv2_mem_be = EX_TBFLAG_A64(tb_flags, NV2_MEM_BE); dc->fpcr_ah = EX_TBFLAG_A64(tb_flags, AH); + dc->fpcr_nep = EX_TBFLAG_A64(tb_flags, NEP); dc->vec_len = 0; dc->vec_stride = 0; dc->cp_regs = arm_cpu->cp_regs; From patchwork Fri Jan 24 16:27:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859625 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp890922wrq; Fri, 24 Jan 2025 08:53:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWcavfUbetd7dPPmyK/Ff+gfUPBHQamCcxuZxkggHjqcURt/9rg3iltBOIvLmE0Mt/Bzjz5nQ==@linaro.org X-Google-Smtp-Source: AGHT+IFIau85x11tabJgScRmeASoS1zy46CHR5cn/jy08L9L6HumLLNt7ldRV4G6J5V12V6ZVWMi X-Received: by 2002:a05:620a:3943:b0:7ac:b95b:7107 with SMTP id af79cd13be357-7be9af33ea0mr558576985a.12.1737737627992; Fri, 24 Jan 2025 08:53:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737627; cv=none; d=google.com; s=arc-20240605; b=S6AYMGpXut9fhwWChalCTeowdeLrT2wWF9o/l4KwjJPseu1u/PBf9fE2OFsi6iJT3l JwWLqlpuF+b5to4Uh2+OBeSSMVnDUUcCIeS6PwK2s7uEqzRyLlgLFYq115AFmkhRTejD NqNcYxddsN+5d/KM0CIa+fE7lI/FfCKzPmfrMyI7xcESazNqIjo2qyQCjHAouWkBXApT XfsL8ei1pPu8ErUcw2Udj742KtXVAeXYSBi3adscA/SNBX6O3PEMl1klS8ancv4I7ydm Ijw+GW9KwlnfkzHP5sXK6giWlZHVYEuUM+0OXkTOinhESfBrhC1tPvpNxdcKocSpLo7S vXCw== 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=vTLm+cEqe7UZu5EmY1MoCvylX+SxZXjkyLAYlyIFtdA=; fh=KJcQMuQLx1q6Lkyan1uQR7+dTpz2H6bOoKbwSFrY2hk=; b=H2EL8B2vXOUwiuPCTRY96vpdXUQhgJBParUqkL9LNCsigdF8u0AErmOzi0yi1zmN23 GB5AhLUmndwmLhqPltq0GIVtyI9tuJVzYyF5whMg57BezO7pq6ZKjWIrTzb1+4qIgM8Q /vjAYch6qX5ejo3ptdx48oOOy5k/De+H5Ci0j4KKhmPL9EWRkIrxjJWtXXISRIZej3GN VXwTOjdJkSTrL1tWWPVH80NxcTbdTVydIqM/sUh/g9R6bseuawvOAt/gvRGfMWTtePlB vMB/c+VXjB0mXA1kvE7fqXigZX+diFqqfdK6PxzIebAcCAP13HB/BDfhTuCLDtcftZiV GJ3g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mIDzSxMv; 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-7be9aeebf09si269229585a.342.2025.01.24.08.53.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:53:47 -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=mIDzSxMv; 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 1tbMc4-00044S-8m; Fri, 24 Jan 2025 11:32:56 -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 1tbMYi-0004Xr-3M for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:28 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYf-0005cB-FR for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:27 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-436345cc17bso16862835e9.0 for ; Fri, 24 Jan 2025 08:29:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736164; x=1738340964; 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=vTLm+cEqe7UZu5EmY1MoCvylX+SxZXjkyLAYlyIFtdA=; b=mIDzSxMvSpQFoTBCrAnYyqEWO+qrGoM/tFQXJeb+j4rWTNbnK2e4hKwXEj+r7Xm3QJ 2oU2l6K1ikm2OABiTEgmgLMBx0n4c441mR+yftPILl5WvyU/jUB05FEhueRsdi8zehdg dXHN1cnrD3qDyxN26EV/AeX7zv04T3bAsJDO+nCtknHpPb9iwRraeSXX+dLEmdCGSHd5 iXypDV9Wb2ByKno/34e0/l5hwHWlBXVPCOyvUwcb6SMQ2bqXIwp1vRMJJr78NzuVz0ky u2ndHnnuMblhsi9F/9eR0GKvfl4o5dQSj1F+xUd0mCTSbbFhj+87vtdIfxCD8jsqqpIO sBvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736164; x=1738340964; 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=vTLm+cEqe7UZu5EmY1MoCvylX+SxZXjkyLAYlyIFtdA=; b=Gy8xuCTIrG2jIHA49SDNiMjjUffF9+g1ko+9TOO9ZnKHbU4vclfkjL0/uV9+8fE2Kk AcFdUH9ygx9Mq0KPEitptNZ93h+Io0wSsdR7y6R2UvUnzo+TyXoU4yBxUjkF1uT2KS6H V9L781F3jEYiYi7/SSvQw8dKt/c5fKalXB+/yP1Y2z3MwleFSa0Y52gRLJFt525qajQB aZmy8B+HekaWxmFkCurOhhEXk++DqosaY++rpYCm9KUWVJ6ymRpZKhP4RlKXFv5hjVzb RUfSaADuwZfUkmGP4rjFYnzR6swOygvmfIB09mm+fvo+2tsKIWRYeLSu+J8ezwdkPV+v PFJA== X-Forwarded-Encrypted: i=1; AJvYcCUB+Vwasf3loNYZuH4RCzwEeNZ1eJynf6ytGwU9oPZ8556J8j6QWIEoS6fzIXai+b7rbTPhlIP1pqX5@nongnu.org X-Gm-Message-State: AOJu0YylvCZScMwx3A7CoQyGrouj9G3J8q0D/hZq8GCx+2YcQtksDfCr BrpnpowjzPFwlKvQ5yOZ/z2iM+vZOV5Va7CRDagzu7gbDKDOaiwx767qhzz6fcJvMSu7rWFQw06 k X-Gm-Gg: ASbGncuN8XoJTwzm86Bk6XxzBqEtPqm5TXIDjv08J/rjG+rN/WFmBLh9vw6KrKM7lWi vG2ypgR8ywViQ3iSsPyaz8wdpBqls/He/RWyrORB6VB4YiBGPH9QUMvZvCC3aWnZL7LKix5wlqh yJe/9kqTyE3/Aer4pSqbgxIHYkmeZlaosRZJrwqJNdyAS1+4CAmmdxHusSqI6yuf0RV6IuWZ/Cu 44X4LoNMunhrrA/m1OQi7mGZ27WBgMEkbr80KOcTzPb5nSvSMCXDXEAobf88NIZn6veF4vts+tU qos/YP4YIfc= X-Received: by 2002:a05:600c:5486:b0:434:f1e9:afae with SMTP id 5b1f17b1804b1-438913bfa0fmr257493665e9.1.1737736163912; Fri, 24 Jan 2025 08:29: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-438bd47eecasm31683025e9.6.2025.01.24.08.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:23 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 37/76] target/arm: Define and use new write_fp_*reg_merging() functions Date: Fri, 24 Jan 2025 16:27:57 +0000 Message-Id: <20250124162836.2332150-38-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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, T_SCC_BODY_TEXT_LINE=-0.01 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 For FEAT_AFP's FPCR.NEP bit, we need to programmatically change the behaviour of the writeback of the result for most SIMD scalar operations, so that instead of zeroing the upper part of the result register it merges the upper elements from one of the input registers. Provide new functions write_fp_*reg_merging() which can be used instead of the existing write_fp_*reg() functions when we want this "merge the result with one of the input registers if FPCR.NEP is enabled" handling, and use them in do_fp3_scalar_with_fpsttype(). Note that (as documented in the description of the FPCR.NEP bit) which input register to use as the merge source varies by instruction: for these 2-input scalar operations, the comparison instructions take from Rm, not Rn. We'll extend this to also provide the merging behaviour for the remaining scalar insns in subsequent commits. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 117 +++++++++++++++++++++++++-------- 1 file changed, 91 insertions(+), 26 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index d34672a8ba6..19a4ae14c15 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -665,6 +665,68 @@ static void write_fp_sreg(DisasContext *s, int reg, TCGv_i32 v) write_fp_dreg(s, reg, tmp); } +/* + * Write a double result to 128 bit vector register reg, honouring FPCR.NEP: + * - if FPCR.NEP == 0, clear the high elements of reg + * - if FPCR.NEP == 1, set the high elements of reg from mergereg + * (i.e. merge the result with those high elements) + * In either case, SVE register bits above 128 are zeroed (per R_WKYLB). + */ +static void write_fp_dreg_merging(DisasContext *s, int reg, int mergereg, + TCGv_i64 v) +{ + if (!s->fpcr_nep) { + write_fp_dreg(s, reg, v); + return; + } + + /* + * Move from mergereg to reg; this sets the high elements and + * clears the bits above 128 as a side effect. + */ + tcg_gen_gvec_mov(MO_64, fp_reg_offset(s, reg, MO_64), + fp_reg_offset(s, mergereg, MO_64), + 16, vec_full_reg_size(s)); + tcg_gen_st_i64(v, tcg_env, fp_reg_offset(s, reg, MO_64)); +} + +/* + * Write a single-prec result, but only clear the higher elements + * of the destination register if FPCR.NEP is 0; otherwise preserve them. + */ +static void write_fp_sreg_merging(DisasContext *s, int reg, int mergereg, + TCGv_i32 v) +{ + if (!s->fpcr_nep) { + write_fp_sreg(s, reg, v); + return; + } + + tcg_gen_gvec_mov(MO_64, fp_reg_offset(s, reg, MO_64), + fp_reg_offset(s, mergereg, MO_64), + 16, vec_full_reg_size(s)); + tcg_gen_st_i32(v, tcg_env, fp_reg_offset(s, reg, MO_32)); +} + +/* + * Write a half-prec result, but only clear the higher elements + * of the destination register if FPCR.NEP is 0; otherwise preserve them. + * The caller must ensure that the top 16 bits of v are zero. + */ +static void write_fp_hreg_merging(DisasContext *s, int reg, int mergereg, + TCGv_i32 v) +{ + if (!s->fpcr_nep) { + write_fp_sreg(s, reg, v); + return; + } + + tcg_gen_gvec_mov(MO_64, fp_reg_offset(s, reg, MO_64), + fp_reg_offset(s, mergereg, MO_64), + 16, vec_full_reg_size(s)); + tcg_gen_st16_i32(v, tcg_env, fp_reg_offset(s, reg, MO_16)); +} + /* Expand a 2-operand AdvSIMD vector operation using an expander function. */ static void gen_gvec_fn2(DisasContext *s, bool is_q, int rd, int rn, GVecGen2Fn *gvec_fn, int vece) @@ -5038,7 +5100,7 @@ typedef struct FPScalar { } FPScalar; static bool do_fp3_scalar_with_fpsttype(DisasContext *s, arg_rrr_e *a, - const FPScalar *f, + const FPScalar *f, int mergereg, ARMFPStatusFlavour fpsttype) { switch (a->esz) { @@ -5047,7 +5109,7 @@ static bool do_fp3_scalar_with_fpsttype(DisasContext *s, arg_rrr_e *a, TCGv_i64 t0 = read_fp_dreg(s, a->rn); TCGv_i64 t1 = read_fp_dreg(s, a->rm); f->gen_d(t0, t0, t1, fpstatus_ptr(fpsttype)); - write_fp_dreg(s, a->rd, t0); + write_fp_dreg_merging(s, a->rd, mergereg, t0); } break; case MO_32: @@ -5055,7 +5117,7 @@ static bool do_fp3_scalar_with_fpsttype(DisasContext *s, arg_rrr_e *a, TCGv_i32 t0 = read_fp_sreg(s, a->rn); TCGv_i32 t1 = read_fp_sreg(s, a->rm); f->gen_s(t0, t0, t1, fpstatus_ptr(fpsttype)); - write_fp_sreg(s, a->rd, t0); + write_fp_sreg_merging(s, a->rd, mergereg, t0); } break; case MO_16: @@ -5066,7 +5128,7 @@ static bool do_fp3_scalar_with_fpsttype(DisasContext *s, arg_rrr_e *a, TCGv_i32 t0 = read_fp_hreg(s, a->rn); TCGv_i32 t1 = read_fp_hreg(s, a->rm); f->gen_h(t0, t0, t1, fpstatus_ptr(fpsttype)); - write_fp_sreg(s, a->rd, t0); + write_fp_hreg_merging(s, a->rd, mergereg, t0); } break; default: @@ -5075,16 +5137,19 @@ static bool do_fp3_scalar_with_fpsttype(DisasContext *s, arg_rrr_e *a, return true; } -static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f) +static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f, + int mergereg) { - return do_fp3_scalar_with_fpsttype(s, a, f, + return do_fp3_scalar_with_fpsttype(s, a, f, mergereg, a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); } -static bool do_fp3_scalar_ah(DisasContext *s, arg_rrr_e *a, const FPScalar *f) +static bool do_fp3_scalar_ah(DisasContext *s, arg_rrr_e *a, const FPScalar *f, + int mergereg) { - return do_fp3_scalar_with_fpsttype(s, a, f, select_fpst(s, a->esz)); + return do_fp3_scalar_with_fpsttype(s, a, f, mergereg, + select_fpst(s, a->esz)); } static const FPScalar f_scalar_fadd = { @@ -5092,63 +5157,63 @@ static const FPScalar f_scalar_fadd = { gen_helper_vfp_adds, gen_helper_vfp_addd, }; -TRANS(FADD_s, do_fp3_scalar, a, &f_scalar_fadd) +TRANS(FADD_s, do_fp3_scalar, a, &f_scalar_fadd, a->rn) static const FPScalar f_scalar_fsub = { gen_helper_vfp_subh, gen_helper_vfp_subs, gen_helper_vfp_subd, }; -TRANS(FSUB_s, do_fp3_scalar, a, &f_scalar_fsub) +TRANS(FSUB_s, do_fp3_scalar, a, &f_scalar_fsub, a->rn) static const FPScalar f_scalar_fdiv = { gen_helper_vfp_divh, gen_helper_vfp_divs, gen_helper_vfp_divd, }; -TRANS(FDIV_s, do_fp3_scalar, a, &f_scalar_fdiv) +TRANS(FDIV_s, do_fp3_scalar, a, &f_scalar_fdiv, a->rn) static const FPScalar f_scalar_fmul = { gen_helper_vfp_mulh, gen_helper_vfp_muls, gen_helper_vfp_muld, }; -TRANS(FMUL_s, do_fp3_scalar, a, &f_scalar_fmul) +TRANS(FMUL_s, do_fp3_scalar, a, &f_scalar_fmul, a->rn) static const FPScalar f_scalar_fmax = { gen_helper_vfp_maxh, gen_helper_vfp_maxs, gen_helper_vfp_maxd, }; -TRANS(FMAX_s, do_fp3_scalar, a, &f_scalar_fmax) +TRANS(FMAX_s, do_fp3_scalar, a, &f_scalar_fmax, a->rn) static const FPScalar f_scalar_fmin = { gen_helper_vfp_minh, gen_helper_vfp_mins, gen_helper_vfp_mind, }; -TRANS(FMIN_s, do_fp3_scalar, a, &f_scalar_fmin) +TRANS(FMIN_s, do_fp3_scalar, a, &f_scalar_fmin, a->rn) static const FPScalar f_scalar_fmaxnm = { gen_helper_vfp_maxnumh, gen_helper_vfp_maxnums, gen_helper_vfp_maxnumd, }; -TRANS(FMAXNM_s, do_fp3_scalar, a, &f_scalar_fmaxnm) +TRANS(FMAXNM_s, do_fp3_scalar, a, &f_scalar_fmaxnm, a->rn) static const FPScalar f_scalar_fminnm = { gen_helper_vfp_minnumh, gen_helper_vfp_minnums, gen_helper_vfp_minnumd, }; -TRANS(FMINNM_s, do_fp3_scalar, a, &f_scalar_fminnm) +TRANS(FMINNM_s, do_fp3_scalar, a, &f_scalar_fminnm, a->rn) static const FPScalar f_scalar_fmulx = { gen_helper_advsimd_mulxh, gen_helper_vfp_mulxs, gen_helper_vfp_mulxd, }; -TRANS(FMULX_s, do_fp3_scalar, a, &f_scalar_fmulx) +TRANS(FMULX_s, do_fp3_scalar, a, &f_scalar_fmulx, a->rn) static void gen_fnmul_h(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_ptr s) { @@ -5173,42 +5238,42 @@ static const FPScalar f_scalar_fnmul = { gen_fnmul_s, gen_fnmul_d, }; -TRANS(FNMUL_s, do_fp3_scalar, a, &f_scalar_fnmul) +TRANS(FNMUL_s, do_fp3_scalar, a, &f_scalar_fnmul, a->rn) static const FPScalar f_scalar_fcmeq = { gen_helper_advsimd_ceq_f16, gen_helper_neon_ceq_f32, gen_helper_neon_ceq_f64, }; -TRANS(FCMEQ_s, do_fp3_scalar, a, &f_scalar_fcmeq) +TRANS(FCMEQ_s, do_fp3_scalar, a, &f_scalar_fcmeq, a->rm) static const FPScalar f_scalar_fcmge = { gen_helper_advsimd_cge_f16, gen_helper_neon_cge_f32, gen_helper_neon_cge_f64, }; -TRANS(FCMGE_s, do_fp3_scalar, a, &f_scalar_fcmge) +TRANS(FCMGE_s, do_fp3_scalar, a, &f_scalar_fcmge, a->rm) static const FPScalar f_scalar_fcmgt = { gen_helper_advsimd_cgt_f16, gen_helper_neon_cgt_f32, gen_helper_neon_cgt_f64, }; -TRANS(FCMGT_s, do_fp3_scalar, a, &f_scalar_fcmgt) +TRANS(FCMGT_s, do_fp3_scalar, a, &f_scalar_fcmgt, a->rm) static const FPScalar f_scalar_facge = { gen_helper_advsimd_acge_f16, gen_helper_neon_acge_f32, gen_helper_neon_acge_f64, }; -TRANS(FACGE_s, do_fp3_scalar, a, &f_scalar_facge) +TRANS(FACGE_s, do_fp3_scalar, a, &f_scalar_facge, a->rm) static const FPScalar f_scalar_facgt = { gen_helper_advsimd_acgt_f16, gen_helper_neon_acgt_f32, gen_helper_neon_acgt_f64, }; -TRANS(FACGT_s, do_fp3_scalar, a, &f_scalar_facgt) +TRANS(FACGT_s, do_fp3_scalar, a, &f_scalar_facgt, a->rm) static void gen_fabd_h(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_ptr s) { @@ -5233,21 +5298,21 @@ static const FPScalar f_scalar_fabd = { gen_fabd_s, gen_fabd_d, }; -TRANS(FABD_s, do_fp3_scalar, a, &f_scalar_fabd) +TRANS(FABD_s, do_fp3_scalar, a, &f_scalar_fabd, a->rn) static const FPScalar f_scalar_frecps = { gen_helper_recpsf_f16, gen_helper_recpsf_f32, gen_helper_recpsf_f64, }; -TRANS(FRECPS_s, do_fp3_scalar_ah, a, &f_scalar_frecps) +TRANS(FRECPS_s, do_fp3_scalar_ah, a, &f_scalar_frecps, a->rn) static const FPScalar f_scalar_frsqrts = { gen_helper_rsqrtsf_f16, gen_helper_rsqrtsf_f32, gen_helper_rsqrtsf_f64, }; -TRANS(FRSQRTS_s, do_fp3_scalar_ah, a, &f_scalar_frsqrts) +TRANS(FRSQRTS_s, do_fp3_scalar_ah, a, &f_scalar_frsqrts, a->rn) static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a, const FPScalar *f, bool swap) From patchwork Fri Jan 24 16:27:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859626 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp891446wrq; Fri, 24 Jan 2025 08:55:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVVnvXiRIGHLoGZo6Dplg57ROHLKt0YQZa1MI2IaVO5/Hz10bUD58EF0AI3KxLw+xtn/HH6Ug==@linaro.org X-Google-Smtp-Source: AGHT+IEY5Lkx/duBofUYKBovDiOM5RevaLmAxbJri9Vd6alqcXYlhRSqxt/FFCd3YD2DrVi80Zg3 X-Received: by 2002:a05:620a:2687:b0:7b7:106a:19b0 with SMTP id af79cd13be357-7be6320be8dmr4671099585a.12.1737737704793; Fri, 24 Jan 2025 08:55:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737704; cv=none; d=google.com; s=arc-20240605; b=eOp35kDrFGwg9iJPNUOP3zsVA2u2nMG2eX9/1fIWN/afz00Xxdpzl0ef81yV16d401 nj/EerjOLy1N90bgE+ZXInQg2tMuSZRXT8rk/d5I2Zk+mX29XZ4DsaLTc44VVWk00ma4 rEJdn37/Ixn+uI0mbZ05h0AkUaBdUe7ukVQk+djLk9ZaDwPM8OrovYvEPzvftVjrdN0m RTpcar0t2rKA3o7uxvNw0R1Lf8+b/ErA9vAcqi+vkYzXZ0MarSbfTaRbVqIdmwt0LWa3 7lnd7tGQpZmiwJsuouYnZxVvNeEOloVEC+qNCn1gegSS1wpXJQuboxeyXZ2suh+jd/K+ IkTQ== 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=v5Tz/8qeASxQsHbh8eTYF0AFW/V0SNYL2us/VX5QjOQ=; fh=Zv9fm0a1j25Q4eBJ0P0gPvc+xqw5vZiwC+lxFGV16sk=; b=Y12wM+Wf8RhLGtFi2PPHIcbIoCV5kqPnMX5iprc/+STNa3mQaFHRV7lXPAXaV57K60 Iw2s7IgAOSzgSLfACU3sPkSatwJleYE7I6TmOZ7cVk9ZsuDjtRVYvYBOpfGruRHEkhWj 5B5xeclXvz76RFvcuvdg+LXWfAY45lgKDKIXXYeqo9odotw7TX1MQokh6rPSU3GcvRy9 IsuGYTb/bzcZq+aLgSrR+2XAySOKEgG468dBP14Kc5yT95XhQE5vkGTIEPA5ZVjTO5+z SY/k3zsYXZYvuybmYrXoBBY1rPjql6sg0lrRFpgxwGSWmM+Ay/3Hsk3rA9rg2gwaBfVX yNHw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E03nogmv; 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-7be9ae819fbsi281121485a.91.2025.01.24.08.55.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:55:04 -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=E03nogmv; 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 1tbMbs-0002dj-1R; Fri, 24 Jan 2025 11:32:44 -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 1tbMYj-0004bI-6C for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:29 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYh-0005cw-0L for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:28 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43634b570c1so16742425e9.0 for ; Fri, 24 Jan 2025 08:29:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736165; x=1738340965; 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=v5Tz/8qeASxQsHbh8eTYF0AFW/V0SNYL2us/VX5QjOQ=; b=E03nogmvOwWcKOnvcfiv9M9R4vr0jCyaHIbZt0VachBund4gInyQ9oNB79iqWKZDt0 Rl6MphP9JazBJd8kAHWQWrylJZtclXRxVnX64mVWaedF1bkJJAWVNxZ37r+AhUz4sqwP 8w250F0peIit/BlPtz5OccedlNsh/6nrPESX2VIosbiuoVvMDSRtJUYZzM/G7tt+JkST 8Mr+k9B394CUWbhgWCn3TC/2gb94qIaSUT1kToBeVncavmE8yHDLmCHKUpykt0omBp5g hqkstzMSusoIelkb6NAyX6CxVh3D3aLNVzHk9HuvYkxZueW5+Anvht1paJCfjLjQWFqM 3sKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736165; x=1738340965; 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=v5Tz/8qeASxQsHbh8eTYF0AFW/V0SNYL2us/VX5QjOQ=; b=j6jRhz/5TBNl5Iedlbc3VpaekHNm+6Pyu8vMtKXX8FTvxfaxz0SBNt/FChhDcZCGbX TfNhckSukRkaq/dLtsmSolK4Z12DH8BxuzRStzSUB3x2Is+m0s94AAIsR1veSmfVlsAy WzBhj3S+zOw+4V0Yvt9En9947yAr2Cn4V899Av1Ly9YaTXAVdrzo7MgdIRM7Ezf5E3BG q+zCVoAfEdd3TLxu6AD1FPGzsdrj3Rl8qNawVdOY/nWV0QnG+2jRZKEuXajyuZjYLeWd wcsYKorKG8vT0W8jBBAOTWAXFdwuAC1uienyqHFmU2SvfeOlEb5LHElI9Lgvh+iyY4hk Lcbw== X-Forwarded-Encrypted: i=1; AJvYcCUzzhD/mbJa5wV27eHNjydA9SwH3M78hDfFtcEeV0il+iTpJ+r68P9Zpn+o1ie0a6nXW1ueTp8cl0H0@nongnu.org X-Gm-Message-State: AOJu0YwGNMze59aNe//JhCyIU7G+y4+t26cWw2ibOf7LB88igfU7U9YL Dz4MpdXb8Uyb1dx1mWTjXS+w8ab+lS+B3nnFnkOZI/lrvj9Y513nITqkGzCP4pM= X-Gm-Gg: ASbGnct2jLyRWvydKhE1kG35JDt0NqAUItexQJh9knDMuIMe0Gw4vD2m9w3lgIFKKu+ W+p5ktnybpBq9oIJ4mNpOd4mhWvbE3t2PgHlNd/jTwXRWFJKJLeNaqO8wd9gVg2A0BfOvlLOg9m C0rr4hcrE6gd17iXLzrPwJMJbPwfZh6cXKJTmmYbAV7uz4zAB59Cj2b2EjYAkpAN973EpWZdoEW KnTj5iUECOEdnLMDUvq1MVadlzq/qiGwSCBSQ5P0rZAhp5mPA3SQIpjRfQQ7YwaZsb1PLbhbB3A xO/FGFzqUQE= X-Received: by 2002:a05:600c:450c:b0:434:a91e:c709 with SMTP id 5b1f17b1804b1-4389145145fmr259338315e9.28.1737736165503; Fri, 24 Jan 2025 08:29:25 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:24 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 38/76] target/arm: Handle FPCR.NEP for 3-input scalar operations Date: Fri, 24 Jan 2025 16:27:58 +0000 Message-Id: <20250124162836.2332150-39-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Handle FPCR.NEP for the 3-input scalar operations which use do_fmla_scalar_idx() and do_fmadd(), by making them call the appropriate write_fp_*reg_merging() functions. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 19a4ae14c15..66c214ed278 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6356,7 +6356,7 @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg) gen_vfp_negd(t1, t1); } gen_helper_vfp_muladdd(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR_A64)); - write_fp_dreg(s, a->rd, t0); + write_fp_dreg_merging(s, a->rd, a->rd, t0); } break; case MO_32: @@ -6370,7 +6370,7 @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg) gen_vfp_negs(t1, t1); } gen_helper_vfp_muladds(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR_A64)); - write_fp_sreg(s, a->rd, t0); + write_fp_sreg_merging(s, a->rd, a->rd, t0); } break; case MO_16: @@ -6388,7 +6388,7 @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg) } gen_helper_advsimd_muladdh(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR_F16_A64)); - write_fp_sreg(s, a->rd, t0); + write_fp_hreg_merging(s, a->rd, a->rd, t0); } break; default: @@ -6867,7 +6867,7 @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n) } fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_muladdd(ta, tn, tm, ta, fpst); - write_fp_dreg(s, a->rd, ta); + write_fp_dreg_merging(s, a->rd, a->ra, ta); } break; @@ -6885,7 +6885,7 @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n) } fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_muladds(ta, tn, tm, ta, fpst); - write_fp_sreg(s, a->rd, ta); + write_fp_sreg_merging(s, a->rd, a->ra, ta); } break; @@ -6906,7 +6906,7 @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n) } fpst = fpstatus_ptr(FPST_FPCR_F16_A64); gen_helper_advsimd_muladdh(ta, tn, tm, ta, fpst); - write_fp_sreg(s, a->rd, ta); + write_fp_hreg_merging(s, a->rd, a->ra, ta); } break; From patchwork Fri Jan 24 16:27:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859583 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp883088wrq; Fri, 24 Jan 2025 08:35:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU9oh6Zz8ssDR5uHtL60bgieKtQogYpaxbtqnY9UqpfNb7LVQ/uxoH9gLK2vfX0nRqi5snf0Q==@linaro.org X-Google-Smtp-Source: AGHT+IEyydAnYo8WDjbHWv3o1lGAFaXip6K5z2jb88ChwCzHFSdOIE6oLAoE/fHN8hAhVDqpF4Gs X-Received: by 2002:a05:6214:1303:b0:6d4:142d:8119 with SMTP id 6a1803df08f44-6e1b224d40emr494565346d6.42.1737736519290; Fri, 24 Jan 2025 08:35:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736519; cv=none; d=google.com; s=arc-20240605; b=JmBvlhRxRy8QfgKfqbK3aS4bO5I7b2dwAZP1+0/R+C07fF+bH1GBUCBe6czSBm9wlt 5m9R8yDp0hNjWWJ9jRXI/ug+vLGiMq8lG0MQHDxKDAKqR7EOwIQzSJTQcamxi14btvKj ZzkEEUGf2XQPifVlJnTk2guzuuXoDDS2ph5uboLG/XydpvfwkfXYLbRfVA8f/nWgVXgV KeDum0+taw/xpVGSzdAqZTjuTB2D36rFMfiHt4+nIXjMrNN7CiqTflD1lAr5DiJUFLR1 EERSRKKYTTyPOk1cQK/IlI3+OobKlN8525zWlP7tQWBWkcTkguSwn0oKM5WOFzFUHcuY CuYg== 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=nKR8uPNYLhAGe3FarqfGbfg+8VB5fh6HLYBVmEiiDLE=; fh=GmUbCokVDWvDp8UaEMSA17N+cZdNPiYksbxh4rpUQQc=; b=fiEuuimdwg4PK5TO+H1jfYL4mihkrJUNaeRb2jBMHd3IGw/dQw80mll3XYVGL4c8Qo fPc+zhe5/QvNGrJdv0GIx8itD9wEzspcgiKgIqd9ANjbRF6efBCoW/b9YhgeenCuzSpL z89yd2762LpQfHI+L0ohPh4fUdXaNA1MbXQJw6VKQzyla6wD0GaEdpxgZwAxYtjWB/QW TmPYk3d1NwmDDhPAO+jwkJmrOWsd+Pr8ldbfJ9S+4jent6g6DMPTOGx0o+uEzaYPpqRg lYlNvTf+x5lnszXbSzXgU+Jtdnwk6kZCr9Ldmvp0ga96kmYDAf98Z2F9K2muaWJfsH0L hKrg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W48Sto+0; 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-6e20525c416si30822486d6.26.2025.01.24.08.35.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:35:19 -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=W48Sto+0; 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 1tbMcA-00055v-Jv; Fri, 24 Jan 2025 11:33:03 -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 1tbMYj-0004cN-HH for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:29 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYh-0005dO-Vm for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:29 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43626213fffso22181515e9.1 for ; Fri, 24 Jan 2025 08:29:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736166; x=1738340966; 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=nKR8uPNYLhAGe3FarqfGbfg+8VB5fh6HLYBVmEiiDLE=; b=W48Sto+0FSdiavBnRQW+/ZwOx+g8Xrm+itB2+ym76WWu11GI6awFBCohIpdLiBIHKZ E9EOZeTcXr0BKqmRNe51yntg/3QAUPyDljIbODaqwDILGM97Z+3N3YudIfJyTHADKWCz bZZJIZUHhpAwL/+kqm0BM35ht+C+G01tiDl3V9iaPMlhVJlvmT9L/HsR96GbYsR4T9ww bt29/uN1x5T8W+mtDlYOUaxfHHr9xvRXF1l5QAAqsRQTkrcJePpS08YDa+0AF12XsKTO jYeQLqSnfl6Eq3DvKMt3kAr9OK04D7i3b0YRZzJYx1HrOHa0BCchD7Uetg983ZC0SVWw yEEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736166; x=1738340966; 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=nKR8uPNYLhAGe3FarqfGbfg+8VB5fh6HLYBVmEiiDLE=; b=blCRcMqUHu6WWj9n5cbH8Rq11eSacaBkyq56JKrL/uxFF+1gVPaiVGgoAG9mQqjTaE LJxSJa8uEjLnPQlsDazSqYbt0JZqI+UM0IzNhh58lsf/SLYdd2kYRXv5f+UiSnOJy3oA DKcwWaW/JJ5t89CAmTI91oRPoe2mmqcMnTQhemRRwlrNfXE6zu10XB8gu659aDU3oF8E YIxvhA1a8Lc/qMEwzYHrLRw7OU7NiXl//BMCRnIBZ/vbbW+tQBcl89ZOl+YTgWb+oYkW Hw3Kr3xWa35iFustVXHZwO+58JBSEfq1NlKUW0BXcdYMudlyCWWLvYy8CpV7i62SwvWM baNw== X-Forwarded-Encrypted: i=1; AJvYcCUMtx3tVjgXL/yBd78PCG8fIx0VXW6H+0IH0AIL51RDKjqq1hk7+T57uk/tTsOlW98oXtyKf7sd4Avu@nongnu.org X-Gm-Message-State: AOJu0Yw5cB8qSYKK2YV600GaB9TLnCjbWfmC8KqnVQzvQQIXwO9umwKC 6XdVtB7Ns0Tlq4EwXVqRrTXtfjHwbrhV/FOK1DnMIzoj8ViIBWGjxwE9qwex2xkJCKJYUFaLyPf K X-Gm-Gg: ASbGnctchbk55B9YGaY88H6YISEsK/Jadx/TiM6Psni6IodeGrbgz9GHpm+J4+lMjzf 7GbVaLZjGaE3FuX4Q7hUbcAgyl2/7xwZeFt9TXU5KeGE+On2EmpRlUO3RDIr7Dy0dO8D82osf57 vyum2SlXXCDnXFQBdNneZahMP34SFH0Uq1q4fMIvrc4+sJV//6pThrvMk8zgCv3miagf+4kButn keox39maHesjNUXXd5Hdh6V/+GjITs0rnS5TGdkC3T3g4p4D0LgsWXzmIx+oZjKv7Yb6ydCQIVJ +gifZP5Oq9g= X-Received: by 2002:a05:600c:5110:b0:42c:b8c9:16c8 with SMTP id 5b1f17b1804b1-438b885b8c1mr76525055e9.10.1737736166524; Fri, 24 Jan 2025 08:29:26 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:25 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 39/76] target/arm: Handle FPCR.NEP for BFCVT scalar Date: Fri, 24 Jan 2025 16:27:59 +0000 Message-Id: <20250124162836.2332150-40-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Currently we implement BFCVT scalar via do_fp1_scalar(). This works even though BFCVT is a narrowing operation from 32 to 16 bits, because we can use write_fp_sreg() for float16. However, FPCR.NEP support requires that we use write_fp_hreg_merging() for float16 outputs, so we can't continue to borrow the non-narrowing do_fp1_scalar() function for this. Split out trans_BFCVT_s() into its own implementation that honours FPCR.NEP. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 66c214ed278..944bdf8cafe 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8582,10 +8582,27 @@ static const FPScalar1 f_scalar_frintx = { }; TRANS(FRINTX_s, do_fp1_scalar, a, &f_scalar_frintx, -1) -static const FPScalar1 f_scalar_bfcvt = { - .gen_s = gen_helper_bfcvt, -}; -TRANS_FEAT(BFCVT_s, aa64_bf16, do_fp1_scalar_ah, a, &f_scalar_bfcvt, -1) +static bool trans_BFCVT_s(DisasContext *s, arg_rr_e *a) +{ + ARMFPStatusFlavour fpsttype = s->fpcr_ah ? FPST_FPCR_AH : FPST_FPCR_A64; + TCGv_i32 t32; + int check; + + if (!dc_isar_feature(aa64_bf16, s)) { + return false; + } + + check = fp_access_check_scalar_hsd(s, a->esz); + + if (check <= 0) { + return check == 0; + } + + t32 = read_fp_sreg(s, a->rn); + gen_helper_bfcvt(t32, t32, fpstatus_ptr(fpsttype)); + write_fp_hreg_merging(s, a->rd, a->rd, t32); + return true; +} static const FPScalar1 f_scalar_frint32 = { NULL, From patchwork Fri Jan 24 16:28:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859598 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp886519wrq; Fri, 24 Jan 2025 08:43:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXuIz55CJIZMXW/JeOBE8cLIk+RPWUvdmbSbc9jcve+E6h7402nJNXL+vNa8Y3avo7OS6kx6g==@linaro.org X-Google-Smtp-Source: AGHT+IH9R6Pmytdw/Yq0lqmn1jCJXlhntvJbYHPDXcdMW6knJpxAqybeqLDGMmeV1N/XB8WAmnrr X-Received: by 2002:a05:620a:bca:b0:7b1:3f88:48ef with SMTP id af79cd13be357-7be63278e8fmr4965312485a.46.1737737010672; Fri, 24 Jan 2025 08:43:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737010; cv=none; d=google.com; s=arc-20240605; b=DhrGFQ6nps2qE42CZ7hqMc0AJGK/Uoonrs2t/JnyBmGqVVEuq7h+jTkEFttiRgkvFS ADU3YHGl0RwG85uGzerlc5Vp0DO+lGP3sJsuaTd+FQAFs9NayZ8kpaYm+52BNHMxl9eW eXGo8CGCNGxilNjw+2k44UBEEkr4SDS5wwOdcqAYSUjAjvZRRuIRqP4cB90bitznLOmy WfnRE8RS56QeCIvwpI+DRGlkWufJMgbDTI2ojRJ7D3jghrM4FcnRv0wlznhRtU9bPOn9 bupyZ9dAQMDQUAX/6XqmYameKRRtVbzHjqn9Hfi3RlPula2YkGFjYoXUsJJDgrxPh92b bZOA== 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=Nm4fVPVn7klvhgQljpSjOnO06niRdClvbiI2p5tiBiU=; fh=GL5LIjimmPjKzMhHQUbqs71mZVDpuskqYDL7OW76Yb4=; b=X2mwlGIHp600JJJ+4zbrl6+gkqWMnKXWuAlCdYJznQcV5e+WtfCDtggsYivOV3imDs 4BqlHQyCvun9cyhhZ1ImyXS6qfHZkloR4oEiHPRmktXOoDhr/oBAMbGeP3GCd5nRr5LY Fz520zxAvMIelaAtPGYbtbrRsjlJ27Cw+mIJIIb3Q+lIyGrQ9aJmskj6EQJd/9g2PCW/ bXBBrkMwTFAi344RONiqPyUhQ5/LQVkIeFcIcV0SFGQIucxDH0UryXpnYjKduE/vYIV0 B1WeXxN+4Z9Pcr55VZdBcpkNprNfySNwwy5usfs1ND1ppy1As1WlEEJcKhEFbyd6ZI5q dffA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yfy+f6wi; 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-7be9aeed7casi269641685a.337.2025.01.24.08.43.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:43:30 -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=yfy+f6wi; 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 1tbMbv-00031a-Uz; Fri, 24 Jan 2025 11:32:48 -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 1tbMYk-0004k8-Qz for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:30 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYi-0005dn-VW for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:30 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4364a37a1d7so23483485e9.3 for ; Fri, 24 Jan 2025 08:29:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736167; x=1738340967; 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=Nm4fVPVn7klvhgQljpSjOnO06niRdClvbiI2p5tiBiU=; b=yfy+f6wiqmoxjA6Fi8mWB3GY4bvQtgjspvanO5kuTYeNjxFSmmkD6NzJ8KMqeJ4jB9 iWAVc980Z0YcI3RNLe4OP00Q2E7dDC9xmvhnqz2kBnNmvV7DOlW6HTXTuuW5SRCFeJLJ o+Uj868okSIdi+PaXJXUqFWdmhNW6T8WiZ5kTLmWEMj5PFdzfhH84NeCRXcOQqGRp0Hb 6GCl9RagWjt1PS4Mczf0Bulh4hIIn6ARggLu53u8II+L6zT3OLH45jd0MzRabNIwtBVN uloA+ERHB5HU4ynf8spnbDGnHLHxm23l8kBMYgTduSglSaRgO6MNQCwDImAOESAXPt9E OO8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736167; x=1738340967; 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=Nm4fVPVn7klvhgQljpSjOnO06niRdClvbiI2p5tiBiU=; b=WDHTNegVXD8BC6HeNkKNtrb7aVAdbMHuwfRETrw8RJ7GM6X1D4BPriUnKrB2FOYwM/ bywD/65zi/XiOVMn8gP5o+MuYIN8+vSUea22LafuHO7tbq5BmWpo+eVO3rk9Q71U1meo bqF12/YUI1RS9zqpFCwKDm+E/CGI9BblMNvmaBxvmzyNyYA47z7mDuU2iMEqV3tiW9xJ FWQdzUxLaSnAJaRb1nj3GVSgaPIqOrPzRf6LdZWnePnOq/HmQ+yvXwRy39o+eup2Q/ch 6Me4HF9kcfwPrgGt47mKC+kRpeqxe0zCtn24iGHve1JgEq4/VI2Nv5k899w0li3LUMX/ G7dg== X-Forwarded-Encrypted: i=1; AJvYcCUNE+zBMy1YZAJKPngK0BSGQXl+ETMr4N5x3XWp9FbdI5LLlvM7B31r9ajKJ/EUWOR+LkLplws6yXj4@nongnu.org X-Gm-Message-State: AOJu0YyRISyIp4y3tsWsfr9gHUg4jvm56rUl5WYb6S4o8AfkvcCD0hyV zH7FvvOYvLDbpZSR9u3KBw584KFd18PoaWaj2vx+uBmhIy7XGzjUAcYo7MNs8t2nvVAH/8+sk0W V X-Gm-Gg: ASbGncvoU6+sf7FbC9Axbm2IAwIjm8iHTNbz8TipqNeyWhMx8lQoVeujrhGK6Si41Ot 8Meobl9ypxoj6UBKdifuJp/ZhnMKugV29mwLSP1O+LXyUaQUFGXGoA3IWcnXO53evKgBWwfAQJL V4ZTpW4l0EYL1VGAmcCqJjS/6OTpc/ph/WInGRUHPyCi4x6FrNsMb5qu2UA4hjwSU7ML7mXDE2/ TAG+xsT5zwud/WyWr0jI8QQicPvE7bIvM/a7ooks57ASfiH7tKNNj47wagCla9WSkkLDiWyKHJX xxl6uB5lqlo= X-Received: by 2002:a05:600c:3b88:b0:436:488f:4d8 with SMTP id 5b1f17b1804b1-438913cdba3mr344566975e9.11.1737736167464; Fri, 24 Jan 2025 08:29:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:26 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 40/76] target/arm: Handle FPCR.NEP for 1-input scalar operations Date: Fri, 24 Jan 2025 16:28:00 +0000 Message-Id: <20250124162836.2332150-41-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Handle FPCR.NEP for the 1-input scalar operations. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 944bdf8cafe..64994d3212f 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8520,17 +8520,17 @@ static bool do_fp1_scalar_with_fpsttype(DisasContext *s, arg_rr_e *a, case MO_64: t64 = read_fp_dreg(s, a->rn); f->gen_d(t64, t64, fpst); - write_fp_dreg(s, a->rd, t64); + write_fp_dreg_merging(s, a->rd, a->rd, t64); break; case MO_32: t32 = read_fp_sreg(s, a->rn); f->gen_s(t32, t32, fpst); - write_fp_sreg(s, a->rd, t32); + write_fp_sreg_merging(s, a->rd, a->rd, t32); break; case MO_16: t32 = read_fp_hreg(s, a->rn); f->gen_h(t32, t32, fpst); - write_fp_sreg(s, a->rd, t32); + write_fp_hreg_merging(s, a->rd, a->rd, t32); break; default: g_assert_not_reached(); @@ -8651,7 +8651,7 @@ static bool trans_FCVT_s_ds(DisasContext *s, arg_rr *a) TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_fcvtds(tcg_rd, tcg_rn, fpst); - write_fp_dreg(s, a->rd, tcg_rd); + write_fp_dreg_merging(s, a->rd, a->rd, tcg_rd); } return true; } @@ -8664,8 +8664,8 @@ static bool trans_FCVT_s_hs(DisasContext *s, arg_rr *a) TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp); - /* write_fp_sreg is OK here because top half of result is zero */ - write_fp_sreg(s, a->rd, tmp); + /* write_fp_hreg_merging is OK here because top half of result is zero */ + write_fp_hreg_merging(s, a->rd, a->rd, tmp); } return true; } @@ -8678,7 +8678,7 @@ static bool trans_FCVT_s_sd(DisasContext *s, arg_rr *a) TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_fcvtsd(tcg_rd, tcg_rn, fpst); - write_fp_sreg(s, a->rd, tcg_rd); + write_fp_sreg_merging(s, a->rd, a->rd, tcg_rd); } return true; } @@ -8692,8 +8692,8 @@ static bool trans_FCVT_s_hd(DisasContext *s, arg_rr *a) TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_fcvt_f64_to_f16(tcg_rd, tcg_rn, fpst, ahp); - /* write_fp_sreg is OK here because top half of tcg_rd is zero */ - write_fp_sreg(s, a->rd, tcg_rd); + /* write_fp_hreg_merging is OK here because top half of tcg_rd is zero */ + write_fp_hreg_merging(s, a->rd, a->rd, tcg_rd); } return true; } @@ -8707,7 +8707,7 @@ static bool trans_FCVT_s_sh(DisasContext *s, arg_rr *a) TCGv_i32 tcg_ahp = get_ahp_flag(); gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); - write_fp_sreg(s, a->rd, tcg_rd); + write_fp_sreg_merging(s, a->rd, a->rd, tcg_rd); } return true; } @@ -8721,7 +8721,7 @@ static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a) TCGv_i32 tcg_ahp = get_ahp_flag(); gen_helper_vfp_fcvt_f16_to_f64(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp); - write_fp_dreg(s, a->rd, tcg_rd); + write_fp_dreg_merging(s, a->rd, a->rd, tcg_rd); } return true; } @@ -8969,7 +8969,9 @@ static bool do_fcvt_f(DisasContext *s, arg_fcvt *a, do_fcvt_scalar(s, a->esz | (is_signed ? MO_SIGN : 0), a->esz, tcg_int, a->shift, a->rn, rmode); - clear_vec(s, a->rd); + if (!s->fpcr_nep) { + clear_vec(s, a->rd); + } write_vec_element(s, tcg_int, a->rd, 0, a->esz); return true; } From patchwork Fri Jan 24 16:28:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859580 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp882894wrq; Fri, 24 Jan 2025 08:34:58 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXF9cwThK0foBMuOll4PTIYae7jDPYOJhTvEyvJ/P5ruL9tSPISwhArK5TECGPLsgJPjZgA0g==@linaro.org X-Google-Smtp-Source: AGHT+IE4BaZhzyMmgXgA4aUQG/CldEgdRsE54S7z0bBi3zlo1OWvbfDEQogQZisQJoc4JhRyNNL3 X-Received: by 2002:a05:622a:1986:b0:466:b2c9:fb00 with SMTP id d75a77b69052e-46e12a1fd6bmr514796781cf.3.1737736498284; Fri, 24 Jan 2025 08:34:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736498; cv=none; d=google.com; s=arc-20240605; b=ZuKCwOyjmV/i4lPZVjUY659oLweK82pYoCy3EjS4m69oJ5MW2hn8YHQ16U6g3Cytft 1so0fcsgnvpt8h7XYMeAT6wPjFEtDmJFpZmTr1U5LMFzvaNViO92w5CjrwL4DUGw1vwC N7+E2E506IP4cl7wY3v5Ig+zArLBjsqPwo8bvFazWuZDHUyjeJrpxAx7J9W5pPf49w0U 1TLBe+rinnltIN/QeQpYFDaMaKMHT00gDVpma9kWRKk6d5mO+at5tIx/q/4tNXWz7p5v 8Lx/WetDtOK1qRNgYU8ApL7XabXS8CiVHOU69O5AksCbbaZzgy42advhPSx1oJPwe0PW 7dHg== 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=e+vM7eVw9FNDbWBcJu93gLE5yRUZL1XievyTDuJkQaA=; fh=JpCI48rGEylxBogVLET12icadvs0s6A87xGjVRJSQyI=; b=A4zS6/WZA3HujsOr0vUOPKSKwRTKdxbend9xAyGW3SZrDvwDlb0bf8FRoRyAqrXlz1 YC9xnD4/OeAfN2BWp/p8lnFRXyHivyZsJE6z2fepV4jktgL7jdywDhcLGh0ZBh+q3eRs EEtgOACg0aJoTvD5bOKh8Yh+dOJ+ksH+D/dKB5Ig4hzA9Qf7l7Yr9S/msSZTfj1RM1RY iGbI57ZcebV2iwcoobVtyrg7z4K/NQvGrsJWcjiBMd3TpyZxcEbeTgyA1AZ2LNNN1OGx 6EwRvWiWI0iwAcuAg2BSquPrFT6mQyOUw9B1M5qsNB+ncEzO3Vz8UDc/w877M0kJBIyG 45Pg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pRNDCYwz; 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-46e6686be36si30498461cf.119.2025.01.24.08.34.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:34:58 -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=pRNDCYwz; 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 1tbMcO-0005r8-TH; Fri, 24 Jan 2025 11:33:20 -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 1tbMYl-0004od-RU for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:32 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYk-0005eI-8Z for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:31 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4364a37a1d7so23483655e9.3 for ; Fri, 24 Jan 2025 08:29:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736169; x=1738340969; 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=e+vM7eVw9FNDbWBcJu93gLE5yRUZL1XievyTDuJkQaA=; b=pRNDCYwzUnEXJz/7dt5sl1nSNYD+bZh6w6ajXX9FeeDZ5W2mVzdKaxZWkXZ8AFCb5M KapDNIlTC+s1ukg01WMFgx1JLa01Izj1GY9SZ5BRYK+spJOImSNBYWdaAA134u+x5o6Z V7DiKvLjjmZPkmyJuZdutRgsVnx4bDUJRUOdLBsnkFflwU/F3pCxFJcIp0GO35PqEusx QvCzwq0JRZv0G8A+reA4n5HkMAqiPRDEL5WD1Np6SXzrV65mV8oxyDLlYvhmxeaq+OlO wAun5dAwlR+cS7O1ClXhJpjfoRMgSsNZPoda0xYF2HFrOa1wJbI3LMOzDdJm63gEnc1H 5A5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736169; x=1738340969; 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=e+vM7eVw9FNDbWBcJu93gLE5yRUZL1XievyTDuJkQaA=; b=bC5s8bO4x1FsGpd3pDEtbAGu4XOIS832OFdomZtQUC/eB3u+4oUOiVlj4aIIIWqVok eKmmwSKAX5IdxUR4mEnB340SSWs5qMOWvnudHHD4OUGSYS/z1/h7/v4UIyZoxFF9Z88P TAVeX5kS17m0Lf7eACOv0aW3WKFPJaCQdvn9Z68Gy22fqS7Oz9MHl/YJTdmP8hwGVrp3 anMOwFPCllpL3eaIjgLf6ZKwt7MVbAPmv4ufEFmBNnUZn2truMVTrZJftAJMk4P6zUDE 4KZZZr51XV4IA+UT0KOalKtFvv0Yix/+gmd5ztyE9raSg+SBi9rR3RFa0KXFD8Ckie3k G5rA== X-Forwarded-Encrypted: i=1; AJvYcCV141WyNHxal9KgyB3zMn2RreFftHnPOv9mH561v632gxpCDsBZ/hFOAEmF7YsPqRxni6M2EnhyteGC@nongnu.org X-Gm-Message-State: AOJu0Ywj3MX6HfeDGi1ta2lYXIanKRgvr+HvydouUej23yi4Yo9BPX6O UJMrEcXmmJNJm1Mr7IvCNMA0ke96qbh03vikI57xTB7TS8Kib4Pj6A+aPqP2rrP00gdCCVGTPLj f X-Gm-Gg: ASbGncumLVw7FBaNr8S1As+CU1eQrPKxGBV1hJLJISZRRlVMoocPYdlMKVcYriN2E44 6NR5QkZdimnHCukzwYwTJxToARlKFMZOpDN3VRKD9EYYVzGx9Fk6vwsYMaGNGh/b5lsiOQzw4HC 2/jVe86yJYsPlcU4h7X5xj1Tg5gYs0NZLP0F9FLRBqgug8eH7FaB2czuBd7D2ZKblcXwwD+8Vl2 T8Pd1DLiGJA8jBFNQwYaUgYouur8My79/nSfioQ+RT/IEUsGecCK/1e6Zq3tP+Gt184b1RwWdnu 6Sm1U7jnaB8= X-Received: by 2002:a05:600c:83ce:b0:436:ed33:1535 with SMTP id 5b1f17b1804b1-438913e0384mr307041865e9.12.1737736168902; Fri, 24 Jan 2025 08:29:28 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:27 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 41/76] target/arm: Handle FPCR.NEP in do_cvtf_scalar() Date: Fri, 24 Jan 2025 16:28:01 +0000 Message-Id: <20250124162836.2332150-42-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Handle FPCR.NEP in the operations handled by do_cvtf_scalar(). Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 64994d3212f..6c20293961a 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8744,7 +8744,7 @@ static bool do_cvtf_scalar(DisasContext *s, MemOp esz, int rd, int shift, } else { gen_helper_vfp_uqtod(tcg_double, tcg_int, tcg_shift, tcg_fpstatus); } - write_fp_dreg(s, rd, tcg_double); + write_fp_dreg_merging(s, rd, rd, tcg_double); break; case MO_32: @@ -8754,7 +8754,7 @@ static bool do_cvtf_scalar(DisasContext *s, MemOp esz, int rd, int shift, } else { gen_helper_vfp_uqtos(tcg_single, tcg_int, tcg_shift, tcg_fpstatus); } - write_fp_sreg(s, rd, tcg_single); + write_fp_sreg_merging(s, rd, rd, tcg_single); break; case MO_16: @@ -8764,7 +8764,7 @@ static bool do_cvtf_scalar(DisasContext *s, MemOp esz, int rd, int shift, } else { gen_helper_vfp_uqtoh(tcg_single, tcg_int, tcg_shift, tcg_fpstatus); } - write_fp_sreg(s, rd, tcg_single); + write_fp_hreg_merging(s, rd, rd, tcg_single); break; default: From patchwork Fri Jan 24 16:28:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859631 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp892460wrq; Fri, 24 Jan 2025 08:57:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX78x+Rw1qbeNqRmiOo23NY+rSY/C6SV7fuzBbakZEoacjcWBpIAU/2FVT6+DwkvA8uK6Kq7g==@linaro.org X-Google-Smtp-Source: AGHT+IGn0ltb9GFpm1NhvwtvER0tPmD4aJoAcdqemx/EKqJazW5rYmzIXvfChpqOW34c1N9BFaZ0 X-Received: by 2002:a05:6122:4fa1:b0:518:859e:87c0 with SMTP id 71dfb90a1353d-51d5b30c6bbmr27281802e0c.9.1737737849605; Fri, 24 Jan 2025 08:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737849; cv=none; d=google.com; s=arc-20240605; b=Ub+oo7viXamLNFoHsTEgQ5mxMxVBoaETYwqx5DqBNOm0dQbCMe3uf1wZEGsHLqOGuT dTYuU6cIwnEljTwRbtUkWPGx3iqDJ+S1pTKcEZguR+cn1FkvXEzoYH0m4cJqzAaqkhq+ RFmWw6fyx9CDB9WU0x6KkCvEf6Xx4M6NWKs3EJ7gP13abnMPJTLtDRFIg4/vnv5aqKi4 CvRiAbgMBZhUYv7lB18mOMIbUWmaTYdaLy3A/bstbe2tZqDxhW1YsEY50v9CdNpPD80S sgPVSJ9oqtN0RijMLVduhY7Y0ijXm1iodSx9h9x9Trk3hhcTTd79SI/04pmKLhROjZ0t QouQ== 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=34luHZDyy2429KmxgwNFbXGPJ5mxedoShXZjqrjksvU=; fh=bKYTo7YcpcsswdKkb/oS2/rGcYfNKtlUPpvvAeeAvIM=; b=Fm+zA9aP/lwYIhdIN3KdKRH4RGi1txQHyzH8NRRh5FtsVQS/JwdkSlZ9EzN2aeim4P abo4bXl6tIr5vSfFLEVw4NzLheS5kN09FbTJzD/4TUlzGlhP5r+0nE8t9pNVVPJZZJm5 n6ia2AQQy18PjIAm0kkLrxU1OGemMEYGQgL8+2mrZBpZi3KZKKu40ut8LEGM8r14b9yS KgzdkM/n3zgjxQNe9QKU2NSCZejhSizB/8zDtpEiBPKDbAzpswfeAEA9o+LFCMrF4Ln5 oxiFvyXQCB0esYSw9jF6NUp6Qx3VCD+XMstfJVU3RuuQ5sXYnnIfAahVsfmvgHTIchPX dywQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="q/EKfThN"; 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 71dfb90a1353d-51e4ea36c55si960573e0c.48.2025.01.24.08.57.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:57:29 -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="q/EKfThN"; 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 1tbMc4-00044d-7Q; Fri, 24 Jan 2025 11:32:56 -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 1tbMYn-0004uA-CB for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:33 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYl-0005ej-Hx for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:32 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso16645565e9.1 for ; Fri, 24 Jan 2025 08:29:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736170; x=1738340970; 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=34luHZDyy2429KmxgwNFbXGPJ5mxedoShXZjqrjksvU=; b=q/EKfThNwnS6F1UljhblK22mmQeYpI/va+Q0N4FmJwAugqvip2HI5i0xZL/l7aIwe/ f2zoyS3qB22EmCvVKzVJ71QdDERD7USgFV6Zpb7RMZJEXGH2S+4KRczFwqt7j8zNY+YL lNeemEveOcrohE6GHBHkarx6kiFd7stHcXf5ZHKMrjgyho4kA5D3Jk/vI3KwdCKdurDo x8SRYZFObHit2Wx7leePVLXnvRGhH+CnU4Lx4dZiIBqZ4yB55Fx/KmgUHw0ZN3O8tCFQ rXDZ8+pgUb5/m/7vCNxON6F6V96ZXu+qKM0f8tkp4A3U9mcPLC7oiUM9zMUAYY90BumX ueSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736170; x=1738340970; 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=34luHZDyy2429KmxgwNFbXGPJ5mxedoShXZjqrjksvU=; b=i3pfAoxK2ZRvdze0P4KJCT33fGVt7HW79FBNeojZd4nZXXnRYCQ9iixcmo2pOrdMDu WHmozI2me0TWX2GElNUBRblgW3+bz9+T5oep4GxdWGPRoahds1C3nCZ00BTwd3KyV8OH TWlKMgd4Qooed+wTe6svERfBUoOaYW2Qzl4c/mC7M5Eiv62YBfzbCb/9FatRfZkHOoKx BG7YqJJwXRLhhoSIVQnxVBY8+IcY3a+RtH/w1n09CjeP8XtJTZ36hqXtHl8u0Pz/CXJq nUN7cwoMogF3S6bAdyeyg6Hd5UyYmtPfyVUv5iuFyRRKFIsk1wjcFZQTDFfW2JfeMSF9 zedA== X-Forwarded-Encrypted: i=1; AJvYcCXEyj4LwSe5ylXCyexHp8js9NZJrdRP5LD+PkP8XY7/t1uOiej7lCNI+h9A0+frhbWBo/zEybTI6uZs@nongnu.org X-Gm-Message-State: AOJu0Yy+9Hzmx0ji7fUI3rMG/BNVA+f5ODFxTbM0TWwNdI+dRUF5CvjS LnH9RwYXF3cjOJ0HR7yPxtSkQyE9E7NI3XuOQCnOolSX2XCLPNbR2ddFzGQ5aZU= X-Gm-Gg: ASbGncvkYE2j2NuD8edRW7/oKAJ8MknQ1Od0JWTrqaeZHLsDBpuVU3OJqCa43b2Jv7H A0UDN7s2G2XY2OERmeymiZoiPN/DfBIhkKOuYFU/KrxlcrQRK0vyHQ98nlkGT24A1RI+OqNTqRd NPSUD2ExYCIrvRC2v8rkvsmTTj+8SX4SGDwthOkSv7l0ttGS/Qmhn9pduaTLnyLU425kfg3Jl1B vPJ8Z1DjvYdWw/50t6MVPA8inaikeSFkWHfnV63U4kF5Al5dChkXq+mA2yp5nO0gNGSKEbDGRG1 5OaL6zVfxkc= X-Received: by 2002:a05:600c:3542:b0:434:9e1d:7626 with SMTP id 5b1f17b1804b1-4389145137dmr242320265e9.25.1737736170078; Fri, 24 Jan 2025 08:29:30 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:29 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 42/76] target/arm: Handle FPCR.NEP for scalar FABS and FNEG Date: Fri, 24 Jan 2025 16:28:02 +0000 Message-Id: <20250124162836.2332150-43-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Handle FPCR.NEP merging for scalar FABS and FNEG; this requires an extra parameter to do_fp1_scalar_int(), since FMOV scalar does not have the merging behaviour. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 6c20293961a..7412787b6b6 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8437,21 +8437,30 @@ typedef struct FPScalar1Int { } FPScalar1Int; static bool do_fp1_scalar_int(DisasContext *s, arg_rr_e *a, - const FPScalar1Int *f) + const FPScalar1Int *f, + bool merging) { switch (a->esz) { case MO_64: if (fp_access_check(s)) { TCGv_i64 t = read_fp_dreg(s, a->rn); f->gen_d(t, t); - write_fp_dreg(s, a->rd, t); + if (merging) { + write_fp_dreg_merging(s, a->rd, a->rd, t); + } else { + write_fp_dreg(s, a->rd, t); + } } break; case MO_32: if (fp_access_check(s)) { TCGv_i32 t = read_fp_sreg(s, a->rn); f->gen_s(t, t); - write_fp_sreg(s, a->rd, t); + if (merging) { + write_fp_sreg_merging(s, a->rd, a->rd, t); + } else { + write_fp_sreg(s, a->rd, t); + } } break; case MO_16: @@ -8461,7 +8470,11 @@ static bool do_fp1_scalar_int(DisasContext *s, arg_rr_e *a, if (fp_access_check(s)) { TCGv_i32 t = read_fp_hreg(s, a->rn); f->gen_h(t, t); - write_fp_sreg(s, a->rd, t); + if (merging) { + write_fp_hreg_merging(s, a->rd, a->rd, t); + } else { + write_fp_sreg(s, a->rd, t); + } } break; default: @@ -8475,21 +8488,21 @@ static const FPScalar1Int f_scalar_fmov = { tcg_gen_mov_i32, tcg_gen_mov_i64, }; -TRANS(FMOV_s, do_fp1_scalar_int, a, &f_scalar_fmov) +TRANS(FMOV_s, do_fp1_scalar_int, a, &f_scalar_fmov, false) static const FPScalar1Int f_scalar_fabs = { gen_vfp_absh, gen_vfp_abss, gen_vfp_absd, }; -TRANS(FABS_s, do_fp1_scalar_int, a, &f_scalar_fabs) +TRANS(FABS_s, do_fp1_scalar_int, a, &f_scalar_fabs, true) static const FPScalar1Int f_scalar_fneg = { gen_vfp_negh, gen_vfp_negs, gen_vfp_negd, }; -TRANS(FNEG_s, do_fp1_scalar_int, a, &f_scalar_fneg) +TRANS(FNEG_s, do_fp1_scalar_int, a, &f_scalar_fneg, true) typedef struct FPScalar1 { void (*gen_h)(TCGv_i32, TCGv_i32, TCGv_ptr); From patchwork Fri Jan 24 16:28:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859610 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp888322wrq; Fri, 24 Jan 2025 08:47:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUZ+vGSACeInBp17YJAwppwNwMe8Qthg9c2DwF+5eosp01MyaIIyZB2cKnTm12Kn2IrS1fvkg==@linaro.org X-Google-Smtp-Source: AGHT+IFffMXGMh8NttLNnvQNrYpH9SbYtGE7v25jdgS7nRFFQ2Bi2kTLrqoHQ9q4bydUimhYxPYU X-Received: by 2002:a05:6102:5129:b0:4b1:20b1:bff3 with SMTP id ada2fe7eead31-4b690c6b664mr25428806137.16.1737737255275; Fri, 24 Jan 2025 08:47:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737255; cv=none; d=google.com; s=arc-20240605; b=P60syy14ffCAyhdR2NpMnNTgZGBSgHVR6RxuLNIzchYfLhz3vQhYKE4VOnUOdf4c+A DhcooxAtp7mg80xzoEEBhKjn5FZd7KtBcwnoSlKzfJjPE3P2l5mZFW8dnUiI2KZDnvnW /gBU4CcFj9rrwyVqJASh2ZgHXI3SUcvddQ33mPfQOXHVuHX7JWeBnGw3wg4ICXW/Bwm0 XEc/U1j3lI7O2Lrb5Pa0CBnY4oE1epgV9XkuKpY+tXRkISykVuWvQuO260rdobfePRLJ h9TFoOkTlxd5U7Poz9kuOlyHrnqkknoqCFmfx7hrb2gwTYnrKX/u3AgtZ5pRHXRPYd3v nHDg== 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=qs+MQLYyxydi0FLdHXNe7tQBtwbpgP1LG2ASJBHmqjY=; fh=uXUhpOBHanKYk7RJzVRdBq7MMTi0elMX+zxNKklgVK8=; b=kY4C19wI9GjZ2Lj8XPG4JihRmLC3EbGlRyNDrhQsyLey/kbyAPEdjeMnq7q/cNw/mX vUwDjnFwLFZLEdRqo47tAIx9d2jHbZ9iJSwelQMru76aD8bKd5OmkxwbmnEPxrns/rqM SOCF9FptmPiQCmsCwRtJLJAe2vI0IsjKcb1gK9JCqpW3p65aBlqCSw+uBRKpJEQzhrpQ L+pIEx7GRE4oVkkT2HS6cJ2kPC4O0JQ5ysxupSWuqHiV91g/pnhbyqg+R4n0TzTmZ7r+ lUQQBt3pv+e1E8NhkRMk4dT13M0Gn7YgAMUjxAQ5xNrWPlwG8uv5aKaNhGOfRJSn3nt8 Sskg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yYGtQUG0; 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 a1e0cc1a2514c-864a9cd7215si710436241.121.2025.01.24.08.47.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:47:35 -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=yYGtQUG0; 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 1tbMga-0006RE-7g; Fri, 24 Jan 2025 11:37: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 1tbMYo-0004za-Mr for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:34 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYn-0005fH-17 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:34 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso24071665e9.0 for ; Fri, 24 Jan 2025 08:29:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736171; x=1738340971; 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=qs+MQLYyxydi0FLdHXNe7tQBtwbpgP1LG2ASJBHmqjY=; b=yYGtQUG0I7+/cLlW9WUyoHq/U9dq9XO5l/FOSAMH49EYSkMCZ8segxdUcfty4Kzw49 NLEUN62eNzun+dNEptLE2O5uj1Q2kzxMz8385B9wkX8kUb409ubgAH7We3Lbcacw6BTY TSzUm/0r9u/FqhSENqk/tr70Hy47sCwa4PGRuSOl6SeibjeArqkMYltdYl57X+4YTRsZ ZCDIB+vVoXFySpwX2CYgd6Dfz6rkoQE+SJU6/G+K3kxttu0RP02wuDTo9B9H5j9Wyq0m D8LXTbJU+9mE1ztDaa/ahwQeyGk2EgYlKsqtgLDcWO+ON0uHLmgoefxJrbkqmeoTB31t HI0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736171; x=1738340971; 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=qs+MQLYyxydi0FLdHXNe7tQBtwbpgP1LG2ASJBHmqjY=; b=f5wv3mphQwquJDRbKK4HwY8PhKTqQckTXGdYtUI1wk5nQWv8jzrKDbiADXiQE6f2bH /M0Q0wIqZETkPoGfY7fVmBnsLaAAAs9H7LpekclBv49m/U1A67E+7gG/UjqwP7oq6bKy 20ByCvThQOdscO+41NsK9dD7pOotnDUeUjKadIeOYG6ksqTJ/aqtCQto53pgjP85+OdB ORPX1gCiFiTFMfeL1z/nK596fy3nhCxObGZIsiVzNp2v3JvhH9rjNWBAXBTkx60M24Zp V9kB7EfYrGbxToQi6TSWN6bNtW+64FpkgYpIppGAOM/IDBxps7xK2XBN0u/8fdqycHXH aC1A== X-Forwarded-Encrypted: i=1; AJvYcCX88op/5tGwF4f0mcLOgt5Ef+Le5RhjlMTlYZkzslDMP9fsvrRdnF0YaE5kVdN6/WYzgSIWzbUFYK0c@nongnu.org X-Gm-Message-State: AOJu0Yw8em1KTrL4J6n6zYCgiMn6YW/g//MhMZYNS717sLZIroHSPrdg JKQTF0zHhJRUXHaL7d8gcWwPdN1C80LUhp5HlgqvwyHxRhTkSrbbIhp5ZJzoMFM= X-Gm-Gg: ASbGncshdFlDZUmPnC7Y/AU5/6fmPvOgpZ9TXa4alZhfs7o1+b11TEtP/py83v8z+Wu Ft82W0pO7d3WZO4aB5FVvyfgaENywhV77nY1kkWktnHyLu7USFechfOBURkbqHrcoWwvIKqDgae JzFRThjt0OvQCxqaTQEtCkTmeTz9afBWUcfSexarL2ExG4UKkijcfiKlZIwQ202rpm2mUdJ0Bqs iCX/QM2WKvMX1N4+MVIUA9uq41bSAVu9I7sDJpLidTbD89Pc0uxVMXN41O05UTlqQjdOOAk579D 1xwEoohIM40= X-Received: by 2002:a05:600c:3b0a:b0:434:9c60:95a3 with SMTP id 5b1f17b1804b1-438913ca93cmr315685425e9.11.1737736171426; Fri, 24 Jan 2025 08:29:31 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:30 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 43/76] target/arm: Handle FPCR.NEP for FCVTXN (scalar) Date: Fri, 24 Jan 2025 16:28:03 +0000 Message-Id: <20250124162836.2332150-44-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Unlike the other users of do_2misc_narrow_scalar(), FCVTXN (scalar) is always double-to-single and must honour FPCR.NEP. Implement this directly in a trans function rather than using do_2misc_narrow_scalar(). We still need gen_fcvtxn_sd() and the f_scalar_fcvtxn[] array for the FCVTXN (vector) insn, so we move those down in the file to where they are used. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 43 ++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 7412787b6b6..6dc5648cb1b 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -9258,24 +9258,21 @@ static ArithOneOp * const f_scalar_uqxtn[] = { }; TRANS(UQXTN_s, do_2misc_narrow_scalar, a, f_scalar_uqxtn) -static void gen_fcvtxn_sd(TCGv_i64 d, TCGv_i64 n) +static bool trans_FCVTXN_s(DisasContext *s, arg_rr_e *a) { - /* - * 64 bit to 32 bit float conversion - * with von Neumann rounding (round to odd) - */ - TCGv_i32 tmp = tcg_temp_new_i32(); - gen_helper_fcvtx_f64_to_f32(tmp, n, fpstatus_ptr(FPST_FPCR_A64)); - tcg_gen_extu_i32_i64(d, tmp); + if (fp_access_check(s)) { + /* + * 64 bit to 32 bit float conversion + * with von Neumann rounding (round to odd) + */ + TCGv_i64 src = read_fp_dreg(s, a->rn); + TCGv_i32 dst = tcg_temp_new_i32(); + gen_helper_fcvtx_f64_to_f32(dst, src, fpstatus_ptr(FPST_FPCR_A64)); + write_fp_sreg_merging(s, a->rd, a->rd, dst); + } + return true; } -static ArithOneOp * const f_scalar_fcvtxn[] = { - NULL, - NULL, - gen_fcvtxn_sd, -}; -TRANS(FCVTXN_s, do_2misc_narrow_scalar, a, f_scalar_fcvtxn) - #undef WRAP_ENV static bool do_gvec_fn2(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn) @@ -9377,11 +9374,27 @@ static void gen_fcvtn_sd(TCGv_i64 d, TCGv_i64 n) tcg_gen_extu_i32_i64(d, tmp); } +static void gen_fcvtxn_sd(TCGv_i64 d, TCGv_i64 n) +{ + /* + * 64 bit to 32 bit float conversion + * with von Neumann rounding (round to odd) + */ + TCGv_i32 tmp = tcg_temp_new_i32(); + gen_helper_fcvtx_f64_to_f32(tmp, n, fpstatus_ptr(FPST_FPCR_A64)); + tcg_gen_extu_i32_i64(d, tmp); +} + static ArithOneOp * const f_vector_fcvtn[] = { NULL, gen_fcvtn_hs, gen_fcvtn_sd, }; +static ArithOneOp * const f_scalar_fcvtxn[] = { + NULL, + NULL, + gen_fcvtxn_sd, +}; TRANS(FCVTN_v, do_2misc_narrow_vector, a, f_vector_fcvtn) TRANS(FCVTXN_v, do_2misc_narrow_vector, a, f_scalar_fcvtxn) From patchwork Fri Jan 24 16:28:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859615 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp889066wrq; Fri, 24 Jan 2025 08:49:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV92I1smtWhUYR+2KGe59ddsMEMHna3IrO0ufVzIr38R2wq+AvVUR8Os0sakQvYke6zYbuUKw==@linaro.org X-Google-Smtp-Source: AGHT+IFIo+rhto57UgbT6WetfzC3jkQXBQeRDBGUdJN3H6keLGS0tPbODPSBNr7vMNofmDHZSIJk X-Received: by 2002:a05:6102:2d0d:b0:4b6:44ff:414e with SMTP id ada2fe7eead31-4b690ce4767mr30526490137.17.1737737362810; Fri, 24 Jan 2025 08:49:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737362; cv=none; d=google.com; s=arc-20240605; b=bs36LMCgXP/TXMl6+i2J4M1Mqj3r6YS+IblYM8gJm6X21lR5rOsyeCF1aRWKmvC/VL 7bjgTl5psSFkEbRUQwq2FA+u2RCo51OaUtIi8VbCsj715uw5CPp6V5YRsNRqApNKhRF3 HdIwsChKyofBOZqGZ2wK/q5B1sSfFlSEQzx9apjM4MdeV1QNlbpLD2Wujll+qNuGb8J9 jll5PcOgiGwSqIJ3Wv7YOrCZdh+EnkAuczO4Gi8q8YREQdZoKvMLvKsZaJvsevnO20O7 UPlTsomlSduZqEpVrWOl3cXeSxHLndzvIvVevjIYQoRQkgpzYFBVPi22t/rYKn2U8Rcp tCCQ== 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=BuQK6peoOcUuSYgPPaEbb7kN/jXaBJX91yp1YJkWkF0=; fh=hg9/uK6Eb8dNyLJUqbUBrRvFYkAkCREyT8bCcWePFTE=; b=G2XmffMzzpdMChLBp0mC21nlMu8i06mxQa+ikPHchUSB7DBVAFzDml1rihQCI9KWVh 2KE7/GrhiJe3Mdq+XU9bkVvUpO5y9IpsFYwubbs8dWSXQ5bywYEOkSrZYTRa9RbXCWGV 95wrD1qnUaVxOc4Jf28y+TpwH9HShHGbcl7ILo/R+MTtspvz93Us7cGaO1cSx2XXsMSi CY+Emz7SNdJ69zNwaylOGHRqaFbqRaJLewETeq7SGOOkBYe/khvTvWcqzQcQWt6A6OBE I+LgDDNrt1xWqqTmspGTW+e/JEyxLilEBHl1HZ+rCnDQn8Ls+bB1Oo/cOxMX3XX3+cEH KPWQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VGOtBfrH; 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 ada2fe7eead31-4b709758914si875871137.55.2025.01.24.08.49.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:49:22 -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=VGOtBfrH; 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 1tbMdf-0008MV-5T; Fri, 24 Jan 2025 11:34: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 1tbMYp-00052n-QI for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:35 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYn-0005fW-Th for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:35 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso16645755e9.1 for ; Fri, 24 Jan 2025 08:29:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736172; x=1738340972; 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=BuQK6peoOcUuSYgPPaEbb7kN/jXaBJX91yp1YJkWkF0=; b=VGOtBfrHPXIzxVWbYN9BQcqY8KJYvHoRlAS/JbEWK3qLAqsaICzG8azx09heF47Xry c4BkfeKkQcjIGMLKkkh11h60vvIV+5dwMjN+qh6SeAoYrXbcCEKxeffqQQqm9WMGVK3s Kflzmgz7VsJBNF8YugWOMvMWRxw/EPB54RaK6SdXWhJ96wooHWih2R8xdgMZoVXjo2nV bbr6B/a6R7LqtXhi7g6FnNvr8MqTY5t6AfqYGa0bR214w7NeT0O1gvOewnl7aDvydWIw lYL0EWTGn/J2BXjGdpVXOSWBQs3xatoo2hGvxgMpgdT+NHbGjHlk0fxKGm+okGQJ/jfO 4ZeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736172; x=1738340972; 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=BuQK6peoOcUuSYgPPaEbb7kN/jXaBJX91yp1YJkWkF0=; b=M6q+AH+37uIdw1D4jT2PcqvqRnTg8s8VBwGIUm3Q/q2BOINiC/0PEa3KVXd0k6ixeY TjPESrYIz+LK82AcAFuge08FZat6ZAwln8fZY+5MNDBunY5aMkERvSJC9FqgBlZB2BM0 7XqxnyGDViEek9TsgOqCDhfV0EU5vXcsz4lrDW/ItIaRq4EVLTmRNomXpF7iyh2AZsgM Ax0w7zv31A1x/izw33kIp01Ajt2w54syWOVREQ7S8oHSzWSw9pEc7qldMpxYXtwK/08x /huxE8oBlilqoZewkGEPcHQ0nJ2NgIQuVwzLMarPSa/c31/wOHS9UmcszN02xSenZs65 73HQ== X-Forwarded-Encrypted: i=1; AJvYcCV9qih1BU6y9iyOOu96pNWj17inC0X5I3LXQecaBTscd4UWL5lA5UgoduTxqb73lf1uiR77zVZ+ynoP@nongnu.org X-Gm-Message-State: AOJu0Yym8BXFw63kjagAC1sIR3/HqDiJjDo7jA2MbebcFv0VSPH2ViW7 dABDrFsQRZVVJOxdr8lBvxE0tmKJ72ULciy+BzhhmfK59CTYjf10TCT+KDaaStg= X-Gm-Gg: ASbGncu2RLmRHLIHoe+zKVmpkoKS0HyUjwrxbNPtQ47noXvRhYoQYMr/B6Ak9h/M+Cl +fzsY1qFDEgDIsFD61gLjaidAs3R2OE67vmzYyUS0tISMBgHSOSHqzasVTd6vc4P86LTASnklRT t0iQJTobt2BW7k2VkadRE0faWAx4QSH9+gzrnVzfBbPofvSgxsP3WlcYifcvszV8yfcwgF0nuJp Krd6RN9tmvbTsRw+xv7qo0/NKVLgj8MG1/Z4sB1//FUJGIpaEAZ4bS2i75SFHVjYGrD2E7lku45 ZjoZqMnKVHU= X-Received: by 2002:a05:600c:3b0f:b0:434:ffe3:bc7d with SMTP id 5b1f17b1804b1-438913f01a1mr325246635e9.16.1737736172422; Fri, 24 Jan 2025 08:29:32 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:31 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 44/76] target/arm: Handle FPCR.NEP for NEP for FMUL, FMULX scalar by element Date: Fri, 24 Jan 2025 16:28:04 +0000 Message-Id: <20250124162836.2332150-45-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 do_fp3_scalar_idx() is used only for the FMUL and FMULX scalar by element instructions; these both need to merge the result with the Rn register when FPCR.NEP is set. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 6dc5648cb1b..d3575ac1154 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6307,7 +6307,7 @@ static bool do_fp3_scalar_idx(DisasContext *s, arg_rrx_e *a, const FPScalar *f) read_vec_element(s, t1, a->rm, a->idx, MO_64); f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); - write_fp_dreg(s, a->rd, t0); + write_fp_dreg_merging(s, a->rd, a->rn, t0); } break; case MO_32: @@ -6317,7 +6317,7 @@ static bool do_fp3_scalar_idx(DisasContext *s, arg_rrx_e *a, const FPScalar *f) read_vec_element_i32(s, t1, a->rm, a->idx, MO_32); f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR_A64)); - write_fp_sreg(s, a->rd, t0); + write_fp_sreg_merging(s, a->rd, a->rn, t0); } break; case MO_16: @@ -6330,7 +6330,7 @@ static bool do_fp3_scalar_idx(DisasContext *s, arg_rrx_e *a, const FPScalar *f) read_vec_element_i32(s, t1, a->rm, a->idx, MO_16); f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16_A64)); - write_fp_sreg(s, a->rd, t0); + write_fp_hreg_merging(s, a->rd, a->rn, t0); } break; default: From patchwork Fri Jan 24 16:28:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859607 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp887701wrq; Fri, 24 Jan 2025 08:46:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUOjTAmPFPd/xAv11YN1QzGMS12wwsUvzM8iT2Exy1pmtN/kl5XoaB4pWoIii5wORmKhqZYMQ==@linaro.org X-Google-Smtp-Source: AGHT+IF6GOf1I6wkww+sSS29208cT8mLcYIdNbFYKWkycCpfzw1BphUf3ak6uT08H8B9iGjF3f7I X-Received: by 2002:a05:620a:191f:b0:7b6:d393:c213 with SMTP id af79cd13be357-7be6321031dmr5354752685a.8.1737737171865; Fri, 24 Jan 2025 08:46:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737171; cv=none; d=google.com; s=arc-20240605; b=TdWEwMgzOfq/1Hwu6KNeXQg2MvAkJ+lrdW7UJ53/gy5R+fw58gWcYH3aly4x2TMOML 1Kny7iKhXlBsTLmXoMqPb3RTMMIoztN9WvFpzIm3kQ20yIw1HnQtt5k6KPD978HSeSOt U0QXPxT5FLVTnZpS4GLXSUvilR5HD/PcaVfeBuc2U/mVdp2F0e4lnCxVoN+s10RSfSdG huINORU+winQCuP1VddJcA+ENKCt8gVF/agz7P1Q4lISyKf2Q96rJwOhpH/D1PULY3uS NGVmRuAyGWW4GYYaKSFUv6x7Mh9xfSiTCHIWoKaeuHCpk4Be6D+VErc/tYgb8XPSRwNH TwwQ== 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=TJWHKwJc3eVXnXS7s+U0+OWmDKYYczcs9FMJOdpDaQc=; fh=FStj1P1da85r2hVhB3KU7G8tlnd1NKy5ykQd641CKqg=; b=byMtcjlVpI0GUyf3VekUw5srzmPw+E/iyEMlgwAlnLYxf0uYd83YktA1IYnOIVCGZF cgp4Kv5XU6J0cdQXBabtlp9FjicAIv7OBPRsk+xsLz1mNxYf20S1kWSTzbaGYFYuO3NG /sgc3SdSBs0VawAzcOtXM69z8DE799padjkWlYNJGEStyqn9dWPCkt6NmrbFXkXPoRhy HAvDBS4bc+a3kQ06jZffmH2kqQJTCFcklMvDrJ1HnLOJlDBC94fju//vWcyOUaOgME6C eRXx3SWuxLgv0Z4OFaXTkQ+rUf+9VKvHlYTX3WylJkPg2BrMLCYhJ0F1lMlV89+H/62A xG/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XfkzxoyG; 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-7be9ae81a33si272051685a.111.2025.01.24.08.46.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:46:11 -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=XfkzxoyG; 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 1tbMbv-0002p5-4c; Fri, 24 Jan 2025 11:32:47 -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 1tbMYq-00057c-V9 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:36 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYp-0005fs-1G for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:36 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4361815b96cso15921295e9.1 for ; Fri, 24 Jan 2025 08:29:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736173; x=1738340973; 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=TJWHKwJc3eVXnXS7s+U0+OWmDKYYczcs9FMJOdpDaQc=; b=XfkzxoyG7VokJzyXm4X3yULPKw0utZA4mN2vItNaxuyYexP1TK2p6Vwh/sxCUCdpIo 13EV+HNJBpfWuTJX+deRULB85723Uu5TdG5ysN/sPB/OpY1kRe6YMV3gf28xRBetcC9S gIPvsVI0leN5tZiPiiI+ToB8xcg+4kFIw0oqacIEN02e0aHlRGFPAepgipja5GAbi5wY D/Z6wtyt/ho2RCRrwUNwCFahDaJ9C+Bq0eNn7pMPNciXcwB3DnsdnANiPUBH898gwU8h +1/mkMM5MizLpa+g5S41CROzIYy3Y7+dqZt/+YNE+WqsVEwnTZTRaoEvi+B6Ez5Lj1X5 rjGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736173; x=1738340973; 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=TJWHKwJc3eVXnXS7s+U0+OWmDKYYczcs9FMJOdpDaQc=; b=m1B0810gLAUspkEaFBfE+dRmo5autsxh4fK/pIxbOn9Zg1F7uNIWeZ41Sk923d8guQ bqU0S59dBRWa4pniIbzY0UTB4Ood87vjqF/Ch7zu8nbC4BhzM84O0ZdRT/Px/6SYsI0Y Vnxg4oB941z8Maak2QxCkGaQ7EucE97tKKGvAwnwbnkEDf3TBki9HfExmZC9fMRASW1p VVCbVomF8Y6rvm3Ayf2u58O119uG5FcZquNWkm/jKwrFraHc1YY8DXaKsEkqVz4QwP3H 8zwUmnT6PuhqH/CX+gbllT7zpZeHJWpZCoOleN900B7WcC39RzDM0CIJcAQzgKuM2VcW jnrA== X-Forwarded-Encrypted: i=1; AJvYcCXjxhPLtNi42TJhmwfWUs9YJ2Rn+ikvIIaHLIMX+SVDFnAFW4e20BtJNnAjhCpP0rJrIIqEhIeCLC7v@nongnu.org X-Gm-Message-State: AOJu0YySc4ZpagrheMG2eIa2to5xsNUdLgPtn0df2n/VJXL3qEy/MJ9n SE3KFqTOMQGnag5upxoEE+hKOW7NbtjnU8uUR0C1nntTmSaOieKQFVysPM42ypA= X-Gm-Gg: ASbGncvoCkq64evczVOjyVwuxjguvPeBFhiBiUeEnMYHyWulKSXr4yRd8lyn09IPrRZ qW7FKjSEr4apZLW7GFiaoC6a1IsBpnGzmohlXasX+pIiUbOW03CdAckspRId3cJhz4maUyv1bYa 6MrB4UALHz48F6F6gUnWdsJHzNTlNvoOtC+lHpBN9Xm94GHYEg6uGx4sYky+ENJ/BxRgPqN4n4U qfLTno2z37Fu2gkiUhNTZun4fqscYrGilUxkJbJAexjgkrBPnsnQwYzzqdUy33CAMiSmFcQKaZa mmG3UnW0fSs= X-Received: by 2002:a05:600c:8717:b0:434:fbcd:1382 with SMTP id 5b1f17b1804b1-438913ca6acmr330021005e9.11.1737736173597; Fri, 24 Jan 2025 08:29:33 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:32 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 45/76] target/arm: Implement FPCR.AH semantics for scalar FMIN/FMAX Date: Fri, 24 Jan 2025 16:28:05 +0000 Message-Id: <20250124162836.2332150-46-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 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 When FPCR.AH == 1, floating point FMIN and FMAX have some odd special cases: * comparing two zeroes (even of different sign) or comparing a NaN with anything always returns the second argument (possibly squashed to zero) * denormal outputs are not squashed to zero regardless of FZ or FZ16 Implement these semantics in new helper functions and select them at translate time if FPCR.AH is 1 for the scalar FMAX and FMIN insns. (We will convert the other FMAX and FMIN insns in subsequent commits.) Note that FMINNM and FMAXNM are not affected. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-a64.h | 7 +++++++ target/arm/tcg/helper-a64.c | 36 ++++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 23 ++++++++++++++++++++-- 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h index bac12fbe55b..ae0424f6de9 100644 --- a/target/arm/tcg/helper-a64.h +++ b/target/arm/tcg/helper-a64.h @@ -67,6 +67,13 @@ DEF_HELPER_4(advsimd_muladd2h, i32, i32, i32, i32, fpst) DEF_HELPER_2(advsimd_rinth_exact, f16, f16, fpst) DEF_HELPER_2(advsimd_rinth, f16, f16, fpst) +DEF_HELPER_3(vfp_ah_minh, f16, f16, f16, fpst) +DEF_HELPER_3(vfp_ah_mins, f32, f32, f32, fpst) +DEF_HELPER_3(vfp_ah_mind, f64, f64, f64, fpst) +DEF_HELPER_3(vfp_ah_maxh, f16, f16, f16, fpst) +DEF_HELPER_3(vfp_ah_maxs, f32, f32, f32, fpst) +DEF_HELPER_3(vfp_ah_maxd, f64, f64, f64, fpst) + DEF_HELPER_2(exception_return, void, env, i64) DEF_HELPER_FLAGS_2(dc_zva, TCG_CALL_NO_WG, void, env, i64) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 05036089dd7..406d76e1129 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -399,6 +399,42 @@ float32 HELPER(fcvtx_f64_to_f32)(float64 a, float_status *fpst) return r; } +/* + * AH=1 min/max have some odd special cases: + * comparing two zeroes (even of different sign), (NaN, anything), + * or (anything, NaN) should return the second argument (possibly + * squashed to zero). + * Also, denormal outputs are not squashed to zero regardless of FZ or FZ16. + */ +#define AH_MINMAX_HELPER(NAME, CTYPE, FLOATTYPE, MINMAX) \ + CTYPE HELPER(NAME)(CTYPE a, CTYPE b, float_status *fpst) \ + { \ + bool save; \ + CTYPE r; \ + a = FLOATTYPE ## _squash_input_denormal(a, fpst); \ + b = FLOATTYPE ## _squash_input_denormal(b, fpst); \ + if (FLOATTYPE ## _is_zero(a) && FLOATTYPE ## _is_zero(b)) { \ + return b; \ + } \ + if (FLOATTYPE ## _is_any_nan(a) || \ + FLOATTYPE ## _is_any_nan(b)) { \ + float_raise(float_flag_invalid, fpst); \ + return b; \ + } \ + save = get_flush_to_zero(fpst); \ + set_flush_to_zero(false, fpst); \ + r = FLOATTYPE ## _ ## MINMAX(a, b, fpst); \ + set_flush_to_zero(save, fpst); \ + return r; \ + } + +AH_MINMAX_HELPER(vfp_ah_minh, dh_ctype_f16, float16, min) +AH_MINMAX_HELPER(vfp_ah_mins, float32, float32, min) +AH_MINMAX_HELPER(vfp_ah_mind, float64, float64, min) +AH_MINMAX_HELPER(vfp_ah_maxh, dh_ctype_f16, float16, max) +AH_MINMAX_HELPER(vfp_ah_maxs, float32, float32, max) +AH_MINMAX_HELPER(vfp_ah_maxd, float64, float64, max) + /* 64-bit versions of the CRC helpers. Note that although the operation * (and the prototypes of crc32c() and crc32() mean that only the bottom * 32 bits of the accumulator and result are used, we pass and return diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index d3575ac1154..a6f24ad9746 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5152,6 +5152,15 @@ static bool do_fp3_scalar_ah(DisasContext *s, arg_rrr_e *a, const FPScalar *f, select_fpst(s, a->esz)); } +/* Some insns need to call different helpers when FPCR.AH == 1 */ +static bool do_fp3_scalar_2fn(DisasContext *s, arg_rrr_e *a, + const FPScalar *fnormal, + const FPScalar *fah, + int mergereg) +{ + return do_fp3_scalar(s, a, s->fpcr_ah ? fah : fnormal, mergereg); +} + static const FPScalar f_scalar_fadd = { gen_helper_vfp_addh, gen_helper_vfp_adds, @@ -5185,14 +5194,24 @@ static const FPScalar f_scalar_fmax = { gen_helper_vfp_maxs, gen_helper_vfp_maxd, }; -TRANS(FMAX_s, do_fp3_scalar, a, &f_scalar_fmax, a->rn) +static const FPScalar f_scalar_fmax_ah = { + gen_helper_vfp_ah_maxh, + gen_helper_vfp_ah_maxs, + gen_helper_vfp_ah_maxd, +}; +TRANS(FMAX_s, do_fp3_scalar_2fn, a, &f_scalar_fmax, &f_scalar_fmax_ah, a->rn) static const FPScalar f_scalar_fmin = { gen_helper_vfp_minh, gen_helper_vfp_mins, gen_helper_vfp_mind, }; -TRANS(FMIN_s, do_fp3_scalar, a, &f_scalar_fmin, a->rn) +static const FPScalar f_scalar_fmin_ah = { + gen_helper_vfp_ah_minh, + gen_helper_vfp_ah_mins, + gen_helper_vfp_ah_mind, +}; +TRANS(FMIN_s, do_fp3_scalar_2fn, a, &f_scalar_fmin, &f_scalar_fmin_ah, a->rn) static const FPScalar f_scalar_fmaxnm = { gen_helper_vfp_maxnumh, From patchwork Fri Jan 24 16:28:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859630 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp892283wrq; Fri, 24 Jan 2025 08:57:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW2wBdb5srdB8i0C/ngMf3xKugd7rxEjSIQONSbYaQi5MEYAAa0Etx81e/6gBT4BVo7SqcKbw==@linaro.org X-Google-Smtp-Source: AGHT+IFEbtq+BbRRZvrJgli1ZKGt8dEb5RphEO0Y8h3UbN5ARlYrthwZbW4jnxdW1uX9wPF8sqw2 X-Received: by 2002:a05:620a:4513:b0:7b6:dd9c:fac1 with SMTP id af79cd13be357-7be63287ac7mr5388431585a.49.1737737819846; Fri, 24 Jan 2025 08:56:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737819; cv=none; d=google.com; s=arc-20240605; b=Jo0q7tkXr0TAUfvIEFUJSQcz2TCeCbUIQS+NDWSTPtXzRcB3IdPTUwPMgcdIQqLPMf a9hXRSETV6gJRf+o5E5wAJg3Nhj0qb4LnYWi68GoFWGcUhQszIk05EClNCbcJKQgirJj wjknmUSJFqaUYazrGz2bsUdaH+zO5LCu7PB/DX0kHD0TqXe44d9keCmhAqkeR0xLyEEw Q3UBol4Y9AoFlQF3bdJyAq64fq64h0nTVwxfQ3CVFew5KoXkKpC41Ig7qHfasOU2Ye7D +Vt1XiySRsp6+7JNuN9iSZ7KCuRChVB/0qWnYOy5woK93WNwU+HYs/JwVXcSBSL4X3Sa XBfA== 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=2Mw+LALc3gCHAn7j1F7N81Llm3ddW1SJ4lLHkZVYPkc=; fh=8VgupFCfCmdhSEnK8+cUzyARssObDF/SB3pueemNpfg=; b=LZunnTfjJo7+4e0yR2nW0Fq8m+Iw+I5wU/a3Nc3pMJpPVEv3GCc2tDvshqMy26LVL/ yaiSxwW5nV13eEvvnqrd6OLOFzLO1/6jz45BweJBnTnplyDtjOSQryGKCyI6e8Xx0JfU ggGXgDee+g5yPZgqt+A2NtH2VpNMtLtaKLRhwtR0H5Pq3sm7XpccTGZC0H3xO1bvrBhJ aWRGNmnjQaT1vn5sSr6x9+0usalLv23EkaIowGDFk+aDJZXcouk77v5r6C0yQGBhA42Z VQrv4YR05JTT1Hn0wnkObFZqITUXDEDQwT3OeegCn6mev0K4Gt+hjsgYAK/XjVJNqvjO RwHw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b2LPCBEV; 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-7be9aee08casi307863185a.284.2025.01.24.08.56.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:56:59 -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=b2LPCBEV; 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 1tbMcs-0006kA-Nr; Fri, 24 Jan 2025 11:33:46 -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 1tbMYs-0005G3-0O for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:38 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYq-0005gT-7k for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:37 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43626213fffso22182385e9.1 for ; Fri, 24 Jan 2025 08:29:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736175; x=1738340975; 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=2Mw+LALc3gCHAn7j1F7N81Llm3ddW1SJ4lLHkZVYPkc=; b=b2LPCBEVCoKLGn31wyOK+lbAFR81KX4cEBsbIm/TfPG71IhVRxqgODrL6S8nVULDyn vERH9uEjAzq3N98O2mrr5PNpK0Y/JI6UiIXIn53c2G8ICCiIvteylQHHMRnjmh8iTos6 8ARGv3+u5riHK+S2c55CqcYeQvo6B0rZ5JI5Jy1fTY1qrV7S7Ue5jjBpSGoXrBUG4rbR Z0ZYU64bIKOPjJuGzImUNwsU7ojvoqQzawApgqWhyPtquFSS6Zztv6TCFfIyej2jiWKJ lIvJHiZTH8CMzH8mEq51m6jT0hrKpDAUz5T5kWCdVKKdSu2d0S3Vuwd6hvF8ADUtidn5 CQEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736175; x=1738340975; 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=2Mw+LALc3gCHAn7j1F7N81Llm3ddW1SJ4lLHkZVYPkc=; b=dGrwfH+368Y6fEYHETUtj34X2nNKSW9E2uNYrlAG2T72YXkuqpq5daFA9mb6Gyh2qb T3VPrZLZMzDhjNAI7dbrSs84gijZjb8Ei/pLRTXOCmagNtMadghaqNnX4QGtlxaokVdl wgxwNvrWRlQYkQxlX3HhOP+OOXr733heYWaY1/qtSU60nPI5VDxs1WZVHupSFj0EJPHQ MH+W6eKYq+uKgy2goShia4DThr9flJvZv5FUB09mvrQFHj++gRjmwbZFeO8DNMUmpKK7 U9BxEHIIXeC76TM5KcMtZ0VjlFry+QOeR0M74mvUHSw3sM/xM1JvnpwpEFUsctxKWE0u MPVA== X-Forwarded-Encrypted: i=1; AJvYcCXqTbFPDyCce5tY6ZEepAbHhNbciICYlyvyREEXHZesFcO4zLyv8mjUthTvMfBdqziALx0AoWpuRAGm@nongnu.org X-Gm-Message-State: AOJu0Yz/UcUYwwNfyCHVHxYXgdFsdQ2idtRmQlPGrpfbrxXcgMjIky0/ Zi+LS+d1itqHWcEtOa4ir4qQAiqbgFIReJWCw+Z9aEa+6OXJu0VPrmW9jM/4gDs= X-Gm-Gg: ASbGncsW3rUfeUdgTgNQgjAyNNkunWJZfJha7Zx1brky2u7R7Yod2TziJ6CiC5qdK1t MWc1Me2JYrcow3tuAuQAdZ1t714zOuYphv6bm0Qgr1Do7t8FbmvJcNIkYBKC+FkDaPXk3BlJOEf BDfduFAQkFRsT14tpEz/H8HeBQ1d3mj9orOY5/jjOKhFX8b7e5EmSK47tMHmCikp4zP45CMwOpN 5Uia4FZEyNp8Xjy6OvRZ+zRtt/99YBL+nZsXWhWZlrYcFDIowW/sEIzKPVfvdZOSeY8u3Yt5Am9 DohI6XFeTOs= X-Received: by 2002:a05:600c:1d0c:b0:434:f9ad:7222 with SMTP id 5b1f17b1804b1-438b885652fmr75928375e9.7.1737736174786; Fri, 24 Jan 2025 08:29:34 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:33 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 46/76] target/arm: Implement FPCR.AH semantics for vector FMIN/FMAX Date: Fri, 24 Jan 2025 16:28:06 +0000 Message-Id: <20250124162836.2332150-47-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Implement the FPCR.AH == 1 semantics for vector FMIN/FMAX, by creating new _ah_ versions of the gvec helpers which invoke the scalar fmin_ah and fmax_ah helpers on each element. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 14 ++++++++++++++ target/arm/tcg/translate-a64.c | 21 +++++++++++++++++++-- target/arm/tcg/vec_helper.c | 8 ++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index fea43b319c3..f1b4606f763 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -972,6 +972,20 @@ DEF_HELPER_FLAGS_5(gvec_rsqrts_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_5(gvec_rsqrts_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fmax_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fmax_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fmax_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) + +DEF_HELPER_FLAGS_5(gvec_ah_fmin_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fmin_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fmin_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) + DEF_HELPER_FLAGS_4(sve_faddv_h, TCG_CALL_NO_RWG, i64, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(sve_faddv_s, TCG_CALL_NO_RWG, diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index a6f24ad9746..330336f0828 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5607,6 +5607,13 @@ static bool do_fp3_vector(DisasContext *s, arg_qrrr_e *a, int data, FPST_FPCR_F16_A64 :FPST_FPCR_A64); } +static bool do_fp3_vector_2fn(DisasContext *s, arg_qrrr_e *a, int data, + gen_helper_gvec_3_ptr * const fnormal[3], + gen_helper_gvec_3_ptr * const fah[3]) +{ + return do_fp3_vector(s, a, data, s->fpcr_ah ? fah : fnormal); +} + static bool do_fp3_vector_ah(DisasContext *s, arg_qrrr_e *a, int data, gen_helper_gvec_3_ptr * const f[3]) { @@ -5647,14 +5654,24 @@ static gen_helper_gvec_3_ptr * const f_vector_fmax[3] = { gen_helper_gvec_fmax_s, gen_helper_gvec_fmax_d, }; -TRANS(FMAX_v, do_fp3_vector, a, 0, f_vector_fmax) +static gen_helper_gvec_3_ptr * const f_vector_fmax_ah[3] = { + gen_helper_gvec_ah_fmax_h, + gen_helper_gvec_ah_fmax_s, + gen_helper_gvec_ah_fmax_d, +}; +TRANS(FMAX_v, do_fp3_vector_2fn, a, 0, f_vector_fmax, f_vector_fmax_ah) static gen_helper_gvec_3_ptr * const f_vector_fmin[3] = { gen_helper_gvec_fmin_h, gen_helper_gvec_fmin_s, gen_helper_gvec_fmin_d, }; -TRANS(FMIN_v, do_fp3_vector, a, 0, f_vector_fmin) +static gen_helper_gvec_3_ptr * const f_vector_fmin_ah[3] = { + gen_helper_gvec_ah_fmin_h, + gen_helper_gvec_ah_fmin_s, + gen_helper_gvec_ah_fmin_d, +}; +TRANS(FMIN_v, do_fp3_vector_2fn, a, 0, f_vector_fmin, f_vector_fmin_ah) static gen_helper_gvec_3_ptr * const f_vector_fmaxnm[3] = { gen_helper_gvec_fmaxnum_h, diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 3fbca8bc8bf..c7af9a04a27 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -1448,6 +1448,14 @@ DO_3OP(gvec_rsqrts_h, helper_rsqrtsf_f16, float16) DO_3OP(gvec_rsqrts_s, helper_rsqrtsf_f32, float32) DO_3OP(gvec_rsqrts_d, helper_rsqrtsf_f64, float64) +DO_3OP(gvec_ah_fmax_h, helper_vfp_ah_maxh, float16) +DO_3OP(gvec_ah_fmax_s, helper_vfp_ah_maxs, float32) +DO_3OP(gvec_ah_fmax_d, helper_vfp_ah_maxd, float64) + +DO_3OP(gvec_ah_fmin_h, helper_vfp_ah_minh, float16) +DO_3OP(gvec_ah_fmin_s, helper_vfp_ah_mins, float32) +DO_3OP(gvec_ah_fmin_d, helper_vfp_ah_mind, float64) + #endif #undef DO_3OP From patchwork Fri Jan 24 16:28:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859606 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp887698wrq; Fri, 24 Jan 2025 08:46:11 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVZpBZogUaCSO3fl+ezpjn2KsNGMwjCtMh+MOCayaallYnGkel7XGLZtg0Xdn2K5quwnfDlsg==@linaro.org X-Google-Smtp-Source: AGHT+IFMJ6iVSgppAdgvFxiC73g3s2vz4sX6X/ytseTON8psIEfJfvRNWm1LJvtsnAKAcmvVKGwt X-Received: by 2002:a05:620a:3950:b0:7b6:78e9:1ea2 with SMTP id af79cd13be357-7be63219946mr4487560685a.4.1737737171642; Fri, 24 Jan 2025 08:46:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737171; cv=none; d=google.com; s=arc-20240605; b=jOgj2jPUScpBkz3by/pCpTk7o167S+2w0nNurox+LZsWIRf7Ulg3u0LdY1ouV/8vxt ygQlIAoELrJfagXJdr8Wv7r25a+SIKhu9JcuFvK9n9uEZUyJ8oHnUy3OAUM9hQyC3K0x QRjbBs8fcDN8BpjBCAB6AkAeDeN9Q0SWr3RcmsWfw1eJh8xj4i/c/MAAuxAkYGof6m5M 7pv0V+Z4NyvT4JJtxA1RGg2kzfKkNaKQ//781L+xHJszjT0Q7UKj/EqMX0NWghJCfyX8 +J/AxR3n7hC0UJ3fhEX5TsfDqmi8WxyEDF4/VkwaiYwuioIHHlf2DahOLJ7WqyK5Ka45 g9eA== 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=ZZv9bq0gc1TNRBfKcXqBREv5BnIPhNP5omygXi9vvRM=; fh=krLh6PEqIGOPdwgXeZpMD0xMquN7YnkuaRR5yy17u68=; b=aXzPwiJWQzAF9eRvkvliB+BgoBKoJRQZEzLxb/3o9LWs5q1i9N4eqZBkbTNgtUXuSr S5Hn4bPoXObQAVAayE+nGT0E6sq4OTtX4NOh/4qOUEdtEqJVBVIdWl9F1SOwVOd0/9xo uFBP1hnjVzYD7y7hNEhofezKd7GwFqiPMIdr2fev8h/KfXBalXDkjWpv3RCfzxDULfaa ipxR93I/Ah99cYXcclZLVGLeO2ptKZvlqz21cj9eDHHfEHmD2sIHvcXARr8wGEdZ8tii NORnDTRDIQLlWqvvKLMHvCafQfXJX/1xA7tegfbLUcH5M1AJZGL1eU16krktcBailkhp jktQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ASqzPj/B"; 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-7be9aee0ee9si260500785a.293.2025.01.24.08.46.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:46:11 -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="ASqzPj/B"; 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 1tbMd3-0007IX-Fn; Fri, 24 Jan 2025 11:33:59 -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 1tbMYt-0005Na-2V for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:39 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYr-0005gq-E6 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:38 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-436202dd730so16570955e9.2 for ; Fri, 24 Jan 2025 08:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736176; x=1738340976; 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=ZZv9bq0gc1TNRBfKcXqBREv5BnIPhNP5omygXi9vvRM=; b=ASqzPj/BA8OepH9orNPRg/HTSQo6M19PpYJ7SjVTMv8Ly4ZQEQh2Q8Ruou1N0GRb0J vItcbGSc4SYL7C8x6mtUlxaPv981Rx9HZ5Gi59FtjYUS023fgIePs0pA1aPJexGa7ML/ pUp5UUMS5PleWIP6edXXsfdn4q2ws9191gz+OlRXuillTJ83FahByoBQWufEA2YAXooQ v+xn9MBdX3fEIZmVjH/YndtjtAascE4Exh+VDHCNBuABuE2g4jgKTdVnbN2GDZRsks4C 42Si+c6WCx0AmgcJRvaDlo6A3OvBdYgwF08G21SWBHObIb1zAcbpfn6PV30nsHWR0sSu 4eWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736176; x=1738340976; 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=ZZv9bq0gc1TNRBfKcXqBREv5BnIPhNP5omygXi9vvRM=; b=kQt+rbve4UUEU8w5n22K6SyKWdppB1agLBzraoKP6nq5S4BBnLrdX/7uJAubMPjCGa FPYMtIqeN2YIaA+vm6EvPXtX3923XBUgs97/PEJ6tMrshMbKNhI/w5azC40u5hX4LgDm ZqRXtQyt+h7fiM8fBckGy/XLvcipCHIncTFUDrpzjz7Ydl8XQ64ECt4PbWnIlv0KFxDQ uKQ0t1XkiHhwLVVq1a3mqMcFqBITeogJYQlNAJZij2sZ6f0mgwc2jRgxe+v5250mW7Ab OxKQM1skbI5hWIyIF4ZLc1Hc8KFt8C+zQ8xAhGGCCzLUV4txO0x6RkwmcGKvCNWRuiSh tA/Q== X-Forwarded-Encrypted: i=1; AJvYcCW7RlpqVz6t5+KwRT5BV3dP1Ltc4ZH0owncdRA1FKZdo8D/kVFxFOyIURwwNGFtL3BgM0fdzkLfOkZ4@nongnu.org X-Gm-Message-State: AOJu0YyTDPq7yIR+PqKCfmXkpzf/Zgh2mxqgevZN0sxZ7GD8PhOKzf9u 1z0V8Cll00yCyUs/J+k/KT1+79sGHHl/wSH5E2qbaDhTKpljzqu9K/TsiPCZ8UM= X-Gm-Gg: ASbGnctOmf9Z9j8dr8yC2nXo7xG7GP6fSSN9B/olkthjc56HVdJxZsgBLc+ZvZ0D37X 2ZlncUAsPPEQ30H9e90JsnFS0cwkVvv1TfVqgIdIFO+ra+c1bpvTO4O5elEXsNedAKxOknuwGkN +hMKBFiI5M5DR32OHvf44ZIl/FAs9Izb+wQ6ZSvV9b5QU2m/M0ybX+OUCaF+rTOmO8q9+pI1KtZ kbwHzc+dJfL0xTJFEZurg4yYcK72AB8HqgLhbocHHZg8Ksxdmqb9Iczm9zPiomhg1QTlLa2pSj9 oPuPczgEKyI= X-Received: by 2002:a05:600c:1d1d:b0:434:faa9:5266 with SMTP id 5b1f17b1804b1-438913e79e2mr281283135e9.13.1737736175953; Fri, 24 Jan 2025 08:29:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:35 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 47/76] target/arm: Implement FPCR.AH semantics for FMAXV and FMINV Date: Fri, 24 Jan 2025 16:28:07 +0000 Message-Id: <20250124162836.2332150-48-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Implement the FPCR.AH semantics for FMAXV and FMINV. These are the "recursively reduce all lanes of a vector to a scalar result" insns; we just need to use the _ah_ helper for the reduction step when FPCR.AH == 1. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 330336f0828..c07e22bad31 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -7029,27 +7029,35 @@ static TCGv_i32 do_reduction_op(DisasContext *s, int rn, MemOp esz, } static bool do_fp_reduction(DisasContext *s, arg_qrr_e *a, - NeonGenTwoSingleOpFn *fn) + NeonGenTwoSingleOpFn *fnormal, + NeonGenTwoSingleOpFn *fah) { if (fp_access_check(s)) { MemOp esz = a->esz; int elts = (a->q ? 16 : 8) >> esz; TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); - TCGv_i32 res = do_reduction_op(s, a->rn, esz, 0, elts, fpst, fn); + TCGv_i32 res = do_reduction_op(s, a->rn, esz, 0, elts, fpst, + s->fpcr_ah ? fah : fnormal); write_fp_sreg(s, a->rd, res); } return true; } -TRANS_FEAT(FMAXNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_maxnumh) -TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_minnumh) -TRANS_FEAT(FMAXV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_maxh) -TRANS_FEAT(FMINV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_minh) +TRANS_FEAT(FMAXNMV_h, aa64_fp16, do_fp_reduction, a, + gen_helper_vfp_maxnumh, gen_helper_vfp_maxnumh) +TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, + gen_helper_vfp_minnumh, gen_helper_vfp_minnumh) +TRANS_FEAT(FMAXV_h, aa64_fp16, do_fp_reduction, a, + gen_helper_vfp_maxh, gen_helper_vfp_ah_maxh) +TRANS_FEAT(FMINV_h, aa64_fp16, do_fp_reduction, a, + gen_helper_vfp_minh, gen_helper_vfp_ah_minh) -TRANS(FMAXNMV_s, do_fp_reduction, a, gen_helper_vfp_maxnums) -TRANS(FMINNMV_s, do_fp_reduction, a, gen_helper_vfp_minnums) -TRANS(FMAXV_s, do_fp_reduction, a, gen_helper_vfp_maxs) -TRANS(FMINV_s, do_fp_reduction, a, gen_helper_vfp_mins) +TRANS(FMAXNMV_s, do_fp_reduction, a, + gen_helper_vfp_maxnums, gen_helper_vfp_maxnums) +TRANS(FMINNMV_s, do_fp_reduction, a, + gen_helper_vfp_minnums, gen_helper_vfp_minnums) +TRANS(FMAXV_s, do_fp_reduction, a, gen_helper_vfp_maxs, gen_helper_vfp_ah_maxs) +TRANS(FMINV_s, do_fp_reduction, a, gen_helper_vfp_mins, gen_helper_vfp_ah_mins) /* * Floating-point Immediate From patchwork Fri Jan 24 16:28:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859623 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp890660wrq; Fri, 24 Jan 2025 08:53:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCULEZ8n2Oo5JswiLn2624mP4/zTdqUPCQniSeugwZapmb/0f4qGVIYPYYWvS0/4pLrkM3+qMw==@linaro.org X-Google-Smtp-Source: AGHT+IGzO6TRRP3tEB5BWKqNf7r4c2SRbUju7griNZ2mQuWyt6t0Dz+aPV59ENevJHpT7n8sf2qq X-Received: by 2002:a05:6214:cce:b0:6d8:ada3:26d3 with SMTP id 6a1803df08f44-6e1b21786c4mr477731126d6.9.1737737585306; Fri, 24 Jan 2025 08:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737585; cv=none; d=google.com; s=arc-20240605; b=iy+2qezi3gtTMKFUZiuBI/qwwho2fGc9RgaXRPHiCWI8+pC46CC6kOGnrLa/4+k1r6 z/nSlLscAvBes5dFI+ZpQ1xinJV+SYfhhmJGhW+IWBmW2puj13GUmrXnUzuYRWW+1AjF FRs1L2yjI1ZK1fo3IiVnZDWj3nHFlKpfmVX6rXcAO+9iINUQPfEL4bIhIaSHmEI0Jphp QYxn1pZjdLPg23rnHj5BkUubSZsJOgsV5qyE89KGivwDi8xsj7f8z6cQuhxktIaQRZdb 8ZK+a0TOCum+mb7+y0Mr0EFrzWLBPzXz69LgxDXQOPfOLXxIIcaWDgTvWLkkrmW5k1cq rbhQ== 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=U0j6vRTPpETqpomxsJi6W+TLpbdYei71WZ9Mhto3dnA=; fh=TMyuq7OwCFcjCSSvc7hgGxFvTjonEyhxbC1HbzUNECA=; b=fd7WsZZS/4gaU5EhnIfAdmA0d0xpcB37OasZO7tqCuZjNrrmju6ilboy4AcHWserU5 fDSxWBPmjlosOyySEX9fpCu24wkBRromJNjPEqDHvs4SaziYTyXdKXybdtk5PsshSkJD MCoIItculsOtfnd8ZQOnAZa+gVhKe16hsiJG5DD6I5ecnbW95vI54VF9/Djryu3PQpg3 LDFKg5J/0RKx/MIMd10YQCP//f09Kh55UaZvLpVirFJr7EL7R/UO9QsGVfnyxVDTrXWg c7U/UeXdMA89AgMGxsW1IpcBc1RWTaNRLgCNCxm5CDDo6WEj1rKvhMJk+4Ss03ZHw8/q RRKQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o7LvzkYC; 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-6e206133f12si28897186d6.481.2025.01.24.08.53.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:53:05 -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=o7LvzkYC; 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 1tbMdr-0000Zz-3C; Fri, 24 Jan 2025 11:34:47 -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 1tbMYu-0005VJ-D0 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:40 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYs-0005hC-HE for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:40 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43622267b2eso23699145e9.0 for ; Fri, 24 Jan 2025 08:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736177; x=1738340977; 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=U0j6vRTPpETqpomxsJi6W+TLpbdYei71WZ9Mhto3dnA=; b=o7LvzkYCRis4MNGikRj3QZtusYAyxCPmH3/QGMhHSqCJVleMzICav91bzqs5HK00Ns 2xFY8oAfqgZ/kTdrFB+ye4+uJa3n17UoGU178cS1XyrbKtoB4rlxPQwFXdot/uQLbBBT hayJIb1HIIRBz2+PCZ64N9Si2LPOPM8pkVkHDdKa25CJIHOsrOl4jLvrjXV5W+1dXJ/2 ge48MOlHby6p+CJPIS4BAw91AeV8WJXspnrOnF+d7Lv9KXSeEDpUCRLijosx5mqDJkfR Z4u0iuPqkkKH8BRmr9K2mBiquYQs4ShOqZAFffyDAKAUyx4yi6gHoT/gdeuRioxARREO Jrxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736177; x=1738340977; 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=U0j6vRTPpETqpomxsJi6W+TLpbdYei71WZ9Mhto3dnA=; b=fFhS5EsVREW4428+/1rkNc/34qG+AE3YqCT7tAUx+SeXu5m7Tz7Ps6E7Ki5NpUVuYe syVLBnX06OHP8gmP08/GvZbqbmiRsik0E4MJPaRb2aBepMlI6NDqhluvIqTnrAOZsxTV r4oaMy+CYL5JRUTmVAAE03cQc4KldBjks6+l+hSR9nLHOgB4ekoi+j6/FgkH3I1V/tot pk+h+FqAZtZO2nfYBTgloKebXn7V85cRNfv+kTJv1BuriWW9XF17Nb9iC8cxiL0/rHZP qh2nSPmPsw9em1UAhzsul7gcD8oquVnivYZWESlQN7XxDeQ6STUlAFsEt6s6XCNJn9SN UpIw== X-Forwarded-Encrypted: i=1; AJvYcCV8Xe2NsMCVOPI28m3nuVtoKgBj8Z5ZhRw3FgiRKtsRX5fJast4G5cg90iNhkL6DE25r6kByy9t9x3J@nongnu.org X-Gm-Message-State: AOJu0Yyb2isHSkzFMfT63BBqHeXZ5zEWjUxo2eFQ6kHRZYGDZQdrdhB8 UKWOIV7J2zGJBX2WMcty65uKcfL11kLiD/UX4d2dcJU2iUHq37iK16kf8LSB1Cg= X-Gm-Gg: ASbGncusvK3XDa3Mbyegn9pR+vyZy5gdvD3hHRL6TXtt8KJ6O/3uooolh1kBBmJBZJ3 aZADE8pfE91gvatkHlnxPS0I4kkZ5+3WMOK+Vlr8g9qhPpmq05CrtnBhoiLzGvjeO3Yc5oPpdF4 woIz5d04jbaKpdb8JoU6T4P+0qM//uZfPdapdKDmXt5ublB9ejZob1Tighx6xfS2h2G5IBvf7zy CfI6P/ieRhacYQHhFN+LZed0ZKRfG30bcHVMWT+ow0eaHSIVl5U5RcvM2ODn+ZjnKY2403veT9F uwXZ/Lvefd0= X-Received: by 2002:a05:600c:3149:b0:434:e9ee:c2d with SMTP id 5b1f17b1804b1-4389144eee4mr250975805e9.26.1737736176994; Fri, 24 Jan 2025 08:29:36 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:36 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 48/76] target/arm: Implement FPCR.AH semantics for FMINP and FMAXP Date: Fri, 24 Jan 2025 16:28:08 +0000 Message-Id: <20250124162836.2332150-49-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Implement the FPCR.AH semantics for the pairwise floating point minimum/maximum insns FMINP and FMAXP. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 14 ++++++++++++++ target/arm/tcg/translate-a64.c | 25 +++++++++++++++++++++---- target/arm/tcg/vec_helper.c | 10 ++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index f1b4606f763..8349752e99b 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -986,6 +986,20 @@ DEF_HELPER_FLAGS_5(gvec_ah_fmin_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_5(gvec_ah_fmin_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fmaxp_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fmaxp_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fmaxp_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) + +DEF_HELPER_FLAGS_5(gvec_ah_fminp_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fminp_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fminp_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) + DEF_HELPER_FLAGS_4(sve_faddv_h, TCG_CALL_NO_RWG, i64, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(sve_faddv_s, TCG_CALL_NO_RWG, diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index c07e22bad31..9d164b80c22 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5776,14 +5776,24 @@ static gen_helper_gvec_3_ptr * const f_vector_fmaxp[3] = { gen_helper_gvec_fmaxp_s, gen_helper_gvec_fmaxp_d, }; -TRANS(FMAXP_v, do_fp3_vector, a, 0, f_vector_fmaxp) +static gen_helper_gvec_3_ptr * const f_vector_ah_fmaxp[3] = { + gen_helper_gvec_ah_fmaxp_h, + gen_helper_gvec_ah_fmaxp_s, + gen_helper_gvec_ah_fmaxp_d, +}; +TRANS(FMAXP_v, do_fp3_vector_2fn, a, 0, f_vector_fmaxp, f_vector_ah_fmaxp) static gen_helper_gvec_3_ptr * const f_vector_fminp[3] = { gen_helper_gvec_fminp_h, gen_helper_gvec_fminp_s, gen_helper_gvec_fminp_d, }; -TRANS(FMINP_v, do_fp3_vector, a, 0, f_vector_fminp) +static gen_helper_gvec_3_ptr * const f_vector_ah_fminp[3] = { + gen_helper_gvec_ah_fminp_h, + gen_helper_gvec_ah_fminp_s, + gen_helper_gvec_ah_fminp_d, +}; +TRANS(FMINP_v, do_fp3_vector_2fn, a, 0, f_vector_fminp, f_vector_ah_fminp) static gen_helper_gvec_3_ptr * const f_vector_fmaxnmp[3] = { gen_helper_gvec_fmaxnump_h, @@ -6775,9 +6785,16 @@ static bool do_fp3_scalar_pair(DisasContext *s, arg_rr_e *a, const FPScalar *f) return true; } +static bool do_fp3_scalar_pair_2fn(DisasContext *s, arg_rr_e *a, + const FPScalar *fnormal, + const FPScalar *fah) +{ + return do_fp3_scalar_pair(s, a, s->fpcr_ah ? fah : fnormal); +} + TRANS(FADDP_s, do_fp3_scalar_pair, a, &f_scalar_fadd) -TRANS(FMAXP_s, do_fp3_scalar_pair, a, &f_scalar_fmax) -TRANS(FMINP_s, do_fp3_scalar_pair, a, &f_scalar_fmin) +TRANS(FMAXP_s, do_fp3_scalar_pair_2fn, a, &f_scalar_fmax, &f_scalar_fmax_ah) +TRANS(FMINP_s, do_fp3_scalar_pair_2fn, a, &f_scalar_fmin, &f_scalar_fmin_ah) TRANS(FMAXNMP_s, do_fp3_scalar_pair, a, &f_scalar_fmaxnm) TRANS(FMINNMP_s, do_fp3_scalar_pair, a, &f_scalar_fminnm) diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index c7af9a04a27..d3f2eaa807e 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2444,6 +2444,16 @@ DO_3OP_PAIR(gvec_fminnump_h, float16_minnum, float16, H2) DO_3OP_PAIR(gvec_fminnump_s, float32_minnum, float32, H4) DO_3OP_PAIR(gvec_fminnump_d, float64_minnum, float64, ) +#ifdef TARGET_AARCH64 +DO_3OP_PAIR(gvec_ah_fmaxp_h, helper_vfp_ah_maxh, float16, H2) +DO_3OP_PAIR(gvec_ah_fmaxp_s, helper_vfp_ah_maxs, float32, H4) +DO_3OP_PAIR(gvec_ah_fmaxp_d, helper_vfp_ah_maxd, float64, ) + +DO_3OP_PAIR(gvec_ah_fminp_h, helper_vfp_ah_minh, float16, H2) +DO_3OP_PAIR(gvec_ah_fminp_s, helper_vfp_ah_mins, float32, H4) +DO_3OP_PAIR(gvec_ah_fminp_d, helper_vfp_ah_mind, float64, ) +#endif + #undef DO_3OP_PAIR #define DO_3OP_PAIR(NAME, FUNC, TYPE, H) \ From patchwork Fri Jan 24 16:28:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859601 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp886985wrq; Fri, 24 Jan 2025 08:44:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVow5XMPQyccqPkFJQeaIF4+EysTPqlKIGRls4i7bi8++SPoViEwQoVmu58sUAUNt2BMDxwCA==@linaro.org X-Google-Smtp-Source: AGHT+IHz0Ttina2ZGA40/1L0Q6s1ucQECfvJ9JHNSXHIexAd0gGIk/jp7mfqKDZa9FnSgAehp/CU X-Received: by 2002:a05:6102:370a:b0:4b1:1caf:f61b with SMTP id ada2fe7eead31-4b690ce4aedmr24980605137.18.1737737080407; Fri, 24 Jan 2025 08:44:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737080; cv=none; d=google.com; s=arc-20240605; b=cIlo8sDZOYBqxjxdvfAELE/dkzYjlla5sIg5oTSuetvw34iqc9X3Snn0nsZbz4wZXL Evc5E2hzw2tnTTg8g+Jv1ivjdKBykxY8vtQCUDxnlomzMzoOHXvi5yzvei1PwKKeJATs 1QCSuzQ5W0HRzIK0ePJdYfkqmyskWyetAsRKVCGeRdvp9VA3XapxfXdcQd81+LHAWiZ/ Z0ooLjthaxJ18x/M9AyHVHqCy+2CSAoSQqzqry1XZ9zaaUHJUDX+jy2YXgjomZCuJMgE gVWePoQwlPMr4dR9TZPK35K7j56rJbxgohheaGMK0/0E1kg0XFQ5xHzi8rjUTpRLWrCK 24uw== 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=uwLB2/qsas/ACZj3WYwXl/SE6xTdp+P0tyNcW+gNK5Y=; fh=UVqf0v3aTcv/AeJFdWChBHQh4/+fG4Q/uofTUmn4XbA=; b=LWZNDA8n93oBtovFEwGm3aoYB1tidXRti6mFMAQZFXc9mpNmmMQYKDjkgcuqFXfYFY w6/gbeM7UiCMn1emMIhJ76KD0/pfzeSIElZIVWJPhhISUHJUjmZJZFHMKtkqdYyRNw1a KoKl8re5Opq2lxcmZvVVXVmf2n5vEmn+q24BXnmpli5dnV1gGQ9+5AVaGp7hO/O3/Oz3 IVvRwDJZlRDStevaU3YiwWZUuyhygG6N5/ltM8ZAHc0ENR9BhQ51ZhOYAMA6AA61gTGc Iw+MrL+hnv/vqF0+geaznngRPf5K+llx+Q7ec3lOs51Q5IkbpYO2xF6KcJ5GpOE9pDvC UWfQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BnrH0Ir4; 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 ada2fe7eead31-4b709a12367si1109630137.586.2025.01.24.08.44.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:44:40 -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=BnrH0Ir4; 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 1tbMdg-0008Qw-91; Fri, 24 Jan 2025 11:34:37 -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 1tbMYw-0005Xr-6t for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:42 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYu-0005he-1k for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:41 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-43634b570c1so16743765e9.0 for ; Fri, 24 Jan 2025 08:29:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736178; x=1738340978; 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=uwLB2/qsas/ACZj3WYwXl/SE6xTdp+P0tyNcW+gNK5Y=; b=BnrH0Ir4KJy352jnc8jjIK2ofgDF2eS+TZhmvianF/mms1MpwG4tlFRRWEYLSoIRry Eq6EgkBC+nTnpgmikf+Zi3dsaor6veeUJ8F2jQt3f0c6RIZu/LFOiCSCnLsV7pwfU5xz 7N8ZVxA/Lu1BFtoAknDjiEgd1AyCy3Mm3fDcTZHuzqxgaAIeu+C2iQ7lRVtO9o7pibr0 +F31hM1b/WB9zXDhnEUDaVY9fXZRpxMkpgeTU5YMR9niSnV1vHX5QLjJNsj8o+2Mm7+p cIlyPXHDHB/pn8pzlpLVD7/NaRYxuTb+4NheDxM5o1SUREnfk095I85j1sBs4bmMZwDk WLog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736178; x=1738340978; 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=uwLB2/qsas/ACZj3WYwXl/SE6xTdp+P0tyNcW+gNK5Y=; b=Nzcffgsy+EsjhQ+9VBSKj03gDtISgoEs3dB7uVOElz9WiRCshpQFcvOgFQXPOKkTsb VcDkg1rrrgphAVTG9mCAVOrQpWO33A3atXVGttA/f9OnXHRSeZ5kaf0nPX32KmKe6aiI BWehI0XTx8UduI9E/QbRanjPKqkeIMt5a6C2q5rm2jw8+AoVGYE01LZ7DprHrZRBEvLO 0ky3zEiFzaEOqxB1WhPPGFZnVj5tD9n1pQKb+TMku73Dbdh07SooILKmQ/PH8XjrCbHA VCOyFbYw4RNNdrqbyXYL6e5jFuVPffHkPr4h/EYOKCpntbcXrwlz/fdQZpU912MKx2yO NX0g== X-Forwarded-Encrypted: i=1; AJvYcCXqDiPrvmvsxm3lg3PoBcboo2CA41xzM5ya1/e9PrP9kkhDP/KJmNiLz+Ap64E6D6LH9w9tHioGz3qB@nongnu.org X-Gm-Message-State: AOJu0YwKL8+ZyqOI/lvZVgkO9Y9y8jS6aaEKjhFsqsg/jhm2BpV6TJrl 0BnhoVFkDptrUlnp5hzowe3m0/NK7DPFPf9EV+A7eGuWO3Blk96Nw2Ens/E+/guLiP/bE4YCc+1 S X-Gm-Gg: ASbGncvZGVKJpx/8VATOYl41e6zUiMeplHB+/zGp61AwQPhIltGrjamQ6gLn9JNnGxu zv0yh18qTw9YpOQssNyoTQSH8loYMPx90BR4XjGP8o2Kt/wY5kqiaoQQrbDu8zil1G9vBXipOjR y6ZLhEyzeEmkO+6kJoaZVM+APfJSMmbasCCXoJZesJQ7tsyp1lkmzJ8iC5ssQd6o78Kq5tAkwum 4IUFlazLbcMKZDHm69rfA5gJVuHNqhh/bPU3AvMr0MN8Ke6V6HCZwKB8sQ615kF0JZRSP34gFLZ nEmkqjJu2tI= X-Received: by 2002:a05:600c:1f86:b0:436:aaf:7eb9 with SMTP id 5b1f17b1804b1-43891439d5fmr257378745e9.20.1737736178519; Fri, 24 Jan 2025 08:29:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:37 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 49/76] target/arm: Implement FPCR.AH semantics for SVE FMAXV and FMINV Date: Fri, 24 Jan 2025 16:28:09 +0000 Message-Id: <20250124162836.2332150-50-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Implement the FPCR.AH semantics for the SVE FMAXV and FMINV vector-reduction-to-scalar max/min operations. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 14 +++++++++++ target/arm/tcg/sve_helper.c | 43 +++++++++++++++++++++------------- target/arm/tcg/translate-sve.c | 16 +++++++++++-- 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index 8349752e99b..7ca95b8fa94 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -1035,6 +1035,20 @@ DEF_HELPER_FLAGS_4(sve_fminv_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_4(sve_fminv_d, TCG_CALL_NO_RWG, i64, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_4(sve_ah_fmaxv_h, TCG_CALL_NO_RWG, + i64, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_4(sve_ah_fmaxv_s, TCG_CALL_NO_RWG, + i64, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_4(sve_ah_fmaxv_d, TCG_CALL_NO_RWG, + i64, ptr, ptr, fpst, i32) + +DEF_HELPER_FLAGS_4(sve_ah_fminv_h, TCG_CALL_NO_RWG, + i64, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_4(sve_ah_fminv_s, TCG_CALL_NO_RWG, + i64, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_4(sve_ah_fminv_d, TCG_CALL_NO_RWG, + i64, ptr, ptr, fpst, i32) + DEF_HELPER_FLAGS_5(sve_fadda_h, TCG_CALL_NO_RWG, i64, i64, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(sve_fadda_s, TCG_CALL_NO_RWG, diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index 9837c5bc7ac..3631d85f23a 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -4190,7 +4190,7 @@ static TYPE NAME##_reduce(TYPE *data, float_status *status, uintptr_t n) \ uintptr_t half = n / 2; \ TYPE lo = NAME##_reduce(data, status, half); \ TYPE hi = NAME##_reduce(data + half, status, half); \ - return TYPE##_##FUNC(lo, hi, status); \ + return FUNC(lo, hi, status); \ } \ } \ uint64_t HELPER(NAME)(void *vn, void *vg, float_status *s, uint32_t desc) \ @@ -4211,26 +4211,37 @@ uint64_t HELPER(NAME)(void *vn, void *vg, float_status *s, uint32_t desc) \ return NAME##_reduce(data, s, maxsz / sizeof(TYPE)); \ } -DO_REDUCE(sve_faddv_h, float16, H1_2, add, float16_zero) -DO_REDUCE(sve_faddv_s, float32, H1_4, add, float32_zero) -DO_REDUCE(sve_faddv_d, float64, H1_8, add, float64_zero) +DO_REDUCE(sve_faddv_h, float16, H1_2, float16_add, float16_zero) +DO_REDUCE(sve_faddv_s, float32, H1_4, float32_add, float32_zero) +DO_REDUCE(sve_faddv_d, float64, H1_8, float64_add, float64_zero) /* Identity is floatN_default_nan, without the function call. */ -DO_REDUCE(sve_fminnmv_h, float16, H1_2, minnum, 0x7E00) -DO_REDUCE(sve_fminnmv_s, float32, H1_4, minnum, 0x7FC00000) -DO_REDUCE(sve_fminnmv_d, float64, H1_8, minnum, 0x7FF8000000000000ULL) +DO_REDUCE(sve_fminnmv_h, float16, H1_2, float16_minnum, 0x7E00) +DO_REDUCE(sve_fminnmv_s, float32, H1_4, float32_minnum, 0x7FC00000) +DO_REDUCE(sve_fminnmv_d, float64, H1_8, float64_minnum, 0x7FF8000000000000ULL) -DO_REDUCE(sve_fmaxnmv_h, float16, H1_2, maxnum, 0x7E00) -DO_REDUCE(sve_fmaxnmv_s, float32, H1_4, maxnum, 0x7FC00000) -DO_REDUCE(sve_fmaxnmv_d, float64, H1_8, maxnum, 0x7FF8000000000000ULL) +DO_REDUCE(sve_fmaxnmv_h, float16, H1_2, float16_maxnum, 0x7E00) +DO_REDUCE(sve_fmaxnmv_s, float32, H1_4, float32_maxnum, 0x7FC00000) +DO_REDUCE(sve_fmaxnmv_d, float64, H1_8, float64_maxnum, 0x7FF8000000000000ULL) -DO_REDUCE(sve_fminv_h, float16, H1_2, min, float16_infinity) -DO_REDUCE(sve_fminv_s, float32, H1_4, min, float32_infinity) -DO_REDUCE(sve_fminv_d, float64, H1_8, min, float64_infinity) +DO_REDUCE(sve_fminv_h, float16, H1_2, float16_min, float16_infinity) +DO_REDUCE(sve_fminv_s, float32, H1_4, float32_min, float32_infinity) +DO_REDUCE(sve_fminv_d, float64, H1_8, float64_min, float64_infinity) -DO_REDUCE(sve_fmaxv_h, float16, H1_2, max, float16_chs(float16_infinity)) -DO_REDUCE(sve_fmaxv_s, float32, H1_4, max, float32_chs(float32_infinity)) -DO_REDUCE(sve_fmaxv_d, float64, H1_8, max, float64_chs(float64_infinity)) +DO_REDUCE(sve_fmaxv_h, float16, H1_2, float16_max, float16_chs(float16_infinity)) +DO_REDUCE(sve_fmaxv_s, float32, H1_4, float32_max, float32_chs(float32_infinity)) +DO_REDUCE(sve_fmaxv_d, float64, H1_8, float64_max, float64_chs(float64_infinity)) + +DO_REDUCE(sve_ah_fminv_h, float16, H1_2, helper_vfp_ah_minh, float16_infinity) +DO_REDUCE(sve_ah_fminv_s, float32, H1_4, helper_vfp_ah_mins, float32_infinity) +DO_REDUCE(sve_ah_fminv_d, float64, H1_8, helper_vfp_ah_mind, float64_infinity) + +DO_REDUCE(sve_ah_fmaxv_h, float16, H1_2, helper_vfp_ah_maxh, + float16_chs(float16_infinity)) +DO_REDUCE(sve_ah_fmaxv_s, float32, H1_4, helper_vfp_ah_maxs, + float32_chs(float32_infinity)) +DO_REDUCE(sve_ah_fmaxv_d, float64, H1_8, helper_vfp_ah_maxd, + float64_chs(float64_infinity)) #undef DO_REDUCE diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index ad415c43565..effa23cefd7 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3588,11 +3588,23 @@ static bool do_reduce(DisasContext *s, arg_rpr_esz *a, }; \ TRANS_FEAT(NAME, aa64_sve, do_reduce, a, name##_fns[a->esz]) +#define DO_VPZ_AH(NAME, name) \ + static gen_helper_fp_reduce * const name##_fns[4] = { \ + NULL, gen_helper_sve_##name##_h, \ + gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ + }; \ + static gen_helper_fp_reduce * const name##_ah_fns[4] = { \ + NULL, gen_helper_sve_ah_##name##_h, \ + gen_helper_sve_ah_##name##_s, gen_helper_sve_ah_##name##_d, \ + }; \ + TRANS_FEAT(NAME, aa64_sve, do_reduce, a, \ + s->fpcr_ah ? name##_ah_fns[a->esz] : name##_fns[a->esz]) + DO_VPZ(FADDV, faddv) DO_VPZ(FMINNMV, fminnmv) DO_VPZ(FMAXNMV, fmaxnmv) -DO_VPZ(FMINV, fminv) -DO_VPZ(FMAXV, fmaxv) +DO_VPZ_AH(FMINV, fminv) +DO_VPZ_AH(FMAXV, fmaxv) #undef DO_VPZ From patchwork Fri Jan 24 16:28:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859593 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp885931wrq; Fri, 24 Jan 2025 08:41:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUu8CzUhp96TtpjFxZwgrHMiDXj2d6OZUF7RdQBQr7VyaJTqXqBXtXnMLBGripnpBhGM9B9qQ==@linaro.org X-Google-Smtp-Source: AGHT+IEWtLwGj0DMAoDysDQIYdsc7lrYoASRV/UMQO8Nt23sWzEV44CITKJWRiZrxKvEZG0cPJqT X-Received: by 2002:a05:622a:1104:b0:467:6b20:e0b1 with SMTP id d75a77b69052e-46e12a1fcdbmr486093101cf.6.1737736915378; Fri, 24 Jan 2025 08:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736915; cv=none; d=google.com; s=arc-20240605; b=Ge+jTiWfgQRaxwx0DA2KSRS+A2RI3VEkLMGE4Q7Tv9ZtKfA2HTUEEhhoVhPx6Dywba GGCUgXG9ZwopI5Yzgx4ZDMoKjve6QclS8yB7LEx0I/YSUdJ5ecOugjtzrPFonzzQu8nG +5BFX/pj8LvSDzubsvIRZgWZKe7nR0sz+xhy8hzWQ9mdr1m5lmUVQv3VRabtLa7Zd7u+ m9lHhEIvdLBl3dsIQnqkwYXIh1KdB6Iap9N7b+WxD153o3wRmjdV9g2m8DZwig92Kykf xQl2MbGZN0vgokQok6Kps6fdkwBpWcgEueaI1nTXXtkAmRgbk0XRRZOGXhwJrkG+7JgQ zgWQ== 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=hq2s3IXVV8PkzL3MODbSyRBZT7eZFQL8olH5eQca4yA=; fh=JHKB4bEwWobN+xxKrRC3iKgEvJ89jXQtK1E3WwP2lhk=; b=DRxftynbaQewyV9BRefCXTfgJkD1jWe7MepQHyij6byrd1jiuCcaz5hOYt4bGq7F54 flwAFetYFPLmKcv3kb+nAC+adw66hUdgICoBLsHUPhl9ykdh+9Q+diWtJ56oUE8rsI+5 VaF9YyOZeh0LTlUfL0NNuMY8JsqPBgQEVM4hZEdAkKmrcg7r2dP9FTYeEzhUJ2M+TM0C bgjSZR9g1+Em4HXhrkS0725xRvQbPUJKwumFnvcKAAxrynhUgtmrJ96RApINHBbXjtYt d1F2eG08GJIXiyz1f7hJtj1u/T7oCveCx8K652xvrhut/kQIxORgAMKwjJjg5AW8TuYU Zg+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IvSPd9vf; 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-46e6686be88si30197761cf.20.2025.01.24.08.41.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:41: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=IvSPd9vf; 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 1tbMdq-0000TQ-B6; Fri, 24 Jan 2025 11:34:46 -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 1tbMYz-0005fR-04 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:50 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYw-0005iI-0Y for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:43 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4361f65ca01so23934575e9.1 for ; Fri, 24 Jan 2025 08:29:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736180; x=1738340980; 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=hq2s3IXVV8PkzL3MODbSyRBZT7eZFQL8olH5eQca4yA=; b=IvSPd9vf3cVr84dN8fnre8/vha11vLqMZsA6ND8brcC7+tB8dmY5T5RxMMIFaZaEUO SihFRzsxNi7LZnHuAsN6qp8fHxLsMLo2e3fC+7RTTz+dX6qidPmqiV9Vj/xhBAcLiDTe Bg8AmDnn5Gdek+E1hjQHjWOMBUx64IBX58OI0bLje7itHjvseJigZA2E0wBV0JTUIwY9 VsWprj7fruunwbfOR36lRwbOvvlYgZVL/FBvwmft2WS1Lc3vsC20iCAJuuz9jT1wvytk wsdD8RRGDg2B9c2H4JswsKW2oZhLmhkho5BfO8zvcQBQsWTrhNFgOAA3i5PeoVb2PLd8 wpDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736180; x=1738340980; 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=hq2s3IXVV8PkzL3MODbSyRBZT7eZFQL8olH5eQca4yA=; b=FNRuCg3wSNnMJMnvA6NHWCbhnfJ4CsDESazViFGk4ACY+wCwG1Yakt8rSFzgxGXduT j1Lm9qGMDYx+GGFBU5H6edhdMQexO+fnws8wmq9Z1l4jfmTR9wER+gq2Ig8SDXoL9B8F FyTRgmB0m7YjHdddVtVpyGJRkXtLUuyjUc+8LWeXv+ce85taHXvo5sG3J6OyKxypmi1H 6yd4eexXN//302Bl3Acx5dkGpBhTtTHj7XnaoD9WyZm4o2PVjWD/JPMtK5pFrxsLhrVj 3Z8ElHi3m8/j/dDiEgNQKSEi0MJNyvUMpdn8iGC+MqgqbclgbO+c2OOxfppL/XmpFcTu njsw== X-Forwarded-Encrypted: i=1; AJvYcCX88BUGGBzOfn91OlHEiADGzCDoRTSK44mohnFmL72LEFP/iDaDwqQTZjv+Ysi+k/WdIk83z00uW65N@nongnu.org X-Gm-Message-State: AOJu0Yx6il8lrxM9xGSMyYXxVSR2OeB87PbTzd5beOSzM/crOZBuMjN3 aZtA3ehCGk2ZWRr8qiiAOqP7e3ygfjC8ovI+bxeU/rlpdOlk0oOrbBBbUZAGUfWQzZrWvYlMhgU v X-Gm-Gg: ASbGncs7g1MvA8LDBu+UffgolhDC9nMOo31EvBZf/towAXLEVxPpCWpTDCQlI89kUP+ CYnIxKzjHjmXhGVD8NCyU2JVcrQg4gpJSHHcEB+hOxtrfFggGjNYIksd9moO5lobermTB4TnyJ5 zEHsYyC4gozFqurPNJfjCcv+OLE/1x+eRHlexhJEhxaXgaJyVdUr6bvBs2FzM56oJOGaIifKQO9 /8Wv8vIWQCBvDE9FzTjrjHu2huY1UNHd5F7apwUTEwipKxVSRLztcKe0W+TKAON3LYh5rFFAGKp cPjSaBpUGiQ= X-Received: by 2002:a05:600c:c0f:b0:42c:c28c:e477 with SMTP id 5b1f17b1804b1-4389141c0a9mr263090115e9.23.1737736180490; Fri, 24 Jan 2025 08:29:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:39 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 50/76] target/arm: Implement FPCR.AH semantics for SVE FMIN/FMAX immediate Date: Fri, 24 Jan 2025 16:28:10 +0000 Message-Id: <20250124162836.2332150-51-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Implement the FPCR.AH semantics for the SVE FMAX and FMIN operations that take an immediate as the second operand. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 14 ++++++++++++++ target/arm/tcg/sve_helper.c | 8 ++++++++ target/arm/tcg/translate-sve.c | 25 +++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index 7ca95b8fa94..3c1d2624ed4 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -1231,6 +1231,20 @@ DEF_HELPER_FLAGS_6(sve_fmins_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_6(sve_fmins_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i64, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmaxs_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, i64, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmaxs_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, i64, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmaxs_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, i64, fpst, i32) + +DEF_HELPER_FLAGS_6(sve_ah_fmins_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, i64, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmins_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, i64, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmins_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, i64, fpst, i32) + DEF_HELPER_FLAGS_5(sve_fcvt_sh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(sve_fcvt_dh, TCG_CALL_NO_RWG, diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index 3631d85f23a..2f6fc82ee4f 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -4459,6 +4459,14 @@ DO_ZPZS_FP(sve_fmins_h, float16, H1_2, float16_min) DO_ZPZS_FP(sve_fmins_s, float32, H1_4, float32_min) DO_ZPZS_FP(sve_fmins_d, float64, H1_8, float64_min) +DO_ZPZS_FP(sve_ah_fmaxs_h, float16, H1_2, helper_vfp_ah_maxh) +DO_ZPZS_FP(sve_ah_fmaxs_s, float32, H1_4, helper_vfp_ah_maxs) +DO_ZPZS_FP(sve_ah_fmaxs_d, float64, H1_8, helper_vfp_ah_maxd) + +DO_ZPZS_FP(sve_ah_fmins_h, float16, H1_2, helper_vfp_ah_minh) +DO_ZPZS_FP(sve_ah_fmins_s, float32, H1_4, helper_vfp_ah_mins) +DO_ZPZS_FP(sve_ah_fmins_d, float64, H1_8, helper_vfp_ah_mind) + /* Fully general two-operand expander, controlled by a predicate, * With the extra float_status parameter. */ diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index effa23cefd7..214aec7f83b 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3821,14 +3821,35 @@ static bool do_fp_imm(DisasContext *s, arg_rpri_esz *a, uint64_t imm, TRANS_FEAT(NAME##_zpzi, aa64_sve, do_fp_imm, a, \ name##_const[a->esz][a->imm], name##_fns[a->esz]) +#define DO_FP_AH_IMM(NAME, name, const0, const1) \ + static gen_helper_sve_fp2scalar * const name##_fns[4] = { \ + NULL, gen_helper_sve_##name##_h, \ + gen_helper_sve_##name##_s, \ + gen_helper_sve_##name##_d \ + }; \ + static gen_helper_sve_fp2scalar * const name##_ah_fns[4] = { \ + NULL, gen_helper_sve_ah_##name##_h, \ + gen_helper_sve_ah_##name##_s, \ + gen_helper_sve_ah_##name##_d \ + }; \ + static uint64_t const name##_const[4][2] = { \ + { -1, -1 }, \ + { float16_##const0, float16_##const1 }, \ + { float32_##const0, float32_##const1 }, \ + { float64_##const0, float64_##const1 }, \ + }; \ + TRANS_FEAT(NAME##_zpzi, aa64_sve, do_fp_imm, a, \ + name##_const[a->esz][a->imm], \ + s->fpcr_ah ? name##_ah_fns[a->esz] : name##_fns[a->esz]) + DO_FP_IMM(FADD, fadds, half, one) DO_FP_IMM(FSUB, fsubs, half, one) DO_FP_IMM(FMUL, fmuls, half, two) DO_FP_IMM(FSUBR, fsubrs, half, one) DO_FP_IMM(FMAXNM, fmaxnms, zero, one) DO_FP_IMM(FMINNM, fminnms, zero, one) -DO_FP_IMM(FMAX, fmaxs, zero, one) -DO_FP_IMM(FMIN, fmins, zero, one) +DO_FP_AH_IMM(FMAX, fmaxs, zero, one) +DO_FP_AH_IMM(FMIN, fmins, zero, one) #undef DO_FP_IMM From patchwork Fri Jan 24 16:28:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859621 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp890080wrq; Fri, 24 Jan 2025 08:51:47 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW2VgHJhwPIbDkLdo+sUU9LzJYT7H2gIgrc1jOLf8I5MWRh0KwSShGVm4NfMyZhLahhNNV5cA==@linaro.org X-Google-Smtp-Source: AGHT+IH4JO/q2erL5B4sApUSJMDWDUEGy+jZ3Kl5279/xr8tXLs/ShoBkFG/AybMzFRxdN2gqJjs X-Received: by 2002:a05:620a:440b:b0:7b1:ae6c:fc60 with SMTP id af79cd13be357-7be63219a07mr5418994485a.8.1737737507698; Fri, 24 Jan 2025 08:51:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737507; cv=none; d=google.com; s=arc-20240605; b=kXBgkfF24RP7VA0DgarQ4ye2pOUt628l/aDh5nK31LtxYEGqcDtQ3GgSl/1wmXydIs Wb06SozrfFR6KnrigRcebq+7Y8vvaGrUEa/ohZtHeAY9qC9CNqKjlA2gNZPQCVR+Wc3R atsfJxilRK8WcTtow6DcSt5qDUbd58AnuHDwOpfy8cISPYAlgYbEbPf1htSMFIRIBMi5 wq1cDpTUfmiishV7rfl02Ci5yj0J0Fe6k/5yQ1dLj5SuZ2wdvsyJdPB8Baud3KczkIC3 XOKKd8N4A1UDfVNfO/g20oB+NYd48JCAZkUkKKrvUT4wFiuuhCahL1jdD8uFCG50UQxS uf8A== 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=3ps5knb3sFdf6P1gy0cvrFvUI+yUM1AgSFsV6YuWq8s=; fh=C16WgJpBYeRm6gZ53rkJD10KiqmJ7sDoeHyQbHqd7Q0=; b=LA14yLbkyRhQy5SMEuadVjT8fRwQ2p9prhJcJuHILf6+KS7RpxR5YbWxKHG3fzXFXd UFsmAP3Dvszx54MEORA7/DkEHLj0cUydMruZ5ldcSJAZ1F/6UQ2ONsbruS6ZZi35iPkr nkEAz00b4z63Kr7jmOCDV7kGHiazkuZuADjLUaOwcF1X/P3dMTrXrAyHAeO5pVeDqsOC 7gdQRWUirHFSIiX+t8Ld9VUo4j9Kqfc+b9iger1ddzOMwv1pfjTfbo+l/UPStjrIc+Vq vmL1SdkYuYtozOgT13MwzdmWCrYTewPebazpuvmxbjVvLKJSVQKmXSQFDHLitTdaRocx 5YjA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ls32xaMP; 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-7be9ae81cd0si270867285a.97.2025.01.24.08.51.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:51:47 -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=Ls32xaMP; 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 1tbMfr-0005Et-9K; Fri, 24 Jan 2025 11:36:51 -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 1tbMZ0-0005ir-NE for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:51 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYx-0005id-3t for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:45 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-43626213fffso22182995e9.1 for ; Fri, 24 Jan 2025 08:29:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736182; x=1738340982; 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=3ps5knb3sFdf6P1gy0cvrFvUI+yUM1AgSFsV6YuWq8s=; b=Ls32xaMPpu+apW9Q4Oa+F2jIWXCpbP4br0mXSNAZFKlNVOdMMQ7p5MK5CQgzE5cwLc I++wsSpA0jDP14Wx7Hw0KBww/eGwU9kMMQHZ40TcMPVEb8111h3h7TmVKg9y2fDwQc6q mxr71+Iupptp9VIy9AD/HSODQ4JuYKCzCcJHJ4L5KbIYOarC1eqENfBEh88KBuca/pDt Vxo7HCv7QrxdL0n588bPUxdCXeASGipkty4F/b5zwxw3Oj6++ksXgA+hbNgL1+DXSlGl or/k6FdhR/tQEPakEc4o1NSHNpbFOfQlBxTfXOtEUDpmzeeIG/vbztN6H5mwITlHjB85 9BVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736182; x=1738340982; 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=3ps5knb3sFdf6P1gy0cvrFvUI+yUM1AgSFsV6YuWq8s=; b=Z+wa7KmV3NLrf62JjMlSK5qMmVc3qNGcUCmneLXK9OZIvGP1OVFiJ5qrjCReTU/AZl S+ZMCh8bE1TZDPVHJ3VN97LFYDyGewh9e+cM05k1Gw9lX85VPzC/NSyMwEQUhwJJJNq1 NVY8vrwP6DJ8qyY47hmkxmVreIVWgifJmLTXeKjc3qEic2hiovqmp10Mzxom9lWg3Fn7 4W4NSj/VyWUVX6JTaxOr3uHnI2+aZmREsA6pGz6T+56+g9N1fqMsiTTdu9oyIdTe7Kl6 uChf0kA9EZsnYd+ip05UM++GJQI43oWoG+5LIwY8oDyza7ka1TCVHZmjGy3H0mYrsz1U 7JMA== X-Forwarded-Encrypted: i=1; AJvYcCX4JLJ1ay2K0rpbSb6BHiTC7/AdUEXAoLKjGcWpXnVhqSkTEGIdso0YlawBDk6VSpiXmwqkPdUOn68+@nongnu.org X-Gm-Message-State: AOJu0YwOwY48I2IwZ9KPdqah2wjCVvA48v+g/0os4Q8kyE5FLV3zY25Y O0/uefcLNiN+sbX16l7f0qFg6y6a3gWuGsIulPF9/t66HnDOz8b/1vVaWe1EtpE3A/uJwF2DF8Y 4 X-Gm-Gg: ASbGnctBSp1+sSAcmsjcDaQsl3uHnCiaNih/zARmKwUIU+kVyKL+zmX9BgPz93J5+9K wWS0yEneUvmpHCcqfaFdkM6FKy/plgTP2yDMNbCHPMUXux3Cbc0dCyO2DsXaUredf5Xl1+BLy34 hN9EhA3fZxUu4EPCTx1y5Kbt3fGpChc4nLnhA1rnYOrdSnFyfHl+5YGmSErnPYLlzfghlhyM3al EWfHGmlXBG9XYljxaKXhAOHW9n7MsU9Qeh3ShqG99j0gqquwfhljF1CpHLj67+p8CiVNhxLY37M fyhK1azA0Cw= X-Received: by 2002:a05:600c:1d0c:b0:434:f9ad:7222 with SMTP id 5b1f17b1804b1-438b885652fmr75931585e9.7.1737736181651; Fri, 24 Jan 2025 08:29:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:40 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 51/76] target/arm: Implement FPCR.AH semantics for SVE FMIN/FMAX vector Date: Fri, 24 Jan 2025 16:28:11 +0000 Message-Id: <20250124162836.2332150-52-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Implement the FPCR.AH semantics for the SVE FMAX and FMIN operations that take two vector operands. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 14 ++++++++++++++ target/arm/tcg/sve_helper.c | 8 ++++++++ target/arm/tcg/translate-sve.c | 17 +++++++++++++++-- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index 3c1d2624ed4..918f2e61b7e 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -1140,6 +1140,20 @@ DEF_HELPER_FLAGS_6(sve_fmax_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_6(sve_fmax_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmin_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmin_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmin_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, fpst, i32) + +DEF_HELPER_FLAGS_6(sve_ah_fmax_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmax_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fmax_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, fpst, i32) + DEF_HELPER_FLAGS_6(sve_fminnum_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_6(sve_fminnum_s, TCG_CALL_NO_RWG, diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index 2f6fc82ee4f..a688b98d284 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -4347,6 +4347,14 @@ DO_ZPZZ_FP(sve_fmax_h, uint16_t, H1_2, float16_max) DO_ZPZZ_FP(sve_fmax_s, uint32_t, H1_4, float32_max) DO_ZPZZ_FP(sve_fmax_d, uint64_t, H1_8, float64_max) +DO_ZPZZ_FP(sve_ah_fmin_h, uint16_t, H1_2, helper_vfp_ah_minh) +DO_ZPZZ_FP(sve_ah_fmin_s, uint32_t, H1_4, helper_vfp_ah_mins) +DO_ZPZZ_FP(sve_ah_fmin_d, uint64_t, H1_8, helper_vfp_ah_mind) + +DO_ZPZZ_FP(sve_ah_fmax_h, uint16_t, H1_2, helper_vfp_ah_maxh) +DO_ZPZZ_FP(sve_ah_fmax_s, uint32_t, H1_4, helper_vfp_ah_maxs) +DO_ZPZZ_FP(sve_ah_fmax_d, uint64_t, H1_8, helper_vfp_ah_maxd) + DO_ZPZZ_FP(sve_fminnum_h, uint16_t, H1_2, float16_minnum) DO_ZPZZ_FP(sve_fminnum_s, uint32_t, H1_4, float32_minnum) DO_ZPZZ_FP(sve_fminnum_d, uint64_t, H1_8, float64_minnum) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 214aec7f83b..0fed92fa48a 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3759,11 +3759,24 @@ TRANS_FEAT_NONSTREAMING(FTSMUL, aa64_sve, gen_gvec_fpst_arg_zzz, }; \ TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, name##_zpzz_fns[a->esz], a) +#define DO_ZPZZ_AH_FP(NAME, FEAT, name, ah_name) \ + static gen_helper_gvec_4_ptr * const name##_zpzz_fns[4] = { \ + NULL, gen_helper_##name##_h, \ + gen_helper_##name##_s, gen_helper_##name##_d \ + }; \ + static gen_helper_gvec_4_ptr * const name##_ah_zpzz_fns[4] = { \ + NULL, gen_helper_##ah_name##_h, \ + gen_helper_##ah_name##_s, gen_helper_##ah_name##_d \ + }; \ + TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, \ + s->fpcr_ah ? name##_ah_zpzz_fns[a->esz] : \ + name##_zpzz_fns[a->esz], a) + DO_ZPZZ_FP(FADD_zpzz, aa64_sve, sve_fadd) DO_ZPZZ_FP(FSUB_zpzz, aa64_sve, sve_fsub) DO_ZPZZ_FP(FMUL_zpzz, aa64_sve, sve_fmul) -DO_ZPZZ_FP(FMIN_zpzz, aa64_sve, sve_fmin) -DO_ZPZZ_FP(FMAX_zpzz, aa64_sve, sve_fmax) +DO_ZPZZ_AH_FP(FMIN_zpzz, aa64_sve, sve_fmin, sve_ah_fmin) +DO_ZPZZ_AH_FP(FMAX_zpzz, aa64_sve, sve_fmax, sve_ah_fmax) DO_ZPZZ_FP(FMINNM_zpzz, aa64_sve, sve_fminnum) DO_ZPZZ_FP(FMAXNM_zpzz, aa64_sve, sve_fmaxnum) DO_ZPZZ_FP(FABD, aa64_sve, sve_fabd) From patchwork Fri Jan 24 16:28:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859616 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp889073wrq; Fri, 24 Jan 2025 08:49:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV8oXGauyC+eA1Biyg54Hd4BjeWCypqguAOlCKFVSTO4x2HYO09IlP3OH7MnmQoNiLG4VyEyw==@linaro.org X-Google-Smtp-Source: AGHT+IFIUf0y97MlAMV3qckPGGmzy4AXYqqcHqL81Va3ynn67OXszzNKEBNKDUK7NoINrIPDTvea X-Received: by 2002:a05:6122:8286:b0:518:778b:70a1 with SMTP id 71dfb90a1353d-51d5b2f094dmr26481574e0c.7.1737737363846; Fri, 24 Jan 2025 08:49:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737363; cv=none; d=google.com; s=arc-20240605; b=R5lBFwS4N9oYBp1Kb227jsh+/zy6IG0HdvIENb94QMtsKsMPz53rx2GUgviletgomi 4l7J40QzIXDCuOYfrCdrG+kF+fZHJz+VziegtXm2+nao/ttytTkfW6lnS3pHzBX/FFsu W0pgar0yLB+08/jkCmvf19EetsnlYxa23FK+t0UzXIKw8fxbhKEzMVcH7S5X29OFsPnM 21JIuOCc/ttSABfqO+L1PCXhx4mi5XEdEjRzUcce0fZVds1h+xBmnBTlZ3OjPWND2Pk2 qQsoF8API2a958Xyu2knofR4K7VmngMACUrK0qA5VJUjUkwc9rmdbR2ARcujWp9MJLlv GGUg== 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=X6N3L7NtFa1YnMZAHkrZh5oUiZiJF+Z8u0edD1E7tQY=; fh=o8Olz9TWt0sPgvb8Fk1IReKz7mDKGcEW3d6zvQ+U+Zg=; b=a8i6KSB+ZNPaRZ448BdOBN8tVKe+wmULFsg6xA6RhJ4pN4u4GMsqQeDd7gq9iCAEJ6 LbwNj+xcH7JxiZxOiaIwqicOqjDm0KvDzFBpC/2MkC3H+z8ugKBqbb9IqQVyCWUZhmac Id7X/XwX56v6u+b5rpZjSOnhqKlt/l1yJjAsO6SzD8NpLOK86e5xwrfo01mquNYW436Y buPJSD/MayOv3T4wph8oRqf1fnE/uXHiTDrMNs4R/XS7uVd6rIluaDm/5fOotThMLOvz SgzYLSH36CKliyL9P5kCzHnDYPsUHNCxC0MlpEtZWZ8tsFNEcTnineFwY22L9ZBF/QLm TVog==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YZ8NJYD0; 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 71dfb90a1353d-51e4ec80c40si1011989e0c.192.2025.01.24.08.49.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:49:23 -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=YZ8NJYD0; 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 1tbMdv-0000qM-9h; Fri, 24 Jan 2025 11:34:51 -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 1tbMZ1-0005jA-UI for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:51 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMYy-0005j1-Sl for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:47 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4361815b96cso15922315e9.1 for ; Fri, 24 Jan 2025 08:29:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736183; x=1738340983; 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=X6N3L7NtFa1YnMZAHkrZh5oUiZiJF+Z8u0edD1E7tQY=; b=YZ8NJYD0t23fvRbR7pNNocpO9BoyB+mlZKCWHidIhk0icP07MbbwoTPRIpxY+iADTZ bcF7jSE1bv+4ljGWq/A72niCNgte7XWoG1id/talpsmNayU41BNsP62U02bTD6sR/EIu KRntLWUp7cWAkxB5uRRt4bD79wo0JHGSyxL47dIR6SHv0DjqBWDD/LWp0s5Y5yqR1BZr LF+/tGBF6NEbHtDvYAbDIYHXN+9MOa5szRC86zj1+2zUOVgqKjOynf9aAweLMrSourvR 17d3eComRiKg3L8V4Vn9veGOEbmXPCr5zecS6Rngpi7vMdGQasEmJLcBrfg62NQNDSEw DE/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736183; x=1738340983; 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=X6N3L7NtFa1YnMZAHkrZh5oUiZiJF+Z8u0edD1E7tQY=; b=grPHQpK67sLUFIN+ebP+KxZybJVFlw5elMFSBeaPkgsLPUFjEKtldel5sXSVDrItG9 8fg4spTvnlIGK0tx7n5krsq/Bk13TX+6yaPk+gl9zk7ThGtuS2l26Fe/more2UCHoNQ6 IPljtUG8O4cqqj1fUhWyZCpYb17rMEjfsCDCoxfIgmAyBPJ4Nu6EXMxE5sEKgmKURvsp Mehz3phHLiZs+LaoLBOCCHyGZQLPuz2g4uMAZL2hgImB1gFy9zaKEgHBWVsPfPNpb10y tjYP7f72zYycAxXnJCzXyV7SERPXKnDizeWX+JBjlk/oPsL28qMr59maEjaxjVwFpZI8 wSQQ== X-Forwarded-Encrypted: i=1; AJvYcCWaebTc0wlvjYObv46Li2LMqeg72Zhnz6q/kSldc2Ym/BE1ScXPFUxJ6+yyKcNarOx3EqVEUJOikIo9@nongnu.org X-Gm-Message-State: AOJu0YyjN/PFviXW42TOilQaOlK3WNmoInQhCmnB5aeBlK1IHOQqzWHN jTVdKjVP3B9wtXG79sYRmUrwv3Q1bKWevbPsPZPQMHFJ74QtWRrn5WfqJFFw6f4= X-Gm-Gg: ASbGnctjOFKa9ORwOaqIodb+IUs1PGa9h/sM+26Mcptk0N+waL/bSpptQt6wxsGsbN8 Ph7rU2cA8s0mBntTABvoSYGMjwhG4sTm5y4CuAiihx3uRodBBDIQE7116/L7OrOvsaXI0oojXf2 VmDvKSqURxvZCncp8cNIBpI2JbrH7J1nj/KJ9Ub6sezUQWiRTw/g63lC1E4axRen/66/vEYNBYA p+sRQmFg66/GNa5bfiSGXB9vrLriy3+qbZ5PufSbNBHECTvmWbx7OJ5ojQlZ7ndXcWYSOUJGOdY XS7E65+5uOA= X-Received: by 2002:a05:600c:3d97:b0:436:f960:3427 with SMTP id 5b1f17b1804b1-4389142745amr264687805e9.22.1737736183482; Fri, 24 Jan 2025 08:29:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:42 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 52/76] target/arm: Implement FPCR.AH handling of negation of NaN Date: Fri, 24 Jan 2025 16:28:12 +0000 Message-Id: <20250124162836.2332150-53-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 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 FPCR.AH == 1 mandates that negation of a NaN value should not flip its sign bit. This means we can no longer use gen_vfp_neg*() everywhere but must instead generate slightly more complex code when FPCR.AH is set. Make this change for the scalar FNEG and for those places in translate-a64.c which were previously directly calling gen_vfp_neg*(). This change in semantics also affects any other instruction whose pseudocode calls FPNeg(); in following commits we extend this change to the other affected instructions. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 125 ++++++++++++++++++++++++++++++--- 1 file changed, 114 insertions(+), 11 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 9d164b80c22..085b29ee536 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -839,6 +839,74 @@ static void gen_gvec_op4_fpst(DisasContext *s, bool is_q, int rd, int rn, is_q ? 16 : 8, vec_full_reg_size(s), data, fn); } +/* + * When FPCR.AH == 1, NEG and ABS do not flip the sign bit of a NaN. + * These functions implement + * d = floatN_is_any_nan(s) ? s : floatN_chs(s) + * which for float32 is + * d = (s & ~(1 << 31)) > 0x7f800000UL) ? s : (s ^ (1 << 31)) + * and similarly for the other float sizes. + */ +static void gen_vfp_ah_negh(TCGv_i32 d, TCGv_i32 s) +{ + TCGv_i32 abs_s = tcg_temp_new_i32(), chs_s = tcg_temp_new_i32(); + + gen_vfp_negh(chs_s, s); + gen_vfp_absh(abs_s, s); + tcg_gen_movcond_i32(TCG_COND_GTU, d, + abs_s, tcg_constant_i32(0x7c00), + s, chs_s); +} + +static void gen_vfp_ah_negs(TCGv_i32 d, TCGv_i32 s) +{ + TCGv_i32 abs_s = tcg_temp_new_i32(), chs_s = tcg_temp_new_i32(); + + gen_vfp_negs(chs_s, s); + gen_vfp_abss(abs_s, s); + tcg_gen_movcond_i32(TCG_COND_GTU, d, + abs_s, tcg_constant_i32(0x7f800000UL), + s, chs_s); +} + +static void gen_vfp_ah_negd(TCGv_i64 d, TCGv_i64 s) +{ + TCGv_i64 abs_s = tcg_temp_new_i64(), chs_s = tcg_temp_new_i64(); + + gen_vfp_negd(chs_s, s); + gen_vfp_absd(abs_s, s); + tcg_gen_movcond_i64(TCG_COND_GTU, d, + abs_s, tcg_constant_i64(0x7ff0000000000000ULL), + s, chs_s); +} + +static void gen_vfp_maybe_ah_negh(DisasContext *dc, TCGv_i32 d, TCGv_i32 s) +{ + if (dc->fpcr_ah) { + gen_vfp_ah_negh(d, s); + } else { + gen_vfp_negh(d, s); + } +} + +static void gen_vfp_maybe_ah_negs(DisasContext *dc, TCGv_i32 d, TCGv_i32 s) +{ + if (dc->fpcr_ah) { + gen_vfp_ah_negs(d, s); + } else { + gen_vfp_negs(d, s); + } +} + +static void gen_vfp_maybe_ah_negd(DisasContext *dc, TCGv_i64 d, TCGv_i64 s) +{ + if (dc->fpcr_ah) { + gen_vfp_ah_negd(d, s); + } else { + gen_vfp_negd(d, s); + } +} + /* Set ZF and NF based on a 64 bit result. This is alas fiddlier * than the 32 bit equivalent. */ @@ -5252,12 +5320,35 @@ static void gen_fnmul_d(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_ptr s) gen_vfp_negd(d, d); } +static void gen_fnmul_ah_h(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_ptr s) +{ + gen_helper_vfp_mulh(d, n, m, s); + gen_vfp_ah_negh(d, d); +} + +static void gen_fnmul_ah_s(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_ptr s) +{ + gen_helper_vfp_muls(d, n, m, s); + gen_vfp_ah_negs(d, d); +} + +static void gen_fnmul_ah_d(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_ptr s) +{ + gen_helper_vfp_muld(d, n, m, s); + gen_vfp_ah_negd(d, d); +} + static const FPScalar f_scalar_fnmul = { gen_fnmul_h, gen_fnmul_s, gen_fnmul_d, }; -TRANS(FNMUL_s, do_fp3_scalar, a, &f_scalar_fnmul, a->rn) +static const FPScalar f_scalar_ah_fnmul = { + gen_fnmul_ah_h, + gen_fnmul_ah_s, + gen_fnmul_ah_d, +}; +TRANS(FNMUL_s, do_fp3_scalar_2fn, a, &f_scalar_fnmul, &f_scalar_ah_fnmul, a->rn) static const FPScalar f_scalar_fcmeq = { gen_helper_advsimd_ceq_f16, @@ -6399,7 +6490,7 @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg) read_vec_element(s, t2, a->rm, a->idx, MO_64); if (neg) { - gen_vfp_negd(t1, t1); + gen_vfp_maybe_ah_negd(s, t1, t1); } gen_helper_vfp_muladdd(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR_A64)); write_fp_dreg_merging(s, a->rd, a->rd, t0); @@ -6413,7 +6504,7 @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg) read_vec_element_i32(s, t2, a->rm, a->idx, MO_32); if (neg) { - gen_vfp_negs(t1, t1); + gen_vfp_maybe_ah_negs(s, t1, t1); } gen_helper_vfp_muladds(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR_A64)); write_fp_sreg_merging(s, a->rd, a->rd, t0); @@ -6430,7 +6521,7 @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg) read_vec_element_i32(s, t2, a->rm, a->idx, MO_16); if (neg) { - gen_vfp_negh(t1, t1); + gen_vfp_maybe_ah_negh(s, t1, t1); } gen_helper_advsimd_muladdh(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR_F16_A64)); @@ -6913,10 +7004,10 @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n) TCGv_i64 ta = read_fp_dreg(s, a->ra); if (neg_a) { - gen_vfp_negd(ta, ta); + gen_vfp_maybe_ah_negd(s, ta, ta); } if (neg_n) { - gen_vfp_negd(tn, tn); + gen_vfp_maybe_ah_negd(s, tn, tn); } fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_muladdd(ta, tn, tm, ta, fpst); @@ -6931,10 +7022,10 @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n) TCGv_i32 ta = read_fp_sreg(s, a->ra); if (neg_a) { - gen_vfp_negs(ta, ta); + gen_vfp_maybe_ah_negs(s, ta, ta); } if (neg_n) { - gen_vfp_negs(tn, tn); + gen_vfp_maybe_ah_negs(s, tn, tn); } fpst = fpstatus_ptr(FPST_FPCR_A64); gen_helper_vfp_muladds(ta, tn, tm, ta, fpst); @@ -6952,10 +7043,10 @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n) TCGv_i32 ta = read_fp_hreg(s, a->ra); if (neg_a) { - gen_vfp_negh(ta, ta); + gen_vfp_maybe_ah_negh(s, ta, ta); } if (neg_n) { - gen_vfp_negh(tn, tn); + gen_vfp_maybe_ah_negh(s, tn, tn); } fpst = fpstatus_ptr(FPST_FPCR_F16_A64); gen_helper_advsimd_muladdh(ta, tn, tm, ta, fpst); @@ -8544,6 +8635,13 @@ static bool do_fp1_scalar_int(DisasContext *s, arg_rr_e *a, return true; } +static bool do_fp1_scalar_int_2fn(DisasContext *s, arg_rr_e *a, + const FPScalar1Int *fnormal, + const FPScalar1Int *fah) +{ + return do_fp1_scalar_int(s, a, s->fpcr_ah ? fah : fnormal, true); +} + static const FPScalar1Int f_scalar_fmov = { tcg_gen_mov_i32, tcg_gen_mov_i32, @@ -8563,7 +8661,12 @@ static const FPScalar1Int f_scalar_fneg = { gen_vfp_negs, gen_vfp_negd, }; -TRANS(FNEG_s, do_fp1_scalar_int, a, &f_scalar_fneg, true) +static const FPScalar1Int f_scalar_ah_fneg = { + gen_vfp_ah_negh, + gen_vfp_ah_negs, + gen_vfp_ah_negd, +}; +TRANS(FNEG_s, do_fp1_scalar_int_2fn, a, &f_scalar_fneg, &f_scalar_ah_fneg) typedef struct FPScalar1 { void (*gen_h)(TCGv_i32, TCGv_i32, TCGv_ptr); From patchwork Fri Jan 24 16:28:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859612 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp888419wrq; Fri, 24 Jan 2025 08:47:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUUaVqbOCQm9MAjgO+QVEiLRTa+4x1WqVU5Y9b6C83kbwipWDUgAMSQlqtVAwrc4xj66Cq9kw==@linaro.org X-Google-Smtp-Source: AGHT+IGgwCW+HYALIGw+aa7YatN3W/zT7Ss2ZrOQFVx0OoDEzOyzzMUiTg311tRjK0a9Fssgv3Gz X-Received: by 2002:a05:6102:e09:b0:4af:ef82:ce8d with SMTP id ada2fe7eead31-4b6f77840cfmr6920889137.0.1737737266142; Fri, 24 Jan 2025 08:47:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737266; cv=none; d=google.com; s=arc-20240605; b=deVvWGuaPi8Csvvm6X2aqWv6U4ra+aAHejE6skZgCh6S9+A6ArUeSSRUvpANc2BiGT 4udA2zK97BzwkX/qcmxX8YXlisiDrQI/D6d+myH/8pbRwoyviDndMpJyIrHQDvFCKlzJ GNwg09cE5Dhdwj1eVGRvGQXXnNzPg4KtKA65/MaicPmscdx3T0c+qiND4DrbzSwh7c4L dlUA/VvusJSSa27UqTTk8LPxEx93ZfowCfAnKwj28TG10ClJzAGnmfNBpElYnXAYlRTv 27BCmpAb+V2ycXpmZRlo0kIX864QJ0g94q7nNDqlg+/JcjCRL+g0+V9W1hw1ueTiI3gW 25QQ== 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=0LRgE5sYkagidW3WnsnXPvw6PPdsduRp7Jmx+Kr/CH8=; fh=9SYHWprmN+tNlTjKPpQJRozNl7rg0/aE6gotc2QOaFg=; b=Xs+gNp9BO43sLjxRVSwxyBFbfghoFudmTgbFq423vm5USQFQahb4tyhIAiFmX649dG OMk/KR9lJw1ggQLUSBoI1dlvetAplfDtMfmJ2SeBE2DSoBISK320U6J6saBDX6i8/dVs 6/Dcs2yV+BhANRwp857ZR/G7E7uHJmKmLQPX6eM23dr72p5UU4T9nRwFMbJ2rlESxKXK hi5MPi+SMxYro/s3Ld6x8ekCNmND/uXliPUG0ymmdit/P0w1XgtLC76/BxWkmIKa356q SvZBsFYsPgLZ3VNhBEqzmgX7cTvqxms3nVKKDypy85K6D4m/8Mb3L/HO07BlNwOIfmH4 94Lg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pzNUrEb8; 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 ada2fe7eead31-4b709a26340si1086430137.644.2025.01.24.08.47.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:47:46 -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=pzNUrEb8; 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 1tbMfb-0004ao-4P; Fri, 24 Jan 2025 11:36: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 1tbMZ2-0005jG-3v for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:51 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZ0-0005jL-Eq for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:47 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-385e3621518so1220039f8f.1 for ; Fri, 24 Jan 2025 08:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736184; x=1738340984; 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=0LRgE5sYkagidW3WnsnXPvw6PPdsduRp7Jmx+Kr/CH8=; b=pzNUrEb8G4iopC1dIF1xZMzR0h6Wr6mzU/bj3S1pELLDfgVztjNUw/PfovIk0RQD7b fYXCdZ1V5ss5NTRlE7ozlTykoxSn+ooYQlsPG0shYAm7SosjBJ0kBEfkhSwVWcLvX/n+ bYyb862npRaEjmqHKZQ1A8hKdxh856dznb8ItQCe4iHOjz1eAUcHP8AeA8A2w3d65XZz IjVLMmmkT7/+822B+prShWPzFYFLZdDmU/C9DtqDKaldiYgkIXFzg4UuyMFzaRttx4Gt wQ3GYKAm7+RkI2eromdjIZtVdju0vzs2g6gDdarLZe5o/O8Y9bmJyVA04u1JtWl010GM 7xpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736184; x=1738340984; 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=0LRgE5sYkagidW3WnsnXPvw6PPdsduRp7Jmx+Kr/CH8=; b=AXYjKIEIhKzDHBZPYNVM/3uSZhKoDBrxGfz6XRN9VgcgKdQ3Sh60S6Zwh8HOZ+lEdl YtI8oWFMNEAET8aKfhVbadXAM+of4gIOzJbJZVs7qIclubVUAKKf3a7qIQZV/EI+wtr7 k9cWVvOaIjrea+6bzLmcvTfuBaQP65Ipi4PRRhG6hswJtZBLKMh38TJGSyHNS/+Sfya1 OFLFyicO6XuSXfsP8CpjPIXGOIgq16LdcCBHtMQ+Bgdic70pk7sQWHqvIbKlMjz5//0Z x2XULRkIsqJ7MRHcbC6K+x3LMln3Nx1iWNc8oOjk2x6g2eFECZuQpTGQi+nswM7KbpN9 ztuA== X-Forwarded-Encrypted: i=1; AJvYcCXabo73b/NWaSbnrnWufUqq9VEAGIgRJ5nqjoZ9aiyfbUvJEPPdBsviF2xguIsHrcz/cA/jxsUO+APh@nongnu.org X-Gm-Message-State: AOJu0YxjLvHOt7GxgBkz/LUEtcrWOvENo+t1Tsbd4VxZxUgiXv30TZuP oMDD8On0vrl5r44c3JkrvAlS1xR0WF2g8u67u7kD+GmtqvyNJGRrWm9ibqTSH+YQH2VZVkW/AUM X X-Gm-Gg: ASbGnctMIr0eSERm8k53vfvnuU3OXK5jbG36SgvxII5CXn6QqNSdXZV6XYU4FVqCCFs yo1iXJg9GyXkBAHyGCjiaW5qvo9n1ebspUjtbRJ8I4VJ5E3A1JG48QS/BRCzmMfwXRTigmWQtoP SW3ekQb08hsYhXyFjmF7xNJwI/qGMEXOhMkWUTSZePZJUyexQj1kJdA2raSS3IilJgvMWB6mnjd 1vkrZ3qurwWs89rAleLjvrME14POLox5cWrEf0rycQ4cI4shdgiRA5dikE9fEdkDHgNfYEOWL5j 0qnUXz1sQE0= X-Received: by 2002:a05:6000:1a87:b0:385:fc32:1ec6 with SMTP id ffacd0b85a97d-38bf57bb947mr24409151f8f.50.1737736184650; Fri, 24 Jan 2025 08:29:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:43 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 53/76] target/arm: Implement FPCR.AH handling for scalar FABS and FABD Date: Fri, 24 Jan 2025 16:28:13 +0000 Message-Id: <20250124162836.2332150-54-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 FPCR.AH == 1 mandates that taking the absolute value of a NaN should not change its sign bit. This means we can no longer use gen_vfp_abs*() everywhere but must instead generate slightly more complex code when FPCR.AH is set. Implement these semantics for scalar FABS and FABD. This change also affects all other instructions whose psuedocode calls FPAbs(); we will extend the change to those instructions in following commits. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 69 +++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 085b29ee536..542e774790b 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -880,6 +880,43 @@ static void gen_vfp_ah_negd(TCGv_i64 d, TCGv_i64 s) s, chs_s); } +/* + * These functions implement + * d = floatN_is_any_nan(s) ? s : floatN_abs(s) + * which for float32 is + * d = (s & ~(1 << 31)) > 0x7f800000UL) ? s : (s & ~(1 << 31)) + * and similarly for the other float sizes. + */ +static void gen_vfp_ah_absh(TCGv_i32 d, TCGv_i32 s) +{ + TCGv_i32 abs_s = tcg_temp_new_i32(); + + gen_vfp_absh(abs_s, s); + tcg_gen_movcond_i32(TCG_COND_GTU, d, + abs_s, tcg_constant_i32(0x7c00), + s, abs_s); +} + +static void gen_vfp_ah_abss(TCGv_i32 d, TCGv_i32 s) +{ + TCGv_i32 abs_s = tcg_temp_new_i32(); + + gen_vfp_abss(abs_s, s); + tcg_gen_movcond_i32(TCG_COND_GTU, d, + abs_s, tcg_constant_i32(0x7f800000UL), + s, abs_s); +} + +static void gen_vfp_ah_absd(TCGv_i64 d, TCGv_i64 s) +{ + TCGv_i64 abs_s = tcg_temp_new_i64(); + + gen_vfp_absd(abs_s, s); + tcg_gen_movcond_i64(TCG_COND_GTU, d, + abs_s, tcg_constant_i64(0x7ff0000000000000ULL), + s, abs_s); +} + static void gen_vfp_maybe_ah_negh(DisasContext *dc, TCGv_i32 d, TCGv_i32 s) { if (dc->fpcr_ah) { @@ -5403,12 +5440,35 @@ static void gen_fabd_d(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_ptr s) gen_vfp_absd(d, d); } +static void gen_fabd_ah_h(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_ptr s) +{ + gen_helper_vfp_subh(d, n, m, s); + gen_vfp_ah_absh(d, d); +} + +static void gen_fabd_ah_s(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_ptr s) +{ + gen_helper_vfp_subs(d, n, m, s); + gen_vfp_ah_abss(d, d); +} + +static void gen_fabd_ah_d(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_ptr s) +{ + gen_helper_vfp_subd(d, n, m, s); + gen_vfp_ah_absd(d, d); +} + static const FPScalar f_scalar_fabd = { gen_fabd_h, gen_fabd_s, gen_fabd_d, }; -TRANS(FABD_s, do_fp3_scalar, a, &f_scalar_fabd, a->rn) +static const FPScalar f_scalar_ah_fabd = { + gen_fabd_ah_h, + gen_fabd_ah_s, + gen_fabd_ah_d, +}; +TRANS(FABD_s, do_fp3_scalar_2fn, a, &f_scalar_fabd, &f_scalar_ah_fabd, a->rn) static const FPScalar f_scalar_frecps = { gen_helper_recpsf_f16, @@ -8654,7 +8714,12 @@ static const FPScalar1Int f_scalar_fabs = { gen_vfp_abss, gen_vfp_absd, }; -TRANS(FABS_s, do_fp1_scalar_int, a, &f_scalar_fabs, true) +static const FPScalar1Int f_scalar_ah_fabs = { + gen_vfp_ah_absh, + gen_vfp_ah_abss, + gen_vfp_ah_absd, +}; +TRANS(FABS_s, do_fp1_scalar_int_2fn, a, &f_scalar_fabs, &f_scalar_ah_fabs) static const FPScalar1Int f_scalar_fneg = { gen_vfp_negh, From patchwork Fri Jan 24 16:28:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859575 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp882020wrq; Fri, 24 Jan 2025 08:33:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUm/tyVOFW6f4GQywuNr5jBEMMtaw29QVqFDKlQL0sjDh2jVJ4X4UkCpBxftsjeN/onMO/MMA==@linaro.org X-Google-Smtp-Source: AGHT+IHMxxXAKIYQapxPsBQRGtaDvuDvMvY+61gHmuviJMV+tNJuDmPnyuDQJXZr5DrHI9eZiMRG X-Received: by 2002:a05:6102:38c9:b0:4b2:5d16:f75 with SMTP id ada2fe7eead31-4b690b8b049mr25524430137.4.1737736399584; Fri, 24 Jan 2025 08:33:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736399; cv=none; d=google.com; s=arc-20240605; b=kSvqrJpbZZLiAPB3CIpcg4TcQK0JzsrMBTx/58g2MhiVuaySClAFnBEFcOUXDTLHZ9 wmNmBrUJRTwkrwyVKbRHQMi6C60OtbtgLFUPi+KyDHV7QAiAqwGwelLhk00edJU+OpDt Aml8m9Pk5LDwg5yE1+M5wjO0UiNuWokKrBlPVyUqjWZRT8YH2v5DTPQjTpU+pptXfOnY COpwZUQ32Ez9u3ME1Q1u9Oxu5tBOGWq4pZFqB1ho/cO1v1vnHo3LaPDXXpjHIv2tXD25 11bBarpJGYWfhUgc7tugD56opIdEAacW/JLDn7pTuuZiKjSCWgncOzrw+szN6WfoEcGT fqrA== 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=llFk2Hwm2qS6gPzAdVlCRdXm81oU4Fumc3QBeOF7eqA=; fh=3UCXGjFGa9JTAikSMU9otLfr4rbJAMJuqdLABAB0P6s=; b=M8TSu1EWFWPl52rnfrW0hZ61sM/RmPCBe1n5EyWKLfcwgz40jFpCRW0jrTI+d2wRoH yjkuUselVMP9wu1uLN5jMqia/w5refdVYLOOVyN6+Cjf4e+9ZkrWPsWk5WU07ko9Xjwz hrSLIKHOz11DVn0qrvoYCN30eH1e7G/nW7PoxouWozog217w+ne5HO8VjQvsoNe2msK5 Q+EgX9R8f8Rli/oKN8LazZ/EtQvUi0PgFfNknPOKagxEOgrTVtWmCZF0lq+O8j9qMSKx EgnVFyXw6LlS2gqXWTnqEiCoqxh/hmI+Nyy606czecuVv71IrLF2bvrRGUKMEtuj0wut wryg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JRQHoH5A; 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 a1e0cc1a2514c-864a9cd7b4csi840926241.98.2025.01.24.08.33.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:33:19 -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=JRQHoH5A; 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 1tbMcB-0005FO-Qb; Fri, 24 Jan 2025 11:33:03 -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 1tbMZ4-0005o5-8h for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:54 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZ1-0005jl-N1 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:49 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-436202dd730so16572115e9.2 for ; Fri, 24 Jan 2025 08:29:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736186; x=1738340986; 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=llFk2Hwm2qS6gPzAdVlCRdXm81oU4Fumc3QBeOF7eqA=; b=JRQHoH5AYzaEQa80G4DcEoZs3r/m17URfp5GeF4MqiUD/Hfq7ZB+JQY5QaZi+KQSzQ 958wmlivfl6PUx64bhQRqBLifJ7SdBlYqVW+vPn9ws4EnUFpyMl7UcPkhTHEdo8ybRup i1GvmwjdyRmq8UqVPPwBBPWJ0dVQPAlH+//fuDJaMAJ+vHrDSGSQPEW1nd3YQvaMiMlG YydrmafQ6PzPvKnm6s9UaYpNtmu0mrEyoTJyFOxQk9WQl7JEn8O8aVI+OSR0IkCWaQuM nU6SjAhxP6VRj+cZW8NeWw4xxWR9r0j4V/Wm5uzI0Z3oqaRAS3vJ0u6vK5OhKNpiyLC4 giDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736186; x=1738340986; 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=llFk2Hwm2qS6gPzAdVlCRdXm81oU4Fumc3QBeOF7eqA=; b=NQ8tuS5hrMLsDmh/HqMNBt41by7xvY/fgsRDb2SV/pGJSz3y8/o5IgMwNWsmRClRzl UjMp4qHy/ZpuKnnxFb4f5z7e3Fz6jky2S66OgwP57x8sE1Zk/G3jtxep7obPofTZ0R19 xYN2Kyu3sJU9etkCslrWc4YFkiV4U6x/mm0XVakEjuJfwwP/ahQ0IzVCp+7TFA/n6ZZt PpmqubnUYeW08qz9h2K2CzRhgq4W7Rt7bf2S4uVN4TPgTSGocRGHQ7JTDWN4q0t30CB8 tlRxHIFsK9dgyiU9fA22a0pGVODNkexBQDoFtVrK8OtXM2f7/DnvbU/zAz1XQQjDRF7g iQRw== X-Forwarded-Encrypted: i=1; AJvYcCX2kWJlYcGkiQ/R2aqWxK8dz11k0v7oIyEq9JZryzs+llLm37XrxZW/OOtJt2wQlgF6fN5g7x7aMtzR@nongnu.org X-Gm-Message-State: AOJu0Yw34H6bSh9EHaDsLZC5iYu/4lybLmWti22+9fbnlr9ranxoc7Sb LEORwpLP5HHGbIN00iy2QclaNjKurDb9rKkxwJgOBDyi8wHp5cFJ9LleqC76N+YMLJh0xxdJ37G k X-Gm-Gg: ASbGncvCQIKf7iCbPIsOJt+8z6NtnwCb8Cah1UYASjXFC8DLUs1Rqi+/MJ4SgmVn5Xm wNTC84aEWj12+osAzpNJYeQv3p6nqfsjAn99agf5VfZFpqz6p0mN9HHqNowaZCAIcHyeM0i0iR9 bQNpDNncwgqNVMqQEZjE0VgAug0hKaAzTasdKAPCYv9yK1HsciGxr7c4r6E5KV8AWSo6+6lKcJq G7GlPyglBvnJXwaqRM3gNOGOMWdiXSPmBQoADCrEOyCAt5BB7YVWwFKhUHD3pdw3RRJ5yufrN2I F4XvfYiffU4= X-Received: by 2002:a05:600c:4687:b0:435:b064:7dce with SMTP id 5b1f17b1804b1-438913f2df1mr295364005e9.18.1737736186333; Fri, 24 Jan 2025 08:29:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:45 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 54/76] target/arm: Handle FPCR.AH in vector FABD Date: Fri, 24 Jan 2025 16:28:14 +0000 Message-Id: <20250124162836.2332150-55-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Split the handling of vector FABD so that it calls a different set of helpers when FPCR.AH is 1, which implement the "no negation of the sign of a NaN" semantics. Signed-off-by: Peter Maydell --- target/arm/helper.h | 4 ++++ target/arm/tcg/translate-a64.c | 7 ++++++- target/arm/tcg/vec_helper.c | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 15bad0773c0..43505d5fedc 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -722,6 +722,10 @@ DEF_HELPER_FLAGS_5(gvec_fabd_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_fabd_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_fabd_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fabd_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fabd_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_fabd_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) + DEF_HELPER_FLAGS_5(gvec_fceq_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_fceq_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_fceq_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 542e774790b..ce9ab75bc2f 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5899,7 +5899,12 @@ static gen_helper_gvec_3_ptr * const f_vector_fabd[3] = { gen_helper_gvec_fabd_s, gen_helper_gvec_fabd_d, }; -TRANS(FABD_v, do_fp3_vector, a, 0, f_vector_fabd) +static gen_helper_gvec_3_ptr * const f_vector_ah_fabd[3] = { + gen_helper_gvec_ah_fabd_h, + gen_helper_gvec_ah_fabd_s, + gen_helper_gvec_ah_fabd_d, +}; +TRANS(FABD_v, do_fp3_vector_2fn, a, 0, f_vector_fabd, f_vector_ah_fabd) static gen_helper_gvec_3_ptr * const f_vector_frecps[3] = { gen_helper_gvec_recps_h, diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index d3f2eaa807e..3b87e5b8d6d 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -1302,6 +1302,25 @@ static float64 float64_abd(float64 op1, float64 op2, float_status *stat) return float64_abs(float64_sub(op1, op2, stat)); } +/* ABD when FPCR.AH = 1: avoid flipping sign bit of a NaN result */ +static float16 float16_ah_abd(float16 op1, float16 op2, float_status *stat) +{ + float16 r = float16_sub(op1, op2, stat); + return float16_is_any_nan(r) ? r : float16_abs(r); +} + +static float32 float32_ah_abd(float32 op1, float32 op2, float_status *stat) +{ + float32 r = float32_sub(op1, op2, stat); + return float32_is_any_nan(r) ? r : float32_abs(r); +} + +static float64 float64_ah_abd(float64 op1, float64 op2, float_status *stat) +{ + float64 r = float64_sub(op1, op2, stat); + return float64_is_any_nan(r) ? r : float64_abs(r); +} + /* * Reciprocal step. These are the AArch32 version which uses a * non-fused multiply-and-subtract. @@ -1389,6 +1408,10 @@ DO_3OP(gvec_fabd_h, float16_abd, float16) DO_3OP(gvec_fabd_s, float32_abd, float32) DO_3OP(gvec_fabd_d, float64_abd, float64) +DO_3OP(gvec_ah_fabd_h, float16_ah_abd, float16) +DO_3OP(gvec_ah_fabd_s, float32_ah_abd, float32) +DO_3OP(gvec_ah_fabd_d, float64_ah_abd, float64) + DO_3OP(gvec_fceq_h, float16_ceq, float16) DO_3OP(gvec_fceq_s, float32_ceq, float32) DO_3OP(gvec_fceq_d, float64_ceq, float64) From patchwork Fri Jan 24 16:28:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859584 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp883165wrq; Fri, 24 Jan 2025 08:35:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXyo7ZDnEvq84HCt6NrioCOAsWTiDSITaWKYixudxAV/z3GCar6x393iSbwVpqBZYcSmEqk0w==@linaro.org X-Google-Smtp-Source: AGHT+IFPn2N+0gyi9FJLS40xjeE0fdbCexptSQXyhDu6Mr+bfBMW9Ej6Mxr7ivvSBEXAY4oLbuYF X-Received: by 2002:a05:6214:1302:b0:6d8:8d16:7cec with SMTP id 6a1803df08f44-6e1b2235e5dmr513305326d6.37.1737736531638; Fri, 24 Jan 2025 08:35:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736531; cv=none; d=google.com; s=arc-20240605; b=Loko2xIrrJb0mzoYWetepiYd8VaUWKxnbtYBY/FhH9CWHxCAKsVeTKUsNVKd/5+QTx BOOvMqEqP7vncLtO6G0gTNswnifvIk3jClRlJi76vlevcDBU80IqMfPQ3QGSz7nN3heH vcYGziWe90GSQk2ffLden/o6jSsD1/d5gN0sanQJRjJNW0TlKMi2Mj44QHzM7Go65A6N ZvQTCgDYktbo7a65Brd/GixTVNbghOWhBgH7JnioAsZ7BNUZ1XftdXB4xZ826JUwgm1d PeH17lEp8we8aHDiq9+x1fh66MdFwCNonWSboZNcMFn3+yJc/6Zq+7ThejRanEQU5V+9 4rDA== 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=Xa1fBo10CzOivkmHS7U9EDrLQS1MKeQCJwxUTgWHwhc=; fh=hgYpfUj1ybmuAf6PsC1mMWfnELsve218Qxo+rZtcZac=; b=TBksejFtkhAZ493hYKpcNjR809PQsRL7s91uMGamyazErYdBtFg52NXk3ie0qnE7Eq dEsf5NdrNlLo6ywD0EF97nWsUQqhtUm9WGuGRZM6HJFTsDr3TnCVIJ1M5NIf2H2a5zue ViovEH59OoaQbZdHNU/NKkmr3KuXd6OGr14MOpFyFXK8gUhyZfhf3F2UEImoIjPnFlHw wtyGPxuUEI9Q6N/YbJGmSdWiyQW3Gtv/F8O6sLlFNDwSU9LdPYDttTD0vQi1Dz0IbGl2 6rI2e5bExvBFw16gj1ugQJXK19z8333DN77qaBUdY+7GrbaT+kP3x8zCu5Q6KpetW0DX L0mw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a0JyjP0W; 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-6e206008c67si25676846d6.355.2025.01.24.08.35.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:35:31 -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=a0JyjP0W; 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 1tbMcH-0005dP-9y; Fri, 24 Jan 2025 11:33:12 -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 1tbMZ5-0005og-MF for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:00 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZ3-0005kG-W9 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:51 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4368a293339so25517045e9.3 for ; Fri, 24 Jan 2025 08:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736188; x=1738340988; 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=Xa1fBo10CzOivkmHS7U9EDrLQS1MKeQCJwxUTgWHwhc=; b=a0JyjP0Wk31axheTgrALDgVeRt5IfD7Q9iJmPEX15vG75iFA8WjgpJGaPJKd2ORime G6iP3F6muCgf9amnA+CU3+n4a7qglu10ufGm2rhwdS9AALXI1CtUHgR4nIKOPzNggQUE jd1g4jJ8xE4Fi7iSNM/5epAl/Vbvf7sALxI3kk3UvmhlRkMdsEDOWhG7/w0K/yJL7IKL 0vNavQK4g3SpSO6qFZ+STKBbAJxKfHXbENcXGF1m+0f+6aYWNMnKC4oreZMujK4aUVdI 8OFvBzza8IQe86xYz9SzLVh3YuKhmaqRGYx7iugDLsH+CO7c1MRfnN2zzWstT4CIt731 jBiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736188; x=1738340988; 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=Xa1fBo10CzOivkmHS7U9EDrLQS1MKeQCJwxUTgWHwhc=; b=lqxChFPlEq0rCniJg6jJ7a0HA2lYQ7iHEDAVREaFCyOqP06EZZKlgvPOJvUSKZp7Y2 58zoskgwExjrTIFuFITXn9AtHwVxiggj210kMGL/Uod0uc3PNPpjTqnZpK+/IwTeM1vE K+iUvvKX9zOSIF7XmF0hJUOa/himdSCKX5qKlB1Fe8n3v7B68M9FAJb4Lt2RuDJJRywS J2ZvNZS4BCnKFLCxUWbwB5k25M3gSOghBa2pmwbUPzSZuSMfmXxjaI4/qSTkrmihHfU8 y9K+HZ9cy8zQE8n3CtRaFazPDVwrEQuhd/DOYWM7MB6+rGxxpXOf2bdjT6jIPS827gPS mkWw== X-Forwarded-Encrypted: i=1; AJvYcCWB64TmiD/qYWctk1943aYJ3UDl397lAdoI282fZnnt0fBsKNA0PjVX43ocMSb74I4L6S+xCayI3VI9@nongnu.org X-Gm-Message-State: AOJu0Yxo/KuwpXLGv9G9FU9Q58e3ud+0q1SDjuZRGtC7rFgES/YmcJpI IQJJxKhq+yy0AMC0GcCfoiEJPKG1odvNCzOqXhOBnWRWl8PwMsHLmIkwIOl5Zegk4BoLA5Y7nsH Z X-Gm-Gg: ASbGncvRat7o95qAz83bV//eS78ozbQDbo1tZPv3cEBEV2WCbNRCDimnVDzfSgkbgfb 6BUWMepw3TtZvDbTlO1mqkt/hRT5RNSFB+bjTj8Ii7BRzqeYz6eDgxQf46a+G7QMI8XoYaih3e3 2eNJi4AKZS04Xqj5jdDR1eeGONW9OaOpw9jyKgm5fMcQw0MU12TPanPqZrj2fY3jWmwqXtH2H5P zx67qLYNTz/zCFDbG5EyixH5iuw0rPG9981q3T2aJaFEwLFV/xto/Pv9b/5mZ2HIdHXnHbHJYN7 7Ge6+qXvrmU= X-Received: by 2002:a05:600c:4e93:b0:436:1b81:b65c with SMTP id 5b1f17b1804b1-438913df89fmr288197655e9.15.1737736187914; Fri, 24 Jan 2025 08:29:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:46 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 55/76] target/arm: Handle FPCR.AH in SVE FNEG Date: Fri, 24 Jan 2025 16:28:15 +0000 Message-Id: <20250124162836.2332150-56-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Make SVE FNEG honour the FPCR.AH "don't negate the sign of a NaN" semantics. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 4 ++++ target/arm/tcg/sve_helper.c | 8 ++++++++ target/arm/tcg/translate-sve.c | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index 918f2e61b7e..867a6d96e04 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -545,6 +545,10 @@ DEF_HELPER_FLAGS_4(sve_fneg_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_fneg_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_fneg_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ah_fneg_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ah_fneg_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ah_fneg_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_4(sve_not_zpz_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_not_zpz_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_not_zpz_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index a688b98d284..976f3be44e0 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -885,6 +885,14 @@ DO_ZPZ(sve_fneg_h, uint16_t, H1_2, DO_FNEG) DO_ZPZ(sve_fneg_s, uint32_t, H1_4, DO_FNEG) DO_ZPZ_D(sve_fneg_d, uint64_t, DO_FNEG) +#define DO_AH_FNEG_H(N) (float16_is_any_nan(N) ? (N) : DO_FNEG(N)) +#define DO_AH_FNEG_S(N) (float32_is_any_nan(N) ? (N) : DO_FNEG(N)) +#define DO_AH_FNEG_D(N) (float64_is_any_nan(N) ? (N) : DO_FNEG(N)) + +DO_ZPZ(sve_ah_fneg_h, uint16_t, H1_2, DO_AH_FNEG_H) +DO_ZPZ(sve_ah_fneg_s, uint32_t, H1_4, DO_AH_FNEG_S) +DO_ZPZ_D(sve_ah_fneg_d, uint64_t, DO_AH_FNEG_D) + #define DO_NOT(N) (~N) DO_ZPZ(sve_not_zpz_b, uint8_t, H1, DO_NOT) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 0fed92fa48a..c173627ad49 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -789,7 +789,12 @@ static gen_helper_gvec_3 * const fneg_fns[4] = { NULL, gen_helper_sve_fneg_h, gen_helper_sve_fneg_s, gen_helper_sve_fneg_d, }; -TRANS_FEAT(FNEG, aa64_sve, gen_gvec_ool_arg_zpz, fneg_fns[a->esz], a, 0) +static gen_helper_gvec_3 * const fneg_ah_fns[4] = { + NULL, gen_helper_sve_ah_fneg_h, + gen_helper_sve_ah_fneg_s, gen_helper_sve_ah_fneg_d, +}; +TRANS_FEAT(FNEG, aa64_sve, gen_gvec_ool_arg_zpz, + s->fpcr_ah ? fneg_ah_fns[a->esz] : fneg_fns[a->esz], a, 0) static gen_helper_gvec_3 * const sxtb_fns[4] = { NULL, gen_helper_sve_sxtb_h, From patchwork Fri Jan 24 16:28:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859605 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp887550wrq; Fri, 24 Jan 2025 08:45:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUxW69Hc/wxH8O0YSU0eBDXxK7jzOIthlCILGRBRsgFNN9WutMEtBpMc//0FURsi400ouawDw==@linaro.org X-Google-Smtp-Source: AGHT+IHNvWaetchWvafNu+yPi1fn/ZFwiffArjFVBXYNOfYxWCNSAu6NaaCGtA+W3tXQ9jHYe9FR X-Received: by 2002:a05:6102:548d:b0:4b6:5e0f:6ddc with SMTP id ada2fe7eead31-4b690be8ea7mr22800026137.14.1737737152674; Fri, 24 Jan 2025 08:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737152; cv=none; d=google.com; s=arc-20240605; b=dyu/4VTXy6ZHJh9mz+HuT3jXzUeLgaNhcrDoQ606C7OCNHQ+y5rw3NZ4g7qFcFrj/N uIVWZHG90OBMs2elYnuROgzQYnx161q5Qwa3g+K5ip7Z7KoB2OJZ3DWxHgSkHCZ1XOoX oDLBJmoZ7OgOQSxeZZSL6en8NbwRpZBXv49QRS97RjleAPmQTh/Y73RGaQ/eyn4Jy/T4 mzCmEzq3nYtv0ZI2ZmO8e2H9oV4LyA+uu/Xo+CwYYcgh8ewAB4Yt7SP+bbDtYJpTKTAC XK81HWR14enXdYybChMWHOZZnThzGGwAqPuB+5XRi5DCpCXVmdR26ly8ynOIrIUqUqc3 apQQ== 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=vkN1tvZXYem3cLB2r+/GaeAu/aQPELpTO9bRu2GSjS0=; fh=OHXdmJhxjkJx83JB8nR6qCtdfWuF9r0Z1CWYa3Kf8HA=; b=dQRDI9TCexdsEUtk7Fnx3er0U/12YOUg9FXd959gBr3mm8NrCib5oymOktIuxiTIp0 QahKbjICI3BwHYbdlt37LC0nf8ZzfITZVWR5yfvKiYiXOs4mFREwMRVw/LXNfOi9V8ay UqkN0uhQ1u7vPGFtaCUPL9R6PFfYUIjbCU59x+G2tZT/ubKG6OABF2hTElcUhwcipZrT wk47bwWI3pHH+buC/LmGCSppfM7dkMLnizX9Ef72wqzYBs/9eQbIF+3yxDKhw8YJR/9g tUGdGhoI+3XBkfV0VDZP17fqF9OVFhXfakrUqKsYy+zefsHXLQAD99/nT6vmB8h/Dvqj 7JpA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QA9ekjkF; 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 a1e0cc1a2514c-864a9d4102csi749601241.178.2025.01.24.08.45.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:45:52 -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=QA9ekjkF; 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 1tbMfZ-0004S7-85; Fri, 24 Jan 2025 11:36:33 -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 1tbMZ7-0005ol-3l for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:00 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZ4-0005kR-KM for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:52 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4361c705434so16685675e9.3 for ; Fri, 24 Jan 2025 08:29:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736189; x=1738340989; 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=vkN1tvZXYem3cLB2r+/GaeAu/aQPELpTO9bRu2GSjS0=; b=QA9ekjkF/0amWxMUvExS+Kru6TyW1dA2ONt43UHo27G2TEW2kcpkarY30KKZsqlzEh PUWM4vwyF/WEqY1V2rHnhn5X9MlJfQ1nImIE2nF1dc1pJDrJ58xDPEcxYQ4pYm6dMxqJ sF8Nd5cH92/4iIec2qWt/o635Yb5Yn5f7GeQcmhOrxMb0By1oNz0ALmjtZHuf6lJ7FW6 MYHfvHAGSvbbzZLZspzzTduRMo4cDHAbJRV4+uVeewgNEqNkmtUTYwLFciMC2cYJxu71 1Z85ECxr+AC5Ye5+Y1jMBReLuQ/IdQfJE8Kw4tAR/zvdiNmUHdy/1/b/EZhHLTX3CvXT 3lKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736189; x=1738340989; 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=vkN1tvZXYem3cLB2r+/GaeAu/aQPELpTO9bRu2GSjS0=; b=VKQYe0pMoWBRsSX+xpQFrVB2EbP8O/sAMsPo/XFRNCsgP1VoDsQ3iGtoc7mkN8eao+ 2yIlRGZJ50mwOVEQajoNhDDYwRzzu4YC6H6sQRVfMrfzPN3oUJRxGfnu+14XIzqGmSQ/ Zl8o+7rHzxvmeNas3dn/jzDfIGiA7SwFP8H60xBXOrcGl80UwBxWJvjH9xv0j5DyJPCO jfn68Fqlbf6uktQwYXaG1tD1adu/wxLxZk6mnJieN0N8JrBSvi4lRlf+S9adMBwQC0fE cp0b5pd2fhiD3QY4Zbw1Dau8RGMPynyVWIQ86LkwLfXcfhERnS2Z0vt/EszQYJFFCFv+ 3G0Q== X-Forwarded-Encrypted: i=1; AJvYcCXhP+kE8NUFjg0G0Wt6Sx4Fn4UNOzJFxvrrbBrLiTp58ysgb4wdNa5y7eisOHArau3gNsxzsYgdRYgJ@nongnu.org X-Gm-Message-State: AOJu0YxX+MTkA7MZSFo7oFHNHDcQ/xmkJDV+Mq3+KThXOUshKeUBrZX7 C6BGq6yhNPqtfMn1OOIYnhh9hLRIxIRyQ39Z8Z3ZJerkW4B9w1hw1JOqr0OU0GCcY6SB3vj9CCR 1 X-Gm-Gg: ASbGncvuq6ACO7Zj6+5rjVF4s3dcKQkeyuqFa5jXPwfsnrIKq+ErQQqo8nV2mQwbo9L oGRhaGvK0eqgr1/zYEz0jQZiJVgOhE6oHpNDhmJBk4ksOSQkuuAK01na9VYqPwPV/yp/I3glz/Y Df5/6FZBT5UZzZeFEtDkoXGqxYbQqiPefjdGr+NLu8Sn7BahjbWqzBdjjOZCESZa1yIGwAT7rsM jGVbBRDAYE86pkXwB4jcmjD1YG3WUVuj7o4GEBEK+YTZvk/FLzS/lYbozWyMd9iplma9qObW3nm WxnWRUkeYNc= X-Received: by 2002:a05:600c:1f19:b0:434:a1d3:a30f with SMTP id 5b1f17b1804b1-438b9cc072emr73449355e9.6.1737736188906; Fri, 24 Jan 2025 08:29:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:48 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 56/76] target/arm: Handle FPCR.AH in SVE FABS Date: Fri, 24 Jan 2025 16:28:16 +0000 Message-Id: <20250124162836.2332150-57-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Make SVE FABS honour the FPCR.AH "don't negate the sign of a NaN" semantics. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 4 ++++ target/arm/tcg/sve_helper.c | 8 ++++++++ target/arm/tcg/translate-sve.c | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index 867a6d96e04..ff12f650c87 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -541,6 +541,10 @@ DEF_HELPER_FLAGS_4(sve_fabs_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_fabs_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_fabs_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ah_fabs_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ah_fabs_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ah_fabs_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_4(sve_fneg_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_fneg_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_fneg_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index 976f3be44e0..5ce7d736475 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -879,6 +879,14 @@ DO_ZPZ(sve_fabs_h, uint16_t, H1_2, DO_FABS) DO_ZPZ(sve_fabs_s, uint32_t, H1_4, DO_FABS) DO_ZPZ_D(sve_fabs_d, uint64_t, DO_FABS) +#define DO_AH_FABS_H(N) (float16_is_any_nan(N) ? (N) : DO_FABS(N)) +#define DO_AH_FABS_S(N) (float32_is_any_nan(N) ? (N) : DO_FABS(N)) +#define DO_AH_FABS_D(N) (float64_is_any_nan(N) ? (N) : DO_FABS(N)) + +DO_ZPZ(sve_ah_fabs_h, uint16_t, H1_2, DO_AH_FABS_H) +DO_ZPZ(sve_ah_fabs_s, uint32_t, H1_4, DO_AH_FABS_S) +DO_ZPZ_D(sve_ah_fabs_d, uint64_t, DO_AH_FABS_D) + #define DO_FNEG(N) (N ^ ~((__typeof(N))-1 >> 1)) DO_ZPZ(sve_fneg_h, uint16_t, H1_2, DO_FNEG) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index c173627ad49..c234a4910dd 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -783,7 +783,12 @@ static gen_helper_gvec_3 * const fabs_fns[4] = { NULL, gen_helper_sve_fabs_h, gen_helper_sve_fabs_s, gen_helper_sve_fabs_d, }; -TRANS_FEAT(FABS, aa64_sve, gen_gvec_ool_arg_zpz, fabs_fns[a->esz], a, 0) +static gen_helper_gvec_3 * const fabs_ah_fns[4] = { + NULL, gen_helper_sve_ah_fabs_h, + gen_helper_sve_ah_fabs_s, gen_helper_sve_ah_fabs_d, +}; +TRANS_FEAT(FABS, aa64_sve, gen_gvec_ool_arg_zpz, + s->fpcr_ah ? fabs_ah_fns[a->esz] : fabs_fns[a->esz], a, 0) static gen_helper_gvec_3 * const fneg_fns[4] = { NULL, gen_helper_sve_fneg_h, From patchwork Fri Jan 24 16:28:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859608 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp888172wrq; Fri, 24 Jan 2025 08:47:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVaR0R4k4+8OLb2x69f+ojHxvgtn4iL/PIJXBQddrYm3i/AXpJB98Vd3tkYUQjjkbbhVcFEyw==@linaro.org X-Google-Smtp-Source: AGHT+IGKEQtBmftr1mgTCtwU3K6e79YAWZCDI5d6uv8Yt/e4bQuY5KtNtH7dFwQ1lJs7H9C0/n58 X-Received: by 2002:a05:6102:510a:b0:4b2:bc6b:c845 with SMTP id ada2fe7eead31-4b690ba2f8cmr24296010137.6.1737737238308; Fri, 24 Jan 2025 08:47:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737238; cv=none; d=google.com; s=arc-20240605; b=jOHD7bi1an5bT9bgdTI2NxxsdbtQ0SSy4jTI58gpW7ULeJUorV4EL6p3CZuWswTnIM 1sqvPTugtskeE6OXY9+Ws0BkiesuZe0V5I5b1DN6mtUuKZcno8kUmGdA+hH3B7TvvaY1 gGj4Xcn/Ifyf1QC7EtJOHKqJL3ENDJeLsRcyr5BKpAFeeByslqEo+2wFTXXFRBYyCWo3 j6MU1XGw4edxv6DN0GgJRAh6O25Uf31IB5iotn1Ne/88NidG5O3wrpPN4h/qXKU+VswK fz2GdGB2hk+4Ckuqa2mFmfxsuJ5alBYHHun/8/s8Z06F1nv+Zds8TWapBTJe4o5WHy0X lrvw== 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=KLPz/10dFXxgiRkXTl1JPzUTaxJlkEW7KOCXlSsN4J0=; fh=vF/STqJ0Fi36c8WDeSRB8UszPhcAvS37pWoaW69azmw=; b=dD1GTKLJpqJLjJwZkKOTh9HGpBhZVROzVmwbFW8egiXeNP0MpRviIE5ZEA9engDE8G oq+PQ5XjF8QGm+oW/ItTIJbHC90vYhj5qf1V24vTqNqYesb2ifPmw+TqOrcjT/kwSuVj 6qx2ggHP54ppTMb8MiyZIeC3oHhNSdYEb0iIkRyGW3jxFG/VY9/hDxG0V3TTQpQAcymD 8qk96VCARNyBePrY2FT7BvU+btVrJETAo38OwcZo7Z2p3Pv4VgrvIwIso448kKsVq86m F+x073sh09C6dDJK22YOLyyivtFpp6JAlV8QxkLKMzzENxd/JLCMnYyl92RB4WT46khm KSgw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bttdBvxi; 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 a1e0cc1a2514c-864a9b192e1si743196241.62.2025.01.24.08.47.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:47:18 -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=bttdBvxi; 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 1tbMcn-0006CB-A0; Fri, 24 Jan 2025 11:33:41 -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 1tbMZ9-0005p2-M9 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:00 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZ7-0005lU-AN for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:55 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-436341f575fso24727565e9.1 for ; Fri, 24 Jan 2025 08:29:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736191; x=1738340991; 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=KLPz/10dFXxgiRkXTl1JPzUTaxJlkEW7KOCXlSsN4J0=; b=bttdBvxi8seEXyDMAO6Q7OxNvHQrQaTDXo0w71qHbJlNqM1VKrA0B36RsDvfgkxUlU mjVvz9HMiIa3T9tcDYJ0cQn2jY32xhzim47zwkeRSqHdd9kgWzw3WuEdGqmuCJiYs28K FwzOx7KxtvNLX3d3RIOu5ltKH/hlAwEITZm+pt/TY5t9z1YwD96KndkQYxNg/jfZBRmN h/8RZG/9b5oXOD1KJLAWp5tn/8+Ys/TUkGdIlOVpGzj3orByiDNatkw/IxFn8sv253z0 Gv5aOQyxMXxEmTekqt3Q2mhuRJ7iCa73/yNKBcLcRYLW5w6oYPbjzTiL0cRYNB2btE7x 1lGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736191; x=1738340991; 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=KLPz/10dFXxgiRkXTl1JPzUTaxJlkEW7KOCXlSsN4J0=; b=d9SvLbTwlrPswkkVaKmi3ofoBl7fAmTKOpROi/YKCNQhgAlQ4YQwBy/vNxMBUKE4o/ Z3d98I7uOdnpvg1Gt+MXiQxuMkNU5HN0mV3WUX32v9psSV8Wh6pTUvB7wPqD/lCir4DZ 1LNri52DRomCzdZZGa/pmD3j8Z/hqVTBiIRqI+K0964Q+i0OzgvEc/A3MskDaXmxnCFa WrQgxdwqAcwY4dhdJezH5qifWxEC7aPmKnoef3aS1+8s6STSqGdXp/wA+ml+u7674E+K C9U9RxymOYzVHuiI83GmqbtKO338sXZ5LHRemacjfUnA2Jj5+PhL+VhKiRW1v8Yv8LqI aViQ== X-Forwarded-Encrypted: i=1; AJvYcCUuMHFnYNwGR4U/GRWLo9bVk+u2O/yolf1PWFhZT6gJdVhAfff6izEHCTzGxTV6zYGAFu6Bg+6ZPEsQ@nongnu.org X-Gm-Message-State: AOJu0YyVE0MvX1be0WORq4JwKqlNIKaul8KJi/FpiGtf9hBesu10PYSt Hle3/k0qjzi7FnV5jivsVXXo67ijcPMqPiXZOhclxOOSOV7/zfW3xuYOCwjPdNs= X-Gm-Gg: ASbGnct784CKXa+fUgadfnYuYAG+kXF70NKCnzTNHbFgiG8DUDJrb8eqaEGlgLpkIw8 iP6xc1ZK1l4TNAEA07SpDx4lMsGAqZVjp4XBHbHHhQ5Ln6Sp2jUqVJOgtH3MMARlIUbg1hhcQun YMMt3PtJLsVI0uvW8urOuJ2k1YTpA3im/Ja9gE/EbJ5r3czTamxDtcjIDMSbWCU+bxqN1fV8qI0 gwh8X4eRXUBPQNLo0rPEeh0XMG5cFzldE5z0X60l+9dkmKJ3SnIvWX/W3J3rW0/Acm2NBtWRfJ9 UTYCndZzdfI= X-Received: by 2002:a05:600c:348c:b0:434:a04d:1670 with SMTP id 5b1f17b1804b1-438912d7c1bmr325724575e9.0.1737736190070; Fri, 24 Jan 2025 08:29:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:49 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 57/76] target/arm: Handle FPCR.AH in SVE FABD Date: Fri, 24 Jan 2025 16:28:17 +0000 Message-Id: <20250124162836.2332150-58-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Make the SVE FABD insn honour the FPCR.AH "don't negate the sign of a NaN" semantics. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 7 +++++++ target/arm/tcg/sve_helper.c | 22 ++++++++++++++++++++++ target/arm/tcg/translate-sve.c | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index ff12f650c87..29c70f054af 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -1183,6 +1183,13 @@ DEF_HELPER_FLAGS_6(sve_fabd_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_6(sve_fabd_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fabd_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fabd_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_6(sve_ah_fabd_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, fpst, i32) + DEF_HELPER_FLAGS_6(sve_fscalbn_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_6(sve_fscalbn_s, TCG_CALL_NO_RWG, diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index 5ce7d736475..8527a7495a6 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -4394,9 +4394,31 @@ static inline float64 abd_d(float64 a, float64 b, float_status *s) return float64_abs(float64_sub(a, b, s)); } +/* ABD when FPCR.AH = 1: avoid flipping sign bit of a NaN result */ +static float16 ah_abd_h(float16 op1, float16 op2, float_status *stat) +{ + float16 r = float16_sub(op1, op2, stat); + return float16_is_any_nan(r) ? r : float16_abs(r); +} + +static float32 ah_abd_s(float32 op1, float32 op2, float_status *stat) +{ + float32 r = float32_sub(op1, op2, stat); + return float32_is_any_nan(r) ? r : float32_abs(r); +} + +static float64 ah_abd_d(float64 op1, float64 op2, float_status *stat) +{ + float64 r = float64_sub(op1, op2, stat); + return float64_is_any_nan(r) ? r : float64_abs(r); +} + DO_ZPZZ_FP(sve_fabd_h, uint16_t, H1_2, abd_h) DO_ZPZZ_FP(sve_fabd_s, uint32_t, H1_4, abd_s) DO_ZPZZ_FP(sve_fabd_d, uint64_t, H1_8, abd_d) +DO_ZPZZ_FP(sve_ah_fabd_h, uint16_t, H1_2, ah_abd_h) +DO_ZPZZ_FP(sve_ah_fabd_s, uint32_t, H1_4, ah_abd_s) +DO_ZPZZ_FP(sve_ah_fabd_d, uint64_t, H1_8, ah_abd_d) static inline float64 scalbn_d(float64 a, int64_t b, float_status *s) { diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index c234a4910dd..9200f7f8a49 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3789,7 +3789,7 @@ DO_ZPZZ_AH_FP(FMIN_zpzz, aa64_sve, sve_fmin, sve_ah_fmin) DO_ZPZZ_AH_FP(FMAX_zpzz, aa64_sve, sve_fmax, sve_ah_fmax) DO_ZPZZ_FP(FMINNM_zpzz, aa64_sve, sve_fminnum) DO_ZPZZ_FP(FMAXNM_zpzz, aa64_sve, sve_fmaxnum) -DO_ZPZZ_FP(FABD, aa64_sve, sve_fabd) +DO_ZPZZ_AH_FP(FABD, aa64_sve, sve_fabd, sve_ah_fabd) DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn) DO_ZPZZ_FP(FDIV, aa64_sve, sve_fdiv) DO_ZPZZ_FP(FMULX, aa64_sve, sve_fmulx) From patchwork Fri Jan 24 16:28:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859628 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp892156wrq; Fri, 24 Jan 2025 08:56:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVpzV7xm2QlbAiJtz+NqN7pdk57iT9gWLbxgRCh88g9791zmeC6JGuuvcEl4i04ZBxXQljt9w==@linaro.org X-Google-Smtp-Source: AGHT+IGuQARgwFSYPHknFrK5nf6r1aQeOrHx1XPhV9c59ZV8ld7M8Mx2L2ibHvyrGYmDkdqPe6ZB X-Received: by 2002:a05:6102:32c4:b0:4b2:cca7:7d51 with SMTP id ada2fe7eead31-4b690c6a5abmr28070885137.19.1737737803898; Fri, 24 Jan 2025 08:56:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737803; cv=none; d=google.com; s=arc-20240605; b=czJHjaQAlIxheI8OhhZw9d/AWUxjtlLWj9qWpBAARSi1tIEgD0HT3/q2ZqXCoNMbN6 gUwQS+nuw3tZHGrUwXRr1s4if2t8KW8zOAIBBNdPHC4b7J5FB/D4ohUcuiT/49snuELp DLiUH9G2t7TkLwp7lB/UbusGgCIDtpKfNsKN9RIuD7udioF4ClQnbO5vcT05jYt/bYph KazNmTYTvNnE2uOZ9hI5r/Zl2CXj0h2CqL7Q9ewEki0GHzunWZ4R6Ji1IxvllKHn7jeL FhJncdfW05C8bTrPToVN7vRYaHLfxIPC0J+UTLwYZSbt5SvgUuq1VKz8P5xynJNkvIH4 OZQQ== 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=LSzywg4TTdbVfL3fvcONmuOXn5s4KCgB/V3iwxmTcrs=; fh=+qOksi+Zx0PFskPM11bcnnr3Wp4jYiYIhdqCXVQbeDc=; b=eXyMlMO2H12d+M5axIXjT31a3sh+D1LJ7xUKt8f0UtUoSg7IP+ehU03DHzigfLX25Q eNwtMkIsiwwTbi2pNi5SSY09xOjSuaOCv6sRiaQzYLtjStaaVjl3eU+NdlL08JjHs8K1 6KCEbldUgd0/s/U+D2zqKbI5W7SX0oTKc7Hq+btHK6taQC1UpcHdGMG+k16govOOwY6/ mh77p1dxDGaF257PyHtCVG2WPQ3uEfUhvfg7tJFGwTm7gXRWTF677CJPIGBFaFGqBuo8 JZQpW9MwjX+9C1M/G0glkZmB1OE5oAZLuTAiJSjqr1y4WlqwpuiqS3XljepKS9PPE1Ii tWrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kiv3o2B2; 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 ada2fe7eead31-4b709a2b050si892802137.677.2025.01.24.08.56.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:56:43 -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=kiv3o2B2; 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 1tbMco-0006Gm-CI; Fri, 24 Jan 2025 11:33:42 -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 1tbMZ8-0005os-E0 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:00 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZ6-0005lI-Fn for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:54 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-436341f575fso24727475e9.1 for ; Fri, 24 Jan 2025 08:29:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736191; x=1738340991; 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=LSzywg4TTdbVfL3fvcONmuOXn5s4KCgB/V3iwxmTcrs=; b=kiv3o2B2PmNEpnqFUIoao6i3ODySIYdCuGAnhiT3TtkBb1SKm8EWR83/71xFFhQB3/ H05mtG3qsIHg7rdxxCKrw2EoYK65EoxyDuBtQVhWi2uAOH+udKXkIrVY9AfB2BC6xvc1 vijb+0DfBfQfmUbYpsDu4+FXnL9Q23ZAPWObFUwUja1anqj0Kj1o2hpmHN0ZwJb/5339 k9ofUkH5I9ZjhRaP1JURiXCLE8gHLQXvXrDrrV9ROg75h5LjdBOCzSJlRKqBFcKWe6CE fZy7+dPyTKyTcDNgViXCsJ7Z3a3Gdw93m63JH/W0tVVANvjJ7pJDEY7IKEQoRg8O9NH2 bwlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736191; x=1738340991; 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=LSzywg4TTdbVfL3fvcONmuOXn5s4KCgB/V3iwxmTcrs=; b=PodZaDDSODWmJrxdxONMSLJsLB3ULTPMFasiMJy1la7+fpagJq6IlpOklcb0JDRaxS 9ccoRRO1MrszyuzN0XY46YJnRUakELcnNdiayNyygGdxeB9fVTPzLLEbZdZIWYoWJo9T MiV6DpyhvUh9f172G1bHYgao/Fex1ugtIEjLe90gZStespViuc/HRclc9/r3jerGZZbx l9//RKpUI1FjwJG00PrmG8Myxd1n7m7u0z16/WskHtAiBLL3l9v4Q+yiP0s0Eo2uhlVE AbKGFSe/koQUojLj9XFDfNcsuymBchlN5gkxVADWdUHZO2PaY9rzNEbedgplKHyOCvo5 HDsw== X-Forwarded-Encrypted: i=1; AJvYcCV6ELj1VAscy4m2zGAe+rx2XsZCzbJ31jdRq5+UTy2o0H97E7TE9UR0XYwM9zrpU4G10rN4R2nq5S91@nongnu.org X-Gm-Message-State: AOJu0Yze9lOR0lfBLU9rvDuVHq+FztMpOqjuv+nM8smmyWSP4xOduKVf LUi5UQaGT92FCJVTxucM3A2PMH07lziSYbhQfs874Ug9L3JMFQcDF7TQsp20Vc4= X-Gm-Gg: ASbGncsFEww6rdrlYPxfTKJeABktU7B6GZszC1PjaTKJiOAXeDeMNbZ9LWYEkZqnulC YP0J78vAhI9bIMWXHNL0z1FddocmYrg2NpXgmN8MDokyc5at6gntvDtpyUH1Pjp49LE63gfa7sN yjc+rMHdtqvkI8QJ410P87J6K+Doo+B/xSpb53p6PzDSaXameE49cGDPT3kepz49BzIz5QyjGao uIcDOESpqMx7j6ilkfr9qiBifIFkesoim/zLLdQeCEISzuM7nYKmlMncuteFpO7+F94fpkOETxT ZN4dAzTArn8= X-Received: by 2002:a05:600c:8712:b0:434:a802:e9a6 with SMTP id 5b1f17b1804b1-438913ce0b7mr315490555e9.7.1737736191105; Fri, 24 Jan 2025 08:29:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:50 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 58/76] target/arm: Handle FPCR.AH in negation steps in FCADD Date: Fri, 24 Jan 2025 16:28:18 +0000 Message-Id: <20250124162836.2332150-59-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 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 negation steps in FCADD must honour FPCR.AH's "don't change the sign of a NaN" semantics. Implement this by encoding FPCR.AH into the SIMD data field passed to the helper and using that to decide whether to negate the values. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 10 +++++++-- target/arm/tcg/vec_helper.c | 39 ++++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index ce9ab75bc2f..0827dff16b2 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6117,8 +6117,14 @@ static gen_helper_gvec_3_ptr * const f_vector_fcadd[3] = { gen_helper_gvec_fcadds, gen_helper_gvec_fcaddd, }; -TRANS_FEAT(FCADD_90, aa64_fcma, do_fp3_vector, a, 0, f_vector_fcadd) -TRANS_FEAT(FCADD_270, aa64_fcma, do_fp3_vector, a, 1, f_vector_fcadd) +/* + * Encode FPCR.AH into the data so the helper knows whether the + * negations it does should avoid flipping the sign bit on a NaN + */ +TRANS_FEAT(FCADD_90, aa64_fcma, do_fp3_vector, a, 0 | (s->fpcr_ah << 1), + f_vector_fcadd) +TRANS_FEAT(FCADD_270, aa64_fcma, do_fp3_vector, a, 1 | (s->fpcr_ah << 1), + f_vector_fcadd) static bool trans_FCMLA_v(DisasContext *s, arg_FCMLA_v *a) { diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 3b87e5b8d6d..382b5da4a9c 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -881,6 +881,7 @@ void HELPER(gvec_fcaddh)(void *vd, void *vn, void *vm, float16 *m = vm; uint32_t neg_real = extract32(desc, SIMD_DATA_SHIFT, 1); uint32_t neg_imag = neg_real ^ 1; + bool fpcr_ah = extract64(desc, SIMD_DATA_SHIFT + 1, 1); uintptr_t i; /* Shift boolean to the sign bit so we can xor to negate. */ @@ -889,9 +890,17 @@ void HELPER(gvec_fcaddh)(void *vd, void *vn, void *vm, for (i = 0; i < opr_sz / 2; i += 2) { float16 e0 = n[H2(i)]; - float16 e1 = m[H2(i + 1)] ^ neg_imag; + float16 e1 = m[H2(i + 1)]; float16 e2 = n[H2(i + 1)]; - float16 e3 = m[H2(i)] ^ neg_real; + float16 e3 = m[H2(i)]; + + /* FPNeg() mustn't flip sign of a NaN if FPCR.AH == 1 */ + if (!(fpcr_ah && float16_is_any_nan(e1))) { + e1 ^= neg_imag; + } + if (!(fpcr_ah && float16_is_any_nan(e3))) { + e3 ^= neg_real; + } d[H2(i)] = float16_add(e0, e1, fpst); d[H2(i + 1)] = float16_add(e2, e3, fpst); @@ -908,6 +917,7 @@ void HELPER(gvec_fcadds)(void *vd, void *vn, void *vm, float32 *m = vm; uint32_t neg_real = extract32(desc, SIMD_DATA_SHIFT, 1); uint32_t neg_imag = neg_real ^ 1; + bool fpcr_ah = extract64(desc, SIMD_DATA_SHIFT + 1, 1); uintptr_t i; /* Shift boolean to the sign bit so we can xor to negate. */ @@ -916,9 +926,17 @@ void HELPER(gvec_fcadds)(void *vd, void *vn, void *vm, for (i = 0; i < opr_sz / 4; i += 2) { float32 e0 = n[H4(i)]; - float32 e1 = m[H4(i + 1)] ^ neg_imag; + float32 e1 = m[H4(i + 1)]; float32 e2 = n[H4(i + 1)]; - float32 e3 = m[H4(i)] ^ neg_real; + float32 e3 = m[H4(i)]; + + /* FPNeg() mustn't flip sign of a NaN if FPCR.AH == 1 */ + if (!(fpcr_ah && float32_is_any_nan(e1))) { + e1 ^= neg_imag; + } + if (!(fpcr_ah && float32_is_any_nan(e3))) { + e3 ^= neg_real; + } d[H4(i)] = float32_add(e0, e1, fpst); d[H4(i + 1)] = float32_add(e2, e3, fpst); @@ -935,6 +953,7 @@ void HELPER(gvec_fcaddd)(void *vd, void *vn, void *vm, float64 *m = vm; uint64_t neg_real = extract64(desc, SIMD_DATA_SHIFT, 1); uint64_t neg_imag = neg_real ^ 1; + bool fpcr_ah = extract64(desc, SIMD_DATA_SHIFT + 1, 1); uintptr_t i; /* Shift boolean to the sign bit so we can xor to negate. */ @@ -943,9 +962,17 @@ void HELPER(gvec_fcaddd)(void *vd, void *vn, void *vm, for (i = 0; i < opr_sz / 8; i += 2) { float64 e0 = n[i]; - float64 e1 = m[i + 1] ^ neg_imag; + float64 e1 = m[i + 1]; float64 e2 = n[i + 1]; - float64 e3 = m[i] ^ neg_real; + float64 e3 = m[i]; + + /* FPNeg() mustn't flip sign of a NaN if FPCR.AH == 1 */ + if (!(fpcr_ah && float64_is_any_nan(e1))) { + e1 ^= neg_imag; + } + if (!(fpcr_ah && float64_is_any_nan(e3))) { + e3 ^= neg_real; + } d[i] = float64_add(e0, e1, fpst); d[i + 1] = float64_add(e2, e3, fpst); From patchwork Fri Jan 24 16:28:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859624 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp890912wrq; Fri, 24 Jan 2025 08:53:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWX65c8nk5ee3VmVXynU2QUFHvqoVJePAmZ3Ns0RZl4wcMy+RAciiLWCM3PwR3UIFlAnocZAQ==@linaro.org X-Google-Smtp-Source: AGHT+IEcGZj8rOCd8WQWkhApOv06/dU5sNcG2cEFE823kPDdbtWc7Zy0Va3QyQxGMvbhSEmkWM9J X-Received: by 2002:a05:620a:4048:b0:7b6:704e:3529 with SMTP id af79cd13be357-7be6324fbb1mr5063039285a.46.1737737626130; Fri, 24 Jan 2025 08:53:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737626; cv=none; d=google.com; s=arc-20240605; b=T2gB+dZ9tJifmXpDkcPzq72h35FCO3Rfe70VKLleTZv3Ho+j0slNefA8W8aVUe+ppC H5mSQmomWYYyD0O0ezCIAROE9SSnWh3NC7GuukTM1DF9Pi80CKuWOTAaA5xX1RAMilxA EWgFZqTL8QkQw6BCSyVwqZjlfcG4qFOPu4kPpeCB6NivB0EfRxQP8oxi/fYk+L/mya55 Iu++EKBcAdVN84NnW9xZ3fldBOu/jnkcxta5qobkCSq80TpseeRiZKtWxXngK1fESEP9 MmPoQoH1srs9Czuz4NKg/8o6QNH8scwGnPu8Y6doIHOcqI+/90Eah3fPt5dkBHqgZQEv 0YkQ== 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=6dgTVvVr0GNtxqpPbcNERedzCSbz846MhmUGqEskeJE=; fh=E4s3kPdTfhZjuwNLPbYjbwoGIUmBaVHSGXhl7NpWjNs=; b=ALFuKTqddU4DoAzUoTjNWAlIg6nrtJHdcY+AJdUjmSKeqDq+zrVMMWwGATRF7sCycc hiBLHFD9QfuHH4cmqA0cppvfAyxFrG/KRQVj0dLO1qk+uuzreWIg3LYu+V3X7Y3ucpp9 fbskQNcj4unnYvSiL44tfhtgV8T7NwF3PSL69jGZvxVCk/X1I5A+spsyOivzqBKcqvlW SmPx3CJZx74kQOA6XtUa0SjGr6giRBwORfyvUQL5GRie/tx2zfMxOKuEzN/wu1psG0se mSLHe4QoApl6OMWSqSel1pUYISqOY3cmfGYiNqy98PH1vUT4Bx9+uLd1VQzkcCH6FYT4 LBeQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qGQCzzN6; 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-7be9af1157asi262739185a.499.2025.01.24.08.53.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:53:46 -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=qGQCzzN6; 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 1tbMfp-00050j-JW; Fri, 24 Jan 2025 11:36: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 1tbMZA-0005pV-Op for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:02 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZ8-0005m4-4s for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:56 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-436202dd730so16572715e9.2 for ; Fri, 24 Jan 2025 08:29:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736192; x=1738340992; 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=6dgTVvVr0GNtxqpPbcNERedzCSbz846MhmUGqEskeJE=; b=qGQCzzN6S8q9GVDFW/IUoO5RBfyz3yGFfmag+CFksup4UHYlCJV7hjdLZv0rFGbxzG C7m6Ggdp4uVwuiXE1HwKmnlSLlZRL5PuvLeUwKFA0C1pHumCheKj8yvoV4rqOspqsLUI h/ON2pwADJGzfGVUtW51PXqhNFiYGbLrdrzZ/D2a0J4Mgk5J4g/reteWWl5hN8Ue8c8q krXK06jl37ObdiPgClDRXJjoi1XPiAdBDxIB1+DYumNtNeVk+qnzyup6Fi08g/5Qnx23 lWgyEiYmGDn+vXT8VtnAlD2mzadKLI3fOfrmzkYlbxIi8ad1b6+9pf4vfU2dSYt9SNh4 2xOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736192; x=1738340992; 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=6dgTVvVr0GNtxqpPbcNERedzCSbz846MhmUGqEskeJE=; b=kH8EsN6j2cOWS3KnbOLUakbhoRhCEetYWqm3TaDapnJRJC5mojtiU6qot+0919Ab0L mXhTnosVurm82CCiIixp2BVGwLmlS++rymj1pIaBEnK48xAlSJGhxGTXf0dyTbrgNR8o GpsnXYcbl8vwr6bFyRlFZtpBND5mmp5r8Brav5O0WwPnzE+EZpkWS4NpPffcDCloBLOS uxGaL56nVBYp0YKPoMATgb77hLuuWOvy5jCE3aB2CWsaMJ9dKEiQ+nxFr3weFFa4mBwv cKAhwR5/oaQ1pj5/PObOslrxnqZ01m5CquamXwSVvKzweBDL+3D9ikTIKRREMjm4fYV/ iUFg== X-Forwarded-Encrypted: i=1; AJvYcCWVvpcdjsRpxZmCn/7yKNEPHUek1GDTEwRjmaDd616lmzNwGwkkSa+nMDOqnc8uAJ1PUNqZQyee0f4i@nongnu.org X-Gm-Message-State: AOJu0Ywow7lvywFxGdQgYhlgkhaFcZE0MDIkkw7Gg5ZTl/tmXpeOv1c5 H8a4mRxV5d7AY3aaOVIuyF/oYhjdg3EbsMRGC3PnQI4o8y/PWEEK4gY2JFvLLr4= X-Gm-Gg: ASbGncv98b3Y1cW9D1KVgFZ2gsu3D61oqfOfbAPj8azoQ1BlSzp+wQbkRiYo5cvFGE0 SvXAdrIzjaL/JMYE4LtKRWbEN/z3qA4XpLF9KR+gpQf5i+IDX8K+pTtYS0EhwkcOmqZEl4jlB6o X76A/7Q6dNolL4veAAUQs+RnJvy9cpvdXkNs+Qt2nThuZx0WB9uqfiNnHP8S47ilz5fykcrpkDz RafqqE21FbBX91Xlgb/PF5SJwJzKuIBvpW3xPsPoDQd1C61XhH2QC2OgHMqr/swQ8NHJip55hvt i+3M3q6tEvo= X-Received: by 2002:a05:600c:3c94:b0:435:192:63ca with SMTP id 5b1f17b1804b1-43891439f04mr240114165e9.21.1737736192085; Fri, 24 Jan 2025 08:29:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:51 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 59/76] target/arm: Handle FPCR.AH in negation steps in SVE FCADD Date: Fri, 24 Jan 2025 16:28:19 +0000 Message-Id: <20250124162836.2332150-60-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 negation steps in FCADD must honour FPCR.AH's "don't change the sign of a NaN" semantics. Implement this in the same way we did for the base ASIMD FCADD, by encoding FPCR.AH into the SIMD data field passed to the helper and using that to decide whether to negate the values. Signed-off-by: Peter Maydell --- target/arm/tcg/sve_helper.c | 45 +++++++++++++++++++++++++++------- target/arm/tcg/translate-sve.c | 2 +- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index 8527a7495a6..dc5a35b46ef 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -5131,7 +5131,9 @@ void HELPER(sve_fcadd_h)(void *vd, void *vn, void *vm, void *vg, { intptr_t j, i = simd_oprsz(desc); uint64_t *g = vg; - float16 neg_imag = float16_set_sign(0, simd_data(desc)); + bool rot = extract32(desc, SIMD_DATA_SHIFT, 1); + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT + 1, 1); + float16 neg_imag = float16_set_sign(0, rot); float16 neg_real = float16_chs(neg_imag); do { @@ -5144,9 +5146,16 @@ void HELPER(sve_fcadd_h)(void *vd, void *vn, void *vm, void *vg, i -= 2 * sizeof(float16); e0 = *(float16 *)(vn + H1_2(i)); - e1 = *(float16 *)(vm + H1_2(j)) ^ neg_real; + e1 = *(float16 *)(vm + H1_2(j)); e2 = *(float16 *)(vn + H1_2(j)); - e3 = *(float16 *)(vm + H1_2(i)) ^ neg_imag; + e3 = *(float16 *)(vm + H1_2(i)); + + if (neg_real && !(fpcr_ah && float16_is_any_nan(e1))) { + e1 ^= neg_real; + } + if (neg_imag && !(fpcr_ah && float16_is_any_nan(e3))) { + e3 ^= neg_imag; + } if (likely((pg >> (i & 63)) & 1)) { *(float16 *)(vd + H1_2(i)) = float16_add(e0, e1, s); @@ -5163,7 +5172,9 @@ void HELPER(sve_fcadd_s)(void *vd, void *vn, void *vm, void *vg, { intptr_t j, i = simd_oprsz(desc); uint64_t *g = vg; - float32 neg_imag = float32_set_sign(0, simd_data(desc)); + bool rot = extract32(desc, SIMD_DATA_SHIFT, 1); + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT + 1, 1); + float32 neg_imag = float32_set_sign(0, rot); float32 neg_real = float32_chs(neg_imag); do { @@ -5176,9 +5187,16 @@ void HELPER(sve_fcadd_s)(void *vd, void *vn, void *vm, void *vg, i -= 2 * sizeof(float32); e0 = *(float32 *)(vn + H1_2(i)); - e1 = *(float32 *)(vm + H1_2(j)) ^ neg_real; + e1 = *(float32 *)(vm + H1_2(j)); e2 = *(float32 *)(vn + H1_2(j)); - e3 = *(float32 *)(vm + H1_2(i)) ^ neg_imag; + e3 = *(float32 *)(vm + H1_2(i)); + + if (neg_real && !(fpcr_ah && float32_is_any_nan(e1))) { + e1 ^= neg_real; + } + if (neg_imag && !(fpcr_ah && float32_is_any_nan(e3))) { + e3 ^= neg_imag; + } if (likely((pg >> (i & 63)) & 1)) { *(float32 *)(vd + H1_2(i)) = float32_add(e0, e1, s); @@ -5195,7 +5213,9 @@ void HELPER(sve_fcadd_d)(void *vd, void *vn, void *vm, void *vg, { intptr_t j, i = simd_oprsz(desc); uint64_t *g = vg; - float64 neg_imag = float64_set_sign(0, simd_data(desc)); + bool rot = extract32(desc, SIMD_DATA_SHIFT, 1); + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT + 1, 1); + float64 neg_imag = float64_set_sign(0, rot); float64 neg_real = float64_chs(neg_imag); do { @@ -5208,9 +5228,16 @@ void HELPER(sve_fcadd_d)(void *vd, void *vn, void *vm, void *vg, i -= 2 * sizeof(float64); e0 = *(float64 *)(vn + H1_2(i)); - e1 = *(float64 *)(vm + H1_2(j)) ^ neg_real; + e1 = *(float64 *)(vm + H1_2(j)); e2 = *(float64 *)(vn + H1_2(j)); - e3 = *(float64 *)(vm + H1_2(i)) ^ neg_imag; + e3 = *(float64 *)(vm + H1_2(i)); + + if (neg_real && !(fpcr_ah && float64_is_any_nan(e1))) { + e1 ^= neg_real; + } + if (neg_imag && !(fpcr_ah && float64_is_any_nan(e3))) { + e3 ^= neg_imag; + } if (likely((pg >> (i & 63)) & 1)) { *(float64 *)(vd + H1_2(i)) = float64_add(e0, e1, s); diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 9200f7f8a49..0696192148c 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3916,7 +3916,7 @@ static gen_helper_gvec_4_ptr * const fcadd_fns[] = { gen_helper_sve_fcadd_s, gen_helper_sve_fcadd_d, }; TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz], - a->rd, a->rn, a->rm, a->pg, a->rot, + a->rd, a->rn, a->rm, a->pg, a->rot | (s->fpcr_ah << 1), a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) #define DO_FMLA(NAME, name) \ From patchwork Fri Jan 24 16:28:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859619 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp889316wrq; Fri, 24 Jan 2025 08:49:58 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUpBxLINchiX5nAFBAwMwtVD82mKhNSbouvf7CMIoedoEFsra0arhGY5GPp/qtfWnncmCtsZA==@linaro.org X-Google-Smtp-Source: AGHT+IHQvOm0YgIVbso1IVuMCpT5OZe2vHpXW2QJ8Dk6uO7zDlwedcpDcCmz1MQR1LT32VmKD7XS X-Received: by 2002:a05:6122:2105:b0:51b:8949:c9a8 with SMTP id 71dfb90a1353d-51d5b33f5d8mr28131557e0c.9.1737737398380; Fri, 24 Jan 2025 08:49:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737398; cv=none; d=google.com; s=arc-20240605; b=OlYLva73JvCmxPAqT96INXpZKLpzQYtrQJtAaCNwkyOzpWWDTGQc8YE/4dT/Jnf6nK vS9Q0pWIk6IP37laqggvr+O4PwIA+j2EG5Nh4sBdbWGi8QNLpsuoLOBZwFVftK8KHOhy eG1N7MGCVqivmyH6OIMGHIzqlHIASb0a5XxwkkgF5IR6qO8XwyY+B1TX4Ph64zR4JyCU U9XXk0TvoJ8I2YbJmo+64XLg4pU7SmmXfo/MXTABhb1a9FWcIZMwwMMUxAkWiYY/3ZdT yZLCaGwR+RQDrTvm2+wTMkHcG4EHWFqRg0sZlDIFCyDE+qCk7fwO6Chok53b0cV6AgJi jzqg== 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=QLc5R4kgwLEQYIqVscOHBm/T/V1hZNad06mmFiQYTk0=; fh=cbau2VKoQEnAxvJIQ92iT0JP3UEqfcuor0zYcddZ5e4=; b=ApHmyzIE5jsnURnTXgL36TAragBgeAE5RykM0+r9mz4V9uNtEztU4UjnHGJGKqCEEk LZjyAY3XzYKzERbDTz848sWrNSIz+bVLTGbGJ+Yk0kYKgrQtV9wtB3VCSFzf66L/zIfo 98aBaXDedvkMoCzJkhQ+Y5RDafL4OHNc7ALEKwQOZvVEnZkjtCnfYzgzcKsKa2Lk3SaJ JfP2pm9KN4+C77+9zJ3/uKQETZyptX25S4ya+3PJvHIzPTRs5DHAqWecOMXdJkZv6JyJ KKn03IVsp38hhInCybSEndMCzSViTFaF3zYNlvGayHHyLAMKlJV2TcdYpmXTyGnLYhMr 2pLA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LonrvDe8; 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 a1e0cc1a2514c-864a9cd8430si700941241.101.2025.01.24.08.49.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:49:58 -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=LonrvDe8; 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 1tbMcv-00079T-CF; Fri, 24 Jan 2025 11:33: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 1tbMZD-0005rN-5h for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:06 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZ9-0005mT-5Q for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:29:56 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-436ce2ab251so15094285e9.1 for ; Fri, 24 Jan 2025 08:29:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736193; x=1738340993; 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=QLc5R4kgwLEQYIqVscOHBm/T/V1hZNad06mmFiQYTk0=; b=LonrvDe8ofyt9K4xiT0MSIuIylOd+bgOp4YTOOm0VEc9kok20yD5G/jNUMbRXa7aIf JlRb6UaFC2vcGU+B77wHRPjU6R2fhw58sb0dQ42D+9f/bvf/mtq+AWlejMg5SygtpFHJ q//D0u6t1X7PQIneit9CR+qlQLgfDbneffFRIp0O+hvX4knqwqjZEATrlgzJL8K0ejev JQ0yWOAwp2IqPSfbkpmk1gz2U8/EJIyDXnvWJXvzIqRyaKK16+MlwZ6XGzqIVr7I0fQO LtxvCKZvu8f7ggk10+3SgTmjt0WFyIzA7q0yFXP9mMeLOUVkKeldhjU+Oz7VG0TvSX1M Msww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736193; x=1738340993; 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=QLc5R4kgwLEQYIqVscOHBm/T/V1hZNad06mmFiQYTk0=; b=Lkr/wpj2V/ryAPKHlIHigg+Ryv47fqdK1ZcxoTl7V9SrgCZrvC+CW7P5zDsn6g3ZXw jOiQ7VdduPrK88ECBteDTHtR4XDvj3j0+LZ/lEtIKAWehIJamk6KBn2lHbE+pTphTmM9 GM/dGe+FKcwAiJMMx3j1RZiVp5ph7irgLG4PUTngRcBHS7Nir6WQnPLSWoS8ANwGZCRu 0/pf2v0tRejVeMqpA0OS/piTptwWU6CoILLIMROFoVDQJYHNZO2vyDAfuo/eZfYgwsSw TMmkjqh3YKWGbv79O6XoJLGi5Dkx32T2KEHUTR3BnbGe6CTzzXmeAY7KzJyM/RDzuLAU Shmw== X-Forwarded-Encrypted: i=1; AJvYcCVfhPi4WfCNHtwuZboQw58FQc6n7BXO5TZpmwolhMXH0lbb9sbORLSK6V97qAHhvBy3tkti2B3uzNo+@nongnu.org X-Gm-Message-State: AOJu0YyN4RymVN7SbJ/Ym+4Uu2UimWO7jetf7m3v9yDqyMPNP6RM7es6 fS2DudFkwias0CMtylhrUN8J4asNRWp7F6K/pXui8oQV8y6uJk5N5pysIiGQUMc= X-Gm-Gg: ASbGncvOZRmBgDFD5UwNG9/Ztlqe3jWmRC678g7fzeDewHAy68I+f26gNGDCm3JtBhN UYJTaJI78oNUBTG182UF0va4KjZh44VAoQ/Rc+9cSyUUvXp0UdkCn8/qD4co+HWMN9oyq+NKJr2 rXVE5VSZ3yfmOWSAAmjtzQveTX9qWUjcalzmKxo5WGJls9onSPK/+Jui1KpIWTkV+hCQy/hvlkQ DbJnTlo2G3+CKHaOWUXuUJXSOs7/cfmXe0UXCVJyRaTkEXcJc3IQCvCWzbpVMY4RxEA6DxB7rqK Mo4KitPj6/k= X-Received: by 2002:a05:600c:511b:b0:432:d797:404a with SMTP id 5b1f17b1804b1-4389142e0e8mr268300935e9.22.1737736193127; Fri, 24 Jan 2025 08:29:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:52 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 60/76] target/arm: Handle FPCR.AH in FMLSL Date: Fri, 24 Jan 2025 16:28:20 +0000 Message-Id: <20250124162836.2332150-61-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Honour the FPCR.AH "don't negate the sign of a NaN" semantics in FMLSL. We pass in the value of FPCR.AH in the SIMD data field, and use this to determine whether we should suppress the negation for NaN inputs. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 4 ++-- target/arm/tcg/vec_helper.c | 28 ++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 0827dff16b2..e22c2a148ab 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5968,7 +5968,7 @@ TRANS(FMINNMP_v, do_fp3_vector, a, 0, f_vector_fminnmp) static bool do_fmlal(DisasContext *s, arg_qrrr_e *a, bool is_s, bool is_2) { if (fp_access_check(s)) { - int data = (is_2 << 1) | is_s; + int data = (s->fpcr_ah << 2) | (is_2 << 1) | is_s; tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), tcg_env, @@ -6738,7 +6738,7 @@ TRANS(FMLS_vi, do_fmla_vector_idx, a, true) static bool do_fmlal_idx(DisasContext *s, arg_qrrx_e *a, bool is_s, bool is_2) { if (fp_access_check(s)) { - int data = (a->idx << 2) | (is_2 << 1) | is_s; + int data = (s->fpcr_ah << 5) | (a->idx << 2) | (is_2 << 1) | is_s; tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), vec_full_reg_offset(s, a->rm), tcg_env, diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 382b5da4a9c..aa42c50f9fe 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2083,6 +2083,26 @@ static uint64_t load4_f16(uint64_t *ptr, int is_q, int is_2) return ptr[is_q & is_2] >> ((is_2 & ~is_q) << 5); } +static uint64_t neg4_f16(uint64_t v, bool fpcr_ah) +{ + /* + * Negate all inputs for FMLSL at once. This is slightly complicated + * by the need to avoid flipping the sign of a NaN when FPCR.AH == 1 + */ + uint64_t mask = 0x8000800080008000ull; + if (fpcr_ah) { + uint64_t tmp = v, signbit = 0x8000; + for (int i = 0; i < 4; i++) { + if (float16_is_any_nan(extract64(tmp, 0, 16))) { + mask ^= signbit; + } + tmp >>= 16; + signbit <<= 16; + } + } + return v ^ mask; +} + /* * Note that FMLAL requires oprsz == 8 or oprsz == 16, * as there is not yet SVE versions that might use blocking. @@ -2094,6 +2114,7 @@ static void do_fmlal(float32 *d, void *vn, void *vm, float_status *fpst, intptr_t i, oprsz = simd_oprsz(desc); int is_s = extract32(desc, SIMD_DATA_SHIFT, 1); int is_2 = extract32(desc, SIMD_DATA_SHIFT + 1, 1); + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT + 2, 1); int is_q = oprsz == 16; uint64_t n_4, m_4; @@ -2101,9 +2122,8 @@ static void do_fmlal(float32 *d, void *vn, void *vm, float_status *fpst, n_4 = load4_f16(vn, is_q, is_2); m_4 = load4_f16(vm, is_q, is_2); - /* Negate all inputs for FMLSL at once. */ if (is_s) { - n_4 ^= 0x8000800080008000ull; + n_4 = neg4_f16(n_4, fpcr_ah); } for (i = 0; i < oprsz / 4; i++) { @@ -2155,6 +2175,7 @@ static void do_fmlal_idx(float32 *d, void *vn, void *vm, float_status *fpst, int is_s = extract32(desc, SIMD_DATA_SHIFT, 1); int is_2 = extract32(desc, SIMD_DATA_SHIFT + 1, 1); int index = extract32(desc, SIMD_DATA_SHIFT + 2, 3); + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT + 5, 1); int is_q = oprsz == 16; uint64_t n_4; float32 m_1; @@ -2162,9 +2183,8 @@ static void do_fmlal_idx(float32 *d, void *vn, void *vm, float_status *fpst, /* Pre-load all of the f16 data, avoiding overlap issues. */ n_4 = load4_f16(vn, is_q, is_2); - /* Negate all inputs for FMLSL at once. */ if (is_s) { - n_4 ^= 0x8000800080008000ull; + n_4 = neg4_f16(n_4, fpcr_ah); } m_1 = float16_to_float32_by_bits(((float16 *)vm)[H2(index)], fz16); From patchwork Fri Jan 24 16:28:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859594 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp885935wrq; Fri, 24 Jan 2025 08:41:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWsIl0PzanlRLx86EZ/z8Irpyv+U+CfZdyTBS9RBZsSNgXkgpqkN0cfVhlJSQals/fJkq6exQ==@linaro.org X-Google-Smtp-Source: AGHT+IHTQKFG6+lTdrYI59jEWIWywtKdjr8VRQZh6RlNXi/sM78lQ19lp4sEMA8keKu3yD9+SSEx X-Received: by 2002:ac8:590c:0:b0:467:56a2:b05c with SMTP id d75a77b69052e-46e12a0c147mr373394101cf.10.1737736915741; Fri, 24 Jan 2025 08:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736915; cv=none; d=google.com; s=arc-20240605; b=YwSQzMoC3AdmYOxCGA37utvx563rkVNLa5cXZJFRnZpKJd7LtVRfL+QB+7QLmf/wbb Z4XeRlKwAb4LA5Vr8moHv8Bn1QQy9M5uUNqcg0ZhEiYwwbdPRXt+cHlHjH41Bctti/oz KN6ef9hoDUHHmi0ANYMmxAq6eAK3rMFA6AOG46e76Y5BnlZXUmMwF8iNUrwR+XqEQjL2 XWGgSqN2q+jKxlp3miwRkgMD0s7pABDl6Q10i/z+pZKMr8yXB9me7pjWqtURgi4yXOUy QlEDy9X6/P3q4u3K2rFG6fJu5H0q+LzGxM1hvru0OwTbEGr+ibvH7tzTPDddnb6w1svH +sFg== 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=5fO4yVTzlDdDstDxzaIvCaMWSZoc0FFpHe7FAcMg52A=; fh=W0b1NpU6Y6eAX1U4HqSus2P3rfkSNCNQYapJHL/D4xE=; b=U25dVlz4YNiuKSESkCaYVGsFSky7qX7d6NMO3bUwUAGdknAlmDEsTN06K2NE5GDbrK BMEVj8yBWH5uiwujuEPO0fk8XUlydtoZq+cLRXTswx3QnEahbU96oVbDrTMxPLPNIMe5 B2A5oi8+VQ4Wgl5PlHmaykQn4aQ2OdtRq0IhY8WUhc8WdiJHkjdjocm6LZ0tBSxK5kA1 r7Dh8LxjQqe2HB3QaJ7wu6hlRWqu+DVrWvgolQVt1c9ySbKWgFXJZTm/r6bAsPAvduAI mb7fAUug2Q6WMNdc/K8Txw5owHAjhGoa//8snbqk0k8Hje5i4F7OO/fbOdH4uCUr0gzy cUnA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oEveJLec; 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-46e6686d82esi29958101cf.29.2025.01.24.08.41.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:41: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=oEveJLec; 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 1tbMe0-0001TW-Kz; Fri, 24 Jan 2025 11:34:56 -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 1tbMZE-0005sJ-SJ for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:16 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZB-0005nE-8z for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:00 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4362f61757fso23850535e9.2 for ; Fri, 24 Jan 2025 08:29:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736195; x=1738340995; 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=5fO4yVTzlDdDstDxzaIvCaMWSZoc0FFpHe7FAcMg52A=; b=oEveJLecqsRmkLLdHfBS3JjNMYfkxL19rdvZI47ZbIHz/2cXGqEiUZ0vIGp0e8ToJB qu5Z+X2rCf+Wr6+LTLbHKHMv6R5BmFqklqNFVOQEWDoX/RM9JfH8yOl1HVt6ajqexNgK PwoIqQSTuJuy9Ex42oQJx5lY/ZDed0VGsgjFol+svxknDeYiPpHLagRnQPF3z3KVtkQd Eba7FOFEftH3Yzxrz1a8HaTV4ztyUOfqUd18tWKTLdW0LheJZDrhrkdgU+xpQ8Kn/Xs0 2Caieio8mxpTw0WaRY9W5fBu53eTXXXK4HBXmnId6FJTCKTcK4R/KJBjSRTrZRLvlJ+3 tUig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736195; x=1738340995; 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=5fO4yVTzlDdDstDxzaIvCaMWSZoc0FFpHe7FAcMg52A=; b=S1jnb7C9KrnMF0cxiA60FMHMR0tQk3hxi9McuToeNpb2q2O8pOo53nuBxCnsn2/gup 85osf5BABiN30FHIC5uWnmHR1dhr6m9Fq3L+qDBkfuzKxKyjMqOYabv9QAkQGc3GHpRc VbXQwN+jiqPiTnXUx4imHW6PN/uW/7K6pe4mNUJlyq4vFnFbyvPusl5fGlAPnE8FvInk dQxCNGXvKGwohVIgtGN9RTOq97ROsDOtO3b267ix0Lb2l6CG9zYMukEgl4alkoUBKVyd Z61zLyXTt/O6bUbQjphSud9JHWKjEns7HY5KfB8oGUFTDP0db74cX01IJqNWSOeMvrGY FHGg== X-Forwarded-Encrypted: i=1; AJvYcCXJKYksnucj8hPcQ8qBJs5m9JDSkYmqMEzBT9X3cwGabrGF7AcxNx1iidUxECsSwuDuuBKqS8bKOHae@nongnu.org X-Gm-Message-State: AOJu0Yz56zcTIGV0uQ+uwPEgaw49YjzM3ApSsgwidYMA6tNsnx2Akwqc DQ1IOnB4nS0D980lvLE/jZOy1Xtb9zZr1In4xHNVSaohq9MMAYLwPJ1rbn0xALM= X-Gm-Gg: ASbGnctne9sKjF2NGwb6/ziLorWt1TFI79GBDakEDV6uvJO6knei2WdXjemsC3nY77F jZM+P5rR/or6HF4yzsdZyHU0GscXaCfGx7Rrl/Ivr4g2G2C4EEqG7qmP/PJ6pp8Am5Aoxo5lCGP aI/UW5tPnnB9Scnq+FqcUe5JhUjbGOgiCklwd9C4JheoQGOtVRaDeCUhQwjwmeKzfRvfytuqenQ AVnOWlGSynLqa64w1DkUO1UkbyALJ2XQYM183RJhSRAjwVw71wsIaYhANBQ0mSoyownguqW23EE 4OM+fXmWqo4= X-Received: by 2002:a05:600c:3d06:b0:435:1b:65ee with SMTP id 5b1f17b1804b1-43891419e16mr246860185e9.24.1737736195184; Fri, 24 Jan 2025 08:29:55 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:53 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 61/76] target/arm: Handle FPCR.AH in FRECPS and FRSQRTS scalar insns Date: Fri, 24 Jan 2025 16:28:21 +0000 Message-Id: <20250124162836.2332150-62-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Handle the FPCR.AH semantics that we do not change the sign of an input NaN in the FRECPS and FRSQRTS scalar insns, by providing new helper functions that do the CHS part of the operation differently. Since the extra helper functions would be very repetitive if written out longhand, we condense them and the existing non-AH helpers into being emitted via macros. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-a64.h | 6 ++ target/arm/tcg/helper-a64.c | 128 ++++++++++++++------------------- target/arm/tcg/translate-a64.c | 25 +++++-- 3 files changed, 78 insertions(+), 81 deletions(-) diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h index ae0424f6de9..85023465b76 100644 --- a/target/arm/tcg/helper-a64.h +++ b/target/arm/tcg/helper-a64.h @@ -38,9 +38,15 @@ DEF_HELPER_FLAGS_3(neon_cgt_f64, TCG_CALL_NO_RWG, i64, i64, i64, fpst) DEF_HELPER_FLAGS_3(recpsf_f16, TCG_CALL_NO_RWG, f16, f16, f16, fpst) DEF_HELPER_FLAGS_3(recpsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, fpst) DEF_HELPER_FLAGS_3(recpsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, fpst) +DEF_HELPER_FLAGS_3(recpsf_ah_f16, TCG_CALL_NO_RWG, f16, f16, f16, fpst) +DEF_HELPER_FLAGS_3(recpsf_ah_f32, TCG_CALL_NO_RWG, f32, f32, f32, fpst) +DEF_HELPER_FLAGS_3(recpsf_ah_f64, TCG_CALL_NO_RWG, f64, f64, f64, fpst) DEF_HELPER_FLAGS_3(rsqrtsf_f16, TCG_CALL_NO_RWG, f16, f16, f16, fpst) DEF_HELPER_FLAGS_3(rsqrtsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, fpst) DEF_HELPER_FLAGS_3(rsqrtsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, fpst) +DEF_HELPER_FLAGS_3(rsqrtsf_ah_f16, TCG_CALL_NO_RWG, f16, f16, f16, fpst) +DEF_HELPER_FLAGS_3(rsqrtsf_ah_f32, TCG_CALL_NO_RWG, f32, f32, f32, fpst) +DEF_HELPER_FLAGS_3(rsqrtsf_ah_f64, TCG_CALL_NO_RWG, f64, f64, f64, fpst) DEF_HELPER_FLAGS_2(frecpx_f64, TCG_CALL_NO_RWG, f64, f64, fpst) DEF_HELPER_FLAGS_2(frecpx_f32, TCG_CALL_NO_RWG, f32, f32, fpst) DEF_HELPER_FLAGS_2(frecpx_f16, TCG_CALL_NO_RWG, f16, f16, fpst) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 406d76e1129..ba21efd0bb0 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -208,88 +208,66 @@ uint64_t HELPER(neon_cgt_f64)(float64 a, float64 b, float_status *fpst) return -float64_lt(b, a, fpst); } -/* Reciprocal step and sqrt step. Note that unlike the A32/T32 +static float16 float16_ah_chs(float16 a) +{ + return float16_is_any_nan(a) ? a : float16_chs(a); +} + +static float32 float32_ah_chs(float32 a) +{ + return float32_is_any_nan(a) ? a : float32_chs(a); +} + +static float64 float64_ah_chs(float64 a) +{ + return float64_is_any_nan(a) ? a : float64_chs(a); +} +/* + * Reciprocal step and sqrt step. Note that unlike the A32/T32 * versions, these do a fully fused multiply-add or * multiply-add-and-halve. + * The FPCR.AH == 1 versions need to avoid flipping the sign of NaN. */ - -uint32_t HELPER(recpsf_f16)(uint32_t a, uint32_t b, float_status *fpst) -{ - a = float16_squash_input_denormal(a, fpst); - b = float16_squash_input_denormal(b, fpst); - - a = float16_chs(a); - if ((float16_is_infinity(a) && float16_is_zero(b)) || - (float16_is_infinity(b) && float16_is_zero(a))) { - return float16_two; +#define DO_RECPS(NAME, CTYPE, FLOATTYPE, CHSFN) \ + CTYPE HELPER(NAME)(CTYPE a, CTYPE b, float_status *fpst) \ + { \ + a = FLOATTYPE ## _squash_input_denormal(a, fpst); \ + b = FLOATTYPE ## _squash_input_denormal(b, fpst); \ + a = FLOATTYPE ## _ ## CHSFN(a); \ + if ((FLOATTYPE ## _is_infinity(a) && FLOATTYPE ## _is_zero(b)) || \ + (FLOATTYPE ## _is_infinity(b) && FLOATTYPE ## _is_zero(a))) { \ + return FLOATTYPE ## _two; \ + } \ + return FLOATTYPE ## _muladd(a, b, FLOATTYPE ## _two, 0, fpst); \ } - return float16_muladd(a, b, float16_two, 0, fpst); -} -float32 HELPER(recpsf_f32)(float32 a, float32 b, float_status *fpst) -{ - a = float32_squash_input_denormal(a, fpst); - b = float32_squash_input_denormal(b, fpst); +DO_RECPS(recpsf_f16, uint32_t, float16, chs) +DO_RECPS(recpsf_f32, float32, float32, chs) +DO_RECPS(recpsf_f64, float64, float64, chs) +DO_RECPS(recpsf_ah_f16, uint32_t, float16, ah_chs) +DO_RECPS(recpsf_ah_f32, float32, float32, ah_chs) +DO_RECPS(recpsf_ah_f64, float64, float64, ah_chs) - a = float32_chs(a); - if ((float32_is_infinity(a) && float32_is_zero(b)) || - (float32_is_infinity(b) && float32_is_zero(a))) { - return float32_two; - } - return float32_muladd(a, b, float32_two, 0, fpst); -} +#define DO_RSQRTSF(NAME, CTYPE, FLOATTYPE, CHSFN) \ + CTYPE HELPER(NAME)(CTYPE a, CTYPE b, float_status *fpst) \ + { \ + a = FLOATTYPE ## _squash_input_denormal(a, fpst); \ + b = FLOATTYPE ## _squash_input_denormal(b, fpst); \ + a = FLOATTYPE ## _ ## CHSFN(a); \ + if ((FLOATTYPE ## _is_infinity(a) && FLOATTYPE ## _is_zero(b)) || \ + (FLOATTYPE ## _is_infinity(b) && FLOATTYPE ## _is_zero(a))) { \ + return FLOATTYPE ## _one_point_five; \ + } \ + return FLOATTYPE ## _muladd_scalbn(a, b, FLOATTYPE ## _three, \ + -1, 0, fpst); \ + } \ -float64 HELPER(recpsf_f64)(float64 a, float64 b, float_status *fpst) -{ - a = float64_squash_input_denormal(a, fpst); - b = float64_squash_input_denormal(b, fpst); - - a = float64_chs(a); - if ((float64_is_infinity(a) && float64_is_zero(b)) || - (float64_is_infinity(b) && float64_is_zero(a))) { - return float64_two; - } - return float64_muladd(a, b, float64_two, 0, fpst); -} - -uint32_t HELPER(rsqrtsf_f16)(uint32_t a, uint32_t b, float_status *fpst) -{ - a = float16_squash_input_denormal(a, fpst); - b = float16_squash_input_denormal(b, fpst); - - a = float16_chs(a); - if ((float16_is_infinity(a) && float16_is_zero(b)) || - (float16_is_infinity(b) && float16_is_zero(a))) { - return float16_one_point_five; - } - return float16_muladd_scalbn(a, b, float16_three, -1, 0, fpst); -} - -float32 HELPER(rsqrtsf_f32)(float32 a, float32 b, float_status *fpst) -{ - a = float32_squash_input_denormal(a, fpst); - b = float32_squash_input_denormal(b, fpst); - - a = float32_chs(a); - if ((float32_is_infinity(a) && float32_is_zero(b)) || - (float32_is_infinity(b) && float32_is_zero(a))) { - return float32_one_point_five; - } - return float32_muladd_scalbn(a, b, float32_three, -1, 0, fpst); -} - -float64 HELPER(rsqrtsf_f64)(float64 a, float64 b, float_status *fpst) -{ - a = float64_squash_input_denormal(a, fpst); - b = float64_squash_input_denormal(b, fpst); - - a = float64_chs(a); - if ((float64_is_infinity(a) && float64_is_zero(b)) || - (float64_is_infinity(b) && float64_is_zero(a))) { - return float64_one_point_five; - } - return float64_muladd_scalbn(a, b, float64_three, -1, 0, fpst); -} +DO_RSQRTSF(rsqrtsf_f16, uint32_t, float16, chs) +DO_RSQRTSF(rsqrtsf_f32, float32, float32, chs) +DO_RSQRTSF(rsqrtsf_f64, float64, float64, chs) +DO_RSQRTSF(rsqrtsf_ah_f16, uint32_t, float16, ah_chs) +DO_RSQRTSF(rsqrtsf_ah_f32, float32, float32, ah_chs) +DO_RSQRTSF(rsqrtsf_ah_f64, float64, float64, ah_chs) /* Floating-point reciprocal exponent - see FPRecpX in ARM ARM */ uint32_t HELPER(frecpx_f16)(uint32_t a, float_status *fpst) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index e22c2a148ab..977a1589e53 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5250,11 +5250,12 @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f, FPST_FPCR_F16_A64 : FPST_FPCR_A64); } -static bool do_fp3_scalar_ah(DisasContext *s, arg_rrr_e *a, const FPScalar *f, - int mergereg) +static bool do_fp3_scalar_ah_2fn(DisasContext *s, arg_rrr_e *a, + const FPScalar *fnormal, const FPScalar *fah, + int mergereg) { - return do_fp3_scalar_with_fpsttype(s, a, f, mergereg, - select_fpst(s, a->esz)); + return do_fp3_scalar_with_fpsttype(s, a, s->fpcr_ah ? fah : fnormal, + mergereg, select_fpst(s, a->esz)); } /* Some insns need to call different helpers when FPCR.AH == 1 */ @@ -5475,14 +5476,26 @@ static const FPScalar f_scalar_frecps = { gen_helper_recpsf_f32, gen_helper_recpsf_f64, }; -TRANS(FRECPS_s, do_fp3_scalar_ah, a, &f_scalar_frecps, a->rn) +static const FPScalar f_scalar_ah_frecps = { + gen_helper_recpsf_ah_f16, + gen_helper_recpsf_ah_f32, + gen_helper_recpsf_ah_f64, +}; +TRANS(FRECPS_s, do_fp3_scalar_ah_2fn, a, + &f_scalar_frecps, &f_scalar_ah_frecps, a->rn) static const FPScalar f_scalar_frsqrts = { gen_helper_rsqrtsf_f16, gen_helper_rsqrtsf_f32, gen_helper_rsqrtsf_f64, }; -TRANS(FRSQRTS_s, do_fp3_scalar_ah, a, &f_scalar_frsqrts, a->rn) +static const FPScalar f_scalar_ah_frsqrts = { + gen_helper_rsqrtsf_ah_f16, + gen_helper_rsqrtsf_ah_f32, + gen_helper_rsqrtsf_ah_f64, +}; +TRANS(FRSQRTS_s, do_fp3_scalar_ah_2fn, a, + &f_scalar_frsqrts, &f_scalar_ah_frsqrts, a->rn) static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a, const FPScalar *f, bool swap) From patchwork Fri Jan 24 16:28:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859596 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp885955wrq; Fri, 24 Jan 2025 08:41:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXEXyGSzf1l9KoNmsM0AkcSpOgyczxthMC9esIkAmlL7B18EJmCGnPfMQmGHjkEZPgaW+jkMg==@linaro.org X-Google-Smtp-Source: AGHT+IEurlZ9YKTtuinPBk+SgHbEgSAcsmAg6b9yHB+VikR9yPh3+zl0qBg1Fq0KL3eCwyEShl1F X-Received: by 2002:a05:6214:4988:b0:6dd:5f90:16bd with SMTP id 6a1803df08f44-6e1b22349dbmr461952326d6.41.1737736917642; Fri, 24 Jan 2025 08:41:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736917; cv=none; d=google.com; s=arc-20240605; b=gNM75b3bvjV5nmbtsvRM6eZZs8gmepuzy1CXcJFkb2wsFe1kLMqv585vDHCSW2+rW1 eLqCKqlOixko4v0ZBrMhOMcifnqQ5xqvqOJiF+nLO1LImgs3X9hjoVpAxxnhQsOFWBvC n6TTDMDS7vzFUKGO9AktFRQM+DD06fPIuK8alSJlTqctYglz/kKyGZrHOn1j+9ss1kfH yKHPZau5XGdeHUM/p//UV6sTl7rEgeDEwXeTymkh4ZpD3wG7+axoKu8G8QtNOteKLG8R XvmITWYVOG6lJ3Sl8m1DCT3kOh4yxHrMQaYMTCIeIL+XxgnfpcVBarnvOVAqj5lOsM8F URLA== 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=90zJmscshgzp9ZgdoGcA5ll/KJlD0eY0cc5R60hdHPs=; fh=hA49ko0fXRQ2obDwvrHyYtbLgIVElL5HXKbGUIBCzn4=; b=Cz6x5pIPGt+KSEGQC/eZGSujqb08GZkL4d1Cjn+XUfqX8+aH+TPym/9UYYum86autt Za7rS4hKotP3bsjoou1f6FhsN5LrNw7jIMSmve9P/jexLywcgZBfFEJ3qrSiRiKdsJBf u+z8thdflu94Y+xmw0R/0ZS6IAlUSnwjKPq4FHr8zAfygOyjsVQWAUsZ5HxDSA5QJT94 W3iASmt+/ntzRPt11IFQYo/q+itgjz+NVsZAtjQxkY5CA0GOd4uNWZmqwkGPsLjoi0iY 2X7oiIkicHuPjMlP+1t1APHMQYpQlASxFwRtxTZfbygEMVkKtYupwSJM93aALriGgXGU sdcQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RuWYvr1S; 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-46e66b65ae3si29972141cf.287.2025.01.24.08.41.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:41:57 -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=RuWYvr1S; 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 1tbMfu-0005bA-59; Fri, 24 Jan 2025 11:36:54 -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 1tbMZM-0005vg-8e for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:16 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZC-0005nn-VE for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:00 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3862d161947so1271291f8f.3 for ; Fri, 24 Jan 2025 08:29:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736196; x=1738340996; 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=90zJmscshgzp9ZgdoGcA5ll/KJlD0eY0cc5R60hdHPs=; b=RuWYvr1S3NUOPhXC8O10QG/OeR9E3Orxn84gacT8jyeexzIId6ks5Sua7nXwV5Y4vh 2sn3N4NRSMSWkYQQuqQStnGZ0FRDXmIsTk1VWBN2W5my7nzWrxdPuLpfgBacQPXBVctY yzcqeUT8WrYaLJ+26VCitMHmxB6rsYT8TuII66pWxG0IIAaSSdQDMpC1an9Ys19hK3dQ 8jehjPGM6WyKltCnaULzcEZ5Lbva0oXryk+HS8iaaG6BTF+/+g9OLqKFSuqR38EZmw/b fO5PnkRzSLf+DK40Kf64dE2ZtWXwLJKU47C0NZszFSMQBAe4G5F8zO0XExIQPo4w0Oac tXMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736196; x=1738340996; 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=90zJmscshgzp9ZgdoGcA5ll/KJlD0eY0cc5R60hdHPs=; b=NM4TY5tMxmmNgrgjM6Kq3fMMrAgVfmBMTEAtPo8Cbfafese+u83EPf+vReZH5IHK1n +f4nyGiFgx1RNlv+lx/gZnYZMlspQmJBeJh+tzDTQixTH+AJ54+O0TKBgUklpDBpIZJ+ o8OO00jj5yfJu6+wuSG9FKHajvUPWjsrQWwrt133yYTcZjQrwZ8uw+VQClckpCmBGnhJ uPOlx4M8JjHDr5nZsj+A2A8LQXxYN8tijVvNpiusmvAq8sIQPdNPcHSjIZFxRopqbHmp hcoaiKi4yGuE/biQJ07HAgIxfJrxMzffrw6WD4c+lotM0fQ8ZjcPHoecNwmCp6IPKR5L vtEg== X-Forwarded-Encrypted: i=1; AJvYcCVL3kWcxMtj7sa7Dz7tnY0p73FU82JCOPkGK5iP1frz0HXkWBANohEcxq4vVwjXkdcjipJyD8KeK8L+@nongnu.org X-Gm-Message-State: AOJu0Yzmm0c2vaUDCM6SMi17mr0YHliogzPGu7KqpgSczjsuev66mhj/ slbrHTsf57veC1awAZ8k3h3HoAmerMCFg5Twx8v4eUzEBr6hetOVBsGqBHkA8p0= X-Gm-Gg: ASbGncu3puwdHkfVJpfGl95Ynu5xTf0FSl3RljAvDqeck1aIRtOmw5xdd8r613AFptY L0AuTYY5bvbBcaq5eF5gEsk3Ti/uiY2wPyttpBV4xl15Vo7Ub1XM+D8M0S8lkhCjltLH281qe5J 7hVjITXscoNvnOPmrfBZX4t4C8Hzbx59AawBWHGJ2zNGhgh6a+yk8mwkE6KtEajyUlTtwXBHgPh MC3p9THYtZjEtvTzWZBhXTWVKAHg3XyeUyUQYyc57ZULWirnVc+DYubu5iT4TGwRHUyqh/vd3j0 XZpEWrfOE4E= X-Received: by 2002:a5d:47c7:0:b0:388:da10:ff13 with SMTP id ffacd0b85a97d-38c11e4af44mr20629251f8f.21.1737736196287; Fri, 24 Jan 2025 08:29:56 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:55 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 62/76] target/arm: Handle FPCR.AH in FRECPS and FRSQRTS vector insns Date: Fri, 24 Jan 2025 16:28:22 +0000 Message-Id: <20250124162836.2332150-63-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Handle the FPCR.AH "don't negate the sign of a NaN" semantics in the vector versions of FRECPS and FRSQRTS, by implementing new vector wrappers that call the _ah_ scalar helpers. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 14 ++++++++++++++ target/arm/tcg/translate-a64.c | 21 ++++++++++++++++----- target/arm/tcg/translate-sve.c | 7 ++++++- target/arm/tcg/vec_helper.c | 8 ++++++++ 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index 29c70f054af..a2e96a498dd 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -980,6 +980,20 @@ DEF_HELPER_FLAGS_5(gvec_rsqrts_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_5(gvec_rsqrts_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_recps_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_recps_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_recps_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) + +DEF_HELPER_FLAGS_5(gvec_ah_rsqrts_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_rsqrts_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_rsqrts_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, fpst, i32) + DEF_HELPER_FLAGS_5(gvec_ah_fmax_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_ah_fmax_s, TCG_CALL_NO_RWG, diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 977a1589e53..3fe8e041093 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5778,10 +5778,11 @@ static bool do_fp3_vector_2fn(DisasContext *s, arg_qrrr_e *a, int data, return do_fp3_vector(s, a, data, s->fpcr_ah ? fah : fnormal); } -static bool do_fp3_vector_ah(DisasContext *s, arg_qrrr_e *a, int data, - gen_helper_gvec_3_ptr * const f[3]) +static bool do_fp3_vector_ah_2fn(DisasContext *s, arg_qrrr_e *a, int data, + gen_helper_gvec_3_ptr * const fnormal[3], + gen_helper_gvec_3_ptr * const fah[3]) { - return do_fp3_vector_with_fpsttype(s, a, data, f, + return do_fp3_vector_with_fpsttype(s, a, data, s->fpcr_ah ? fah : fnormal, select_fpst(s, a->esz)); } @@ -5924,14 +5925,24 @@ static gen_helper_gvec_3_ptr * const f_vector_frecps[3] = { gen_helper_gvec_recps_s, gen_helper_gvec_recps_d, }; -TRANS(FRECPS_v, do_fp3_vector_ah, a, 0, f_vector_frecps) +static gen_helper_gvec_3_ptr * const f_vector_ah_frecps[3] = { + gen_helper_gvec_ah_recps_h, + gen_helper_gvec_ah_recps_s, + gen_helper_gvec_ah_recps_d, +}; +TRANS(FRECPS_v, do_fp3_vector_ah_2fn, a, 0, f_vector_frecps, f_vector_ah_frecps) static gen_helper_gvec_3_ptr * const f_vector_frsqrts[3] = { gen_helper_gvec_rsqrts_h, gen_helper_gvec_rsqrts_s, gen_helper_gvec_rsqrts_d, }; -TRANS(FRSQRTS_v, do_fp3_vector_ah, a, 0, f_vector_frsqrts) +static gen_helper_gvec_3_ptr * const f_vector_ah_frsqrts[3] = { + gen_helper_gvec_ah_rsqrts_h, + gen_helper_gvec_ah_rsqrts_s, + gen_helper_gvec_ah_rsqrts_d, +}; +TRANS(FRSQRTS_v, do_fp3_vector_ah_2fn, a, 0, f_vector_frsqrts, f_vector_ah_frsqrts) static gen_helper_gvec_3_ptr * const f_vector_faddp[3] = { gen_helper_gvec_faddp_h, diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 0696192148c..eef3623fd3a 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3741,7 +3741,12 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) NULL, gen_helper_gvec_##name##_h, \ gen_helper_gvec_##name##_s, gen_helper_gvec_##name##_d \ }; \ - TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_ah_arg_zzz, name##_fns[a->esz], a, 0) + static gen_helper_gvec_3_ptr * const name##_ah_fns[4] = { \ + NULL, gen_helper_gvec_ah_##name##_h, \ + gen_helper_gvec_ah_##name##_s, gen_helper_gvec_ah_##name##_d \ + }; \ + TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_ah_arg_zzz, \ + s->fpcr_ah ? name##_ah_fns[a->esz] : name##_fns[a->esz], a, 0) DO_FP3(FADD_zzz, fadd) DO_FP3(FSUB_zzz, fsub) diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index aa42c50f9fe..bf6f6a97636 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -1498,6 +1498,14 @@ DO_3OP(gvec_rsqrts_h, helper_rsqrtsf_f16, float16) DO_3OP(gvec_rsqrts_s, helper_rsqrtsf_f32, float32) DO_3OP(gvec_rsqrts_d, helper_rsqrtsf_f64, float64) +DO_3OP(gvec_ah_recps_h, helper_recpsf_ah_f16, float16) +DO_3OP(gvec_ah_recps_s, helper_recpsf_ah_f32, float32) +DO_3OP(gvec_ah_recps_d, helper_recpsf_ah_f64, float64) + +DO_3OP(gvec_ah_rsqrts_h, helper_rsqrtsf_ah_f16, float16) +DO_3OP(gvec_ah_rsqrts_s, helper_rsqrtsf_ah_f32, float32) +DO_3OP(gvec_ah_rsqrts_d, helper_rsqrtsf_ah_f64, float64) + DO_3OP(gvec_ah_fmax_h, helper_vfp_ah_maxh, float16) DO_3OP(gvec_ah_fmax_s, helper_vfp_ah_maxs, float32) DO_3OP(gvec_ah_fmax_d, helper_vfp_ah_maxd, float64) From patchwork Fri Jan 24 16:28:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859599 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp886536wrq; Fri, 24 Jan 2025 08:43:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU3I+4AB2gvDpMgDgqw87c/EC/nvLrm6YxgwCIkQeP58HHOgkQyNlPao3rFN+3X4I2iGV897w==@linaro.org X-Google-Smtp-Source: AGHT+IFbkT9rK/gkHmntZ0PcPToSsqys/gtta7ZSO/kKV1a9Q60nZ8ZxkNq0kbgD/oUugj1VieAM X-Received: by 2002:a05:6214:caf:b0:6e0:86ab:4b46 with SMTP id 6a1803df08f44-6e1b220e1cdmr408539756d6.31.1737737011811; Fri, 24 Jan 2025 08:43:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737011; cv=none; d=google.com; s=arc-20240605; b=kO4Pu0W2eu/77bRbWTcd/biMs6/C0VeEVOlb04hjy1L+PKW/lDGwck/jQ6+PfLNI+O KmVtd6lysgkJy9P4DQ135lcz7jhp/lvkkyHN2Iy9RDxPobU/dv956v9Fffl5053eqhsC ZXWLRvx/esUzpNB7bgsggxFZdaVmPkN4gzaP8z7D4UDUxIvf2dPV/Xxi+EGldpAxxJZ0 IajRVwWv2YBQ1vWPgrziNpb8iHilIl3bCqVa+CbDwMZi6pdZOmM8WckITvfimY+C9LOQ C64U82TfmyHFl5GwHaSwwTDJsZWdQonUxKt598cssZiFipOhDiK2wJ5lbzq0rKnvdAxo KBwQ== 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=phqWKrFmcHTgW6QQ28uLmFCKUWP0y8vEv9xKJtoc0vQ=; fh=CNeshAm7R+Q6+wbaSJvTwE/tdPD6QsnRET0Iw1L6SjQ=; b=Nvui3UeMOKc3ifp7uTwMZzzR7eJ1fSGjkozdouefSRnGL5v6KDQv5bD8h5JfxHrBiN dmQkZ5rY0upniqHictNGF5Cnziv8z5EEDKyz9sjby1Bx/xP3aw07DgJRBXJQXs7z+5LW 8PA/N00AWpQIynVr2v1XgBy1B9lguznT2MNHNqQYMix1jnLfg3OdHivuloeGi+Pr221y rIJVy5Z8SDkW3okaD5yYHGWxGUvOJ1Myjlq8iPACaZ0nn7aArrSzXrm26p65gpJqcW2G W2Ezt1N595BKDoGFa6E20/oQ+Cqesdc1Rri5P8SGoXSiVH1y3YEd329qPxAbuKTORiSA V7ag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G1vWMb2w; 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-6e20525c4a0si27896686d6.58.2025.01.24.08.43.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:43:31 -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=G1vWMb2w; 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 1tbMe1-0001gb-DC; Fri, 24 Jan 2025 11:34:58 -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 1tbMZO-0005vv-SH for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:19 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZD-0005o6-JQ for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:01 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-43626213fffso22184765e9.1 for ; Fri, 24 Jan 2025 08:29:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736198; x=1738340998; 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=phqWKrFmcHTgW6QQ28uLmFCKUWP0y8vEv9xKJtoc0vQ=; b=G1vWMb2wVMZ2enIicJMMhBT9OEF/8oa4viM0FxpZWLT96e5bO5qtyKLzQh6ruQhwCJ QEToXjuIvByoFaQW+kBNBMWTk4f2ynA32Rw+QaCd81FdyGY014ljZnAG9UGdMfi0zz4J QLFlQhIPlEo/3tN7fisuZ5W4cZbz7NxPnSWviM3xupdS+dxnSe3RalV5FuFZgJcbEOvu 9CfGlQ9itGxgPfRSOup9Ix/BdeQJGW5ovFGxesgB6f66pgfyc4EaALpHJ/jkT/m6iCIg UWjztnam4gLmo7wrbLgDF9b81bRpxmxwhqJP35V2pbBkIiLZKLM8AeUNZiwtJCqowSC7 idcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736198; x=1738340998; 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=phqWKrFmcHTgW6QQ28uLmFCKUWP0y8vEv9xKJtoc0vQ=; b=bRbgtNtF3HR7TN5KljuuVSkHsIkFJOTH9/LLzFnlvy8gaqJZlcV780YiFjkr365IF7 RKeEte/gb4SE+7m5ifA5ZxygSEQRNPhHD6KfdFgGIOEzFD7fdV3vtvF1jgnqRqnx54pl 3gykzflUUG8OHfwXgcp50vxcLKAt6QkaOIsKfHoD5R66W0s1Btawc9e1ANmdC48LkpQ5 HJak/8KkCRmHQjs88mMG/HjB3LNLXqYfRuw2QEiX0olJv3j/y5N1KQT2WN+vUtdthFYF RG4bBTGWVPSWBpQqtV6Rfj1I6BXDSdtge56lw8DpMrye/dqBxRr4L2fm87FNkXT1P3Jz 6dbA== X-Forwarded-Encrypted: i=1; AJvYcCWh4cosk94uI+nm0t4wD32csy8mKiaMIk7SvnmJudfjGjUz1NK4CNhbnvjJm6o3RUVHrGL/r2vLUzlx@nongnu.org X-Gm-Message-State: AOJu0YzJUsHRUMl7D1UfqXwJtKMRkn7xm6WOxnmyrH5s2vqFJOT3piQL FNQiARgUMyIjVxggU+7jp/1dnoLkmPpbYLO9dBy6L/0GSXNqjzmN/2kv0JgrBBg= X-Gm-Gg: ASbGncscSiv0M/Buwq0ek4HQSlsx7qMInTe2aUtfJoK+tvsHdSTmlvzPs2PMokYs9J8 +aktCDOWCM49mzERDps1mOJlLcp2POGEitqK664+Fses65uwebikwoy641aKQPkVHTKWqUy05yQ gRSYJex46dn6wbSzRDvYvNtZqlECjinSmFm/R92Bbz6afb72+9Lrja4QngnQwVeirp0jctGeDMb bpVO+vg87eTioTnSgxTG/FUPkuJZWcGyI87sobxDPS40LvLDtd2OxA10jev7J4P9h32F6uwJFql Dq6V9vfZx4w= X-Received: by 2002:a05:600c:1391:b0:434:ffb2:f9cf with SMTP id 5b1f17b1804b1-438b88603femr75243415e9.14.1737736198236; Fri, 24 Jan 2025 08:29:58 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:56 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 63/76] target/arm: Handle FPCR.AH in negation step in FMLS (indexed) Date: Fri, 24 Jan 2025 16:28:23 +0000 Message-Id: <20250124162836.2332150-64-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Handle the FPCR.AH "don't negate the sign of a NaN" semantics in FMLS (indexed), by passing through FPCR.AH in the SIMD data word, for the helper to use to determine whether to negate. Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 2 +- target/arm/tcg/translate-sve.c | 2 +- target/arm/tcg/vec_helper.c | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 3fe8e041093..c688275106f 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6751,7 +6751,7 @@ static bool do_fmla_vector_idx(DisasContext *s, arg_qrrx_e *a, bool neg) gen_gvec_op4_fpst(s, a->q, a->rd, a->rn, a->rm, a->rd, esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64, - (a->idx << 1) | neg, + (s->fpcr_ah << 5) | (a->idx << 1) | neg, fns[esz - 1]); return true; } diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index eef3623fd3a..a7033fe93ab 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3533,7 +3533,7 @@ static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub) gen_helper_gvec_fmla_idx_d, }; return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, - (a->index << 1) | sub, + (s->fpcr_ah << 5) | (a->index << 1) | sub, a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64); } diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index bf6f6a97636..5e9663382a9 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -1708,13 +1708,18 @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, \ intptr_t i, j, oprsz = simd_oprsz(desc); \ intptr_t segment = MIN(16, oprsz) / sizeof(TYPE); \ TYPE op1_neg = extract32(desc, SIMD_DATA_SHIFT, 1); \ - intptr_t idx = desc >> (SIMD_DATA_SHIFT + 1); \ + intptr_t idx = extract32(desc, SIMD_DATA_SHIFT + 1, 3); \ + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT + 5, 1); \ TYPE *d = vd, *n = vn, *m = vm, *a = va; \ op1_neg <<= (8 * sizeof(TYPE) - 1); \ for (i = 0; i < oprsz / sizeof(TYPE); i += segment) { \ TYPE mm = m[H(i + idx)]; \ for (j = 0; j < segment; j++) { \ - d[i + j] = TYPE##_muladd(n[i + j] ^ op1_neg, \ + TYPE nval = n[i + j]; \ + if (!(fpcr_ah && TYPE ## _is_any_nan(nval))) { \ + nval ^= op1_neg; \ + } \ + d[i + j] = TYPE##_muladd(nval, \ mm, a[i + j], 0, stat); \ } \ } \ From patchwork Fri Jan 24 16:28:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859632 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp892600wrq; Fri, 24 Jan 2025 08:57:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX6ywcS//75RLrXC1vtRRAAX8LNfDJ7VFbrDfFHwUj3niPrwpqdU7RAqANZ0O0lB0a7z8tFsg==@linaro.org X-Google-Smtp-Source: AGHT+IFKbZ3Xf+2bSBz0uCTnsW5rsXV+EPkMo/gv/twfJ7IrTbvyabMrsn+eMcDvKS7Oh04xIz19 X-Received: by 2002:a05:6102:3ec2:b0:4b2:5d63:ff72 with SMTP id ada2fe7eead31-4b690be8625mr26811981137.13.1737737869358; Fri, 24 Jan 2025 08:57:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737869; cv=none; d=google.com; s=arc-20240605; b=RAcQj6kB+cptDSDai8TVpprmpG7/veAuXZcx/Rsk+xj/NAx9aR354yV+ehMald5kJp u8GzaHEUi65f/PJfM2f6nxY/nOq4nbTcKJI/9rTopqfvqzxvi4DhFnki4WBBbLl1w80S v2ZkZFaU98iejk+gzRcSfgK9EEE2aevR14I9VQwlYrd+scS+G4g1gHJWcScN2NOr8bHS 69+c4iXP0EpQCHriajadKqBZOURcHQk9DzQfDAnFiqjSLx6QiG15L5ppEyd0vkIwsona ncqqSFqq60teH3q241TcxfmbylzGl6bbLJrX+nfJ+oV/mXJFEUk1vKPEGi4n4rMsvs8F uQHA== 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=hQP+mP8aoERhG/l82UzKUhVhRS0CYJg3hdc1vQH02Ms=; fh=RC+6COW88N7mQFaL+C87FzqsTLKBIs+aQdUBQ2zBM10=; b=d/TXLZcKGzFph3n7zibXuDfJGcaOzq1s5zLxo27H962bk4Ebv90ZuTYlPl1Kj4E7gp 39PbtuxCTcu6eSNYZoreT288cGwP1wKBIjSa16iMQcbR8dy9cjIANgQivIyJ/14r/yp5 +V9us5O0ys79SBp7QEJXtsn4fc7VdsD61BU+VvFmzQvgP+bOWr7+U7VoaqV4A6vOTrpz e1cEwGNr+LKbaIvQjZtekROwoZzEBgZ3owcqkxR/528wQ6zPjfkGT7pOZiFNDwDHe6PJ jjdlPQwL0cg40XmHoZJouAQNp4Q9Xno4p14EnydvRwUVL7eeC3IbX8VEEhJgweW10gu0 /AuQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l5aMiUJM; 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 ada2fe7eead31-4b7099823c6si838084137.345.2025.01.24.08.57.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:57:49 -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=l5aMiUJM; 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 1tbMdy-00018P-7R; Fri, 24 Jan 2025 11:34:54 -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 1tbMZR-0005xv-RQ for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:19 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZH-0005oZ-99 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:10 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso15352995e9.1 for ; Fri, 24 Jan 2025 08:30:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736199; x=1738340999; 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=hQP+mP8aoERhG/l82UzKUhVhRS0CYJg3hdc1vQH02Ms=; b=l5aMiUJMJIoXlAMi1Tvd/ob3DsmkIzNecnMF6NE34pBLtRwFWNz7yCQF7CMwHWg2Oi f39FWXNf5wYZUCODnDMj3ZGrl7Gzf8vqhN9mvZpTaQ6SxWGyq0fcNfVU73GqoxEIWPt8 LH98hGygZZ5uUR6y9XURTSoz6r7/x6XG1RrQj7dL5nkgMNpxGd+pN86wTNlDRX731jBu U/17RrgmYgFCWdK4l3j14l3/d73Y8ezgO8XfouteTatmk5ngsRSF/tEI2iRXCLeDe0vN UOePXeuk6LEH5T43J8WaLdYRbH33J7l/dfSSF2jPIdmeOt37SAqlK4tLMu28s17hykEH Nuww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736199; x=1738340999; 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=hQP+mP8aoERhG/l82UzKUhVhRS0CYJg3hdc1vQH02Ms=; b=HZfMORUhM93KosGY+29ZSeKs0h5zy58XF4w7gc2Bhu1zTqPHtlYLhK1Qh73L1JCkKn oS3MptmgymBEzZKcawRsWrgjC99pTVY6DRPU7Rw71dG6avraX0PzbRqw0jQn3eLN+UNj +DjAB7YLD4rPsOyaja3Q9q20B54vWwdta7OtoRhgunCS1k7kn9jl7AnyJajy+ihcZRdY HfSx0AIK22L/Dxlv9tmLV1DlM4rQ+oRQeqpO8/6ydpd0mAUcoqqEec0L5zMZgYqPu0ol s7/+Sa9mVPeJ9sArhl/4HkaNB66H8lliP6XbRHuPDGUc6GzAV8cqujVmzWB0b1uC3VlD K3Ag== X-Forwarded-Encrypted: i=1; AJvYcCUxXUWZTzrHrgEWM6rG6q3f51ee1tVlx6lEbC3/p3zdsMj6J5hIeJZolnxDJKTQ0jlnHeqLeduIXWzc@nongnu.org X-Gm-Message-State: AOJu0YxSTDRyuUSiQ/MG2t8c5RLjSl0ZHuplMC+zdBiN1Z+mQtaXFasY eUJW+a7SV/hFNKIo8d8M3xBi3F5EtRvD2htqJbBI6bB26BehNpkclcjKBIJmmfg9GLb+yLLDfkQ c X-Gm-Gg: ASbGncvkd/R+z63ula0ec1v9UkxqUo1+w3hpFRDkdLtKumUEwB6Rcfte9nKQ2P1rR0+ 58eKG2HZix9T36hiyTrYLMxkirdIMPk1evjUaYHrumszNp9NJSCNjCptUFcsRecs3pPyZBSH7/Z I+HNGbGLkr92psPfpNSExRbtG4gn5Ws6/EILZcfAyIeQgqSxSsIXz1RvSfaZEZY4RWtipXYDjwb yZAumsTZmtbCNFvkT8X90ZIqUN3OIr2DlwyAcVz6BZJYddn5Xi7S95RBw2luDjJ4sjDl2qHa2LG hDfyHLOqokw= X-Received: by 2002:a05:600c:21d8:b0:434:ea1a:e30c with SMTP id 5b1f17b1804b1-438bd0bca9amr41267815e9.13.1737736199253; Fri, 24 Jan 2025 08:29:59 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:58 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 64/76] target/arm: Handle FPCR.AH in negation in FMLS (vector) Date: Fri, 24 Jan 2025 16:28:24 +0000 Message-Id: <20250124162836.2332150-65-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Handle the FPCR.AH "don't negate the sign of a NaN" semantics in FMLS (vector), by implementing a new set of helpers for the AH=1 case. Signed-off-by: Peter Maydell --- target/arm/helper.h | 4 ++++ target/arm/tcg/translate-a64.c | 7 ++++++- target/arm/tcg/vec_helper.c | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 43505d5fedc..0a8b4c946e1 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -782,6 +782,10 @@ DEF_HELPER_FLAGS_5(gvec_vfms_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_vfms_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_vfms_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_vfms_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_vfms_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_5(gvec_ah_vfms_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) + DEF_HELPER_FLAGS_5(gvec_ftsmul_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_5(gvec_ftsmul_s, TCG_CALL_NO_RWG, diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index c688275106f..0b57e35f999 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -5871,7 +5871,12 @@ static gen_helper_gvec_3_ptr * const f_vector_fmls[3] = { gen_helper_gvec_vfms_s, gen_helper_gvec_vfms_d, }; -TRANS(FMLS_v, do_fp3_vector, a, 0, f_vector_fmls) +static gen_helper_gvec_3_ptr * const f_vector_fmls_ah[3] = { + gen_helper_gvec_ah_vfms_h, + gen_helper_gvec_ah_vfms_s, + gen_helper_gvec_ah_vfms_d, +}; +TRANS(FMLS_v, do_fp3_vector_2fn, a, 0, f_vector_fmls, f_vector_fmls_ah) static gen_helper_gvec_3_ptr * const f_vector_fcmeq[3] = { gen_helper_gvec_fceq_h, diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 5e9663382a9..c720b435d58 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -1579,6 +1579,27 @@ static float64 float64_mulsub_f(float64 dest, float64 op1, float64 op2, return float64_muladd(float64_chs(op1), op2, dest, 0, stat); } +static float16 float16_ah_mulsub_f(float16 dest, float16 op1, float16 op2, + float_status *stat) +{ + op1 = float16_is_any_nan(op1) ? op1 : float16_chs(op1); + return float16_muladd(op1, op2, dest, 0, stat); +} + +static float32 float32_ah_mulsub_f(float32 dest, float32 op1, float32 op2, + float_status *stat) +{ + op1 = float32_is_any_nan(op1) ? op1 : float32_chs(op1); + return float32_muladd(op1, op2, dest, 0, stat); +} + +static float64 float64_ah_mulsub_f(float64 dest, float64 op1, float64 op2, + float_status *stat) +{ + op1 = float64_is_any_nan(op1) ? op1 : float64_chs(op1); + return float64_muladd(op1, op2, dest, 0, stat); +} + #define DO_MULADD(NAME, FUNC, TYPE) \ void HELPER(NAME)(void *vd, void *vn, void *vm, \ float_status *stat, uint32_t desc) \ @@ -1605,6 +1626,10 @@ DO_MULADD(gvec_vfms_h, float16_mulsub_f, float16) DO_MULADD(gvec_vfms_s, float32_mulsub_f, float32) DO_MULADD(gvec_vfms_d, float64_mulsub_f, float64) +DO_MULADD(gvec_ah_vfms_h, float16_ah_mulsub_f, float16) +DO_MULADD(gvec_ah_vfms_s, float32_ah_mulsub_f, float32) +DO_MULADD(gvec_ah_vfms_d, float64_ah_mulsub_f, float64) + /* For the indexed ops, SVE applies the index per 128-bit vector segment. * For AdvSIMD, there is of course only one such vector segment. */ From patchwork Fri Jan 24 16:28:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859613 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp888426wrq; Fri, 24 Jan 2025 08:47:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWg0vUn5Iy2EeRuRRTTLsvza9Lm5urqGxMea+s4CYPIyT0gjAU61dyKuKOQa9cjWKv7pN+OYA==@linaro.org X-Google-Smtp-Source: AGHT+IHY2dVc+z2c6KEZpxDopr020InQEBYOFoiwKafZaiiYFdia76JDi6/z/OZeaHgTvv+WFt2N X-Received: by 2002:a05:6102:74b:b0:4b5:c302:37b3 with SMTP id ada2fe7eead31-4b709bb10e3mr3988248137.5.1737737266730; Fri, 24 Jan 2025 08:47:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737266; cv=none; d=google.com; s=arc-20240605; b=LFqHiqiMr9LCOB58AGVuC5L3/YIdFBNu+1rQxc37OQWenSg6rOx0ba9PKxouI7MOGP fEKShRkVg9g8of5lrH8q8bb6jPYOMzbTEBgNTdZaMZnbG+VZFWEahyu/jq8xMl9s2Jdx a60BPGcYVjTZqS6N7DHzd2n4stPRBZ6OUX96rLntwO/dnmcT83IffVrw9GImMr+XlQwF h1NN1S4u3fWZGfpxcSTwrv2+b4SzTNjy1hrpF5V5uun8bqFDRH1xziTTvwFW0F4KPvdK v6yvKrw28cQgD9lChkS5lgGKSWoNHxrjYLiFZm6JRB7+Sx8dpKC9qVy3GPGh7HsKWaRx RO7g== 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=KmmHXd9GrblPYO2aSGw968FOMap5vznRkrI2AiqmE4w=; fh=ogjgTsaG3uxEEJMb6723/TOCL2HyZ7Fgxf1BFbGMcig=; b=eyc3MsR4QgIxNs3Db/O36L564waVjylU6TtLXcdhZ5SzDS9KMcWD5Ao/o5MQGN6uLw 7vekKb8tcryfUFe/5Ez6giGpepLWC78IBKzl1CusSyvCl6gFeeiCkUvzTX0fVmzlccPS xZ20hwY3S/VSEktnqUeCfgiGhjioKoCW+slTLjwzSXfmLvZh9P2viiX4NSVJ8HcuEN6r di4VMQ/n/k6fNO3U35Ab7wAO9Pb/XsKQELcf9QeGahOHr5Jbiua8fgvBSrP/yFhxTFbK 5nmuL7J7VRyoNWZYkyo+KSZDJ8InaFd39hmxIT6Ixv+5t11Ohxixjfoac3aMVlapQsfS hymQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qH0oYMqU; 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 ada2fe7eead31-4b709a2db02si845311137.691.2025.01.24.08.47.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:47:46 -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=qH0oYMqU; 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 1tbMdf-0008Ms-6t; Fri, 24 Jan 2025 11:34: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 1tbMZR-0005xw-Rq for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:19 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZL-0005oz-0f for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:12 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-436ce2ab251so15095175e9.1 for ; Fri, 24 Jan 2025 08:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736200; x=1738341000; 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=KmmHXd9GrblPYO2aSGw968FOMap5vznRkrI2AiqmE4w=; b=qH0oYMqU9o5s4wwVzSBwco7pfy6QZEBDInydO3B+qlZlFJzfGBPphsw0Aav4g+NhBQ gKMmC+LEmKOL3YZYgJWVB1VR+eJisiaIWFyzi/ugbvFUPiUmi9gFHtxbMR/SnbCaIxQg vbRebeyYaJFsBhjp1fKthowYILp8YJp2EiJ+JtqhvnOZJTTcd8vgtkNbLxNX0cVr/G0H LgugBfE0o691UHx3MpVrfTaVlY/MgZ2bO9F7QlTFTfZzg74UJB8fo1u/URMlUSfqvduu a0wcSdtvCxvlJs1EgOjWOiTnsiYAsA89KiILTnkd6qYETINPX/Vzwe2krNv6ISzlJTQe 9Jlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736200; x=1738341000; 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=KmmHXd9GrblPYO2aSGw968FOMap5vznRkrI2AiqmE4w=; b=ZuFWL2aJ43anHGloSIgUJbRj51CLwMze9B19UdcclwaWJWrCJtP1zLqMRMR91zvH3r zlzeeOX5ZyybuBoJ7BueknIHcyEgpd9G7lczMuyHifz6SsEm0ofNeNs/MZyqfFsK0vlQ sPe7sa7IFZISEVHqNKFTTyuLLwocf0hiHnqZBd1vU55rCqnxKDyEQkwL6APFLDNnS+A6 PV75pig7m252LwLavMezSfq52aZ85XiGwO/Neg/XH82aD9OpLjtLHV5vz/6hjSNoUBRT 4c3F37mI+zaE27G5BjSblPeLcRJoFOPU6xGSpPXdAfSjOiR4R1GAzDuRlN1zkQcVXeSx J+6w== X-Forwarded-Encrypted: i=1; AJvYcCUvsCH0Q6bM+iWGQloXuOVuHY97yyx8TMV2ZjCimleSMGeHEoEBhQdIaNHOPjncY6b9r1NJyHk018mp@nongnu.org X-Gm-Message-State: AOJu0Yyz5QTqOVcWw9IPUzqWIz67AjxAT2byLHza26c3YLbMpEibyun1 hveXUjhWctQzPOZFFPZjsngY4eIhtyfnbqPxhTWCgQtqvqQqzZNnVFI+gdbKSqVlgRWA0RPKrRF 6 X-Gm-Gg: ASbGnculgst2f/y9819EIc+y4bqsmysl7i0wmlRFmc/aI9AeoUMZVSSOgriUvHkyzQ8 iPxPWQ37O5hxm9BJUXyAVI5bW+pMVXEmM0bXnasyaRPeTLuOqsmyQe0TZPaZ8Tbp8obIhxSHWV1 tnO/obwfy0FYfBtweiRUR5jgD2gLsteD66eGNEIzEWHncGeg1HDIBjV8n0dN5eqJ7bo5Lrp+2pm D0jsnN6QOPitX607+E6ER0l147kZlZt7AU6A49phQXGYWOCsboowkN6Igc0DLoRYi0gzc42vlO2 v1wNYowPiDs= X-Received: by 2002:a05:600c:4e08:b0:434:a4a6:51f8 with SMTP id 5b1f17b1804b1-438912d4a3bmr316757715e9.0.1737736200464; Fri, 24 Jan 2025 08:30: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-438bd47eecasm31683025e9.6.2025.01.24.08.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:29:59 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 65/76] target/arm: Handle FPCR.AH in negation step in SVE FMLS (vector) Date: Fri, 24 Jan 2025 16:28:25 +0000 Message-Id: <20250124162836.2332150-66-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Handle the FPCR.AH "don't negate the sign of a NaN" semantics fro the SVE FMLS (vector) insns, by providing new helpers for the AH=1 case which end up passing fpcr_ah = true to the do_fmla_zpzzz_* functions that do the work. Signed-off-by: Peter Maydell --- target/arm/tcg/helper-sve.h | 21 ++++++ target/arm/tcg/sve_helper.c | 114 +++++++++++++++++++++++++++------ target/arm/tcg/translate-sve.c | 18 ++++-- 3 files changed, 126 insertions(+), 27 deletions(-) diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h index a2e96a498dd..0b1b5887834 100644 --- a/target/arm/tcg/helper-sve.h +++ b/target/arm/tcg/helper-sve.h @@ -1475,6 +1475,27 @@ DEF_HELPER_FLAGS_7(sve_fnmls_zpzzz_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_7(sve_fnmls_zpzzz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_7(sve_ah_fmls_zpzzz_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_7(sve_ah_fmls_zpzzz_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_7(sve_ah_fmls_zpzzz_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, fpst, i32) + +DEF_HELPER_FLAGS_7(sve_ah_fnmla_zpzzz_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_7(sve_ah_fnmla_zpzzz_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_7(sve_ah_fnmla_zpzzz_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, fpst, i32) + +DEF_HELPER_FLAGS_7(sve_ah_fnmls_zpzzz_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_7(sve_ah_fnmls_zpzzz_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_7(sve_ah_fnmls_zpzzz_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, fpst, i32) + DEF_HELPER_FLAGS_7(sve_fcmla_zpzzz_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_7(sve_fcmla_zpzzz_s, TCG_CALL_NO_RWG, diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index dc5a35b46ef..90bcf680fa4 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -4802,7 +4802,7 @@ DO_ZPZ_FP(flogb_d, float64, H1_8, do_float64_logb_as_int) static void do_fmla_zpzzz_h(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc, - uint16_t neg1, uint16_t neg3) + uint16_t neg1, uint16_t neg3, bool fpcr_ah) { intptr_t i = simd_oprsz(desc); uint64_t *g = vg; @@ -4814,9 +4814,15 @@ static void do_fmla_zpzzz_h(void *vd, void *vn, void *vm, void *va, void *vg, if (likely((pg >> (i & 63)) & 1)) { float16 e1, e2, e3, r; - e1 = *(uint16_t *)(vn + H1_2(i)) ^ neg1; + e1 = *(uint16_t *)(vn + H1_2(i)); e2 = *(uint16_t *)(vm + H1_2(i)); - e3 = *(uint16_t *)(va + H1_2(i)) ^ neg3; + e3 = *(uint16_t *)(va + H1_2(i)); + if (neg1 && !(fpcr_ah && float16_is_any_nan(e1))) { + e1 ^= neg1; + } + if (neg3 && !(fpcr_ah && float16_is_any_nan(e3))) { + e3 ^= neg3; + } r = float16_muladd(e1, e2, e3, 0, status); *(uint16_t *)(vd + H1_2(i)) = r; } @@ -4827,30 +4833,48 @@ static void do_fmla_zpzzz_h(void *vd, void *vn, void *vm, void *va, void *vg, void HELPER(sve_fmla_zpzzz_h)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0, 0); + do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0, 0, false); } void HELPER(sve_fmls_zpzzz_h)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0x8000, 0); + do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0x8000, 0, false); } void HELPER(sve_fnmla_zpzzz_h)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0x8000, 0x8000); + do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0x8000, 0x8000, false); } void HELPER(sve_fnmls_zpzzz_h)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0, 0x8000); + do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0, 0x8000, false); +} + +void HELPER(sve_ah_fmls_zpzzz_h)(void *vd, void *vn, void *vm, void *va, + void *vg, float_status *status, uint32_t desc) +{ + do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0x8000, 0, true); +} + +void HELPER(sve_ah_fnmla_zpzzz_h)(void *vd, void *vn, void *vm, void *va, + void *vg, float_status *status, uint32_t desc) +{ + do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0x8000, 0x8000, true); +} + +void HELPER(sve_ah_fnmls_zpzzz_h)(void *vd, void *vn, void *vm, void *va, + void *vg, float_status *status, uint32_t desc) +{ + do_fmla_zpzzz_h(vd, vn, vm, va, vg, status, desc, 0, 0x8000, true); } static void do_fmla_zpzzz_s(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc, - uint32_t neg1, uint32_t neg3) + uint32_t neg1, uint32_t neg3, bool fpcr_ah) { intptr_t i = simd_oprsz(desc); uint64_t *g = vg; @@ -4862,9 +4886,15 @@ static void do_fmla_zpzzz_s(void *vd, void *vn, void *vm, void *va, void *vg, if (likely((pg >> (i & 63)) & 1)) { float32 e1, e2, e3, r; - e1 = *(uint32_t *)(vn + H1_4(i)) ^ neg1; + e1 = *(uint32_t *)(vn + H1_4(i)); e2 = *(uint32_t *)(vm + H1_4(i)); - e3 = *(uint32_t *)(va + H1_4(i)) ^ neg3; + e3 = *(uint32_t *)(va + H1_4(i)); + if (neg1 && !(fpcr_ah && float32_is_any_nan(e1))) { + e1 ^= neg1; + } + if (neg3 && !(fpcr_ah && float32_is_any_nan(e3))) { + e3 ^= neg3; + } r = float32_muladd(e1, e2, e3, 0, status); *(uint32_t *)(vd + H1_4(i)) = r; } @@ -4875,30 +4905,48 @@ static void do_fmla_zpzzz_s(void *vd, void *vn, void *vm, void *va, void *vg, void HELPER(sve_fmla_zpzzz_s)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0, 0); + do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0, 0, false); } void HELPER(sve_fmls_zpzzz_s)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0x80000000, 0); + do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0x80000000, 0, false); } void HELPER(sve_fnmla_zpzzz_s)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0x80000000, 0x80000000); + do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0x80000000, 0x80000000, false); } void HELPER(sve_fnmls_zpzzz_s)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0, 0x80000000); + do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0, 0x80000000, false); +} + +void HELPER(sve_ah_fmls_zpzzz_s)(void *vd, void *vn, void *vm, void *va, + void *vg, float_status *status, uint32_t desc) +{ + do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0x80000000, 0, true); +} + +void HELPER(sve_ah_fnmla_zpzzz_s)(void *vd, void *vn, void *vm, void *va, + void *vg, float_status *status, uint32_t desc) +{ + do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0x80000000, 0x80000000, true); +} + +void HELPER(sve_ah_fnmls_zpzzz_s)(void *vd, void *vn, void *vm, void *va, + void *vg, float_status *status, uint32_t desc) +{ + do_fmla_zpzzz_s(vd, vn, vm, va, vg, status, desc, 0, 0x80000000, true); } static void do_fmla_zpzzz_d(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc, - uint64_t neg1, uint64_t neg3) + uint64_t neg1, uint64_t neg3, bool fpcr_ah) { intptr_t i = simd_oprsz(desc); uint64_t *g = vg; @@ -4910,9 +4958,15 @@ static void do_fmla_zpzzz_d(void *vd, void *vn, void *vm, void *va, void *vg, if (likely((pg >> (i & 63)) & 1)) { float64 e1, e2, e3, r; - e1 = *(uint64_t *)(vn + i) ^ neg1; + e1 = *(uint64_t *)(vn + i); e2 = *(uint64_t *)(vm + i); - e3 = *(uint64_t *)(va + i) ^ neg3; + e3 = *(uint64_t *)(va + i); + if (neg1 && !(fpcr_ah && float64_is_any_nan(e1))) { + e1 ^= neg1; + } + if (neg3 && !(fpcr_ah && float64_is_any_nan(e3))) { + e3 ^= neg3; + } r = float64_muladd(e1, e2, e3, 0, status); *(uint64_t *)(vd + i) = r; } @@ -4923,25 +4977,43 @@ static void do_fmla_zpzzz_d(void *vd, void *vn, void *vm, void *va, void *vg, void HELPER(sve_fmla_zpzzz_d)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, 0, 0); + do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, 0, 0, false); } void HELPER(sve_fmls_zpzzz_d)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, INT64_MIN, 0); + do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, INT64_MIN, 0, false); } void HELPER(sve_fnmla_zpzzz_d)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, INT64_MIN, INT64_MIN); + do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, INT64_MIN, INT64_MIN, false); } void HELPER(sve_fnmls_zpzzz_d)(void *vd, void *vn, void *vm, void *va, void *vg, float_status *status, uint32_t desc) { - do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, 0, INT64_MIN); + do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, 0, INT64_MIN, false); +} + +void HELPER(sve_ah_fmls_zpzzz_d)(void *vd, void *vn, void *vm, void *va, + void *vg, float_status *status, uint32_t desc) +{ + do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, INT64_MIN, 0, true); +} + +void HELPER(sve_ah_fnmla_zpzzz_d)(void *vd, void *vn, void *vm, void *va, + void *vg, float_status *status, uint32_t desc) +{ + do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, INT64_MIN, INT64_MIN, true); +} + +void HELPER(sve_ah_fnmls_zpzzz_d)(void *vd, void *vn, void *vm, void *va, + void *vg, float_status *status, uint32_t desc) +{ + do_fmla_zpzzz_d(vd, vn, vm, va, vg, status, desc, 0, INT64_MIN, true); } /* Two operand floating-point comparison controlled by a predicate. diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index a7033fe93ab..663634e3a39 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3924,19 +3924,25 @@ TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz], a->rd, a->rn, a->rm, a->pg, a->rot | (s->fpcr_ah << 1), a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) -#define DO_FMLA(NAME, name) \ +#define DO_FMLA(NAME, name, ah_name) \ static gen_helper_gvec_5_ptr * const name##_fns[4] = { \ NULL, gen_helper_sve_##name##_h, \ gen_helper_sve_##name##_s, gen_helper_sve_##name##_d \ }; \ - TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_zzzzp, name##_fns[a->esz], \ + static gen_helper_gvec_5_ptr * const name##_ah_fns[4] = { \ + NULL, gen_helper_sve_##ah_name##_h, \ + gen_helper_sve_##ah_name##_s, gen_helper_sve_##ah_name##_d \ + }; \ + TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_zzzzp, \ + s->fpcr_ah ? name##_ah_fns[a->esz] : name##_fns[a->esz], \ a->rd, a->rn, a->rm, a->ra, a->pg, 0, \ a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) -DO_FMLA(FMLA_zpzzz, fmla_zpzzz) -DO_FMLA(FMLS_zpzzz, fmls_zpzzz) -DO_FMLA(FNMLA_zpzzz, fnmla_zpzzz) -DO_FMLA(FNMLS_zpzzz, fnmls_zpzzz) +/* We don't need an ah_fmla_zpzzz because fmla doesn't negate anything */ +DO_FMLA(FMLA_zpzzz, fmla_zpzzz, fmla_zpzzz) +DO_FMLA(FMLS_zpzzz, fmls_zpzzz, ah_fmls_zpzzz) +DO_FMLA(FNMLA_zpzzz, fnmla_zpzzz, ah_fnmla_zpzzz) +DO_FMLA(FNMLS_zpzzz, fnmls_zpzzz, ah_fnmls_zpzzz) #undef DO_FMLA From patchwork Fri Jan 24 16:28:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859588 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp883797wrq; Fri, 24 Jan 2025 08:36:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVcxITDJ6Ssg9Lpgny2/o5nsLX4+owmHlDaLl8/mW1npjG/Wdk/bFyP+9ij/k+6YSw1WuXgrg==@linaro.org X-Google-Smtp-Source: AGHT+IHM/pc0cbCCxQgSIbpnRlyhA98guxiANxvroT3DioAsd1TrAfg1byt61kc9Ef3czSwyKBDx X-Received: by 2002:a05:6122:6585:b0:518:773b:39f with SMTP id 71dfb90a1353d-51d59797f69mr28186209e0c.4.1737736617007; Fri, 24 Jan 2025 08:36:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736616; cv=none; d=google.com; s=arc-20240605; b=c9GwuTZ6Vo+Qo+0L1BM3KRNdqq0F5az7t0h+pZ2mUy6svdEo7Pe6BuEqnafXs64vQE qcjEIr6pk5IHWmynbBcPAMjyhdiI4sj2UGO3RBX4zaexZoWBSyFzjV43R9CMY0n/NpTt 4i087ad4JRzabVN0FUh1LoGOzxEdxwXzTsEbtDKLBC6gK+718aEkUIuijL26NnADbOKu uuL28lKoZicCpGIfWd3JOwpqw7FhI7sJ2+6HF04AtDJTrqxpY+LWZwITyLpxnc09IyOE 0vnwfpHBdqHpMo6jnWHK/lq0X8N6ZN5dYkvXZ8ZbYYVP1QUpnZvARRnxKeHvFb9IgCR0 6frw== 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=8AGs31o3QVkBdFVRa9k1zWhHeCcvoSGGZNisnAwsyfU=; fh=myVcqgMLdSvBUziRHlEpwqzNkRAw2j9y/U6JPLsYOXc=; b=DeaQWUnHeZZO4zV3csyMxj+83wl2gOUa6AstUqXGpBfB0UMMhZTTeBusJE5ZHvkuSF L2h7YZrqwPOi/imOfBdHSTsKcvDv7dJpH/83D5cvBuwW/FSISEz2Zxqc2BLtmOi+kbM/ C9tPt7YAwo46ZwUe+PNLUujrMzFjL0K8Ad4i56UCXLIGLSISKjLJWC+vu7dCKCwO0E5B 8eFPOwqmMsr8+hc/ULx7IFWrrNifF0AbqP6IegV5JSmaAPFfzKyi+UF1utrCjPLYy7R/ wNFE3o3AXx4qPPHtbbIxpnsx1HL5b1WdssQs3+Ov/gMlLU/6wJoxJsZO0hV6AuMakuiu PgQw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z1OSb0dp; 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 71dfb90a1353d-51e4ec883bbsi1134726e0c.187.2025.01.24.08.36.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:36:56 -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=z1OSb0dp; 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 1tbMe6-00026r-RY; Fri, 24 Jan 2025 11:35:04 -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 1tbMZh-0006B9-Mc for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:32 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZY-0005pO-IB for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:26 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-436202dd730so16573815e9.2 for ; Fri, 24 Jan 2025 08:30:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736202; x=1738341002; 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=8AGs31o3QVkBdFVRa9k1zWhHeCcvoSGGZNisnAwsyfU=; b=z1OSb0dple0v4WE5ZeuN071rjzwF5/aXCec82pyAzyH5A5WNDdXfyl264E664u8FkE L52Dh88kHERzZMBFTAExDpbcaD+U/MGRdW+0AU9TN0z70Ms1G3cSkXcf3EIMoDg+kxBr O9QVBGW/3rMKCvr4kSZxrG28dNY0s0sadXcKPiAfjlMogU28+Cq1OC0L5lEZI3BqSDNW 09bir7mr6q5Q4B8Xlx5XXzDwkOUHyHteu7NsBCbFzZjzSn9qiP9hgTmFd0Fst9NWd/tS wsjR1zExgccGsV0qGL6A5BNnqZY1anBJ8x+91y4Cn/YfZsDp8cxbWSDP9Y6SweYoXWVs FXGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736202; x=1738341002; 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=8AGs31o3QVkBdFVRa9k1zWhHeCcvoSGGZNisnAwsyfU=; b=CkQYNXMee5kSp7BwKM30pkHEHhAOh0OPL91TnV9lPTiS9jmtCDlBOywPfdwrOCjzLU By+aioS3PrU+MLpnnBLZun2maiiIw2a2/z0/ikVyStfguDAovewoICyQuITXzNmQIn0m VQ5+T1GyC9ZSGM5LO95MitqGWfSES5zk5nJl4vCKLOcWUE7PP+dOMOo/iqgmR7qU4esp nEbXKl+B9wwTBZEC/tZsyRWXzwxAlT841Lvvh4uunHlPCAU+OnMCj4C3oE1p8AO49gkb zdLVkSeN0ZtxJ9+3LClFl7+93sOI9nVg8z8zO7ESqpCUoILdCfxPmhlmJhiLhPAFFNo+ 9Icw== X-Forwarded-Encrypted: i=1; AJvYcCV+NyI99Tumj78idXfx9oNC92JQrVyfAkXJ77Wilz0j9nYVswVYR/JrQ8rXbphVHFH4KUgm7bcRHNqy@nongnu.org X-Gm-Message-State: AOJu0Yxfvj+eWs7GMJuQ8Ddb5KlxximL/Nx5FqQAiAkEvU4vcPCUxjl3 vYHDA9ctInL85dopkTKhz/k1bih8fBg5X25qwz/m2v0NLntzAo6Z4gn36ZXCDC0= X-Gm-Gg: ASbGnctO8TpGF0BZ8SSARsr7ESujVxRGp8qG3XRgu3LULPGzkDqzIhvX7KUFbvDtGcq QUU8qu92qIkLAq3nSl3dqfoktGee++U5mxQYCeTAQtGhFKbZ3oCO6OoBNuimUZNLX9yUwgvxN5V lbBKlIOzZWjk0HQz6LKYiyFC82qpo9U8A1AhmFSx4/gcJnfmpCSwEwzXg//33GovVGG4lA9qDpp LEoyGjgh6UcywIYpFJp5HjN9t4Au3pu98ISs+eNRJzA94xeEeHKj8Cs78WSYb8hmPDK/2l7H+Zp N/z2NvNqnOI= X-Received: by 2002:a05:600c:3484:b0:434:f8e5:1bb with SMTP id 5b1f17b1804b1-438913e48fdmr301349545e9.12.1737736201795; Fri, 24 Jan 2025 08:30:01 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:00 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 66/76] target/arm: Handle FPCR.AH in SVE FTSSEL Date: Fri, 24 Jan 2025 16:28:26 +0000 Message-Id: <20250124162836.2332150-67-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 negation step in the SVE FTSSEL insn mustn't negate a NaN when FPCR.AH is set. Pass FPCR.AH to the helper via the SIMD data field and use that to determine whether to do the negation. Signed-off-by: Peter Maydell --- target/arm/tcg/sve_helper.c | 18 +++++++++++++++--- target/arm/tcg/translate-sve.c | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index 90bcf680fa4..a39a3ed0cf9 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -2555,6 +2555,7 @@ void HELPER(sve_fexpa_d)(void *vd, void *vn, uint32_t desc) void HELPER(sve_ftssel_h)(void *vd, void *vn, void *vm, uint32_t desc) { intptr_t i, opr_sz = simd_oprsz(desc) / 2; + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT, 1); uint16_t *d = vd, *n = vn, *m = vm; for (i = 0; i < opr_sz; i += 1) { uint16_t nn = n[i]; @@ -2562,13 +2563,17 @@ void HELPER(sve_ftssel_h)(void *vd, void *vn, void *vm, uint32_t desc) if (mm & 1) { nn = float16_one; } - d[i] = nn ^ (mm & 2) << 14; + if ((mm & 2) && !(fpcr_ah && float16_is_any_nan(nn))) { + nn ^= (1 << 15); + } + d[i] = nn; } } void HELPER(sve_ftssel_s)(void *vd, void *vn, void *vm, uint32_t desc) { intptr_t i, opr_sz = simd_oprsz(desc) / 4; + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT, 1); uint32_t *d = vd, *n = vn, *m = vm; for (i = 0; i < opr_sz; i += 1) { uint32_t nn = n[i]; @@ -2576,13 +2581,17 @@ void HELPER(sve_ftssel_s)(void *vd, void *vn, void *vm, uint32_t desc) if (mm & 1) { nn = float32_one; } - d[i] = nn ^ (mm & 2) << 30; + if ((mm & 2) && !(fpcr_ah && float32_is_any_nan(nn))) { + nn ^= (1U << 31); + } + d[i] = nn; } } void HELPER(sve_ftssel_d)(void *vd, void *vn, void *vm, uint32_t desc) { intptr_t i, opr_sz = simd_oprsz(desc) / 8; + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT, 1); uint64_t *d = vd, *n = vn, *m = vm; for (i = 0; i < opr_sz; i += 1) { uint64_t nn = n[i]; @@ -2590,7 +2599,10 @@ void HELPER(sve_ftssel_d)(void *vd, void *vn, void *vm, uint32_t desc) if (mm & 1) { nn = float64_one; } - d[i] = nn ^ (mm & 2) << 62; + if ((mm & 2) && !(fpcr_ah && float64_is_any_nan(nn))) { + nn ^= (1ULL << 63); + } + d[i] = nn; } } diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 663634e3a39..2d70b0faad2 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -1238,14 +1238,14 @@ static gen_helper_gvec_2 * const fexpa_fns[4] = { gen_helper_sve_fexpa_s, gen_helper_sve_fexpa_d, }; TRANS_FEAT_NONSTREAMING(FEXPA, aa64_sve, gen_gvec_ool_zz, - fexpa_fns[a->esz], a->rd, a->rn, 0) + fexpa_fns[a->esz], a->rd, a->rn, s->fpcr_ah) static gen_helper_gvec_3 * const ftssel_fns[4] = { NULL, gen_helper_sve_ftssel_h, gen_helper_sve_ftssel_s, gen_helper_sve_ftssel_d, }; TRANS_FEAT_NONSTREAMING(FTSSEL, aa64_sve, gen_gvec_ool_arg_zzz, - ftssel_fns[a->esz], a, 0) + ftssel_fns[a->esz], a, s->fpcr_ah) /* *** SVE Predicate Logical Operations Group From patchwork Fri Jan 24 16:28:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859603 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp887343wrq; Fri, 24 Jan 2025 08:45:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW9vp/zpRRJaZgy3GEf3qiuWyWcjoCblcTYU7Sx8utaQLYqe7OIMJmJgVqx3c304ron6gpe+Q==@linaro.org X-Google-Smtp-Source: AGHT+IFrsllDML0/7vC3ZRWxRIMYdIbwnD5Fut+B2BwZFptCHF70BqFH381QakfFq7mrD8CiHw92 X-Received: by 2002:a05:6102:cd4:b0:4b2:c105:dc40 with SMTP id ada2fe7eead31-4b690bfc8c0mr28547197137.8.1737737128666; Fri, 24 Jan 2025 08:45:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737128; cv=none; d=google.com; s=arc-20240605; b=Dt3l4k0Rx5mfsC/nojuQOm1kM6BC3IQ9qsJlwhSGftY+u0LQOHNL9LPlsE8MLMioFE P60s77xCWP++aa7miZkr5Xp5xOWHFmL8pn16TInydPxUusFD7d6TV5tymnSXIAKZmniZ nX44FrTSJ9SumaBURF9zvHqutnpuSdcR696PBi36Xo0lDAWunHzYW5WywzD09KpXkitI M9HGjr/ZjhJGPzFEQTMGHZ0VaNpeTgpHhJC/Kl2aT99vKejzyvs8fz4kqsBE3PqAuE9l B+M1Oe7ll4udBvHcXSF9LRN/g5LBxe8/nAGy8g0ORWAyk3bYYdvQNxPGnWrLlL3K8O/u bNuA== 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=KUOVCjsqK9P972q7q40ePDcGfBy7iqRLI3g1W6aCg3E=; fh=NFM1RF54mRhE3ZBtDvBQbEm0gFBruLt4IfYZYodKtpI=; b=aU2P+rFQR1wfCbmW8ua7XSBMN90cuIrl2WnxxgQePp37H0kEuqFicMESNNUYEh4Gpp xzFcJN7tSnUBol/9oTPQ3JNZEGlcsq1fn2mmsjAiwMD+Xuuw0Y+PQMN8mzrRRpaJ/U/7 51803AbNb8a3jbjD4DaK6D2x4K9P3oC5YNiv6NSxo9TKXv1RskbE85M3cv9ce8rwiSnY xm1F6Zp9CNeEAow39d2E14tOItwTJL9bvszDCk4IHFbml488zHv7UZJQ/qVDojfAzE0B uj4CBeSWpt0YdvJJ/VAAOJX+0FvmUCpNNjxSAOuopzQbzExXLxZvVNn/gD9euecEi+Yj UtUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tsRBJL1q; 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 ada2fe7eead31-4b709a2dc33si851335137.657.2025.01.24.08.45.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:45:28 -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=tsRBJL1q; 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 1tbMgq-000782-GK; Fri, 24 Jan 2025 11:37:52 -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 1tbMZa-00065c-3v for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:28 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZR-0005pY-LP for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:21 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-43618283d48so16770405e9.1 for ; Fri, 24 Jan 2025 08:30:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736203; x=1738341003; 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=KUOVCjsqK9P972q7q40ePDcGfBy7iqRLI3g1W6aCg3E=; b=tsRBJL1qQ+rGlAs/eUK4Wtm0TkWIiXYOhvEWI/EIhRAveKQkwQZKhuzdOD3YrhI2kz 6S/cTYreYpjh9nJNetFH6qGgoNqo49QP4r9uZUSs6MFaOiF6cxNuoPD300F6a2OsKCKC bAbZA/8xunfb4Fsq7HRJ1OUtPvci6XcpAXF1gcvr0/gFsXWXlF+o0F4aVhYEazbqBjdM ghrvasx4dtgJbkhlP0BXkrwAm/HByezGIH81a62v6ULZwt+u8j9xTLUDfVnwx0UCCaW8 OxUr6GMWqJMQmPSdkjfhR+N1YEAisva9833ZT/0BhNUriIIdM3p2bEmOs8p/0Alhfk0z /t0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736203; x=1738341003; 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=KUOVCjsqK9P972q7q40ePDcGfBy7iqRLI3g1W6aCg3E=; b=L3/ZfXoKdLqGm2oS9zw8p/N3OqKHxKy3GQNchj7FDz1Xwhb9O/pI0ev+yqmk9A2Bpt veZSzNEp8CnEaIZlte+ArgBlrqZOHf12LhLjelzAPG5nMBYVR0zuLhethSizRH8573lG 5s9/I2kWKfwrALWzxJjNmusGWMYCJDslJ+dj7bDjMeHhC93EzrGAOaKV4XKCpPom1bOX d4Ee8N9ylBcAn9GYWumlnfkZmnoJI1kDhk5aWrWQ8W4eTa/CqLOl0gKwdVaO5sszCJKn TTC2djecyK2KC0JCEyWIvr6xaAqnillbRhths9N8TkP9/B+hvTWrwcnm7CqjAuolgPGQ KD+w== X-Forwarded-Encrypted: i=1; AJvYcCWmXitjxJbuxgRsJuK3l6b26LO5QE7TQfJbgSRGL6bMAlBKuS8KRQKO3+HRcazSN29nnh0lqWd8KoIy@nongnu.org X-Gm-Message-State: AOJu0YwWJi6LE0fEzbPL5ob2crAmHP74VBKcasEJvDGRKw1zfwwRQPOA fOIv9jTMh9zr/oh686xVSUQWD9inkF4mPJ6BtC6eTVH44Ac3Y1JuDEPk2/uhZoIJH7cK2QGPbc4 Y X-Gm-Gg: ASbGncvndc4DAUAaGAfGwOuZO3DLBcHqaFniuhxtCyBXBv2qbquOgh+ijFrpH3qW/LA E1bETzcVKsGYS7T3cvYha8i/gI4YYlROTgTh3CmFJlqx5qeo54TMyt8wZmiovfjlA8HE64wbC6k PhvY0Ow8WLfZiWc1wKJfEuoTcx6NXjenzrBixy5C0QaQcf2+OK8N/ckDEETfQ6l0lRA2RnHjCFs xHoeYaqWLHqHcJXhm4iVDcd/PRrtk4/wfVZ0U8fGRcSShw9TDF33Cm/H/2HhoOn0aY+UGA7Jtrc QPc1ILoefoE= X-Received: by 2002:a05:600c:1da8:b0:434:a711:ace4 with SMTP id 5b1f17b1804b1-4389eca3ca1mr301479515e9.17.1737736202805; Fri, 24 Jan 2025 08:30:02 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:02 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 67/76] target/arm: Handle FPCR.AH in SVE FTMAD Date: Fri, 24 Jan 2025 16:28:27 +0000 Message-Id: <20250124162836.2332150-68-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 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 negation step in the SVE FTMAD insn mustn't negate a NaN when FPCR.AH is set. Pass FPCR.AH to the helper via the SIMD data field and use that to determine whether to do the negation. Signed-off-by: Peter Maydell --- target/arm/tcg/sve_helper.c | 21 +++++++++++++++------ target/arm/tcg/translate-sve.c | 3 ++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index a39a3ed0cf9..3f38e078291 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -5143,13 +5143,16 @@ void HELPER(sve_ftmad_h)(void *vd, void *vn, void *vm, 0x3c00, 0xb800, 0x293a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; intptr_t i, opr_sz = simd_oprsz(desc) / sizeof(float16); - intptr_t x = simd_data(desc); + intptr_t x = extract32(desc, SIMD_DATA_SHIFT, 3); + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT + 3, 1); float16 *d = vd, *n = vn, *m = vm; for (i = 0; i < opr_sz; i++) { float16 mm = m[i]; intptr_t xx = x; if (float16_is_neg(mm)) { - mm = float16_abs(mm); + if (!(fpcr_ah && float16_is_any_nan(mm))) { + mm = float16_abs(mm); + } xx += 8; } d[i] = float16_muladd(n[i], mm, coeff[xx], 0, s); @@ -5166,13 +5169,16 @@ void HELPER(sve_ftmad_s)(void *vd, void *vn, void *vm, 0x37cd37cc, 0x00000000, 0x00000000, 0x00000000, }; intptr_t i, opr_sz = simd_oprsz(desc) / sizeof(float32); - intptr_t x = simd_data(desc); + intptr_t x = extract32(desc, SIMD_DATA_SHIFT, 3); + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT + 3, 1); float32 *d = vd, *n = vn, *m = vm; for (i = 0; i < opr_sz; i++) { float32 mm = m[i]; intptr_t xx = x; if (float32_is_neg(mm)) { - mm = float32_abs(mm); + if (!(fpcr_ah && float32_is_any_nan(mm))) { + mm = float32_abs(mm); + } xx += 8; } d[i] = float32_muladd(n[i], mm, coeff[xx], 0, s); @@ -5193,13 +5199,16 @@ void HELPER(sve_ftmad_d)(void *vd, void *vn, void *vm, 0x3e21ee96d2641b13ull, 0xbda8f76380fbb401ull, }; intptr_t i, opr_sz = simd_oprsz(desc) / sizeof(float64); - intptr_t x = simd_data(desc); + intptr_t x = extract32(desc, SIMD_DATA_SHIFT, 3); + bool fpcr_ah = extract32(desc, SIMD_DATA_SHIFT + 3, 1); float64 *d = vd, *n = vn, *m = vm; for (i = 0; i < opr_sz; i++) { float64 mm = m[i]; intptr_t xx = x; if (float64_is_neg(mm)) { - mm = float64_abs(mm); + if (!(fpcr_ah && float64_is_any_nan(mm))) { + mm = float64_abs(mm); + } xx += 8; } d[i] = float64_muladd(n[i], mm, coeff[xx], 0, s); diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 2d70b0faad2..26bdda8f96e 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3682,7 +3682,8 @@ static gen_helper_gvec_3_ptr * const ftmad_fns[4] = { gen_helper_sve_ftmad_s, gen_helper_sve_ftmad_d, }; TRANS_FEAT_NONSTREAMING(FTMAD, aa64_sve, gen_gvec_fpst_zzz, - ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm, + ftmad_fns[a->esz], a->rd, a->rn, a->rm, + a->imm | (s->fpcr_ah << 3), a->esz == MO_16 ? FPST_FPCR_F16_A64 : FPST_FPCR_A64) /* From patchwork Fri Jan 24 16:28:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859622 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp890162wrq; Fri, 24 Jan 2025 08:51:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXgUXX/LyqHZr109oH3icqZbAXLDWIAsVj8wjPNxZgasrBPlutItgMyLOnjFS3muJtFID1Q3w==@linaro.org X-Google-Smtp-Source: AGHT+IHMlytle5+5NWrrJdgC+N7k1qBmGgZLdeZuSEGEF3rztu1Om2z+dAvecmI6A+0SZXcr9Fvh X-Received: by 2002:a05:620a:1a8d:b0:7b6:7a7b:1a4 with SMTP id af79cd13be357-7be63249b24mr4663399185a.27.1737737518943; Fri, 24 Jan 2025 08:51:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737518; cv=none; d=google.com; s=arc-20240605; b=XnGP5NE2DPzf3mGG+smoQi+FOa/rqfxrxa6B1Nivpg1JoHCoXDaLwJbENSL5WFKdIj zSJiBynY3ggz3Y7wx0ZoL+WE0OZFU7H8gr0T6tXSMLC9NR1qv2A66rrznXyCg1dtbc0+ qi6InJXJbjoWULn60G0RkyRMP0p9MJS3akYgmLQM2+xOzQV1yflWiAcIiKGKXaAB0q6O r8OJPoLsZl9o4jUwkMy/TR8itTvZv2FSdWS+0s8URDBtaIW/QIf5FHrs4kSyyPUIOpBO v08ju81viA3nWA86IbI1m+MATin/gXxSZ9Y8QmaP4Y0IqksCVCF0KgjMMF95V0PoeqfX kdxQ== 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=ol6wjs2XXi3PGGKevFQFr1g6AWQeoCb1SFBUJSxPQd4=; fh=6jA2Wr/uZb62sdy9vpxBMSeqf8qV1fmyMveLjj8XBFY=; b=EC75YSE9FvNTUjeFa6oeeL07PhcIhbFWqIRP3c3LgKw4m9SSuux4FM667Whe16ErQV HlJzGkgR3pNopHrO2cWyA9uRlWdr7mOhi97G+v3jpZ6/d5SPYIhUC6pTADS7UkF/gq17 oGbAPAu3zeYw2AiW/O3SRB1dGvI3ZOiGkcE1KytnKzwE8D9h98+zprpfTKMFheHqeIGA I9/e7L9sBo9oFpIgHONBe4buwJJcovXZo4IKKxQ3AsZzxClbVDhP90OAoAcMRZJMS5hp 67RknIYoQczcLB27+zjfsOAqW35g6STVwbuaHAGMwzn2KKkxOk+DMF3LiMfODc7c6xIF Sj9A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MUsfNPJS; 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-7be9af1156fsi268021585a.487.2025.01.24.08.51.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:51:58 -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=MUsfNPJS; 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 1tbMgl-0006ss-5b; Fri, 24 Jan 2025 11:37:47 -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 1tbMZa-00065Y-3O for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:28 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZR-0005pi-KC for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:21 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-436ce2ab251so15095615e9.1 for ; Fri, 24 Jan 2025 08:30:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736204; x=1738341004; 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=ol6wjs2XXi3PGGKevFQFr1g6AWQeoCb1SFBUJSxPQd4=; b=MUsfNPJSrZyJxcIonXbUjb0dIzlMxExGBMzarZ9q0XS+IL+rnBcgs8gHzjFlq8x9Wk hVH/BE3ecc0xAJRnX2UNxu+OUtCUUrTFwGjz0rZBSHnGHIjzeWMnDbOj6llzT2UZ5jeT UTLaFwXHR8w/1/x2vTXYMIDBqI/DBFhgOkNYq4kx8NSVdiMDWpCR7YjwsOhWR3+W6n4J HGDxapOwzFEX29IZ0cF2Cb+Uz9dClEtOr8i/zhrKE5LEMoRj95ETmFDMG7btIhv3HIjL 8Kp/BS+yAJ0sKvvsn2jUTDY6Vq8JoR711Mg1U32+EQ+8yJyMBRhSqvzUu/KPLutGHx9u n2lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736204; x=1738341004; 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=ol6wjs2XXi3PGGKevFQFr1g6AWQeoCb1SFBUJSxPQd4=; b=nh+ZXKA9Pv6+tlIzxuSq0J6h61VGjn52qW5Ie7dzwUc8anyhhhSmzwxKG6DsRyIPOn PfRYMb7BDGLL1wJl6kQVyj2NbQM9XShpK2ASHODL2irrBbEocCmSru/mfF/m9rTgPwaP vXPX4LrqT996hoHC6vLkCbkJOwo1MgHdolT9wkayyrQO+0MLMpL/TO2aF2N6TmW/h4+T w4xYDw9/HTBgF3LS/7mv2vzxXuoHAA51fjrbaM6iYmIIGqSu9azCo34vvqrGwumGYgxQ tl/RD061FfPYxskx+0E/rMb/HBNldnBwRtutsn++z7zQvuJiOQMik+Q7z/a3xauR46du 8Oow== X-Forwarded-Encrypted: i=1; AJvYcCV7+F3+TzVuYpZKnx85nrSdck1bqi/TPCATRKHuJx/QeWb4DR9eaxj8Pi2FVExedbu/8x7B6bGO4I4L@nongnu.org X-Gm-Message-State: AOJu0YwUftB9xp4a24ctav7OnLc4vNLDYEJKQOyitNSkjiTH98FLNMSS CJMkXSLotDMzrdY3H90kKGmvOuL3Beev2e9BZzLva2rbVBi0f1FUOYmbHTDQwyc= X-Gm-Gg: ASbGncvaMiE5QjoG9T6IHIG+ALdLAnzZdq+EngbPjvEtyCQ46Yri7SlSSyWyVkfLWXN qS+Q+s9cj0bPVeZZymgulAn2gVdcnLT4B4KQNhrCA7Blc+bumZ3y9P80/R3OjxLnSKkRx4meKjw dF5d070h0UQ6iYqtC4oRcADP1TIJW4TbqpdZ76aBhppCto45vcbf4cl8iW9vCi5bya60s1R9rl+ YhGrvm93qKmhhJj8K6BnQzKXtDINFr2f8AJk3I7+wERhi5Sgb52A2lJQ8nLAcAGsrc4LQXvef3I 66WKCTMN5Iw= X-Received: by 2002:a05:600c:4e89:b0:434:f739:7ce3 with SMTP id 5b1f17b1804b1-438913cb518mr283514855e9.8.1737736203723; Fri, 24 Jan 2025 08:30:03 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:03 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 68/76] target/arm: Enable FEAT_AFP for '-cpu max' Date: Fri, 24 Jan 2025 16:28:28 +0000 Message-Id: <20250124162836.2332150-69-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Now that we have completed the handling for FPCR.{AH,FIZ,NEP}, we can enable FEAT_AFP for '-cpu max', and document that we support it. Signed-off-by: Peter Maydell --- docs/system/arm/emulation.rst | 1 + target/arm/tcg/cpu64.c | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 60176d08597..63b4cdf5fb1 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -20,6 +20,7 @@ the following architecture extensions: - FEAT_AA64EL3 (Support for AArch64 at EL3) - FEAT_AdvSIMD (Advanced SIMD Extension) - FEAT_AES (AESD and AESE instructions) +- FEAT_AFP (Alternate floating-point behavior) - FEAT_Armv9_Crypto (Armv9 Cryptographic Extension) - FEAT_ASID16 (16 bit ASID) - FEAT_BBM at level 2 (Translation table break-before-make levels) diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c index 93573ceeb1a..0bc68aac177 100644 --- a/target/arm/tcg/cpu64.c +++ b/target/arm/tcg/cpu64.c @@ -1218,6 +1218,7 @@ void aarch64_max_tcg_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* FEAT_XNX */ t = FIELD_DP64(t, ID_AA64MMFR1, ETS, 2); /* FEAT_ETS2 */ t = FIELD_DP64(t, ID_AA64MMFR1, HCX, 1); /* FEAT_HCX */ + t = FIELD_DP64(t, ID_AA64MMFR1, AFP, 1); /* FEAT_AFP */ t = FIELD_DP64(t, ID_AA64MMFR1, TIDCP1, 1); /* FEAT_TIDCP1 */ t = FIELD_DP64(t, ID_AA64MMFR1, CMOW, 1); /* FEAT_CMOW */ cpu->isar.id_aa64mmfr1 = t; From patchwork Fri Jan 24 16:28:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859629 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp892279wrq; Fri, 24 Jan 2025 08:56:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUYFW103iCRoec++XrKvmuNPZuEbi5a++udhEZNZdEshRKCsQx5In8wDna3a7n8EC4NsZNU2A==@linaro.org X-Google-Smtp-Source: AGHT+IEKXZ9/cioDe1jn+wd8Pji/lKN8fxuD0XQPaSOdZ3HfaN5Nems+zAExidV4OHZ7FAjxOTtB X-Received: by 2002:a05:6102:3712:b0:4b1:14f3:5d6d with SMTP id ada2fe7eead31-4b690bc6bc7mr25485669137.6.1737737819542; Fri, 24 Jan 2025 08:56:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737819; cv=none; d=google.com; s=arc-20240605; b=A66DrOJcpMHgtlgLEOIkRHKzLQ8nqIGFVeg4aYGxsVeX6wYMpTHM6jrCuNDoQJJP5i NGCZoJ8j/uagX9u73RA5aUo66wcDyFCe648xT2gD/nr68bL2CxlfHb9v9sTy2F8xunN7 Qmm57gnv447hzFMML9BR0w/pKR+/NUoNo8GjEQGaP+0pzZba49hXFmSgua4J8LDbcc64 OEIvLUC5QyH4ydKkGy1myFvtmEzr3NDRzq6QpPYhhRIc/vr7613MCTnjecO+7m9hmSUq LuTRhpJI8WnU7UwIkkpAqGdnkgtUeHzl7FYa4vIHNYv9W//XOxJW5kzrySoXr/XbFEMs pMVA== 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=OvRLjmTLeMLqpQAceAkdSOX3ePjKfhM6kYjWkG/iUUU=; fh=6eJoRncMBtU9H4+VxbYkVM8ZF8Y2zS9jNq0HGNihBX0=; b=CC6dEincYXnrvaLY0NkAaDMrKff95dk7lhkJJWeq21o3r0gycxbViPevQzL7Hw+oo9 uXEzGJHO+/2/41ydRNVmp3c9zO82LInaTAClX45kxCbT4dGamMttl7t4jXAsxI4NSoa+ kmB+RD029WFQQqUQLTOgO1sR9AEBI8ID2y6yrzKWoSeozUVrsvnrLCE+/CGP50GrYeAI AdiBW7hTOLMlot0i+dJNvsNlqmjBPhq5N6IlZbV+O8XU4XAZlL9PLq1iXjUjcywm5xaO RsCfo2JAcSd6IGwWryS0GTnxIqJhNvx8mtuhF3u041b9MjT6nPavoNG9ZoicsGsb5zUl YgrA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+rI1Ti9; 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 a1e0cc1a2514c-864a9d0a5a3si744165241.144.2025.01.24.08.56.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:56:59 -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=P+rI1Ti9; 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 1tbMgp-00073D-1I; Fri, 24 Jan 2025 11:37:51 -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 1tbMZh-0006B4-LJ for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:32 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZZ-0005qt-Qx for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:28 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-436a03197b2so15868495e9.2 for ; Fri, 24 Jan 2025 08:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736205; x=1738341005; 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=OvRLjmTLeMLqpQAceAkdSOX3ePjKfhM6kYjWkG/iUUU=; b=P+rI1Ti9a+RvGvo5jfvgqHdwfrWKvI5TxnOtZsPaycGksyQhtNe05V3HAgkJq58oDw ITfmQwTyj8zC7m6BSg7TK2U0U3nxEvI+7j09PSrQv7AfsQjbxCzcFnnF5zzQs7fJE22T O+NfakfIhvgNPnZ1P2FdacywrEvTjOqbyaOS0HKwZ/BOwQrndqyDQ1CeAdpannn6zmja 9AFcBOHiOwHevkBcLLVUWHdoICeh7jKuiLROObalWq7INMR4+9E/nq6W1xNtN53eQJ/S wdTnQrnSKoDCyOMW3xknjMwaIEqAW4kLLMKg8wFfZopFHDiWwC4gTiojNUOH4HirCOXj 1SFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736205; x=1738341005; 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=OvRLjmTLeMLqpQAceAkdSOX3ePjKfhM6kYjWkG/iUUU=; b=kcJhIGrOeehbhyx3KGzs2sSOmVoI9yO9gG1DkLYhuxfYFSHRg/sLXHPwXXd73BDsYb CXiWZvaSSXaP0mb1xpuJD7xGHqkkrLKdSjbiokS3d4mF6dQTmxkmb24WRDE745U6/kcJ 6L3XJUIb5DyO5TJO7cMHomS20IPTKiWFGA4glVALnRd90/V8NYYhG4K8baFwgPrFfod3 1zGa6mgpG8zvQrNauT8GSoqGFwdUVfT9xp9jbdzE0ZUGMBYf1VTTEcjISM5kzxZsWKRs 7+3ebsV7r1k8Rug0Y5nuyRGQisJ3WkNUT3R9VAl3ze3zu5f7yjAODtMPxLnRs0p2j4Nu gf7A== X-Forwarded-Encrypted: i=1; AJvYcCUr7V4vplx0RIWbvPkI2CVBFCylPX+cxyG5fJTSexGafllli032resnzYHXuyigtwRAGXM2VkJuJ50n@nongnu.org X-Gm-Message-State: AOJu0Ywz7tn5y7ly3w1bt5hykxkPK3iG9R9JGSZEyqJVkfVqSVBrDCYu WGs/sBNySkTKjaTLNEZEPuwrcl7SfoJatsEVNEkDmCYI9wKk/H+FvxFElNyelcM= X-Gm-Gg: ASbGncv/ksbwuKmygTwaWDuzpHO9FM3Tt4epdMqCATBKSx+2GqotX+FqGc/st+2shJp /LLmXvPW6Ks4b+blxD8EW2bmN9iEuyxF6ISpu7LRYciOISFCEuk3UFzhJxIZ4a+BYlcp1286i4J 2PtOy6k559TQ0yE44pqsIb92JG3nYflI8dy0Q2fSera1rSHsg1YjEOw+qZVy/LRae1/CFV+iptB c3BuLn0jxXd+QOuLOemwqeuecfQrGAfCBSFXCsSUI9B7idjwTVWjBHfHzdFxQncFg1v7QGzKHWp 6mcpM7X42I+T6IOxUVt2lg== X-Received: by 2002:a05:600c:3d97:b0:436:f960:3427 with SMTP id 5b1f17b1804b1-4389142745amr264698565e9.22.1737736205502; Fri, 24 Jan 2025 08:30:05 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:04 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 69/76] target/arm: Plumb FEAT_RPRES frecpe and frsqrte through to new helper Date: Fri, 24 Jan 2025 16:28:29 +0000 Message-Id: <20250124162836.2332150-70-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 FEAT_RPRES implements an "increased precision" variant of the single precision FRECPE and FRSQRTE instructions from an 8 bit to a 12 bit mantissa. This applies only when FPCR.AH == 1. Note that the halfprec and double versions of these insns retain the 8 bit precision regardless. In this commit we add all the plumbing to make these instructions call a new helper function when the increased-precision is in effect. In the following commit we will provide the actual change in behaviour in the helpers. Signed-off-by: Peter Maydell --- target/arm/cpu-features.h | 5 +++++ target/arm/helper.h | 4 ++++ target/arm/tcg/translate-a64.c | 34 ++++++++++++++++++++++++++++++---- target/arm/tcg/translate-sve.c | 16 ++++++++++++++-- target/arm/tcg/vec_helper.c | 2 ++ target/arm/vfp_helper.c | 32 ++++++++++++++++++++++++++++++-- 6 files changed, 85 insertions(+), 8 deletions(-) diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h index 7bf24c506b3..525e4cee12f 100644 --- a/target/arm/cpu-features.h +++ b/target/arm/cpu-features.h @@ -597,6 +597,11 @@ static inline bool isar_feature_aa64_mops(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, MOPS); } +static inline bool isar_feature_aa64_rpres(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, RPRES); +} + static inline bool isar_feature_aa64_fp_simd(const ARMISARegisters *id) { /* We always set the AdvSIMD and FP fields identically. */ diff --git a/target/arm/helper.h b/target/arm/helper.h index 0a8b4c946e1..dbad1f5d741 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -245,9 +245,11 @@ DEF_HELPER_4(vfp_muladdh, f16, f16, f16, f16, fpst) DEF_HELPER_FLAGS_2(recpe_f16, TCG_CALL_NO_RWG, f16, f16, fpst) DEF_HELPER_FLAGS_2(recpe_f32, TCG_CALL_NO_RWG, f32, f32, fpst) +DEF_HELPER_FLAGS_2(recpe_rpres_f32, TCG_CALL_NO_RWG, f32, f32, fpst) DEF_HELPER_FLAGS_2(recpe_f64, TCG_CALL_NO_RWG, f64, f64, fpst) DEF_HELPER_FLAGS_2(rsqrte_f16, TCG_CALL_NO_RWG, f16, f16, fpst) DEF_HELPER_FLAGS_2(rsqrte_f32, TCG_CALL_NO_RWG, f32, f32, fpst) +DEF_HELPER_FLAGS_2(rsqrte_rpres_f32, TCG_CALL_NO_RWG, f32, f32, fpst) DEF_HELPER_FLAGS_2(rsqrte_f64, TCG_CALL_NO_RWG, f64, f64, fpst) DEF_HELPER_FLAGS_1(recpe_u32, TCG_CALL_NO_RWG, i32, i32) DEF_HELPER_FLAGS_1(rsqrte_u32, TCG_CALL_NO_RWG, i32, i32) @@ -680,10 +682,12 @@ DEF_HELPER_FLAGS_4(gvec_vrintx_s, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(gvec_frecpe_h, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(gvec_frecpe_s, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_4(gvec_frecpe_rpres_s, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(gvec_frecpe_d, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(gvec_frsqrte_h, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(gvec_frsqrte_s, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) +DEF_HELPER_FLAGS_4(gvec_frsqrte_rpres_s, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(gvec_frsqrte_d, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) DEF_HELPER_FLAGS_4(gvec_fcgt0_h, TCG_CALL_NO_RWG, void, ptr, ptr, fpst, i32) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 0b57e35f999..3e2fe46464f 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -8909,7 +8909,14 @@ static const FPScalar1 f_scalar_frecpe = { gen_helper_recpe_f32, gen_helper_recpe_f64, }; -TRANS(FRECPE_s, do_fp1_scalar_ah, a, &f_scalar_frecpe, -1) +static const FPScalar1 f_scalar_frecpe_rpres = { + gen_helper_recpe_f16, + gen_helper_recpe_rpres_f32, + gen_helper_recpe_f64, +}; +TRANS(FRECPE_s, do_fp1_scalar_ah, a, + s->fpcr_ah && dc_isar_feature(aa64_rpres, s) ? + &f_scalar_frecpe_rpres : &f_scalar_frecpe, -1) static const FPScalar1 f_scalar_frecpx = { gen_helper_frecpx_f16, @@ -8923,7 +8930,14 @@ static const FPScalar1 f_scalar_frsqrte = { gen_helper_rsqrte_f32, gen_helper_rsqrte_f64, }; -TRANS(FRSQRTE_s, do_fp1_scalar_ah, a, &f_scalar_frsqrte, -1) +static const FPScalar1 f_scalar_frsqrte_rpres = { + gen_helper_rsqrte_f16, + gen_helper_rsqrte_rpres_f32, + gen_helper_rsqrte_f64, +}; +TRANS(FRSQRTE_s, do_fp1_scalar_ah, a, + s->fpcr_ah && dc_isar_feature(aa64_rpres, s) ? + &f_scalar_frsqrte_rpres : &f_scalar_frsqrte, -1) static bool trans_FCVT_s_ds(DisasContext *s, arg_rr *a) { @@ -9954,14 +9968,26 @@ static gen_helper_gvec_2_ptr * const f_frecpe[] = { gen_helper_gvec_frecpe_s, gen_helper_gvec_frecpe_d, }; -TRANS(FRECPE_v, do_gvec_op2_ah_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frecpe) +static gen_helper_gvec_2_ptr * const f_frecpe_rpres[] = { + gen_helper_gvec_frecpe_h, + gen_helper_gvec_frecpe_rpres_s, + gen_helper_gvec_frecpe_d, +}; +TRANS(FRECPE_v, do_gvec_op2_ah_fpst, a->esz, a->q, a->rd, a->rn, 0, + s->fpcr_ah && dc_isar_feature(aa64_rpres, s) ? f_frecpe_rpres : f_frecpe) static gen_helper_gvec_2_ptr * const f_frsqrte[] = { gen_helper_gvec_frsqrte_h, gen_helper_gvec_frsqrte_s, gen_helper_gvec_frsqrte_d, }; -TRANS(FRSQRTE_v, do_gvec_op2_ah_fpst, a->esz, a->q, a->rd, a->rn, 0, f_frsqrte) +static gen_helper_gvec_2_ptr * const f_frsqrte_rpres[] = { + gen_helper_gvec_frsqrte_h, + gen_helper_gvec_frsqrte_rpres_s, + gen_helper_gvec_frsqrte_d, +}; +TRANS(FRSQRTE_v, do_gvec_op2_ah_fpst, a->esz, a->q, a->rd, a->rn, 0, + s->fpcr_ah && dc_isar_feature(aa64_rpres, s) ? f_frsqrte_rpres : f_frsqrte) static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a) { diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 26bdda8f96e..454f7ff9008 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -3626,13 +3626,25 @@ static gen_helper_gvec_2_ptr * const frecpe_fns[] = { NULL, gen_helper_gvec_frecpe_h, gen_helper_gvec_frecpe_s, gen_helper_gvec_frecpe_d, }; -TRANS_FEAT(FRECPE, aa64_sve, gen_gvec_fpst_ah_arg_zz, frecpe_fns[a->esz], a, 0) +static gen_helper_gvec_2_ptr * const frecpe_rpres_fns[] = { + NULL, gen_helper_gvec_frecpe_h, + gen_helper_gvec_frecpe_rpres_s, gen_helper_gvec_frecpe_d, +}; +TRANS_FEAT(FRECPE, aa64_sve, gen_gvec_fpst_ah_arg_zz, + s->fpcr_ah && dc_isar_feature(aa64_rpres, s) ? + frecpe_rpres_fns[a->esz] : frecpe_fns[a->esz], a, 0) static gen_helper_gvec_2_ptr * const frsqrte_fns[] = { NULL, gen_helper_gvec_frsqrte_h, gen_helper_gvec_frsqrte_s, gen_helper_gvec_frsqrte_d, }; -TRANS_FEAT(FRSQRTE, aa64_sve, gen_gvec_fpst_ah_arg_zz, frsqrte_fns[a->esz], a, 0) +static gen_helper_gvec_2_ptr * const frsqrte_rpres_fns[] = { + NULL, gen_helper_gvec_frsqrte_h, + gen_helper_gvec_frsqrte_rpres_s, gen_helper_gvec_frsqrte_d, +}; +TRANS_FEAT(FRSQRTE, aa64_sve, gen_gvec_fpst_ah_arg_zz, + s->fpcr_ah && dc_isar_feature(aa64_rpres, s) ? + frsqrte_rpres_fns[a->esz] : frsqrte_fns[a->esz], a, 0) /* *** SVE Floating Point Compare with Zero Group diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index c720b435d58..b369c9f45b3 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -1237,10 +1237,12 @@ void HELPER(NAME)(void *vd, void *vn, float_status *stat, uint32_t desc) \ DO_2OP(gvec_frecpe_h, helper_recpe_f16, float16) DO_2OP(gvec_frecpe_s, helper_recpe_f32, float32) +DO_2OP(gvec_frecpe_rpres_s, helper_recpe_rpres_f32, float32) DO_2OP(gvec_frecpe_d, helper_recpe_f64, float64) DO_2OP(gvec_frsqrte_h, helper_rsqrte_f16, float16) DO_2OP(gvec_frsqrte_s, helper_rsqrte_f32, float32) +DO_2OP(gvec_frsqrte_rpres_s, helper_rsqrte_rpres_f32, float32) DO_2OP(gvec_frsqrte_d, helper_rsqrte_f64, float64) DO_2OP(gvec_vrintx_h, float16_round_to_int, float16) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 50a8a659577..1b7ecc14621 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -839,7 +839,11 @@ uint32_t HELPER(recpe_f16)(uint32_t input, float_status *fpst) return make_float16(f16_val); } -float32 HELPER(recpe_f32)(float32 input, float_status *fpst) +/* + * FEAT_RPRES means the f32 FRECPE has an "increased precision" variant + * which is used when FPCR.AH == 1. + */ +static float32 do_recpe_f32(float32 input, float_status *fpst, bool rpres) { float32 f32 = float32_squash_input_denormal(input, fpst); uint32_t f32_val = float32_val(f32); @@ -888,6 +892,16 @@ float32 HELPER(recpe_f32)(float32 input, float_status *fpst) return make_float32(f32_val); } +float32 HELPER(recpe_f32)(float32 input, float_status *fpst) +{ + return do_recpe_f32(input, fpst, false); +} + +float32 HELPER(recpe_rpres_f32)(float32 input, float_status *fpst) +{ + return do_recpe_f32(input, fpst, true); +} + float64 HELPER(recpe_f64)(float64 input, float_status *fpst) { float64 f64 = float64_squash_input_denormal(input, fpst); @@ -1033,7 +1047,11 @@ uint32_t HELPER(rsqrte_f16)(uint32_t input, float_status *s) return make_float16(val); } -float32 HELPER(rsqrte_f32)(float32 input, float_status *s) +/* + * FEAT_RPRES means the f32 FRSQRTE has an "increased precision" variant + * which is used when FPCR.AH == 1. + */ +static float32 do_rsqrte_f32(float32 input, float_status *s, bool rpres) { float32 f32 = float32_squash_input_denormal(input, s); uint32_t val = float32_val(f32); @@ -1078,6 +1096,16 @@ float32 HELPER(rsqrte_f32)(float32 input, float_status *s) return make_float32(val); } +float32 HELPER(rsqrte_f32)(float32 input, float_status *s) +{ + return do_rsqrte_f32(input, s, false); +} + +float32 HELPER(rsqrte_rpres_f32)(float32 input, float_status *s) +{ + return do_rsqrte_f32(input, s, true); +} + float64 HELPER(rsqrte_f64)(float64 input, float_status *s) { float64 f64 = float64_squash_input_denormal(input, s); From patchwork Fri Jan 24 16:28:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859609 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp888320wrq; Fri, 24 Jan 2025 08:47:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV+KZDJHEHOKwImQrqrh0Wpa15n+UqOHdZHvWx66lZu0gjCwGIyE/9kKdNZUJvUqCQLKilnkQ==@linaro.org X-Google-Smtp-Source: AGHT+IFtMxYJ4SUijOgyx2hVWd8vaNJdYFV+Ja5aCg7lZvBesI+/T7/Le8zzdI+M2dZBUBFBMgPU X-Received: by 2002:a05:6102:1625:b0:4b2:ad50:a99c with SMTP id ada2fe7eead31-4b690b86c0fmr28483960137.2.1737737255045; Fri, 24 Jan 2025 08:47:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737255; cv=none; d=google.com; s=arc-20240605; b=LEmDz3V2dNcaEZkYhwhwewQYZodgMHbKuF4Ee/py7cJdSYMyEGRdB4C7itPKkN3829 2sw2tXqwUjX7HTaQFutxL94f/WuzgpfxAsp5ZBS1owze+INkf1KhKtITtS00rBPD9ZO3 Kbn5RLxD3jcpGU2SyOP91/5BbnBp8g8ghhRGUmIRu4SDs3vgPs9V3RdIStNHTv2rnBjQ 1Zeo2qbTLFcclcQHgJXNMiVTT72PnkwUQA+hH61QCLVphBRgjjbBCu1H6XVvucEJ5GmJ lgFx2dm6aLXwjIhHdCSHiGHqn437zSxtYD6qFOg/0eogJwnSE517ZTowDwUE4Pn6WL9+ ZtDA== 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=xCeU+LpcSryg5lQ4AtUsxFm/b07YhdAnNy4h4JOSVJ8=; fh=LhfnHoM05m6tkUDjX/Pq9kxNuwZmdj3KslqlW6YaN3A=; b=ij59dBsuNLZIhmw672xK9xVP/Q1b1RxaxUy06CxA1Cb22Ob2xQ5kS27rBs3qxZwO8i Nfpu5d4Fc6/qPX03+EqhEgA43cP4vCeUZXrWSFaXpVwwbL2WBbBIjWTnzbfguH/J36A/ v/k/3O/R4xhGTEFsAbMn/jqTI6SO3AjTLZdjYayH4KCoMJJ5UlcaNxmRixpNF7YnyL3t QmgbhnIuZcxOSD2tzf25whUelUAv0A9DBGZkDQFBDgPzueO7wxYlBz4mA4ktRLpE4MJN HGmzxG6Njo1lb6PzAxQ574mMeWrgm/Ed+SSRxytbG35kjm8g4hPhmAlwlur1jrfuig8C GZdg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jdpXH+DP; 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 ada2fe7eead31-4b709a2c791si805248137.683.2025.01.24.08.47.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:47:35 -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=jdpXH+DP; 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 1tbMgu-0007Db-2V; Fri, 24 Jan 2025 11:37:57 -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 1tbMZa-00065Z-3g for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:28 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZS-0005rD-K0 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:21 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso15353985e9.1 for ; Fri, 24 Jan 2025 08:30:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736207; x=1738341007; 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=xCeU+LpcSryg5lQ4AtUsxFm/b07YhdAnNy4h4JOSVJ8=; b=jdpXH+DPMjvvIWElio+xHOBN4syCyDgu6NcT74/DhVrqqe+nvfXjyRRTVsUb7M3hPU 5HrORUx079jZgAoMhFSRQZg734ohfPKHJZynkXqli/ts3adeB82PsVsosuo8xN4JulGl AbAMp/6B5Yy0LEKnFPNRJ6FgQ9U+zzBiJcwLd03X9M2FpHNIkUM7hiikQnXJs2arLpfz Z8snTo483KO0NSSh6jPMuVLewQXmGX88gU/m0vU8zVx448Lq/Mc48ndIRU6ZN14NExuZ NxtiuYVr5WJiPy3tThrhd4IO1e4xzkXqh+qHHwUl1Y8Ol0PmfVAU7h/ExnQ0KOrAFFEg L2KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736207; x=1738341007; 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=xCeU+LpcSryg5lQ4AtUsxFm/b07YhdAnNy4h4JOSVJ8=; b=X7FQJGhDwTfdP2QniTs3yv9q+J0XqjRYlPzKSAEsxsCtxEtV3ihuKt95rC6KFnlUPj 0+sehUJP1hzH4IwqoXyVn2W1IrRcTLxhFRM+De6Uf4n5Jsxf5cCBizHj+EjawdM6AOri MZTxH7652IFktUedC6eWwqTPjaL5Y2bZ2OgPmqnu3i2UwTzFHGWNiDoTuDCoMmGYCKN7 njn4qFHg18RxbQN4PI1GnDNd6OZPugWXv3AdaFXx5B5ZnCroawruucs62an2dc6/L508 YW6JtoIFW2GOya2XoIRsyNv6AwAe1VixOJGh2IfxKjUCZqTny5MMBPW9cl2vTPByNiKR o18g== X-Forwarded-Encrypted: i=1; AJvYcCVFmWoig5R+qEyH5zE+fg70v6x7wbJI0GMiXcJ+DhWy3Y5r7BrkQ9QNuExR8HKKv9nb949KZXW4iFEA@nongnu.org X-Gm-Message-State: AOJu0YwyS5lftaAn4gBu5sL9CpFxh2/0WpwhlkQCiDAX7PFPYoNeYLGK aiqLDo22atBDDi7jN5oQH1RL7LGqcSX+6ddPsxNUFPF1rzQmW7YgAmyAGG7KYlWqk6CIcf5GQla r X-Gm-Gg: ASbGncvdOuATobVcvmefv39NY7MMiM+D5n23fJnIuc/YVgblxeTxJ+Tf0lg4ArTia7f kQ1T6V8PCI+oma/gJApSW/THPV5Qeu2/hv3z7NbXNy2YaKSmG2D1KCNtF4hiPXHC9xTq0FaXy+a /nvyJ8DbkFaDI9s11eph3khEYkKdAHzZ3IB7DREHNkm8LTid55hBDFCdIxvSeUvwf3JbjVbOn2K LzXzsLJNnyoRU9SetEUI41T3pEPu3eBPUgoaOxbJ9Isj92NWSpMEOVWJtc0s5MG/Ds5QVZ9QJ4l FJrtFQv5VWE= X-Received: by 2002:a05:600c:5110:b0:42c:b8c9:16c8 with SMTP id 5b1f17b1804b1-438b885b8c1mr76545395e9.10.1737736207376; Fri, 24 Jan 2025 08:30:07 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:06 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 70/76] target/arm: Implement increased precision FRECPE Date: Fri, 24 Jan 2025 16:28:30 +0000 Message-Id: <20250124162836.2332150-71-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Implement the increased precision variation of FRECPE. In the pseudocode this corresponds to the handling of the "increasedprecision" boolean in the FPRecipEstimate() and RecipEstimate() functions. Signed-off-by: Peter Maydell --- target/arm/vfp_helper.c | 54 +++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 1b7ecc14621..79e58c5bb2a 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -731,6 +731,33 @@ static int recip_estimate(int input) return r; } +/* + * Increased precision version: + * input is a 13 bit fixed point number + * input range 2048 .. 4095 for a number from 0.5 <= x < 1.0. + * result range 4096 .. 8191 for a number from 1.0 to 2.0 + */ +static int recip_estimate_incprec(int input) +{ + int a, b, r; + assert(2048 <= input && input < 4096); + a = (input * 2) + 1; + /* + * The pseudocode expresses this as an operation on infinite + * precision reals where it calculates 2^25 / a and then looks + * at the error between that and the rounded-down-to-integer + * value to see if it should instead round up. We instead + * follow the same approach as the pseudocode for the 8-bit + * precision version, and calculate (2 * (2^25 / a)) as an + * integer so we can do the "add one and halve" to round it. + * So the 1 << 26 here is correct. + */ + b = (1 << 26) / a; + r = (b + 1) >> 1; + assert(4096 <= r && r < 8192); + return r; +} + /* * Common wrapper to call recip_estimate * @@ -740,7 +767,8 @@ static int recip_estimate(int input) * callee. */ -static uint64_t call_recip_estimate(int *exp, int exp_off, uint64_t frac) +static uint64_t call_recip_estimate(int *exp, int exp_off, uint64_t frac, + bool increasedprecision) { uint32_t scaled, estimate; uint64_t result_frac; @@ -756,12 +784,22 @@ static uint64_t call_recip_estimate(int *exp, int exp_off, uint64_t frac) } } - /* scaled = UInt('1':fraction<51:44>) */ - scaled = deposit32(1 << 8, 0, 8, extract64(frac, 44, 8)); - estimate = recip_estimate(scaled); + if (increasedprecision) { + /* scaled = UInt('1':fraction<51:41>) */ + scaled = deposit32(1 << 11, 0, 11, extract64(frac, 41, 11)); + estimate = recip_estimate_incprec(scaled); + } else { + /* scaled = UInt('1':fraction<51:44>) */ + scaled = deposit32(1 << 8, 0, 8, extract64(frac, 44, 8)); + estimate = recip_estimate(scaled); + } result_exp = exp_off - *exp; - result_frac = deposit64(0, 44, 8, estimate); + if (increasedprecision) { + result_frac = deposit64(0, 40, 12, estimate); + } else { + result_frac = deposit64(0, 44, 8, estimate); + } if (result_exp == 0) { result_frac = deposit64(result_frac >> 1, 51, 1, 1); } else if (result_exp == -1) { @@ -830,7 +868,7 @@ uint32_t HELPER(recpe_f16)(uint32_t input, float_status *fpst) } f64_frac = call_recip_estimate(&f16_exp, 29, - ((uint64_t) f16_frac) << (52 - 10)); + ((uint64_t) f16_frac) << (52 - 10), false); /* result = sign : result_exp<4:0> : fraction<51:42> */ f16_val = deposit32(0, 15, 1, f16_sign); @@ -883,7 +921,7 @@ static float32 do_recpe_f32(float32 input, float_status *fpst, bool rpres) } f64_frac = call_recip_estimate(&f32_exp, 253, - ((uint64_t) f32_frac) << (52 - 23)); + ((uint64_t) f32_frac) << (52 - 23), rpres); /* result = sign : result_exp<7:0> : fraction<51:29> */ f32_val = deposit32(0, 31, 1, f32_sign); @@ -941,7 +979,7 @@ float64 HELPER(recpe_f64)(float64 input, float_status *fpst) return float64_set_sign(float64_zero, float64_is_neg(f64)); } - f64_frac = call_recip_estimate(&f64_exp, 2045, f64_frac); + f64_frac = call_recip_estimate(&f64_exp, 2045, f64_frac, false); /* result = sign : result_exp<10:0> : fraction<51:0>; */ f64_val = deposit64(0, 63, 1, f64_sign); From patchwork Fri Jan 24 16:28:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859595 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp885951wrq; Fri, 24 Jan 2025 08:41:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWguVY9lRI92QyHLSqcnACLENkDXOsAKsvvLzRkZPSov2Jf0MKOFJLrwbUjbu0spgSm3lZQBQ==@linaro.org X-Google-Smtp-Source: AGHT+IE1ACw64Y3CF41Tfb8W6f5LHfA4JIaqGMIIEND13suYguZTEUDOAUMxCK+qhEVDeBOac45J X-Received: by 2002:a05:622a:130c:b0:466:9861:3e9c with SMTP id d75a77b69052e-46e12a9cacdmr415504451cf.31.1737736917305; Fri, 24 Jan 2025 08:41:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737736917; cv=none; d=google.com; s=arc-20240605; b=K4CpYoDOJuEf+NHooj1zr54+MzrYxtzgJ68SNVEZi4UN5wgGm7iHFQwNplJUPvVi5b O9Qzs+MDsediIv7uxQ49xbTYd82NELQKzFqDOBg3+wSUBz/ltUu7sVy4jX2PmOy1FKxy BiOhAgPaPzgbIkrhMt/0RD+ze24EfHG/knNAkjozfqCMjpFoNV4XKO9S+NUishO1yXT/ E8nJlDf1Jh7Fxv4K1VbrzbrMFdWDE7DuVSjNBxXbILWHnXLx16ZocEBmQR91P52tVpCP 0+vffll7w0o9jaRD0vqCoKGd7g9+S9p0kqkMowxvr3crFy3GHEFEL+HodnVcj05593tm rHVw== 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=vF2AaEc13GOjZXFd5xHueWajog0n73mmADepNcW83nk=; fh=em8nAwa6R4tMVUZfk4Rqj76REHee8DggrCMXJITPa68=; b=bs7xjmB6yjd/amnqi9epln2DYh8WwuL3dENJcy5xiiy8K+wTW365/nrgP/3oQZjc7H yCitWEfa0XP71h2FfymNSnPantbwN4OTbyDUH/kq0u6BjLZ2EVi10NGyaC/SENOTTTjN I+TRVBpqzCkQ7T2jhvf6j5KS0v8e24kk0aoQgOmQ1dhGp7cZtCWKSKoHXBQ5SoeqXfNm kWBErhfQyho9zFTZTFYGEoRiLW6+ryItt34R0xLmMrtAsSECOUH63xzjcm8x2u7y3wPU ZSvfNAN84FWykrXgeE/1DjysB6bqUhfSEmgNwuenpnkHMqZbTITn0cvdkWbcz67PyQ8L IcJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Kd/CAOUy"; 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-46e66b616dasi25646691cf.289.2025.01.24.08.41.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:41:57 -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="Kd/CAOUy"; 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 1tbMgm-0006ux-5i; Fri, 24 Jan 2025 11:37:48 -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 1tbMZY-00064L-72 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:28 -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 1tbMZR-00062p-MM for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:19 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4362f61757fso23853085e9.2 for ; Fri, 24 Jan 2025 08:30:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736210; x=1738341010; 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=vF2AaEc13GOjZXFd5xHueWajog0n73mmADepNcW83nk=; b=Kd/CAOUykEVGtdJaSe1sWeB6K97BzSroTIJ5rO8c086VeOWrLdog8+2hZUWtbqX779 UeCnOYc5Qs/D5yvsCuobiDRiX3yCWIk8hEtXjzXax59QbytobZ2LzsPZpRAVZ2M40zOt Spi8b5T27EsQX7qFpj2azPr68btVz8ujfwE2DQmiGVsEnt5dmKpdRmajalfmiqqhwsPN CysJDHV80A2g7nfNoNOcEJ69sLcH88+IR8XW/EyYK/LKHmyLryCmb5sU5YlZLSUN6wtu F7K71TaT94GMnl27/od/2A7mo5ydUCXdu14n9vySN40XmnDbTqARGsJKfKsdylQ80O0A Lm/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736210; x=1738341010; 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=vF2AaEc13GOjZXFd5xHueWajog0n73mmADepNcW83nk=; b=cGvuMo5TCXy0iK7MpomUnlu9J46+GnrB2abjlWjlc9gHCnq2C00zkq+KEZwZiEZJSx bHYZfrw5IjqiMsYs/CDcwVO1qqMVREWZw3sTa9e1YCHNw9rCM2h+NuM5LqZwb8EJ9JuY 9Q7K9k6+Z95FnqfL6qYVZ4+3MGBY0saciqx4oASdVMkhmSVKI1pX7HCvAW/PBVv0fKLP YycJgntR+Av+57D1OwL++EN6COmSkBvFkjkQvrfk2eXTWqe/Yet7UJlbMyNLKpNQr1ri rYv9OOTzWdpLFbJBPgpRYZkgQLpQaknENAaQ5LL5PS8tcLsOkFyL8oGUspIxuT8tTCMm UAZg== X-Forwarded-Encrypted: i=1; AJvYcCXW+i/wU+aFolZ3pdV+pfzvIP95JBJ2H60XPkgoIAVhSAKBDrI0HdjHUJq35fBqlKdr1vNhegtRnWGk@nongnu.org X-Gm-Message-State: AOJu0YwzQNJc77hy6uVSiEJduPK9Dp9Dm7OEypYRo0pDUa10wCWa0oS8 mh5j6QBDlzGSf91DVqoaUPI+3MWwEc4Ag01xc+SXdbsaRjwjNIxkn8XY1nqKul7VGsgQeYJQQbV B X-Gm-Gg: ASbGncvM7Z0Xld70FRZvnfn7HI3XF1dvFQVHJmaZKqWcx50E4OS8lkhArUfXWYpkG7k y8UxJ3iGhXwYr5bSkz17utwjiVnftsHNGPylTZY5F+tR4LOHnxJVljh2yf4oyX9bULN3m91GLST OEnPUoysnWmE8xTnrnq3HMSNmd4yGl9vIbgwUrneBEm6NOrAJdohD4QHjitzB6LctWM5zTp9VCP 8WoXSJZ8Xjj6JDIDGDhH8kCXQF/69cBbNnAJxZpQY5OViMH2W/1zNqZdpDd/Xc/ggHEuG7yVmDP qTXThv3hNKY= X-Received: by 2002:adf:e404:0:b0:38b:f074:214c with SMTP id ffacd0b85a97d-38bf5674039mr18896227f8f.30.1737736208512; Fri, 24 Jan 2025 08:30:08 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:07 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 71/76] target/arm: Implement increased precision FRSQRTE Date: Fri, 24 Jan 2025 16:28:31 +0000 Message-Id: <20250124162836.2332150-72-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Implement the increased precision variation of FRSQRTE. In the pseudocode this corresponds to the handling of the "increasedprecision" boolean in the FPRSqrtEstimate() and RecipSqrtEstimate() functions. Signed-off-by: Peter Maydell --- target/arm/vfp_helper.c | 77 ++++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 13 deletions(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 79e58c5bb2a..e63455c4bb9 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -1013,8 +1013,36 @@ static int do_recip_sqrt_estimate(int a) return estimate; } +static int do_recip_sqrt_estimate_incprec(int a) +{ + /* + * The Arm ARM describes the 12-bit precision version of RecipSqrtEstimate + * in terms of an infinite-precision floating point calculation of a + * square root. We implement this using the same kind of pure integer + * algorithm as the 8-bit mantissa, to get the same bit-for-bit result. + */ + int64_t b, estimate; -static uint64_t recip_sqrt_estimate(int *exp , int exp_off, uint64_t frac) + assert(1024 <= a && a < 4096); + if (a < 2048) { + a = a * 2 + 1; + } else { + a = (a >> 1) << 1; + a = (a + 1) * 2; + } + b = 8192; + while (a * (b + 1) * (b + 1) < (1ULL << 39)) { + b += 1; + } + estimate = (b + 1) / 2; + + assert(4096 <= estimate && estimate < 8192); + + return estimate; +} + +static uint64_t recip_sqrt_estimate(int *exp , int exp_off, uint64_t frac, + bool increasedprecision) { int estimate; uint32_t scaled; @@ -1027,17 +1055,32 @@ static uint64_t recip_sqrt_estimate(int *exp , int exp_off, uint64_t frac) frac = extract64(frac, 0, 51) << 1; } - if (*exp & 1) { - /* scaled = UInt('01':fraction<51:45>) */ - scaled = deposit32(1 << 7, 0, 7, extract64(frac, 45, 7)); + if (increasedprecision) { + if (*exp & 1) { + /* scaled = UInt('01':fraction<51:42>) */ + scaled = deposit32(1 << 10, 0, 10, extract64(frac, 42, 10)); + } else { + /* scaled = UInt('1':fraction<51:41>) */ + scaled = deposit32(1 << 11, 0, 11, extract64(frac, 41, 11)); + } + estimate = do_recip_sqrt_estimate_incprec(scaled); } else { - /* scaled = UInt('1':fraction<51:44>) */ - scaled = deposit32(1 << 8, 0, 8, extract64(frac, 44, 8)); + if (*exp & 1) { + /* scaled = UInt('01':fraction<51:45>) */ + scaled = deposit32(1 << 7, 0, 7, extract64(frac, 45, 7)); + } else { + /* scaled = UInt('1':fraction<51:44>) */ + scaled = deposit32(1 << 8, 0, 8, extract64(frac, 44, 8)); + } + estimate = do_recip_sqrt_estimate(scaled); } - estimate = do_recip_sqrt_estimate(scaled); *exp = (exp_off - *exp) / 2; - return extract64(estimate, 0, 8) << 44; + if (increasedprecision) { + return extract64(estimate, 0, 12) << 40; + } else { + return extract64(estimate, 0, 8) << 44; + } } uint32_t HELPER(rsqrte_f16)(uint32_t input, float_status *s) @@ -1076,7 +1119,7 @@ uint32_t HELPER(rsqrte_f16)(uint32_t input, float_status *s) f64_frac = ((uint64_t) f16_frac) << (52 - 10); - f64_frac = recip_sqrt_estimate(&f16_exp, 44, f64_frac); + f64_frac = recip_sqrt_estimate(&f16_exp, 44, f64_frac, false); /* result = sign : result_exp<4:0> : estimate<7:0> : Zeros(2) */ val = deposit32(0, 15, 1, f16_sign); @@ -1125,12 +1168,20 @@ static float32 do_rsqrte_f32(float32 input, float_status *s, bool rpres) f64_frac = ((uint64_t) f32_frac) << 29; - f64_frac = recip_sqrt_estimate(&f32_exp, 380, f64_frac); + f64_frac = recip_sqrt_estimate(&f32_exp, 380, f64_frac, rpres); - /* result = sign : result_exp<4:0> : estimate<7:0> : Zeros(15) */ + /* + * result = sign : result_exp<7:0> : estimate<7:0> : Zeros(15) + * or for increased precision + * result = sign : result_exp<7:0> : estimate<11:0> : Zeros(11) + */ val = deposit32(0, 31, 1, f32_sign); val = deposit32(val, 23, 8, f32_exp); - val = deposit32(val, 15, 8, extract64(f64_frac, 52 - 8, 8)); + if (rpres) { + val = deposit32(val, 11, 12, extract64(f64_frac, 52 - 12, 12)); + } else { + val = deposit32(val, 15, 8, extract64(f64_frac, 52 - 8, 8)); + } return make_float32(val); } @@ -1174,7 +1225,7 @@ float64 HELPER(rsqrte_f64)(float64 input, float_status *s) return float64_zero; } - f64_frac = recip_sqrt_estimate(&f64_exp, 3068, f64_frac); + f64_frac = recip_sqrt_estimate(&f64_exp, 3068, f64_frac, false); /* result = sign : result_exp<4:0> : estimate<7:0> : Zeros(44) */ val = deposit64(0, 61, 1, f64_sign); From patchwork Fri Jan 24 16:28:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859617 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp889139wrq; Fri, 24 Jan 2025 08:49:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXfP6Lp8DBvf0QAK5mXpDoX8RVpBaOCNRcPkUBd+Bt8tQBVPrJfIldxOVdAMqEdK9G5ZDnwJQ==@linaro.org X-Google-Smtp-Source: AGHT+IFCIpjXf/oUhe5kke3OOsAkguo0S2Q22OMrSxCYQnvUNxPpW0eQc4AMrG1b04dXr00VH2XW X-Received: by 2002:a05:6102:a52:b0:4b6:1991:4f4f with SMTP id ada2fe7eead31-4b690c6b3a8mr28160568137.17.1737737373227; Fri, 24 Jan 2025 08:49:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737373; cv=none; d=google.com; s=arc-20240605; b=YXy7qjS/e84AIDZAnKB24hPOK0hmfCtvR6xUNOysjyplkhiNuHcchdWTv579AygS7J 0Z4zu3OQ2etfTfw56kr7pyQc3O9640TlOABlTpKyKDonklcYYJYXCYYD+Db6SsMnwaJ6 3TUbleAdFfMdMejVNhluAamD9u1THq/ktOvWoVRTO1IxIwW4tQ3HvsKmnxgVhSbsXHsR cryBkgvuJ3gYozawnOulIfzwEXWUvPk4yTUxhJ7qfNpv2J91PdnpJgwKqm2tqHyz2CUc qARvFJTUgxXSqVm8gLmUULseH40Q3f1HyAZOvPuF10bnPuH2/zfqKU22oIY+wxTxZMQs MWMQ== 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=lA6x5OsofqZFLGhXUxXjPh4lmTqYPUIQ861yE8d4HvY=; fh=XrhDWAHvz3h/zsSB3hLRM1F38a+BheEdy57EuI8IxqU=; b=UITzHjMjmAtWcc9J9B6Cxl1xkG/Co1pnwZ4MM+mHq7w6hu231iuqJbGBlc9dgAUdzx 1OwBnVS99Ql1tSlSah1ZjT4qcQH3ZW5UK6ajeNk6Tgd2geMdcNcO5VJxEJiKXoB99qjt jPyCJlVA5/eTda3PNiaalR32Au6LZ1gARjDZ3bPmYikZbdcTL4utjGMgf7QiwIPnAHPY KGzdYt3VyEKEmbxUhD0glraKn7wksYzLGKbXEDUN08afWc3zweeUmOOPF+6vRKNe/V7k DS91lBc4U3xU2mCltX6FXbqplv4JT9+4cjaA/HDBaEdUK+1iQuiT684kN5mM/SkrLd9N jfsQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F0uuLkrh; 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 ada2fe7eead31-4b709a1be7csi855583137.603.2025.01.24.08.49.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:49:33 -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=F0uuLkrh; 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 1tbMhM-0007m8-Fq; Fri, 24 Jan 2025 11:38:25 -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 1tbMZh-0006BB-NV for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:32 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZZ-00062T-RX for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:27 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4361dc6322fso15854535e9.3 for ; Fri, 24 Jan 2025 08:30:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736209; x=1738341009; 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=lA6x5OsofqZFLGhXUxXjPh4lmTqYPUIQ861yE8d4HvY=; b=F0uuLkrhRCUmYBjk8PmKKFNE5XFPsRUxziw4jPaCl52HmJn0AnpONVp/zxEzSThYJ0 3fPCnsQh6XTSCDCNp8qR8zYt4EOkawy08X1h2zqw5sC10grHUI9c0zuLkXs6FstYNdsQ XDvgqTpELPxlQU7VkF6BCXQwv/Y2i4Nsc6hvAgiK5M2wG/6pgVYHqf+oB9v7Laujwiks 46gI96cOt8bIYG9OK5vxnuXS9qbJC0GtFquhRhr2/fNlyd4BCw2rIYwi+qyaIymKp1zs udBd3WDGJ9S/U3rY0Vq8LqqsFSo+5oZG/w+3Ero1aUt3qedFHi6ZGq+J4QN1bc86M+x1 BpuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736209; x=1738341009; 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=lA6x5OsofqZFLGhXUxXjPh4lmTqYPUIQ861yE8d4HvY=; b=XqsMqJoz6YtHzzPdH/nn6wkHtnXGHYYoBiVrzUWNje5VrzsRkVuruwxv7QO0/tWrgM IvIcoyKPUa/yUHAHNco2xVNrPTEL9hFWL07TLUvNLAhtEKthW6Y+G4F9oWOHHpKiJghw preDkOJPtKj1MEkB7QlqEOMCiNVIV4zJ8iz80M/LXYUTygZePmGM7yiDiCManlz7eekT UJtFxIlw+heJUIBouh81llhqbVudUU0SJjZ0SvyaxucfhPP8X2lBcgHPXkVr9tEBAiXY uPW5QWvgUQy7hlX1SSnfU3662bv17hEjBGg0HazXz3h3I5bTjzzb4K0EI0JptT6PcXPg FnfQ== X-Forwarded-Encrypted: i=1; AJvYcCU+Lzc9fbATr8rvn2oryL/FGXDyFgcotCQgK8GruHEGd/yrvCbJ8lmGdWypakt/iHmiest1BVajxwkQ@nongnu.org X-Gm-Message-State: AOJu0Yw5SJK84uTBsnNJxHtA5bEXsSZy7ifJ3RngNeVNRINt66K/u8Xp d17Fufj1mEXfYv1ZAbgpNyZCvqjsFzco1iuhnZhvSTQl/uCg6x8Vjru/OMty1VU= X-Gm-Gg: ASbGncsbPZ4ZD9BqLq2Pou/zXOVif+3GVMmSW7UqZFwdzYiroaWgsj7mk4soA77Aey7 LVSLtvX7uWciB8C3zflrZiB63Pbauhy2mMvknpOXHBaICuFesfObz+6lwYVroKHDQqsE7QGZLoe lnQHT8fXWTVmxWpTIjg7vjfgmuImE0t97tzIOMDB0N92kJ/NmJqXHvPZPp4pqmq7h3u6+MshFID l4Faa1Z4rbaechfsSUA9IpDw1o+49mHuv239KxBV4iOVWBQ4rxe8UBeO6N4QxP4SaIOmaRpvEd4 lQpguaEskWg= X-Received: by 2002:a05:600c:3149:b0:434:f270:a513 with SMTP id 5b1f17b1804b1-4389144e70fmr297782605e9.29.1737736209377; Fri, 24 Jan 2025 08:30:09 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:08 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 72/76] target/arm: Enable FEAT_RPRES for -cpu max Date: Fri, 24 Jan 2025 16:28:32 +0000 Message-Id: <20250124162836.2332150-73-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Now the emulation is complete, we can enable FEAT_RPRES for the 'max' CPU type. Signed-off-by: Peter Maydell --- docs/system/arm/emulation.rst | 1 + target/arm/tcg/cpu64.c | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 63b4cdf5fb1..78c2fd2113c 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -118,6 +118,7 @@ the following architecture extensions: - FEAT_RDM (Advanced SIMD rounding double multiply accumulate instructions) - FEAT_RME (Realm Management Extension) (NB: support status in QEMU is experimental) - FEAT_RNG (Random number generator) +- FEAT_RPRES (Increased precision of FRECPE and FRSQRTE) - FEAT_S2FWB (Stage 2 forced Write-Back) - FEAT_SB (Speculation Barrier) - FEAT_SEL2 (Secure EL2) diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c index 0bc68aac177..29ab0ac79da 100644 --- a/target/arm/tcg/cpu64.c +++ b/target/arm/tcg/cpu64.c @@ -1167,6 +1167,7 @@ void aarch64_max_tcg_initfn(Object *obj) cpu->isar.id_aa64isar1 = t; t = cpu->isar.id_aa64isar2; + t = FIELD_DP64(t, ID_AA64ISAR2, RPRES, 1); /* FEAT_RPRES */ t = FIELD_DP64(t, ID_AA64ISAR2, MOPS, 1); /* FEAT_MOPS */ t = FIELD_DP64(t, ID_AA64ISAR2, BC, 1); /* FEAT_HBC */ t = FIELD_DP64(t, ID_AA64ISAR2, WFXT, 2); /* FEAT_WFxT */ From patchwork Fri Jan 24 16:28:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859600 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp886539wrq; Fri, 24 Jan 2025 08:43:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUKcnjhuqkillJyY1AV/lwd5fwB6qfv+sec/n6khDKhx9E210zNU0GM+waTOgAbV1PkWbiqbQ==@linaro.org X-Google-Smtp-Source: AGHT+IFCkIa/mc5s8PPg6vt70EkTKOGBY+fp/aTJ5bE80QJvZDXaq9PLcEUrzW/HAoNmY9aECUDk X-Received: by 2002:a05:6214:5197:b0:6cb:d4e6:2507 with SMTP id 6a1803df08f44-6e1b216892dmr474543536d6.22.1737737012023; Fri, 24 Jan 2025 08:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737012; cv=none; d=google.com; s=arc-20240605; b=AxAzgdx2Xt140J9YwI7Cu58SaE+SdL+4jIgFXEHPpIXIQSgscyFcBOtviWQqINmxQ4 GBGIVOsMuDfXoQ/Zfzi5vACyoopT9gXvTgOKeTK74uEnSru8a2ZquTCjaQuzbRGtx+TY t29cxjHv/NlrP4y4IZDsUIdFd/dTOg6+SFeOEdZEvlnkgh+z/YLgVSYynJZAhjUWBWOC uoOh+WRpcUoEsCjE2QxV3UbkXM3a2QB6INvzRVzv1BIyFvz5br1TmNFi1zLMYjagEhzj 90/2OF3LwUz2sMSZZfEo3PyKp8f1hiUGeyuVVLAJ96mOn6yu6wqAwXCAUNtZ3Dq+1UTp U6Rw== 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=KQPKoJ5OpJcpnmKsSmz59ndMFucnaB6ozSHh4Jfa8B8=; fh=q3V2uM2Kfe43XPhnuFS6rFKP/A9zx/O9/PupCcacxP4=; b=dCpcDn3xgRMsdTUlDJ/LHz6RI5DJShQ3WeqjBYDjs5qAOiN157Zrv7qI7WUKR0wkgG JjlESuyY/vhXMZ38AzsqFI7T9n53DjhyM09Vh8EUuL7idFqfIiHwxyxlS4JsBwngQ/8D MZ/vV7dnPkQbUT6U+b0Y4lzGOLPZLczl4vVUb1NPC/ECC7nXF1kPteLcRdD0QBK5VnHH AvrM4hQocuPJzV9iZUDQ003m4x1nfgVlnIbfSepXhJtfdHKDp/vAl2+kUvTPXfLzUpCn xQ1unOMrSp4fGbTcAnvOk+j5StOyvqTjfAv/2V9O5st2Yq2cGYj6xqmZt1MnYEQT48dB mHBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RI/oDXFY"; 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-6e20613359asi28848066d6.459.2025.01.24.08.43.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:43:32 -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="RI/oDXFY"; 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 1tbMgc-0006WT-6D; Fri, 24 Jan 2025 11:37:41 -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 1tbMZY-00064N-7J for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:27 -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 1tbMZR-00063D-Lh for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:19 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-43690d4605dso15879665e9.0 for ; Fri, 24 Jan 2025 08:30:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736211; x=1738341011; 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=KQPKoJ5OpJcpnmKsSmz59ndMFucnaB6ozSHh4Jfa8B8=; b=RI/oDXFYI9yyKJH/o8R26TgPNZYSTgHU8z7ohuxWtcCEhnrIjJ/4diW8qAbZrVGy2g xXGZzdz+xY1e2s5ILhFNXb9tEwT8asiyASAsXzNqmi5rDxOioLDWqrOjfS50LOICK0/V V89TlgHRVfxssIWlg7ynNnH1ftFOsz27LvvSEYo4F5Xw0cBCY1rbeKewrIJeJsKgYowd dQMtGp/2CQ0fCDT89PalPyYPaAL6qFUgyBezKFU57KCJlcXPlCQENqq3hA8PJDp8JuME B6sWWsdG31t1s1rmowa+QgysflH91MZdhq+ctsL9xxR65mQci6EmtfC5+lVxJRcVGakR Z0aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736211; x=1738341011; 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=KQPKoJ5OpJcpnmKsSmz59ndMFucnaB6ozSHh4Jfa8B8=; b=EzILVDbN3Ztgex+ol/cvbfy+JRntLYPWxAQrN2ifXsl5qk++LMzFpFuVxbLkDkRTcw TQOHMnM1CY4uH3taBTLEDRdzcQaF6aadXccjIcqa/zKplRz6MLJOwkVUgiD1j9NJVAlZ 9toRbYuXmB+mtZdFEzCuFqkJkPU9HpUraM/jEwwv9cHKxQRtLOH9TG3DtkDGsOJuHEfA DbS+e0pJsczy9M55XjMkbYPR9I5aIYChS5mosBxGP99Z1mm/ErsrOoJkk4WciRCm8MrS DhM87gRLHRSAhRv5xBq0PWi9vrhAHG9+waM3rgCEohj6mVQ0YOw9MqV+p3gDsL4AhG79 bRJg== X-Forwarded-Encrypted: i=1; AJvYcCW4sEGJjqit/snLR0b3edaJosXqhX8JcuqiyfGz2MfybBTw7qb4MAMwLD4XuOdTdl8bwuNPBgKb1Bop@nongnu.org X-Gm-Message-State: AOJu0YwXtAFx0Hl7S3lBvC03/wWPsPkE8dIe8BygD01ftxhv4b+i7Yd3 I0toyBEsq8GFWpAIqYNUdsTuBgSdSwqZnka3KJ8ZitxpZD/GA8188U0p9mtIGfB7ZTN52tX38/y t X-Gm-Gg: ASbGncsKPkWOuAiL/V/vwbuQ2OvGB6Q1hFVpVxrNZUwZY5+xISpsbWQM2ccwWlLu+WB lSoWIWD5YiU12s4eaccWHZ3h4ocInnBYH4WjOUKH1NbIQmoUsWK9niIZcoDVOo28v8Ay0UH09gm ST10loZQtn5P4+Hk6pjxTu4zQ3dxKhblHTgWtgGHNtcLjYG6HThWp6lQTL7k6I7cH5q4jaomIya vEAgZJFqC+tbXdlgTXO6EtKFUhA/B4/KtdsbppOWsLoBwzWGFL1+rz/+TCE/Jx7JHBzN06IWx6I NejnOqR1EL0= X-Received: by 2002:a05:600c:3585:b0:434:f297:8e85 with SMTP id 5b1f17b1804b1-438913d5da1mr330585925e9.10.1737736211271; Fri, 24 Jan 2025 08:30:11 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:09 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 73/76] target/i386: Detect flush-to-zero after rounding Date: Fri, 24 Jan 2025 16:28:33 +0000 Message-Id: <20250124162836.2332150-74-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Intel SDM section 10.2.3.3 on the MXCSR.FTZ bit says that we flush outputs to zero when we detect underflow, which is after rounding. Set the detect_ftz flag accordingly. This allows us to enable the test in fma.c which checks this behaviour. Signed-off-by: Peter Maydell --- target/i386/tcg/fpu_helper.c | 8 ++++---- tests/tcg/x86_64/fma.c | 5 ----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index 9bf23fdd0f6..5c233fdf5b4 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -189,13 +189,13 @@ void cpu_init_fp_statuses(CPUX86State *env) set_float_default_nan_pattern(0b11000000, &env->mmx_status); set_float_default_nan_pattern(0b11000000, &env->sse_status); /* - * TODO: x86 does flush-to-zero detection after rounding (the SDM + * x86 does flush-to-zero detection after rounding (the SDM * section 10.2.3.3 on the FTZ bit of MXCSR says that we flush * when we detect underflow, which x86 does after rounding). */ - set_float_detect_ftz(detect_ftz_before_rounding, &env->fp_status); - set_float_detect_ftz(detect_ftz_before_rounding, &env->mmx_status); - set_float_detect_ftz(detect_ftz_before_rounding, &env->sse_status); + set_float_detect_ftz(detect_ftz_after_rounding, &env->fp_status); + set_float_detect_ftz(detect_ftz_after_rounding, &env->mmx_status); + set_float_detect_ftz(detect_ftz_after_rounding, &env->sse_status); } static inline uint8_t save_exception_flags(CPUX86State *env) diff --git a/tests/tcg/x86_64/fma.c b/tests/tcg/x86_64/fma.c index 09c622ebc00..46f863005ed 100644 --- a/tests/tcg/x86_64/fma.c +++ b/tests/tcg/x86_64/fma.c @@ -79,14 +79,9 @@ static testdata tests[] = { /* * Flushing of denormal outputs to zero should also happen after * rounding, so setting FTZ should not affect the result or the flags. - * QEMU currently does not emulate this correctly because we do the - * flush-to-zero check before rounding, so we incorrectly produce a - * zero result and set Underflow as well as Precision. */ -#ifdef ENABLE_FAILING_TESTS { 0x3fdfffffffffffff, 0x001fffffffffffff, 0x801fffffffffffff, true, 0x8010000000000000, 0x20 }, /* Enabling FTZ shouldn't change flags */ -#endif }; int main(void) From patchwork Fri Jan 24 16:28:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859618 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp889155wrq; Fri, 24 Jan 2025 08:49:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXXwRtqxLqEJp3X0q2QLBZNsRI4PLWup20GCO6V69b64RYj3qu5QwRAfC6JBiibj76j0NO+bg==@linaro.org X-Google-Smtp-Source: AGHT+IFc08TSsQ7MXlyevYNMfy8IzeQ1bGfgZGFRQdqccl6U48c+WL12Ux38SDY5bIXwEJCyjVST X-Received: by 2002:a05:6102:162c:b0:4b2:48cc:74f3 with SMTP id ada2fe7eead31-4b690bdc67emr27160238137.12.1737737376026; Fri, 24 Jan 2025 08:49:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737376; cv=none; d=google.com; s=arc-20240605; b=WLOQZgzO2zSZPFEQjS62XnsNHMiiF1X6UfYJ/rGnF3ojcKP06WxCB3txbgGS5DohUj Wq2mvmJ/KWacCBZLwMeFOgnR462cmW5e00yHi/aj+my9O0s5oebKaIKyh6eUN7+ebMl9 zf4gy9Bl9p8E4k+p3Oa+pegmqWcakvGEyBLchNOhAWqrRKyX9HxW77vy7TJvipLCI0Oo cuidRM8FaM8cYnVjt8f5CZc2VWgdHC/ShB+3MlojTZrRwFGFzuCBXpglU3pB2uwT2GEz B0fEIP2bHt0UmeiGhF4JFQO2acMhOE7jv2PLPZzBRwgCcjigs12Kb+9SsA4a43wJNkWr mQVg== 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=mL8/LDS+VVeI+qmrE01zyxLcmb07nMFf+7bIQYAM6sc=; fh=sHDC7T2AojumEaCvisDpoHjje5m6StHYLv+renujolk=; b=MUn9r5HjsnUcPOfbEg4pyhFGiRWNGGihWWefAPW3JZ0SvPXmYbGUjdeUvKHsKc4GfL shrea8skaz4nJ2NlsqT1gq8nBWG8a364WOa1WMGPYuxyRv0bgml6MiXjYAJGYv/1/oIa SBdgYZNtFZIF01xgP6JsNFd2vAxw0LjhDudQHjed3gW8jMDk/NvYEnRi1E07lIuDL9zj hWBBXfSZ9Zhpt75qAXO6hgYSOG9cJ0ouE2fn5F8ZNHK549RgV9utc1eApPTXBPHwlzVy /BmExgY9PX2R1fTl9tq9xrSjMVHXghPetGacpjTwLtXGj767HhnEM1cCKkJ3Es6MBNHE gFLg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N199EIZR; 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 ada2fe7eead31-4b7099aad85si1138327137.350.2025.01.24.08.49.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:49:36 -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=N199EIZR; 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 1tbMef-0002wo-Mh; Fri, 24 Jan 2025 11:35:38 -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 1tbMZh-00069Y-7y for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:32 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZX-00063W-Fh for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:23 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-43618283d48so16771765e9.1 for ; Fri, 24 Jan 2025 08:30:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736212; x=1738341012; 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=mL8/LDS+VVeI+qmrE01zyxLcmb07nMFf+7bIQYAM6sc=; b=N199EIZRxEH5COSksEKWfqIMTRnG5mlMSpAO5KZ1lWtG9ryXNh5egiXYHgF7XDluzW alHyS9Zwj/Mpi+EQI0SuSLZqqjUeKsHl0Al+Vl31n79EAdEnM2/8E4hH/DStZ9DBcjO/ HPEfcNvu35tUwqP5s5aSULxjv5G7aurD2wDYsEYRUmwNJ4zBKeAoL49ogbDpEZpSPRAn Ky4klRLlXoof2u62FdOpsJW/AafgcwmodlvhAK1cKHrRS/WUVlwoTWlE1WydJj2zzinL YNF9+xquwCH4eydORR/2tbZ0Ym0QLj1w4C60thdiCDiIYJuvwYNCiVieJOdVopyddjoq NEfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736212; x=1738341012; 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=mL8/LDS+VVeI+qmrE01zyxLcmb07nMFf+7bIQYAM6sc=; b=HsL+oH2YepC+LnucF/R/4d1Zhjx+EKXleIRsJd0cOsREUNZ1UQnpj/L4Zkz9GTpxYw ZtSsyCV6opY1by+lFZbKhiBeMcdtnOHJyXft5Ag3Z0oBvmUqUmDo5Kpu4IQy1n3C6i6C bksr5EG6M1UGmsb63JV1Ear7l1jSf+QFzu8U6zvf/kvsvj83rHUind2YCMllmBdUXsle n7CKB4MISbXGBF7IowYA8a83yJAKaIh/UMyX9mIXue+dtMyUGLj9KRTc+fSB/CDR1MPa 31aksS38pJE5h/2h/zzdM2LxuiSrYcNN7pRC5cyDlEjMGk6OnI6TxdHHlNB029FtumTN eXvg== X-Forwarded-Encrypted: i=1; AJvYcCV9nMkRUNTT+GfURtK0r0l2VjeJavtHsFf2vNtT6Vqlx/wC1JKXAHAukw6Dy3FuE/aIqFs8CEcoeM9h@nongnu.org X-Gm-Message-State: AOJu0YxnEYMhQf7bR2ko6p5V6GH4Kafxsv3Q7KYgvCm1qpXirtNWMdyZ sd6ro9QtAlMrGu5HWy4mf9mdwXtCoM6QXB6Kgi+99YwATsyj2/Z+v4OlgXLEwT+Dxe/dZ8PwsXX + X-Gm-Gg: ASbGnctRkojhUrVVcsLulm15x8090R9ck8mmk52+wAkiQpGlmJeL6IZmAzDleiY0Tc5 s+Ks9w3Kr4IH/i6vtTu6mTx8diogpLSKC3neJyVcI7hbsF2z8BzYnePVbARqeMsPJb/UY+jyYPi cYhDTzk6Q1V1N/ficsueHIUM5xQ0b5GYVI1skaNSqLW/1ONvrBdSQu7HA4T2w713sZF3gtIMp2o 5reO4VDkzxtE2NCmYRjgHhGIkJ7B2L8nfgT2R1Nxjum7lWBIsGMhHnkwftblsY4HsFIn4Zm1/Da iNr6MsRnRQ7A+EdvhKwLcQ== X-Received: by 2002:a05:600c:3420:b0:436:f3f6:9582 with SMTP id 5b1f17b1804b1-438913cb729mr300201085e9.8.1737736212431; Fri, 24 Jan 2025 08:30:12 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:11 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 74/76] target/i386: Use correct type for get_float_exception_flags() values Date: Fri, 24 Jan 2025 16:28:34 +0000 Message-Id: <20250124162836.2332150-75-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 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 softfloat get_float_exception_flags() function returns 'int', but in various places in target/i386 we incorrectly store the returned value into a uint8_t. This currently has no ill effects because i386 doesn't care about any of the float_flag enum values above 0x40. However, we want to start using float_flag_input_denormal_used, which is 0x4000. Switch to using 'int' so that we can handle all the possible valid float_flag_* values. This includes changing the return type of save_exception_flags() and the argument to merge_exception_flags(). Signed-off-by: Peter Maydell --- target/i386/ops_sse.h | 16 +++---- target/i386/tcg/fpu_helper.c | 82 ++++++++++++++++++------------------ 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index f0aa1894aa2..a2e4d480399 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -842,7 +842,7 @@ int64_t helper_cvttsd2sq(CPUX86State *env, ZMMReg *s) void glue(helper_rsqrtps, SUFFIX)(CPUX86State *env, ZMMReg *d, ZMMReg *s) { - uint8_t old_flags = get_float_exception_flags(&env->sse_status); + int old_flags = get_float_exception_flags(&env->sse_status); int i; for (i = 0; i < 2 << SHIFT; i++) { d->ZMM_S(i) = float32_div(float32_one, @@ -855,7 +855,7 @@ void glue(helper_rsqrtps, SUFFIX)(CPUX86State *env, ZMMReg *d, ZMMReg *s) #if SHIFT == 1 void helper_rsqrtss(CPUX86State *env, ZMMReg *d, ZMMReg *v, ZMMReg *s) { - uint8_t old_flags = get_float_exception_flags(&env->sse_status); + int old_flags = get_float_exception_flags(&env->sse_status); int i; d->ZMM_S(0) = float32_div(float32_one, float32_sqrt(s->ZMM_S(0), &env->sse_status), @@ -869,7 +869,7 @@ void helper_rsqrtss(CPUX86State *env, ZMMReg *d, ZMMReg *v, ZMMReg *s) void glue(helper_rcpps, SUFFIX)(CPUX86State *env, ZMMReg *d, ZMMReg *s) { - uint8_t old_flags = get_float_exception_flags(&env->sse_status); + int old_flags = get_float_exception_flags(&env->sse_status); int i; for (i = 0; i < 2 << SHIFT; i++) { d->ZMM_S(i) = float32_div(float32_one, s->ZMM_S(i), &env->sse_status); @@ -880,7 +880,7 @@ void glue(helper_rcpps, SUFFIX)(CPUX86State *env, ZMMReg *d, ZMMReg *s) #if SHIFT == 1 void helper_rcpss(CPUX86State *env, ZMMReg *d, ZMMReg *v, ZMMReg *s) { - uint8_t old_flags = get_float_exception_flags(&env->sse_status); + int old_flags = get_float_exception_flags(&env->sse_status); int i; d->ZMM_S(0) = float32_div(float32_one, s->ZMM_S(0), &env->sse_status); for (i = 1; i < 2 << SHIFT; i++) { @@ -1714,7 +1714,7 @@ void glue(helper_phminposuw, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) void glue(helper_roundps, SUFFIX)(CPUX86State *env, Reg *d, Reg *s, uint32_t mode) { - uint8_t old_flags = get_float_exception_flags(&env->sse_status); + int old_flags = get_float_exception_flags(&env->sse_status); signed char prev_rounding_mode; int i; @@ -1738,7 +1738,7 @@ void glue(helper_roundps, SUFFIX)(CPUX86State *env, Reg *d, Reg *s, void glue(helper_roundpd, SUFFIX)(CPUX86State *env, Reg *d, Reg *s, uint32_t mode) { - uint8_t old_flags = get_float_exception_flags(&env->sse_status); + int old_flags = get_float_exception_flags(&env->sse_status); signed char prev_rounding_mode; int i; @@ -1763,7 +1763,7 @@ void glue(helper_roundpd, SUFFIX)(CPUX86State *env, Reg *d, Reg *s, void glue(helper_roundss, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s, uint32_t mode) { - uint8_t old_flags = get_float_exception_flags(&env->sse_status); + int old_flags = get_float_exception_flags(&env->sse_status); signed char prev_rounding_mode; int i; @@ -1788,7 +1788,7 @@ void glue(helper_roundss, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s, void glue(helper_roundsd, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s, uint32_t mode) { - uint8_t old_flags = get_float_exception_flags(&env->sse_status); + int old_flags = get_float_exception_flags(&env->sse_status); signed char prev_rounding_mode; int i; diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index 5c233fdf5b4..97b46307d56 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -198,16 +198,16 @@ void cpu_init_fp_statuses(CPUX86State *env) set_float_detect_ftz(detect_ftz_after_rounding, &env->sse_status); } -static inline uint8_t save_exception_flags(CPUX86State *env) +static inline int save_exception_flags(CPUX86State *env) { - uint8_t old_flags = get_float_exception_flags(&env->fp_status); + int old_flags = get_float_exception_flags(&env->fp_status); set_float_exception_flags(0, &env->fp_status); return old_flags; } -static void merge_exception_flags(CPUX86State *env, uint8_t old_flags) +static void merge_exception_flags(CPUX86State *env, int old_flags) { - uint8_t new_flags = get_float_exception_flags(&env->fp_status); + int new_flags = get_float_exception_flags(&env->fp_status); float_raise(old_flags, &env->fp_status); fpu_set_exception(env, ((new_flags & float_flag_invalid ? FPUS_IE : 0) | @@ -220,7 +220,7 @@ static void merge_exception_flags(CPUX86State *env, uint8_t old_flags) static inline floatx80 helper_fdiv(CPUX86State *env, floatx80 a, floatx80 b) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); floatx80 ret = floatx80_div(a, b, &env->fp_status); merge_exception_flags(env, old_flags); return ret; @@ -240,7 +240,7 @@ static void fpu_raise_exception(CPUX86State *env, uintptr_t retaddr) void helper_flds_FT0(CPUX86State *env, uint32_t val) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); union { float32 f; uint32_t i; @@ -253,7 +253,7 @@ void helper_flds_FT0(CPUX86State *env, uint32_t val) void helper_fldl_FT0(CPUX86State *env, uint64_t val) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); union { float64 f; uint64_t i; @@ -271,7 +271,7 @@ void helper_fildl_FT0(CPUX86State *env, int32_t val) void helper_flds_ST0(CPUX86State *env, uint32_t val) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int new_fpstt; union { float32 f; @@ -288,7 +288,7 @@ void helper_flds_ST0(CPUX86State *env, uint32_t val) void helper_fldl_ST0(CPUX86State *env, uint64_t val) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int new_fpstt; union { float64 f; @@ -338,7 +338,7 @@ void helper_fildll_ST0(CPUX86State *env, int64_t val) uint32_t helper_fsts_ST0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); union { float32 f; uint32_t i; @@ -351,7 +351,7 @@ uint32_t helper_fsts_ST0(CPUX86State *env) uint64_t helper_fstl_ST0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); union { float64 f; uint64_t i; @@ -364,7 +364,7 @@ uint64_t helper_fstl_ST0(CPUX86State *env) int32_t helper_fist_ST0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int32_t val; val = floatx80_to_int32(ST0, &env->fp_status); @@ -378,7 +378,7 @@ int32_t helper_fist_ST0(CPUX86State *env) int32_t helper_fistl_ST0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int32_t val; val = floatx80_to_int32(ST0, &env->fp_status); @@ -391,7 +391,7 @@ int32_t helper_fistl_ST0(CPUX86State *env) int64_t helper_fistll_ST0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int64_t val; val = floatx80_to_int64(ST0, &env->fp_status); @@ -404,7 +404,7 @@ int64_t helper_fistll_ST0(CPUX86State *env) int32_t helper_fistt_ST0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int32_t val; val = floatx80_to_int32_round_to_zero(ST0, &env->fp_status); @@ -418,7 +418,7 @@ int32_t helper_fistt_ST0(CPUX86State *env) int32_t helper_fisttl_ST0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int32_t val; val = floatx80_to_int32_round_to_zero(ST0, &env->fp_status); @@ -431,7 +431,7 @@ int32_t helper_fisttl_ST0(CPUX86State *env) int64_t helper_fisttll_ST0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int64_t val; val = floatx80_to_int64_round_to_zero(ST0, &env->fp_status); @@ -527,7 +527,7 @@ static const int fcom_ccval[4] = {0x0100, 0x4000, 0x0000, 0x4500}; void helper_fcom_ST0_FT0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); FloatRelation ret; ret = floatx80_compare(ST0, FT0, &env->fp_status); @@ -537,7 +537,7 @@ void helper_fcom_ST0_FT0(CPUX86State *env) void helper_fucom_ST0_FT0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); FloatRelation ret; ret = floatx80_compare_quiet(ST0, FT0, &env->fp_status); @@ -549,7 +549,7 @@ static const int fcomi_ccval[4] = {CC_C, CC_Z, 0, CC_Z | CC_P | CC_C}; void helper_fcomi_ST0_FT0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int eflags; FloatRelation ret; @@ -562,7 +562,7 @@ void helper_fcomi_ST0_FT0(CPUX86State *env) void helper_fucomi_ST0_FT0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int eflags; FloatRelation ret; @@ -575,28 +575,28 @@ void helper_fucomi_ST0_FT0(CPUX86State *env) void helper_fadd_ST0_FT0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); ST0 = floatx80_add(ST0, FT0, &env->fp_status); merge_exception_flags(env, old_flags); } void helper_fmul_ST0_FT0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); ST0 = floatx80_mul(ST0, FT0, &env->fp_status); merge_exception_flags(env, old_flags); } void helper_fsub_ST0_FT0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); ST0 = floatx80_sub(ST0, FT0, &env->fp_status); merge_exception_flags(env, old_flags); } void helper_fsubr_ST0_FT0(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); ST0 = floatx80_sub(FT0, ST0, &env->fp_status); merge_exception_flags(env, old_flags); } @@ -615,28 +615,28 @@ void helper_fdivr_ST0_FT0(CPUX86State *env) void helper_fadd_STN_ST0(CPUX86State *env, int st_index) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); ST(st_index) = floatx80_add(ST(st_index), ST0, &env->fp_status); merge_exception_flags(env, old_flags); } void helper_fmul_STN_ST0(CPUX86State *env, int st_index) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); ST(st_index) = floatx80_mul(ST(st_index), ST0, &env->fp_status); merge_exception_flags(env, old_flags); } void helper_fsub_STN_ST0(CPUX86State *env, int st_index) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); ST(st_index) = floatx80_sub(ST(st_index), ST0, &env->fp_status); merge_exception_flags(env, old_flags); } void helper_fsubr_STN_ST0(CPUX86State *env, int st_index) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); ST(st_index) = floatx80_sub(ST0, ST(st_index), &env->fp_status); merge_exception_flags(env, old_flags); } @@ -861,7 +861,7 @@ void helper_fbld_ST0(CPUX86State *env, target_ulong ptr) void helper_fbst_ST0(CPUX86State *env, target_ulong ptr) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); int v; target_ulong mem_ref, mem_end; int64_t val; @@ -1136,7 +1136,7 @@ static const struct f2xm1_data f2xm1_table[65] = { void helper_f2xm1(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); uint64_t sig = extractFloatx80Frac(ST0); int32_t exp = extractFloatx80Exp(ST0); bool sign = extractFloatx80Sign(ST0); @@ -1369,7 +1369,7 @@ static const struct fpatan_data fpatan_table[9] = { void helper_fpatan(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); uint64_t arg0_sig = extractFloatx80Frac(ST0); int32_t arg0_exp = extractFloatx80Exp(ST0); bool arg0_sign = extractFloatx80Sign(ST0); @@ -1806,7 +1806,7 @@ void helper_fpatan(CPUX86State *env) void helper_fxtract(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); CPU_LDoubleU temp; temp.d = ST0; @@ -1855,7 +1855,7 @@ void helper_fxtract(CPUX86State *env) static void helper_fprem_common(CPUX86State *env, bool mod) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); uint64_t quotient; CPU_LDoubleU temp0, temp1; int exp0, exp1, expdiff; @@ -2050,7 +2050,7 @@ static void helper_fyl2x_common(CPUX86State *env, floatx80 arg, int32_t *exp, void helper_fyl2xp1(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); uint64_t arg0_sig = extractFloatx80Frac(ST0); int32_t arg0_exp = extractFloatx80Exp(ST0); bool arg0_sign = extractFloatx80Sign(ST0); @@ -2148,7 +2148,7 @@ void helper_fyl2xp1(CPUX86State *env) void helper_fyl2x(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); uint64_t arg0_sig = extractFloatx80Frac(ST0); int32_t arg0_exp = extractFloatx80Exp(ST0); bool arg0_sign = extractFloatx80Sign(ST0); @@ -2295,7 +2295,7 @@ void helper_fyl2x(CPUX86State *env) void helper_fsqrt(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); if (floatx80_is_neg(ST0)) { env->fpus &= ~0x4700; /* (C3,C2,C1,C0) <-- 0000 */ env->fpus |= 0x400; @@ -2321,14 +2321,14 @@ void helper_fsincos(CPUX86State *env) void helper_frndint(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); ST0 = floatx80_round_to_int(ST0, &env->fp_status); merge_exception_flags(env, old_flags); } void helper_fscale(CPUX86State *env) { - uint8_t old_flags = save_exception_flags(env); + int old_flags = save_exception_flags(env); if (floatx80_invalid_encoding(ST1) || floatx80_invalid_encoding(ST0)) { float_raise(float_flag_invalid, &env->fp_status); ST0 = floatx80_default_nan(&env->fp_status); @@ -2366,7 +2366,7 @@ void helper_fscale(CPUX86State *env) } else { int n; FloatX80RoundPrec save = env->fp_status.floatx80_rounding_precision; - uint8_t save_flags = get_float_exception_flags(&env->fp_status); + int save_flags = get_float_exception_flags(&env->fp_status); set_float_exception_flags(0, &env->fp_status); n = floatx80_to_int32_round_to_zero(ST1, &env->fp_status); set_float_exception_flags(save_flags, &env->fp_status); @@ -3266,7 +3266,7 @@ void update_mxcsr_status(CPUX86State *env) void update_mxcsr_from_sse_status(CPUX86State *env) { - uint8_t flags = get_float_exception_flags(&env->sse_status); + int flags = get_float_exception_flags(&env->sse_status); /* * The MXCSR denormal flag has opposite semantics to * float_flag_input_denormal_flushed (the softfloat code sets that flag From patchwork Fri Jan 24 16:28:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859602 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp887154wrq; Fri, 24 Jan 2025 08:45:02 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWCss1BTrvFiDmkoxS3Itto4A+54lA91Inr/AP1Xsvg74JsVV3trW8GZWmCAsCvCqsdA27NiA==@linaro.org X-Google-Smtp-Source: AGHT+IHGFRg9UEFmfjV61USUVBIk34/D+XjYVVjceM6oZQdDXJNYCiTi14pAt4jCojcGV1uJUiGG X-Received: by 2002:a05:6122:6581:b0:517:4fb0:749c with SMTP id 71dfb90a1353d-51d592ba751mr27302469e0c.3.1737737102515; Fri, 24 Jan 2025 08:45:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737102; cv=none; d=google.com; s=arc-20240605; b=e6nIwWlg1HrGcZwaDfkK+tLhXsWXRISh2ZHcH/BDb0gPCWUW0ThyVNgthJkCaTQihk LPdHerefLYqjjpwn0FwE0o59Hpcmpt3EeLwUOQE1UkZRkX2iIdF+TYL5HByx3oNG8viy bnji+f1ecGQE2U4eKHR9Ge/3P5cln8pMDpl8NOqOYlv5+kiNHkP4UbVl7hfENwpsiOxD 7EDWUJollvRKAorm4zM9Nb0O0WLwUxpXALW70URdm+b3hBe00qBr8GyYB8ZIy+g8ZR4K rUn/nXQn6ZEJSY4IleF02rG+lG+CBGB/MNUn7DiKS0zL+Wr4g6R5SzyXMvLGZtkbZWE7 TE/w== 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=oV62nQbavYpaLNeL3j3KFgn+7cVCaGdr4oQFW+y825Y=; fh=cJc9r/Kn0tfdtbEkwOmpxb7ZNNkTVxkXigTzqs5Zdy4=; b=IuVbXXKMoBhqP+VLAYswNWz0Kq6qLc867OviGnS+nJwoG4VQzSZJbsdDaYnwICffRw q2uj++cqBesqbHRVbN3WYrVvMXxa4FdmewnJMcpeMGKIsq1b004S6U95QKq8E8q8Pr/o BdO4CR37eyzwFlbe8tN3SjDLInP0u1C755XnapNDtM4UlFvJ25eKWWuuMfIOBTJzkm1m BA/8kGdn711U59PXC85cKuKrb4iOaxHDmqrS1ws7QG2YBTuXux4aBPTm4IUsB7cfUALC dQire4KYmcCXvXUhm35WatGaRzN+8LH35UBYkTPqVGOhrdpZo5XMf/KSmpFYHe/OJJaR BiBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C/YvdDbO"; 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 71dfb90a1353d-51e4ecbf7a0si1165707e0c.227.2025.01.24.08.45.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:45:02 -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="C/YvdDbO"; 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 1tbMgq-000785-OI; Fri, 24 Jan 2025 11:37:52 -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 1tbMZh-00069U-63 for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:32 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZX-00064S-Oh for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:23 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43624b2d453so24616825e9.2 for ; Fri, 24 Jan 2025 08:30:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736214; x=1738341014; 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=oV62nQbavYpaLNeL3j3KFgn+7cVCaGdr4oQFW+y825Y=; b=C/YvdDbOYdAda5mAhbwWlJQh4WkhHwNkHMBBnBNAVIpQe/vpgtdteR3stVCSXcZ6b8 P//VCLOFvQwKg78R4UhbciAWMNXN8aL0rWFrW7mq9cdTDLKyoc9NjuyClzabUikkuvBa xEZyutPmH1yRFk27DmK12IkEM6jcFtSZLjJhi97rqtNVWdj/vUIv4/l13AIXbVZYDfrn RDYWSkG43eeFe+xMfXwX0spOssMywf5SfkKZw7oz08hfJGFLedxdlRjdDvKjAJDeKOF8 TkEyih/KMWS/JS7LbJGBAamq0PdVKLrzA3F+pZoqd2ayDSJKc3NojamH1ECzrBgg7WyR NHVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736214; x=1738341014; 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=oV62nQbavYpaLNeL3j3KFgn+7cVCaGdr4oQFW+y825Y=; b=I6CtnyGltW+eHXtzdmkGUulsv25frrrIrSMyvhJe1+08xs9UZM2ccF3O/9ehG4j1+j 3yaHG7c17mggzG83BHqnzYJH+6gpMM6Hr/heiN2md0dUEaAKIE//W3e1N6vx8he3x7dR Ls7/RNsxfubUVhv1RC5QSdRGGxYYtHsgjcFG0gL5GQmPFKUXesYhRCOgcznlpcbZ2Rnz Oo+7qmiQv2SFPsYlGsmLIbhcdC/KJ5XCP8jHHOdJko0JRUZsCdeJy8iIlOYNonPA5H/X eedNv/9GAYt9zBGI/WuC3/Jqt7lrMXQTLhl0TKX2VGvhlIyNj3OqZnF5Brb8lOfyijEm qhJQ== X-Forwarded-Encrypted: i=1; AJvYcCWIHeIu3oXWEJKgcxUMzFycPH8OgaTWpSXMaR+5l4afIxESqK+U0ghax1Qn3GF4SkWqgWi+nedwjYoJ@nongnu.org X-Gm-Message-State: AOJu0YwPPvYRaHHo2q4xbJlFT34WTuql58CdOnZQGvv1rSiCOqlj7whG lZYo0QIR2dJkHxEn6kDHo/nrcS8pRX+5NaPtY1GgfNk4LYfbpdzCrJrw9+Rst1iYntmS7+A17TW w X-Gm-Gg: ASbGnct46e1ZwaPMtG+znl0L9LMapsDq4xRD6gjq8V6vri/VDwvOanL7FVLGb/21Q06 5UpmUOHVg+NMGmHdwGov9QO8y7n4ezOIhIngBKBd8ks2FD7O/g4es8ISenQQ0W8/1gb1Lv1rlil ZhJhUXtex1Tegts8Jod3ytQ92y5DQyYrg5RnM3jmYHSAzv00dH7UdQfEgdvWhTH4C+R0WdlB/5z eO0KUlmZolBK2G+0bYxkEiFr/hiBcZfB0bS+PxGHLGXR4e6ISA/dB9bh0Wy+s00NQGzpU/Gbeor KBzC6Iognh4= X-Received: by 2002:a05:600c:35c3:b0:434:f131:1e71 with SMTP id 5b1f17b1804b1-438913cf2e0mr294415915e9.8.1737736214070; Fri, 24 Jan 2025 08:30:14 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:13 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 75/76] target/i386: Wire up MXCSR.DE and FPUS.DE correctly Date: Fri, 24 Jan 2025 16:28:35 +0000 Message-Id: <20250124162836.2332150-76-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 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 x86 DE bit in the FPU and MXCSR status is supposed to be set when an input denormal is consumed. We didn't previously report this from softfloat, so the x86 code either simply didn't set the DE bit or else incorrectly wired it up to denormal_flushed, depending on which register you looked at. Now we have input_denormal_used we can wire up these DE bits with the semantics they are supposed to have. Signed-off-by: Peter Maydell --- target/i386/tcg/fpu_helper.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index 97b46307d56..fd1cd823e9e 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -215,7 +215,7 @@ static void merge_exception_flags(CPUX86State *env, int old_flags) (new_flags & float_flag_overflow ? FPUS_OE : 0) | (new_flags & float_flag_underflow ? FPUS_UE : 0) | (new_flags & float_flag_inexact ? FPUS_PE : 0) | - (new_flags & float_flag_input_denormal_flushed ? FPUS_DE : 0))); + (new_flags & float_flag_input_denormal_used ? FPUS_DE : 0))); } static inline floatx80 helper_fdiv(CPUX86State *env, floatx80 a, floatx80 b) @@ -3251,6 +3251,7 @@ void update_mxcsr_status(CPUX86State *env) /* Set exception flags. */ set_float_exception_flags((mxcsr & FPUS_IE ? float_flag_invalid : 0) | + (mxcsr & FPUS_DE ? float_flag_input_denormal_used : 0) | (mxcsr & FPUS_ZE ? float_flag_divbyzero : 0) | (mxcsr & FPUS_OE ? float_flag_overflow : 0) | (mxcsr & FPUS_UE ? float_flag_underflow : 0) | @@ -3267,14 +3268,8 @@ void update_mxcsr_status(CPUX86State *env) void update_mxcsr_from_sse_status(CPUX86State *env) { int flags = get_float_exception_flags(&env->sse_status); - /* - * The MXCSR denormal flag has opposite semantics to - * float_flag_input_denormal_flushed (the softfloat code sets that flag - * only when flushing input denormals to zero, but SSE sets it - * only when not flushing them to zero), so is not converted - * here. - */ env->mxcsr |= ((flags & float_flag_invalid ? FPUS_IE : 0) | + (flags & float_flag_input_denormal_used ? FPUS_DE : 0) | (flags & float_flag_divbyzero ? FPUS_ZE : 0) | (flags & float_flag_overflow ? FPUS_OE : 0) | (flags & float_flag_underflow ? FPUS_UE : 0) | From patchwork Fri Jan 24 16:28:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 859620 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp890074wrq; Fri, 24 Jan 2025 08:51:47 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXsp08YPAzgutkpr8JkfDuRyGX9n6ozy8w+HZstawbAsRuIaZ21FEM8dTksxqL0j4+UwBdJsA==@linaro.org X-Google-Smtp-Source: AGHT+IEBVzQh+dEzZIx56O3noBPr1TM6gdXz+sGCuQ3SabNkBUh7ObPkbHxkA+UBT+82m84ugK6Z X-Received: by 2002:a05:6214:4107:b0:6e1:85d5:9723 with SMTP id 6a1803df08f44-6e1b220a779mr452813416d6.31.1737737506941; Fri, 24 Jan 2025 08:51:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737737506; cv=none; d=google.com; s=arc-20240605; b=Gs+P+h23gMSAapKKFvEM2TdcV9wlmiGLtJERwaWli+nHp4bvG4sRldqIJdG1mcrOxa zxFLzcHpVb6b/EbLJzhKM3oKCVGPzf6DNUZoDArPdRLeRNdEdWdzQ8sk4LbeVo4E+ZSi Lp6vQEGS6sKoPzAkF9uvwVa74aypDSSThS7Ifw14K8UD74N1Eh0wwUKuUShAamfkYo2h AFE25E2B28RkyLPYlVgezt156mnXEtMr1BrnyUbCfde+IXuaO+toDJ400m1iNByRQYKg NEyjJoRiZmT4EY8TzOuBGCuK1MjKeprdYTWlCR1oVG07WpctUgRSTlN2ZOQtxs89jq/2 7p/w== 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=1n4b3Sbe/IW5K25A4cb6upe/VFAy/+5L91fnNWowiOo=; fh=pV5qAre5DvtGSuA9WVFOxJ3NarFtg5IC/adD11/5EyM=; b=Nbuo2MoXRkQWne161w3CdnZ0u97n4mcA0ZusUHJEfXyMb4T0Q4StEhEiX5+F5kxeyF mr0KMjIdNRXwPThFPUhpRqp/qu7ctQMJjfgQLoXiJ9biGVDKb0W0cdS5NSl/wBH2AHdq eIBbMOh1cdlBUYS7PGhrK0R0WDuNc+hJ4TO98GlBewlz+KoXxV3TJbFbjbwLvB6WPM4L vvmaPmNqhlR48g0Y1/vm+rmk7CLgVSlX/lWXLMHnGjgPF9SnZOplpB7T83ADrw7Q9b1+ 3LVaVjXDf1Gsoy3ACtti9O5KendpEKLP5XFvPHQ0B0sPZ9UeTGYSBpEMBKM1/A0eMT3Z UXug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PV8FF46E; 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-46e6686cb75si25944591cf.10.2025.01.24.08.51.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Jan 2025 08:51:46 -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=PV8FF46E; 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 1tbMev-0003Z4-Kh; Fri, 24 Jan 2025 11:35:53 -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 1tbMZh-00069e-8a for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:32 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbMZX-00064i-Cq for qemu-devel@nongnu.org; Fri, 24 Jan 2025 11:30:22 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-436202dd730so16575645e9.2 for ; Fri, 24 Jan 2025 08:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737736215; x=1738341015; 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=1n4b3Sbe/IW5K25A4cb6upe/VFAy/+5L91fnNWowiOo=; b=PV8FF46EQSv655R6R1CYir2ekj1t3zcuAJArLS0pADO/Je02iwhQwJRko7wWBY24v6 kJ0D78uSLjpVZeahmynXUu4MiE4Z/WHo+c70WFLhKGLwc5ZzNE6mFEik+FMsJv7UFQ4J CjjHi2XQzkSn+CGTAH9wf5oEgHTzdKHfyDNan5s6lFqSS8/ZI7fRyEK3BIFpw6ye72cP BG2RBT0kZeX5UpnO/gWpHBxkRd1F3TuDup5x8Oh/ZGTwXGpoLLAFM47sKUJ/fDANGgnf SUkTq3cNmCn7lm3zbR6/Hmbq/NjnLp4/udeS2eqDyzKj92eP05MpW8dcG22c3oF8uAcN Z49A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737736215; x=1738341015; 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=1n4b3Sbe/IW5K25A4cb6upe/VFAy/+5L91fnNWowiOo=; b=SzH5QkVsjpxUjexgYmRBv/46YqraMfZOarzLfJzPDA8f1hs+nJdN4J41HI414QrHSv DuG5/zbUYaHtCsLF1QPvdyl2IoFu+AESPU6naq9zZdmWxKaf8QqJP4FAPQf+FEDhKcAy hEFMvhEvH+LgML6ULeNzH8MILFT8rqfjdX7nnOOyKzQA7EJAQog+m/qQaeP1cWMqtMXl C0Yzwhvf4OFn9rAaquytI0LAsg7O+X/4xO1pW65XziC5xLXDBHCkrvb+/VpgufulFlio Zkbgc5zMFd+DCxrxC8mUxwSXnyzDRYCJ9aIIHOhHYfUmvwk164085uene8sltvKVdkIg z4fQ== X-Forwarded-Encrypted: i=1; AJvYcCWMiN33IcAUQ4UNgkcoGBO5tfHOms/h2PGH5ns7KgE2e8+IoHyClhMuliGF3as7UfbUUeJL0CWNEDTk@nongnu.org X-Gm-Message-State: AOJu0YzYprbuhD+fmO2XVA6+SwsJqWcpCqwhQftErGpX+L2HXDmU+YA0 F5eKCItecrSUQcwJAKlOmFv1go8mDSuJ7YxMKUsWNF9rAgMWfRTh0l4SSjlrb3r0d1Pl+1F9oSa 7 X-Gm-Gg: ASbGnctHZJ55xT/Iqjn3nm1HGt9qTryPFMGCFmn7H9Dw+qVorKMChbpJb/eEb6CdK8G KxIyTogA4ETCkb4L0Wa7iCz9gXoGVgVtuAnn59Zk7czG6C7+gRybmA7W6TlMZzAJKAW+LHAX020 WaekpcfvP+NjOJjGTe8tqaxy2iwehlW0V6KEqRpIqjW7BTu20Bgul5CRN/54K407eRFPrs1dSZX cbExH6R5qm2qtyhZ/7eqbNRvfybWf7zhCJUS8l0j1Zkeva9B9zcEXnPnIsgyTOLXpM+x2zb/nx5 ZkwzKTpYuLs= X-Received: by 2002:a05:600c:4687:b0:435:b064:7dce with SMTP id 5b1f17b1804b1-438913f2df1mr295380125e9.18.1737736215407; Fri, 24 Jan 2025 08:30:15 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd47eecasm31683025e9.6.2025.01.24.08.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 08:30:14 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 76/76] tests/tcg/x86_64/fma: add test for exact-denormal output Date: Fri, 24 Jan 2025 16:28:36 +0000 Message-Id: <20250124162836.2332150-77-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250124162836.2332150-1-peter.maydell@linaro.org> References: <20250124162836.2332150-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Add some fma test cases that check for correct handling of FTZ and for the flag that indicates that the input denormal was consumed. Signed-off-by: Peter Maydell --- tests/tcg/x86_64/fma.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/tcg/x86_64/fma.c b/tests/tcg/x86_64/fma.c index 46f863005ed..34219614c0a 100644 --- a/tests/tcg/x86_64/fma.c +++ b/tests/tcg/x86_64/fma.c @@ -82,6 +82,18 @@ static testdata tests[] = { */ { 0x3fdfffffffffffff, 0x001fffffffffffff, 0x801fffffffffffff, true, 0x8010000000000000, 0x20 }, /* Enabling FTZ shouldn't change flags */ + /* + * normal * 0 + a denormal. With FTZ disabled this gives an exact + * result (equal to the input denormal) that has consumed the denormal. + */ + { 0x3cc8000000000000, 0x0000000000000000, 0x8008000000000000, false, + 0x8008000000000000, 0x2 }, /* Denormal */ + /* + * With FTZ enabled, this consumes the denormal, returns zero (because + * flushed) and indicates also Underflow and Precision. + */ + { 0x3cc8000000000000, 0x0000000000000000, 0x8008000000000000, true, + 0x8000000000000000, 0x32 }, /* Precision, Underflow, Denormal */ }; int main(void)