Updated patch attached. No functional change, just nicer whitespace.<div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Dec 8, 2012 at 3:53 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The attached patched takes a sequence like:<div><div> %neg = xor i32 %A, -1</div><div> %shl = shl i32 1, %B</div><div> %and = and i32 %shl, %neg</div>
<div> %cmp = icmp ne i32 %and, 0</div></div><div><br></div><div>and turns it into:</div>

<div><div> %shl = shl i32 1, %B<br></div><div> %and = and i32 %shl, %A</div><div> %cmp = icmp eq i32 %and, 0</div></div><div><br></div><div>The patch includes a test case that exercises this transform.</div><div><br></div>

<div>Examples of frontend code that could generate sequence 1 is:</div><div><br></div><div>bool fun1(unsigned A, unsigned B) { return ~A & (1 << B); }</div><div><br></div><div>An example of sequence 2 is:</div>
<div>
bool fun2(unsigned A, unsigned B) { return !(A & (1 << B)); }<br></div><div><br></div><div>With this patch, they would have the same IR.</div>
</blockquote></div><br></div>