[Top][All Lists]
[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
- Re: [Qemu-devel] [PATCH 3/9] target-xtensa: specialize softfloat NaN rules, (continued)
[Qemu-devel] [PATCH 4/9] target-xtensa: add FP registers, Max Filippov, 2012/09/08
[Qemu-devel] [PATCH 5/9] target-xtensa: implement LSCX and LSCI groups, Max Filippov, 2012/09/08
[Qemu-devel] [PATCH 6/9] target-xtensa: implement FP0 arithmetic, Max Filippov, 2012/09/08
[Qemu-devel] [PATCH 7/9] target-xtensa: implement FP0 conversions, Max Filippov, 2012/09/08
[Qemu-devel] [PATCH 8/9] target-xtensa: implement FP1 group, Max Filippov, 2012/09/08
[Qemu-devel] [PATCH 9/9] target-xtensa: implement coprocessor context option, Max Filippov, 2012/09/08