<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 18, 2016, at 1:37 PM, Rail Shafigulin <<a href="mailto:rail@esenciatech.com" class="">rail@esenciatech.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><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" class=""><div class=""><div class="h5"><blockquote type="cite" class=""><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class="">I think you created a cycle, this is easy to do with SelectionDAG :)<br class=""></div><div class=""><div class="">Basically SelecitonDAG will iterate until it does not see anything to change. So if you insert a transformation on a pattern A, that generates pattern B, while you have another transformation that matches B and generates somehow A, you run into an infinite loop.</div><div class=""><br class=""></div><div class=""><br class=""></div></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">I'm doing a lot of guess work in trying to understand what is going on. I would really appreciate any help on this.</div></div></div></div></div></blockquote><div class=""><br class=""></div></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">Here is how I started with SelectionDAG: </div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br class=""></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">- small IR (bugpoint can help)</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">- the magic flag: -debug </div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">- read the output of SelectionDAG debugging (especially with cycles)</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">- matching the log to source code</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">- single stepping in a debugger sometimes.</div></blockquote><div class=""><br class=""></div></div></div><div class="">Also: try to run your experiments with llc so you can easily tweak the input IR to SelectionDAG.</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">-- </div><div class="">Mehdi</div><div class=""><br class=""></div></font></span></div></blockquote></div><br class=""><br clear="all" class=""><div class="">I ran a very simple test using llc and the following .ll file</div><div class=""><div class="">target datalayout = "E-m:e-p:32:32-i64:32-f64:32-v64:32-v128:32-a:0:32-n32"</div><div class="">target triple = "esencia"</div><div class=""><br class=""></div><div class="">; Function Attrs: nounwind uwtable</div><div class="">define i32 @main() {</div><div class="">entry:</div><div class="">   %z = alloca <4 x i32></div><div class="">   %a = alloca <4 x i32></div><div class="">   %b = alloca <4 x i32></div><div class="">   %a.l = load <4 x i32>* %a</div><div class="">   %b.l = load <4 x i32>* %b</div><div class="">   %z.l = add <4 x i32> %a.l, %b.l</div><div class="">   store <4 x i32> %z.l, <4 x i32>* %z</div><div class="">   ret i32 0<br class=""></div><div class="">}</div></div><div class=""><br class=""></div><div class="">The test ran successfully (by successfully I mean genration of correct assembly for my target) without any modifications to the code, i.e. I didn't have to add any</div><div class=""><div class="">  setOperationAction(ISD::BUILD_VECTOR,      MVT::v4i32, Expand);</div><div class="">  setOperationAction(ISD::EXTRACT_VECTOR_ELT,      MVT::v4i32, Expand);</div><div class="">  setOperationAction(ISD::VECTOR_SHUFFLE,      MVT::v4i32, Expand);</div></div></div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div>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, sum them, and store the result to the pointer.</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class=""><br class=""></div><div class="">In other words I left the code as is. </div><div class=""><br class=""></div><div class="">However if I use a .c code and run it through clang, I don't see any vector instructions. I'm puzzled. What am I doing wrong? There seems to be a step missing, the one that will generate vectorized IR, but I can't seem to find how to do it.</div></div></div></div></blockquote><div><br class=""></div><div>Try: clang -O3 -emit-llvm -S test.c</div><div><br class=""></div><div>-- </div><div>Mehdi</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class=""><br class=""></div><div class="">Any help on this is really appreciated.</div><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">Rail Shafigulin<br class=""></div>Software Engineer <br class="">Esencia Technologies<br class=""></div></div></div></div>
</div></div>
</div></blockquote></div><br class=""></body></html>