<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 5, 2016 at 1:15 AM, James Molloy <span dir="ltr"><<a href="mailto:james@jamesmolloy.co.uk" target="_blank">james@jamesmolloy.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi David,<span class=""><div><br></div><div>> <span style="line-height:1.5">Out of curiosity, is there a major benefit to canonicalizing this in the middle-end vs doing this transform in code-gen prepare?</span></div><div><span style="line-height:1.5"><br></span></div></span><div><span style="line-height:1.5">Major? no. My initial implementation was to do this in ISelLowering, but it was remarked that matching bitreversals is a fairly generic concept that other backends could benefit from.</span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">The code already in instcombine (since at least 2010) to match bswaps performs almost exactly the same steps as matching bitreversals (apart from it looks at bytes rather than bits). I therefore thought the most obvious thing to do would be to tweak the existing algorithm and improve it.</span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">Do you think it's too heavyweight for instcombine?</span></div></div></blockquote><div><br></div><div>I think it might be too heavyweight and I haven't seen an argument for why it's valuable to canonicalize upfront.  bswap is a little more reasonable because there are fewer "parts" and we want to eliminate bswap pairs.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="HOEnZb"><font color="#888888"><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">James</span></div></font></span></div><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Mon, 4 Jan 2016 at 23:13 David Majnemer via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">majnemer added a comment.<br>
<br>
Out of curiosity, is there a major benefit to canonicalizing this in the middle-end vs doing this transform in code-gen prepare?<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D15857" rel="noreferrer" target="_blank">http://reviews.llvm.org/D15857</a><br>
<br>
<br>
<br></div></div><span class="">
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</span></blockquote></div>
</blockquote></div><br></div></div>