summaryrefslogtreecommitdiff
path: root/compiler/llvmGen
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-02-14 21:26:18 +0000
committerIan Lynagh <igloo@earth.li>2012-02-14 23:08:26 +0000
commit7bfb7bfc6da981ef827b1a166c8cbfb5b29a25a4 (patch)
tree64f62969824858ce141d89bc52ffc7e71ed236f9 /compiler/llvmGen
parent8c0196b48d043fe16eb5b2d343f5544b7fdd5004 (diff)
downloadhaskell-7bfb7bfc6da981ef827b1a166c8cbfb5b29a25a4.tar.gz
Define a quotRem CallishMachOp; fixes #5598
This means we no longer do a division twice when we are using quotRem (on platforms on which the op is supported; currently only amd64).
Diffstat (limited to 'compiler/llvmGen')
-rw-r--r--compiler/llvmGen/LlvmCodeGen/CodeGen.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index 059328f868..98fb8eb4e8 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -15,6 +15,7 @@ import BlockId
import CgUtils ( activeStgRegs, callerSaves )
import CLabel
import OldCmm
+import OldCmmUtils
import qualified OldPprCmm as PprCmm
import DynFlags
@@ -222,6 +223,10 @@ genCall env t@(CmmPrim op) [] args CmmMayReturn | op == MO_Memcpy ||
`appOL` trashStmts `snocOL` call
return (env2, stmts, top1 ++ top2)
+genCall env (CmmPrim op) results args _
+ | Just stmts <- expandCallishMachOp op results args
+ = stmtsToInstrs env stmts (nilOL, [])
+
-- Handle all other foreign calls and prim ops.
genCall env target res args ret = do
@@ -469,17 +474,17 @@ cmmPrimOpFunctions env mop
(MO_PopCnt w) -> fsLit $ "llvm.ctpop." ++ show (widthToLlvmInt w)
- MO_WriteBarrier ->
- panic $ "cmmPrimOpFunctions: MO_WriteBarrier not supported here"
- MO_Touch ->
- panic $ "cmmPrimOpFunctions: MO_Touch not supported here"
+ MO_S_QuotRem {} -> unsupported
+ MO_WriteBarrier -> unsupported
+ MO_Touch -> unsupported
where
intrinTy1 = (if getLlvmVer env >= 28
then "p0i8.p0i8." else "") ++ show llvmWord
intrinTy2 = (if getLlvmVer env >= 28
then "p0i8." else "") ++ show llvmWord
-
+ unsupported = panic ("cmmPrimOpFunctions: " ++ show mop
+ ++ " not supported here")
-- | Tail function calls
genJump :: LlvmEnv -> CmmExpr -> Maybe [GlobalReg] -> UniqSM StmtData