(operand_equal_p): Make it clear that this function tests for indistinguishable values, not for equality as computed by `=='...
(operand_equal_p): Make it clear that this function tests for indistinguishable values, not for equality as computed by `=='; the distinction is important for IEEE NaNs and -0.0. From-SVN: r1807
This commit is contained in:
parent
e92b33f508
commit
6a1746af42
@ -1567,8 +1567,13 @@ swap_tree_comparison (code)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return nonzero if two operands are necessarily equal.
|
/* Return nonzero if two operands are necessarily equal.
|
||||||
If ONLY_CONST is non-zero, only return non-zero for constants. */
|
If ONLY_CONST is non-zero, only return non-zero for constants.
|
||||||
|
This function tests whether the operands are indistinguishable;
|
||||||
|
it does not test whether they are equal using C's == operation.
|
||||||
|
The distinction is important for IEEE floating point, because
|
||||||
|
(1) -0.0 and 0.0 are distinguishable, but -0.0==0.0, and
|
||||||
|
(2) two NaNs may be indistinguishable, but NaN!=NaN. */
|
||||||
|
|
||||||
int
|
int
|
||||||
operand_equal_p (arg0, arg1, only_const)
|
operand_equal_p (arg0, arg1, only_const)
|
||||||
@ -1604,18 +1609,11 @@ operand_equal_p (arg0, arg1, only_const)
|
|||||||
&& TREE_INT_CST_HIGH (arg0) == TREE_INT_CST_HIGH (arg1))
|
&& TREE_INT_CST_HIGH (arg0) == TREE_INT_CST_HIGH (arg1))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Detect when real constants are equal.
|
/* Detect when real constants are equal. */
|
||||||
But reject weird values because we can't be sure what to do with them. */
|
|
||||||
if (TREE_CODE (arg0) == TREE_CODE (arg1)
|
if (TREE_CODE (arg0) == TREE_CODE (arg1)
|
||||||
&& TREE_CODE (arg0) == REAL_CST
|
&& TREE_CODE (arg0) == REAL_CST)
|
||||||
&& !bcmp (&TREE_REAL_CST (arg0), &TREE_REAL_CST (arg1),
|
return !bcmp (&TREE_REAL_CST (arg0), &TREE_REAL_CST (arg1),
|
||||||
sizeof (REAL_VALUE_TYPE))
|
sizeof (REAL_VALUE_TYPE));
|
||||||
/* Some people say these are not necessary.
|
|
||||||
But they do little harm, and taking them out would be risky.
|
|
||||||
So leave them and let's not spend any more time on them--rms. */
|
|
||||||
&& !REAL_VALUE_ISINF (TREE_REAL_CST (arg0))
|
|
||||||
&& !REAL_VALUE_ISNAN (TREE_REAL_CST (arg0)))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (only_const)
|
if (only_const)
|
||||||
return 0;
|
return 0;
|
||||||
@ -3316,7 +3314,7 @@ fold (expr)
|
|||||||
/* Fold &x - &x. This can happen from &x.foo - &x.
|
/* Fold &x - &x. This can happen from &x.foo - &x.
|
||||||
This is unsafe for certain floats even in non-IEEE formats.
|
This is unsafe for certain floats even in non-IEEE formats.
|
||||||
In IEEE, it is unsafe because it does wrong for NaNs.
|
In IEEE, it is unsafe because it does wrong for NaNs.
|
||||||
Also note that operand_equal_p is always false is an operand
|
Also note that operand_equal_p is always false if an operand
|
||||||
is volatile. */
|
is volatile. */
|
||||||
|
|
||||||
if (operand_equal_p (arg0, arg1,
|
if (operand_equal_p (arg0, arg1,
|
||||||
|
Loading…
Reference in New Issue
Block a user