From nobody Sun May 11 15:55:44 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1694414780; cv=none; d=zohomail.com; s=zohoarc; b=O3+sZo7UtEV9Bwt96T1UvbPm1nsEAlf9ptiC+SMBH9Opoi6TdHDpDubXUxk9fo4gDlfF/EcX8KeIjFtzqg/OTlNsKUrpjbtiL3gqeYjq6R5p36ia27FvmJtHIYJy+Kdvaa5ch6l/qECsysM8rdozKr5AmBA0dvW95PF44s0Mc3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694414780; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nTIPyYdgqpfPvLBboQ7TsJe7pH9+EMYhManEx2tFzDg=; b=QJTaRP62tBdEzf+GM/u61V26mnNYiYTJgYr1L4OZm2qpo+MXB+8HrJtixX+kzUVdNVpGcOmSFKa60hSkqsrn0hDLFnyGG5PaFq3KVBT3TIgr9aAd7pfHFoQR/xLnaFNR9zqChFHn4mWyMSsAJ6Ag3/BSrmbasbwVvrA/ek08tXU= 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=<alistair23@gmail.com> (p=none dis=none) Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694414780128820.3896433619061; Sun, 10 Sep 2023 23:46:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1qfaer-0000cW-8r; Mon, 11 Sep 2023 02:44:29 -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 <alistair23@gmail.com>) id 1qfaeq-0000cC-K5 for qemu-devel@nongnu.org; Mon, 11 Sep 2023 02:44:28 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <alistair23@gmail.com>) id 1qfaeo-0004Vz-8j for qemu-devel@nongnu.org; Mon, 11 Sep 2023 02:44:28 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-68cbbff84f6so3528861b3a.1 for <qemu-devel@nongnu.org>; Sun, 10 Sep 2023 23:44:25 -0700 (PDT) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id q12-20020a656a8c000000b00553dcfc2179sm4264606pgu.52.2023.09.10.23.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Sep 2023 23:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694414664; x=1695019464; 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=nTIPyYdgqpfPvLBboQ7TsJe7pH9+EMYhManEx2tFzDg=; b=WDUOKm6ia2YpBYzk+ucDec2MhLsfE+L1EYxh03bAXBoBDlkNkdqoDjf3AMmQ501niZ s3t8P0isffuBLr5SK1X9LSjQK4GBA9Ix3huSBUx0AFjJsd7LgJBQUT6LMGQRZku8oVKn j+jWhsFYwMGjcsDofiEAxiXUqcHHBu0lCaPnA8gB8D5BZCuBL07a58QXGjRhZOPZ9kto 7ffd9vP7KyHHSu3he7n1dNE+yuw7MZ4jBNZPHkMLdfaJnPC60VzGNNLGI+E0UspdPjXB zM31p6HYyIqqeOcXmuRsUuC4zBlapweYvnDtYvcwl+yTTh3AHY929bsk4JxSE2J31FDm k2og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694414664; x=1695019464; 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=nTIPyYdgqpfPvLBboQ7TsJe7pH9+EMYhManEx2tFzDg=; b=maSmhHw0fKVB6R42ynAtqzOdYs6rWwFUodkMcsvUXxXVIwjRRl2xIDtWIACw9glyjA 6gytnpFOiPOjrorHfxdRNwptGO6c6AHnh7+pgyzQoFT3UHkXYb6c2dwYVZSzd2kCfyc3 0q/6/ZK070SZ3HUMxGP1N6QQqyLhJCT6pcFhX5AdzYFarGvmAcBsyE1Su/rl/HeS7haR NSWE1WnIp+DFyKhDfRxB0XpsmQbganaIclCdpS+wUPTWke+m2OOSxgLsU5OFzwsPzA1L cy0GrnDVX3f+oGGwV5n3+zr5OkI57WanHx/KaVa7ao8ie+0UxsQ7U2Rh2XrIrq/SwW2l KWtA== X-Gm-Message-State: AOJu0YxqtUgD7WrnoohRmhrSL6Z6Hnsrs6dtEUC1krcgOsZNUSsUZ8V1 32aHBd56CIocXrkft10CnE6RQi9XDPufHQ== X-Google-Smtp-Source: AGHT+IEjWyZmGzMoiDvriRSPlBIy0FkULnBOAsBMEYOX61DPSCqz882UpcokJSqtMMKTbHkeRKnq9g== X-Received: by 2002:a05:6a20:2444:b0:14b:f78e:d061 with SMTP id t4-20020a056a20244400b0014bf78ed061mr11669321pzc.19.1694414664304; Sun, 10 Sep 2023 23:44:24 -0700 (PDT) From: Alistair Francis <alistair23@gmail.com> X-Google-Original-From: Alistair Francis <alistair.francis@wdc.com> To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Nazar Kazakov <nazar.kazakov@codethink.co.uk>, Richard Henderson <richard.henderson@linaro.org>, Weiwei Li <liweiwei@iscas.ac.cn>, Max Chou <max.chou@sifive.com>, Alistair Francis <alistair.francis@wdc.com> Subject: [PULL v2 12/45] target/riscv: Move vector translation checks Date: Mon, 11 Sep 2023 16:42:47 +1000 Message-ID: <20230911064320.939791-13-alistair.francis@wdc.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911064320.939791-1-alistair.francis@wdc.com> References: <20230911064320.939791-1-alistair.francis@wdc.com> MIME-Version: 1.0 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::435; envelope-from=alistair23@gmail.com; helo=mail-pf1-x435.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=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 @gmail.com) X-ZM-MESSAGEID: 1694414781947100005 Content-Type: text/plain; charset="utf-8" From: Nazar Kazakov <nazar.kazakov@codethink.co.uk> Move the checks out of `do_opiv{v,x,i}_gvec{,_shift}` functions and into the corresponding macros. This enables the functions to be reused in proceeding commits without check duplication. Signed-off-by: Nazar Kazakov <nazar.kazakov@codethink.co.uk> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn> Signed-off-by: Max Chou <max.chou@sifive.com> Message-ID: <20230711165917.2629866-6-max.chou@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com> --- target/riscv/insn_trans/trans_rvv.c.inc | 28 +++++++++++-------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index bf7384c065..641cf5da6f 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -1183,9 +1183,6 @@ do_opivv_gvec(DisasContext *s, arg_rmrr *a, GVecGen3F= n *gvec_fn, gen_helper_gvec_4_ptr *fn) { TCGLabel *over =3D gen_new_label(); - if (!opivv_check(s, a)) { - return false; - } =20 tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); =20 @@ -1218,6 +1215,9 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a= ) \ gen_helper_##NAME##_b, gen_helper_##NAME##_h, \ gen_helper_##NAME##_w, gen_helper_##NAME##_d, \ }; \ + if (!opivv_check(s, a)) { \ + return false; \ + } \ return do_opivv_gvec(s, a, tcg_gen_gvec_##SUF, fns[s->sew]); \ } =20 @@ -1276,10 +1276,6 @@ static inline bool do_opivx_gvec(DisasContext *s, arg_rmrr *a, GVecGen2sFn *gvec_fn, gen_helper_opivx *fn) { - if (!opivx_check(s, a)) { - return false; - } - if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) { TCGv_i64 src1 =3D tcg_temp_new_i64(); =20 @@ -1301,6 +1297,9 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a= ) \ gen_helper_##NAME##_b, gen_helper_##NAME##_h, \ gen_helper_##NAME##_w, gen_helper_##NAME##_d, \ }; \ + if (!opivx_check(s, a)) { \ + return false; \ + } \ return do_opivx_gvec(s, a, tcg_gen_gvec_##SUF, fns[s->sew]); \ } =20 @@ -1432,10 +1431,6 @@ static inline bool do_opivi_gvec(DisasContext *s, arg_rmrr *a, GVecGen2iFn *gvec_fn, gen_helper_opivx *fn, imm_mode_t imm_mode) { - if (!opivx_check(s, a)) { - return false; - } - if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) { gvec_fn(s->sew, vreg_ofs(s, a->rd), vreg_ofs(s, a->rs2), extract_imm(s, a->rs1, imm_mode), MAXSZ(s), MAXSZ(s)); @@ -1453,6 +1448,9 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a= ) \ gen_helper_##OPIVX##_b, gen_helper_##OPIVX##_h, \ gen_helper_##OPIVX##_w, gen_helper_##OPIVX##_d, \ }; \ + if (!opivx_check(s, a)) { \ + return false; \ + } \ return do_opivi_gvec(s, a, tcg_gen_gvec_##SUF, \ fns[s->sew], IMM_MODE); \ } @@ -1775,10 +1773,6 @@ static inline bool do_opivx_gvec_shift(DisasContext *s, arg_rmrr *a, GVecGen2sFn32 *gvec_fn, gen_helper_opivx *fn) { - if (!opivx_check(s, a)) { - return false; - } - if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) { TCGv_i32 src1 =3D tcg_temp_new_i32(); =20 @@ -1800,7 +1794,9 @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a= ) \ gen_helper_##NAME##_b, gen_helper_##NAME##_h, \ gen_helper_##NAME##_w, gen_helper_##NAME##_d, \ }; \ - \ + if (!opivx_check(s, a)) { \ + return false; \ + } \ return do_opivx_gvec_shift(s, a, tcg_gen_gvec_##SUF, fns[s->sew]); \ } =20 --=20 2.41.0