[commit: ghc] simd: Add Cmm support for 256-bit-wide values. (5401d5d)

Geoffrey Mainland gmainlan at ghc.haskell.org
Fri Jul 19 14:16:43 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : simd

http://hackage.haskell.org/trac/ghc/changeset/5401d5d136b6769b392c12d00dd1ea2a12a74e16

>---------------------------------------------------------------

commit 5401d5d136b6769b392c12d00dd1ea2a12a74e16
Author: Geoffrey Mainland <gmainlan at microsoft.com>
Date:   Thu Feb 14 18:48:25 2013 +0000

    Add Cmm support for 256-bit-wide values.

>---------------------------------------------------------------

 compiler/cmm/CmmLex.x   |    3 +++
 compiler/cmm/CmmParse.y |    2 ++
 compiler/cmm/CmmType.hs |   11 +++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/compiler/cmm/CmmLex.x b/compiler/cmm/CmmLex.x
index 81227eb..46f4cf5 100644
--- a/compiler/cmm/CmmLex.x
+++ b/compiler/cmm/CmmLex.x
@@ -164,6 +164,7 @@ data CmmToken
   | CmmT_bits32
   | CmmT_bits64
   | CmmT_bits128
+  | CmmT_bits256
   | CmmT_float32
   | CmmT_float64
   | CmmT_gcptr
@@ -244,6 +245,7 @@ reservedWordsFM = listToUFM $
 	( "bits32",		CmmT_bits32 ),
 	( "bits64",		CmmT_bits64 ),
 	( "bits128",		CmmT_bits128 ),
+	( "bits256",		CmmT_bits256 ),
 	( "float32",		CmmT_float32 ),
 	( "float64",		CmmT_float64 ),
 -- New forms
@@ -252,6 +254,7 @@ reservedWordsFM = listToUFM $
 	( "b32",		CmmT_bits32 ),
 	( "b64",		CmmT_bits64 ),
 	( "b128",		CmmT_bits128 ),
+	( "b256",		CmmT_bits256 ),
 	( "f32",		CmmT_float32 ),
 	( "f64",		CmmT_float64 ),
 	( "gcptr",		CmmT_gcptr )
diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
index 8c36dea..f7c543a 100644
--- a/compiler/cmm/CmmParse.y
+++ b/compiler/cmm/CmmParse.y
@@ -289,6 +289,7 @@ import Data.Maybe
         'bits32'        { L _ (CmmT_bits32) }
         'bits64'        { L _ (CmmT_bits64) }
         'bits128'       { L _ (CmmT_bits128) }
+        'bits256'       { L _ (CmmT_bits256) }
         'float32'       { L _ (CmmT_float32) }
         'float64'       { L _ (CmmT_float64) }
         'gcptr'         { L _ (CmmT_gcptr) }
@@ -777,6 +778,7 @@ typenot8 :: { CmmType }
         | 'bits32'              { b32 }
         | 'bits64'              { b64 }
         | 'bits128'             { b128 }
+        | 'bits256'             { b256 }
         | 'float32'             { f32 }
         | 'float64'             { f64 }
         | 'gcptr'               {% do dflags <- getDynFlags; return $ gcWord dflags }
diff --git a/compiler/cmm/CmmType.hs b/compiler/cmm/CmmType.hs
index 8eac8c9..98e4053 100644
--- a/compiler/cmm/CmmType.hs
+++ b/compiler/cmm/CmmType.hs
@@ -1,7 +1,7 @@
 
 module CmmType
     ( CmmType   -- Abstract
-    , b8, b16, b32, b64, b128, f32, f64, bWord, bHalfWord, gcWord
+    , b8, b16, b32, b64, b128, b256, f32, f64, bWord, bHalfWord, gcWord
     , cInt, cLong
     , cmmBits, cmmFloat
     , typeWidth, cmmEqType, cmmEqType_ignoring_ptrhood
@@ -107,12 +107,13 @@ cmmFloat = CmmType FloatCat
 
 -------- Common CmmTypes ------------
 -- Floats and words of specific widths
-b8, b16, b32, b64, b128, f32, f64 :: CmmType
+b8, b16, b32, b64, b128, b256, f32, f64 :: CmmType
 b8     = cmmBits W8
 b16    = cmmBits W16
 b32    = cmmBits W32
 b64    = cmmBits W64
 b128   = cmmBits W128
+b256   = cmmBits W256
 f32    = cmmFloat W32
 f64    = cmmFloat W64
 
@@ -166,6 +167,7 @@ data Width   = W8 | W16 | W32 | W64
                         -- used in x86 native codegen only.
                         -- (we use Ord, so it'd better be in this order)
              | W128
+             | W256
              deriving (Eq, Ord, Show)
 
 instance Outputable Width where
@@ -177,6 +179,7 @@ mrStr W16  = sLit("W16")
 mrStr W32  = sLit("W32")
 mrStr W64  = sLit("W64")
 mrStr W128 = sLit("W128")
+mrStr W256 = sLit("W256")
 mrStr W80  = sLit("W80")
 
 
@@ -216,6 +219,7 @@ widthInBits W16  = 16
 widthInBits W32  = 32
 widthInBits W64  = 64
 widthInBits W128 = 128
+widthInBits W256 = 256
 widthInBits W80  = 80
 
 widthInBytes :: Width -> Int
@@ -224,6 +228,7 @@ widthInBytes W16  = 2
 widthInBytes W32  = 4
 widthInBytes W64  = 8
 widthInBytes W128 = 16
+widthInBytes W256 = 32
 widthInBytes W80  = 10
 
 widthFromBytes :: Int -> Width
@@ -232,6 +237,7 @@ widthFromBytes 2  = W16
 widthFromBytes 4  = W32
 widthFromBytes 8  = W64
 widthFromBytes 16 = W128
+widthFromBytes 32 = W256
 widthFromBytes 10 = W80
 widthFromBytes n  = pprPanic "no width for given number of bytes" (ppr n)
 
@@ -242,6 +248,7 @@ widthInLog W16  = 1
 widthInLog W32  = 2
 widthInLog W64  = 3
 widthInLog W128 = 4
+widthInLog W256 = 5
 widthInLog W80  = panic "widthInLog: F80"
 
 -- widening / narrowing






More information about the ghc-commits mailing list