qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 7/9] target-xtensa: implement FP0 conversions


From: Max Filippov
Subject: Re: [Qemu-devel] [PATCH 7/9] target-xtensa: implement FP0 conversions
Date: Sun, 9 Sep 2012 16:41:42 +0400

On Sun, Sep 9, 2012 at 3:06 PM, Peter Maydell <address@hidden> wrote:
> On 9 September 2012 02:29, Max Filippov <address@hidden> wrote:
>> +uint32_t HELPER(ftoui)(float32 v, uint32_t rounding_mode, uint32_t scale)
>> +{
>> +    float_status fp_status = {0};
>> +    float32 zero = {0};
>
> This probably won't compile if you turn on USE_SOFTFLOAT_STRUCT_TYPES

It will, but thanks for the hint, gdbstub breaks with this macro defined.

> in softfloat.h. (That's a define intended to assist in avoiding
> accidental mixing of the softfloat types with native int/float types.)
>
> In any case softfloat.h provides a float32_zero which is probably what
> you want to use here.
>
>> +    float32 res;
>> +
>> +    set_float_rounding_mode(rounding_mode, &fp_status);
>> +
>> +    res = float32_mul(v, uint32_to_float32(scale, &fp_status), &fp_status);
>
> Can you use the softflota scalbn function here instead?

Sure, had to search for it harder myself...

>> +
>> +    if (float32_compare_quiet(v, zero, &fp_status) == float_relation_less) {
>> +        return float32_to_int32(res, &fp_status);
>> +    } else {
>> +        return float32_to_uint32(res, &fp_status);
>> +    }
>
> This looks rather odd...are you sure it's correct?

Unfortunately this is what Tensilica ISS does. Doesn't match what ISA
specifies and both are a bit counter-intuitive. I've mailed a question
to Tensilica
guys, will see what they answer.

-- 
Thanks.
-- Max



reply via email to

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