diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-11-02 18:21:46 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-06 07:53:42 -0400 |
commit | 2800eee24d006cfe5ed224e35e856154ae0cd444 (patch) | |
tree | 0b885b48cb1d0b31701a97a6532215e4009414f0 /testsuite | |
parent | 20956e5784fe43781d156dd7ab02f0bff4ab41fb (diff) | |
download | haskell-2800eee24d006cfe5ed224e35e856154ae0cd444.tar.gz |
Make Word64 use Word64# on every architecture
Diffstat (limited to 'testsuite')
23 files changed, 151 insertions, 306 deletions
diff --git a/testsuite/tests/cmm/should_run/cmp64.hs b/testsuite/tests/cmm/should_run/cmp64.hs index b1786d3889..1801cf39ff 100644 --- a/testsuite/tests/cmm/should_run/cmp64.hs +++ b/testsuite/tests/cmm/should_run/cmp64.hs @@ -4,7 +4,6 @@ {-# LANGUAGE UnliftedFFITypes #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE GHCForeignImportPrim #-} -{-# LANGUAGE CPP #-} {- Test 64bit comparisons. We simply compare a number of values in different ways @@ -16,10 +15,6 @@ module Main where -#if defined(__GLASGOW_HASKELL__) -#include "MachDeps.h" -#endif - import GHC.Types import GHC.Exts import GHC.Word @@ -28,32 +23,18 @@ import Data.Bits import Control.Monad import Unsafe.Coerce -#if WORD_SIZE_IN_BITS < 64 -#define INT64 Int64# -#define WORD64 Word64# -#define I64CON I64# -#else -#define INT64 Int# -#define WORD64 Word# -#define I64CON I# -#endif - - -data I64 = I64 INT64 -data W64 = W64 WORD64 +foreign import prim "test_lt" lt_s :: Int64# -> Int64# -> Int# +foreign import prim "test_gt" gt_s :: Int64# -> Int64# -> Int# +foreign import prim "test_le" le_s :: Int64# -> Int64# -> Int# +foreign import prim "test_ge" ge_s :: Int64# -> Int64# -> Int# -foreign import prim "test_lt" lt_s :: INT64 -> INT64 -> Int# -foreign import prim "test_gt" gt_s :: INT64 -> INT64 -> Int# -foreign import prim "test_le" le_s :: INT64 -> INT64 -> Int# -foreign import prim "test_ge" ge_s :: INT64 -> INT64 -> Int# +foreign import prim "test_eq" eq_s :: Int64# -> Int64# -> Int# +foreign import prim "test_ne" ne_s :: Int64# -> Int64# -> Int# -foreign import prim "test_eq" eq_s :: INT64 -> INT64 -> Int# -foreign import prim "test_ne" ne_s :: INT64 -> INT64 -> Int# - -foreign import prim "test_ltu" lt_u :: WORD64 -> WORD64 -> Int# -foreign import prim "test_gtu" gt_u :: WORD64 -> WORD64 -> Int# -foreign import prim "test_leu" le_u :: WORD64 -> WORD64 -> Int# -foreign import prim "test_geu" ge_u :: WORD64 -> WORD64 -> Int# +foreign import prim "test_ltu" lt_u :: Word64# -> Word64# -> Int# +foreign import prim "test_gtu" gt_u :: Word64# -> Word64# -> Int# +foreign import prim "test_leu" le_u :: Word64# -> Word64# -> Int# +foreign import prim "test_geu" ge_u :: Word64# -> Word64# -> Int# wordValues :: [Word64] wordValues = do @@ -83,7 +64,7 @@ interestingValues = intValues :: [Int64] intValues = map fromIntegral wordValues -intOps :: [(INT64 -> INT64 -> Int#, String)] +intOps :: [(Int64# -> Int64# -> Int#, String)] intOps = [(lt_s, "lt_s") ,(gt_s, "gt_s") ,(le_s, "le_s") @@ -92,9 +73,8 @@ intOps = [(lt_s, "lt_s") ,(eq_s, "eq_s") ,(ne_s, "ne_s")] -testInt :: Int64 -> Int64 -> (INT64 -> INT64 -> Int#) -> String -> IO () -testInt x y op op_name = do - (I64 w1,I64 w2) <- getInts x y +testInt :: Int64 -> Int64 -> (Int64# -> Int64# -> Int#) -> String -> IO () +testInt x@(I64# w1) y@(I64# w2) op op_name = do let !res = I# (op w1 w2) putStrLn $ "(" ++ (show x) ++ " `" ++ op_name ++ "` " ++ show y ++ ") = " ++ show res return () @@ -107,14 +87,13 @@ testInts = do return $ testInt x y op op_desc sequence tests -wordOps :: [(WORD64 -> WORD64 -> Int#, String)] +wordOps :: [(Word64# -> Word64# -> Int#, String)] wordOps = [(lt_u, "lt_u") ,(gt_u, "gt_u") ,(le_u, "le_u") ,(ge_u, "ge_u")] -testWord x y op op_name = do - (W64 w1,W64 w2) <- getWords x y +testWord x@(W64# w1) y@(W64# w2) op op_name = do let !res = I# (op w1 w2) putStrLn $ "(" ++ (show x) ++ " `" ++ op_name ++ "` " ++ show y ++ ") = " ++ show res @@ -134,23 +113,3 @@ main = do print wordValues print intValues return () - - --- We want to get a I64#/W64# both and 64 and 32bit platforms. --- We unsafeCoerce on 64bit, on 32bit the unboxed argument already --- has the right type. - -getInts :: Int64 -> Int64 -> IO ( I64, I64 ) -#if WORD_SIZE_IN_BITS < 64 -getInts (I64# a1) (I64# a2) = return (I64 a1, I64 a2) -#else -getInts (I64# a1) (I64# a2) = return $ unsafeCoerce# (I64 a1, I64 a2) -#endif - - -getWords :: Word64 -> Word64 -> IO ( W64, W64 ) -#if WORD_SIZE_IN_BITS < 64 -getWords (W64# a1) (W64# a2) = return (W64 a1, W64 a2) -#else -getWords (W64# a1) (W64# a2) = return $ unsafeCoerce# (W64 a1, W64 a2) -#endif diff --git a/testsuite/tests/codeGen/should_run/T9340.hs b/testsuite/tests/codeGen/should_run/T9340.hs index 22f5824115..45f791ba73 100644 --- a/testsuite/tests/codeGen/should_run/T9340.hs +++ b/testsuite/tests/codeGen/should_run/T9340.hs @@ -1,5 +1,4 @@ {-# LANGUAGE MagicHash #-} -{-# LANGUAGE CPP #-} import Control.Monad import Data.Bits @@ -7,8 +6,6 @@ import GHC.Exts import GHC.Word import Numeric (showHex) -#include "MachDeps.h" - -- Reference Implementation -- count trailing zeros @@ -61,13 +58,8 @@ ctzIUT32 (W# x#) = W# (ctz32# x#) clzIUT32 (W# x#) = W# (clz32# x#) ctzIUT64, clzIUT64 :: Word64 -> Word -#if WORD_SIZE_IN_BITS < 64 ctzIUT64 (W64# x#) = W# (ctz64# x#) clzIUT64 (W64# x#) = W# (clz64# x#) -#else -ctzIUT64 (W64# x#) = W# (ctz64# (wordToWord64# x#)) -clzIUT64 (W64# x#) = W# (clz64# (wordToWord64# x#)) -#endif main :: IO () main = do diff --git a/testsuite/tests/codeGen/should_run/cgrun071.hs b/testsuite/tests/codeGen/should_run/cgrun071.hs index c8ee2d17f9..21ee04121b 100644 --- a/testsuite/tests/codeGen/should_run/cgrun071.hs +++ b/testsuite/tests/codeGen/should_run/cgrun071.hs @@ -30,12 +30,7 @@ popcnt32 :: Word -> Word popcnt32 (W# w#) = W# (popCnt32# w#) popcnt64 :: Word64 -> Word -popcnt64 (W64# w#) = -#if SIZEOF_HSWORD == 4 - W# (popCnt64# w#) -#else - W# (popCnt# w#) -#endif +popcnt64 (W64# w#) = W# (popCnt64# w#) -- Cribbed from https://gitlab.haskell.org/ghc/ghc/issues/3563 slowPopcnt :: Word -> Word diff --git a/testsuite/tests/codeGen/should_run/cgrun072.hs b/testsuite/tests/codeGen/should_run/cgrun072.hs index 729564b631..b97ce56d01 100644 --- a/testsuite/tests/codeGen/should_run/cgrun072.hs +++ b/testsuite/tests/codeGen/should_run/cgrun072.hs @@ -37,11 +37,7 @@ bswap32 :: Word32 -> Word32 bswap32 (W32# w#) = W32# (wordToWord32# (byteSwap32# (word32ToWord# w#))) bswap64 :: Word64 -> Word64 -#if WORD_SIZE_IN_BITS < 64 bswap64 (W64# w#) = W64# (byteSwap64# w#) -#else -bswap64 (W64# w#) = W64# (word64ToWord# (byteSwap64# (wordToWord64# w#))) -#endif slowBswap64 :: Word64 -> Word64 slowBswap64 w = diff --git a/testsuite/tests/codeGen/should_run/cgrun075.hs b/testsuite/tests/codeGen/should_run/cgrun075.hs index 1cac98b2dd..5babde1254 100644 --- a/testsuite/tests/codeGen/should_run/cgrun075.hs +++ b/testsuite/tests/codeGen/should_run/cgrun075.hs @@ -36,11 +36,7 @@ instance Pdep Word32 where pdep (W32# src#) (W32# mask#) = W32# (wordToWord32# (pdep32# (word32ToWord# src#) (word32ToWord# mask#))) instance Pdep Word64 where -#if WORD_SIZE_IN_BITS < 64 pdep (W64# src#) (W64# mask#) = W64# (pdep64# src# mask#) -#else - pdep (W64# src#) (W64# mask#) = W64# (word64ToWord# (pdep64# (wordToWord64# src#) (wordToWord64# mask#))) -#endif class SlowPdep a where slowPdep :: a -> a -> a diff --git a/testsuite/tests/codeGen/should_run/cgrun076.hs b/testsuite/tests/codeGen/should_run/cgrun076.hs index ce26e375d0..4779b5beb8 100644 --- a/testsuite/tests/codeGen/should_run/cgrun076.hs +++ b/testsuite/tests/codeGen/should_run/cgrun076.hs @@ -36,11 +36,7 @@ instance Pext Word32 where pext (W32# src#) (W32# mask#) = W32# (wordToWord32# (pext32# (word32ToWord# src#) (word32ToWord# mask#))) instance Pext Word64 where -#if WORD_SIZE_IN_BITS < 64 pext (W64# src#) (W64# mask#) = W64# (pext64# src# mask#) -#else - pext (W64# src#) (W64# mask#) = W64# (word64ToWord# (pext64# (wordToWord64# src#) (wordToWord64# mask#))) -#endif class SlowPext a where slowPext :: a -> a -> a diff --git a/testsuite/tests/codeGen/should_run/cgrun077.hs b/testsuite/tests/codeGen/should_run/cgrun077.hs index 2058ad7b18..fa224e9eca 100644 --- a/testsuite/tests/codeGen/should_run/cgrun077.hs +++ b/testsuite/tests/codeGen/should_run/cgrun077.hs @@ -36,12 +36,7 @@ lzcnt32 :: Word -> Word lzcnt32 (W# w#) = W# (clz32# w#) lzcnt64 :: Word64 -> Word -lzcnt64 (W64# w#) = -#if SIZEOF_HSWORD == 4 - W# (clz64# w#) -#else - W# (clz# w#) -#endif +lzcnt64 (W64# w#) = W# (clz64# w#) lzcnt_slow :: Int -> Word -> Word lzcnt_slow size x = fromIntegral $ min size $ length $ takeWhile (== False) $ reverse $ map (testBit x) [0 .. size - 1] @@ -59,12 +54,7 @@ tzcnt32 :: Word -> Word tzcnt32 (W# w#) = W# (ctz32# w#) tzcnt64 :: Word64 -> Word -tzcnt64 (W64# w#) = -#if SIZEOF_HSWORD == 4 - W# (ctz64# w#) -#else - W# (ctz# w#) -#endif +tzcnt64 (W64# w#) = W# (ctz64# w#) tzcnt_slow :: Int -> Word -> Word tzcnt_slow size x = fromIntegral $ min size $ length $ takeWhile (== False) $ map (testBit x) [0 .. size - 1] diff --git a/testsuite/tests/concurrent/should_run/AtomicPrimops.hs b/testsuite/tests/concurrent/should_run/AtomicPrimops.hs index 05ac80dcad..b8adb3c621 100644 --- a/testsuite/tests/concurrent/should_run/AtomicPrimops.hs +++ b/testsuite/tests/concurrent/should_run/AtomicPrimops.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE UnboxedTuples #-} @@ -15,8 +14,6 @@ import GHC.Int import GHC.IO import GHC.Word -#include "MachDeps.h" - -- | Iterations per worker. iters :: Word iters = 1000000 @@ -553,11 +550,7 @@ readInt32Array (MBA mba#) (I# ix#) = IO $ \ s# -> readInt64Array :: MByteArray -> Int -> IO Int64 readInt64Array (MBA mba#) (I# ix#) = IO $ \ s# -> case readInt64Array# mba# ix# s# of -#if WORD_SIZE_IN_BITS < 64 (# s2#, n# #) -> (# s2#, I64# n# #) -#else - (# s2#, n# #) -> (# s2#, I64# (int64ToInt# n#) #) -#endif atomicWriteIntArray :: MByteArray -> Int -> Int -> IO () atomicWriteIntArray (MBA mba#) (I# ix#) (I# n#) = IO $ \ s# -> @@ -591,13 +584,8 @@ casInt32Array (MBA mba#) (I# ix#) (I32# old#) (I32# new#) = IO $ \ s# -> casInt64Array :: MByteArray -> Int -> Int64 -> Int64 -> IO Int64 casInt64Array (MBA mba#) (I# ix#) (I64# old#) (I64# new#) = IO $ \ s# -> -#if WORD_SIZE_IN_BITS < 64 case casInt64Array# mba# ix# old# new# s# of (# s2#, old2# #) -> (# s2#, I64# old2# #) -#else - case casInt64Array# mba# ix# (intToInt64# old#) (intToInt64# new#) s# of - (# s2#, old2# #) -> (# s2#, I64# (int64ToInt# old2#) #) -#endif ------------------------------------------------------------------------ -- Wrappers around Addr# @@ -663,10 +651,5 @@ atomicCasWord32Ptr (Ptr addr#) (W32# old#) (W32# new#) = IO $ \ s# -> (# s2#, old2# #) -> (# s2#, W32# old2# #) atomicCasWord64Ptr :: Ptr Word64 -> Word64 -> Word64 -> IO Word64 atomicCasWord64Ptr (Ptr addr#) (W64# old#) (W64# new#) = IO $ \ s# -> -#if WORD_SIZE_IN_BITS < 64 case atomicCasWord64Addr# addr# old# new# s# of (# s2#, old2# #) -> (# s2#, W64# old2# #) -#else - case atomicCasWord64Addr# addr# (wordToWord64# old#) (wordToWord64# new#) s# of - (# s2#, old2# #) -> (# s2#, W64# (word64ToWord# old2#) #) -#endif diff --git a/testsuite/tests/ghci/should_run/UnboxedTuples/ByteCode.hs b/testsuite/tests/ghci/should_run/UnboxedTuples/ByteCode.hs index a1bce35ad0..e2f7997b77 100644 --- a/testsuite/tests/ghci/should_run/UnboxedTuples/ByteCode.hs +++ b/testsuite/tests/ghci/should_run/UnboxedTuples/ByteCode.hs @@ -1,14 +1,6 @@ {-# LANGUAGE CPP, UnboxedTuples, MagicHash, ScopedTypeVariables, PolyKinds #-} {-# OPTIONS_GHC -fbyte-code #-} -#include "MachDeps.h" - -#if WORD_SIZE_IN_BITS < 64 -#define WW Word64 -#else -#define WW Word -#endif - module ByteCode where import GHC.Exts diff --git a/testsuite/tests/ghci/should_run/UnboxedTuples/Common.hs-incl b/testsuite/tests/ghci/should_run/UnboxedTuples/Common.hs-incl index 46cefa025e..b6cf760ed7 100644 --- a/testsuite/tests/ghci/should_run/UnboxedTuples/Common.hs-incl +++ b/testsuite/tests/ghci/should_run/UnboxedTuples/Common.hs-incl @@ -131,10 +131,10 @@ type T4c = Float -> Double -> Word64 -> Integer -> Float -> Double -> Word64 -> Integer -> Float -> Double -> Word64 -> Integer -> Float -> Double -> Word64 -> Integer - -> (# Float#, Double#, WW#, Integer - , Float#, Double#, WW#, Integer - , Float#, Double#, WW#, Integer - , Float#, Double#, WW#, Integer + -> (# Float#, Double#, Word64#, Integer + , Float#, Double#, Word64#, Integer + , Float#, Double#, Word64#, Integer + , Float#, Double#, Word64#, Integer #) tuple4c :: T4c tuple4c (F# f1) (D# d1) (W64# w1) i1 @@ -179,10 +179,10 @@ type T5 = Int -> Word64 -> Int -> Word64 -> Int -> Word64 -> Int -> Word64 -> Int -> Word64 -> Int -> Word64 -> Int -> Word64 -> Int -> Word64 - -> (# Int, WW#, Int, WW# - , Int, WW#, Int, WW# - , Int, WW#, Int, WW# - , Int, WW#, Int, WW# + -> (# Int, Word64#, Int, Word64# + , Int, Word64#, Int, Word64# + , Int, Word64#, Int, Word64# + , Int, Word64#, Int, Word64# #) tuple5 :: T5 diff --git a/testsuite/tests/ghci/should_run/UnboxedTuples/Obj.hs b/testsuite/tests/ghci/should_run/UnboxedTuples/Obj.hs index 190b8f1683..44e06dbb62 100644 --- a/testsuite/tests/ghci/should_run/UnboxedTuples/Obj.hs +++ b/testsuite/tests/ghci/should_run/UnboxedTuples/Obj.hs @@ -3,12 +3,6 @@ #include "MachDeps.h" -#if WORD_SIZE_IN_BITS < 64 -#define WW Word64 -#else -#define WW Word -#endif - module Obj where import GHC.Exts diff --git a/testsuite/tests/numeric/should_compile/T16402.stderr-ws-64 b/testsuite/tests/numeric/should_compile/T16402.stderr-ws-64 index 6828811655..39a7281ec0 100644 --- a/testsuite/tests/numeric/should_compile/T16402.stderr-ws-64 +++ b/testsuite/tests/numeric/should_compile/T16402.stderr-ws-64 @@ -1,37 +1,44 @@ ==================== Tidy Core ==================== Result size of Tidy Core - = {terms: 36, types: 19, coercions: 0, joins: 0/0} + = {terms: 55, types: 22, coercions: 0, joins: 0/0} --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} $trModule4 = "main"# --- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} $trModule3 = TrNameS $trModule4 --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} $trModule2 = "T16402"# --- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} $trModule1 = TrNameS $trModule2 --- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} $trModule = Module $trModule3 $trModule1 --- RHS size: {terms: 8, types: 3, coercions: 0, joins: 0/0} smallWord_bar - = \ x -> case x of { W64# x# -> W64# (and# x# 0xffff##) } + = \ x -> + case x of { W64# x# -> + W64# + (int64ToWord64# + (intToInt64# (word2Int# (and# (word64ToWord# x#) 0xffff##)))) + } --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} smallWord_foo = smallWord_bar --- RHS size: {terms: 8, types: 3, coercions: 0, joins: 0/0} smallInt_bar = \ x -> - case x of { I64# x# -> I64# (int16ToInt# (intToInt16# x#)) } + case x of { I64# x1 -> + I64# (intToInt64# (int16ToInt# (intToInt16# (int64ToInt# x1)))) + } --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} -smallInt_foo = smallInt_bar +smallInt_foo + = \ x -> + case x of { I64# x# -> + I64# + (intToInt64# + (int16ToInt# + (intToInt16# + (int64ToInt# + (word64ToInt64# (and64# (int64ToWord64# x#) 0x0012ffff##64)))))) + } diff --git a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr index afd80e9cdd..de44e14add 100644 --- a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr @@ -153,8 +153,7 @@ (NoEpAnns) (EpaComments [])) - {HsInt{64}Prim (1) (SourceText - "1")})))) + {HsInt{64}Prim (1) (NoSourceText)})))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) (HsVar @@ -313,8 +312,7 @@ (NoEpAnns) (EpaComments [])) - {HsInt{64}Prim (3) (SourceText - "3")})))) + {HsInt{64}Prim (3) (NoSourceText)})))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) (HsVar @@ -473,8 +471,7 @@ (NoEpAnns) (EpaComments [])) - {HsInt{64}Prim (0) (SourceText - "0")})))) + {HsInt{64}Prim (0) (NoSourceText)})))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) (HsVar @@ -633,8 +630,7 @@ (NoEpAnns) (EpaComments [])) - {HsInt{64}Prim (0) (SourceText - "0")})))) + {HsInt{64}Prim (0) (NoSourceText)})))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) (HsVar @@ -793,8 +789,7 @@ (NoEpAnns) (EpaComments [])) - {HsInt{64}Prim (0) (SourceText - "0")})))) + {HsInt{64}Prim (0) (NoSourceText)})))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) (HsVar diff --git a/testsuite/tests/primops/should_run/T4442.hs b/testsuite/tests/primops/should_run/T4442.hs index ad0c882533..f651224de7 100644 --- a/testsuite/tests/primops/should_run/T4442.hs +++ b/testsuite/tests/primops/should_run/T4442.hs @@ -109,34 +109,6 @@ testIntArray name0 index read write val0 len = do doOne name val = test name index read write val (intToBytes (fromIntegral val) len) len -#if WORD_SIZE_IN_BITS == 64 -testInt64Array = testIntArray -#else -testInt64Array :: - String - -> (ByteArray# -> Int# -> Int64#) - -> (MutableByteArray# RealWorld -> Int# -> State# RealWorld - -> (# State# RealWorld, Int64# #)) - -> (MutableByteArray# RealWorld -> Int# -> Int64# -> State# RealWorld - -> State# RealWorld) - -> Int64 - -> Int - -> IO () -testInt64Array name0 index read write val0 len = do - doOne (name0 ++ " positive") val0 - doOne (name0 ++ " negative") (negate val0) - where - doOne :: String -> Int64 -> IO () - doOne name val = test - name - (\arr i -> I64# (index arr i)) - (\arr i s -> case read arr i s of (# s', a #) -> (# s', I64# a #)) - (\arr i (I64# a) s -> write arr i a s) - val - (intToBytes (fromIntegral val) len) - len -#endif - testWordArray :: (Eq a, Show a, Integral a) => String -> (ByteArray# -> Int# -> a) @@ -151,29 +123,6 @@ testWordArray name index read write val len = test name index read write val (intToBytes (fromIntegral val) len) len -#if WORD_SIZE_IN_BITS == 64 -testWord64Array = testWordArray -#else -testWord64Array :: - String - -> (ByteArray# -> Int# -> Word64#) - -> (MutableByteArray# RealWorld -> Int# -> State# RealWorld - -> (# State# RealWorld, Word64# #)) - -> (MutableByteArray# RealWorld -> Int# -> Word64# -> State# RealWorld - -> State# RealWorld) - -> Word64 - -> Int - -> IO () -testWord64Array name index read write val len = test - name - (\arr i -> W64# (index arr i)) - (\arr i s -> case read arr i s of (# s', a #) -> (# s', W64# a #)) - (\arr i (W64# a) s -> write arr i a s) - val - (intToBytes (fromIntegral val) len) - len -#endif - wordSizeInBytes :: Int wordSizeInBytes = WORD_SIZE_IN_BITS `div` 8 @@ -222,19 +171,11 @@ main = do (\arr i s -> case readWord8ArrayAsInt32# arr i s of (# s', a #) -> (# s', I32# a #)) (\arr i (I32# a) s -> writeWord8ArrayAsInt32# arr i a s) 12345678 4 -#if WORD_SIZE_IN_BITS < 64 - testInt64Array "Int64#" + testIntArray "Int64#" (\arr i -> I64# (indexWord8ArrayAsInt64# arr i)) (\arr i s -> case readWord8ArrayAsInt64# arr i s of (# s', a #) -> (# s', I64# a #)) (\arr i (I64# a) s -> writeWord8ArrayAsInt64# arr i a s) 1234567890123 8 -#else - testInt64Array "Int64#" - (\arr i -> I64# (int64ToInt# (indexWord8ArrayAsInt64# arr i))) - (\arr i s -> case readWord8ArrayAsInt64# arr i s of (# s', a #) -> (# s', I64# (int64ToInt# a) #)) - (\arr i (I64# a) s -> writeWord8ArrayAsInt64# arr i (intToInt64# a) s) - 1234567890123 8 -#endif testIntArray "Int#" (\arr i -> I# (indexWord8ArrayAsInt# arr i)) (\arr i s -> case readWord8ArrayAsInt# arr i s of (# s', a #) -> (# s', I# a #)) @@ -256,19 +197,11 @@ main = do (\arr i s -> case readWord8ArrayAsWord32# arr i s of (# s', a #) -> (# s', W32# a #)) (\arr i (W32# a) s -> writeWord8ArrayAsWord32# arr i a s) 12345678 4 -#if WORD_SIZE_IN_BITS < 64 - testWord64Array "Word64#" + testWordArray "Word64#" (\arr i -> W64# (indexWord8ArrayAsWord64# arr i)) (\arr i s -> case readWord8ArrayAsWord64# arr i s of (# s', a #) -> (# s', W64# a #)) (\arr i (W64# a) s -> writeWord8ArrayAsWord64# arr i a s) 1234567890123 8 -#else - testWord64Array "Word64#" - (\arr i -> W64# (word64ToWord# (indexWord8ArrayAsWord64# arr i))) - (\arr i s -> case readWord8ArrayAsWord64# arr i s of (# s', a #) -> (# s', W64# (word64ToWord# a) #)) - (\arr i (W64# a) s -> writeWord8ArrayAsWord64# arr i (wordToWord64# a) s) - 1234567890123 8 -#endif testWordArray "Word#" (\arr i -> W# (indexWord8ArrayAsWord# arr i)) (\arr i s -> case readWord8ArrayAsWord# arr i s of (# s', a #) -> (# s', W# a #)) diff --git a/testsuite/tests/roles/should_compile/Roles1.stderr b/testsuite/tests/roles/should_compile/Roles1.stderr index 3941c2d01f..f547b33fad 100644 --- a/testsuite/tests/roles/should_compile/Roles1.stderr +++ b/testsuite/tests/roles/should_compile/Roles1.stderr @@ -25,60 +25,60 @@ Dependent packages: [base-4.16.0.0] ==================== Typechecker ==================== Roles1.$tcT7 = GHC.Types.TyCon - 178606230775360129## 14564382578551945561## Roles1.$trModule - (GHC.Types.TrNameS "T7"#) 1 $krep + 178606230775360129##64 14564382578551945561##64 Roles1.$trModule + (GHC.Types.TrNameS "T7"#) 1# $krep Roles1.$tc'K7 = GHC.Types.TyCon - 15901479081375327280## 4842873210599704617## Roles1.$trModule - (GHC.Types.TrNameS "'K7"#) 3 $krep + 15901479081375327280##64 4842873210599704617##64 Roles1.$trModule + (GHC.Types.TrNameS "'K7"#) 3# $krep Roles1.$tcT6 = GHC.Types.TyCon - 7244893995195634045## 6882827069359931041## Roles1.$trModule - (GHC.Types.TrNameS "T6"#) 1 $krep + 7244893995195634045##64 6882827069359931041##64 Roles1.$trModule + (GHC.Types.TrNameS "T6"#) 1# $krep Roles1.$tc'K6 = GHC.Types.TyCon - 13928703131159360198## 9274401506945696896## Roles1.$trModule - (GHC.Types.TrNameS "'K6"#) 2 $krep + 13928703131159360198##64 9274401506945696896##64 Roles1.$trModule + (GHC.Types.TrNameS "'K6"#) 2# $krep Roles1.$tcT5 = GHC.Types.TyCon - 12033401645911719002## 6369139038321702301## Roles1.$trModule - (GHC.Types.TrNameS "T5"#) 0 GHC.Types.krep$*Arr* + 12033401645911719002##64 6369139038321702301##64 Roles1.$trModule + (GHC.Types.TrNameS "T5"#) 0# GHC.Types.krep$*Arr* Roles1.$tc'K5 = GHC.Types.TyCon - 5548842497263642061## 18349261927117571882## Roles1.$trModule - (GHC.Types.TrNameS "'K5"#) 1 $krep + 5548842497263642061##64 18349261927117571882##64 Roles1.$trModule + (GHC.Types.TrNameS "'K5"#) 1# $krep Roles1.$tcT4 = GHC.Types.TyCon - 15834077582937152787## 17059037094835388922## Roles1.$trModule - (GHC.Types.TrNameS "T4"#) 0 $krep + 15834077582937152787##64 17059037094835388922##64 Roles1.$trModule + (GHC.Types.TrNameS "T4"#) 0# $krep Roles1.$tc'K4 = GHC.Types.TyCon - 10188453925450404995## 4762093850599364042## Roles1.$trModule - (GHC.Types.TrNameS "'K4"#) 2 $krep + 10188453925450404995##64 4762093850599364042##64 Roles1.$trModule + (GHC.Types.TrNameS "'K4"#) 2# $krep Roles1.$tcT3 = GHC.Types.TyCon - 13341737262627465733## 14527452670364737316## Roles1.$trModule - (GHC.Types.TrNameS "T3"#) 1 $krep + 13341737262627465733##64 14527452670364737316##64 Roles1.$trModule + (GHC.Types.TrNameS "T3"#) 1# $krep Roles1.$tc'K3 = GHC.Types.TyCon - 14534968069054730342## 6860808298964464185## Roles1.$trModule - (GHC.Types.TrNameS "'K3"#) 2 $krep + 14534968069054730342##64 6860808298964464185##64 Roles1.$trModule + (GHC.Types.TrNameS "'K3"#) 2# $krep Roles1.$tcT2 = GHC.Types.TyCon - 12900773996789723956## 9313087549503346504## Roles1.$trModule - (GHC.Types.TrNameS "T2"#) 0 GHC.Types.krep$*Arr* + 12900773996789723956##64 9313087549503346504##64 Roles1.$trModule + (GHC.Types.TrNameS "T2"#) 0# GHC.Types.krep$*Arr* Roles1.$tc'K2 = GHC.Types.TyCon - 11054915488163123841## 10799789256744079155## Roles1.$trModule - (GHC.Types.TrNameS "'K2"#) 1 $krep + 11054915488163123841##64 10799789256744079155##64 Roles1.$trModule + (GHC.Types.TrNameS "'K2"#) 1# $krep Roles1.$tcT1 = GHC.Types.TyCon - 13228660854624297872## 14494320157476678712## Roles1.$trModule - (GHC.Types.TrNameS "T1"#) 0 GHC.Types.krep$*Arr* + 13228660854624297872##64 14494320157476678712##64 Roles1.$trModule + (GHC.Types.TrNameS "T1"#) 0# GHC.Types.krep$*Arr* Roles1.$tc'K1 = GHC.Types.TyCon - 1265606750138351672## 7033043930969109074## Roles1.$trModule - (GHC.Types.TrNameS "'K1"#) 1 $krep + 1265606750138351672##64 7033043930969109074##64 Roles1.$trModule + (GHC.Types.TrNameS "'K1"#) 1# $krep $krep [InlPrag=[~]] = GHC.Types.KindRepVar 1 $krep [InlPrag=[~]] = GHC.Types.KindRepVar 0 $krep [InlPrag=[~]] = GHC.Types.KindRepVar 0 diff --git a/testsuite/tests/roles/should_compile/Roles14.stderr b/testsuite/tests/roles/should_compile/Roles14.stderr index ec103457b1..a1d95b7298 100644 --- a/testsuite/tests/roles/should_compile/Roles14.stderr +++ b/testsuite/tests/roles/should_compile/Roles14.stderr @@ -11,12 +11,12 @@ Dependent packages: [base-4.16.0.0] ==================== Typechecker ==================== Roles12.$tcC2 = GHC.Types.TyCon - 7996680154108933333## 9454227235464419996## Roles12.$trModule - (GHC.Types.TrNameS "C2"#) 0 $krep + 7996680154108933333##64 9454227235464419996##64 Roles12.$trModule + (GHC.Types.TrNameS "C2"#) 0# $krep Roles12.$tc'C:C2 = GHC.Types.TyCon - 7087988437584478859## 11477953550142401435## Roles12.$trModule - (GHC.Types.TrNameS "'C:C2"#) 1 $krep + 7087988437584478859##64 11477953550142401435##64 Roles12.$trModule + (GHC.Types.TrNameS "'C:C2"#) 1# $krep $krep [InlPrag=[~]] = GHC.Types.KindRepVar 0 $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep diff --git a/testsuite/tests/roles/should_compile/Roles2.stderr b/testsuite/tests/roles/should_compile/Roles2.stderr index 1b8d2172e4..39627de6de 100644 --- a/testsuite/tests/roles/should_compile/Roles2.stderr +++ b/testsuite/tests/roles/should_compile/Roles2.stderr @@ -11,20 +11,20 @@ Dependent packages: [base-4.16.0.0] ==================== Typechecker ==================== Roles2.$tcT2 = GHC.Types.TyCon - 9065817229114433861## 13399581642971864140## Roles2.$trModule - (GHC.Types.TrNameS "T2"#) 0 GHC.Types.krep$*Arr* + 9065817229114433861##64 13399581642971864140##64 Roles2.$trModule + (GHC.Types.TrNameS "T2"#) 0# GHC.Types.krep$*Arr* Roles2.$tc'K2 = GHC.Types.TyCon - 17395957229042313563## 12263882107019815181## Roles2.$trModule - (GHC.Types.TrNameS "'K2"#) 1 $krep + 17395957229042313563##64 12263882107019815181##64 Roles2.$trModule + (GHC.Types.TrNameS "'K2"#) 1# $krep Roles2.$tcT1 = GHC.Types.TyCon - 10310640733256438505## 9162099558816022096## Roles2.$trModule - (GHC.Types.TrNameS "T1"#) 0 GHC.Types.krep$*Arr* + 10310640733256438505##64 9162099558816022096##64 Roles2.$trModule + (GHC.Types.TrNameS "T1"#) 0# GHC.Types.krep$*Arr* Roles2.$tc'K1 = GHC.Types.TyCon - 16530009231990968394## 11761390951471299534## Roles2.$trModule - (GHC.Types.TrNameS "'K1"#) 1 $krep + 16530009231990968394##64 11761390951471299534##64 Roles2.$trModule + (GHC.Types.TrNameS "'K1"#) 1# $krep $krep [InlPrag=[~]] = GHC.Types.KindRepVar 0 $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep diff --git a/testsuite/tests/roles/should_compile/Roles3.stderr b/testsuite/tests/roles/should_compile/Roles3.stderr index 1613bcdf7a..41016dd5b8 100644 --- a/testsuite/tests/roles/should_compile/Roles3.stderr +++ b/testsuite/tests/roles/should_compile/Roles3.stderr @@ -26,28 +26,28 @@ Dependent packages: [base-4.16.0.0] ==================== Typechecker ==================== Roles3.$tcC4 = GHC.Types.TyCon - 6800596812149592130## 15513203864133461281## Roles3.$trModule - (GHC.Types.TrNameS "C4"#) 0 $krep + 6800596812149592130##64 15513203864133461281##64 Roles3.$trModule + (GHC.Types.TrNameS "C4"#) 0# $krep Roles3.$tcC3 = GHC.Types.TyCon - 5076086601454991970## 10299714674904836194## Roles3.$trModule - (GHC.Types.TrNameS "C3"#) 0 $krep + 5076086601454991970##64 10299714674904836194##64 Roles3.$trModule + (GHC.Types.TrNameS "C3"#) 0# $krep Roles3.$tcC2 = GHC.Types.TyCon - 7902873224172523979## 11840994447152209031## Roles3.$trModule - (GHC.Types.TrNameS "C2"#) 0 $krep + 7902873224172523979##64 11840994447152209031##64 Roles3.$trModule + (GHC.Types.TrNameS "C2"#) 0# $krep Roles3.$tc'C:C2 = GHC.Types.TyCon - 11218882737915989529## 9454910899374397367## Roles3.$trModule - (GHC.Types.TrNameS "'C:C2"#) 2 $krep + 11218882737915989529##64 9454910899374397367##64 Roles3.$trModule + (GHC.Types.TrNameS "'C:C2"#) 2# $krep Roles3.$tcC1 = GHC.Types.TyCon - 11013585501375994163## 16371608655219610659## Roles3.$trModule - (GHC.Types.TrNameS "C1"#) 0 $krep + 11013585501375994163##64 16371608655219610659##64 Roles3.$trModule + (GHC.Types.TrNameS "C1"#) 0# $krep Roles3.$tc'C:C1 = GHC.Types.TyCon - 4508088879886988796## 13962145553903222779## Roles3.$trModule - (GHC.Types.TrNameS "'C:C1"#) 1 $krep + 4508088879886988796##64 13962145553903222779##64 Roles3.$trModule + (GHC.Types.TrNameS "'C:C1"#) 1# $krep $krep [InlPrag=[~]] = GHC.Types.KindRepVar 0 $krep [InlPrag=[~]] = GHC.Types.KindRepVar 1 $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep diff --git a/testsuite/tests/roles/should_compile/Roles4.stderr b/testsuite/tests/roles/should_compile/Roles4.stderr index 803825d4ec..4d8bc6666a 100644 --- a/testsuite/tests/roles/should_compile/Roles4.stderr +++ b/testsuite/tests/roles/should_compile/Roles4.stderr @@ -14,20 +14,20 @@ Dependent packages: [base-4.16.0.0] ==================== Typechecker ==================== Roles4.$tcC3 = GHC.Types.TyCon - 7508642517340826358## 16938219270597865136## Roles4.$trModule - (GHC.Types.TrNameS "C3"#) 0 $krep + 7508642517340826358##64 16938219270597865136##64 Roles4.$trModule + (GHC.Types.TrNameS "C3"#) 0# $krep Roles4.$tc'C:C3 = GHC.Types.TyCon - 3133378316178104365## 15809386433947157376## Roles4.$trModule - (GHC.Types.TrNameS "'C:C3"#) 1 $krep + 3133378316178104365##64 15809386433947157376##64 Roles4.$trModule + (GHC.Types.TrNameS "'C:C3"#) 1# $krep Roles4.$tcC1 = GHC.Types.TyCon - 13392243382482428602## 1780037961948725012## Roles4.$trModule - (GHC.Types.TrNameS "C1"#) 0 $krep + 13392243382482428602##64 1780037961948725012##64 Roles4.$trModule + (GHC.Types.TrNameS "C1"#) 0# $krep Roles4.$tc'C:C1 = GHC.Types.TyCon - 3870707671502302648## 10631907186261837450## Roles4.$trModule - (GHC.Types.TrNameS "'C:C1"#) 1 $krep + 3870707671502302648##64 10631907186261837450##64 Roles4.$trModule + (GHC.Types.TrNameS "'C:C1"#) 1# $krep $krep [InlPrag=[~]] = GHC.Types.KindRepVar 0 $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep diff --git a/testsuite/tests/roles/should_compile/T8958.stderr b/testsuite/tests/roles/should_compile/T8958.stderr index 196ff7e7c7..6a6e3dc627 100644 --- a/testsuite/tests/roles/should_compile/T8958.stderr +++ b/testsuite/tests/roles/should_compile/T8958.stderr @@ -21,28 +21,28 @@ Dependent packages: [base-4.16.0.0] ==================== Typechecker ==================== T8958.$tcMap = GHC.Types.TyCon - 16542473435673943392## 5374201132143305512## T8958.$trModule - (GHC.Types.TrNameS "Map"#) 0 GHC.Types.krep$*->*->* + 16542473435673943392##64 5374201132143305512##64 T8958.$trModule + (GHC.Types.TrNameS "Map"#) 0# GHC.Types.krep$*->*->* T8958.$tc'MkMap = GHC.Types.TyCon - 2942839876828444488## 3989137838066763457## T8958.$trModule - (GHC.Types.TrNameS "'MkMap"#) 2 $krep + 2942839876828444488##64 3989137838066763457##64 T8958.$trModule + (GHC.Types.TrNameS "'MkMap"#) 2# $krep T8958.$tcRepresentational = GHC.Types.TyCon - 12809567151893673426## 12159693688248149156## T8958.$trModule - (GHC.Types.TrNameS "Representational"#) 0 $krep + 12809567151893673426##64 12159693688248149156##64 T8958.$trModule + (GHC.Types.TrNameS "Representational"#) 0# $krep T8958.$tc'C:Representational = GHC.Types.TyCon - 2358772282532242424## 5444038897914446879## T8958.$trModule - (GHC.Types.TrNameS "'C:Representational"#) 1 $krep + 2358772282532242424##64 5444038897914446879##64 T8958.$trModule + (GHC.Types.TrNameS "'C:Representational"#) 1# $krep T8958.$tcNominal = GHC.Types.TyCon - 12224997609886144634## 9866011944332051160## T8958.$trModule - (GHC.Types.TrNameS "Nominal"#) 0 $krep + 12224997609886144634##64 9866011944332051160##64 T8958.$trModule + (GHC.Types.TrNameS "Nominal"#) 0# $krep T8958.$tc'C:Nominal = GHC.Types.TyCon - 10562260635335201742## 1215478186250709459## T8958.$trModule - (GHC.Types.TrNameS "'C:Nominal"#) 1 $krep + 10562260635335201742##64 1215478186250709459##64 T8958.$trModule + (GHC.Types.TrNameS "'C:Nominal"#) 1# $krep $krep [InlPrag=[~]] = GHC.Types.KindRepVar 0 $krep [InlPrag=[~]] = GHC.Types.KindRepVar 1 $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep diff --git a/testsuite/tests/simplCore/should_compile/T8832.stdout-ws-64 b/testsuite/tests/simplCore/should_compile/T8832.stdout-ws-64 index 625102854d..e99bbde15b 100644 --- a/testsuite/tests/simplCore/should_compile/T8832.stdout-ws-64 +++ b/testsuite/tests/simplCore/should_compile/T8832.stdout-ws-64 @@ -2,10 +2,10 @@ i = GHC.Types.I# 0# i8 = GHC.Int.I8# 0#8 i16 = GHC.Int.I16# 0#16 i32 = GHC.Int.I32# 0#32 -i64 = GHC.Int.I64# 0# +i64 = GHC.Int.I64# 0#64 w = GHC.Types.W# 0## w8 = GHC.Word.W8# 0##8 w16 = GHC.Word.W16# 0##16 w32 = GHC.Word.W32# 0##32 -w64 = GHC.Word.W64# 0## +w64 = GHC.Word.W64# 0##64 z = GHC.Num.Integer.IS 0# diff --git a/testsuite/tests/simplCore/should_run/T20203.stderr-ws-64 b/testsuite/tests/simplCore/should_run/T20203.stderr-ws-64 index 1ef5a70af8..194091e5f3 100644 --- a/testsuite/tests/simplCore/should_run/T20203.stderr-ws-64 +++ b/testsuite/tests/simplCore/should_run/T20203.stderr-ws-64 @@ -1,7 +1,7 @@ ==================== Tidy Core ==================== Result size of Tidy Core - = {terms: 280, types: 141, coercions: 0, joins: 0/0} + = {terms: 290, types: 141, coercions: 0, joins: 0/0} bitOrTwoVarInt = \ x y -> @@ -122,17 +122,34 @@ bitAndInt32 bitOrTwoVarInt64 = \ x y -> case x of { I64# x# -> - case y of { I64# x#1 -> I64# (orI# 255# (orI# x# x#1)) } + case y of { I64# x#1 -> + I64# + (word64ToInt64# + (or64# 255##64 (or64# (int64ToWord64# x#) (int64ToWord64# x#1)))) + } } bitAndTwoVarInt64 = \ x y -> case x of { I64# x# -> - case y of { I64# x#1 -> I64# (andI# 170# (andI# x# x#1)) } + case y of { I64# x#1 -> + I64# + (word64ToInt64# + (and64# 170##64 (and64# (int64ToWord64# x#) (int64ToWord64# x#1)))) + } } -bitOrInt64 = \ x -> case x of { I64# x# -> I64# (orI# 255# x#) } +bitOrInt64 + = \ x -> + case x of { I64# x# -> + I64# (word64ToInt64# (or64# 255##64 (int64ToWord64# x#))) + } + +bitAndInt64 + = \ x -> + case x of { I64# x# -> + I64# (word64ToInt64# (and64# 170##64 (int64ToWord64# x#))) + } -bitAndInt64 = \ x -> case x of { I64# x# -> I64# (andI# 170# x#) } diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr index 46857abf86..42e17986d0 100644 --- a/testsuite/tests/th/TH_Roles2.stderr +++ b/testsuite/tests/th/TH_Roles2.stderr @@ -7,8 +7,8 @@ Dependent packages: [base-4.16.0.0, template-haskell-2.18.0.0] ==================== Typechecker ==================== TH_Roles2.$tcT = GHC.Types.TyCon - 11651627537942629178## 11503899791410937231## TH_Roles2.$trModule - (GHC.Types.TrNameS "T"#) 1 $krep + 11651627537942629178##64 11503899791410937231##64 + TH_Roles2.$trModule (GHC.Types.TrNameS "T"#) 1# $krep $krep [InlPrag=[~]] = GHC.Types.KindRepVar 0 $krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep GHC.Types.krep$* TH_Roles2.$trModule |