[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for lo
From: |
Richard Henderson |
Subject: |
Re: [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns |
Date: |
Thu, 6 Aug 2020 17:03:58 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 8/6/20 3:46 AM, frank.chang@sifive.com wrote:
> +static inline uint32_t vext_max_elems(uint32_t desc, uint32_t esz, bool
> is_ldst)
> {
> - return simd_maxsz(desc) << vext_lmul(desc);
> + /*
> + * As simd_desc support at most 256 bytes, the max vlen is 256 bits.
> + * so vlen in bytes (vlenb) is encoded as maxsz.
> + */
> + uint32_t vlenb = simd_maxsz(desc);
> +
> + if (is_ldst) {
> + /*
> + * Vector load/store instructions have the EEW encoded
> + * directly in the instructions. The maximum vector size is
> + * calculated with EMUL rather than LMUL.
> + */
> + uint32_t eew = ctzl(esz);
> + uint32_t sew = vext_sew(desc);
> + uint32_t lmul = vext_lmul(desc);
> + int32_t emul = eew - sew + lmul;
> + uint32_t emul_r = emul < 0 ? 0 : emul;
> + return 1 << (ctzl(vlenb) + emul_r - ctzl(esz));
As I said before, the is_ldst instructions should put the EEW and EMUL values
into the SEW and LMUL desc fields, so that this does not need to be
special-cased at all.
> + /* Return VLMAX */
> + return 1 << (ctzl(vlenb) + vext_lmul(desc) - ctzl(esz));
This is overly complicated.
(1) 1 << ctzl(vlenb) == vlenb.
(2) I'm not sure why esz is not already a log2 number.
This ought to look more like
int scale = lmul - esz;
return (scale < 0
? vlenb >> -scale
: vlenb << scale);
r~
- Re: [RFC v3 19/71] target/riscv: rvv-1.0: configure instructions, (continued)
- [RFC v3 18/71] target/riscv: rvv-1.0: apply nanbox helper in opfvf_trans, frank . chang, 2020/08/06
- [RFC v3 20/71] target/riscv: rvv-1.0: stride load and store instructions, frank . chang, 2020/08/06
- [RFC v3 22/71] target/riscv: rvv-1.0: fix address index overflow bug of indexed load/store insns, frank . chang, 2020/08/06
- [RFC v3 21/71] target/riscv: rvv-1.0: index load and store instructions, frank . chang, 2020/08/06
- [RFC v3 23/71] target/riscv: rvv-1.0: fault-only-first unit stride load, frank . chang, 2020/08/06
- [RFC v3 24/71] target/riscv: rvv-1.0: amo operations, frank . chang, 2020/08/06
- [RFC v3 25/71] target/riscv: rvv-1.0: load/store whole register instructions, frank . chang, 2020/08/06
- [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns, frank . chang, 2020/08/06
- Re: [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns,
Richard Henderson <=
- Re: [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns, Frank Chang, 2020/08/13
- Re: [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns, Richard Henderson, 2020/08/14
- Re: [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns, Frank Chang, 2020/08/15
- Re: [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns, Richard Henderson, 2020/08/15
- Re: [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns, Frank Chang, 2020/08/15
- Re: [RFC v3 26/71] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns, Frank Chang, 2020/08/15
[RFC v3 28/71] target/riscv: rvv-1.0: floating-point square-root instruction, frank . chang, 2020/08/06
[RFC v3 27/71] target/riscv: rvv-1.0: take fractional LMUL into vector max elements calculation, frank . chang, 2020/08/06
[RFC v3 29/71] target/riscv: rvv-1.0: floating-point classify instructions, frank . chang, 2020/08/06
[RFC v3 32/71] target/riscv: rvv-1.0: set-X-first mask bit instructions, frank . chang, 2020/08/06