From 22d01924b1c09c4bf3e9b602a2c6efbc46ca070f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 12 Jan 2021 04:57:44 +0000 Subject: C-- shift amount is always native size, not shiftee size This isn't a bug yet, because we only shift native-sized types, but I hope to change that. --- compiler/GHC/Cmm/Opt.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/GHC/Cmm') diff --git a/compiler/GHC/Cmm/Opt.hs b/compiler/GHC/Cmm/Opt.hs index d9e7c4885a..f4be9520ee 100644 --- a/compiler/GHC/Cmm/Opt.hs +++ b/compiler/GHC/Cmm/Opt.hs @@ -346,10 +346,10 @@ cmmMachOpFoldM platform mop [x, (CmmLit (CmmInt n _))] = case mop of MO_Mul rep | Just p <- exactLog2 n -> - Just $! (cmmMachOpFold platform (MO_Shl rep) [x, CmmLit (CmmInt p rep)]) + Just $! (cmmMachOpFold platform (MO_Shl rep) [x, CmmLit (CmmInt p $ wordWidth platform)]) MO_U_Quot rep | Just p <- exactLog2 n -> - Just $! (cmmMachOpFold platform (MO_U_Shr rep) [x, CmmLit (CmmInt p rep)]) + Just $! (cmmMachOpFold platform (MO_U_Shr rep) [x, CmmLit (CmmInt p $ wordWidth platform)]) MO_U_Rem rep | Just _ <- exactLog2 n -> Just $! (cmmMachOpFold platform (MO_And rep) [x, CmmLit (CmmInt (n - 1) rep)]) -- cgit v1.2.1