[Git][ghc/ghc][master] Add INLINE [1] pragma to compareInt / compareWord

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sat Jun 22 14:44:32 UTC 2024



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


Commits:
749e089b by Alexander McKenna at 2024-06-22T10:43:24-04:00
Add INLINE [1] pragma to compareInt / compareWord

To allow rules to be written on the concrete implementation of
`compare` for `Int` and `Word`, we need to have an `INLINE [1]`
pragma on these functions, following the
`matching_overloaded_methods_in_rules` note in `GHC.Classes`.

CLC proposal https://github.com/haskell/core-libraries-committee/issues/179

Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/22643

- - - - -


2 changed files:

- libraries/base/changelog.md
- libraries/ghc-prim/GHC/Classes.hs


Changes:

=====================================
libraries/base/changelog.md
=====================================
@@ -2,6 +2,7 @@
 
 ## 4.21.0.0 *TBA*
   * Add a `readTixFile` field to the `HpcFlags` record in `GHC.RTS.Flags` ([CLC proposal #276](https://github.com/haskell/core-libraries-committee/issues/276))
+  * Add `INLINE[1]` to `compareInt` / `compareWord` ([CLC proposal #179](https://github.com/haskell/core-libraries-committee/issues/179))
   * Add the `MonadFix` instance for `(,) a`, similar to the one for `Writer a` ([CLC proposal #238](https://github.com/haskell/core-libraries-committee/issues/238))
   * Improve `toInteger :: Word32 -> Integer` on 64-bit platforms ([CLC proposal #259](https://github.com/haskell/core-libraries-committee/issues/259))
   * Make `flip` representation polymorphic ([CLC proposal #245](https://github.com/haskell/core-libraries-committee/issues/245))


=====================================
libraries/ghc-prim/GHC/Classes.hs
=====================================
@@ -575,6 +575,8 @@ gtInt, geInt, ltInt, leInt :: Int -> Int -> Bool
 (I# x) `ltInt` (I# y) = isTrue# (x <#  y)
 (I# x) `leInt` (I# y) = isTrue# (x <=# y)
 
+-- See GHC.Classes#matching_overloaded_methods_in_rules
+{-# INLINE [1] compareInt #-}
 compareInt :: Int -> Int -> Ordering
 (I# x#) `compareInt` (I# y#) = compareInt# x# y#
 
@@ -602,6 +604,8 @@ gtWord, geWord, ltWord, leWord :: Word -> Word -> Bool
 (W# x) `ltWord` (W# y) = isTrue# (x `ltWord#` y)
 (W# x) `leWord` (W# y) = isTrue# (x `leWord#` y)
 
+-- See GHC.Classes#matching_overloaded_methods_in_rules
+{-# INLINE [1] compareWord #-}
 compareWord :: Word -> Word -> Ordering
 (W# x#) `compareWord` (W# y#) = compareWord# x# y#
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/749e089bafb1c8f7664bec5ec504835a1038f056

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/749e089bafb1c8f7664bec5ec504835a1038f056
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/20240622/ea185a69/attachment-0001.html>


More information about the ghc-commits mailing list