summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2022-10-19 11:46:46 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-10-25 18:08:24 -0400
commit0988a23d21110f4351eb9879dcab1b035d4e92c6 (patch)
tree714bac942bd544fba5178df088de5d5eb1db3d4f
parent7f203d00edd639d24af2cf5970e771207adc2bc6 (diff)
downloadhaskell-0988a23d21110f4351eb9879dcab1b035d4e92c6.tar.gz
Enable popcount rewrite rule when cross-compiling
The comment applies only when host's word size < target's word size. So we can relax the guard.
-rw-r--r--compiler/GHC/Core/Opt/ConstantFold.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Core/Opt/ConstantFold.hs b/compiler/GHC/Core/Opt/ConstantFold.hs
index 8a22124779..dbbb36b8e6 100644
--- a/compiler/GHC/Core/Opt/ConstantFold.hs
+++ b/compiler/GHC/Core/Opt/ConstantFold.hs
@@ -2244,7 +2244,7 @@ builtinBignumRules =
-- We use a host Int to compute the popCount. If we compile on a 32-bit
-- host for a 64-bit target, the result may be different than if computed
-- by the target. So we disable this rule if sizes don't match.
- guard (platformWordSizeInBits platform == finiteBitSize (0 :: Word))
+ guard (platformWordSizeInBits platform <= finiteBitSize (0 :: Word))
[a0] <- getArgs
x <- isBignumLiteral a0
pure $ Lit (mk_lit platform (fromIntegral (popCount x)))