<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Well, you'll be pleased to know that I am now back from my
camping and hiking trip in the Lake District and have actually
purchased "Hacker's Delight", and I have to say it's extremely
insightful. I would love to play around and implement some of the
suggested optimisations.</p>
<p>Some of them will require some clever insight and manipulation at
the node level though (e.g. converting "(x mod constant) = 0" into
something that produces fast code unique to checking to see if the
division is exact)... the main problem is seeing through all the
typecasts and the different loads.</p>
<p>Gareth aka. Kit<br>
</p>
<div class="moz-cite-prefix">On 24/08/2021 20:14, Marģers . via
fpc-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1629832449.6125450124779@mail.inbox.lv">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
I came up with even shorter variant of div<br>
example <br>
function teDWordDivBy7_v4( divided : dword):dword; assembler;
nostackframe;<br>
asm<br>
mov ecx,divided<br>
mov rax,2635249153693862181<br>
mul rcx<br>
mov eax,edx<br>
end;<br>
<br>
current version for comparison<br>
<br>
function teDWordDivBy7_v0( divided : dword):dword; assembler;
nostackframe;<br>
asm<br>
mov ecx,divided<br>
mov eax,613566757<br>
mul ecx<br>
add edx,ecx<br>
rcr edx,1<br>
shr edx,2<br>
mov eax,edx<br>
end;<br>
<br>
<blockquote>
<blockquote>
<blockquote>
<div>
<table>
<tbody>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</div>
</blockquote>
</blockquote>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>