<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hao,</div><div>Seems like a reasonable change, but perhaps John could comment on why he chose to force a minimum precision of 32.</div><div><br></div><div>Also, please add a test case before committing.</div><div><br></div><div> Chad</div><br><div><div>On Mar 19, 2013, at 2:43 AM, Hao Liu <<a href="mailto:Hao.Liu@arm.com">Hao.Liu@arm.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div lang="ZH-CN" link="blue" vlink="purple" style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US">Hi,<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US"> </span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US">Please consider patch in attachment as fix for PR15318: AsmPrinter crashes with assertion.<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US"><a href="http://llvm.org/bugs/show_bug.cgi?id=15318" style="color: purple; text-decoration: underline;">http://llvm.org/bugs/show_bug.cgi?id=15318</a><o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US"> </span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US">APFloat::toString tries to print floating point in decimal string. It calculates the precision and padding of the output format. At the end of the AdjustPrecision function, it truncates the significand down to its active bit count but always keeps it never drop below 32 bits.<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US"> </span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US">BitWidth of significand is larger than active bits, but it is not always larger than 32. E.g. when the 64bit value 0x41EFFFFFE0000000 is read and called toString(), the BitWidth of significand is smaller than 32. Then truncating the significand to 32 will cause an assertion failure (it always assert width < BitWidth).<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US"> </span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US">The fix is very simple, just remove the “don’t try to drop below 32” operation. Always truncate it to the active bits.<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US"> </span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US">I just find it’s no need to keep significand above 32. The AdjustPrecision function does useless thing, which causes the assertion failure.<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US"> </span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US"> </span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US">Thanks,<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US">-Hao<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: Calibri, sans-serif;"><span lang="EN-US"> </span></div></div><span><APFloat.patch></span>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu" style="color: purple; text-decoration: underline;">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" style="color: purple; text-decoration: underline;">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div><br></body></html>