Support MO_{Add,Sub}IntC and MO_Add2 in the LLVM backend
authorMichal Terepeta <michal.terepeta@gmail.com>
Sat, 4 Jul 2015 10:52:02 +0000 (12:52 +0200)
committerBen Gamari <ben@smart-cactus.org>
Sat, 4 Jul 2015 10:52:03 +0000 (12:52 +0200)
commitb1d1c652908ecd7bfcf13cf2e5dd06ac7926992c
tree376136663cd16de698e4c957b2da6ffb11381985
parent69beef56a4c020d08e1b0243d4c1a629f972e019
Support MO_{Add,Sub}IntC and MO_Add2 in the LLVM backend

This includes:

- Adding new LlvmType called LMStructP that represents an unpacked
  struct (this is necessary since LLVM's instructions the
  llvm.sadd.with.overflow.* return an unpacked struct).

- Modifications to LlvmCodeGen.CodeGen to generate the LLVM
  instructions for the primops.

- Modifications to StgCmmPrim to actually use those three instructions
  if we use the LLVM backend (so far they were only used for NCG).

Test Plan: validate

Reviewers: austin, rwbarton, bgamari

Reviewed By: bgamari

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D991

GHC Trac Issues: #9430
compiler/codeGen/StgCmmPrim.hs
compiler/llvmGen/Llvm/AbsSyn.hs
compiler/llvmGen/Llvm/PpLlvm.hs
compiler/llvmGen/Llvm/Types.hs
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
testsuite/tests/primops/should_run/T9430.hs [new file with mode: 0644]
testsuite/tests/primops/should_run/all.T