From 401dfe7bbaad4a35f0cc72a078dfcedc7ab9af67 Mon Sep 17 00:00:00 2001
From: Sylvain Henry <sylvain@haskus.fr>
Date: Mon, 12 Feb 2024 18:03:45 +0100
Subject: [PATCH] Reexport primops from GHC.Float + add deprecation

---
 libraries/ghc-internal/src/GHC/Float.hs                | 10 ++++++++++
 .../tests/interface-stability/base-exports.stdout      |  4 ++++
 .../base-exports.stdout-javascript-unknown-ghcjs       |  4 ++++
 .../interface-stability/base-exports.stdout-mingw32    |  4 ++++
 .../interface-stability/base-exports.stdout-ws-32      |  4 ++++
 5 files changed, 26 insertions(+)

diff --git a/libraries/ghc-internal/src/GHC/Float.hs b/libraries/ghc-internal/src/GHC/Float.hs
index 785e3316c2a2..ef6de2f187d6 100644
--- a/libraries/ghc-internal/src/GHC/Float.hs
+++ b/libraries/ghc-internal/src/GHC/Float.hs
@@ -59,6 +59,8 @@ module GHC.Float
     , rationalToFloat
     , castWord32ToFloat
     , castFloatToWord32
+    , castWord32ToFloat#
+    , castFloatToWord32#
     , float2Double
       -- ** Operations
     , floorFloat
@@ -96,6 +98,8 @@ module GHC.Float
     , rationalToDouble
     , castWord64ToDouble
     , castDoubleToWord64
+    , castWord64ToDouble#
+    , castDoubleToWord64#
     , double2Float
       -- ** Operations
     , floorDouble
@@ -1734,6 +1738,12 @@ read it from memory into the destination register and the best way to do that
 is using CMM.
 -}
 
+-- Deprecated since GHC 9.10.
+{-# DEPRECATED stgDoubleToWord64 "Use castDoubleToWord64# instead" #-}
+{-# DEPRECATED stgWord64ToDouble "Use castWord64ToDouble# instead" #-}
+{-# DEPRECATED stgFloatToWord32  "Use castFloatToWord32# instead" #-}
+{-# DEPRECATED stgWord32ToFloat  "Use castWord32ToFloat# instead" #-}
+
 stgDoubleToWord64 :: Double# -> Word64#
 stgDoubleToWord64 = castDoubleToWord64#
 
diff --git a/testsuite/tests/interface-stability/base-exports.stdout b/testsuite/tests/interface-stability/base-exports.stdout
index 8a088eb222c0..693ac532a0f1 100644
--- a/testsuite/tests/interface-stability/base-exports.stdout
+++ b/testsuite/tests/interface-stability/base-exports.stdout
@@ -7118,9 +7118,13 @@ module GHC.Float where
   atanhDouble :: Double -> Double
   atanhFloat :: Float -> Float
   castDoubleToWord64 :: Double -> GHC.Word.Word64
+  castDoubleToWord64# :: Double# -> GHC.Prim.Word64#
   castFloatToWord32 :: Float -> GHC.Word.Word32
+  castFloatToWord32# :: Float# -> GHC.Prim.Word32#
   castWord32ToFloat :: GHC.Word.Word32 -> Float
+  castWord32ToFloat# :: GHC.Prim.Word32# -> Float#
   castWord64ToDouble :: GHC.Word.Word64 -> Double
+  castWord64ToDouble# :: GHC.Prim.Word64# -> Double#
   ceilingDouble :: forall b. GHC.Real.Integral b => Double -> b
   ceilingFloat :: forall b. GHC.Real.Integral b => Float -> b
   clamp :: GHC.Types.Int -> GHC.Types.Int -> GHC.Types.Int
diff --git a/testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs b/testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
index e4c47f6be9e8..a6b02c509911 100644
--- a/testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
+++ b/testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
@@ -7087,9 +7087,13 @@ module GHC.Float where
   atanhDouble :: Double -> Double
   atanhFloat :: Float -> Float
   castDoubleToWord64 :: Double -> GHC.Word.Word64
+  castDoubleToWord64# :: Double# -> GHC.Prim.Word64#
   castFloatToWord32 :: Float -> GHC.Word.Word32
+  castFloatToWord32# :: Float# -> GHC.Prim.Word32#
   castWord32ToFloat :: GHC.Word.Word32 -> Float
+  castWord32ToFloat# :: GHC.Prim.Word32# -> Float#
   castWord64ToDouble :: GHC.Word.Word64 -> Double
+  castWord64ToDouble# :: GHC.Prim.Word64# -> Double#
   ceilingDouble :: forall b. GHC.Real.Integral b => Double -> b
   ceilingFloat :: forall b. GHC.Real.Integral b => Float -> b
   clamp :: GHC.Types.Int -> GHC.Types.Int -> GHC.Types.Int
diff --git a/testsuite/tests/interface-stability/base-exports.stdout-mingw32 b/testsuite/tests/interface-stability/base-exports.stdout-mingw32
index 167d4e0f4085..e3e3a0961ccf 100644
--- a/testsuite/tests/interface-stability/base-exports.stdout-mingw32
+++ b/testsuite/tests/interface-stability/base-exports.stdout-mingw32
@@ -7267,9 +7267,13 @@ module GHC.Float where
   atanhDouble :: Double -> Double
   atanhFloat :: Float -> Float
   castDoubleToWord64 :: Double -> GHC.Word.Word64
+  castDoubleToWord64# :: Double# -> GHC.Prim.Word64#
   castFloatToWord32 :: Float -> GHC.Word.Word32
+  castFloatToWord32# :: Float# -> GHC.Prim.Word32#
   castWord32ToFloat :: GHC.Word.Word32 -> Float
+  castWord32ToFloat# :: GHC.Prim.Word32# -> Float#
   castWord64ToDouble :: GHC.Word.Word64 -> Double
+  castWord64ToDouble# :: GHC.Prim.Word64# -> Double#
   ceilingDouble :: forall b. GHC.Real.Integral b => Double -> b
   ceilingFloat :: forall b. GHC.Real.Integral b => Float -> b
   clamp :: GHC.Types.Int -> GHC.Types.Int -> GHC.Types.Int
diff --git a/testsuite/tests/interface-stability/base-exports.stdout-ws-32 b/testsuite/tests/interface-stability/base-exports.stdout-ws-32
index 77c3c2e15e4c..b8dfb52ef217 100644
--- a/testsuite/tests/interface-stability/base-exports.stdout-ws-32
+++ b/testsuite/tests/interface-stability/base-exports.stdout-ws-32
@@ -7118,9 +7118,13 @@ module GHC.Float where
   atanhDouble :: Double -> Double
   atanhFloat :: Float -> Float
   castDoubleToWord64 :: Double -> GHC.Word.Word64
+  castDoubleToWord64# :: Double# -> GHC.Prim.Word64#
   castFloatToWord32 :: Float -> GHC.Word.Word32
+  castFloatToWord32# :: Float# -> GHC.Prim.Word32#
   castWord32ToFloat :: GHC.Word.Word32 -> Float
+  castWord32ToFloat# :: GHC.Prim.Word32# -> Float#
   castWord64ToDouble :: GHC.Word.Word64 -> Double
+  castWord64ToDouble# :: GHC.Prim.Word64# -> Double#
   ceilingDouble :: forall b. GHC.Real.Integral b => Double -> b
   ceilingFloat :: forall b. GHC.Real.Integral b => Float -> b
   clamp :: GHC.Types.Int -> GHC.Types.Int -> GHC.Types.Int
-- 
GitLab