diff options
author | Michal Terepeta <michal.terepeta@gmail.com> | 2018-11-02 14:27:03 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-11-02 17:15:01 -0400 |
commit | 2c959a1894311e59cd2fd469c1967491c1e488f3 (patch) | |
tree | dc396ec23115f4b6a10b8295bfa94b865ff02efb /compiler/utils/Binary.hs | |
parent | 6bb8aaa3b4fcebf8f0de2f81f00dcc20b857c4f5 (diff) | |
download | haskell-2c959a1894311e59cd2fd469c1967491c1e488f3.tar.gz |
Add Int8# and Word8#
This is the first step of implementing:
https://github.com/ghc-proposals/ghc-proposals/pull/74
The main highlights/changes:
primops.txt.pp gets two new sections for two new primitive types for
signed and unsigned 8-bit integers (Int8# and Word8 respectively) along
with basic arithmetic and comparison operations. PrimRep/RuntimeRep get
two new constructors for them. All of the primops translate into the
existing MachOPs.
For CmmCalls the codegen will now zero-extend the values at call
site (so that they can be moved to the right register) and then truncate
them back their original width.
x86 native codegen needed some updates, since it wasn't able to deal
with the new widths, but all the changes are quite localized. LLVM
backend seems to just work.
This is the second attempt at merging this, after the first attempt in
D4475 had to be backed out due to regressions on i386.
Bumps binary submodule.
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate (on both x86-{32,64})
Reviewers: bgamari, hvr, goldfire, simonmar
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5258
Diffstat (limited to 'compiler/utils/Binary.hs')
-rw-r--r-- | compiler/utils/Binary.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 447317ca47..a38af74efe 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -637,6 +637,10 @@ instance Binary RuntimeRep where put_ bh AddrRep = putByte bh 9 put_ bh FloatRep = putByte bh 10 put_ bh DoubleRep = putByte bh 11 +#if __GLASGOW_HASKELL__ >= 807 + put_ bh Int8Rep = putByte bh 12 + put_ bh Word8Rep = putByte bh 13 +#endif get bh = do tag <- getByte bh @@ -653,6 +657,10 @@ instance Binary RuntimeRep where 9 -> pure AddrRep 10 -> pure FloatRep 11 -> pure DoubleRep +#if __GLASGOW_HASKELL__ >= 807 + 12 -> pure Int8Rep + 13 -> pure Word8Rep +#endif _ -> fail "Binary.putRuntimeRep: invalid tag" instance Binary KindRep where |