[LLVMdev] Fwd: Vectorization of pointer PHI nodes

Renato Golin renato.golin at linaro.org
Mon Oct 14 09:29:26 PDT 2013


Hi Nadav, Arnold, (now copying LLVM-dev, not commits),

I'm working on an example of a code that current GCC trunk can vectorize
but LLVM cannot, and after analysing the intermediate IR just before the
loop vectorization and by stepping through the process, I can see that the
vectorizer only recognizes integer and float reduction variables, not
pointers.

My code looks like this:

for (i: 0 -> MAX) {
  a = *read;
  b = *read;
  c = *read;

  // do the same stuff to a, b, c

  *write++ = a;
  *write++ = b;
  *write++ = c;
}

Vectorizing this is very simple and it's a sequence of VLD3 + VOPS + VST3,
which GCC does it nicely, but we don't.

What would be the steps in adding a pointer increment reduction kind
(RK_PointerInc)? I believe the logic would be similar to RK_IntegerAdd, but
with a stride of type size, right?

Or maybe we'd have to translate the loop into something like:

for (i: 0 -> MAX, +=3) {
  write[i] = (op) read[i];
  write[i+1] = (op) read[i+1];
  write[i+2] = (op) read[i+2];
}

So that the reduction variable gets recognized?

cheers,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131014/77229f86/attachment.html>


More information about the llvm-dev mailing list