qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and


From: Richard Henderson
Subject: Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract
Date: Sun, 15 Mar 2020 16:27:32 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/15/20 4:23 PM, LIU Zhiwei wrote:
> Many other fixed point instructions also need vxsat besides vxsrm.

Ah yes.

> In that cases, can I just define OPIVV2_RM like this:
> 
> #define OPIVV2_RM(NAME, TD, T1, T2, TX1, TX2, HD, HS1, HS2, OP)     \
> static inline void                                                  \
> do_##NAME(void *vd, void *vs1, void *vs2, int i,                    \
>           CPURISCVState *env, int vxrm)                             \
> {                                                                   \
>     TX1 s1 = *((T1 *)vs1 + HS1(i));                                 \
>     TX2 s2 = *((T2 *)vs2 + HS2(i));                                 \
>     *((TD *)vd + HD(i)) = OP(env, vxrm, s2, s1);                    \
> }
> 
> static inline int32_t aadd32(|__attribute__((unused)) |CPURISCVState *env, 
>                            int vxrm, int32_t a, int32_t b)

You can drop the unused.  We don't turn on warnings for unused arguments, as we
have a *lot* of them for exactly this reason -- keeping a common functional
interface.


> {
>     int64_t res = (int64_t)a + b;
>     uint8_t round = get_round(vxrm, res, 1);
> 
>     return (res >> 1) + round;
> }
> 
> 
> In this way, I can write just one OPIVV2_RM instead of (OPIVV2_RM,
> OPIVV2_RM_ENV, OPIVV2_ENV).

Yes, that's fine.


r~



reply via email to

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