<html><head><base href="x-msg://4957/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 24, 2010, at 5:58 PM, Martinez, Javier E wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div lang="EN-US" link="blue" vlink="purple"><div class="WordSection1" style="page: WordSection1; "><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; ">Hello,<o:p></o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; ">A while back I submitted a patch for this function. The patch, added in revision 90482, left the case of a shift by zero undefined. Attached is another patch to deal with that condition.<o:p></o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div></div></div></span></blockquote><br></div><div>Hi Javier,</div><div><br></div><div>This patch seems ok, but it will pessimize all of the existing targets, which produce an undefined result on overflow instead of performing an undefined operation.  Does your target really produce undefined behavior on this condition, or does it just produce an undefined result?</div><div><br></div><div>If you really need to get this in, please add a new TargetLowering hook (along the same lines of getShiftAmountTy() which would return an enum indicating the behavior on overflow.  The legalize code can then use this hook to determine if it needs to generate the extra code.</div><div><br></div><div>Thanks!</div><div><br></div><div>-Chris</div><br></body></html>