qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] temp-floating-point: Use float32_to_t and t_to_


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] temp-floating-point: Use float32_to_t and t_to_float32 for the input register value
Date: Mon, 5 Oct 2015 12:29:15 +0100

On 5 October 2015 at 12:21, Chen Gang <address@hidden> wrote:
> From 6bb2ed5b7046cda545f6a12721b773fde40f07f1 Mon Sep 17 00:00:00 2001
> From: Chen Gang <address@hidden>
> Date: Mon, 5 Oct 2015 19:12:07 +0800
> Subject: [PATCH] temp-floating-point: Use float32_to_t and t_to_float32 for
>  the input register value
>
> Original implementation use int*_to_float32 and float32_to_int*, which
> will generate incorrect result.
>
> Signed-off-by: Chen Gang <address@hidden>
> ---
>  target-tilegx/fpu_helper.c | 51 
> +++++++++++++++++++++-------------------------
>  1 file changed, 23 insertions(+), 28 deletions(-)
>
> diff --git a/target-tilegx/fpu_helper.c b/target-tilegx/fpu_helper.c
> index daae570..2707f30 100644
> --- a/target-tilegx/fpu_helper.c
> +++ b/target-tilegx/fpu_helper.c
> @@ -68,6 +68,20 @@ static uint64_t float64_to_t(float64 fa)
>      return r.ll;
>  }
>
> +static float32 t_to_float32 (uint32_t a)
> +{
> +    CPU_FloatU r;
> +    r.l = a;
> +    return r.f;
> +}

This appears to be reimplementing make_float32().

> +
> +static uint32_t float32_to_t(float32 a)
> +{
> +    CPU_FloatU r;
> +    r.f = a;
> +    return r.l;
> +}

And this is just float32_val().

>  uint64_t helper_fsingle_add1(CPUTLGState *env, uint64_t rsrc, uint64_t rsrcb)
>  {
> -    FPUTLGState *fpu = &env->fpu;
> -    return fsingle_calc(fpu, int64_to_float32(rsrc, &FP_STATUS),
> -                        int64_to_float32(rsrcb, &FP_STATUS),
> -                        float32_add);
> +    return fsingle_calc(&env->fpu, t_to_float32((uint32_t)rsrc),
> +                        t_to_float32((uint32_t)rsrcb), float32_add);
>  }

Why is the helper for a single-precision operation taking a 64-bit
argument anyway?

thanks
-- PMM



reply via email to

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