From 7bfb7bfc6da981ef827b1a166c8cbfb5b29a25a4 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 14 Feb 2012 21:26:18 +0000 Subject: 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). --- compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'compiler/llvmGen') 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 -- cgit v1.2.1