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".
Gareth aka. Kit
On 15/09/2021 18:36, Marģers . via fpc-devel wrote:
Hi,
Thank you for implementation.
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.
----- Reply to message -----
*Subject: *Re: [fpc-devel] The "magic div" algorithm
*From: * J. Gareth Moreton via fpc-devel
<fpc-devel@lists.freepascal.org> <mailto:fpc-devel@lists.freepascal.org>
*To: * <fpc-devel@lists.freepascal.org>
<mailto:fpc-devel@lists.freepascal.org>
This one is for Marģers especially:
https://gitlab.com/freepascal.org/fpc/source/-/issues/39355
<https://gitlab.com/freepascal.org/fpc/source/-/issues/39355>
Gareth aka. Kit
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel