diff options
author | Jan Hubicka <hubicka@gcc.gnu.org> | 2012-10-19 09:17:06 +0000 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2012-10-19 09:17:06 +0000 |
commit | c8379865b38e7dfdd18d1aa64bb95ed76c7b54f0 (patch) | |
tree | 302a352ecd6a2844ce27887f23d549051161c388 | |
parent | b11f0116d6e5e89dca5b1bfd56ba54fda3e05bf7 (diff) | |
download | gcc-c8379865b38e7dfdd18d1aa64bb95ed76c7b54f0.zip gcc-c8379865b38e7dfdd18d1aa64bb95ed76c7b54f0.tar.gz gcc-c8379865b38e7dfdd18d1aa64bb95ed76c7b54f0.tar.bz2 |
cunroll-1.c: New testcase.
* gcc.dg/tree-ssa/cunroll-1.c: New testcase.
* gcc.dg/tree-ssa/cunroll-2.c: New testcase.
* gcc.dg/tree-ssa/cunroll-3.c: New testcase.
* gcc.dg/tree-ssa/cunroll-4.c: New testcase.
* gcc.dg/tree-ssa/cunroll-5.c: New testcase.
From-SVN: r192608
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/cunroll-1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/cunroll-3.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/cunroll-4.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/cunroll-5.c | 14 |
5 files changed, 79 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-1.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-1.c new file mode 100644 index 0000000..c302b17 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-cunroll-details" } */ +int a[2]; +test(int c) +{ + int i; + for (i=0;i<c;i++) + a[i]=5; +} +/* Array bounds says the loop will not roll much. */ +/* { dg-final { scan-tree-dump "Unrolled loop 1 completely .duplicated 1 times.." "cunroll"} } */ +/* { dg-final { scan-tree-dump "Last iteration exit edge was proved true." "cunroll"} } */ +/* { dg-final { cleanup-tree-dump "cunroll" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c new file mode 100644 index 0000000..cd54c66 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-cunroll-details" } */ +int a[2]; +test(int c) +{ + int i; + for (i=0;i<c;i++) + { + a[i]=5; + if (test2()) + return; + } +} +/* We are not able to get rid of the final conditional because the loop has two exits. */ +/* { dg-final { scan-tree-dump "Unrolled loop 1 completely .duplicated 2 times.." "cunroll"} } */ +/* { dg-final { cleanup-tree-dump "cunroll" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-3.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-3.c new file mode 100644 index 0000000..b621432 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-3.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-cunrolli-details" } */ +int a[1]; +test(int c) +{ + int i; + for (i=0;i<c;i++) + { + a[i]=5; + } +} +/* If we start duplicating headers prior curoll, this loop will have 0 iterations. */ + +/* { dg-final { scan-tree-dump "Unrolled loop 1 completely .duplicated 1 times.." "cunrolli"} } */ +/* { dg-final { cleanup-tree-dump "cunrolli" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-4.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-4.c new file mode 100644 index 0000000..02c9426 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-4.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-cunroll-details" } */ +int a[1]; +test(int c) +{ + int i=0,j; + for (i=0;i<c;i++) + { + for (j=0;j<c;j++) + { + a[i]=5; + test2(); + } + } +} + +/* We should do this as part of cunrolli, but our cost model do not take into account early exit + from the last iteration. */ +/* { dg-final { scan-tree-dump "Turned loop 1 to non-loop; it never loops." "cunrolli"} } */ +/* { dg-final { scan-tree-dump "Last iteration exit edge was proved true." "cunrolli"} } */ +/* { dg-final { cleanup-tree-dump "cunroll" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-5.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-5.c new file mode 100644 index 0000000..8d1a14a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-5.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-cunroll-details" } */ +int *a; +test(int c) +{ + int i; + for (i=0;i<6;i++) + a[i]=5; +} +/* Basic testcase for complette unrolling. */ +/* { dg-final { scan-tree-dump "Unrolled loop 1 completely .duplicated 5 times.." "cunroll"} } */ +/* { dg-final { scan-tree-dump "Exit condition of peeled iterations was eliminated." "cunroll"} } */ +/* { dg-final { scan-tree-dump "Last iteration exit edge was proved true." "cunroll"} } */ +/* { dg-final { cleanup-tree-dump "cunroll" } } */ |