summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorReid Barton <rwbarton@gmail.com>2014-08-22 18:57:50 -0400
committerReid Barton <rwbarton@gmail.com>2014-08-23 14:55:57 -0400
commitcfd08a992c91c0a9c629912a5d7234610256121e (patch)
tree958982daff6933b00804d5b703f2a362d7c82acf /compiler/codeGen
parent104a66a461f4f89b8e5ad9c829923bb7ca8ceddb (diff)
downloadhaskell-cfd08a992c91c0a9c629912a5d7234610256121e.tar.gz
Add MO_AddIntC, MO_SubIntC MachOps and implement in X86 backend
Summary: These MachOps are used by addIntC# and subIntC#, which in turn are used in integer-gmp when adding or subtracting small Integers. The following benchmark shows a ~6% speedup after this commit on x86_64 (building GHC with BuildFlavour=perf). {-# LANGUAGE MagicHash #-} import GHC.Exts import Criterion.Main count :: Int -> Integer count (I# n#) = go n# 0 where go :: Int# -> Integer -> Integer go 0# acc = acc go n# acc = go (n# -# 1#) $! acc + 1 main = defaultMain [bgroup "count" [bench "100" $ whnf count 100]] Differential Revision: https://phabricator.haskell.org/D140
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/StgCmmPrim.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index 9e12427355..e6f4e48425 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -806,9 +806,11 @@ callishPrimOpSupported dflags op
WordAdd2Op | ncg && x86ish -> Left (MO_Add2 (wordWidth dflags))
| otherwise -> Right genericWordAdd2Op
- IntAddCOp -> Right genericIntAddCOp
+ IntAddCOp | ncg && x86ish -> Left (MO_AddIntC (wordWidth dflags))
+ | otherwise -> Right genericIntAddCOp
- IntSubCOp -> Right genericIntSubCOp
+ IntSubCOp | ncg && x86ish -> Left (MO_SubIntC (wordWidth dflags))
+ | otherwise -> Right genericIntSubCOp
WordMul2Op | ncg && x86ish -> Left (MO_U_Mul2 (wordWidth dflags))
| otherwise -> Right genericWordMul2Op