Commit 49f4c12e authored by gmainlan@microsoft.com's avatar gmainlan@microsoft.com
Browse files

Add Cmm support for 512-bit-wide values.

parent 03e33c92
...@@ -165,6 +165,7 @@ data CmmToken ...@@ -165,6 +165,7 @@ data CmmToken
| CmmT_bits64 | CmmT_bits64
| CmmT_bits128 | CmmT_bits128
| CmmT_bits256 | CmmT_bits256
| CmmT_bits512
| CmmT_float32 | CmmT_float32
| CmmT_float64 | CmmT_float64
| CmmT_gcptr | CmmT_gcptr
...@@ -246,6 +247,7 @@ reservedWordsFM = listToUFM $ ...@@ -246,6 +247,7 @@ reservedWordsFM = listToUFM $
( "bits64", CmmT_bits64 ), ( "bits64", CmmT_bits64 ),
( "bits128", CmmT_bits128 ), ( "bits128", CmmT_bits128 ),
( "bits256", CmmT_bits256 ), ( "bits256", CmmT_bits256 ),
( "bits512", CmmT_bits512 ),
( "float32", CmmT_float32 ), ( "float32", CmmT_float32 ),
( "float64", CmmT_float64 ), ( "float64", CmmT_float64 ),
-- New forms -- New forms
...@@ -255,6 +257,7 @@ reservedWordsFM = listToUFM $ ...@@ -255,6 +257,7 @@ reservedWordsFM = listToUFM $
( "b64", CmmT_bits64 ), ( "b64", CmmT_bits64 ),
( "b128", CmmT_bits128 ), ( "b128", CmmT_bits128 ),
( "b256", CmmT_bits256 ), ( "b256", CmmT_bits256 ),
( "b512", CmmT_bits512 ),
( "f32", CmmT_float32 ), ( "f32", CmmT_float32 ),
( "f64", CmmT_float64 ), ( "f64", CmmT_float64 ),
( "gcptr", CmmT_gcptr ) ( "gcptr", CmmT_gcptr )
......
...@@ -290,6 +290,7 @@ import Data.Maybe ...@@ -290,6 +290,7 @@ import Data.Maybe
'bits64' { L _ (CmmT_bits64) } 'bits64' { L _ (CmmT_bits64) }
'bits128' { L _ (CmmT_bits128) } 'bits128' { L _ (CmmT_bits128) }
'bits256' { L _ (CmmT_bits256) } 'bits256' { L _ (CmmT_bits256) }
'bits512' { L _ (CmmT_bits512) }
'float32' { L _ (CmmT_float32) } 'float32' { L _ (CmmT_float32) }
'float64' { L _ (CmmT_float64) } 'float64' { L _ (CmmT_float64) }
'gcptr' { L _ (CmmT_gcptr) } 'gcptr' { L _ (CmmT_gcptr) }
...@@ -779,6 +780,7 @@ typenot8 :: { CmmType } ...@@ -779,6 +780,7 @@ typenot8 :: { CmmType }
| 'bits64' { b64 } | 'bits64' { b64 }
| 'bits128' { b128 } | 'bits128' { b128 }
| 'bits256' { b256 } | 'bits256' { b256 }
| 'bits512' { b512 }
| 'float32' { f32 } | 'float32' { f32 }
| 'float64' { f64 } | 'float64' { f64 }
| 'gcptr' {% do dflags <- getDynFlags; return $ gcWord dflags } | 'gcptr' {% do dflags <- getDynFlags; return $ gcWord dflags }
......
module CmmType module CmmType
( CmmType -- Abstract ( CmmType -- Abstract
, b8, b16, b32, b64, b128, b256, f32, f64, bWord, bHalfWord, gcWord , b8, b16, b32, b64, b128, b256, b512, f32, f64, bWord, bHalfWord, gcWord
, cInt, cLong , cInt, cLong
, cmmBits, cmmFloat , cmmBits, cmmFloat
, typeWidth, cmmEqType, cmmEqType_ignoring_ptrhood , typeWidth, cmmEqType, cmmEqType_ignoring_ptrhood
...@@ -107,13 +107,14 @@ cmmFloat = CmmType FloatCat ...@@ -107,13 +107,14 @@ cmmFloat = CmmType FloatCat
-------- Common CmmTypes ------------ -------- Common CmmTypes ------------
-- Floats and words of specific widths -- Floats and words of specific widths
b8, b16, b32, b64, b128, b256, f32, f64 :: CmmType b8, b16, b32, b64, b128, b256, b512, f32, f64 :: CmmType
b8 = cmmBits W8 b8 = cmmBits W8
b16 = cmmBits W16 b16 = cmmBits W16
b32 = cmmBits W32 b32 = cmmBits W32
b64 = cmmBits W64 b64 = cmmBits W64
b128 = cmmBits W128 b128 = cmmBits W128
b256 = cmmBits W256 b256 = cmmBits W256
b512 = cmmBits W512
f32 = cmmFloat W32 f32 = cmmFloat W32
f64 = cmmFloat W64 f64 = cmmFloat W64
...@@ -168,6 +169,7 @@ data Width = W8 | W16 | W32 | W64 ...@@ -168,6 +169,7 @@ data Width = W8 | W16 | W32 | W64
-- (we use Ord, so it'd better be in this order) -- (we use Ord, so it'd better be in this order)
| W128 | W128
| W256 | W256
| W512
deriving (Eq, Ord, Show) deriving (Eq, Ord, Show)
instance Outputable Width where instance Outputable Width where
...@@ -180,6 +182,7 @@ mrStr W32 = sLit("W32") ...@@ -180,6 +182,7 @@ mrStr W32 = sLit("W32")
mrStr W64 = sLit("W64") mrStr W64 = sLit("W64")
mrStr W128 = sLit("W128") mrStr W128 = sLit("W128")
mrStr W256 = sLit("W256") mrStr W256 = sLit("W256")
mrStr W512 = sLit("W512")
mrStr W80 = sLit("W80") mrStr W80 = sLit("W80")
...@@ -220,6 +223,7 @@ widthInBits W32 = 32 ...@@ -220,6 +223,7 @@ widthInBits W32 = 32
widthInBits W64 = 64 widthInBits W64 = 64
widthInBits W128 = 128 widthInBits W128 = 128
widthInBits W256 = 256 widthInBits W256 = 256
widthInBits W512 = 512
widthInBits W80 = 80 widthInBits W80 = 80
widthInBytes :: Width -> Int widthInBytes :: Width -> Int
...@@ -229,6 +233,7 @@ widthInBytes W32 = 4 ...@@ -229,6 +233,7 @@ widthInBytes W32 = 4
widthInBytes W64 = 8 widthInBytes W64 = 8
widthInBytes W128 = 16 widthInBytes W128 = 16
widthInBytes W256 = 32 widthInBytes W256 = 32
widthInBytes W512 = 64
widthInBytes W80 = 10 widthInBytes W80 = 10
widthFromBytes :: Int -> Width widthFromBytes :: Int -> Width
...@@ -238,6 +243,7 @@ widthFromBytes 4 = W32 ...@@ -238,6 +243,7 @@ widthFromBytes 4 = W32
widthFromBytes 8 = W64 widthFromBytes 8 = W64
widthFromBytes 16 = W128 widthFromBytes 16 = W128
widthFromBytes 32 = W256 widthFromBytes 32 = W256
widthFromBytes 64 = W512
widthFromBytes 10 = W80 widthFromBytes 10 = W80
widthFromBytes n = pprPanic "no width for given number of bytes" (ppr n) widthFromBytes n = pprPanic "no width for given number of bytes" (ppr n)
...@@ -249,6 +255,7 @@ widthInLog W32 = 2 ...@@ -249,6 +255,7 @@ widthInLog W32 = 2
widthInLog W64 = 3 widthInLog W64 = 3
widthInLog W128 = 4 widthInLog W128 = 4
widthInLog W256 = 5 widthInLog W256 = 5
widthInLog W512 = 6
widthInLog W80 = panic "widthInLog: F80" widthInLog W80 = panic "widthInLog: F80"
-- widening / narrowing -- widening / narrowing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment