Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
math/big: avoid DIVQ #9246
Suggested by Torbjörn Granlund (personal communication):
The DIVQ instruction is terrible. Don't ever use it. You might
(paper reference: https://gmplib.org/~tege/division-paper.pdf)
Ok, good to know. Note that Torbjörn's paper suggests that even for a non-constant divisor, division via mutiplication by inverse is faster:
"Somewhat surprisingly, a well-tuned Newton reciprocal followed by multiplication and adjustments wins over the hardware division instructions even for a single non-invariant division on modern 64-bit PC processors."