> -----Original Message-----
> From: Richard Henderson <[email protected]>
> Sent: Sunday, February 14, 2021 2:57 PM
> To: Taylor Simpson <[email protected]>; [email protected]
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; Brian Cain <[email protected]>
> 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