[Git][ghc/ghc][wip/js-staging] Fix popCount rule for Natural when cross-compiling

Sylvain Henry (@hsyl20) gitlab at gitlab.haskell.org
Mon Oct 17 23:47:07 UTC 2022



Sylvain Henry pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC


Commits:
00e4a7ad by Sylvain Henry at 2022-10-18T01:50:22+02:00
Fix popCount rule for Natural when cross-compiling

- - - - -


1 changed file:

- compiler/GHC/Core/Opt/ConstantFold.hs


Changes:

=====================================
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)))



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/00e4a7ad64f56ac2940e7167c00b6a1af0be757f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/00e4a7ad64f56ac2940e7167c00b6a1af0be757f
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221017/424dcbf5/attachment.html>


More information about the ghc-commits mailing list