qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 2/8] target/ppc: rework vmrg{l, h}{b, h, w} i


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v4 2/8] target/ppc: rework vmrg{l, h}{b, h, w} instructions to use Vsr* macros
Date: Tue, 29 Jan 2019 15:05:56 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 1/29/19 11:17 AM, Mark Cave-Ayland wrote:
> +#define VMRG_DO(name, element, access, ofs)                             \
>      void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)       \
>      {                                                                   \
>          ppc_avr_t result;                                               \
>          int i;                                                          \
>                                                                          \
> +        for (i = 0; i < ARRAY_SIZE(r->element) / 2; i++) {              \
> +            result.access(i * 2 + 0) = a->access(i + ofs);              \
> +            result.access(i * 2 + 1) = b->access(i + ofs);              \
>          }                                                               \
>          *r = result;                                                    \
>      }
> +
> +#define VMRG(suffix, element, access, half)        \
> +    VMRG_DO(mrgl##suffix, element, access, half)   \
> +    VMRG_DO(mrgh##suffix, element, access, 0)
> +VMRG(b, u8, VsrB, 8)
> +VMRG(h, u16, VsrH, 4)
> +VMRG(w, u32, VsrW, 2)

So... the point of "half" was to not replicate knowledge out to VMRG.
Just use

    int i, half = ARRAY_SIZE(r->element) / 2;
    for (i = 0; i < half; i++) {

within VMRG_DO.


r~



reply via email to

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