Wrap `gmpz_fdiv_{q,r,qr}_ui` to optimize `div`/`mod`
authorHerbert Valerio Riedel <hvr@gnu.org>
Mon, 13 Jan 2014 15:13:40 +0000 (16:13 +0100)
committerHerbert Valerio Riedel <hvr@gnu.org>
Mon, 13 Jan 2014 15:13:40 +0000 (16:13 +0100)
commitcbde86278d2090e19e62f0dd22682b4381433658
treee7c08e5a79b9d99779b32e0e86358d88d235a1d2
parent7bdcadda7e884edffb1427f0685493f3a2e5c5fa
Wrap `gmpz_fdiv_{q,r,qr}_ui` to optimize `div`/`mod`

This is similiar to what has been done in [af2ba9c8/integer-gmp] for
`gmpz_tdiv_{q,r,qr}_ui` (re #8647); However, the gain is more modest
here, as performance-conscious code tends to use `quot`/`rem` rather
than `div`/`mod`:

     Program    Size    Allocs   Runtime   Elapsed  TotalMem
 -------------------------------------------------------------
   primetest   +0.3%     -2.4%      0.06      0.06     +0.0%
         rsa   +0.2%     -3.3%      0.02      0.02     +0.0%

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
GHC/Integer/GMP/Prim.hs
GHC/Integer/Type.lhs
cbits/gmp-wrappers.cmm