On Fri, Mar 27, 2020 at 12:09 AM Richard Henderson <richard.hender...@linaro.org> wrote: [...] > diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c > index bee00eaa44..7d7a59f620 100644 > --- a/target/arm/sve_helper.c > +++ b/target/arm/sve_helper.c > @@ -1088,6 +1088,49 @@ DO_ZZW(sve_lsl_zzw_s, uint32_t, uint64_t, H1_4, DO_LSL) > #undef DO_ZPZ > #undef DO_ZPZ_D > > +/* > + * Three-operand expander, unpredicated, in which the two inputs are > + * selected from the top or bottom half of the wide column. > + */ > +#define DO_ZZZ_TB(NAME, TYPE, TYPEN, OP) \ > +void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ > +{ \ > + intptr_t i, opr_sz = simd_oprsz(desc); \ > + int sel1 = (simd_data(desc) & 1) * sizeof(TYPE); \ > + int sel2 = (simd_data(desc) & 2) * (sizeof(TYPE) / 2); \ > + for (i = 0; i < opr_sz; i += sizeof(TYPE)) { \ > + TYPE nn = (TYPEN)(*(TYPE *)(vn + i) >> sel1); \ > + TYPE mm = (TYPEN)(*(TYPE *)(vm + i) >> sel2); \ > + *(TYPE *)(vd + i) = OP(nn, mm); \ > + } \ > +}
For sel1/sel2 the multiplicand should be the number of bits in TYPEN. Laurent