* match.pd ((X * CST) * Y): Reassociate to (X * Y) * CST.
testsuite/
* gcc.dg/tree-ssa/assoc-2.c: New testcase.
From-SVN: r250523
-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
(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.
--- /dev/null
+/* { 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" } } */