Add Int8# and Word8#
authorMichal Terepeta <michal.terepeta@gmail.com>
Thu, 4 Oct 2018 17:56:59 +0000 (13:56 -0400)
committerBen Gamari <ben@smart-cactus.org>
Sun, 7 Oct 2018 22:36:07 +0000 (18:36 -0400)
commit5d5307f943d7581d7013ffe20af22233273fba06
treeec9ae993cfa44d2cfe797e0422eb388933277100
parente4bec29cb475b7e1431dad41fb8d4438814641c9
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 `MachOP`s.

- For `CmmCall`s 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.

Bumps binary submodule.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate with new tests

Reviewers: hvr, goldfire, bgamari, simonmar

Subscribers: Abhiroop, dfeuer, rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4475
43 files changed:
compiler/cmm/CmmExpr.hs
compiler/cmm/CmmMachOp.hs
compiler/cmm/CmmUtils.hs
compiler/cmm/MkGraph.hs
compiler/cmm/PprC.hs
compiler/codeGen/StgCmmArgRep.hs
compiler/codeGen/StgCmmPrim.hs
compiler/ghci/ByteCodeGen.hs
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
compiler/nativeGen/X86/CodeGen.hs
compiler/nativeGen/X86/Instr.hs
compiler/nativeGen/X86/Ppr.hs
compiler/prelude/PrelNames.hs
compiler/prelude/TysPrim.hs
compiler/prelude/TysWiredIn.hs
compiler/prelude/TysWiredIn.hs-boot
compiler/prelude/primops.txt.pp
compiler/simplStg/RepType.hs
compiler/typecheck/TcGenDeriv.hs
compiler/types/TyCon.hs
compiler/utils/Binary.hs
libraries/base/Data/Typeable/Internal.hs
libraries/binary
libraries/ghc-prim/GHC/Types.hs
testsuite/tests/ffi/should_run/PrimFFIInt8.hs [new file with mode: 0644]
testsuite/tests/ffi/should_run/PrimFFIInt8.stdout [new file with mode: 0644]
testsuite/tests/ffi/should_run/PrimFFIInt8_c.c [new file with mode: 0644]
testsuite/tests/ffi/should_run/PrimFFIWord8.hs [new file with mode: 0644]
testsuite/tests/ffi/should_run/PrimFFIWord8.stdout [new file with mode: 0644]
testsuite/tests/ffi/should_run/PrimFFIWord8_c.c [new file with mode: 0644]
testsuite/tests/ffi/should_run/all.T
testsuite/tests/primops/should_run/ArithInt8.hs [new file with mode: 0644]
testsuite/tests/primops/should_run/ArithInt8.stdout [new file with mode: 0644]
testsuite/tests/primops/should_run/ArithWord8.hs [new file with mode: 0644]
testsuite/tests/primops/should_run/ArithWord8.stdout [new file with mode: 0644]
testsuite/tests/primops/should_run/CmpInt8.hs [new file with mode: 0644]
testsuite/tests/primops/should_run/CmpInt8.stdout [new file with mode: 0644]
testsuite/tests/primops/should_run/CmpWord8.hs [new file with mode: 0644]
testsuite/tests/primops/should_run/CmpWord8.stdout [new file with mode: 0644]
testsuite/tests/primops/should_run/ShowPrim.hs [new file with mode: 0644]
testsuite/tests/primops/should_run/ShowPrim.stdout [new file with mode: 0644]
testsuite/tests/primops/should_run/all.T
utils/genprimopcode/Main.hs