summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-12-03 18:54:54 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-03 08:12:29 -0500
commitd8dc0f96237fe6fe7081c04727c7c2573477e5cb (patch)
treedbc4e8d25cf5a085e979df98bacad5999bf78aee /testsuite/tests/codeGen
parenteea96042f1e8682605ae68db10f2bcdd7dab923e (diff)
downloadhaskell-d8dc0f96237fe6fe7081c04727c7c2573477e5cb.tar.gz
Fix array and cleanup conversion primops (#19026)
The first change makes the array ones use the proper fixed-size types, which also means that just like before, they can be used without explicit conversions with the boxed sized types. (Before, it was Int# / Word# on both sides, now it is fixed sized on both sides). For the second change, don't use "extend" or "narrow" in some of the user-facing primops names for conversions. - Names like `narrowInt32#` are misleading when `Int` is 32-bits. - Names like `extendInt64#` are flat-out wrong when `Int is 32-bits. - `narrow{Int,Word}<N>#` however map a type to itself, and so don't suffer from this problem. They are left as-is. These changes are batched together because Alex happend to use the array ops. We can only use released versions of Alex at this time, sadly, and I don't want to have to have a release thatwon't work for the final GHC 9.2. So by combining these we get all the changes for Alex done at once. Bump hackage state in a few places, and also make that workflow slightly easier for the future. Bump minimum Alex version Bump Cabal, array, bytestring, containers, text, and binary submodules
Diffstat (limited to 'testsuite/tests/codeGen')
-rw-r--r--testsuite/tests/codeGen/should_compile/T18614.hs2
-rw-r--r--testsuite/tests/codeGen/should_compile/cg006.hs2
-rw-r--r--testsuite/tests/codeGen/should_run/T2080.hs2
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun070.hs4
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun072.hs4
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun075.hs6
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun076.hs6
-rw-r--r--testsuite/tests/codeGen/should_run/compareByteArrays.hs4
8 files changed, 15 insertions, 15 deletions
diff --git a/testsuite/tests/codeGen/should_compile/T18614.hs b/testsuite/tests/codeGen/should_compile/T18614.hs
index ae055e3cfd..f1d80d8409 100644
--- a/testsuite/tests/codeGen/should_compile/T18614.hs
+++ b/testsuite/tests/codeGen/should_compile/T18614.hs
@@ -8,4 +8,4 @@ import GHC.Exts
main = pure ()
test :: Word8# -> Word8#
-test x = x `plusWord8#` narrowWord8# 1##
+test x = x `plusWord8#` wordToWord8# 1##
diff --git a/testsuite/tests/codeGen/should_compile/cg006.hs b/testsuite/tests/codeGen/should_compile/cg006.hs
index 494b37937b..4ae3f5a2e9 100644
--- a/testsuite/tests/codeGen/should_compile/cg006.hs
+++ b/testsuite/tests/codeGen/should_compile/cg006.hs
@@ -5,4 +5,4 @@ module ShouldCompile where
import GHC.Base
class Unboxable a where
writeUnboxable :: MutableByteArray# RealWorld -> a -> State# RealWorld -> State# RealWorld
- writeUnboxable arr a s = writeInt8Array# arr 0# (getTag 0) s
+ writeUnboxable arr a s = writeInt8Array# arr 0# (intToInt8# (getTag 0)) s
diff --git a/testsuite/tests/codeGen/should_run/T2080.hs b/testsuite/tests/codeGen/should_run/T2080.hs
index 924e77a30f..8645d510e3 100644
--- a/testsuite/tests/codeGen/should_run/T2080.hs
+++ b/testsuite/tests/codeGen/should_run/T2080.hs
@@ -10,7 +10,7 @@ utf8DecodeChar# :: Addr# -> Bool -> Bool
{-# NOINLINE utf8DecodeChar# #-}
utf8DecodeChar# a# fred =
case () of
- _ | isTrue# (word2Int# (indexWord8OffAddr# a# 0#) <=# 0x7F#) -> True
+ _ | isTrue# (word2Int# (word8ToWord# (indexWord8OffAddr# a# 0#)) <=# 0x7F#) -> True
-- Omitting the next line gives an ASSERT error:
-- ghc-6.9: panic! (the 'impossible' happened)
diff --git a/testsuite/tests/codeGen/should_run/cgrun070.hs b/testsuite/tests/codeGen/should_run/cgrun070.hs
index 53f640116f..d37032a707 100644
--- a/testsuite/tests/codeGen/should_run/cgrun070.hs
+++ b/testsuite/tests/codeGen/should_run/cgrun070.hs
@@ -196,11 +196,11 @@ touch a = unsafeIOToST $ IO $ \s# ->
indexWord8Array :: ByteArray -> Int -> Word8
indexWord8Array arr (I# i#) = case indexWord8Array# (unBA arr) i# of
- a -> W8# (narrowWord8# a)
+ a -> W8# a
writeWord8Array :: MByteArray s -> Int -> Word8 -> ST s ()
writeWord8Array marr (I# i#) (W8# a) = ST $ \ s# ->
- case writeWord8Array# (unMBA marr) i# (extendWord8# a) s# of
+ case writeWord8Array# (unMBA marr) i# a s# of
s2# -> (# s2#, () #)
unsafeFreezeByteArray :: MByteArray s -> ST s (ByteArray)
diff --git a/testsuite/tests/codeGen/should_run/cgrun072.hs b/testsuite/tests/codeGen/should_run/cgrun072.hs
index fb1b26252f..b97ce56d01 100644
--- a/testsuite/tests/codeGen/should_run/cgrun072.hs
+++ b/testsuite/tests/codeGen/should_run/cgrun072.hs
@@ -31,10 +31,10 @@ main = do putStrLn test_primop_bSwap16
putStrLn test'_base_bSwap64
bswap16 :: Word16 -> Word16
-bswap16 (W16# w#) = W16# (narrowWord16# (byteSwap16# (extendWord16# w#)))
+bswap16 (W16# w#) = W16# (wordToWord16# (byteSwap16# (word16ToWord# w#)))
bswap32 :: Word32 -> Word32
-bswap32 (W32# w#) = W32# (narrowWord32# (byteSwap32# (extendWord32# w#)))
+bswap32 (W32# w#) = W32# (wordToWord32# (byteSwap32# (word32ToWord# w#)))
bswap64 :: Word64 -> Word64
bswap64 (W64# w#) = W64# (byteSwap64# w#)
diff --git a/testsuite/tests/codeGen/should_run/cgrun075.hs b/testsuite/tests/codeGen/should_run/cgrun075.hs
index 89a4679e5f..5babde1254 100644
--- a/testsuite/tests/codeGen/should_run/cgrun075.hs
+++ b/testsuite/tests/codeGen/should_run/cgrun075.hs
@@ -27,13 +27,13 @@ instance Pdep Word where
pdep (W# src#) (W# mask#) = W# (pdep# src# mask#)
instance Pdep Word8 where
- pdep (W8# src#) (W8# mask#) = W8# (narrowWord8# (pdep8# (extendWord8# src#) (extendWord8# mask#)))
+ pdep (W8# src#) (W8# mask#) = W8# (wordToWord8# (pdep8# (word8ToWord# src#) (word8ToWord# mask#)))
instance Pdep Word16 where
- pdep (W16# src#) (W16# mask#) = W16# (narrowWord16# (pdep16# (extendWord16# src#) (extendWord16# mask#)))
+ pdep (W16# src#) (W16# mask#) = W16# (wordToWord16# (pdep16# (word16ToWord# src#) (word16ToWord# mask#)))
instance Pdep Word32 where
- pdep (W32# src#) (W32# mask#) = W32# (narrowWord32# (pdep32# (extendWord32# src#) (extendWord32# mask#)))
+ pdep (W32# src#) (W32# mask#) = W32# (wordToWord32# (pdep32# (word32ToWord# src#) (word32ToWord# mask#)))
instance Pdep Word64 where
pdep (W64# src#) (W64# mask#) = W64# (pdep64# src# mask#)
diff --git a/testsuite/tests/codeGen/should_run/cgrun076.hs b/testsuite/tests/codeGen/should_run/cgrun076.hs
index a6ae331cf6..4779b5beb8 100644
--- a/testsuite/tests/codeGen/should_run/cgrun076.hs
+++ b/testsuite/tests/codeGen/should_run/cgrun076.hs
@@ -27,13 +27,13 @@ instance Pext Word where
pext (W# src#) (W# mask#) = W# (pext# src# mask#)
instance Pext Word8 where
- pext (W8# src#) (W8# mask#) = W8# (narrowWord8# (pext8# (extendWord8# src#) (extendWord8# mask#)))
+ pext (W8# src#) (W8# mask#) = W8# (wordToWord8# (pext8# (word8ToWord# src#) (word8ToWord# mask#)))
instance Pext Word16 where
- pext (W16# src#) (W16# mask#) = W16# (narrowWord16# (pext16# (extendWord16# src#) (extendWord16# mask#)))
+ pext (W16# src#) (W16# mask#) = W16# (wordToWord16# (pext16# (word16ToWord# src#) (word16ToWord# mask#)))
instance Pext Word32 where
- pext (W32# src#) (W32# mask#) = W32# (narrowWord32# (pext32# (extendWord32# src#) (extendWord32# mask#)))
+ pext (W32# src#) (W32# mask#) = W32# (wordToWord32# (pext32# (word32ToWord# src#) (word32ToWord# mask#)))
instance Pext Word64 where
pext (W64# src#) (W64# mask#) = W64# (pext64# src# mask#)
diff --git a/testsuite/tests/codeGen/should_run/compareByteArrays.hs b/testsuite/tests/codeGen/should_run/compareByteArrays.hs
index e155bc45a5..5bd0e58588 100644
--- a/testsuite/tests/codeGen/should_run/compareByteArrays.hs
+++ b/testsuite/tests/codeGen/should_run/compareByteArrays.hs
@@ -39,7 +39,7 @@ copyByteArray (BA# src#) (I# srcOfs#) (MBA# dest#) (I# destOfs#) (I# n#)
indexWord8Array :: BA -> Int -> Word8
indexWord8Array (BA# ba#) (I# i#)
- = W8# (narrowWord8# (indexWord8Array# ba# i#))
+ = W8# (indexWord8Array# ba# i#)
sizeofByteArray :: BA -> Int
sizeofByteArray (BA# ba#) = I# (sizeofByteArray# ba#)
@@ -54,7 +54,7 @@ newByteArray (I# n#)
writeWord8Array :: MBA s -> Int -> Word8 -> ST s ()
writeWord8Array (MBA# mba#) (I# i#) (W8# j#)
- = ST $ \s -> case writeWord8Array# mba# i# (extendWord8# j#) s of
+ = ST $ \s -> case writeWord8Array# mba# i# j# s of
s' -> (# s', () #)
unsafeFreezeByteArray :: MBA s -> ST s BA