From patchwork Mon Jul 22 17:29:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 813737 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp1976025wro; Mon, 22 Jul 2024 10:31:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWy9BkDj6nQq8zlen2I6nkDUs2OiEpuIu49Tz2KlpaOrmVuRAnAdCED/DzFEGduo0wkgphqBAJAyFupJ/URZshq X-Google-Smtp-Source: AGHT+IHqmIFS0aPzqMwbVV35FyE7YbCXlGao44wztttAH+U1kxacgHTcmGeGWXjKxgrPDveeUVKa X-Received: by 2002:a05:6808:1383:b0:3d9:21db:d077 with SMTP id 5614622812f47-3dafd0ef4admr528618b6e.29.1721669505621; Mon, 22 Jul 2024 10:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721669505; cv=none; d=google.com; s=arc-20160816; b=mmkTQ1QOvFshj+rJXTQ/uECK94+6Axjos0qG6OeU1TVZgZ15WLr4ykjbWAdonOCZst 5SowemmLnjgbXRDOw8uCCnneUi/sU/eUa4PT9fuWhODWKPcoe5VBXu+NIFGBmTVYfuAH tiSbm5G5s/J9MY7HBwteDz/dPcjcEkiW4xPIwF1EbniSAYwOegvj5tl24y2jN7jC9KkK 4HE1UREqkkmyQhcQbgGqhznjufTJpqAjojviEhDap5A60yRQtxpmXa60haXhZR2ymCoE LjS8dAd4u4lW4pq4DxMKwvb8PmBk4+fe2DyA8MdXl41A3OxeT6eN9JvO9euPn+ONShwL LJPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8nfDaGNYYtX7WTms9otZZ/RyOW6fJggHI+PAByoitQ4=; fh=uewkf1CHRcq3o2W/lNTg+Le+tU4LIv4Gc5cu8MqPE/4=; b=iQHh734Q3R6CsWnhc42pD56qvI4FWNSJxqwCuVnh+f8tr7iU7XAWj5pzET5cTkiNZ0 SkV6mHcb7UptTQK8T9E9+6deg1A5QYjoMuthDp39v1IlhiNfUkTkhCQwWU5YYgRfPRjl 6nP1Bc/+oP8TKx5HThuF0xdy56SNk7bivUUQ6qc/6s6V/5v0clobCbdYUzKjxiSuhgkR wdk1CyJUoiphEX8kL/S0rKh71dukRPtfhzpY97LBcEeXY3GO53BYce25fdYFns1HF5BU F6PKc3YFkRywFf9WrOffJXI/Kpzsn8sWm82t8B0zkSXQPbVuzdPhvKU6fx17HlYki1Nk tVsg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tcp7YWDt; 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-49279395c17si1571956137.518.2024.07.22.10.31.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2024 10:31:45 -0700 (PDT) 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=Tcp7YWDt; 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 1sVwrc-0000T3-Dt; Mon, 22 Jul 2024 13:30:20 -0400 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 1sVwrZ-0000HO-Fl for qemu-devel@nongnu.org; Mon, 22 Jul 2024 13:30:17 -0400 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 1sVwrR-0006Nj-BU for qemu-devel@nongnu.org; Mon, 22 Jul 2024 13:30:17 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-426717a2d12so23240835e9.0 for ; Mon, 22 Jul 2024 10:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721669400; x=1722274200; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8nfDaGNYYtX7WTms9otZZ/RyOW6fJggHI+PAByoitQ4=; b=Tcp7YWDtRpvssscB17O8CJJ0K1Yook0ZQ0ZdLXoZbozNBycZDgTt4Kl+8+SqogyexN O7kD8GL768c7N9YJFd1BU+U3bzU4bIEfeLIXAMuN5KecC+RZgn9JhrVNT3wHHrEWweOm 4Ps64CWkY+SPF8jwRX0Ey7bY8nro7uVzQs7BxqoSS1uNXHA6LcKK2QzZ3LNgnCLoBpmX yNG3qjhgw+c/KQ/TpNqpwnc9m4cA1p3CTMgTFZcktezSIGQOoJaSMD28pq/Is0NN4U/r aNPBeFGtBSm+9fCC97XxTJIVHGuDwWIFqX4Sl0wVJ02T6FOyDGG4YPa8gSVvLobsGVUv 8W2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721669400; x=1722274200; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8nfDaGNYYtX7WTms9otZZ/RyOW6fJggHI+PAByoitQ4=; b=coDjx4491Qvh+1lwdOU13PYMA8YVnCjtC+G945SxqJCH9MaX8mZKEH1OQ8CpGaujGn Y1VtUmtYfsOe7Zuupdlsc/suE03/KoLPYU68a4hGpXJ5lKc26EcSEix0ai1vrRPAbQmM 8lwumi7PUZmOICLOYgsdkhI7SdIRzw+F+EzTgGgvYFczrJ/rh2Zcdx/7hMqcXs7N0PBQ raWk/8NGXViqr87uAq5YH9dZc0cMJ6emtjbWO60QmiH6C3S1hcrFtrOPbyCraiHpMkfY SEZBs3nsOSVif8cG9q7itcDcYWN0RYNHWAuGR8FMcyLwaX5IpREDhfaNwqY2ngkKVCKx Ya/g== X-Forwarded-Encrypted: i=1; AJvYcCVzkoeEKpVP+ev0ONlIt6Jn/UKKWCYwHN0Pk1hLjThaIV9LpjtPl4BrnJlf0syHZFYVEZTtPWjDnBhwv0K7fayJPJtOGhg= X-Gm-Message-State: AOJu0Yxsf1qL3VH455U2/pn2XUqcugCLKj6UHJQFuoosalLIJqPwkcBz 96ivCz0We3P5jvEDWov7FV5AGAMdqAwSdTkCu9+UQjVpuNm1Ex56sy91wfKZMew= X-Received: by 2002:a05:600c:4509:b0:426:67fa:f7 with SMTP id 5b1f17b1804b1-427d2a954c2mr89604295e9.9.1721669399753; Mon, 22 Jul 2024 10:29:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d68fa493sm138035665e9.10.2024.07.22.10.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 10:29:59 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org Subject: [PATCH 1/4] target/arm: Don't assert for 128-bit tile accesses when SVL is 128 Date: Mon, 22 Jul 2024 18:29:54 +0100 Message-Id: <20240722172957.1041231-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240722172957.1041231-1-peter.maydell@linaro.org> References: <20240722172957.1041231-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 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 an instruction which accesses a 128-bit element tile when the SVL is also 128 (for example MOV z0.Q, p0/M, ZA0H.Q[w0,0]), we will assert in get_tile_rowcol(): qemu-system-aarch64: ../../tcg/tcg-op.c:926: tcg_gen_deposit_z_i32: Assertion `len > 0' failed. This happens because we calculate len = ctz32(streaming_vec_reg_size(s)) - esz;$ but if the SVL and the element size are the same len is 0, and the deposit operation asserts. In this case the ZA storage contains exactly one 128 bit element ZA tile, and the horizontal or vertical slice is just that tile. This means that regardless of the index value in the Ws register, we always access that tile. (In pseudocode terms, we calculate (index + offset) MOD 1, which is 0.) Special case the len == 0 case to avoid hitting the assertion in tcg_gen_deposit_z_i32(). Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate-sme.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/translate-sme.c b/target/arm/tcg/translate-sme.c index 185a8a917b0..a50a419af27 100644 --- a/target/arm/tcg/translate-sme.c +++ b/target/arm/tcg/translate-sme.c @@ -49,7 +49,15 @@ static TCGv_ptr get_tile_rowcol(DisasContext *s, int esz, int rs, /* Prepare a power-of-two modulo via extraction of @len bits. */ len = ctz32(streaming_vec_reg_size(s)) - esz; - if (vertical) { + if (!len) { + /* + * SVL is 128 and the element size is 128. There is exactly + * one 128x128 tile in the ZA storage, and so we calculate + * (Rs + imm) MOD 1, which is always 0. We need to special case + * this because TCG doesn't allow deposit ops with len 0. + */ + tcg_gen_movi_i32(tmp, 0); + } else if (vertical) { /* * Compute the byte offset of the index within the tile: * (index % (svl / size)) * size