This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: loop unroll question
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Revital Eres <ERES at il dot ibm dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 2 Apr 2004 11:06:36 +0200
- Subject: Re: loop unroll question
- References: <OF3FEBFE03.6A98C185-ONC2256E69.004E2096-C2256E69.004F31D6@il.ibm.com>
Hello,
> For mainline on power-pc 4 with the option -O3 -funroll-loops,
> the following loop is not unrolled, but in GCC 3.4 it is.
> Also for mainline the bct is not inserted, but again in GCC 3.4
> it is.
>
> void
> example_new(int a[],int b[],int c[], int j)
> {
> int i;
>
> for(i=0 ; i<=j ; i++)
> {
> c[i]=a[i]+b[i];
> }
> return;
> }
as for inserting bct -- it was wrong to do this, since the loop could
be the infinite one (not really, since we work in a signed arithmetics
for that the overflow has an undefined behavior, but we cannot
verify this on rtl level).
As for unrolling, we are too conservative here; I will send a patch
for this soon.
Zdenek
> If the condition is changed to < (instead of <=) the unrolling is
> done as expected and bct is inserted.
>
> Thanks,
> Revital