<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>