Add new `mpz_{sub,add}_ui`-based primop (re #8647)
authorHerbert Valerio Riedel <hvr@gnu.org>
Fri, 3 Jan 2014 21:36:04 +0000 (22:36 +0100)
committerHerbert Valerio Riedel <hvr@gnu.org>
Sat, 4 Jan 2014 21:41:34 +0000 (22:41 +0100)
commit8bf9541912c30ffb740d6ab67edcadcfbe4fc80b
tree4d73d98364f00992ccfe4f89786b6339e19f24f3
parentbaeeef7af6e37441d1fa28f4197a8cb878a9ef0b
Add new `mpz_{sub,add}_ui`-based primop (re #8647)

This adds `{plus,minus}IntegerInt#` which help to reduce temporary
allocations in `plusInteger` and `minusInteger`.

This and the previous commit introducing `timesIntegerInt#` (i.e. baeeef7af6e)
result in reduced allocations for the following nofib benchmarks on Linux/amd64:

         Program      Size    Allocs   Runtime   Elapsed  TotalMem
  ------------------------------------------------------------------
      bernouilli     +0.0%     -4.2%      0.12      0.12     +0.0%
           kahan     +0.1%    -12.6%      0.17      0.17     +0.0%
        pidigits     +0.0%     -0.5%     -4.7%     -4.5%     +0.0%
           power     +0.0%     -2.7%     +3.1%     +3.1%     +9.1%
       primetest     +0.0%     -4.2%      0.07      0.07     +0.0%
             rsa     +0.0%     -4.1%      0.02      0.02     +0.0%
             scs     +0.0%     -2.6%     -0.8%     -0.7%     +0.0%
  ------------------------------------------------------------------
             Min     +0.0%    -12.6%     -4.7%     -4.5%     -5.0%
             Max     +0.1%     +0.2%     +3.1%     +3.1%     +9.1%
  Geometric Mean     +0.1%     -0.3%     -0.0%     +0.0%     +0.1%
  ------------------------------------------------------------------

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