[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 18/20] fpu/softfloat: re-factor scalbn
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v2 18/20] fpu/softfloat: re-factor scalbn |
Date: |
Fri, 12 Jan 2018 16:31:52 +0000 |
On 9 January 2018 at 12:22, Alex Bennée <address@hidden> wrote:
> This is one of the simpler manipulations you could make to a floating
> point number.
>
> Signed-off-by: Alex Bennée <address@hidden>
> Reviewed-by: Richard Henderson <address@hidden>
> ---
> fpu/softfloat.c | 104
> +++++++++++++++---------------------------------
> include/fpu/softfloat.h | 1 +
> 2 files changed, 32 insertions(+), 73 deletions(-)
>
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index bb68d77f72..3647f6ca03 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -1663,6 +1663,37 @@ float64 uint16_to_float64(uint16_t a, float_status
> *status)
> return uint64_to_float64(a, status);
> }
>
> +/* Multiply A by 2 raised to the power N. */
> +static decomposed_parts scalbn_decomposed(decomposed_parts a, int n,
> + float_status *s)
> +{
> + if (a.cls == float_class_normal) {
> + a.exp += n;
> + }
> + return a;
> +}
> +
> +float16 float16_scalbn(float16 a, int n, float_status *status)
> +{
> + decomposed_parts pa = float16_unpack_canonical(a, status);
> + decomposed_parts pr = scalbn_decomposed(pa, n, status);
> + return float16_round_pack_canonical(pr, status);
> +}
> +
> +float32 float32_scalbn(float32 a, int n, float_status *status)
> +{
> + decomposed_parts pa = float32_unpack_canonical(a, status);
> + decomposed_parts pr = scalbn_decomposed(pa, n, status);
> + return float32_round_pack_canonical(pr, status);
> +}
> +
> +float64 float64_scalbn(float64 a, int n, float_status *status)
> +{
> + decomposed_parts pa = float64_unpack_canonical(a, status);
> + decomposed_parts pr = scalbn_decomposed(pa, n, status);
> + return float64_round_pack_canonical(pr, status);
> +}
The old code used propagateFloat32NaN(a, a, status) if the
input was a NaN, to cause us to raise the invalid flag,
maybe return a default NaN, maybe silence the NaN. I can't
see where the new code is doing this?
thanks
-- PMM
- Re: [Qemu-devel] [PATCH v2 11/20] fpu/softfloat: re-factor add/sub, (continued)
- [Qemu-devel] [PATCH v2 14/20] fpu/softfloat: re-factor muladd, Alex Bennée, 2018/01/09
- [Qemu-devel] [PATCH v2 16/20] fpu/softfloat: re-factor float to int/uint, Alex Bennée, 2018/01/09
- [Qemu-devel] [PATCH v2 19/20] fpu/softfloat: re-factor minmax, Alex Bennée, 2018/01/09
- [Qemu-devel] [PATCH v2 18/20] fpu/softfloat: re-factor scalbn, Alex Bennée, 2018/01/09
- Re: [Qemu-devel] [PATCH v2 18/20] fpu/softfloat: re-factor scalbn,
Peter Maydell <=
- [Qemu-devel] [PATCH v2 13/20] fpu/softfloat: re-factor div, Alex Bennée, 2018/01/09
- [Qemu-devel] [PATCH v2 20/20] fpu/softfloat: re-factor compare, Alex Bennée, 2018/01/09
- [Qemu-devel] [PATCH v2 17/20] fpu/softfloat: re-factor int/uint to float, Alex Bennée, 2018/01/09
- [Qemu-devel] [PATCH v2 15/20] fpu/softfloat: re-factor round_to_int, Alex Bennée, 2018/01/09
- Re: [Qemu-devel] [PATCH v2 00/20] re-factor softfloat and add fp16 functions, no-reply, 2018/01/09