@@ -2139,6 +2139,15 @@ 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)
+ && !TYPE_OVERFLOW_SANITIZED (type) && !TYPE_SATURATING (type))
+ (mult (mult @0 @2) @1)))
+
/* True if we can easily extract the real and imaginary parts of a complex
number. */
(match compositional_complex
new file mode 100644
@@ -0,0 +1,8 @@
+/* { 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" } } */