<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Serg Anohovsky</b> <span dir="ltr"><<a href="mailto:serg.anohovsky@gmail.com">serg.anohovsky@gmail.com</a>></span><br>
Date: 2011/5/22<br>Subject: Re: [LLVMdev] No SSE instructions<br>To: Chris Lattner <<a href="mailto:clattner@apple.com">clattner@apple.com</a>><br><br><br><div><div></div><div class="h5"><br><br><div class="gmail_quote">
2011/5/22 Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></span><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"><br><div><div><div>On May 22, 2011, at 10:47 AM, Justin Holewinski wrote:</div><br><blockquote type="cite"><div class="gmail_quote">On Sun, May 22, 2011 at 1:07 PM, Serg Anohovsky <span dir="ltr"><<a href="mailto:serg.anohovsky@gmail.com" target="_blank">serg.anohovsky@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello.<div>I have compiled the simple program:</div><div><br></div><div><div>#include <stdio.h></div><div>#include <stdlib.h></div><div><br></div><div>int v1[10000];</div><div><br></div><div>int main()</div><div>



{</div><div>        int i;</div><div><br></div><div>        for (i = 0; i < 10000; i++) {</div><div>                v1[i] = i;</div><div>        }</div><div><br></div></div></blockquote><div><br></div><div>This loop is not really vectorizable, even if LLVM had an auto-vectorizer.  You need the same operation (floating-point or integer) applied to contiguous elements in a vector.  An example of a vectorizable loop body would be "v1[i] = v1[i] * v1[i]"  Then, you could use SSE (or any other vector instruction set) to get a substantial speed improvement.</div>

</div></blockquote><div><br></div></div><div>This is vectorizable.  Just start out with a vector of constants <0, 1, 2, 3>  and do a store of it every time through the loop, adding <4,4,4,4> as you go.</div><div>

<br></div><font color="#888888"><div>-Chris</div></font><div><br><blockquote type="cite"><div class="gmail_quote">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>        for (i = 0; i < 10000; i++) {</div>
<div>                printf("%d ", v1[i]);</div><div>        }</div><div><br></div><div>        return 0;</div><div>}</div></div><div><br></div><div>Next, I disasseble the executable file and have not found any SSE instructions.</div>



<div>I know that LLVM support SSE.</div><div>So my questions:</div><div>  1. It is occur only in my computer?</div><div>  2. If it is not only my bug, then there are not SSE optimizations in LLVM? </div><div>  3. Have anyone, already worked on this problem? </div>



<div><br></div><div>--</div><div>Serg Anohovsky.</div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <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><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div><br>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <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><br></blockquote></div></div><br></div>
</blockquote></div></div></div>Thanks, for your notes. In my opinion, there are no different. So another example:<div><div class="im"><div>#include <stdio.h></div><div>#include <stdlib.h></div><div><br></div>
</div><div>int v0[10000];</div><div class="im"><div>
int v1[10000];</div><div><br></div><div>int main()</div><div>{</div><div>        int i;</div><div><br></div><div>        for (i = 0; i < 10000; i++) {</div></div><div>                v0[i] = i;</div><div class="im"><div>
        }</div><div>
<br></div><div>        for (i = 0; i < 10000; i++) {</div></div><div>                v1[i] = v0[i] * v0[i] * 4;</div><div class="im"><div>        }</div><div><br></div><div>        for (i = 0; i < 10000; i++) {</div>
<div>                printf("%d ", v1[i]);</div>
<div>        }</div><div><br></div><div>        return 0;</div><div>}</div></div></div><div><br></div><div>This is should be optimized, but LLVM have not optimized this program. The questions </div><div>were not about this specific example. I wont to understand, what vector optimizations LLVM have?</div>

<div>How well implemented this theme in LLVM?</div>
</div><br>