summaryrefslogtreecommitdiff
path: root/compiler/codeGen
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/codeGen
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/codeGen')
-rw-r--r--compiler/codeGen/CgPrimOp.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/codeGen/CgPrimOp.hs b/compiler/codeGen/CgPrimOp.hs
index b0865d69d9..f169c0ce38 100644
--- a/compiler/codeGen/CgPrimOp.hs
+++ b/compiler/codeGen/CgPrimOp.hs
@@ -440,6 +440,15 @@ emitPrimOp [res] op args live
= let stmt = CmmAssign (CmmLocal res) (CmmMachOp mop args) in
stmtC stmt
+emitPrimOp [res_q, res_r] IntQuotRemOp [arg_x, arg_y] _
+ = let stmt = CmmCall (CmmPrim (MO_S_QuotRem wordWidth))
+ [CmmHinted res_q NoHint,
+ CmmHinted res_r NoHint]
+ [CmmHinted arg_x NoHint,
+ CmmHinted arg_y NoHint]
+ CmmMayReturn
+ in stmtC stmt
+
emitPrimOp _ op _ _
= pprPanic "emitPrimOp: can't translate PrimOp" (ppr op)