[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 13/22] fpu/softfloat: re-factor mul
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PATCH v4 13/22] fpu/softfloat: re-factor mul |
Date: |
Mon, 19 Feb 2018 16:04:00 +0000 |
User-agent: |
mu4e 1.1.0; emacs 26.0.91 |
Peter Maydell <address@hidden> writes:
> On 6 February 2018 at 16:48, Alex Bennée <address@hidden> wrote:
>> We can now add float16_mul and use the common decompose and
>> canonicalize functions to have a single implementation for
>> float16/32/64 versions.
>>
>> Signed-off-by: Alex Bennée <address@hidden>
>> Signed-off-by: Richard Henderson <address@hidden>
>>
>> ---
>> v3
>
>> +/*
>> + * Returns the result of multiplying the floating-point values `a' and
>> + * `b'. The operation is performed according to the IEC/IEEE Standard
>> + * for Binary Floating-Point Arithmetic.
>> + */
>> +
>> +static FloatParts mul_floats(FloatParts a, FloatParts b, float_status *s)
>> +{
>> + bool sign = a.sign ^ b.sign;
>> +
>> + if (a.cls == float_class_normal && b.cls == float_class_normal) {
>> + uint64_t hi, lo;
>> + int exp = a.exp + b.exp;
>> +
>> + mul64To128(a.frac, b.frac, &hi, &lo);
>
> It seems a shame that we previously were able to use a
> 32x32->64 multiply for the float32 case, and now we have to
> do an expensive 64x64->128 multiply regardless...
Actually for mul the hit isn't too bad. When we do a div however you do
notice a bit of a gulf:
https://i.imgur.com/KMWceo8.png
We could start passing &floatN_params to the functions much like the
sqrt function and be a bit smarter when we do our multiply and let the
compiler figure it out as we go.
Another avenue worth exploring is ensuring we use native Int128 support
where we can so these wide operations can use wide registers where
available.
However both of these things for future optimisations given it doesn't
show up in dbt-bench timings.
>
> Regardless
> Reviewed-by: Peter Maydell <address@hidden>
>
> thanks
> -- PMM
--
Alex Bennée
- Re: [Qemu-devel] [PATCH] fpu/softfloat: use hardware sqrt if we can (EXPERIMENT!), (continued)
- [Qemu-devel] [PATCH v4 20/22] fpu/softfloat: re-factor minmax, Alex Bennée, 2018/02/06
- [Qemu-devel] [PATCH v4 19/22] fpu/softfloat: re-factor scalbn, Alex Bennée, 2018/02/06
- [Qemu-devel] [PATCH v4 21/22] fpu/softfloat: re-factor compare, Alex Bennée, 2018/02/06
- [Qemu-devel] [PATCH v4 11/22] fpu/softfloat: define decompose structures, Alex Bennée, 2018/02/06
- [Qemu-devel] [PATCH v4 18/22] fpu/softfloat: re-factor int/uint to float, Alex Bennée, 2018/02/06
- [Qemu-devel] [PATCH v4 13/22] fpu/softfloat: re-factor mul, Alex Bennée, 2018/02/06
- [Qemu-devel] [PATCH v4 15/22] fpu/softfloat: re-factor muladd, Alex Bennée, 2018/02/06
- [Qemu-devel] [PATCH v4 17/22] fpu/softfloat: re-factor float to int/uint, Alex Bennée, 2018/02/06
- [Qemu-devel] [PATCH v4 12/22] fpu/softfloat: re-factor add/sub, Alex Bennée, 2018/02/06
- Re: [Qemu-devel] [PATCH v4 00/22] re-factor softfloat and add fp16 functions, no-reply, 2018/02/07
- Re: [Qemu-devel] [PATCH v4 00/22] re-factor softfloat and add fp16 functions, Peter Maydell, 2018/02/13
- Re: [Qemu-devel] [PATCH v4 00/22] re-factor softfloat and add fp16 functions, Peter Maydell, 2018/02/13