Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract

2020-03-15 Thread Richard Henderson
On 3/15/20 4:23 PM, LIU Zhiwei wrote: > Many other fixed point instructions also need vxsat besides vxsrm. Ah yes. > In that cases, can I just define OPIVV2_RM like this: > > #define OPIVV2_RM(NAME, TD, T1, T2, TX1, TX2, HD, HS1, HS2, OP) \ > static inline void

Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract

2020-03-15 Thread LIU Zhiwei
On 2020/3/15 9:00, Richard Henderson wrote: On 3/14/20 4:12 PM, LIU Zhiwei wrote: I am not sure whether I get it. In my opinion, the code should be modified like static inline int8_t aadd8_rnu(CPURISCVState *env, int8_t a, int8_t b) {     int16_t res = (int16_t)a + (int16_t)b;     uint8_t

Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract

2020-03-14 Thread Richard Henderson
On 3/14/20 4:12 PM, LIU Zhiwei wrote: > I am not sure whether I get it. In my opinion, the code should be modified > like > > static inline int8_t aadd8_rnu(CPURISCVState *env, int8_t a, int8_t b) > { >     int16_t res = (int16_t)a + (int16_t)b; >     uint8_t round = res & 0x1; >     res   =

Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract

2020-03-14 Thread LIU Zhiwei
On 2020/3/14 16:25, Richard Henderson wrote: On 3/14/20 1:14 AM, Richard Henderson wrote: I think you should have 4 versions of aadd8, for each of the rounding modes, +RVVCALL(OPIVV2_ENV, vaadd_vv_b, OP_SSS_B, H1, H1, H1, aadd8) then use this, or something like it, to define 4 functions

Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract

2020-03-14 Thread Richard Henderson
On 3/14/20 1:14 AM, Richard Henderson wrote: > I think you should have 4 versions of aadd8, for each of the rounding modes, > >> +RVVCALL(OPIVV2_ENV, vaadd_vv_b, OP_SSS_B, H1, H1, H1, aadd8) > > then use this, or something like it, to define 4 functions containing main > loops, which will get

Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract

2020-03-14 Thread Richard Henderson
On 3/12/20 7:58 AM, LIU Zhiwei wrote: > +/* Vector Single-Width Averaging Add and Subtract */ > +static inline uint8_t get_round(CPURISCVState *env, uint64_t v, uint8_t > shift) > +{ > +uint8_t d = extract64(v, shift, 1); > +uint8_t d1; > +uint64_t D1, D2; > +int mod = env->vxrm;

[PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract

2020-03-12 Thread LIU Zhiwei
Signed-off-by: LIU Zhiwei --- target/riscv/helper.h | 17 target/riscv/insn32.decode | 5 + target/riscv/insn_trans/trans_rvv.inc.c | 7 ++ target/riscv/vector_helper.c| 129 4 files changed, 158 insertions(+) diff