On 7/22/20 2:15 AM, frank.ch...@sifive.com wrote: > +#define IMM_ZX 0 /* Zero-extended */ > +#define IMM_SX 1 /* Sign-extended */ > +#define IMM_TRUNC_SEW 2 /* Truncate to log(SEW) bits */ > +#define IMM_TRUNC_2SEW 3 /* Truncate to log(2*SEW) bits */
Please use an enum. > + case IMM_TRUNC_SEW: > + src1 = tcg_const_tl( > + extract64(imm, 0, 5) & ((1 << (s->sew + 3)) - 1) & 0x1f); > + break; > + case IMM_TRUNC_2SEW: > + src1 = tcg_const_tl( > + extract64(imm, 0, 5) & ((2 << (s->sew + 3)) - 1) & 0x1f); > + break; Either the extract or the "& 0x1f" is redundant. Remove one. It would be worth splitting the integer arithmetic out to a helper function so that you don't have to replicate it again in do_opivi_gvec. r~