[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] Softfloat: Add support to softfloat to retur
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v2] Softfloat: Add support to softfloat to return floatxx_default_nan when, the corresponding target status flag is set. |
Date: |
Mon, 7 Feb 2011 16:48:38 +0000 |
On 7 February 2011 15:30, Christophe Lyon <address@hidden> wrote:
> Note that I am unsure whether it's useful to have a default (ie non-ARM)
> value for float16_default_nan and if the value I've used is right.
We should set the default consistent with how we do it for
the other types: special cases for various architectures,
default for SNAN_BIT_IS_ONE is sign=0,exp=1....1,
mantissa=01.....1; default for !SNAN_BIT_IS_ONE is
sign=1,exp=1.....1,mantissa=0....0. So:
#if defined(TARGET_ARM)
#define float16_default_nan 0x7E00
#elif SNAN_BIT_IS_ONE
#define float16_default_nan 0x7DFF
#else
#define float16_default_nan 0xFE00
#endif
> +static bits16 commonNaNToFloat16( commonNaNT a STATUS_PARAM)
> +{
> + bits16 mantissa = a.high>>57;
> +
> + if ( STATUS(default_nan_mode) ) {
> + return float16_default_nan;
> + }
> +
> + if ( mantissa )
> + return (bits16)a.sign << 15 | 0x1F << 10 | mantissa;
> + else
> + return float16_default_nan;
> +}
Could we have some brackets around the shifts and some braces
for this if(), please? (I know most of softfloat doesn't adhere to
the qemu brace-standard, and I'm not going to ask for all those
other ifs to change, but since this is a new function we might as
well put in the braces for this one.)
thanks
-- PMM