qemu-devel
[Top][All Lists]
Advanced

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

RE: [PATCH v8 16/35] Hexagon (target/hexagon/conv_emu.[ch]) utility func


From: Taylor Simpson
Subject: RE: [PATCH v8 16/35] Hexagon (target/hexagon/conv_emu.[ch]) utility functions
Date: Thu, 18 Mar 2021 03:57:22 +0000


> -----Original Message-----
> From: Richard Henderson <richard.henderson@linaro.org>
> Sent: Sunday, February 14, 2021 2:57 PM
> To: Taylor Simpson <tsimpson@quicinc.com>; qemu-devel@nongnu.org
> Cc: philmd@redhat.com; alex.bennee@linaro.org; laurent@vivier.eu;
> ale@rev.ng; Brian Cain <bcain@quicinc.com>
> Subject: Re: [PATCH v8 16/35] Hexagon (target/hexagon/conv_emu.[ch])
> utility functions
>
> On 2/7/21 9:46 PM, Taylor Simpson wrote:
> > +uint64_t conv_sf_to_8u(float32 in, float_status *fp_status);
> > +uint32_t conv_sf_to_4u(float32 in, float_status *fp_status);
> > +int64_t conv_sf_to_8s(float32 in, float_status *fp_status);
> > +int32_t conv_sf_to_4s(float32 in, float_status *fp_status);
> > +
> > +uint64_t conv_df_to_8u(float64 in, float_status *fp_status);
> > +uint32_t conv_df_to_4u(float64 in, float_status *fp_status);
> > +int64_t conv_df_to_8s(float64 in, float_status *fp_status);
> > +int32_t conv_df_to_4s(float64 in, float_status *fp_status);
>
> You need to either use the normal float conversion routines, or document
> what the differences are.

There are some differences in floating point flags raised, so I could write 
something like this:
    if (float32_is_infinity(RsV)) {
        float_raise(float_flag_invalid, &env->fp_status);
        if (float32_is_neg(RsV)) {
            RddV = 0ULL;
        } else {
            RddV = ~0ULL;
        }
    } else if (float32_is_any_nan(RsV)) {
        float_raise(float_flag_invalid, &env->fp_status);
        RddV = ~0ULL;
    } else if (float32_is_zero(RsV)) {
        RddV = 0;
    } else if (float32_is_neg(RsV)) {
        float_raise(float_flag_invalid, &env->fp_status);
        RddV = 0;
    } else {
        RddV = float32_to_uint64_round_to_zero(RsV, &env->fp_status);
    }

Does that work?


Thanks,
Taylor

reply via email to

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