> On Jun 18, 2020, at 6:29 PM, Richard Henderson <richard.hender...@linaro.org> > wrote: > > On 6/12/20 9:20 PM, Lijun Pan wrote: >> +#define VMULH_DO(name, op, element, cast_orig, cast_temp) \ >> + void helper_vmulh##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) >> \ >> + { >> \ >> + int i; \ >> + \ >> + for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ >> + r->element[i] = (cast_orig)(((cast_temp)a->element[i] op \ >> + (cast_temp)b->element[i]) >> 32); \ >> + } \ >> + } >> +VMULH_DO(sw, *, s32, int32_t, int64_t) >> +VMULH_DO(uw, *, u32, uint32_t, uint64_t) >> +#undef VMULH_DO > > There's no point in calling the macro "VMUL" and then passing in "op" as a > parameter. Just inline the multiply directly. Do you mean writing two functions directly, void helper_vmulhsw(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { int i; for (i = 0; i < 4; i++) { r->s32[i] = (int32_t)((int64_t)a->s32[i] * (int64_t)b->s32[i]) >> 32); } } void helper_vmulhuw(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { int i; for (i = 0; i < 4; i++) { r->u32[i] = (uint32_t)((uint64_t)a->u32[i] * (uint64_t)b->u32[i]) >> 32); } } Thanks, Lijun
- [PATCH 5/6] fix the prototype of muls64/mulu64 Lijun Pan
- Re: [PATCH 5/6] fix the prototype of muls64/mulu64 Richard Henderson
- [PATCH 2/6] target/ppc: add vmulld instruction Lijun Pan
- Re: [PATCH 2/6] target/ppc: add vmulld instruction Richard Henderson
- Re: [PATCH 2/6] target/ppc: add vmulld instruct... Lijun Pan
- Re: [PATCH 2/6] target/ppc: add vmulld inst... Richard Henderson
- [PATCH 6/6] target/ppc: add vdiv{su}{wd} vmod{su}{wd} in... Lijun Pan
- Re: [PATCH 6/6] target/ppc: add vdiv{su}{wd} vmod{s... Richard Henderson
- [PATCH 3/6] targetc/ppc: add vmulh{su}w instructions Lijun Pan
- Re: [PATCH 3/6] targetc/ppc: add vmulh{su}w instruc... Richard Henderson
- Re: [PATCH 3/6] targetc/ppc: add vmulh{su}w ins... Lijun Pan
- Re: [PATCH 3/6] targetc/ppc: add vmulh{su}w... Richard Henderson
- [PATCH 4/6] target/ppc: add vmulh{su}d instructions Lijun Pan
- Re: [PATCH 4/6] target/ppc: add vmulh{su}d instruct... Richard Henderson
- Re: [PATCH 0/6] Add several Power ISA 3.1 32/64-bit vect... no-reply
- Re: [PATCH 0/6] Add several Power ISA 3.1 32/64-bit vect... Cédric Le Goater
- Re: [PATCH 0/6] Add several Power ISA 3.1 32/64-bit... Lijun Pan
- Re: [PATCH 0/6] Add several Power ISA 3.1 32/64... Cédric Le Goater
- Re: [PATCH 0/6] Add several Power ISA 3.1 32/64-bit vect... Richard Henderson