Hi everyone,
Before I go optimising the wrong thing, I have a question to ask.
What's the policy on platform-specific assembly language in the
compiler, or any code designed to run on a specific (source) platform
(and using a more generic implementation otherwise via $ifdef)? I ask
because I have a faster algorithm for "calc_divconst_magic_unsigned" in
'compiler/cgutils.pas', but it's only able to work because it can take
advantage of the x86 DIV instruction using RDX:RAX (or EDX:EAX) as a
double-wide dividend. It is somewhat faster than what currently exists
because of the lack of a loop whose iteration count is proportional to
log2(d), where d is the desired divisor (in other words, it's slower the
bigger the divisor is, whereas my algorithm is constant speed).
Speaking of "calc_divconst_magic_unsigned", exactly what is the function
doing? I'm guessing it's something akin to Newton-Raphson division, but
there's no comments on documentation explaining which algorithm is being
used (although I can appreciate what "magic_add" is just from my own
experiences). On a related note, its partner function,
"calc_divconst_magic_signed", uses 'assert' rather than an internal
error, which is a bit against the code guidelines, right?
Gareth aka. Kit
--
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