diff options
author | Peter Trommler <ptrommler@acm.org> | 2018-12-11 13:22:00 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-12-11 14:23:22 -0500 |
commit | 9e7d58c894571f3c114c4f793b52f9d17c4c57fe (patch) | |
tree | fa41d76acb7242a1b975dfd054dc7b6d4387ffc9 /compiler/codeGen | |
parent | da05d79d03e5e03e391b381f23c46fc02957abf7 (diff) | |
download | haskell-9e7d58c894571f3c114c4f793b52f9d17c4c57fe.tar.gz |
PPC NCG: Generate MO_?_QuotRem for subword sizes
Handle Int*QuotRemOP and Word*QuotRemOp in PPC NCG.
Refactor common code with remainder operation.
Test Plan: validate (I validated on Linux powerpc64le and x86_64)
Reviewers: erikd, hvr, bgamari, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5323
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/StgCmmPrim.hs | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs index 015eeced05..a6f3395425 100644 --- a/compiler/codeGen/StgCmmPrim.hs +++ b/compiler/codeGen/StgCmmPrim.hs @@ -880,11 +880,11 @@ callishPrimOpSupported dflags op | otherwise -> Right (genericIntQuotRemOp (wordWidth dflags)) - Int8QuotRemOp | (ncg && x86ish) + Int8QuotRemOp | ncg && (x86ish || ppc) -> Left (MO_S_QuotRem W8) | otherwise -> Right (genericIntQuotRemOp W8) - Int16QuotRemOp | (ncg && x86ish) + Int16QuotRemOp | ncg && (x86ish || ppc) -> Left (MO_S_QuotRem W16) | otherwise -> Right (genericIntQuotRemOp W16) @@ -894,54 +894,45 @@ callishPrimOpSupported dflags op | otherwise -> Right (genericWordQuotRemOp (wordWidth dflags)) - WordQuotRem2Op | (ncg && (x86ish - || ppc)) + WordQuotRem2Op | (ncg && (x86ish || ppc)) || llvm -> Left (MO_U_QuotRem2 (wordWidth dflags)) | otherwise -> Right (genericWordQuotRem2Op dflags) - Word8QuotRemOp | (ncg && x86ish) + Word8QuotRemOp | ncg && (x86ish || ppc) -> Left (MO_U_QuotRem W8) | otherwise -> Right (genericWordQuotRemOp W8) - Word16QuotRemOp| (ncg && x86ish) + Word16QuotRemOp| ncg && (x86ish || ppc) -> Left (MO_U_QuotRem W16) | otherwise -> Right (genericWordQuotRemOp W16) - WordAdd2Op | (ncg && (x86ish - || ppc)) + WordAdd2Op | (ncg && (x86ish || ppc)) || llvm -> Left (MO_Add2 (wordWidth dflags)) | otherwise -> Right genericWordAdd2Op - WordAddCOp | (ncg && (x86ish - || ppc)) + WordAddCOp | (ncg && (x86ish || ppc)) || llvm -> Left (MO_AddWordC (wordWidth dflags)) | otherwise -> Right genericWordAddCOp - WordSubCOp | (ncg && (x86ish - || ppc)) + WordSubCOp | (ncg && (x86ish || ppc)) || llvm -> Left (MO_SubWordC (wordWidth dflags)) | otherwise -> Right genericWordSubCOp - IntAddCOp | (ncg && (x86ish - || ppc)) + IntAddCOp | (ncg && (x86ish || ppc)) || llvm -> Left (MO_AddIntC (wordWidth dflags)) | otherwise -> Right genericIntAddCOp - IntSubCOp | (ncg && (x86ish - || ppc)) + IntSubCOp | (ncg && (x86ish || ppc)) || llvm -> Left (MO_SubIntC (wordWidth dflags)) | otherwise -> Right genericIntSubCOp - WordMul2Op | ncg && (x86ish - || ppc) + WordMul2Op | ncg && (x86ish || ppc) || llvm -> Left (MO_U_Mul2 (wordWidth dflags)) | otherwise -> Right genericWordMul2Op - FloatFabsOp | (ncg && x86ish - || ppc) + FloatFabsOp | (ncg && x86ish || ppc) || llvm -> Left MO_F32_Fabs | otherwise -> Right $ genericFabsOp W32 - DoubleFabsOp | (ncg && x86ish - || ppc) + DoubleFabsOp | (ncg && x86ish || ppc) || llvm -> Left MO_F64_Fabs | otherwise -> Right $ genericFabsOp W64 |