[cfe-dev] vectorization for X86

Rail Shafigulin via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 16 14:29:43 PDT 2016


I'm trying to vectorize a simple C code. My problem is that I don't quite
understand the relationship between clang --target option and the cores
mentioned in X86.td as well as other X86 related options (such as -mtune).
Below are the command and the code that I'm trying to vectorize. The code
compiles but I don't see any vectors. What am I doing wrong? Any help is
appreciated.

clang -S x.c --target=x86_64-pc-gnu -mtune=core-avx2 -o x.x86.s -fvectorize
-fno-lax-vector-conversions -fslp-vectorize-aggressive -fslp-vectorize

#define N 32

int main () {

  int  a[N], b[N];
  int c[N];

  for (int i = 0; i < N; ++i)
       c[i] = a[i] + b[i];

  int sum=0;
  for (int i = 0; i < N; ++i)
       sum += c[i];

  return sum;
}



-- 
Rail Shafigulin
Software Engineer
Esencia Technologies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160316/4d51517c/attachment.html>


More information about the cfe-dev mailing list