diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-10-06 12:04:53 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-07 20:20:01 -0400 |
commit | e1d02fb0f04bcf3acea1da96d291a03bb749718d (patch) | |
tree | 9cf5450df9e05b5be60214c94f6e4c1f4c52572d /libraries/ghc-bignum | |
parent | 0cf232636e613b2ba8d2285c9e0783c9ba6ff84f (diff) | |
download | haskell-e1d02fb0f04bcf3acea1da96d291a03bb749718d.tar.gz |
Bignum: allow naturalEq#/Ne# to inline (#20361)
We now perform constant folding on bigNatEq# instead.
Diffstat (limited to 'libraries/ghc-bignum')
-rw-r--r-- | libraries/ghc-bignum/src/GHC/Num/BigNat.hs | 1 | ||||
-rw-r--r-- | libraries/ghc-bignum/src/GHC/Num/Natural.hs | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/libraries/ghc-bignum/src/GHC/Num/BigNat.hs b/libraries/ghc-bignum/src/GHC/Num/BigNat.hs index a9104caefb..1e6acaf9cc 100644 --- a/libraries/ghc-bignum/src/GHC/Num/BigNat.hs +++ b/libraries/ghc-bignum/src/GHC/Num/BigNat.hs @@ -312,6 +312,7 @@ bigNatLeWord bn (W# w) = isTrue# (bigNatLeWord# bn w) -- | Equality test for BigNat bigNatEq# :: BigNat# -> BigNat# -> Bool# +{-# NOINLINE bigNatEq# #-} bigNatEq# wa wb | isTrue# (wordArraySize# wa /=# wordArraySize# wb) = 0# | isTrue# (wordArraySize# wa ==# 0#) = 1# diff --git a/libraries/ghc-bignum/src/GHC/Num/Natural.hs b/libraries/ghc-bignum/src/GHC/Num/Natural.hs index 9f950a843c..3fe09a0625 100644 --- a/libraries/ghc-bignum/src/GHC/Num/Natural.hs +++ b/libraries/ghc-bignum/src/GHC/Num/Natural.hs @@ -142,7 +142,6 @@ naturalEncodeFloat# !m e = double2Float# (naturalEncodeDouble# m e) -- | Equality test for Natural naturalEq# :: Natural -> Natural -> Bool# -{-# NOINLINE naturalEq# #-} naturalEq# (NS x) (NS y) = x `eqWord#` y naturalEq# (NB x) (NB y) = bigNatEq# x y naturalEq# _ _ = 0# @@ -153,7 +152,6 @@ naturalEq !x !y = isTrue# (naturalEq# x y) -- | Inequality test for Natural naturalNe# :: Natural -> Natural -> Bool# -{-# NOINLINE naturalNe# #-} naturalNe# (NS x) (NS y) = x `neWord#` y naturalNe# (NB x) (NB y) = bigNatNe# x y naturalNe# _ _ = 1# |