Very interesting, Gareth !

Is the div-by-7 related to 2 to the 3rd ? If yes, is it possible to design a 
div-by-3 with similar magics ?

Cheers, Ched'



Le 03.09.21 à 15:35, J. Gareth Moreton via fpc-devel a écrit :
Hey Marģers,

So I've been experimenting with your suggestion, and it looks like a resounding success!  I added some new tests to the "bdiv" bench test to see how it performs.  16-bit multiplications don't get improved as well as they could be on x86_64 because the intermediate values are all extended to 32-bit, but you can still see a massive improvement on all the unsigned divisions by 7.

I'm currently running the test suite for i386-win32 and x86_64-win64, then will implement the same system for AArch64. Thanks so much for spotting the improvement.

Gareth aka. Kit

P.S. I still need to work on the signed modulus at some point.


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to