summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-01-12 04:57:44 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-22 15:01:24 -0500
commit22d01924b1c09c4bf3e9b602a2c6efbc46ca070f (patch)
tree5530a6023575f4f579d0f92f374aee788d8282f1 /compiler
parent2267d42a0bf50cb1bc3b5bb6660589eb05903c84 (diff)
downloadhaskell-22d01924b1c09c4bf3e9b602a2c6efbc46ca070f.tar.gz
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.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Cmm/Opt.hs4
1 files changed, 2 insertions, 2 deletions
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)])