mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 19:33:39 +08:00
target-arm: Implement correct NaN propagation rules
Implement the correct NaN propagation rules for ARM targets by providing an appropriate pickNaN function. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
354f211b1a
commit
011da610ba
@ -168,6 +168,28 @@ static float32 commonNaNToFloat32( commonNaNT a )
|
|||||||
| tie-break rule.
|
| tie-break rule.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if defined(TARGET_ARM)
|
||||||
|
static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
|
||||||
|
flag aIsLargerSignificand)
|
||||||
|
{
|
||||||
|
/* ARM mandated NaN propagation rules: take the first of:
|
||||||
|
* 1. A if it is signaling
|
||||||
|
* 2. B if it is signaling
|
||||||
|
* 3. A (quiet)
|
||||||
|
* 4. B (quiet)
|
||||||
|
* A signaling NaN is always quietened before returning it.
|
||||||
|
*/
|
||||||
|
if (aIsSNaN) {
|
||||||
|
return 0;
|
||||||
|
} else if (bIsSNaN) {
|
||||||
|
return 1;
|
||||||
|
} else if (aIsQNaN) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
|
static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
|
||||||
flag aIsLargerSignificand)
|
flag aIsLargerSignificand)
|
||||||
{
|
{
|
||||||
@ -197,6 +219,7 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
| Takes two single-precision floating-point values `a' and `b', one of which
|
| Takes two single-precision floating-point values `a' and `b', one of which
|
||||||
|
Loading…
Reference in New Issue
Block a user