<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; 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>-Kuba</div></span>
</div>
<br><div><div>On Jul 27, 2011, at 10:46 AM, Benjamin Kramer wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Wed, Jul 27, 2011 at 09:50, Chris Lattner <<a href="mailto:clattner@apple.com">clattner@apple.com</a>> wrote:<br><blockquote type="cite"><br></blockquote><blockquote type="cite">On Jul 27, 2011, at 9:00 AM, Jakub Staszak wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Author: kuba<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Date: Wed Jul 27 11:00:40 2011<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">New Revision: 136222<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=136222&view=rev">http://llvm.org/viewvc/llvm-project?rev=136222&view=rev</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Log:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Optimize 96-bit division a little bit.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">How about:<br></blockquote><blockquote type="cite"> if (top_part1 == 0 && top_part2 == 0)<br></blockquote><blockquote type="cite">   return low1/low2;<br></blockquote><blockquote type="cite"> .. slow path..<br></blockquote><br>It looks like the code already checks that and only uses 96 bit<br>arithmetic if it's really necessary. However, there's a lot of<br>optimization potential in the 96 bit division algorithm. As the bit<br>widths are known it should be possible to do it with a bunch of 64 bit<br>divs+mods.<br><br>Trying to optimize it without unit tests is dangerous though …<br><br>- Ben<br></div></blockquote></div><br><div>I'm working on unit tests right now. Actually I have them, I'm just copying them to unittests/Support/.  I will also try to optimize the algorithm, but it is not so easy (for me) as I thought at the beginning. I had an algorithm with "bunch of 64 bit divs+mods" and it was slower than the one we have here.</div><div><br></div><div>- Kuba</div></body></html>