Commit 7d4d4d22 by Richard Stallman

*** empty log message ***

From-SVN: r563
parent 333e0f7d
...@@ -738,6 +738,46 @@ target_isinf (x) ...@@ -738,6 +738,46 @@ target_isinf (x)
} }
} }
/* Check whether an IEEE double precision number is a NaN. */
int
target_isnan (x)
REAL_VALUE_TYPE x;
{
/* The IEEE 64-bit double format. */
union {
REAL_VALUE_TYPE d;
struct {
unsigned sign : 1;
unsigned exponent : 11;
unsigned mantissa1 : 20;
unsigned mantissa2;
} little_endian;
struct {
unsigned mantissa2;
unsigned mantissa1 : 20;
unsigned exponent : 11;
unsigned sign : 1;
} big_endian;
} u;
u.d = dconstm1;
if (u.big_endian.sign == 1)
{
u.d = x;
return (u.big_endian.exponent == 2047
&& (u.big_endian.mantissa1 != 0
|| u.big_endian.mantissa2 != 0));
}
else
{
u.d = x;
return (u.little_endian.exponent == 2047
&& (u.little_endian.mantissa1 != 0
|| u.little_endian.mantissa2 != 0));
}
}
/* Check for minus zero in an IEEE double precision number. */ /* Check for minus zero in an IEEE double precision number. */
int int
...@@ -762,6 +802,15 @@ target_isinf (x) ...@@ -762,6 +802,15 @@ target_isinf (x)
return 0; return 0;
} }
/* Let's assume other float formats don't have NaNs.
(This can be overridden by redefining REAL_VALUE_ISNAN.) */
target_isnan (x)
REAL_VALUE_TYPE x;
{
return 0;
}
/* Let's assume other float formats don't have minus zero. /* Let's assume other float formats don't have minus zero.
(This can be overridden by redefining REAL_VALUE_MINUS_ZERO.) */ (This can be overridden by redefining REAL_VALUE_MINUS_ZERO.) */
...@@ -1408,9 +1457,13 @@ operand_equal_p (arg0, arg1, only_const) ...@@ -1408,9 +1457,13 @@ 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.
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
&& REAL_VALUES_EQUAL (TREE_REAL_CST (arg0), TREE_REAL_CST (arg1))) && REAL_VALUES_EQUAL (TREE_REAL_CST (arg0), TREE_REAL_CST (arg1))
&& !REAL_VALUE_ISINF (TREE_REAL_CST (arg0))
&& !REAL_VALUE_ISNAN (TREE_REAL_CST (arg0)))
return 1; return 1;
if (only_const) if (only_const)
...@@ -1562,8 +1615,8 @@ invert_truthvalue (arg) ...@@ -1562,8 +1615,8 @@ invert_truthvalue (arg)
/* For floating-point comparisons, it isn't safe to invert the condition. /* For floating-point comparisons, it isn't safe to invert the condition.
So just enclose a TRUTH_NOT_EXPR around what we have. */ So just enclose a TRUTH_NOT_EXPR around what we have. */
if (TREE_CODE (type) == REAL_TYPE if (TREE_CODE_CLASS (TREE_CODE (arg)) == '<'
&& TREE_CODE_CLASS (TREE_CODE (arg)) == '<') && TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REAL_TYPE)
return build1 (TRUTH_NOT_EXPR, type, arg); return build1 (TRUTH_NOT_EXPR, type, arg);
switch (TREE_CODE (arg)) switch (TREE_CODE (arg))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment