------- Comment #3 from spop at gcc dot gnu dot org  2010-03-26 20:26 -------
vectorizable_condition has to be cleaned up of this condition:

  /* We do not handle two different vector types for the condition
     and the values.  */
  if (TREE_TYPE (TREE_OPERAND (cond_expr, 0)) != TREE_TYPE (vectype))
    return false;

When using: 

typedef int uint8_t;
vsad16_c (void *c, uint8_t * s1, uint8_t * s2, int stride, int h)
{
  int score = 0;
  int x, y;
  for (x = 0; x < 16; x++)
    score += ((s1[x] - s1[x + stride] + s2[x + stride]) >= 0 ?
              s1[x] + s2[x + stride] :
              s2[x + stride]);
  return score;
}

ncopies is then equal to 1, but then this condition is true:
"uint8_t" is a different type than "int"

    type <integer_type 0x7ffff5a91498 uint8_t sizes-gimplified public SI
    type <integer_type 0x7ffff7e7f498 int sizes-gimplified public SI

but using this version, we pass over this condition:

int vsad16_c (void *c, int * s1, int * s2, int stride, int h)
{
  int score = 0;
  int x, y;
  for (x = 0; x < 16; x++)
    score += ((s1[x] - s1[x + stride] + s2[x + stride]) >= 0 ?
              s1[x] + s2[x + stride] :
              s2[x + stride]);
  return score;
}

and the loop is vectorized.


-- 


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

Reply via email to