summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-11-02 18:21:46 +0100
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-11-06 04:07:28 +0000
commit0871a7094a94fbc722a137d4ccef9b0be4a6c26e (patch)
tree1be0c48a7f79a337831d9845f9a074df0327b1b1
parent4d5215c1fc673f0af7804c7e6ffea3226932fb32 (diff)
downloadhaskell-0871a7094a94fbc722a137d4ccef9b0be4a6c26e.tar.gz
Make Word64 use Word64# on every architecture
-rw-r--r--compiler/GHC/Iface/Tidy/StaticPtrTable.hs12
-rw-r--r--compiler/GHC/Tc/Instance/Typeable.hs15
-rw-r--r--libraries/base/GHC/Conc/Sync.hs6
-rw-r--r--libraries/base/GHC/Float.hs8
-rw-r--r--libraries/base/GHC/Int.hs195
-rw-r--r--libraries/base/GHC/StaticPtr.hs9
-rw-r--r--libraries/base/GHC/Storable.hs17
-rw-r--r--libraries/base/GHC/Word.hs192
-rw-r--r--libraries/ghc-bignum/src/GHC/Num/Integer.hs4
-rw-r--r--libraries/ghc-prim/GHC/Classes.hs17
-rw-r--r--libraries/ghc-prim/GHC/Prim/Ext.hs41
-rw-r--r--libraries/ghc-prim/GHC/Types.hs10
-rw-r--r--testsuite/tests/cmm/should_run/cmp64.hs71
-rw-r--r--testsuite/tests/codeGen/should_run/T9340.hs8
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun071.hs7
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun072.hs4
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun075.hs4
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun076.hs4
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun077.hs14
-rw-r--r--testsuite/tests/concurrent/should_run/AtomicPrimops.hs17
-rw-r--r--testsuite/tests/ghci/should_run/UnboxedTuples/ByteCode.hs8
-rw-r--r--testsuite/tests/ghci/should_run/UnboxedTuples/Common.hs-incl16
-rw-r--r--testsuite/tests/ghci/should_run/UnboxedTuples/Obj.hs6
-rw-r--r--testsuite/tests/numeric/should_compile/T16402.stderr-ws-6433
-rw-r--r--testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr15
-rw-r--r--testsuite/tests/primops/should_run/T4442.hs71
-rw-r--r--testsuite/tests/roles/should_compile/Roles1.stderr56
-rw-r--r--testsuite/tests/roles/should_compile/Roles14.stderr8
-rw-r--r--testsuite/tests/roles/should_compile/Roles2.stderr16
-rw-r--r--testsuite/tests/roles/should_compile/Roles3.stderr24
-rw-r--r--testsuite/tests/roles/should_compile/Roles4.stderr16
-rw-r--r--testsuite/tests/roles/should_compile/T8958.stderr24
-rw-r--r--testsuite/tests/simplCore/should_compile/T8832.stdout-ws-644
-rw-r--r--testsuite/tests/simplCore/should_run/T20203.stderr-ws-6427
-rw-r--r--testsuite/tests/th/TH_Roles2.stderr4
-rw-r--r--utils/genprimopcode/gen_bytearray_ops.py4
36 files changed, 201 insertions, 786 deletions
diff --git a/compiler/GHC/Iface/Tidy/StaticPtrTable.hs b/compiler/GHC/Iface/Tidy/StaticPtrTable.hs
index ad7c1a3ec8..4751ae9ea6 100644
--- a/compiler/GHC/Iface/Tidy/StaticPtrTable.hs
+++ b/compiler/GHC/Iface/Tidy/StaticPtrTable.hs
@@ -188,7 +188,6 @@ sptCreateStaticBinds hsc_env this_mod binds
go (reverse fps' ++ fps) (bnd' : bs) xs'
dflags = hsc_dflags hsc_env
- platform = targetPlatform dflags
-- Generates keys and replaces 'makeStatic' with 'StaticPtr'.
--
@@ -230,8 +229,8 @@ sptCreateStaticBinds hsc_env this_mod binds
staticPtrDataCon <- lift $ lookupDataConHscEnv staticPtrDataConName
return (fp, mkConApp staticPtrDataCon
[ Type t
- , mkWord64LitWordRep platform w0
- , mkWord64LitWordRep platform w1
+ , mkWord64LitWord64 w0
+ , mkWord64LitWord64 w1
, info
, e ])
@@ -242,13 +241,6 @@ sptCreateStaticBinds hsc_env this_mod binds
, show n
]
- -- Choose either 'Word64#' or 'Word#' to represent the arguments of the
- -- 'Fingerprint' data constructor.
- mkWord64LitWordRep platform =
- case platformWordSize platform of
- PW4 -> mkWord64LitWord64
- PW8 -> mkWordLit platform . toInteger
-
lookupIdHscEnv :: Name -> IO Id
lookupIdHscEnv n = lookupType hsc_env n >>=
maybe (getError n) (return . tyThingId)
diff --git a/compiler/GHC/Tc/Instance/Typeable.hs b/compiler/GHC/Tc/Instance/Typeable.hs
index a68a92e311..3dc6154c84 100644
--- a/compiler/GHC/Tc/Instance/Typeable.hs
+++ b/compiler/GHC/Tc/Instance/Typeable.hs
@@ -48,7 +48,6 @@ import GHC.Data.FastString ( FastString, mkFastString, fsLit )
import Control.Monad.Trans.State.Strict
import Control.Monad.Trans.Class (lift)
import Data.Maybe ( isJust )
-import Data.Word( Word64 )
{- Note [Grand plan for Typeable]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -641,11 +640,11 @@ mkTyConRepTyConRHS :: TypeableStuff -> TypeRepTodo
-> LHsExpr GhcTc
mkTyConRepTyConRHS (Stuff {..}) todo tycon kind_rep
= nlHsDataCon trTyConDataCon
- `nlHsApp` nlHsLit (word64 platform high)
- `nlHsApp` nlHsLit (word64 platform low)
+ `nlHsApp` nlHsLit (HsWord64Prim NoSourceText (toInteger high))
+ `nlHsApp` nlHsLit (HsWord64Prim NoSourceText (toInteger low))
`nlHsApp` mod_rep_expr todo
`nlHsApp` trNameLit (mkFastString tycon_str)
- `nlHsApp` nlHsLit (int n_kind_vars)
+ `nlHsApp` nlHsLit (HsIntPrim NoSourceText (toInteger n_kind_vars))
`nlHsApp` kind_rep
where
n_kind_vars = length $ filter isNamedTyConBinder (tyConBinders tycon)
@@ -660,14 +659,6 @@ mkTyConRepTyConRHS (Stuff {..}) todo tycon kind_rep
, fingerprintString tycon_str
]
- int :: Int -> HsLit GhcTc
- int n = HsIntPrim (SourceText $ show n) (toInteger n)
-
-word64 :: Platform -> Word64 -> HsLit GhcTc
-word64 platform n = case platformWordSize platform of
- PW4 -> HsWord64Prim NoSourceText (toInteger n)
- PW8 -> HsWordPrim NoSourceText (toInteger n)
-
{-
Note [Representing TyCon kinds: KindRep]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/libraries/base/GHC/Conc/Sync.hs b/libraries/base/GHC/Conc/Sync.hs
index 38ce56ccbf..d5fb4868df 100644
--- a/libraries/base/GHC/Conc/Sync.hs
+++ b/libraries/base/GHC/Conc/Sync.hs
@@ -92,8 +92,6 @@ module GHC.Conc.Sync
, sharedCAF
) where
-#include "MachDeps.h"
-
import Foreign
import Foreign.C
@@ -194,11 +192,7 @@ instance Ord ThreadId where
-- @since 4.8.0.0
setAllocationCounter :: Int64 -> IO ()
setAllocationCounter (I64# i) = IO $ \s ->
-#if WORD_SIZE_IN_BITS < 64
case setThreadAllocationCounter# i s of s' -> (# s', () #)
-#else
- case setThreadAllocationCounter# (intToInt64# i) s of s' -> (# s', () #)
-#endif
-- | Return the current value of the allocation counter for the
-- current thread.
diff --git a/libraries/base/GHC/Float.hs b/libraries/base/GHC/Float.hs
index 2fb30c5712..6ec4e84ceb 100644
--- a/libraries/base/GHC/Float.hs
+++ b/libraries/base/GHC/Float.hs
@@ -1565,11 +1565,7 @@ castWord64ToDouble :: Word64 -> Double
castWord64ToDouble (W64# w) = D# (stgWord64ToDouble w)
foreign import prim "stg_word64ToDoublezh"
-#if WORD_SIZE_IN_BITS == 64
- stgWord64ToDouble :: Word# -> Double#
-#else
stgWord64ToDouble :: Word64# -> Double#
-#endif
-- | @'castFloatToWord64' f@ does a bit-for-bit copy from a floating-point value
@@ -1582,11 +1578,7 @@ castDoubleToWord64 :: Double -> Word64
castDoubleToWord64 (D# d#) = W64# (stgDoubleToWord64 d#)
foreign import prim "stg_doubleToWord64zh"
-#if WORD_SIZE_IN_BITS == 64
- stgDoubleToWord64 :: Double# -> Word#
-#else
stgDoubleToWord64 :: Double# -> Word64#
-#endif
diff --git a/libraries/base/GHC/Int.hs b/libraries/base/GHC/Int.hs
index 45bb3f70ca..d0ab7d055e 100644
--- a/libraries/base/GHC/Int.hs
+++ b/libraries/base/GHC/Int.hs
@@ -42,12 +42,8 @@ module GHC.Int (
import Data.Bits
import Data.Maybe
-#if WORD_SIZE_IN_BITS < 64
import GHC.Prim
import GHC.Base
-#else
-import GHC.Base hiding (uncheckedIShiftL64#, uncheckedIShiftRA64#)
-#endif
import GHC.Enum
import GHC.Num
@@ -695,8 +691,6 @@ instance Ix Int32 where
-- type Int64
------------------------------------------------------------------------
-#if WORD_SIZE_IN_BITS < 64
-
data {-# CTYPE "HsInt64" #-} Int64 = I64# Int64#
-- ^ 64-bit signed integer type
@@ -802,14 +796,24 @@ instance Integral Int64 where
| y == 0 = divZeroError
-- Note [Order of tests]
| y == (-1) && x == minBound = (overflowError, 0)
- | otherwise = (I64# (x# `quotInt64#` y#),
- I64# (x# `remInt64#` y#))
+#if WORD_SIZE_IN_BITS < 64
+ -- we don't have quotRemInt64# primop yet
+ | otherwise = (I64# (x# `quotInt64#` y#), I64# (x# `remInt64#` y#))
+#else
+ | otherwise = case quotRemInt# (int64ToInt# x#) (int64ToInt# y#) of
+ (# q, r #) -> (I64# (intToInt64# q), I64# (intToInt64# r))
+#endif
divMod x@(I64# x#) y@(I64# y#)
| y == 0 = divZeroError
-- Note [Order of tests]
| y == (-1) && x == minBound = (overflowError, 0)
- | otherwise = (I64# (x# `divInt64#` y#),
- I64# (x# `modInt64#` y#))
+#if WORD_SIZE_IN_BITS < 64
+ -- we don't have divModInt64# primop yet
+ | otherwise = (I64# (x# `divInt64#` y#), I64# (x# `modInt64#` y#))
+#else
+ | otherwise = case divModInt# (int64ToInt# x#) (int64ToInt# y#) of
+ (# q, r #) -> (I64# (intToInt64# q), I64# (intToInt64# r))
+#endif
toInteger (I64# x) = integerFromInt64# x
@@ -896,166 +900,8 @@ a `iShiftRA64#` b | isTrue# (b >=# 64#) = if isTrue# (a `ltInt64#` (intToInt64#
-- No RULES for RealFrac methods if Int is smaller than Int64, we can't
-- go through Int and whether going through Integer is faster is uncertain.
-#else
-
--- Int64 is represented in the same way as Int.
--- Operations may assume and must ensure that it holds only values
--- from its logical range.
-
-data {-# CTYPE "HsInt64" #-} Int64 = I64# Int#
--- ^ 64-bit signed integer type
-
--- See GHC.Classes#matching_overloaded_methods_in_rules
--- | @since 2.01
-instance Eq Int64 where
- (==) = eqInt64
- (/=) = neInt64
-
-eqInt64, neInt64 :: Int64 -> Int64 -> Bool
-eqInt64 (I64# x) (I64# y) = isTrue# (x ==# y)
-neInt64 (I64# x) (I64# y) = isTrue# (x /=# y)
-{-# INLINE [1] eqInt64 #-}
-{-# INLINE [1] neInt64 #-}
-
--- | @since 2.01
-instance Ord Int64 where
- (<) = ltInt64
- (<=) = leInt64
- (>=) = geInt64
- (>) = gtInt64
-
-{-# INLINE [1] gtInt64 #-}
-{-# INLINE [1] geInt64 #-}
-{-# INLINE [1] ltInt64 #-}
-{-# INLINE [1] leInt64 #-}
-gtInt64, geInt64, ltInt64, leInt64 :: Int64 -> Int64 -> Bool
-(I64# x) `gtInt64` (I64# y) = isTrue# (x ># y)
-(I64# x) `geInt64` (I64# y) = isTrue# (x >=# y)
-(I64# x) `ltInt64` (I64# y) = isTrue# (x <# y)
-(I64# x) `leInt64` (I64# y) = isTrue# (x <=# y)
-
--- | @since 2.01
-instance Show Int64 where
- showsPrec p x = showsPrec p (fromIntegral x :: Int)
-
--- | @since 2.01
-instance Num Int64 where
- (I64# x#) + (I64# y#) = I64# (x# +# y#)
- (I64# x#) - (I64# y#) = I64# (x# -# y#)
- (I64# x#) * (I64# y#) = I64# (x# *# y#)
- negate (I64# x#) = I64# (negateInt# x#)
- abs x | x >= 0 = x
- | otherwise = negate x
- signum x | x > 0 = 1
- signum 0 = 0
- signum _ = -1
- fromInteger i = I64# (integerToInt# i)
-
--- | @since 2.01
-instance Enum Int64 where
- succ x
- | x /= maxBound = x + 1
- | otherwise = succError "Int64"
- pred x
- | x /= minBound = x - 1
- | otherwise = predError "Int64"
- toEnum (I# i#) = I64# i#
- fromEnum (I64# x#) = I# x#
- -- See Note [Stable Unfolding for list producers] in GHC.Enum
- {-# INLINE enumFrom #-}
- enumFrom = boundedEnumFrom
- -- See Note [Stable Unfolding for list producers] in GHC.Enum
- {-# INLINE enumFromThen #-}
- enumFromThen = boundedEnumFromThen
-
--- | @since 2.01
-instance Integral Int64 where
- quot x@(I64# x#) y@(I64# y#)
- | y == 0 = divZeroError
- | y == (-1) && x == minBound = overflowError -- Note [Order of tests]
- | otherwise = I64# (x# `quotInt#` y#)
- rem (I64# x#) y@(I64# y#)
- | y == 0 = divZeroError
- -- The quotRem CPU instruction might fail for 'minBound
- -- `quotRem` -1' if it is an instruction for exactly this
- -- width of signed integer. But, 'minBound `rem` -1' is
- -- well-defined (0). We therefore special-case it.
- | y == (-1) = 0
- | otherwise = I64# (x# `remInt#` y#)
- div x@(I64# x#) y@(I64# y#)
- | y == 0 = divZeroError
- | y == (-1) && x == minBound = overflowError -- Note [Order of tests]
- | otherwise = I64# (x# `divInt#` y#)
- mod (I64# x#) y@(I64# y#)
- | y == 0 = divZeroError
- -- The divMod CPU instruction might fail for 'minBound
- -- `divMod` -1' if it is an instruction for exactly this
- -- width of signed integer. But, 'minBound `mod` -1' is
- -- well-defined (0). We therefore special-case it.
- | y == (-1) = 0
- | otherwise = I64# (x# `modInt#` y#)
- quotRem x@(I64# x#) y@(I64# y#)
- | y == 0 = divZeroError
- -- Note [Order of tests]
- | y == (-1) && x == minBound = (overflowError, 0)
- | otherwise = case x# `quotRemInt#` y# of
- (# q, r #) ->
- (I64# q, I64# r)
- divMod x@(I64# x#) y@(I64# y#)
- | y == 0 = divZeroError
- -- Note [Order of tests]
- | y == (-1) && x == minBound = (overflowError, 0)
- | otherwise = case x# `divModInt#` y# of
- (# d, m #) ->
- (I64# d, I64# m)
- toInteger (I64# x#) = IS x#
-
--- | @since 2.01
-instance Read Int64 where
- readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
-
--- | @since 2.01
-instance Bits Int64 where
- {-# INLINE shift #-}
- {-# INLINE bit #-}
- {-# INLINE testBit #-}
- {-# INLINE popCount #-}
-
- (I64# x#) .&. (I64# y#) = I64# (x# `andI#` y#)
- (I64# x#) .|. (I64# y#) = I64# (x# `orI#` y#)
- (I64# x#) `xor` (I64# y#) = I64# (x# `xorI#` y#)
- complement (I64# x#) = I64# (notI# x#)
- (I64# x#) `shift` (I# i#)
- | isTrue# (i# >=# 0#) = I64# (x# `iShiftL#` i#)
- | otherwise = I64# (x# `iShiftRA#` negateInt# i#)
- (I64# x#) `shiftL` (I# i#)
- | isTrue# (i# >=# 0#) = I64# (x# `iShiftL#` i#)
- | otherwise = overflowError
- (I64# x#) `unsafeShiftL` (I# i#) = I64# (x# `uncheckedIShiftL#` i#)
- (I64# x#) `shiftR` (I# i#)
- | isTrue# (i# >=# 0#) = I64# (x# `iShiftRA#` i#)
- | otherwise = overflowError
- (I64# x#) `unsafeShiftR` (I# i#) = I64# (x# `uncheckedIShiftRA#` i#)
- (I64# x#) `rotate` (I# i#)
- | isTrue# (i'# ==# 0#)
- = I64# x#
- | otherwise
- = I64# (word2Int# ((x'# `uncheckedShiftL#` i'#) `or#`
- (x'# `uncheckedShiftRL#` (64# -# i'#))))
- where
- !x'# = int2Word# x#
- !i'# = word2Int# (int2Word# i# `and#` 63##)
- bitSizeMaybe i = Just (finiteBitSize i)
- bitSize i = finiteBitSize i
- isSigned _ = True
-#if WORD_SIZE_IN_BITS < 64
- popCount (I64# x#) = I# (word2Int# (popCnt64# (int64ToWord64# x#)))
-#else
- popCount (I64# x#) = I# (word2Int# (popCnt# (int2Word# x#)))
-#endif
- bit = bitDefault
- testBit = testBitDefault
+#if WORD_SIZE_IN_BITS == 64
{-# RULES
"properFraction/Float->(Int64,Float)"
properFraction = \x ->
@@ -1085,12 +931,6 @@ instance Bits Int64 where
"round/Double->Int64"
round = (fromIntegral :: Int -> Int64) . (round :: Double -> Int)
#-}
-
-uncheckedIShiftL64# :: Int# -> Int# -> Int#
-uncheckedIShiftL64# = uncheckedIShiftL#
-
-uncheckedIShiftRA64# :: Int# -> Int# -> Int#
-uncheckedIShiftRA64# = uncheckedIShiftRA#
#endif
-- | @since 4.6.0.0
@@ -1098,13 +938,8 @@ instance FiniteBits Int64 where
{-# INLINE countLeadingZeros #-}
{-# INLINE countTrailingZeros #-}
finiteBitSize _ = 64
-#if WORD_SIZE_IN_BITS < 64
countLeadingZeros (I64# x#) = I# (word2Int# (clz64# (int64ToWord64# x#)))
countTrailingZeros (I64# x#) = I# (word2Int# (ctz64# (int64ToWord64# x#)))
-#else
- countLeadingZeros (I64# x#) = I# (word2Int# (clz# (int2Word# x#)))
- countTrailingZeros (I64# x#) = I# (word2Int# (ctz# (int2Word# x#)))
-#endif
-- | @since 2.01
instance Real Int64 where
diff --git a/libraries/base/GHC/StaticPtr.hs b/libraries/base/GHC/StaticPtr.hs
index 9a1e1232bb..5ec74c63eb 100644
--- a/libraries/base/GHC/StaticPtr.hs
+++ b/libraries/base/GHC/StaticPtr.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE CPP #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
@@ -57,17 +56,11 @@ import GHC.Prim
import GHC.Word (Word64(..))
-#include "MachDeps.h"
-
-- | A reference to a value of type @a@.
-#if WORD_SIZE_IN_BITS < 64
data StaticPtr a = StaticPtr Word64# Word64# -- The flattened Fingerprint is
-- convenient in the compiler.
StaticPtrInfo a
-#else
-data StaticPtr a = StaticPtr Word# Word#
- StaticPtrInfo a
-#endif
+
-- | Dereferences a static pointer.
deRefStaticPtr :: StaticPtr a -> a
deRefStaticPtr (StaticPtr _ _ _ v) = v
diff --git a/libraries/base/GHC/Storable.hs b/libraries/base/GHC/Storable.hs
index 548430eb59..d9b9382211 100644
--- a/libraries/base/GHC/Storable.hs
+++ b/libraries/base/GHC/Storable.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE CPP #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, UnboxedTuples #-}
{-# OPTIONS_HADDOCK not-home #-}
@@ -52,8 +51,6 @@ module GHC.Storable
, writeWord64OffPtr
) where
-#include "MachDeps.h"
-
import GHC.Stable ( StablePtr(..) )
import GHC.Int
import GHC.Word
@@ -105,17 +102,10 @@ readInt32OffPtr (Ptr a) (I# i)
= IO $ \s -> case readInt32OffAddr# a i s of (# s2, x #) -> (# s2, I32# x #)
readWord32OffPtr (Ptr a) (I# i)
= IO $ \s -> case readWord32OffAddr# a i s of (# s2, x #) -> (# s2, W32# x #)
-#if WORD_SIZE_IN_BITS < 64
readInt64OffPtr (Ptr a) (I# i)
= IO $ \s -> case readInt64OffAddr# a i s of (# s2, x #) -> (# s2, I64# x #)
readWord64OffPtr (Ptr a) (I# i)
= IO $ \s -> case readWord64OffAddr# a i s of (# s2, x #) -> (# s2, W64# x #)
-#else
-readInt64OffPtr (Ptr a) (I# i)
- = IO $ \s -> case readInt64OffAddr# a i s of (# s2, x #) -> (# s2, I64# (int64ToInt# x) #)
-readWord64OffPtr (Ptr a) (I# i)
- = IO $ \s -> case readWord64OffAddr# a i s of (# s2, x #) -> (# s2, W64# (word64ToWord# x) #)
-#endif
writeWideCharOffPtr :: Ptr Char -> Int -> Char -> IO ()
writeIntOffPtr :: Ptr Int -> Int -> Int -> IO ()
@@ -162,14 +152,7 @@ writeInt32OffPtr (Ptr a) (I# i) (I32# x)
= IO $ \s -> case writeInt32OffAddr# a i x s of s2 -> (# s2, () #)
writeWord32OffPtr (Ptr a) (I# i) (W32# x)
= IO $ \s -> case writeWord32OffAddr# a i x s of s2 -> (# s2, () #)
-#if WORD_SIZE_IN_BITS < 64
writeInt64OffPtr (Ptr a) (I# i) (I64# x)
= IO $ \s -> case writeInt64OffAddr# a i x s of s2 -> (# s2, () #)
writeWord64OffPtr (Ptr a) (I# i) (W64# x)
= IO $ \s -> case writeWord64OffAddr# a i x s of s2 -> (# s2, () #)
-#else
-writeInt64OffPtr (Ptr a) (I# i) (I64# x)
- = IO $ \s -> case writeInt64OffAddr# a i (intToInt64# x) s of s2 -> (# s2, () #)
-writeWord64OffPtr (Ptr a) (I# i) (W64# x)
- = IO $ \s -> case writeWord64OffAddr# a i (wordToWord64# x) s of s2 -> (# s2, () #)
-#endif
diff --git a/libraries/base/GHC/Word.hs b/libraries/base/GHC/Word.hs
index 43b6e4b311..be1921df05 100644
--- a/libraries/base/GHC/Word.hs
+++ b/libraries/base/GHC/Word.hs
@@ -48,12 +48,8 @@ module GHC.Word (
import Data.Maybe
-#if WORD_SIZE_IN_BITS < 64
import GHC.Prim
import GHC.Base
-#else
-import GHC.Base hiding (uncheckedShiftL64#, uncheckedShiftRL64#)
-#endif
import GHC.Bits
import GHC.Enum
@@ -676,8 +672,6 @@ byteSwap32 (W32# w#) = W32# (wordToWord32# (byteSwap32# (word32ToWord# w#)))
-- type Word64
------------------------------------------------------------------------
-#if WORD_SIZE_IN_BITS < 64
-
data {-# CTYPE "HsWord64" #-} Word64 = W64# Word64#
-- ^ 64-bit unsigned integer type
@@ -766,7 +760,13 @@ instance Integral Word64 where
| y /= 0 = W64# (x# `remWord64#` y#)
| otherwise = divZeroError
quotRem (W64# x#) y@(W64# y#)
+#if WORD_SIZE_IN_BITS < 64
| y /= 0 = (W64# (x# `quotWord64#` y#), W64# (x# `remWord64#` y#))
+#else
+ -- we don't have a `quotRemWord64#` primitive yet.
+ | y /= 0 = case quotRemWord# (word64ToWord# x#) (word64ToWord# y#) of
+ (# q, r #) -> (W64# (wordToWord64# q), W64# (wordToWord64# r))
+#endif
| otherwise = divZeroError
div x y = quot x y
@@ -823,184 +823,14 @@ a `shiftL64#` b | isTrue# (b >=# 64#) = wordToWord64# 0##
a `shiftRL64#` b | isTrue# (b >=# 64#) = wordToWord64# 0##
| otherwise = a `uncheckedShiftRL64#` b
-#else
-
--- Word64 is represented in the same way as Word.
--- Operations may assume and must ensure that it holds only values
--- from its logical range.
-
-data {-# CTYPE "HsWord64" #-} Word64 = W64# Word#
--- ^ 64-bit unsigned integer type
-
--- See GHC.Classes#matching_overloaded_methods_in_rules
--- | @since 2.01
-instance Eq Word64 where
- (==) = eqWord64
- (/=) = neWord64
-
-eqWord64, neWord64 :: Word64 -> Word64 -> Bool
-eqWord64 (W64# x) (W64# y) = isTrue# (x `eqWord#` y)
-neWord64 (W64# x) (W64# y) = isTrue# (x `neWord#` y)
-{-# INLINE [1] eqWord64 #-}
-{-# INLINE [1] neWord64 #-}
-
--- | @since 2.01
-instance Ord Word64 where
- (<) = ltWord64
- (<=) = leWord64
- (>=) = geWord64
- (>) = gtWord64
-
-{-# INLINE [1] gtWord64 #-}
-{-# INLINE [1] geWord64 #-}
-{-# INLINE [1] ltWord64 #-}
-{-# INLINE [1] leWord64 #-}
-gtWord64, geWord64, ltWord64, leWord64 :: Word64 -> Word64 -> Bool
-(W64# x) `gtWord64` (W64# y) = isTrue# (x `gtWord#` y)
-(W64# x) `geWord64` (W64# y) = isTrue# (x `geWord#` y)
-(W64# x) `ltWord64` (W64# y) = isTrue# (x `ltWord#` y)
-(W64# x) `leWord64` (W64# y) = isTrue# (x `leWord#` y)
-
--- | @since 2.01
-instance Num Word64 where
- (W64# x#) + (W64# y#) = W64# (x# `plusWord#` y#)
- (W64# x#) - (W64# y#) = W64# (x# `minusWord#` y#)
- (W64# x#) * (W64# y#) = W64# (x# `timesWord#` y#)
- negate (W64# x#) = W64# (int2Word# (negateInt# (word2Int# x#)))
- abs x = x
- signum 0 = 0
- signum _ = 1
- fromInteger i = W64# (integerToWord# i)
-
--- | @since 2.01
-instance Enum Word64 where
- succ x
- | x /= maxBound = x + 1
- | otherwise = succError "Word64"
- pred x
- | x /= minBound = x - 1
- | otherwise = predError "Word64"
- toEnum i@(I# i#)
- | i >= 0 = W64# (int2Word# i#)
- | otherwise = toEnumError "Word64" i (minBound::Word64, maxBound::Word64)
- fromEnum x@(W64# x#)
- | x <= fromIntegral (maxBound::Int)
- = I# (word2Int# x#)
- | otherwise = fromEnumError "Word64" x
-
- -- See Note [Stable Unfolding for list producers] in GHC.Enum
- {-# INLINABLE enumFrom #-}
- enumFrom w
- = map wordToWord64
- $ enumFrom (word64ToWord w)
-
- -- See Note [Stable Unfolding for list producers] in GHC.Enum
- {-# INLINABLE enumFromThen #-}
- enumFromThen w s
- = map wordToWord64
- $ enumFromThen (word64ToWord w) (word64ToWord s)
-
- -- See Note [Stable Unfolding for list producers] in GHC.Enum
- {-# INLINABLE enumFromTo #-}
- enumFromTo w1 w2
- = map wordToWord64
- $ enumFromTo (word64ToWord w1) (word64ToWord w2)
-
- -- See Note [Stable Unfolding for list producers] in GHC.Enum
- {-# INLINABLE enumFromThenTo #-}
- enumFromThenTo w1 s w2
- = map wordToWord64
- $ enumFromThenTo (word64ToWord w1) (word64ToWord s) (word64ToWord w2)
-
-word64ToWord :: Word64 -> Word
-word64ToWord (W64# w#) = (W# w#)
-
-wordToWord64 :: Word -> Word64
-wordToWord64 (W# w#) = (W64# w#)
-
-
--- | @since 2.01
-instance Integral Word64 where
- -- see Note [INLINE division wrappers] in GHC.Base
- {-# INLINE quot #-}
- {-# INLINE rem #-}
- {-# INLINE quotRem #-}
- {-# INLINE div #-}
- {-# INLINE mod #-}
- {-# INLINE divMod #-}
-
- quot (W64# x#) y@(W64# y#)
- | y /= 0 = W64# (x# `quotWord#` y#)
- | otherwise = divZeroError
- rem (W64# x#) y@(W64# y#)
- | y /= 0 = W64# (x# `remWord#` y#)
- | otherwise = divZeroError
- quotRem (W64# x#) y@(W64# y#)
- | y /= 0 = case x# `quotRemWord#` y# of
- (# q, r #) -> (W64# q, W64# r)
- | otherwise = divZeroError
-
- div x y = quot x y
- mod x y = rem x y
- divMod x y = quotRem x y
-
- toInteger (W64# x#) = integerFromWord# x#
-
--- | @since 2.01
-instance Bits Word64 where
- {-# INLINE shift #-}
- {-# INLINE bit #-}
- {-# INLINE testBit #-}
- {-# INLINE popCount #-}
-
- (W64# x#) .&. (W64# y#) = W64# (x# `and#` y#)
- (W64# x#) .|. (W64# y#) = W64# (x# `or#` y#)
- (W64# x#) `xor` (W64# y#) = W64# (x# `xor#` y#)
- complement (W64# x#) = W64# (not# x#)
- (W64# x#) `shift` (I# i#)
- | isTrue# (i# >=# 0#) = W64# (x# `shiftL#` i#)
- | otherwise = W64# (x# `shiftRL#` negateInt# i#)
- (W64# x#) `shiftL` (I# i#)
- | isTrue# (i# >=# 0#) = W64# (x# `shiftL#` i#)
- | otherwise = overflowError
- (W64# x#) `unsafeShiftL` (I# i#) = W64# (x# `uncheckedShiftL#` i#)
- (W64# x#) `shiftR` (I# i#)
- | isTrue# (i# >=# 0#) = W64# (x# `shiftRL#` i#)
- | otherwise = overflowError
- (W64# x#) `unsafeShiftR` (I# i#) = W64# (x# `uncheckedShiftRL#` i#)
- (W64# x#) `rotate` (I# i#)
- | isTrue# (i'# ==# 0#) = W64# x#
- | otherwise = W64# ((x# `uncheckedShiftL#` i'#) `or#`
- (x# `uncheckedShiftRL#` (64# -# i'#)))
- where
- !i'# = word2Int# (int2Word# i# `and#` 63##)
- bitSizeMaybe i = Just (finiteBitSize i)
- bitSize i = finiteBitSize i
- isSigned _ = False
- popCount (W64# x#) = I# (word2Int# (popCnt# x#))
- bit = bitDefault
- testBit = testBitDefault
-
-uncheckedShiftL64# :: Word# -> Int# -> Word#
-uncheckedShiftL64# = uncheckedShiftL#
-
-uncheckedShiftRL64# :: Word# -> Int# -> Word#
-uncheckedShiftRL64# = uncheckedShiftRL#
-
-#endif
-- | @since 4.6.0.0
instance FiniteBits Word64 where
{-# INLINE countLeadingZeros #-}
{-# INLINE countTrailingZeros #-}
finiteBitSize _ = 64
-#if WORD_SIZE_IN_BITS < 64
countLeadingZeros (W64# x#) = I# (word2Int# (clz64# x#))
countTrailingZeros (W64# x#) = I# (word2Int# (ctz64# x#))
-#else
- countLeadingZeros (W64# x#) = I# (word2Int# (clz# x#))
- countTrailingZeros (W64# x#) = I# (word2Int# (ctz# x#))
-#endif
-- | @since 2.01
instance Show Word64 where
@@ -1024,13 +854,8 @@ instance Ix Word64 where
-- | Reverse order of bytes in 'Word64'.
--
-- @since 4.7.0.0
-#if WORD_SIZE_IN_BITS < 64
byteSwap64 :: Word64 -> Word64
byteSwap64 (W64# w#) = W64# (byteSwap64# w#)
-#else
-byteSwap64 :: Word64 -> Word64
-byteSwap64 (W64# w#) = W64# (byteSwap# w#)
-#endif
-- | Reverse the order of the bits in a 'Word8'.
--
@@ -1053,13 +878,8 @@ bitReverse32 (W32# w#) = W32# (wordToWord32# (bitReverse32# (word32ToWord# w#)))
-- | Reverse the order of the bits in a 'Word64'.
--
-- @since 4.12.0.0
-#if WORD_SIZE_IN_BITS < 64
bitReverse64 :: Word64 -> Word64
bitReverse64 (W64# w#) = W64# (bitReverse64# w#)
-#else
-bitReverse64 :: Word64 -> Word64
-bitReverse64 (W64# w#) = W64# (bitReverse# w#)
-#endif
-------------------------------------------------------------------------------
diff --git a/libraries/ghc-bignum/src/GHC/Num/Integer.hs b/libraries/ghc-bignum/src/GHC/Num/Integer.hs
index d85148fc05..810ce7f050 100644
--- a/libraries/ghc-bignum/src/GHC/Num/Integer.hs
+++ b/libraries/ghc-bignum/src/GHC/Num/Integer.hs
@@ -1001,7 +1001,7 @@ integerIsPowerOf2# (IP w) = bigNatIsPowerOf2# w
-- | Convert an Int64# into an Integer
integerFromInt64# :: Int64# -> Integer
{-# NOINLINE integerFromInt64# #-}
-integerFromInt64# !i
+integerFromInt64# i
| isTrue# ((i `leInt64#` intToInt64# INT_MAXBOUND#)
&&# (i `geInt64#` intToInt64# INT_MINBOUND#))
= IS (int64ToInt# i)
@@ -1476,7 +1476,6 @@ to only rely on rewrite rules for bignum functions.
#-}
-#if WORD_SIZE_IN_BITS == 32
{-# RULES
"Int64# -> Integer -> Int64#"
@@ -1516,4 +1515,3 @@ to only rely on rewrite rules for bignum functions.
forall x. integerToInt# (integerFromWord64# x) = word2Int# (word64ToWord# x)
#-}
-#endif
diff --git a/libraries/ghc-prim/GHC/Classes.hs b/libraries/ghc-prim/GHC/Classes.hs
index 2c874fb241..13e9556864 100644
--- a/libraries/ghc-prim/GHC/Classes.hs
+++ b/libraries/ghc-prim/GHC/Classes.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, Trustworthy #-}
+{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, StandaloneDeriving, BangPatterns,
KindSignatures, DataKinds, ConstraintKinds,
MultiParamTypeClasses, FunctionalDependencies #-}
@@ -63,8 +63,6 @@ import GHC.Tuple
import GHC.CString (unpackCString#)
import GHC.Types
-#include "MachDeps.h"
-
infix 4 ==, /=, <, <=, >=, >
infixr 3 &&
infixr 2 ||
@@ -277,7 +275,6 @@ eqInt, neInt :: Int -> Int -> Bool
(I# x) `eqInt` (I# y) = isTrue# (x ==# y)
(I# x) `neInt` (I# y) = isTrue# (x /=# y)
-#if WORD_SIZE_IN_BITS < 64
instance Eq TyCon where
(==) (TyCon hi1 lo1 _ _ _ _) (TyCon hi2 lo2 _ _ _ _)
= isTrue# (hi1 `eqWord64#` hi2) && isTrue# (lo1 `eqWord64#` lo2)
@@ -288,18 +285,6 @@ instance Ord TyCon where
| isTrue# (lo1 `gtWord64#` lo2) = GT
| isTrue# (lo1 `ltWord64#` lo2) = LT
| True = EQ
-#else
-instance Eq TyCon where
- (==) (TyCon hi1 lo1 _ _ _ _) (TyCon hi2 lo2 _ _ _ _)
- = isTrue# (hi1 `eqWord#` hi2) && isTrue# (lo1 `eqWord#` lo2)
-instance Ord TyCon where
- compare (TyCon hi1 lo1 _ _ _ _) (TyCon hi2 lo2 _ _ _ _)
- | isTrue# (hi1 `gtWord#` hi2) = GT
- | isTrue# (hi1 `ltWord#` hi2) = LT
- | isTrue# (lo1 `gtWord#` lo2) = GT
- | isTrue# (lo1 `ltWord#` lo2) = LT
- | True = EQ
-#endif
-- | The 'Ord' class is used for totally ordered datatypes.
diff --git a/libraries/ghc-prim/GHC/Prim/Ext.hs b/libraries/ghc-prim/GHC/Prim/Ext.hs
index e581e66dd7..d911133947 100644
--- a/libraries/ghc-prim/GHC/Prim/Ext.hs
+++ b/libraries/ghc-prim/GHC/Prim/Ext.hs
@@ -28,17 +28,14 @@
-- are described over there.
module GHC.Prim.Ext
(
- -- 64-bit bit aliases
- INT64
- , WORD64
+ -- * Misc
+ getThreadAllocationCounter#
-- * Delay\/wait operations
#if defined(mingw32_HOST_OS)
, asyncRead#
, asyncWrite#
, asyncDoProc#
#endif
- -- * Misc
- , getThreadAllocationCounter#
) where
import GHC.Prim
@@ -47,24 +44,6 @@ import GHC.Types () -- Make implicit dependency known to build system
default () -- Double and Integer aren't available yet
------------------------------------------------------------------------
--- 64-bit bit aliases
-------------------------------------------------------------------------
-
-type INT64 =
-#if WORD_SIZE_IN_BITS < 64
- Int64#
-#else
- Int#
-#endif
-
-type WORD64 =
-#if WORD_SIZE_IN_BITS < 64
- Word64#
-#else
- Word#
-#endif
-
-------------------------------------------------------------------------
-- Delay/wait operations
------------------------------------------------------------------------
@@ -104,7 +83,7 @@ foreign import prim "stg_asyncDoProczh" asyncDoProc#
-- | Retrieves the allocation counter for the current thread.
foreign import prim "stg_getThreadAllocationCounterzh" getThreadAllocationCounter#
:: State# RealWorld
- -> (# State# RealWorld, INT64 #)
+ -> (# State# RealWorld, Int64# #)
------------------------------------------------------------------------
-- Rules for primops that don't need to be built-in
@@ -249,3 +228,17 @@ foreign import prim "stg_getThreadAllocationCounterzh" getThreadAllocationCounte
forall x . intToInt64# (word2Int# (word64ToWord# x)) = word64ToInt64# x
#-}
#endif
+
+
+-- Push downcast into bitwise operations
+{-# RULES
+"word64ToWord#/and64#"
+ forall x y . word64ToWord# (and64# x y) = and# (word64ToWord# x) (word64ToWord# y)
+
+"word64ToWord#/or64#"
+ forall x y . word64ToWord# (or64# x y) = or# (word64ToWord# x) (word64ToWord# y)
+
+"word64ToWord#/xor64#"
+ forall x y . word64ToWord# (xor64# x y) = xor# (word64ToWord# x) (word64ToWord# y)
+
+#-}
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs
index aa4bcce603..45f14e7691 100644
--- a/libraries/ghc-prim/GHC/Types.hs
+++ b/libraries/ghc-prim/GHC/Types.hs
@@ -522,12 +522,6 @@ data TrName
-- | A de Bruijn index for a binder within a 'KindRep'.
type KindBndr = Int
-#if WORD_SIZE_IN_BITS < 64
-#define WORD64_TY Word64#
-#else
-#define WORD64_TY Word#
-#endif
-
-- | The representation produced by GHC for conjuring up the kind of a
-- 'Data.Typeable.TypeRep'.
@@ -545,8 +539,8 @@ data TypeLitSort = TypeLitSymbol
| TypeLitChar
-- Show instance for TyCon found in GHC.Show
-data TyCon = TyCon WORD64_TY -- ^ Fingerprint (high)
- WORD64_TY -- ^ Fingerprint (low)
+data TyCon = TyCon Word64# -- ^ Fingerprint (high)
+ Word64# -- ^ Fingerprint (low)
Module -- ^ Module in which this is defined
TrName -- ^ Type constructor name
Int# -- ^ How many kind variables do we accept?
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
diff --git a/utils/genprimopcode/gen_bytearray_ops.py b/utils/genprimopcode/gen_bytearray_ops.py
index 46a9aa91bb..a7212740b6 100644
--- a/utils/genprimopcode/gen_bytearray_ops.py
+++ b/utils/genprimopcode/gen_bytearray_ops.py
@@ -41,12 +41,12 @@ element_types += [
ElementType("Int8", "Int8#", "8-bit signed integer", 1),
ElementType("Int16", "Int16#", "16-bit signed integer", 2),
ElementType("Int32", "Int32#", "32-bit signed integer", 4),
- ElementType("Int64", "INT64", "64-bit signed integer", 8),
+ ElementType("Int64", "Int64#", "64-bit signed integer", 8),
ElementType("Word8", "Word8#", "8-bit unsigned integer", 1),
ElementType("Word16", "Word16#", "16-bit unsigned integer", 2),
ElementType("Word32", "Word32#", "32-bit unsigned integer", 4),
- ElementType("Word64", "WORD64", "64-bit unsigned integer", 8),
+ ElementType("Word64", "Word64#", "64-bit unsigned integer", 8),
]
def pretty_offset(n: Optional[int]) -> str: