qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/6] target/ppc: rework vmul{e, o}{s, u}{b, h, w


From: Mark Cave-Ayland
Subject: Re: [Qemu-devel] [PATCH 3/6] target/ppc: rework vmul{e, o}{s, u}{b, h, w} instructions to use Vsr* macros
Date: Fri, 28 Dec 2018 13:46:23 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

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 <address@hidden>

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]