summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-02-08 10:43:45 +0000
committerSimon Marlow <marlowsd@gmail.com>2011-02-08 10:43:45 +0000
commit6b89acb468c0db3337b831790f96bee4d9b54bfe (patch)
treee1cee7826c2a4e7186cba00a1bdad4d895de1174
parentc073f23aba6d88a9479a20ccb53bb98a338638db (diff)
downloadhaskell-6b89acb468c0db3337b831790f96bee4d9b54bfe.tar.gz
Recursively call cmmMachOpFold on divides that we turned into shifts
There might be more simplification to do.
-rw-r--r--compiler/cmm/CmmOpt.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs
index 53281b0312..0e35cc10b9 100644
--- a/compiler/cmm/CmmOpt.hs
+++ b/compiler/cmm/CmmOpt.hs
@@ -431,10 +431,10 @@ cmmMachOpFold mop args@[x, y@(CmmLit (CmmInt n _))]
= case mop of
MO_Mul rep
| Just p <- exactLog2 n ->
- CmmMachOp (MO_Shl rep) [x, CmmLit (CmmInt p rep)]
+ cmmMachOpFold (MO_Shl rep) [x, CmmLit (CmmInt p rep)]
MO_U_Quot rep
| Just p <- exactLog2 n ->
- CmmMachOp (MO_U_Shr rep) [x, CmmLit (CmmInt p rep)]
+ cmmMachOpFold (MO_U_Shr rep) [x, CmmLit (CmmInt p rep)]
MO_S_Quot rep
| Just p <- exactLog2 n,
CmmReg _ <- x -> -- We duplicate x below, hence require
@@ -462,7 +462,7 @@ cmmMachOpFold mop args@[x, y@(CmmLit (CmmInt n _))]
CmmMachOp (MO_And rep) [x1, CmmLit (CmmInt (n-1) rep)]
x3 = CmmMachOp (MO_Add rep) [x, x2]
in
- CmmMachOp (MO_S_Shr rep) [x3, CmmLit (CmmInt p rep)]
+ cmmMachOpFold (MO_S_Shr rep) [x3, CmmLit (CmmInt p rep)]
other
-> unchanged
where