<div dir="ltr"><div>There is a difference in the backend, whether the overflow flag should be thrown or not. We would like to produce a signed arithmetic left shift for an int that is signed in C (ie signed int). </div><div><br></div><div>for example, a small test case:</div><div><br></div><div>signed x = -2;</div><div>unsigned y =1;</div><div><br></div><div>int foo() {</div><div>   x = x << y;</div><div>   return x;</div><div>}</div><div><br></div><div>Thank you.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 19, 2014 at 1:52 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.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">What is the difference between logical and arithmetic left shift on your target? LLVM only makes that distinction for right shift, and not for left shift.</div><div class="gmail_extra"><br><div class="gmail_quote"><span>On Wed, Nov 19, 2014 at 10:32 AM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><span><div dir="ltr"><div>I'm curious why there is not always a nsw/nuw flag with shl instruction? For example, I have a signed int I'm shifting left (want to generate an arithmetic left shift in backend for signed int shift lefts and logical for unsigned, at the moment).... but shl on a signed int does not always have nsw/nuw flag present, why is this?</div><div><br></div><div>Thank you.</div></div>
<br></span>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>