This kernel from FFmpeg is not vectorized with:
gcc-4.5 -c sub_hfyu_median_prediction.c -O3 -ffast-math
-ftree-vectorizer-verbose=7 -msse2
[...]
sub_hfyu_median_prediction.c:18: note: not vectorized: unhandled data-ref 

Looking with GDB at it, I get:
(gdb) p debug_data_references (datarefs)
(Data Ref: 
  stmt: D.2736_16 = *D.2735_15;
  ref: *D.2735_15;
  base_object: *src1_14(D);
  Access function 0: {0B, +, 1}_1
)
(Data Ref: 
  stmt: 
  ref: 
  base_object: 
)

I think it is the dst data ref that is NULL.  Might be an aliasing
problem for the data dep analysis, but still, the data ref should be
analyzed correctly first.


typedef short DCTELEM;
typedef unsigned char uint8_t;
typedef long int x86_reg;
typedef unsigned int uint32_t;
typedef unsigned long int uint64_t;

void
sub_hfyu_median_prediction_c (uint8_t * dst, const uint8_t * src1,
                              const uint8_t * src2, int w, int *left,
                              int *left_top)
{
  int i;
  uint8_t l, lt;

  l = *left;
  lt = *left_top;

  for (i = 0; i < w; i++)
    {
      const int pred = mid_pred (l, src1[i], (l + src1[i] - lt) & 0xFF);
      lt = src1[i];
      l = src2[i];
      dst[i] = l - pred;
    }

  *left = l;
  *left_top = lt;
}

void add_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1, const
uint8_t *diff, int w, int *left, int *left_top)
{
  int i;
  uint8_t l, lt;

  l= *left;
  lt= *left_top;

  for(i=0; i<w; i++)
    {
      l= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF) + diff[i];
      lt= src1[i];
      dst[i]= l;
    }

  *left= l;
  *left_top= lt;
}


-- 
           Summary: Missed vectorization: "unhandled data-ref"
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: spop at gcc dot gnu dot org


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

Reply via email to