[commit: ghc] simd: Remove general vector insertion primops. (582c49c)

Geoffrey Mainland gmainlan at microsoft.com
Wed Apr 18 20:10:30 CEST 2012


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : simd

http://hackage.haskell.org/trac/ghc/changeset/582c49cfe4fda19eadbc6e63491a0abb97b89656

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

commit 582c49cfe4fda19eadbc6e63491a0abb97b89656
Author: Geoffrey Mainland <gmainlan at microsoft.com>
Date:   Thu Apr 5 13:13:05 2012 +0100

    Remove general vector insertion primops.
    
    LLVM seems not to be able to compile these in general.

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

 compiler/codeGen/CgPrimOp.hs    |   38 --------------------------------------
 compiler/prelude/primops.txt.pp |   16 ----------------
 2 files changed, 0 insertions(+), 54 deletions(-)

diff --git a/compiler/codeGen/CgPrimOp.hs b/compiler/codeGen/CgPrimOp.hs
index 973e712..99d57c3 100644
--- a/compiler/codeGen/CgPrimOp.hs
+++ b/compiler/codeGen/CgPrimOp.hs
@@ -470,9 +470,6 @@ emitPrimOp [res] PopCntOp [w] live = emitPopCntCall res w wordWidth live
 emitPrimOp [res] FloatToFloatX4Op [e] _ =
     doVecPack Nothing vec4f32 [e,e,e,e] res
 
-emitPrimOp [res] FloatX4InsertOp [v,e,i] _ =
-    doVecInsert Nothing vec4f32 v e i res
-
 emitPrimOp [res] FloatX4PackOp es@[_,_,_,_] _ =
     doVecPack Nothing vec4f32 es res
 
@@ -482,9 +479,6 @@ emitPrimOp res@[_,_,_,_] FloatX4UnpackOp [arg] _ =
 emitPrimOp [res] DoubleToDoubleX2Op [e] _ =
     doVecPack Nothing vec2f64 [e,e] res
 
-emitPrimOp [res] DoubleX2InsertOp [v,e,i] _ =
-    doVecInsert Nothing vec2f64 v e i res
-
 emitPrimOp [res] DoubleX2PackOp es@[_,_] _ =
     doVecPack Nothing vec2f64 es res
 
@@ -494,9 +488,6 @@ emitPrimOp res@[_,_] DoubleX2UnpackOp [arg] _ =
 emitPrimOp [res] Int32ToInt32X4Op [e] _ =
     doVecPack (Just mo_WordTo32) vec4b32 [e,e,e,e] res
 
-emitPrimOp [res] Int32X4InsertOp [v,e,i] _ =
-    doVecInsert (Just mo_WordTo32) vec4b32 v e i res
-
 emitPrimOp [res] Int32X4PackOp es@[_,_,_,_] _ =
     doVecPack (Just mo_WordTo32) vec4b32 es res
 
@@ -506,9 +497,6 @@ emitPrimOp res@[_,_,_,_] Int32X4UnpackOp [arg] _ =
 emitPrimOp [res] Int64ToInt64X2Op [e] _ =
     doVecPack Nothing vec2b64 [e,e] res
 
-emitPrimOp [res] Int64X2InsertOp [v,e,i] _ =
-    doVecInsert Nothing vec2b64 v e i res
-
 emitPrimOp [res] Int64X2PackOp es@[_,_] _ =
     doVecPack Nothing vec2b64 es res
 
@@ -947,32 +935,6 @@ mkBasicIndexedWrite off (Just cast) write_rep base idx val
 ------------------------------------------------------------------------------
 -- Helpers for translating vector packing and unpacking.
 
-doVecInsert :: Maybe MachOp  -- Cast from element to vector component
-            -> CmmType       -- Vector type
-            -> CmmExpr       -- Source vector
-            -> CmmExpr       -- Element
-            -> CmmExpr       -- Index at which to insert element
-            -> CmmFormal     -- Destination for result
-            -> Code
-doVecInsert maybe_pre_write_cast ty src e idx res =
-    stmtC $ CmmAssign (CmmLocal res)
-                      (CmmMachOp (MO_V_Insert len wid) [src, cast e, idx'])
-  where
-    cast :: CmmExpr -> CmmExpr
-    cast val = case maybe_pre_write_cast of
-                 Nothing   -> val
-                 Just cast -> CmmMachOp cast [val]
-
-    -- vector indices are always 32-bits
-    idx' :: CmmExpr
-    idx' = CmmMachOp (MO_SS_Conv wordWidth W32) [idx]
-
-    len :: Length
-    len = vecLength ty 
-
-    wid :: Width
-    wid = typeWidth (vecType ty)
-
 doVecPack :: Maybe MachOp  -- Cast from element to vector component
           -> CmmType       -- Type of vector
           -> [CmmExpr]     -- Elements
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index be9f28d..46859c2 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -2194,10 +2194,6 @@ primtype FloatX4#
 primop FloatToFloatX4Op "floatToFloatX4#" GenPrimOp     
    Float# -> FloatX4#
 
-primop FloatX4InsertOp "insertFloatX4#" GenPrimOp     
-   FloatX4# -> Float# -> Int# -> FloatX4#
-   with can_fail = True
-
 primop FloatX4PackOp "packFloatX4#" GenPrimOp         
    Float# -> Float# -> Float# -> Float# -> FloatX4#
 
@@ -2289,10 +2285,6 @@ primtype DoubleX2#
 primop DoubleToDoubleX2Op "doubleToDoubleX2#" GenPrimOp     
    Double# -> DoubleX2#
 
-primop DoubleX2InsertOp "insertDoubleX2#" GenPrimOp     
-   DoubleX2# -> Double# -> Int# -> DoubleX2#
-   with can_fail = True
-
 primop DoubleX2PackOp "packDoubleX2#" GenPrimOp         
    Double# -> Double# -> DoubleX2#
 
@@ -2383,10 +2375,6 @@ primtype Int32X4#
 primop Int32ToInt32X4Op "int32ToInt32X4#" GenPrimOp     
    INT32 -> Int32X4#
 
-primop Int32X4InsertOp "insertInt32X4#" GenPrimOp     
-   Int32X4# -> INT32 -> Int# -> Int32X4#
-   with can_fail = True
-
 primop Int32X4PackOp "packInt32X4#" GenPrimOp         
    INT32 -> INT32 -> INT32 -> INT32 -> Int32X4#
 
@@ -2481,10 +2469,6 @@ primtype Int64X2#
 primop Int64ToInt64X2Op "int64ToInt64X2#" GenPrimOp     
    INT64 -> Int64X2#
 
-primop Int64X2InsertOp "insertInt64X2#" GenPrimOp     
-   Int64X2# -> INT64 -> Int# -> Int64X2#
-   with can_fail = True
-
 primop Int64X2PackOp "packInt64X2#" GenPrimOp         
    INT64 -> INT64 -> Int64X2#
 





More information about the Cvs-ghc mailing list