diff options
author | Michal Terepeta <michal.terepeta@gmail.com> | 2018-11-07 08:03:16 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-11-07 08:09:40 -0500 |
commit | f424515fd8cbc2b7380cdf8427f972d062940bd5 (patch) | |
tree | 858b1de592ee06c335a8e5572d7b87f7fb447910 | |
parent | 406978c478e4b14e677f396499420d7b8e5d21fd (diff) | |
download | haskell-f424515fd8cbc2b7380cdf8427f972d062940bd5.tar.gz |
[LlvmCodeGen] Fixes for Int8#/Word8#
This fixes two isssues:
- Using bitcast for MO_XX_Conv
Arguments to a bitcast must be of the same size. We should be using
`trunc` and `zext` instead.
- Using unsupported MO_*_QuotRem for LLVM
The two primops `MO_*_QuotRem` are not supported by the LLVM backend,
so
we shouldn't use them for `Int8#`/`Word8#` (just as we do not use
them for
`Int#`/`Word#`).
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: manually run tests with WAY=llvm
Reviewers: bgamari, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, carter
GHC Trac Issues: #15864
Differential Revision: https://phabricator.haskell.org/D5304
-rw-r--r-- | compiler/codeGen/StgCmmPrim.hs | 6 | ||||
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs index 9da472e768..75d46b5b3a 100644 --- a/compiler/codeGen/StgCmmPrim.hs +++ b/compiler/codeGen/StgCmmPrim.hs @@ -881,7 +881,7 @@ callishPrimOpSupported dflags op Right (genericIntQuotRemOp (wordWidth dflags)) Int8QuotRemOp | (ncg && x86ish) - || llvm -> Left (MO_S_QuotRem W8) + -> Left (MO_S_QuotRem W8) | otherwise -> Right (genericIntQuotRemOp W8) WordQuotRemOp | ncg && (x86ish || ppc) -> @@ -895,8 +895,8 @@ callishPrimOpSupported dflags op | otherwise -> Right (genericWordQuotRem2Op dflags) Word8QuotRemOp | (ncg && x86ish) - || llvm -> Left (MO_U_QuotRem W8) - | otherwise -> Right (genericWordQuotRemOp W8) + -> Left (MO_U_QuotRem W8) + | otherwise -> Right (genericWordQuotRemOp W8) WordAdd2Op | (ncg && (x86ish || ppc)) diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs index efc870993c..d24075ec7c 100644 --- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs @@ -1194,7 +1194,7 @@ genMachOp _ op [x] = case op of -> sameConv from (widthToLlvmInt to) LM_Trunc LM_Zext MO_XX_Conv from to - -> sameConv from (widthToLlvmInt to) LM_Bitcast LM_Bitcast + -> sameConv from (widthToLlvmInt to) LM_Trunc LM_Zext MO_FF_Conv from to -> sameConv from (widthToLlvmFloat to) LM_Fptrunc LM_Fpext |