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: Richard Henderson
Subject: Re: [PATCH v8 16/35] Hexagon (target/hexagon/conv_emu.[ch]) utility functions
Date: Thu, 18 Mar 2021 07:30:23 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 3/17/21 9:57 PM, Taylor Simpson wrote:


-----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;
         }

This isn't different from softfloat.c.

     } else if (float32_is_any_nan(RsV)) {
         float_raise(float_flag_invalid, &env->fp_status);
         RddV = ~0ULL;

Nor is this.

     } else if (float32_is_zero(RsV)) {
         RddV = 0;

Not exactly a special case.

     } else if (float32_is_neg(RsV)) {
         float_raise(float_flag_invalid, &env->fp_status);
         RddV = 0;

Not different.

     } else {
         RddV = float32_to_uint64_round_to_zero(RsV, &env->fp_status);
     }

Does that work?

This is 100% identical with round_to_uint_and_pack as used by float32_to_uint64_round_to_zero. It's all straight IEEE 754.


r~



reply via email to

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