This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

loop unswitching


It is said that gcc implements loop unswitching  on
SSA and RTL representations.

At the same time, in this link 
http://gcc.gnu.org/projects/tree-ssa/vectorization.html
it is said that loop unswitching is not done to
overcome branch statements to vectorize loops.

When I run a simple code which has a loop with 'if' 
statement gcc-4.1.2  is unable to vectorize loop.
The prg is at bottom. It was compiled as 'gcc
-march=pentium4 -O3  -S -ftree-vectorize'
-funswitch-loops 6.c
Can anyone resolve this ambiguity?

--------------------------------------------------------
      1 #include<stdio.h>
      2
      3 int main()
      4 {
      5
      6 int c[100],a[100],b[100];
      7 int i,j,n=80;
      8 for(i=0;i<n;i++)
      9         a[i]=b[i]=c[i]=i;
     10
     11 for (i=0;i<n;i++)
     12 {
     13 a[i] = b[i]-1;
     14 if(c[i])
     15 c[i]=b[i]*2;
     16 //b[i+10] = a[i]+5;
     17 }
     18
     19 for (i=0;i<n;i++)
     20 printf("\n %d %d %d\n",b[i],c[i],a[i]);
     21 }



 


      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]