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 /libraries/ghc-prim | |
parent | 20956e5784fe43781d156dd7ab02f0bff4ab41fb (diff) | |
download | haskell-2800eee24d006cfe5ed224e35e856154ae0cd444.tar.gz |
Make Word64 use Word64# on every architecture
Diffstat (limited to 'libraries/ghc-prim')
-rw-r--r-- | libraries/ghc-prim/GHC/Classes.hs | 17 | ||||
-rw-r--r-- | libraries/ghc-prim/GHC/Prim/Ext.hs | 41 | ||||
-rw-r--r-- | libraries/ghc-prim/GHC/Types.hs | 10 |
3 files changed, 20 insertions, 48 deletions
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? |