aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@gcc.gnu.org>2008-12-23 08:21:32 -0800
committerAndrew Pinski <pinskia@gcc.gnu.org>2008-12-23 08:21:32 -0800
commit12fda46d3bcf919c1ee2c423c1ddee6b14d0d94a (patch)
tree919a9fe2e9f195264bf7c794d82fbfc334d65c11 /gcc/fold-const.c
parentf05d0fc14890e21fda270b46d6344cac934f409d (diff)
downloadgcc-12fda46d3bcf919c1ee2c423c1ddee6b14d0d94a.zip
gcc-12fda46d3bcf919c1ee2c423c1ddee6b14d0d94a.tar.gz
gcc-12fda46d3bcf919c1ee2c423c1ddee6b14d0d94a.tar.bz2
[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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 8c0cb1d..74a0a87 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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