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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-05 
07:10:56 UTC ---
Until http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176563
float a[1024], b[1024], c[1024], d[1024];
int j[1024];

void
foo (void)
{
  int i;
  for (i = 0; i < 1024; ++i)
    {
      int x = a[i] < b[i];
      int y = c[i] < d[i];
      j[i] = x & c[i] < y;
    }
}

didn't use any bool types, just int and float, still it couldn't vectorize:
pr50596-2.c:8: note: not vectorized: relevant stmt not supported: x_5 =
D.2699_3 < D.2700_4;

I think we could use VECT_COND_EXPR <vect1 < vect2, { 1, 1, ...}, { 0, 0, ...
}>
for that (and hopefully the backends optimize that well, e.g. into
anding the comparison mask with { 1, 1, ... } or doing per-element right shift
by element width - 1 on the mask.

With bool it would be nice if at least for non-stores we would pick the best
suitable wider integer vector type (in this case where the bools are set by
comparison operation and feed & that is afterwards cast to int the best is
obviously int vector).

Reply via email to