[commit: ghc] master: [LlvmCodeGen] Fixes for Int8#/Word8# (f424515)
git at git.haskell.org
git at git.haskell.org
Wed Nov 7 13:10:21 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f424515fd8cbc2b7380cdf8427f972d062940bd5/ghc
>---------------------------------------------------------------
commit f424515fd8cbc2b7380cdf8427f972d062940bd5
Author: Michal Terepeta <michal.terepeta at gmail.com>
Date: Wed Nov 7 08:03:16 2018 -0500
[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 at 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
>---------------------------------------------------------------
f424515fd8cbc2b7380cdf8427f972d062940bd5
compiler/codeGen/StgCmmPrim.hs | 6 +++---
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 9da472e..75d46b5 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 efc8709..d24075e 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
More information about the ghc-commits
mailing list