Commit ab29fdfc by Richard Kenner

(convert_to_integer): Convert integer_one_node to proper type before

tree_int_cst_lt call.

From-SVN: r6777
parent ff3225e7
......@@ -170,9 +170,9 @@ convert_to_integer (type, expr)
else if (outprec >= inprec)
return build1 (NOP_EXPR, type, expr);
/* Here detect when we can distribute the truncation down past some arithmetic.
For example, if adding two longs and converting to an int,
we can equally well convert both to ints and then add.
/* Here detect when we can distribute the truncation down past some
arithmetic. For example, if adding two longs and converting to an
int, we can equally well convert both to ints and then add.
For the operations handled here, such truncation distribution
is always safe.
It is desirable in these cases:
......@@ -196,7 +196,9 @@ convert_to_integer (type, expr)
/* We can pass truncation down through right shifting
when the shift count is a nonpositive constant. */
if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
&& tree_int_cst_lt (TREE_OPERAND (expr, 1), integer_one_node))
&& tree_int_cst_lt (TREE_OPERAND (expr, 1),
convert (TREE_TYPE (TREE_OPERAND (expr, 1)),
integer_one_node)))
goto trunc1;
break;
......@@ -204,7 +206,7 @@ convert_to_integer (type, expr)
/* We can pass truncation down through left shifting
when the shift count is a nonnegative constant. */
if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
&& ! tree_int_cst_lt (TREE_OPERAND (expr, 1), integer_zero_node)
&& tree_int_cst_sgn (TREE_OPERAND (expr, 1)) >= 0
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
{
/* If shift count is less than the width of the truncated type,
......
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