diff options
author | Ian Lynagh <igloo@earth.li> | 2012-02-14 21:26:18 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-02-14 23:08:26 +0000 |
commit | 7bfb7bfc6da981ef827b1a166c8cbfb5b29a25a4 (patch) | |
tree | 64f62969824858ce141d89bc52ffc7e71ed236f9 /compiler/codeGen | |
parent | 8c0196b48d043fe16eb5b2d343f5544b7fdd5004 (diff) | |
download | haskell-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.hs | 9 |
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) |