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
This commit is contained in:
Jan Hubicka 2012-10-19 09:17:06 +00:00
parent b11f0116d6
commit c8379865b3
5 changed files with 79 additions and 0 deletions

View File

@ -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" } } */

View File

@ -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" } } */

View File

@ -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" } } */

View File

@ -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" } } */

View File

@ -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" } } */