[PATCH] D15690: Gather and Scatter intrinsics in the Loop Vectorizer

Elena Demikhovsky via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 07:08:56 PST 2015


delena created this revision.
delena added reviewers: Ayal, gilr, nadav, aschwaighofer.
delena added a subscriber: llvm-commits.
delena set the repository for this revision to rL LLVM.

Loop vectorizer now knows to vectorize GEP and create masked gather and scatter intrinsics for random memory access.

The feature is enabled on AVX-512 target.
the following loops are vectorized on AVX-512:

struct In {
  float a;
  float b;
};

void foo1 (float * __restrict__ in, float * __restrict__ out, int * __restrict__ trigger, int * __restrict__ index) {

  for (int i=0; i<SIZE; ++i) {
    if (trigger[i] > 0) {
      out[i] = in[index[i]] + (float) 0.5;
    }
  }
}
void foo2 (In * __restrict__ in, float * __restrict__ out, int * __restrict__ trigger) {

  for (int i=0; i<SIZE; ++i) {
    if (trigger[i] > 0) {
      out[i] = in[i].b + (float) 0.5;
    }
  }
}

struct Out {
  float a;
  float b;
};
void foo3 (In * __restrict__ in, Out * __restrict__ out, int * __restrict__ trigger) {

  for (int i=0; i<SIZE; ++i) {
    if (trigger[i] > 0) {
      out[i].b = in[i].b + (float) 0.5;
    }
  }
}


Repository:
  rL LLVM

http://reviews.llvm.org/D15690

Files:
  ../include/llvm/Analysis/TargetTransformInfo.h
  ../include/llvm/Analysis/TargetTransformInfoImpl.h
  ../include/llvm/IR/IRBuilder.h
  ../lib/Analysis/TargetTransformInfo.cpp
  ../lib/IR/IRBuilder.cpp
  ../lib/Target/X86/X86TargetTransformInfo.cpp
  ../lib/Target/X86/X86TargetTransformInfo.h
  ../lib/Transforms/Vectorize/LoopVectorize.cpp
  ../test/Transforms/LoopVectorize/X86/gather_scatter.ll
  ../test/Transforms/LoopVectorize/X86/masked_load_store.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15690.43374.patch
Type: text/x-patch
Size: 36255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151221/875584c8/attachment.bin>


More information about the llvm-commits mailing list