On powerpc, current auto-vectorizer does not vectorize loops that have
conversion from float to int statement in it.
For example, in case we have the following program:

#include <stdarg.h>

#define N 32

int main1 ()
{
  int i;
  int ib[N]; 
  float fa[N] =
{0.2,3.1,6.7,6.9,9.8,12.3,15.4,18.9,21.0,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42};

  /* int -> float */
  for (i = 0; i < N; i++)
    {
      ib[i] = (int) fa[i];      
    }

    /* check results:  */
  for (i = 0; i < N; i++)
    {
      if (ib[i] != (int)fa[i]) 
        abort (); 
    }   

  return 0;
}

The vectorizer output is:
"not vectorized: relevant stmt not supported: D.2488_7 = (int) D.2487_6"
since there is no target hook for float to int conversion in rs6000 (altivec).


-- 
           Summary: missed auto-vectorization optimization, when there is
                    float to int conversion
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tehila at il dot ibm dot com
 GCC build triplet: powerpc-suse-linux
  GCC host triplet: powerpc-suse-linux
GCC target triplet: powerpc-suse-linux


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

Reply via email to