summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-plusmult.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-29 15:59:43 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-29 15:59:43 +0000
commitf4cd9b29e57a095e0c0a3e431733a5e58cbd0399 (patch)
treec9e456f594c1a551adbd796e105d2374bafd6819 /gcc/testsuite/gcc.dg/fold-plusmult.c
parentd0cfbbf21962a7fab6ad56f56ee3739188338c20 (diff)
downloadgcc-f4cd9b29e57a095e0c0a3e431733a5e58cbd0399.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134798 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/fold-plusmult.c')
-rw-r--r--gcc/testsuite/gcc.dg/fold-plusmult.c15
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 00000000000..d584b958874
--- /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" } } */