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 peeling in autovectorization


Hi,

This question is about loop peeling done by gcc-4.1.2
in autovectorization.

For the following program gcc is able to do vectorize
the code by peeling.
    1 #include<stdio.h>
      2 int main()
      3 {
      4 int a[100],b[100],c[100];
      5 int i,j,n=80;
      6 for(i=0;i<100;i++) a[i]=b[i]=c[i]=i;
      7
      8
      9 for(i=0;i<n;i++)
     10 {
     11 a[i+1]=b[i+13]-10;
     12 b[i+1]=a[i+14]*3;
     13 }
     14
     15 printf("\n %d %d", a[44],b[33]);
     16 }

But, if we change the 12 th line to 
 b[i+2]=a[i+14]*3;
gcc cant do loop peeling.Consequently gcc cant do
autovectorization.

The reason is when the two  references misalignments
are equal it sets DR_MISALIGNMENT(dr) to zero.
Below is the code from "tree-vect-analyze.c" where it
does so.

My question is why gcc cant do autovectorization in
case if two datarefernces's misalignments are not
same.
What should I do to improve that case?
Thanks in advance.


   833 vect_update_misalignment_for_peel (struct
data_reference *dr,
    834                                    struct
data_reference *dr_peel, int npeel)
    835 {
    836   unsigned int i;
    837   int drsize;
    838   VEC(dr_p,heap) *same_align_drs;
    839   struct data_reference *current_dr;
    840
    841   if (known_alignment_for_access_p (dr)
    842       && DR_MISALIGNMENT (dr) ==
DR_MISALIGNMENT (dr_peel))
    843     {
    844       DR_MISALIGNMENT (dr) = 0;
    845       return;
    846     }




      ___________________________________________________________
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]