diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2020-10-22 12:08:34 +0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-26 16:00:32 -0500 |
commit | be5d74caab64abf9d986fc7290f62731db7e73e7 (patch) | |
tree | 7b1f374333ff0fb0449e9c6834c2a8210cfba7c5 /testsuite/tests/codeGen | |
parent | 2ed3e6c0f179c06828712832d1176519cdfa82a6 (diff) | |
download | haskell-be5d74caab64abf9d986fc7290f62731db7e73e7.tar.gz |
[Sized Cmm] properly retain sizes.
This replaces all Word<N> = W<N># Word# and Int<N> = I<N># Int# with
Word<N> = W<N># Word<N># and Int<N> = I<N># Int<N>#, thus providing us
with properly sized primitives in the codegenerator instead of pretending
they are all full machine words.
This came up when implementing darwinpcs for arm64. The darwinpcs reqires
us to pack function argugments in excess of registers on the stack. While
most procedure call standards (pcs) assume arguments are just passed in
8 byte slots; and thus the caller does not know the exact signature to make
the call, darwinpcs requires us to adhere to the prototype, and thus have
the correct sizes. If we specify CInt in the FFI call, it should correspond
to the C int, and not just be Word sized, when it's only half the size.
This does change the expected output of T16402 but the new result is no
less correct as it eliminates the narrowing (instead of the `and` as was
previously done).
Bumps the array, bytestring, text, and binary submodules.
Co-Authored-By: Ben Gamari <ben@well-typed.com>
Metric Increase:
T13701
T14697
Diffstat (limited to 'testsuite/tests/codeGen')
5 files changed, 12 insertions, 12 deletions
diff --git a/testsuite/tests/codeGen/should_run/cgrun070.hs b/testsuite/tests/codeGen/should_run/cgrun070.hs index d37032a707..53f640116f 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# a + a -> W8# (narrowWord8# a) writeWord8Array :: MByteArray s -> Int -> Word8 -> ST s () writeWord8Array marr (I# i#) (W8# a) = ST $ \ s# -> - case writeWord8Array# (unMBA marr) i# a s# of + case writeWord8Array# (unMBA marr) i# (extendWord8# 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 403bc49a3c..fb1b26252f 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# (narrow16Word# (byteSwap16# w#)) +bswap16 (W16# w#) = W16# (narrowWord16# (byteSwap16# (extendWord16# w#))) bswap32 :: Word32 -> Word32 -bswap32 (W32# w#) = W32# (narrow32Word# (byteSwap32# w#)) +bswap32 (W32# w#) = W32# (narrowWord32# (byteSwap32# (extendWord32# 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 09e35b4d8a..89a4679e5f 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# (pdep8# src# mask#) + pdep (W8# src#) (W8# mask#) = W8# (narrowWord8# (pdep8# (extendWord8# src#) (extendWord8# mask#))) instance Pdep Word16 where - pdep (W16# src#) (W16# mask#) = W16# (pdep16# src# mask#) + pdep (W16# src#) (W16# mask#) = W16# (narrowWord16# (pdep16# (extendWord16# src#) (extendWord16# mask#))) instance Pdep Word32 where - pdep (W32# src#) (W32# mask#) = W32# (pdep32# src# mask#) + pdep (W32# src#) (W32# mask#) = W32# (narrowWord32# (pdep32# (extendWord32# src#) (extendWord32# 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 7fa42d74e0..a6ae331cf6 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# (pext8# src# mask#) + pext (W8# src#) (W8# mask#) = W8# (narrowWord8# (pext8# (extendWord8# src#) (extendWord8# mask#))) instance Pext Word16 where - pext (W16# src#) (W16# mask#) = W16# (pext16# src# mask#) + pext (W16# src#) (W16# mask#) = W16# (narrowWord16# (pext16# (extendWord16# src#) (extendWord16# mask#))) instance Pext Word32 where - pext (W32# src#) (W32# mask#) = W32# (pext32# src# mask#) + pext (W32# src#) (W32# mask#) = W32# (narrowWord32# (pext32# (extendWord32# src#) (extendWord32# 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 5bd0e58588..e155bc45a5 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# (indexWord8Array# ba# i#) + = W8# (narrowWord8# (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# j# s of + = ST $ \s -> case writeWord8Array# mba# i# (extendWord8# j#) s of s' -> (# s', () #) unsafeFreezeByteArray :: MBA s -> ST s BA |