<div dir="ltr">On Wed, May 8, 2013 at 8:54 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<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>>><br>
>> Is the select case really redundant now?<br>
><br>
> Yes, llvm::isKnownToBeAPowerOfTwo has support for select instructions. The<br>
> function 'test4' in rem.ll provides verification that we still handle select<br>
> instructions.<br>
<br>
</div>OK. We will now convert<br>
<br>
urem X, (select Cond, 2^C1, 2^C2)<br>
<br>
to<br>
<br>
X and ((select Cond, 2^C1, 2^C2) - 1)<br>
<br>
Instead of creating the two ands. I guess that is fine.</blockquote><div><br></div><div>InstCombiner::visitSelectInst will actually turn</div><div><br></div><div>(select Cond, X and 2^C1 - 1, 2^C2- 1)</div><div><br></div>

<div>to<br></div><div><br></div><div>X and (select Cond 2^C1 - 1, 2^C2- 1) so it works out the same in the end for that case.<br></div><div><br></div><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">

Having the<br>
test uses filecehck should make this change explicit to anyone reading<br>
the patch.<br></blockquote><div><br></div><div style>An updated patch is attached.</div><div> </div><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">

<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div></div>