On 25/12/2018 20:11, Richard Henderson wrote: > On 12/23/18 10:38 PM, Mark Cave-Ayland wrote: >> -#define VMUL_DO(name, mul_element, prod_element, cast, evenp) \ >> +#define VMUL_DO_EVN(name, mul_element, mul_access, prod_access, cast) \ >> void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ >> { \ >> int i; \ >> \ >> + for (i = 0; i < ARRAY_SIZE(r->mul_element); i += 2) { \ >> + r->prod_access(i >> 1) = (cast)a->mul_access(i) * \ >> + (cast)b->mul_access(i); \ >> + } \ >> + } >> + >> +#define VMUL_DO_ODD(name, mul_element, mul_access, prod_access, cast) \ >> + void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ >> + { \ >> + int i; \ >> + \ >> + for (i = 0; i < ARRAY_SIZE(r->mul_element); i += 2) { \ >> + r->prod_access(i >> 1) = (cast)a->mul_access(i + 1) * \ >> + (cast)b->mul_access(i + 1); \ >> } \ >> } > > FWIW, > > for (i = odd; i < ARRAY_SIZE; i += 2) { > r->pacc(i >> 1) = (cast)a->macc(i) * b->macc(i); > } > > is sufficient to unify these two. But what you have isn't wrong. > > Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
Ah indeed that's quite neat! Thinking about it for a few days, I've decided to leave it as-is for now, since it was useful to be able to test the odd/even variants separately (as they were often used together in testing) and it's just that tiny bit easier to relate to the ISA documentation. ATB, Mark.