Changes between Version 13 and Version 14 of SIMDPlan
- Timestamp:
- 10/12/11 09:23:20 (20 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SIMDPlan
v13 v14 37 37 38 38 The steps to be undertaken are: 39 1. Modify ./compiler/prelude/primops.txt.pp 39 1. Modify ./compiler/prelude/PrimOp.lhs (actually, ./compiler/primop-primop-info.hs-incl) to add the new PrimOps (VIntQuotOp, etc...) 40 1. Modify ./compiler/prelude/primops.txt.pp (the following instructions may be changed a bit based on the direction) 40 41 a. Add the following vector length constants as Int# types 41 42 * intVecLen, intVec8Len, intVec16Len, intVec32Len, intVec64Len, wordVecLen, wordVec8Len, wordVec16Len, wordVec32Len, wordVec64Len, floatVecLen, and doubleVecLen, … … 73 74 It may make more sense to add the MachOps to Cmm prior to implementing the PrimOps (or at least before adding the code to the CgPrimOp.hs file). There is a useful [http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/CmmType#AdditionsinCmm Cmm Wiki Page] available to aid in the definition of the new Cmm operations. 74 75 75 The primary files that are involved in adding Cmm instructions are: 76 1. Modify CmmExpr.hs 76 Modify compiler/cmm/CmmType.hs to add new required vector types and such, here is a basic outline of what needs to be done: 77 {{{ 78 data CmmType -- The important one! 79 = CmmType CmmCat Width 80 81 type Multiplicty = Int 82 83 data CmmCat -- "Category" (not exported) 84 = GcPtrCat -- GC pointer 85 | BitsCat -- Non-pointer 86 | FloatCat -- Float 87 | VBitsCat Multiplicity -- Non-pointer 88 | VFloatCat Multiplicity -- Float 89 deriving( Eq ) 90 -- See Note [Signed vs unsigned] at the end 91 }}} 77 92 78 Some existing Cmm instructions may be able to be reused, but there will have to be additional instructions added to account for vectorization primitives. I'm still a little curious why these new instructions should not be built as out-of-line PrimOps. It should be noted that the reference for adding primops appears to be wildly out of data for adding out-of-line primops. 93 Modify compiler/cmm/CmmMachOp.hs, this will add the necessary MachOps for use from the PrimOps modifications to support SIMD. Here is an example of adding a SIMD version of the MO_F_Add MachOp: 94 {{{ 95 -- Floating point arithmetic 96 MO_VF_Add Width Int -- MO_VF_Add W64 4 Add 4-vector of 64-bit floats 97 }}} 98 99 Some existing Cmm instructions may be able to be reused, but there will have to be additional instructions added to account for vectorization primitives. This will help keep the SIMD / non-SIMD code generation separate for the time being until we have it working. 79 100 80 101 == Modify LLVM Code Generator ==
