summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/PPC/CodeGen.hs
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/nativeGen/PPC/CodeGen.hs
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/nativeGen/PPC/CodeGen.hs')
-rw-r--r--compiler/nativeGen/PPC/CodeGen.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs
index 7b704cbe8f..db97a8cc97 100644
--- a/compiler/nativeGen/PPC/CodeGen.hs
+++ b/compiler/nativeGen/PPC/CodeGen.hs
@@ -42,6 +42,7 @@ import Platform
import BlockId
import PprCmm ( pprExpr )
import OldCmm
+import OldCmmUtils
import CLabel
-- The rest:
@@ -901,6 +902,10 @@ genCCall'
genCCall' _ (CmmPrim MO_WriteBarrier) _ _
= return $ unitOL LWSYNC
+genCCall' _ (CmmPrim op) results args
+ | Just stmts <- expandCallishMachOp op results args
+ = stmtsToInstrs stmts
+
genCCall' gcp target dest_regs argsAndHints
= ASSERT (not $ any (`elem` [II16]) $ map cmmTypeSize argReps)
-- we rely on argument promotion in the codeGen
@@ -1142,10 +1147,11 @@ genCCall' gcp target dest_regs argsAndHints
MO_PopCnt w -> (fsLit $ popCntLabel w, False)
- MO_WriteBarrier ->
- panic $ "outOfLineCmmOp: MO_WriteBarrier not supported"
- MO_Touch ->
- panic $ "outOfLineCmmOp: MO_Touch not supported"
+ MO_S_QuotRem {} -> unsupported
+ MO_WriteBarrier -> unsupported
+ MO_Touch -> unsupported
+ unsupported = panic ("outOfLineCmmOp: " ++ show mop
+ ++ " not supported")
-- -----------------------------------------------------------------------------
-- Generating a table-branch