summaryrefslogtreecommitdiff
path: root/compiler/cmm/OldCmmUtils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/cmm/OldCmmUtils.hs')
-rw-r--r--compiler/cmm/OldCmmUtils.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/cmm/OldCmmUtils.hs b/compiler/cmm/OldCmmUtils.hs
index 14a17d7946..3fc6fd441a 100644
--- a/compiler/cmm/OldCmmUtils.hs
+++ b/compiler/cmm/OldCmmUtils.hs
@@ -12,6 +12,8 @@ module OldCmmUtils(
maybeAssignTemp, loadArgsIntoTemps,
+ expandCallishMachOp,
+
module CmmUtils,
) where
@@ -96,3 +98,12 @@ maybeAssignTemp uniques e
| hasNoGlobalRegs e = (uniques, [], e)
| otherwise = (tail uniques, [CmmAssign local e], CmmReg local)
where local = CmmLocal (LocalReg (head uniques) (cmmExprType e))
+
+expandCallishMachOp :: CallishMachOp -> [HintedCmmFormal] -> [HintedCmmActual]
+ -> Maybe [CmmStmt]
+expandCallishMachOp (MO_S_QuotRem width) [CmmHinted res_q _, CmmHinted res_r _] args
+ = Just [CmmAssign (CmmLocal res_q) (CmmMachOp (MO_S_Quot width) args'),
+ CmmAssign (CmmLocal res_r) (CmmMachOp (MO_S_Rem width) args')]
+ where args' = map hintlessCmm args
+expandCallishMachOp _ _ _ = Nothing
+