<div dir="ltr"><div><div><div><div><div><div><div><div><div>A rotate intrinsic should be relatively close in cost/complexity to the existing bswap.<br><br></div>A grep of intrinsic::bswap says we'd probably add code in:<br></div>InstCombine<br></div><div>InstructionSimplify<br></div>ConstantFolding<br></div>DemandedBits<br></div>ValueTracking<br></div>VectorUtils<br></div>SelectionDAGBuilder<br><br></div>But I don't think it's fair to view those additions as pure added cost. As an example, consider that we have to add hacks to EarlyCSE to recognize multi-IR-instruction min/max/abs patterns. Intrinsics just work as-is there. So if you search for 'matchSelectPattern', you get an idea (I see 32 hits in 10 files) of the cost of *not* having intrinsics for those operations that we've decided are not worthy of intrinsics.<br></div><div><div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 16, 2018 at 2:20 PM, John Regehr via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="gmail-">On 5/16/18 1:58 PM, Sanjay Patel via llvm-dev wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
An informal metric might be: if the operation is supported as a primitive op or built-in in source languages and it is supported as a single target instruction, can we guarantee that 1-to-1 translation through optimization?<br>
</blockquote>
<br></span>
It seems perfectly reasonable for LLVM users to expect this to happen reliably.<br>
<br>
I'd like to take a look at the other side of the equation: the cost of adding a new intrinsic in terms of teaching passes to see through it, so we don't lose optimizations that worked before the intrinsic was added.<br>
<br>
For example, clearly ValueTracking needs a few lines added so that computeKnownBits and friends don't get stopped by a rotate. Anyone have a reasonably complete list of files that need similar changes?<br>
<br>
John<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>