diff options
author | Reid Barton <rwbarton@gmail.com> | 2014-08-22 18:57:50 -0400 |
---|---|---|
committer | Reid Barton <rwbarton@gmail.com> | 2014-08-23 14:55:57 -0400 |
commit | cfd08a992c91c0a9c629912a5d7234610256121e (patch) | |
tree | 958982daff6933b00804d5b703f2a362d7c82acf /compiler/nativeGen/X86/Instr.hs | |
parent | 104a66a461f4f89b8e5ad9c829923bb7ca8ceddb (diff) | |
download | haskell-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/nativeGen/X86/Instr.hs')
-rw-r--r-- | compiler/nativeGen/X86/Instr.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/nativeGen/X86/Instr.hs b/compiler/nativeGen/X86/Instr.hs index ef0ceeabf3..a43d42ec2a 100644 --- a/compiler/nativeGen/X86/Instr.hs +++ b/compiler/nativeGen/X86/Instr.hs @@ -210,6 +210,7 @@ data Instr -- Do not rewrite these instructions to "equivalent" ones that -- have different effect on the condition register! (See #9013.) | ADD_CC Size Operand Operand + | SUB_CC Size Operand Operand -- Simple bit-twiddling. | AND Size Operand Operand @@ -371,6 +372,7 @@ x86_regUsageOfInstr platform instr DIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx] IDIV _ op -> mkRU (eax:edx:use_R op []) [eax,edx] ADD_CC _ src dst -> usageRM src dst + SUB_CC _ src dst -> usageRM src dst AND _ src dst -> usageRM src dst OR _ src dst -> usageRM src dst @@ -548,6 +550,7 @@ x86_patchRegsOfInstr instr env IDIV sz op -> patch1 (IDIV sz) op DIV sz op -> patch1 (DIV sz) op ADD_CC sz src dst -> patch2 (ADD_CC sz) src dst + SUB_CC sz src dst -> patch2 (SUB_CC sz) src dst AND sz src dst -> patch2 (AND sz) src dst OR sz src dst -> patch2 (OR sz) src dst XOR sz src dst -> patch2 (XOR sz) src dst |