aboutsummaryrefslogtreecommitdiff
path: root/target/riscv/insn_trans
diff options
context:
space:
mode:
authorFrank Chang <frank.chang@sifive.com>2021-12-10 15:56:05 +0800
committerAlistair Francis <alistair.francis@wdc.com>2021-12-20 14:51:36 +1000
commitd9b7609a1fb237dd05fac4cfe5163429115c9c6d (patch)
tree2f0d01ac0c4edc86b8db166539b8b95563633909 /target/riscv/insn_trans
parent57a2d89a82be6167a5200b5efa66b89686ce3141 (diff)
target/riscv: rvv-1.0: configure instructions
Signed-off-by: Frank Chang <frank.chang@sifive.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20211210075704.23951-20-frank.chang@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv/insn_trans')
-rw-r--r--target/riscv/insn_trans/trans_rvv.c.inc62
1 files changed, 27 insertions, 35 deletions
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
index afec187333..049688d83a 100644
--- a/target/riscv/insn_trans/trans_rvv.c.inc
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
@@ -120,59 +120,51 @@ static bool require_noover(const int8_t dst, const int8_t dst_lmul,
return !is_overlapped(dst, dst_size, src, src_size);
}
-static bool trans_vsetvl(DisasContext *ctx, arg_vsetvl *a)
+static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2)
{
- TCGv s1, s2, dst;
+ TCGv s1, dst;
- if (!require_rvv(ctx) || !has_ext(ctx, RVV)) {
+ if (!require_rvv(s) || !has_ext(s, RVV)) {
return false;
}
- s2 = get_gpr(ctx, a->rs2, EXT_ZERO);
- dst = dest_gpr(ctx, a->rd);
+ dst = dest_gpr(s, rd);
- /* Using x0 as the rs1 register specifier, encodes an infinite AVL */
- if (a->rs1 == 0) {
+ if (rd == 0 && rs1 == 0) {
+ s1 = tcg_temp_new();
+ tcg_gen_mov_tl(s1, cpu_vl);
+ } else if (rs1 == 0) {
/* As the mask is at least one bit, RV_VLEN_MAX is >= VLMAX */
s1 = tcg_constant_tl(RV_VLEN_MAX);
} else {
- s1 = get_gpr(ctx, a->rs1, EXT_ZERO);
+ s1 = get_gpr(s, rs1, EXT_ZERO);
}
+
gen_helper_vsetvl(dst, cpu_env, s1, s2);
- gen_set_gpr(ctx, a->rd, dst);
- mark_vs_dirty(ctx);
+ gen_set_gpr(s, rd, dst);
+ mark_vs_dirty(s);
- tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn);
+ tcg_gen_movi_tl(cpu_pc, s->pc_succ_insn);
tcg_gen_lookup_and_goto_ptr();
- ctx->base.is_jmp = DISAS_NORETURN;
- return true;
-}
+ s->base.is_jmp = DISAS_NORETURN;
-static bool trans_vsetvli(DisasContext *ctx, arg_vsetvli *a)
-{
- TCGv s1, s2, dst;
-
- if (!require_rvv(ctx) || !has_ext(ctx, RVV)) {
- return false;
+ if (rd == 0 && rs1 == 0) {
+ tcg_temp_free(s1);
}
- s2 = tcg_constant_tl(a->zimm);
- dst = dest_gpr(ctx, a->rd);
+ return true;
+}
- /* Using x0 as the rs1 register specifier, encodes an infinite AVL */
- if (a->rs1 == 0) {
- /* As the mask is at least one bit, RV_VLEN_MAX is >= VLMAX */
- s1 = tcg_constant_tl(RV_VLEN_MAX);
- } else {
- s1 = get_gpr(ctx, a->rs1, EXT_ZERO);
- }
- gen_helper_vsetvl(dst, cpu_env, s1, s2);
- gen_set_gpr(ctx, a->rd, dst);
- mark_vs_dirty(ctx);
+static bool trans_vsetvl(DisasContext *s, arg_vsetvl *a)
+{
+ TCGv s2 = get_gpr(s, a->rs2, EXT_ZERO);
+ return do_vsetvl(s, a->rd, a->rs1, s2);
+}
- gen_goto_tb(ctx, 0, ctx->pc_succ_insn);
- ctx->base.is_jmp = DISAS_NORETURN;
- return true;
+static bool trans_vsetvli(DisasContext *s, arg_vsetvli *a)
+{
+ TCGv s2 = tcg_constant_tl(a->zimm);
+ return do_vsetvl(s, a->rd, a->rs1, s2);
}
/* vector register offset from env */