http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47892

           Summary: Fails to vectorize comparison code
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jeremysal...@gmail.com


I have the following function

#define PIO6 0.523598776

#define SA5 2.74201854577e-06
#define SA4 -1.98410347969e-04
#define SA3 8.33333320429e-03
#define SA2 -1.66666666666e-01

static void bestseries9(float * __restrict__ arr,int len) {
   for(int i=0; i<len; i++) {
      float or=arr[i];
      float orig=or / 3*(or>PIO6);
      float sqr=orig*orig;
      arr[i]=orig*(1+sqr*(SA2+sqr*(SA3+sqr*(SA4+SA5*sqr))));
      arr[i]=arr[i]*(1+(or>PIO6)*(2-4*arr[i]*arr[i]));
   }
}

which should be vectorized, but it is not.  If I turn on verbose vectorization,
it says that there is a conditional in the loop, and so it won't vectorize it.

Reply via email to