<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Aug 19, 2013, at 6:08 PM, Sean Silva <<a href="mailto:silvas@purdue.edu">silvas@purdue.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 19, 2013 at 8:35 PM, Quentin Colombet <span dir="ltr"><<a href="mailto:qcolombet@apple.com" target="_blank">qcolombet@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"><div>Hi,</div><div><br></div>
<div>Here is a patch that implements the slicing of a load into two smaller loads when the elements are next to each other in memory.</div><div>The original motivation as well as the discussion of why we came up with this patch can be found here:</div>
<div><a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-August/064769.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-August/064769.html</a></div><div><br></div><div><br></div><div>** Motivation **</div>
<div><br></div><div>To give a bit of context, the motivation was to get rid of truncate and shift right instructions that get in the way of paired load or floating point load.</div><div>E.g.,</div><div>Consider the following example:</div>
<div>struct Complex {</div><div><span style="white-space:pre-wrap">   </span>float real;</div><div><span style="white-space:pre-wrap">      </span>float imm;</div><div>};</div><div><br></div><div>When accessing a complex, llvm was generating a 64-bits load and the imm field was obtained by a trunc(lshr) sequence, resulting in poor code generation, at least for x86.</div>
<div><br></div></div></blockquote><div><br></div><div>Interesting. I saw something similar ("<span style="white-space: pre-wrap;">extract-fields-from-chunk-of-bits") </span>while investigating the issue reported in PR16739 (the second IR example in the bug report is an example), except that the trunc/lshr's were being created by GVN and not by SROA. <<a href="http://llvm.org/bugs/show_bug.cgi?id=16739">http://llvm.org/bugs/show_bug.cgi?id=16739</a>></div></div></div></div></blockquote><div>That’s indeed interesting.</div><div>I had a quick look at PR16739, and this transformation could apply if we extend it to floating point type. Currently, we abort the transformation is the load is not an int type.</div><div><br></div><div>-Quentin</div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div><br></div><div>-- Sean Silva</div></div></div></div>
</blockquote></div><br></body></html>