<div dir="ltr">Nadav,<div><br></div><div style>Please forgive my ignorance, but 'opt -mcpu=corei7 -loop-vectorize -S -debug double.ll' doesn't appear to make a difference. In fact it seems to be ignored as garbage values for -mcpu don't raise an error. Am I overlooking something else also?</div>
<div style><br></div><div style>Many Thanks,</div><div style>Josh</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 9, 2013 at 6:06 PM, Nadav Rotem <span dir="ltr"><<a href="mailto:nrotem@apple.com" target="_blank">nrotem@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Josh, <div><br></div><div>Your modules does not have a triple, so the target machine and TargetTransformInfo have no way of knowing if you are running on a machine with vector registers.  Try adding the '-mcpu=XXXX' to opt and see what happens. </div>
<div><br></div><div>Thanks,</div><div>Nadav</div><div><br><div><div>On May 9, 2013, at 1:42 PM, Josh Klontz <<a href="mailto:josh.klontz@gmail.com" target="_blank">josh.klontz@gmail.com</a>> wrote:</div><br><blockquote type="cite">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Hi! I am trying to get the loop vectorizer to work on a simple example<br>(<a href="http://pastebin.com/tGhpc4y0" target="_blank">http://pastebin.com/tGhpc4y0</a>) that doubles every element in a vector.<br>
<br>I've found that 'opt -loop-vectorize -force-vector-width=4 -S -debug<br>double.ll' works as expected. However, removing the -force-vector-width flag<br>results in no vectorization. From the debug output I can see that the issue<br>
boils down to:<br><br>LV: The Widest type: 32 bits.<br>LV: The Widest register is:32bits.<br><br>I tried to work back through the source code to figure out why the widest<br>register is incorrect, though I get lost following the code logic for how<br>
TargetTransformInfo gets initialized. Therefore, I have two questions:<br><br>1) Can -force-vector-width be specified from the C++ API? And if so, how?<br>2) What am I neglecting to do so that TargetTransformInfo is set correctly<br>
and vectorization happens without forcing a vector width? Ultimately I would<br>like use vectorization in conjunction with the JIT ExecutionEngine.<br><br>Thank you to those of you who have answered my questions in the past, the<br>
answers have helped tremendously and I am extremely grateful!<br><br>Kindly,<br>Josh<br><br><br><br><span class="HOEnZb"><font color="#888888"><br>--<br>View this message in context:<span> </span><a href="http://llvm.1065342.n5.nabble.com/Simple-Loop-Vectorize-Question-tp57584.html" target="_blank">http://llvm.1065342.n5.nabble.com/Simple-Loop-Vectorize-Question-tp57584.html</a><br>
Sent from the LLVM - Dev mailing list archive at<span> </span><a href="http://nabble.com/" target="_blank">Nabble.com</a>.<br>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a><span> </span>        <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></font></span></div></blockquote></div><br></div></div></blockquote></div><br></div>