diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c new file mode 100644 index 000000000..5b57160bc --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-reassoc1" } */ + +unsigned int test1 (unsigned int x, unsigned int y, unsigned int z, + unsigned int weight) +{ + unsigned int tmp1 = x * weight; + unsigned int tmp2 = y * weight; + unsigned int tmp3 = (x - y) * weight; + return tmp1 + (tmp2 + tmp3); +} + +unsigned int test2 (unsigned int x, unsigned int y, unsigned int z, + unsigned int weight) +{ + unsigned int tmp1 = x * weight; + unsigned int tmp2 = y * weight * weight; + unsigned int tmp3 = z * weight * weight * weight; + return tmp1 + tmp2 + tmp3; +} + +/* There should be one multiplication left in test1 and three in test2. */ + +/* { dg-final { scan-tree-dump-times "\\\*" 4 "reassoc1" } } */ +/* { dg-final { cleanup-tree-dump "reassoc1" } } */ |