[llvm-dev] Vectorizing "hybrid" SOA

Tom Chen via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 15 11:13:42 PST 2017

Do anyone know how to get LLVM's vectorizer to work on this code?
struct pair {
  int x[4], y[4];

void foo(int n, struct pair *a, int *restrict rx, int *restrict ry) {
  int x = 0, y = 0;
  for (int i = 0; i < n; i++) {
    x += (a+(i/4))->x[i%4];
    y += (a+(i/4))->y[i%4];
  *rx = x;
  *ry = y;
I have a pass that converts structures such as {int, int} into {int x 4,
int x 4}, but the transformation is profitable if it can work with the
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171115/5636ba2f/attachment-0001.html>

More information about the llvm-dev mailing list