<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 Jan 7, 2014, at 11:40 AM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 7, 2014 at 2:24 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I agree with Andy and Jim.</div><div>Actually, I have prototyped a compiler that does exactly this kind of promotion in CodeGenPrepare.</div>
<div>Basically, I have updated the addressing mode matcher so that it moves a sext that is in a way of an addressing mode (i.e., it promotes the operand of the sext, let us call this operand def, if it is legal to do so, and sign extends the operands of def). When the matcher does not manage to absorb more computation after promoting def, it can revert the promotion.</div>
<div><br></div><div>I am currently benchmarking this solution and I’ll update this thread with the results.</div></blockquote></div><br>Very cool. Could you share the patch? I can also run some benchmarks.</div></div>
</blockquote></div>Sure, but be aware that this is a prototype (not structured, not commented) :).<div>In particular, it is missing the rollback if the promotion does not help<br><div><div><br></div><div>-Quentin</div><div></div></div></div></body></html>