aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2016-04-26 16:02:09 +0200
committerMarc Glisse <glisse@gcc.gnu.org>2016-04-26 14:02:09 +0000
commit6b6aa8d388ce3a330fb65db4e9d5120fbe3c1fe7 (patch)
treec9d8cd56bc07eff23e7a6bbb4f64796773adab46 /gcc/fold-const.c
parenta84454dc451034e76d05f0b23ad2bffceb8cac05 (diff)
downloadgcc-6b6aa8d388ce3a330fb65db4e9d5120fbe3c1fe7.zip
gcc-6b6aa8d388ce3a330fb65db4e9d5120fbe3c1fe7.tar.gz
gcc-6b6aa8d388ce3a330fb65db4e9d5120fbe3c1fe7.tar.bz2
match.pd: X + X --> X * 2 for integers
2016-04-26 Marc Glisse <marc.glisse@inria.fr> gcc/ * genmatch.c (write_predicate): Add ATTRIBUTE_UNUSED. * fold-const.c (fold_binary_loc): Remove 2 transformations superseded by match.pd. * match.pd (x+x -> x*2): Generalize to integers. gcc/testsuite/ * gcc.dg/fold-plusmult.c: Adjust. * gcc.dg/no-strict-overflow-6.c: Adjust. * gcc.dg/gomp/loop-1.c: Xfail some tests. From-SVN: r235444
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c19
1 files changed, 0 insertions, 19 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 9514c71..1ce66e7 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9956,25 +9956,6 @@ fold_binary_loc (location_t loc,
fold_convert_loc (loc, type,
negate_expr (op0)), tem);
- /* (A + A) * C -> A * 2 * C */
- if (TREE_CODE (arg0) == PLUS_EXPR
- && TREE_CODE (arg1) == INTEGER_CST
- && operand_equal_p (TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg0, 1), 0))
- return fold_build2_loc (loc, MULT_EXPR, type,
- omit_one_operand_loc (loc, type,
- TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg0, 1)),
- fold_build2_loc (loc, MULT_EXPR, type,
- build_int_cst (type, 2) , arg1));
-
- /* ((T) (X /[ex] C)) * C cancels out if the conversion is
- sign-changing only. */
- if (TREE_CODE (arg1) == INTEGER_CST
- && TREE_CODE (arg0) == EXACT_DIV_EXPR
- && operand_equal_p (arg1, TREE_OPERAND (arg0, 1), 0))
- return fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0));
-
strict_overflow_p = false;
if (TREE_CODE (arg1) == INTEGER_CST
&& 0 != (tem = extract_muldiv (op0, arg1, code, NULL_TREE,