Commit b771c609 by Alexander Monakov

match.pd: reassociate multiplications

	* match.pd ((X * CST) * Y): Reassociate to (X * Y) * CST.
testsuite/
	* gcc.dg/tree-ssa/assoc-2.c: New testcase.

From-SVN: r250523
parent 417ca011
2017-07-07 Torsten Duwe <duwe@suse.de>
2017-07-25 Alexander Monakov <amonakov@ispras.ru>
* match.pd ((X * CST) * Y): Reassociate to (X * Y) * CST.
2017-07-25 Torsten Duwe <duwe@suse.de>
* common.opt: Introduce -fpatchable-function-entry
command line option, and its variables function_entry_patch_area_size
......
......@@ -2213,6 +2213,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(mult @0 integer_minus_onep)
(negate @0))
/* Reassociate (X * CST) * Y to (X * Y) * CST. This does not introduce
signed overflow for CST != 0 && CST != -1. */
(simplify
(mult:c (mult:s @0 INTEGER_CST@1) @2)
(if (TREE_CODE (@2) != INTEGER_CST
&& !integer_zerop (@1) && !integer_minus_onep (@1))
(mult (mult @0 @2) @1)))
/* True if we can easily extract the real and imaginary parts of a complex
number. */
(match compositional_complex
......
2017-07-07 Torsten Duwe <duwe@suse.de>
2017-07-25 Alexander Monakov <amonakov@ispras.ru>
* gcc.dg/tree-ssa/assoc-2.c: New testcase.
2017-07-25 Torsten Duwe <duwe@suse.de>
* c-c++-common/patchable_function_entry-default.c: New test.
* c-c++-common/patchable_function_entry-decl.c: Likewise.
......
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-gimple-raw -fdump-tree-optimized-raw" } */
int f0(int a, int b){
return a * 33 * b * 55;
}
/* { dg-final { scan-tree-dump-times "mult_expr" 2 "gimple" } } */
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