From nobody Fri Dec 19 17:09:52 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1733935079; cv=none; d=zohomail.com; s=zohoarc; b=E1O89vqEHkgbKqS878zH3CCkS8QTDieWWqFq73MQOEyvHmWPeMuyM1HqXDzkGFbVrS2U+LItFLUVHOPktwbHt+bjJ6YsIkS4UMqnEbNf8Uc8Hm4IYIwh//ADeajY83zXo703cZ2SD+GiTehRe6xmovE2Ed6Om6KhQkPuyQ0L0MU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733935079; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BT2CQNAxIU5n7++J+PUBPBasEOAUptPVV+g3YGfaYsg=; b=BO/e9EuJWnHKdJzSfr5zQmZBCYxIw1oW7CtJJt3IhVyUxMqeW02Qx5TImv6Qy7knk53vqXPvq11XE8UkkAzIxgukup7v3TNk9q+0JxRZjp7Dh0z43JBaBfFxYwewAMUu5GF8GG6w85ns3RHYMWrBkrNUuEZvcs2uMFbGZjo9ENM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1733935079314811.8701199899825; Wed, 11 Dec 2024 08:37:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLPh5-0006Zo-6m; Wed, 11 Dec 2024 11:36:11 -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 1tLPgy-0006LY-RZ for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:36:04 -0500 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLPgv-00025u-Uk for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:36:04 -0500 Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-6d88d3d1eb6so8339366d6.0 for ; Wed, 11 Dec 2024 08:36:01 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d8da675214sm71856276d6.11.2024.12.11.08.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 08:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733934961; x=1734539761; 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=BT2CQNAxIU5n7++J+PUBPBasEOAUptPVV+g3YGfaYsg=; b=mkXkYWAwMp0+HyA3WOx6vH4aTsyVB7Peve5Le0LyBTZNbTriivCQ5Y5RoXnNVDhehN XOEKZGTYOr8lR8yl5DyNp2oNb+Ij5y4lt2BYiXGDNUKmIv7gtlzYPj+4ReWqAS8Qnz/f FvUbWXdIW7/fcmPTBTFNuYr7AK+exLd1+cOFtWmjGOLCqduinc6ino12APVn+xBVI37e +CTQO5BozMR1XF9Bvl6czPvCGYU4QWtDF8ZnGhjGIaj8lNHjvcSilHtqxanX5DzjDA6V 3hRRP9JwmYdDxYPdEDxKtPCMDcmz5RVGFo2UJaNPFSm/kPDvfw78mUTzggufs/OJzFd4 2uaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733934961; x=1734539761; 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=BT2CQNAxIU5n7++J+PUBPBasEOAUptPVV+g3YGfaYsg=; b=EXgiYlq/MXmPLCvd5vzSIxIOU+l7wGNyh3mf6vkpUcfCPbfq7A2uXERgaO8Pq/OQLF ccguG4LnB9taOrj8YSXm2bvTCdOjCQPNQ84e3VtVyKiTLcKfjzBvmnCcEjmB8hWjyDF1 ZGcmYJNst2yev3bI0TsbxinF5r807Po5DSvCWXHrTo9y20ImKiAmIJ5GfmuORv45sQJW UjA6LagfOaVp7gXgC4Hti09O+9IOfJ4xVh70zKHhbwMsKlVjM7b85f3xbQIM3COXwXDj zZWBBHwg95eMxl8TMgISIMCyn83o8DX+I5d7xxiJOwumQ6k9R7ilSnEy65GWVQXweYEG 7koQ== X-Gm-Message-State: AOJu0YwdIAhfeSzx1vG2IqnuG6mg+eVg6ZnQnldB/APvQ5vh2WvtaeJp Rb4i2oSJtV03ALNAxTjP9WSJev05v8JxL/t5Htc6McSaYqewZR9wnpcXAhslFdF6dKkMLHGEdSC m0i3Kzasy X-Gm-Gg: ASbGnctVL1UuCrYsKVSKx2NGgRfX+bIagMtvXhEbSC5gmVvLgU+U44m5ftCaq0SfYjd wd8UfvuqVIJpKf2Wd8+3XDv7lrfErMgKn3XTrYP+rnf1tlby3n0L+cR4OpkwmpVLtFk8LhRKD0h y2Tw1F4maU3GYzkR5hbJ3NJrkk6qOIv1Jd3HxPzIh+wtKgLga8HMLFnQHj56eysqZ9CmmLbe3ZU PaQqih7VyIJTI94/uzxJy4EPq+gOcC32FlkgfT+PaV765VGUQiRO7TQrDpNSg== X-Google-Smtp-Source: AGHT+IFBF/qbhL7OQOikB73Q6JQagVVAAiDcY4gIrLNT6lo5X+YTPOFA+sS0UqY8tGM+IdLj7q8wQw== X-Received: by 2002:a05:6214:d6b:b0:6d8:a9a6:83ef with SMTP id 6a1803df08f44-6d9353193a4mr51936416d6.20.1733934960779; Wed, 11 Dec 2024 08:36:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 48/69] target/arm: Introduce clear_vec Date: Wed, 11 Dec 2024 10:30:15 -0600 Message-ID: <20241211163036.2297116-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241211163036.2297116-1-richard.henderson@linaro.org> References: <20241211163036.2297116-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::f2c; envelope-from=richard.henderson@linaro.org; helo=mail-qv1-xf2c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1733935081068116600 In a couple of places, clearing the entire vector before storing one element is the easiest solution. Wrap that into a helper function. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 717d30dd5b..0e8e867058 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -628,7 +628,16 @@ static TCGv_i32 read_fp_hreg(DisasContext *s, int reg) return v; } =20 -/* Clear the bits above an N-bit vector, for N =3D (is_q ? 128 : 64). +static void clear_vec(DisasContext *s, int rd) +{ + unsigned ofs =3D fp_reg_offset(s, rd, MO_64); + unsigned vsz =3D vec_full_reg_size(s); + + tcg_gen_gvec_dup_imm(MO_64, ofs, vsz, vsz, 0); +} + +/* + * Clear the bits above an N-bit vector, for N =3D (is_q ? 128 : 64). * If SVE is not enabled, then there are only 128 bits in the vector. */ static void clear_vec_high(DisasContext *s, bool is_q, int rd) @@ -4851,7 +4860,6 @@ static bool trans_SM3SS1(DisasContext *s, arg_SM3SS1 = *a) TCGv_i32 tcg_op2 =3D tcg_temp_new_i32(); TCGv_i32 tcg_op3 =3D tcg_temp_new_i32(); TCGv_i32 tcg_res =3D tcg_temp_new_i32(); - unsigned vsz, dofs; =20 read_vec_element_i32(s, tcg_op1, a->rn, 3, MO_32); read_vec_element_i32(s, tcg_op2, a->rm, 3, MO_32); @@ -4863,9 +4871,7 @@ static bool trans_SM3SS1(DisasContext *s, arg_SM3SS1 = *a) tcg_gen_rotri_i32(tcg_res, tcg_res, 25); =20 /* Clear the whole register first, then store bits [127:96]. */ - vsz =3D vec_full_reg_size(s); - dofs =3D vec_full_reg_offset(s, a->rd); - tcg_gen_gvec_dup_imm(MO_64, dofs, vsz, vsz, 0); + clear_vec(s, a->rd); write_vec_element_i32(s, tcg_res, a->rd, 3, MO_32); } return true; @@ -6307,7 +6313,6 @@ static bool do_scalar_muladd_widening_idx(DisasContex= t *s, arg_rrx_e *a, TCGv_i64 t0 =3D tcg_temp_new_i64(); TCGv_i64 t1 =3D tcg_temp_new_i64(); TCGv_i64 t2 =3D tcg_temp_new_i64(); - unsigned vsz, dofs; =20 if (acc) { read_vec_element(s, t0, a->rd, 0, a->esz + 1); @@ -6317,9 +6322,7 @@ static bool do_scalar_muladd_widening_idx(DisasContex= t *s, arg_rrx_e *a, fn(t0, t1, t2); =20 /* Clear the whole register first, then store scalar. */ - vsz =3D vec_full_reg_size(s); - dofs =3D vec_full_reg_offset(s, a->rd); - tcg_gen_gvec_dup_imm(MO_64, dofs, vsz, vsz, 0); + clear_vec(s, a->rd); write_vec_element(s, t0, a->rd, 0, a->esz + 1); } return true; --=20 2.43.0