<div dir="ltr">On Thu, Jul 18, 2013 at 6:06 AM, Jay Foad <span dir="ltr"><<a href="mailto:jay.foad@gmail.com" target="_blank">jay.foad@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 18 July 2013 13:50, David Majnemer <<a href="mailto:david.majnemer@gmail.com">david.majnemer@gmail.com</a>> wrote:<br>
> On Thu, Jul 18, 2013 at 4:40 AM, Jay Foad <<a href="mailto:jay.foad@gmail.com">jay.foad@gmail.com</a>> wrote:<br>
>><br>
>> > + // fold (or (shl x, (*ext y)), (srl x, (*ext (and (sub 32, y),<br>
>> > 31)))) -><br>
>> > + // (rotl x, y)<br>
>> > + // fold (or (shl x, (*ext y)), (srl x, (*ext (and (sub 32, y),<br>
>> > 31)))) -><br>
>> > + // (rotr x, (sub 32, y))<br>
>><br>
>> "and (sub 32, y), 31" should be "and (sub 0, y), 31". There are four<br>
>> occurrences of this in the whole patch.<br>
><br>
><br>
> Sorry about that, the comment is fixed in the attached patch.<br>
><br>
>><br>
>><br>
>> > + if (SUBC->getAPIntValue() == 0 &&<br>
>> > + ANDC->getAPIntValue() == OpSizeInBits - 1 &&<br>
>> > + RExtOp0.getOperand(0).getOperand(1) == LExtOp0)<br>
>><br>
>> Do you need an explicit check that OpSizeInBits is a power of two?<br>
><br>
><br>
> Good catch, we do indeed need such a check, fixed in the attached patch.<br>
<br>
</div></div>I'm not familiar with the DAG combiner, but the logic in your patch now LGTM.<br>
<br>
For further improvements, would it be possible to run the test case on<br>
more targets than just X86?</blockquote><div><br></div><div>AFAIK, it is not really possible to test the more target independent parts of the DAGCombiner.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And could your new transformation also be<br>
applied to the non-sign/zero/any-extend/truncate part of MatchRotate<br>
(i.e. the cases starting at line 3346) ?<br></blockquote><div><br></div><div>I cannot seem to write LLVM IR that would trigger this case.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
Jay.<br>
</font></span></blockquote></div><br></div></div>