arm: fix some fp comparisons that worked by accident.
The explict tests in the follwing fp comparison operations were incorrect as they checked for only signaling NaNs and not quite-NaNs as well. When compiled with gcc, the comparison generates a fp exception that causes the FE_INVALID flag to be set and we check for it, so even though the check was incorrect, the correct exception was set. With clang this behavior seems to not occur. The checks are updated to test for nans and the behavior is now correct with both clang and gcc.
This commit is contained in:
parent
4412046041
commit
db5c478e70
1 changed files with 6 additions and 6 deletions
|
@ -565,7 +565,7 @@ output exec {{
|
||||||
static float
|
static float
|
||||||
vcgtFunc(float op1, float op2)
|
vcgtFunc(float op1, float op2)
|
||||||
{
|
{
|
||||||
if (isSnan(op1) || isSnan(op2))
|
if (std::isnan(op1) || std::isnan(op2))
|
||||||
return 2.0;
|
return 2.0;
|
||||||
return (op1 > op2) ? 0.0 : 1.0;
|
return (op1 > op2) ? 0.0 : 1.0;
|
||||||
}
|
}
|
||||||
|
@ -573,7 +573,7 @@ output exec {{
|
||||||
static float
|
static float
|
||||||
vcgeFunc(float op1, float op2)
|
vcgeFunc(float op1, float op2)
|
||||||
{
|
{
|
||||||
if (isSnan(op1) || isSnan(op2))
|
if (std::isnan(op1) || std::isnan(op2))
|
||||||
return 2.0;
|
return 2.0;
|
||||||
return (op1 >= op2) ? 0.0 : 1.0;
|
return (op1 >= op2) ? 0.0 : 1.0;
|
||||||
}
|
}
|
||||||
|
@ -589,7 +589,7 @@ output exec {{
|
||||||
static float
|
static float
|
||||||
vcleFunc(float op1, float op2)
|
vcleFunc(float op1, float op2)
|
||||||
{
|
{
|
||||||
if (isSnan(op1) || isSnan(op2))
|
if (std::isnan(op1) || std::isnan(op2))
|
||||||
return 2.0;
|
return 2.0;
|
||||||
return (op1 <= op2) ? 0.0 : 1.0;
|
return (op1 <= op2) ? 0.0 : 1.0;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ output exec {{
|
||||||
static float
|
static float
|
||||||
vcltFunc(float op1, float op2)
|
vcltFunc(float op1, float op2)
|
||||||
{
|
{
|
||||||
if (isSnan(op1) || isSnan(op2))
|
if (std::isnan(op1) || std::isnan(op2))
|
||||||
return 2.0;
|
return 2.0;
|
||||||
return (op1 < op2) ? 0.0 : 1.0;
|
return (op1 < op2) ? 0.0 : 1.0;
|
||||||
}
|
}
|
||||||
|
@ -605,7 +605,7 @@ output exec {{
|
||||||
static float
|
static float
|
||||||
vacgtFunc(float op1, float op2)
|
vacgtFunc(float op1, float op2)
|
||||||
{
|
{
|
||||||
if (isSnan(op1) || isSnan(op2))
|
if (std::isnan(op1) || std::isnan(op2))
|
||||||
return 2.0;
|
return 2.0;
|
||||||
return (fabsf(op1) > fabsf(op2)) ? 0.0 : 1.0;
|
return (fabsf(op1) > fabsf(op2)) ? 0.0 : 1.0;
|
||||||
}
|
}
|
||||||
|
@ -613,7 +613,7 @@ output exec {{
|
||||||
static float
|
static float
|
||||||
vacgeFunc(float op1, float op2)
|
vacgeFunc(float op1, float op2)
|
||||||
{
|
{
|
||||||
if (isSnan(op1) || isSnan(op2))
|
if (std::isnan(op1) || std::isnan(op2))
|
||||||
return 2.0;
|
return 2.0;
|
||||||
return (fabsf(op1) >= fabsf(op2)) ? 0.0 : 1.0;
|
return (fabsf(op1) >= fabsf(op2)) ? 0.0 : 1.0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue