mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
target/riscv: add vector configure instruction
vsetvl and vsetvli are two configure instructions for vl, vtype. TB flags should update after configure instructions. The (ill, lmul, sew ) of vtype and the bit of (VSTART == 0 && VL == VLMAX) will be placed within tb_flags. Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200701152549.1218-5-zhiwei_liu@c-sky.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
8e3a1f1887
commit
2b7168fc43
7 changed files with 211 additions and 13 deletions
79
target/riscv/insn_trans/trans_rvv.inc.c
Normal file
79
target/riscv/insn_trans/trans_rvv.inc.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* RISC-V translation routines for the RVV Standard Extension.
|
||||
*
|
||||
* Copyright (c) 2020 T-Head Semiconductor Co., Ltd. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2 or later, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
static bool trans_vsetvl(DisasContext *ctx, arg_vsetvl *a)
|
||||
{
|
||||
TCGv s1, s2, dst;
|
||||
|
||||
if (!has_ext(ctx, RVV)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
s2 = tcg_temp_new();
|
||||
dst = tcg_temp_new();
|
||||
|
||||
/* 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_const_tl(RV_VLEN_MAX);
|
||||
} else {
|
||||
s1 = tcg_temp_new();
|
||||
gen_get_gpr(s1, a->rs1);
|
||||
}
|
||||
gen_get_gpr(s2, a->rs2);
|
||||
gen_helper_vsetvl(dst, cpu_env, s1, s2);
|
||||
gen_set_gpr(a->rd, dst);
|
||||
tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn);
|
||||
lookup_and_goto_ptr(ctx);
|
||||
ctx->base.is_jmp = DISAS_NORETURN;
|
||||
|
||||
tcg_temp_free(s1);
|
||||
tcg_temp_free(s2);
|
||||
tcg_temp_free(dst);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool trans_vsetvli(DisasContext *ctx, arg_vsetvli *a)
|
||||
{
|
||||
TCGv s1, s2, dst;
|
||||
|
||||
if (!has_ext(ctx, RVV)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
s2 = tcg_const_tl(a->zimm);
|
||||
dst = tcg_temp_new();
|
||||
|
||||
/* 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_const_tl(RV_VLEN_MAX);
|
||||
} else {
|
||||
s1 = tcg_temp_new();
|
||||
gen_get_gpr(s1, a->rs1);
|
||||
}
|
||||
gen_helper_vsetvl(dst, cpu_env, s1, s2);
|
||||
gen_set_gpr(a->rd, dst);
|
||||
gen_goto_tb(ctx, 0, ctx->pc_succ_insn);
|
||||
ctx->base.is_jmp = DISAS_NORETURN;
|
||||
|
||||
tcg_temp_free(s1);
|
||||
tcg_temp_free(s2);
|
||||
tcg_temp_free(dst);
|
||||
return true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue