[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 10/13] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax()
From: |
Alistair Francis |
Subject: |
Re: [PATCH v3 10/13] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax() |
Date: |
Mon, 22 Jan 2024 13:05:53 +1000 |
On Wed, Jan 17, 2024 at 7:02 AM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> Rename the existing 'sew' variable to 'vsew' for extra clarity.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> target/riscv/cpu.h | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 11df226a00..3af61e0f94 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -690,9 +690,16 @@ static inline RISCVMXL riscv_cpu_sxl(CPURISCVState *env)
> */
> static inline uint32_t vext_get_vlmax(RISCVCPU *cpu, target_ulong vtype)
> {
> - uint8_t sew = FIELD_EX64(vtype, VTYPE, VSEW);
> + uint8_t vsew = FIELD_EX64(vtype, VTYPE, VSEW);
> int8_t lmul = sextract32(FIELD_EX64(vtype, VTYPE, VLMUL), 0, 3);
> - return cpu->cfg.vlen >> (sew + 3 - lmul);
> + uint32_t vlen = cpu->cfg.vlenb << 3;
> +
> + /*
> + * We need to use 'vlen' instead of 'vlenb' to
> + * preserve the '+ 3' in the formula. Otherwise
> + * we risk a negative shift if vsew < lmul.
> + */
> + return vlen >> (vsew + 3 - lmul);
> }
>
> void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc,
> --
> 2.43.0
>
>
- Re: [PATCH v3 05/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb', (continued)
- [PATCH v3 06/13] target/riscv/insn_trans/trans_rvvk.c.inc: use 'vlenb', Daniel Henrique Barboza, 2024/01/16
- [PATCH v3 07/13] target/riscv/vector_helper.c: use 'vlenb', Daniel Henrique Barboza, 2024/01/16
- [PATCH v3 08/13] target/riscv/vector_helper.c: use vlenb in HELPER(vsetvl), Daniel Henrique Barboza, 2024/01/16
- [PATCH v3 09/13] target/riscv/insn_trans/trans_rvv.c.inc: use 'vlenb' in MAXSZ(), Daniel Henrique Barboza, 2024/01/16
- [PATCH v3 10/13] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax(), Daniel Henrique Barboza, 2024/01/16
- Re: [PATCH v3 10/13] target/riscv/cpu.h: use 'vlenb' in vext_get_vlmax(),
Alistair Francis <=
- [PATCH v3 11/13] target/riscv: change vext_get_vlmax() arguments, Daniel Henrique Barboza, 2024/01/16
- [PATCH v3 12/13] trans_rvv.c.inc: use vext_get_vlmax() in trans_vrgather_v*(), Daniel Henrique Barboza, 2024/01/16
- [PATCH v3 13/13] target/riscv/cpu.c: remove cpu->cfg.vlen, Daniel Henrique Barboza, 2024/01/16
- Re: [PATCH v3 00/13] target/riscv: add 'cpu->cfg.vlenb', remove 'cpu->cfg.vlen', Alistair Francis, 2024/01/21