<div dir="ltr">Note that there is a slight difficulty due to the fact that we "sink" the trunc:<div><br></div><div>(zext i16 {0,+,1}<%bb> to i32) + (65536 * ({0,+,1}<nuw><%bb> /u 65536)</div><div><br></div><div>Here the recurrence lost it's <nuw> and got reduced to a i16 (on the left), but not on the right.</div><div><br></div><div>But we can prove:<br>- that (zext i16 {0,+,1}<%bb> to i32) has the same 16 LSB than (i32 {0,+,1}<nuw><%bb>)<br>- that (65536 * ({0,+,1}<nuw><%bb> /u 65536) has the same 16 MSB than (i32 {0,+,1}<nuw><%bb>)</div><div>And therefore conclude that we can simplify it to (i32 {0,+,1}<nuw><%bb>).</div><div><br></div><div>The difficulty is to come up with the (i32 {0,+,1}<nuw><%bb>) in the first place.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 11, 2017 at 5:57 PM, Alexandre Isoard <span dir="ltr"><<a href="mailto:alexandre.isoard@gmail.com" target="_blank">alexandre.isoard@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello again,<div><br></div><div>On that subject, I have the following SCEV:</div><div><br></div><div><span style="font-size:12.8px">(zext i16 (trunc i32 %a to i16) to i32) + </span><span style="font-size:12.8px">((%a /u 65536) *u 65536)</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">That I would like to normalize into:</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">%a</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I am not sure where is the most natural spot in which to do that?</span></div><div><span style="font-size:12.8px">Also, this pattern is much more general. The idea is that I want to coalesce bit ranges that have been extracted and put back together.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Should I detect patterns, or look for a more generic strategy? Do you have input on that?</span></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Tue, Jul 25, 2017 at 9:21 PM, Alexandre Isoard <span dir="ltr"><<a href="mailto:alexandre.isoard@gmail.com" target="_blank">alexandre.isoard@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I assumed SCEV purpose was to be a normal form, but then I wondered which one of those is the normal form:</div><div><br></div><div>(zext i16 (trunc i32 %a to i16) to i32)</div><div><br></div><div>vs</div><div><br>(-((%a /u 65536) *u 65536) + %a)</div><div><br></div><div><br></div><div>The first one is nice for interval analysis, and known bit analysis.</div><div>The second one is nice when plugged into gep of 2d arrays.</div><span class="m_6656910692308029064HOEnZb"><font color="#888888"><div><div><br></div>-- <br><div class="m_6656910692308029064m_-1886481468319790301gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b>Alexandre Isoard</b><br></div></div>
</div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div class="m_6656910692308029064gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b>Alexandre Isoard</b><br></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b>Alexandre Isoard</b><br></div></div>
</div>