1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-reassoc1" } */
4 int test1 (int x, int y, int z, int weight)
8 int tmp3 = (x - y) * weight;
9 return tmp1 + (tmp2 + tmp3);
12 int test2 (int x, int y, int z, int weight)
14 int tmp1 = x * weight;
15 int tmp2 = y * weight * weight;
16 int tmp3 = z * weight * weight * weight;
17 return tmp1 + tmp2 + tmp3;
20 /* There should be one multiplication left in test1 and three in test2. */
22 /* { dg-final { scan-tree-dump-times "\\\*" 4 "reassoc1" } } */
23 /* { dg-final { cleanup-tree-dump "reassoc1" } } */