From: Max Chou <max.chou@sifive.com>
To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Cc: Max Chou <max.chou@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Bin Meng <bin.meng@windriver.com>,
Weiwei Li <liweiwei@iscas.ac.cn>,
Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
Lawrence Hunter <lawrence.hunter@codethink.co.uk>,
Nazar Kazakov <nazar.kazakov@codethink.co.uk>
Subject: [PATCH v2 04/14] target/riscv: Replace Zvbb checking by Zvkb
Date: Thu, 26 Oct 2023 23:18:11 +0800 [thread overview]
Message-ID: <20231026151828.754279-5-max.chou@sifive.com> (raw)
In-Reply-To: <20231026151828.754279-1-max.chou@sifive.com>
The Zvkb extension is a proper subset of the Zvbb extension and includes
following instructions:
* vandn.[vv,vx]
* vbrev8.v
* vrev8.v
* vrol.[vv,vx]
* vror.[vv,vx,vi]
Signed-off-by: Max Chou <max.chou@sifive.com>
---
target/riscv/insn_trans/trans_rvvk.c.inc | 37 +++++++++++++++---------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/target/riscv/insn_trans/trans_rvvk.c.inc b/target/riscv/insn_trans/trans_rvvk.c.inc
index e691519ed78..3801c16829d 100644
--- a/target/riscv/insn_trans/trans_rvvk.c.inc
+++ b/target/riscv/insn_trans/trans_rvvk.c.inc
@@ -112,24 +112,27 @@ GEN_VX_MASKED_TRANS(vclmulh_vx, vclmul_vx_check)
return false; \
}
-static bool zvbb_vv_check(DisasContext *s, arg_rmrr *a)
+static bool zvkb_vv_check(DisasContext *s, arg_rmrr *a)
{
- return opivv_check(s, a) && s->cfg_ptr->ext_zvbb == true;
+ return opivv_check(s, a) &&
+ (s->cfg_ptr->ext_zvbb == true || s->cfg_ptr->ext_zvkb == true);
}
-static bool zvbb_vx_check(DisasContext *s, arg_rmrr *a)
+static bool zvkb_vx_check(DisasContext *s, arg_rmrr *a)
{
- return opivx_check(s, a) && s->cfg_ptr->ext_zvbb == true;
+ return opivx_check(s, a) &&
+ (s->cfg_ptr->ext_zvbb == true || s->cfg_ptr->ext_zvkb == true);
}
/* vrol.v[vx] */
-GEN_OPIVV_GVEC_TRANS_CHECK(vrol_vv, rotlv, zvbb_vv_check)
-GEN_OPIVX_GVEC_SHIFT_TRANS_CHECK(vrol_vx, rotls, zvbb_vx_check)
+GEN_OPIVV_GVEC_TRANS_CHECK(vrol_vv, rotlv, zvkb_vv_check)
+GEN_OPIVX_GVEC_SHIFT_TRANS_CHECK(vrol_vx, rotls, zvkb_vx_check)
/* vror.v[vxi] */
-GEN_OPIVV_GVEC_TRANS_CHECK(vror_vv, rotrv, zvbb_vv_check)
-GEN_OPIVX_GVEC_SHIFT_TRANS_CHECK(vror_vx, rotrs, zvbb_vx_check)
-GEN_OPIVI_GVEC_TRANS_CHECK(vror_vi, IMM_TRUNC_SEW, vror_vx, rotri, zvbb_vx_check)
+GEN_OPIVV_GVEC_TRANS_CHECK(vror_vv, rotrv, zvkb_vv_check)
+GEN_OPIVX_GVEC_SHIFT_TRANS_CHECK(vror_vx, rotrs, zvkb_vx_check)
+GEN_OPIVI_GVEC_TRANS_CHECK(vror_vi, IMM_TRUNC_SEW, vror_vx, rotri,
+ zvkb_vx_check)
#define GEN_OPIVX_GVEC_TRANS_CHECK(NAME, SUF, CHECK) \
static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
@@ -147,8 +150,8 @@ GEN_OPIVI_GVEC_TRANS_CHECK(vror_vi, IMM_TRUNC_SEW, vror_vx, rotri, zvbb_vx_check
}
/* vandn.v[vx] */
-GEN_OPIVV_GVEC_TRANS_CHECK(vandn_vv, andc, zvbb_vv_check)
-GEN_OPIVX_GVEC_TRANS_CHECK(vandn_vx, andcs, zvbb_vx_check)
+GEN_OPIVV_GVEC_TRANS_CHECK(vandn_vv, andc, zvkb_vv_check)
+GEN_OPIVX_GVEC_TRANS_CHECK(vandn_vx, andcs, zvkb_vx_check)
#define GEN_OPIV_TRANS(NAME, CHECK) \
static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
@@ -188,8 +191,16 @@ static bool zvbb_opiv_check(DisasContext *s, arg_rmr *a)
vext_check_ss(s, a->rd, a->rs2, a->vm);
}
-GEN_OPIV_TRANS(vbrev8_v, zvbb_opiv_check)
-GEN_OPIV_TRANS(vrev8_v, zvbb_opiv_check)
+static bool zvkb_opiv_check(DisasContext *s, arg_rmr *a)
+{
+ return (s->cfg_ptr->ext_zvbb == true || s->cfg_ptr->ext_zvkb == true) &&
+ require_rvv(s) &&
+ vext_check_isa_ill(s) &&
+ vext_check_ss(s, a->rd, a->rs2, a->vm);
+}
+
+GEN_OPIV_TRANS(vbrev8_v, zvkb_opiv_check)
+GEN_OPIV_TRANS(vrev8_v, zvkb_opiv_check)
GEN_OPIV_TRANS(vbrev_v, zvbb_opiv_check)
GEN_OPIV_TRANS(vclz_v, zvbb_opiv_check)
GEN_OPIV_TRANS(vctz_v, zvbb_opiv_check)
--
2.34.1
next prev parent reply other threads:[~2023-10-26 15:22 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-26 15:18 [PATCH v2 00/14] Update RISC-V vector crypto to ratified v1.0.0 Max Chou
2023-10-26 15:18 ` [PATCH v2 01/14] target/riscv: Add cfg property for Zvkt extension Max Chou
2023-10-30 14:34 ` Daniel Henrique Barboza
2023-11-02 0:44 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 02/14] target/riscv: Expose Zvkt extension property Max Chou
2023-10-30 14:35 ` Daniel Henrique Barboza
2023-11-02 0:44 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 03/14] target/riscv: Add cfg property for Zvkb extension Max Chou
2023-10-30 14:49 ` Daniel Henrique Barboza
2023-11-02 0:45 ` Alistair Francis
2023-10-26 15:18 ` Max Chou [this message]
2023-10-30 17:23 ` [PATCH v2 04/14] target/riscv: Replace Zvbb checking by Zvkb Daniel Henrique Barboza
2023-11-02 0:46 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 05/14] target/riscv: Expose Zvkb extension property Max Chou
2023-10-30 17:24 ` Daniel Henrique Barboza
2023-11-02 0:47 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 06/14] target/riscv: Add cfg properties for Zvkn[c|g] extensions Max Chou
2023-10-30 17:28 ` Daniel Henrique Barboza
2023-11-02 0:49 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 07/14] target/riscv: Expose Zvkn[c|g] extnesion properties Max Chou
2023-10-30 17:29 ` Daniel Henrique Barboza
2023-11-02 0:49 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 08/14] target/riscv: Add cfg properties for Zvks[c|g] extensions Max Chou
2023-10-30 17:30 ` Daniel Henrique Barboza
2023-11-02 0:50 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 09/14] target/riscv: Expose Zvks[c|g] extnesion properties Max Chou
2023-10-30 17:30 ` Daniel Henrique Barboza
2023-11-02 0:50 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 10/14] target/riscv: Move vector crypto extensions to riscv_cpu_extensions Max Chou
2023-10-30 17:33 ` Daniel Henrique Barboza
2023-11-02 0:51 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 11/14] disas/riscv: Add rv_fmt_vd_vs2_uimm format Max Chou
2023-11-02 0:52 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 12/14] disas/riscv: Add rv_codec_vror_vi for vror.vi Max Chou
2023-11-02 0:57 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 13/14] disas/riscv: Add support for vector crypto extensions Max Chou
2023-11-02 0:59 ` Alistair Francis
2023-10-26 15:18 ` [PATCH v2 14/14] disas/riscv: Replace TABs with space Max Chou
2023-11-02 1:00 ` Alistair Francis
2023-11-02 1:38 ` [PATCH v2 00/14] Update RISC-V vector crypto to ratified v1.0.0 Alistair Francis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231026151828.754279-5-max.chou@sifive.com \
--to=max.chou@sifive.com \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=dbarboza@ventanamicro.com \
--cc=lawrence.hunter@codethink.co.uk \
--cc=liweiwei@iscas.ac.cn \
--cc=nazar.kazakov@codethink.co.uk \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).