<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 18, 2016 at 2:03 PM, Rail Shafigulin <span dir="ltr"><<a href="mailto:rail@esenciatech.com" target="_blank">rail@esenciatech.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Fri, Mar 18, 2016 at 1:53 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On Mar 18, 2016, at 1:47 PM, Rail Shafigulin <<a href="mailto:rail@esenciatech.com" target="_blank">rail@esenciatech.com</a>> wrote:</div><br><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div><div><span style="color:rgb(34,34,34)">Yes this IR does not build or shuffle any vector. Try to write a function that takes 8 ints and a pointer to a <4xi32>, builds two vectors with the 8 ints,</span></div></div></div></div></div></blockquote><div><br></div><div>This might sound like a dumb question, but how does one build a vector of ints out of regular ints in IR? </div></div></div></div></div></blockquote><div><br></div></span><div>See: <a href="http://llvm.org/docs/LangRef.html#vector-operations" target="_blank">http://llvm.org/docs/LangRef.html#vector-operations</a></div><div><br></div><div>In short, the IR has "insertelement", which maps to "INSERT_VECTOR_ELT" in SDAG and "extractelement", which maps to "EXTRACT_VECTOR_ELT" in SDAG.</div><div><br></div><div>I usually find good example by grepping in the lit tests. Another way is to write the function in clang, and run it with -O3 -emit-llvm -S to get a good starting point.</div></div></div></blockquote></span><div>I tried using clang test.c -O3 -emit-llvm -S, but the only I didn't see any of the insertvectorelt or extractvectorelt. I'm wondering how does one trigger vector operations? </div><div><br></div><div>Below is the test.c file. It seemed to me like a good candidate for vectorization, however nothing happened. I would really appreciate  if you could point me in the right<br></div><div>direction with respect to vector generation.</div><div><br></div><div>Any help is appreciated.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span><font color="#888888"><div><br></div><span class=""><font color="#888888"><div>-- </div><div>Mehdi</div></font></span></font></span></div></div></blockquote></div><span class=""><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div>Rail Shafigulin<br></div>Software Engineer <br>Esencia Technologies<br></div></div></div></div>
</span></div></div>
</blockquote></div><br>Forgot to attach a C file. Here it is:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">#define N 32</div><div class="gmail_extra"><br></div><div class="gmail_extra">int main () {</div><div class="gmail_extra"><br></div><div class="gmail_extra">  int  a[N], b[N];</div><div class="gmail_extra">  int c[N];</div><div class="gmail_extra"><br></div><div class="gmail_extra">  for (int i = 0; i < N; ++i)</div><div class="gmail_extra">       c[i] = a[i] + b[i];</div><div class="gmail_extra"><br></div><div class="gmail_extra">  int sum=0;</div><div class="gmail_extra">  for (int i = 0; i < N; ++i)</div><div class="gmail_extra">       sum += c[i];</div><div class="gmail_extra"><br></div><div class="gmail_extra">  return sum;</div><div class="gmail_extra">}</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>