<div dir="ltr"><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><p>I updated my patch with the test cases. Can you please check if this is correct? </p>
<p>If it looks good to you, can you please commit it on my behalf?</p>
<p> </p>
<p>My patch also handles the case, where <span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"><span> one of the operand </span>has only 1 bit that is not known to</span></p>
<div class=""><br style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;color:rgb(34,34,34);word-spacing:0px;background-color:rgb(255,255,255)">
<span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)">be zero, but it is also not know to be one.</span></div>
<p></p>
<p><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)">((~RHSKnownZero).countpopulation == 1) will be able to determine if only one of the bit is unkown (it may be 1 or 0).</span></p>

<p><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"></span> </p>

<p><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)">As far as the test case :</span></p>
<div class="">
<p><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"><em></em></span></span> </p>

<p><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"><em>define i32 @foo(i32 %x, i32 %y) {</em></span><em><br style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;color:rgb(34,34,34);word-spacing:0px;background-color:rgb(255,255,255)">
</em><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"><em>  %v1 = and i32 %y, 1</em></span><em><br style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;color:rgb(34,34,34);word-spacing:0px;background-color:rgb(255,255,255)">
</em><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"><em>  %v2 = add i32 %x, %v1</em></span><em><br style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;color:rgb(34,34,34);word-spacing:0px;background-color:rgb(255,255,255)">
</em><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"><em>  ret i32 %v2</em></span><em><br style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;color:rgb(34,34,34);word-spacing:0px;background-color:rgb(255,255,255)">
</em><span style="text-transform:none;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;font-size:13px;line-height:normal;font-family:arial,sans-serif;white-space:normal;float:none;color:rgb(34,34,34);word-spacing:0px;display:inline!important;background-color:rgb(255,255,255)"><em>}</em></span></span></p>

<p> </p>
</div><p>We know that only one of the bit is unknown of one of the operand, it may be 1 or 0.</p>
<p>But for the other operand, we do not know if it has 0 at any higher bit position. Hence we do not add 'nsw' in this case.</p>
<p> </p>
<p>Added this test case as well + test case to handle sext  i1(bitwidth = 1).</p>
<p> </p>
<p>Awaiting for your review.</p>
<p></p></div></blockquote><div><br></div><div>The check for a bitwidth of one seems redundant. The updated computation of Op1OnePosition handles that case too, no?</div><div><br></div><div>It looks like the tests can be simplified a bit further. They are still using numbered instead of named instructions for example. </div>
<div><br></div><div>Please make sure the positive tests are cases that currently fail, so they demonstrate the new optimization capabilities. For example, we already add a nsw to  @ripple_nsw because of the current logic for handling both operands having more than one sign bit.</div>
<div><br></div><div>Cheers,</div><div>Rafael</div><div><br></div><div><br></div></div></div></div>