Commit 12fda46d by Andrew Pinski

[multiple changes]

2008-12-23  Andrew Pinski  <pinski@gmail.com>

        PR middle-end/38590
        * fold-const.c (fold_binary): Call fold_convert on arguments to
        fold_build2 for negative divide optimization.

2008-12-23  Andrew Pinski  <pinskia@gmail.com>

        PR middle-end/38590
        * gcc.c-torture/compile/pr38590-1.c: New testcase.
        * gcc.c-torture/compile/pr38590-2.c: New testcase.

From-SVN: r142906
parent f05d0fc1
2008-12-23 Andrew Pinski <pinski@gmail.com>
PR middle-end/38590
* fold-const.c (fold_binary): Call fold_convert on arguments to
fold_build2 for negative divide optimization.
2008-12-23 Jakub Jelinek <jakub@redhat.com>
PR middle-end/31150
......@@ -11678,7 +11678,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
WARN_STRICT_OVERFLOW_MISC);
return fold_build2 (code, type,
fold_convert (type, TREE_OPERAND (arg0, 0)),
negate_expr (arg1));
fold_convert (type, negate_expr (arg1)));
}
if ((!INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_UNDEFINED (type))
&& TREE_CODE (arg1) == NEGATE_EXPR
......@@ -11689,8 +11689,9 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
"when distributing negation across "
"division"),
WARN_STRICT_OVERFLOW_MISC);
return fold_build2 (code, type, negate_expr (arg0),
TREE_OPERAND (arg1, 0));
return fold_build2 (code, type,
fold_convert (type, negate_expr (arg0)),
fold_convert (type, TREE_OPERAND (arg1, 0)));
}
/* If arg0 is a multiple of arg1, then rewrite to the fastest div
......
2008-12-23 Andrew Pinski <pinskia@gmail.com>
PR middle-end/38590
* gcc.c-torture/compile/pr38590-1.c: New testcase.
* gcc.c-torture/compile/pr38590-2.c: New testcase.
2008-12-18 Jakub Jelinek <jakub@redhat.com>
PR middle-end/31150
......
int func_75 (int p_76)
{
return (1 / (int) -(unsigned int)p_76);
}
int func_75 (int p_76)
{
return (1 / (int) -(unsigned int)p_76) ? 1 : p_76;
}
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