inline-asm 0.5.0.1 → 0.5.0.2
raw patch · 4 files changed
+42/−8 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Language.Asm.Inline: instance Language.Asm.Inline.AsmArg GHC.Int.Int64 GHC.Prim.Int#
- Language.Asm.Inline: instance Language.Asm.Inline.AsmArg GHC.Word.Word64 GHC.Prim.Word#
+ Language.Asm.Inline: instance Language.Asm.Inline.AsmArg GHC.Int.Int64 Language.Asm.Inline.Int64Rep#
+ Language.Asm.Inline: instance Language.Asm.Inline.AsmArg GHC.Word.Word64 Language.Asm.Inline.Word64Rep#
Files
- ChangeLog.md +4/−0
- inline-asm.cabal +4/−4
- src/Language/Asm/Inline.hs +21/−4
- test/Spec.hs +13/−0
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for inline-asm +## v0.5.0.2++* GHC 9.4 compatibility.+ ## v0.5.0.1 * GHC 9.2 compatibility.
inline-asm.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack ----- hash: 0ba4305bbb1fd0e42473bdc9159b5a24f4b74229ff868ae87110529fdf4590b6+-- hash: c5778d06671fe086d6246601849ecf96707a9e8b6078ad56ce8ad59f4a91ff7a name: inline-asm-version: 0.5.0.1+version: 0.5.0.2 synopsis: Inline some Assembly in ur Haskell! description: Please see the README on GitHub at <https://github.com/0xd34df00d/inline-asm#readme> category: FFI@@ -83,11 +83,11 @@ , primitive , template-haskell >=2.16.0.0 , uniplate+ default-language: Haskell2010 if flag(with-examples) buildable: True else buildable: False- default-language: Haskell2010 test-suite inline-asm-test type: exitcode-stdio-1.0
src/Language/Asm/Inline.hs view
@@ -47,11 +47,20 @@ type Int8Rep# = Int# type Int16Rep# = Int# type Int32Rep# = Int#+type Int64Rep# = Int# type Word8Rep# = Word# type Word16Rep# = Word# type Word32Rep# = Word# #endif +#if MIN_VERSION_GLASGOW_HASKELL(9,4,0,0)+type Int64Rep# = Int64#+type Word64Rep# = Word64#+#else+type Int64Rep# = Int#+type Word64Rep# = Word#+#endif+ instance AsmArg Unit Int# where unbox _ = 0# rebox _ = Unit@@ -73,7 +82,7 @@ rebox = I32# #if WORD_SIZE_IN_BITS > 32-instance AsmArg Int64 Int# where+instance AsmArg Int64 Int64Rep# where #else instance AsmArg Int64 Int64# where #endif@@ -97,7 +106,7 @@ rebox = W32# #if WORD_SIZE_IN_BITS > 32-instance AsmArg Word64 Word# where+instance AsmArg Word64 Word64Rep# where #else instance AsmArg Word64 Word64# where #endif@@ -235,16 +244,24 @@ . transformBi unliftBS where unliftBaseTy x+#if MIN_VERSION_GLASGOW_HASKELL(9,4,0,0)+ | x == ''Word64 = ''Word64#+ | x == ''Int64 = ''Int64#+#else+ | x == ''Word64 = ''Word#+ | x == ''Int64 = ''Int#+#endif #if MIN_VERSION_GLASGOW_HASKELL(9,2,0,0)- | x == ''Word || x == ''Word64 = ''Word#+ | x == ''Word = ''Word# | x == ''Word8 = ''Word8# | x == ''Word16 = ''Word16# | x == ''Word32 = ''Word32# - | x == ''Int || x == ''Int64 = ''Int#+ | x == ''Int = ''Int# | x == ''Int8 = ''Int8# | x == ''Int16 = ''Int16# | x == ''Int32 = ''Int32#+ #else | x `elem` [ ''Word, ''Word8, ''Word16, ''Word32, ''Word64 ] = ''Word# | x `elem` [ ''Int, ''Int8, ''Int16, ''Int32, ''Int64 ] = ''Int#
test/Spec.hs view
@@ -6,6 +6,7 @@ import qualified Data.ByteString.Char8 as BS8 import Data.ByteString(ByteString) import Foreign.Ptr+import GHC.Int import GHC.Word import Test.Hspec import Test.Hspec.Core.QuickCheck@@ -42,6 +43,14 @@ [asmTy| (a : Int) (b : Int) | (_ : Int) |] [asm| add {b}, {a} |] +defineAsmFun "plusInt64QQ"+ [asmTy| (a : Int64) (b : Int64) | (_ : Int64) |]+ [asm| add {b}, {a} |]++defineAsmFun "plusWord64QQ"+ [asmTy| (a : Word64) (b : Word64) | (_ : Word64) |]+ [asm| add {b}, {a} |]+ defineAsmFun "plus3IntQQ" [asmTy| (a : Int) (b : Int) (c : Int) | (_ : Int) |] [asm|@@ -182,6 +191,10 @@ it "plusInt" $ property $ \n1 n2 -> plusIntQQ n1 n2 `shouldBe` n1 + n2 it "plus3Int" $ property $ \n1 n2 n3 -> plus3IntQQ n1 n2 n3 `shouldBe` n1 + n2 + n3 it "swap returns a tuple properly" $ property $ \n1 n2 -> swap2p1QQ n1 n2 `shouldBe` (n2, n1 + 1)+ describe "Works on Int64s" $ do+ it "plusInt" $ property $ \n1 n2 -> plusInt64QQ n1 n2 `shouldBe` n1 + n2+ describe "Works on Word64s" $ do+ it "plusInt" $ property $ \n1 n2 -> plusWord64QQ n1 n2 `shouldBe` n1 + n2 describe "Works on Floats" $ do it "timesTwo" $ property $ \num -> timesTwoFloatQQ num `shouldBe` num * 2 it "plusFloat" $ property $ \n1 n2 -> plusFloatQQ n1 n2 `shouldBe` n1 + n2