[Git][ghc/ghc][master] Enable popcount rewrite rule when cross-compiling

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Oct 25 22:08:39 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
0988a23d by Sylvain Henry at 2022-10-25T18:08:24-04:00
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.

- - - - -


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/0988a23d21110f4351eb9879dcab1b035d4e92c6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0988a23d21110f4351eb9879dcab1b035d4e92c6
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/20221025/39754519/attachment.html>


More information about the ghc-commits mailing list