diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-07-07 18:47:25 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-07-15 23:29:09 -0400 |
commit | 41d6cfc4d36ba93d82f16f9a83ea69f4e02c3810 (patch) | |
tree | 067308ecd598d42523238a96ac400a40edbe9f28 /compiler/GHC/Builtin/primops.txt.pp | |
parent | de98a0ce8f184c9653477ee41602f999c7a381e1 (diff) | |
download | haskell-41d6cfc4d36ba93d82f16f9a83ea69f4e02c3810.tar.gz |
Add Word64#/Int64# primops
Word64#/Int64# are only used on 32-bit architectures. Before this patch,
operations on these types were directly using the FFI. Now we use real
primops that are then lowered into ccalls.
The advantage of doing this is that we can now perform constant folding on
Word64#/Int64# (#19024).
Most of this work was done by John Ericson in !3658. However this patch
doesn't go as far as e.g. changing Word64 to always be using Word64#.
Noticeable performance improvements
T9203(normal) run/alloc 89870808.0 66662456.0 -25.8% GOOD
haddock.Cabal(normal) run/alloc 14215777340.8 12780374172.0 -10.1% GOOD
haddock.base(normal) run/alloc 15420020877.6 13643834480.0 -11.5% GOOD
Metric Decrease:
T9203
haddock.Cabal
haddock.base
Diffstat (limited to 'compiler/GHC/Builtin/primops.txt.pp')
-rw-r--r-- | compiler/GHC/Builtin/primops.txt.pp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/compiler/GHC/Builtin/primops.txt.pp b/compiler/GHC/Builtin/primops.txt.pp index 2512612b5b..25e673b192 100644 --- a/compiler/GHC/Builtin/primops.txt.pp +++ b/compiler/GHC/Builtin/primops.txt.pp @@ -601,6 +601,43 @@ section "Int64#" primtype Int64# +primop Int64ToIntOp "int64ToInt#" GenPrimOp Int64# -> Int# +primop IntToInt64Op "intToInt64#" GenPrimOp Int# -> Int64# + +primop Int64NegOp "negateInt64#" GenPrimOp Int64# -> Int64# + +primop Int64AddOp "plusInt64#" GenPrimOp Int64# -> Int64# -> Int64# + with + commutable = True + +primop Int64SubOp "subInt64#" GenPrimOp Int64# -> Int64# -> Int64# + +primop Int64MulOp "timesInt64#" GenPrimOp Int64# -> Int64# -> Int64# + with + commutable = True + +primop Int64QuotOp "quotInt64#" GenPrimOp Int64# -> Int64# -> Int64# + with + can_fail = True + +primop Int64RemOp "remInt64#" GenPrimOp Int64# -> Int64# -> Int64# + with + can_fail = True + +primop Int64SllOp "uncheckedIShiftL64#" GenPrimOp Int64# -> Int# -> Int64# +primop Int64SraOp "uncheckedIShiftRA64#" GenPrimOp Int64# -> Int# -> Int64# +primop Int64SrlOp "uncheckedIShiftRL64#" GenPrimOp Int64# -> Int# -> Int64# + +primop Int64ToWord64Op "int64ToWord64#" GenPrimOp Int64# -> Word64# + with code_size = 0 + +primop Int64EqOp "eqInt64#" Compare Int64# -> Int64# -> Int# +primop Int64GeOp "geInt64#" Compare Int64# -> Int64# -> Int# +primop Int64GtOp "gtInt64#" Compare Int64# -> Int64# -> Int# +primop Int64LeOp "leInt64#" Compare Int64# -> Int64# -> Int# +primop Int64LtOp "ltInt64#" Compare Int64# -> Int64# -> Int# +primop Int64NeOp "neInt64#" Compare Int64# -> Int64# -> Int# + ------------------------------------------------------------------------ section "Word64#" {Operations on 64-bit unsigned words. This type is only used @@ -610,6 +647,51 @@ section "Word64#" primtype Word64# +primop Word64ToWordOp "word64ToWord#" GenPrimOp Word64# -> Word# +primop WordToWord64Op "wordToWord64#" GenPrimOp Word# -> Word64# + +primop Word64AddOp "plusWord64#" GenPrimOp Word64# -> Word64# -> Word64# + with + commutable = True + +primop Word64SubOp "subWord64#" GenPrimOp Word64# -> Word64# -> Word64# + +primop Word64MulOp "timesWord64#" GenPrimOp Word64# -> Word64# -> Word64# + with + commutable = True + +primop Word64QuotOp "quotWord64#" GenPrimOp Word64# -> Word64# -> Word64# + with + can_fail = True + +primop Word64RemOp "remWord64#" GenPrimOp Word64# -> Word64# -> Word64# + with + can_fail = True + +primop Word64AndOp "and64#" GenPrimOp Word64# -> Word64# -> Word64# + with commutable = True + +primop Word64OrOp "or64#" GenPrimOp Word64# -> Word64# -> Word64# + with commutable = True + +primop Word64XorOp "xor64#" GenPrimOp Word64# -> Word64# -> Word64# + with commutable = True + +primop Word64NotOp "not64#" GenPrimOp Word64# -> Word64# + +primop Word64SllOp "uncheckedShiftL64#" GenPrimOp Word64# -> Int# -> Word64# +primop Word64SrlOp "uncheckedShiftRL64#" GenPrimOp Word64# -> Int# -> Word64# + +primop Word64ToInt64Op "word64ToInt64#" GenPrimOp Word64# -> Int64# + with code_size = 0 + +primop Word64EqOp "eqWord64#" Compare Word64# -> Word64# -> Int# +primop Word64GeOp "geWord64#" Compare Word64# -> Word64# -> Int# +primop Word64GtOp "gtWord64#" Compare Word64# -> Word64# -> Int# +primop Word64LeOp "leWord64#" Compare Word64# -> Word64# -> Int# +primop Word64LtOp "ltWord64#" Compare Word64# -> Word64# -> Int# +primop Word64NeOp "neWord64#" Compare Word64# -> Word64# -> Int# + #endif ------------------------------------------------------------------------ |