[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/12] ARM: Return correct result for float-to-i
From: |
Nathan Froyd |
Subject: |
Re: [Qemu-devel] [PATCH 07/12] ARM: Return correct result for float-to-integer conversion of NaN |
Date: |
Mon, 29 Nov 2010 08:38:42 -0800 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
On Tue, Nov 23, 2010 at 06:53:46PM +0000, Peter Maydell wrote:
> The ARM architecture mandates that converting a NaN value to
> integer gives zero (if Invalid Operation FP exceptions are
> not being trapped). This isn't the behaviour of the SoftFloat
> library, so NaNs must be special-cased.
>
> +/* Helper routines to identify NaNs. Note that softfloat's
> + * floatxx_is_nan() actually only returns true for quiet NaNs.
> + * A NaN has an exponent field all 1s and a fraction field
> + * anything except all zeros. Conveniently we can detect this
> + * by masking out the sign bit and doing an unsigned comparison.
> + */
> +static int float32_is_any_nan(float32 x)
> +{
> + return ((float32_val(x) & ~(1 << 31)) > 0x7f800000UL);
> +}
> +
> +static int float64_is_any_nan(float64 x)
> +{
> + return ((float64_val(x) & ~(1ULL << 63)) > 0x7ff0000000000000ULL);
> +}
Why not just use:
static int float32_is_any_nan(float32 x)
{
return float32_is_nan(x) || float32_is_signaling_nan(x);
}
and likewise for the 64-bit case?
-Nathan
- Re: [Qemu-devel] [PATCH 06/12] ARM: Fix sense of to_integer bit in Neon VCVT float/int conversion, (continued)
[Qemu-devel] [PATCH 01/12] target-arm: Add support for PKHxx in thumb2, Peter Maydell, 2010/11/23
[Qemu-devel] [PATCH 07/12] ARM: Return correct result for float-to-integer conversion of NaN, Peter Maydell, 2010/11/23
- Re: [Qemu-devel] [PATCH 07/12] ARM: Return correct result for float-to-integer conversion of NaN,
Nathan Froyd <=
[Qemu-devel] [PATCH 03/12] target-arm: Handle 'smc' as an undefined instruction, Peter Maydell, 2010/11/23