[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~
- [PATCH v5 23/60] target/riscv: vector single-width saturating add and subtract, (continued)
- [PATCH v5 23/60] target/riscv: vector single-width saturating add and subtract, LIU Zhiwei, 2020/03/12
- [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract, LIU Zhiwei, 2020/03/12
- Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract, Richard Henderson, 2020/03/14
- Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract, Richard Henderson, 2020/03/14
- Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract, LIU Zhiwei, 2020/03/14
- Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract, Richard Henderson, 2020/03/14
- Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract, LIU Zhiwei, 2020/03/15
- Re: [PATCH v5 24/60] target/riscv: vector single-width averaging add and subtract, Richard Henderson, 2020/03/15
[PATCH v5 25/60] target/riscv: vector single-width fractional multiply with rounding and saturation, LIU Zhiwei, 2020/03/12
- Re: [PATCH v5 25/60] target/riscv: vector single-width fractional multiply with rounding and saturation,
Richard Henderson <=
[PATCH v5 26/60] target/riscv: vector widening saturating scaled multiply-add, LIU Zhiwei, 2020/03/12
[PATCH v5 27/60] target/riscv: vector single-width scaling shift instructions, LIU Zhiwei, 2020/03/12
[PATCH v5 28/60] target/riscv: vector narrowing fixed-point clip instructions, LIU Zhiwei, 2020/03/12
[PATCH v5 29/60] target/riscv: vector single-width floating-point add/subtract instructions, LIU Zhiwei, 2020/03/12
[PATCH v5 30/60] target/riscv: vector widening floating-point add/subtract instructions, LIU Zhiwei, 2020/03/12