Re: [PATCH v4 1/5] target/riscv: add vector unit stride load and store instructions

2020-03-07 Thread Richard Henderson
On 3/6/20 8:36 PM, LIU Zhiwei wrote: > I define fields shared between vector helpers and decode code. > FIELD(VDATA, MLEN, 0, 8) > FIELD(VDATA, VM, 8, 1) > FIELD(VDATA, LMUL, 9, 2) > FIELD(VDATA, NF, 11, 4) > > But I can't find a  good place to place the fields. There is not a > "translate.h" in

Re: [PATCH v4 1/5] target/riscv: add vector unit stride load and store instructions

2020-03-06 Thread LIU Zhiwei
On 2020/2/28 3:17, Richard Henderson wrote: On 2/25/20 2:35 AM, LIU Zhiwei wrote: +static bool vext_check_reg(DisasContext *s, uint32_t reg, bool widen) +{ +int legal = widen ? 2 << s->lmul : 1 << s->lmul; + +return !((s->lmul == 0x3 && widen) || (reg % legal)); +} + +static bool

Re: [PATCH v4 1/5] target/riscv: add vector unit stride load and store instructions

2020-02-27 Thread LIU Zhiwei
On 2020/2/28 11:33, Richard Henderson wrote: On 2/27/20 5:50 PM, LIU Zhiwei wrote: This is not what I had in mind, and looks wrong as well. int idx = (index * mlen) / 64; int pos = (index * mlen) % 64; return (((uint64_t *)v0)[idx] >> pos) & 1; You also might consider

Re: [PATCH v4 1/5] target/riscv: add vector unit stride load and store instructions

2020-02-27 Thread Richard Henderson
On 2/27/20 5:50 PM, LIU Zhiwei wrote: >> This is not what I had in mind, and looks wrong as well. >> >> int idx = (index * mlen) / 64; >> int pos = (index * mlen) % 64; >> return (((uint64_t *)v0)[idx] >> pos) & 1; >> >> You also might consider passing log2(mlen), so the multiplication

Re: [PATCH v4 1/5] target/riscv: add vector unit stride load and store instructions

2020-02-27 Thread LIU Zhiwei
On 2020/2/28 3:17, Richard Henderson wrote: On 2/25/20 2:35 AM, LIU Zhiwei wrote: +static bool vext_check_reg(DisasContext *s, uint32_t reg, bool widen) +{ +int legal = widen ? 2 << s->lmul : 1 << s->lmul; + +return !((s->lmul == 0x3 && widen) || (reg % legal)); +} + +static bool

Re: [PATCH v4 1/5] target/riscv: add vector unit stride load and store instructions

2020-02-27 Thread Richard Henderson
On 2/25/20 2:35 AM, LIU Zhiwei wrote: > +static bool vext_check_reg(DisasContext *s, uint32_t reg, bool widen) > +{ > +int legal = widen ? 2 << s->lmul : 1 << s->lmul; > + > +return !((s->lmul == 0x3 && widen) || (reg % legal)); > +} > + > +static bool vext_check_overlap_mask(DisasContext

[PATCH v4 1/5] target/riscv: add vector unit stride load and store instructions

2020-02-25 Thread LIU Zhiwei
Vector unit-stride operations access elements stored contiguously in memory starting from the base effective address. The Zvlsseg expands some vector load/store segment instructions, which move multiple contiguous fields in memory to and from consecutively numbered vector register Signed-off-by: