qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH v5 25/60] target/riscv: vector single-width fractional multip


From: Richard Henderson
Subject: Re: [PATCH v5 25/60] target/riscv: vector single-width fractional multiply with rounding and saturation
Date: Sat, 14 Mar 2020 01:27:08 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/12/20 7:58 AM, LIU Zhiwei wrote:
> +/* Vector Single-Width Fractional Multiply with Rounding and Saturation */
> +static inline int8_t vsmul8(CPURISCVState *env, int8_t a, int8_t b)
> +{
> +    uint8_t round;
> +    int16_t res;
> +
> +    res = (int16_t)a * (int16_t)b;
> +    round = get_round(env, res, 7);
> +    res   = (res >> 7) + round;
> +
> +    if (res > INT8_MAX) {
> +        env->vxsat = 0x1;
> +        return INT8_MAX;
> +    } else if (res < INT8_MIN) {
> +        env->vxsat = 0x1;
> +        return INT8_MIN;
> +    } else {
> +        return res;
> +    }
> +}
> +static int16_t vsmul16(CPURISCVState *env, int16_t a, int16_t b)

With the same caveat for vxrm as before.  Oh, and watch the spacing between
these functions.  I noticed before but didn't mention.


r~



reply via email to

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