From 6b89acb468c0db3337b831790f96bee4d9b54bfe Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Tue, 8 Feb 2011 10:43:45 +0000 Subject: [PATCH] Recursively call cmmMachOpFold on divides that we turned into shifts There might be more simplification to do. --- compiler/cmm/CmmOpt.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs index 53281b0..0e35cc1 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 -- 1.7.10.4