mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
target/riscv: Remove mstatus_hs_{fs, vs} from tb_flags
Merge with mstatus_{fs,vs}. We might perform a redundant assignment to one or the other field, but it's a trivial and saves 4 bits from TB_FLAGS. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn> Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Message-Id: <20230325105429.1142530-5-richard.henderson@linaro.org> Message-Id: <20230412114333.118895-5-richard.henderson@linaro.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
ebd476488d
commit
25f3ddff5f
3 changed files with 33 additions and 48 deletions
|
@ -66,8 +66,6 @@ typedef struct DisasContext {
|
|||
uint32_t opcode;
|
||||
RISCVExtStatus mstatus_fs;
|
||||
RISCVExtStatus mstatus_vs;
|
||||
RISCVExtStatus mstatus_hs_fs;
|
||||
RISCVExtStatus mstatus_hs_vs;
|
||||
uint32_t mem_idx;
|
||||
/*
|
||||
* Remember the rounding mode encoded in the previous fp instruction,
|
||||
|
@ -620,16 +618,12 @@ static void mark_fs_dirty(DisasContext *ctx)
|
|||
tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus));
|
||||
tcg_gen_ori_tl(tmp, tmp, MSTATUS_FS);
|
||||
tcg_gen_st_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus));
|
||||
}
|
||||
|
||||
if (ctx->virt_enabled && ctx->mstatus_hs_fs != EXT_STATUS_DIRTY) {
|
||||
/* Remember the stage change for the rest of the TB. */
|
||||
ctx->mstatus_hs_fs = EXT_STATUS_DIRTY;
|
||||
|
||||
tmp = tcg_temp_new();
|
||||
tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus_hs));
|
||||
tcg_gen_ori_tl(tmp, tmp, MSTATUS_FS);
|
||||
tcg_gen_st_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus_hs));
|
||||
if (ctx->virt_enabled) {
|
||||
tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus_hs));
|
||||
tcg_gen_ori_tl(tmp, tmp, MSTATUS_FS);
|
||||
tcg_gen_st_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus_hs));
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -653,16 +647,12 @@ static void mark_vs_dirty(DisasContext *ctx)
|
|||
tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus));
|
||||
tcg_gen_ori_tl(tmp, tmp, MSTATUS_VS);
|
||||
tcg_gen_st_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus));
|
||||
}
|
||||
|
||||
if (ctx->virt_enabled && ctx->mstatus_hs_vs != EXT_STATUS_DIRTY) {
|
||||
/* Remember the stage change for the rest of the TB. */
|
||||
ctx->mstatus_hs_vs = EXT_STATUS_DIRTY;
|
||||
|
||||
tmp = tcg_temp_new();
|
||||
tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus_hs));
|
||||
tcg_gen_ori_tl(tmp, tmp, MSTATUS_VS);
|
||||
tcg_gen_st_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus_hs));
|
||||
if (ctx->virt_enabled) {
|
||||
tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus_hs));
|
||||
tcg_gen_ori_tl(tmp, tmp, MSTATUS_VS);
|
||||
tcg_gen_st_tl(tmp, cpu_env, offsetof(CPURISCVState, mstatus_hs));
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -1171,8 +1161,6 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
|||
ctx->misa_ext = env->misa_ext;
|
||||
ctx->frm = -1; /* unknown rounding mode */
|
||||
ctx->cfg_ptr = &(cpu->cfg);
|
||||
ctx->mstatus_hs_fs = FIELD_EX32(tb_flags, TB_FLAGS, MSTATUS_HS_FS);
|
||||
ctx->mstatus_hs_vs = FIELD_EX32(tb_flags, TB_FLAGS, MSTATUS_HS_VS);
|
||||
ctx->hlsx = FIELD_EX32(tb_flags, TB_FLAGS, HLSX);
|
||||
ctx->vill = FIELD_EX32(tb_flags, TB_FLAGS, VILL);
|
||||
ctx->sew = FIELD_EX32(tb_flags, TB_FLAGS, SEW);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue