<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div><div style="font-family: Calibri,sans-serif; font-size: 11pt;">Hi. I don't know how llvm works internally, but I guess the code you wrote don't need any vectorization.<br>It's probably because its completely memory bound and hardware prefetch will do the job for you. <br>You can force vectorization using some pragmas (I don't remember which). <br>Regis<br>Altimesh</div></div><div dir="ltr"><hr><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">De : </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:cfe-dev@lists.llvm.org">Rail Shafigulin via cfe-dev</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Envoyé : </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">‎16/‎03/‎2016 23:00</span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">À : </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:llvm-dev@lists.llvm.org">llvm-dev</a>; <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Objet : </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">[cfe-dev] vectorization for X86</span><br><br></div><div dir="ltr">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.<div><br><div>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<br></div><div><div><br></div><div><div><div>#define N 32</div><div><br></div><div>int main () {</div><div><br></div><div>  int  a[N], b[N];</div><div>  int c[N];</div><div><br></div><div>  for (int i = 0; i < N; ++i)</div><div>       c[i] = a[i] + b[i];</div><div><br></div><div>  int sum=0;</div><div>  for (int i = 0; i < N; ++i)</div><div>       sum += c[i];</div><div><br></div><div>  return sum;</div><div>}</div></div><div><br></div><div><br></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Rail Shafigulin<br></div>Software Engineer <br>Esencia Technologies<br></div></div></div></div>
</div></div></div></div>
</body></html>