mirror of https://github.com/xemu-project/xemu.git
target/riscv: Add a tb flags field for vstart
Once we mistook the vstart directly from the env->vstart. As env->vstart is not a constant, we should record it in the tb flags if we want to use it in translation. Reported-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com> Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn> Message-Id: <20230324143031.1093-5-zhiwei_liu@linux.alibaba.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Message-Id: <20230325105429.1142530-6-richard.henderson@linaro.org> Message-Id: <20230412114333.118895-6-richard.henderson@linaro.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
25f3ddff5f
commit
4acaa133b1
|
@ -655,6 +655,7 @@ FIELD(TB_FLAGS, VMA, 21, 1)
|
|||
FIELD(TB_FLAGS, ITRIGGER, 22, 1)
|
||||
/* Virtual mode enabled */
|
||||
FIELD(TB_FLAGS, VIRT_ENABLED, 23, 1)
|
||||
FIELD(TB_FLAGS, VSTART_EQ_ZERO, 24, 1)
|
||||
|
||||
#ifdef TARGET_RISCV32
|
||||
#define riscv_cpu_mxl(env) ((void)(env), MXL_RV32)
|
||||
|
|
|
@ -74,6 +74,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
|
|||
FIELD_EX64(env->vtype, VTYPE, VTA));
|
||||
flags = FIELD_DP32(flags, TB_FLAGS, VMA,
|
||||
FIELD_EX64(env->vtype, VTYPE, VMA));
|
||||
flags = FIELD_DP32(flags, TB_FLAGS, VSTART_EQ_ZERO, env->vstart == 0);
|
||||
} else {
|
||||
flags = FIELD_DP32(flags, TB_FLAGS, VILL, 1);
|
||||
}
|
||||
|
|
|
@ -547,7 +547,7 @@ static bool vext_check_sds(DisasContext *s, int vd, int vs1, int vs2, int vm)
|
|||
*/
|
||||
static bool vext_check_reduction(DisasContext *s, int vs2)
|
||||
{
|
||||
return require_align(vs2, s->lmul) && (s->vstart == 0);
|
||||
return require_align(vs2, s->lmul) && s->vstart_eq_zero;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3083,7 +3083,7 @@ static bool trans_vcpop_m(DisasContext *s, arg_rmr *a)
|
|||
{
|
||||
if (require_rvv(s) &&
|
||||
vext_check_isa_ill(s) &&
|
||||
s->vstart == 0) {
|
||||
s->vstart_eq_zero) {
|
||||
TCGv_ptr src2, mask;
|
||||
TCGv dst;
|
||||
TCGv_i32 desc;
|
||||
|
@ -3112,7 +3112,7 @@ static bool trans_vfirst_m(DisasContext *s, arg_rmr *a)
|
|||
{
|
||||
if (require_rvv(s) &&
|
||||
vext_check_isa_ill(s) &&
|
||||
s->vstart == 0) {
|
||||
s->vstart_eq_zero) {
|
||||
TCGv_ptr src2, mask;
|
||||
TCGv dst;
|
||||
TCGv_i32 desc;
|
||||
|
@ -3148,7 +3148,7 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
|
|||
vext_check_isa_ill(s) && \
|
||||
require_vm(a->vm, a->rd) && \
|
||||
(a->rd != a->rs2) && \
|
||||
(s->vstart == 0)) { \
|
||||
s->vstart_eq_zero) { \
|
||||
uint32_t data = 0; \
|
||||
gen_helper_gvec_3_ptr *fn = gen_helper_##NAME; \
|
||||
TCGLabel *over = gen_new_label(); \
|
||||
|
@ -3189,7 +3189,7 @@ static bool trans_viota_m(DisasContext *s, arg_viota_m *a)
|
|||
!is_overlapped(a->rd, 1 << MAX(s->lmul, 0), a->rs2, 1) &&
|
||||
require_vm(a->vm, a->rd) &&
|
||||
require_align(a->rd, s->lmul) &&
|
||||
(s->vstart == 0)) {
|
||||
s->vstart_eq_zero) {
|
||||
uint32_t data = 0;
|
||||
TCGLabel *over = gen_new_label();
|
||||
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
|
||||
|
@ -3638,7 +3638,7 @@ static bool vcompress_vm_check(DisasContext *s, arg_r *a)
|
|||
require_align(a->rs2, s->lmul) &&
|
||||
(a->rd != a->rs2) &&
|
||||
!is_overlapped(a->rd, 1 << MAX(s->lmul, 0), a->rs1, 1) &&
|
||||
(s->vstart == 0);
|
||||
s->vstart_eq_zero;
|
||||
}
|
||||
|
||||
static bool trans_vcompress_vm(DisasContext *s, arg_r *a)
|
||||
|
@ -3677,7 +3677,7 @@ static bool trans_##NAME(DisasContext *s, arg_##NAME * a) \
|
|||
QEMU_IS_ALIGNED(a->rd, LEN) && \
|
||||
QEMU_IS_ALIGNED(a->rs2, LEN)) { \
|
||||
uint32_t maxsz = (s->cfg_ptr->vlen >> 3) * LEN; \
|
||||
if (s->vstart == 0) { \
|
||||
if (s->vstart_eq_zero) { \
|
||||
/* EEW = 8 */ \
|
||||
tcg_gen_gvec_mov(MO_8, vreg_ofs(s, a->rd), \
|
||||
vreg_ofs(s, a->rs2), maxsz, maxsz); \
|
||||
|
|
|
@ -99,7 +99,7 @@ typedef struct DisasContext {
|
|||
uint8_t vta;
|
||||
uint8_t vma;
|
||||
bool cfg_vta_all_1s;
|
||||
target_ulong vstart;
|
||||
bool vstart_eq_zero;
|
||||
bool vl_eq_vlmax;
|
||||
CPUState *cs;
|
||||
TCGv zero;
|
||||
|
@ -1168,7 +1168,7 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
|||
ctx->vta = FIELD_EX32(tb_flags, TB_FLAGS, VTA) && cpu->cfg.rvv_ta_all_1s;
|
||||
ctx->vma = FIELD_EX32(tb_flags, TB_FLAGS, VMA) && cpu->cfg.rvv_ma_all_1s;
|
||||
ctx->cfg_vta_all_1s = cpu->cfg.rvv_ta_all_1s;
|
||||
ctx->vstart = env->vstart;
|
||||
ctx->vstart_eq_zero = FIELD_EX32(tb_flags, TB_FLAGS, VSTART_EQ_ZERO);
|
||||
ctx->vl_eq_vlmax = FIELD_EX32(tb_flags, TB_FLAGS, VL_EQ_VLMAX);
|
||||
ctx->misa_mxl_max = env->misa_mxl_max;
|
||||
ctx->xl = FIELD_EX32(tb_flags, TB_FLAGS, XL);
|
||||
|
|
Loading…
Reference in New Issue