diff options
author | Richard Guenther <rguenther@suse.de> | 2008-04-29 15:59:43 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-04-29 15:59:43 +0000 |
commit | 1447bf0556ad0cb300aabd1b883fedee314b6fca (patch) | |
tree | c9e456f594c1a551adbd796e105d2374bafd6819 /gcc/testsuite/gcc.dg/fold-plusmult.c | |
parent | 59e6913ad1743f76ca98421b9b5614caf96a7cf7 (diff) | |
download | gcc-1447bf0556ad0cb300aabd1b883fedee314b6fca.zip gcc-1447bf0556ad0cb300aabd1b883fedee314b6fca.tar.gz gcc-1447bf0556ad0cb300aabd1b883fedee314b6fca.tar.bz2 |
re PR tree-optimization/15255 ([tree-ssa] a * 2 + a * 2 is not converted to a * 4)
2008-04-29 Richard Guenther <rguenther@suse.de>
PR middle-end/15255
* fold-const.c (fold_binary): Fold (A + A) * C to A * 2*C.
* gcc.dg/fold-plusmult.c: New testcase.
From-SVN: r134798
Diffstat (limited to 'gcc/testsuite/gcc.dg/fold-plusmult.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/fold-plusmult.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/fold-plusmult.c b/gcc/testsuite/gcc.dg/fold-plusmult.c new file mode 100644 index 0000000..d584b95 --- /dev/null +++ b/gcc/testsuite/gcc.dg/fold-plusmult.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-original" } */ + +int test1 (int a) +{ + return 2*a + 2*a; +} + +int test2 (int a) +{ + return (a + a)*2; +} + +/* { dg-final { scan-tree-dump-times "<a> \\\* 4" 2 "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ |