<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>The problem is that Free Pascal automatically scales up inputs to
      the word size, usually 32-bits.  If you do a node dump of a
      division node, you'll see that the input will often have a
      typecast node cast upon it.  It is possible to remove it, but it
      would have to be done at a different compiler stage.  I might see
      if it's possible to implement this at a later stage, since I've
      done just that for my latest merge request for "(x mod n) = 0".</p>
    <p>Gareth aka. Kit<br>
    </p>
    <div class="moz-cite-prefix">On 15/09/2021 18:36, Marģers . via
      fpc-devel wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1631727410.61422f32eda23@mail.inbox.lv">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      Hi,<br>
      Thank you for implementation.<br>
      <br>
      Is that true, that you can not detect word and byte size on
      division by constant? Squeezing in 32 bit register it would make
      byte-code shorter, not necessarily faster.<br>
       
      <div class="noTransl">----- Reply to message -----<br>
        <b>Subject: </b>Re: [fpc-devel] The "magic div" algorithm<br>
        <b>From: </b> J. Gareth Moreton via fpc-devel <a
          href="mailto:fpc-devel@lists.freepascal.org"
          moz-do-not-send="true"><fpc-devel@lists.freepascal.org></a><br>
        <b>To: </b> <a href="mailto:fpc-devel@lists.freepascal.org"
          moz-do-not-send="true"><fpc-devel@lists.freepascal.org></a></div>
      <blockquote>This one is for Marģers especially:<br>
        <br>
        <a
          href="https://gitlab.com/freepascal.org/fpc/source/-/issues/39355"
          target="_blank" moz-do-not-send="true">https://gitlab.com/freepascal.org/fpc/source/-/issues/39355</a><br>
        <br>
        Gareth aka. Kit<br>
        <br>
        <br>
         </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>