| | 177 | translateOp FloatVectorMultOp = Just (MO_VF_Mult W32 4) |
| | 178 | }}} |
| | 179 | |
| | 180 | The new primtype also needs to be weaved through the code generation path, but it is slightly different then primops. To complete the primtype definition, the following files need to be modified. |
| | 181 | |
| | 182 | ./utils/genprimopcode/Main.hs needs to have an association added between the FloatVec# type added above and a Type that is used for representation elsewhere: |
| | 183 | {{{ |
| | 184 | ppType (TyApp "FloatVec#" []) = "floatVecPrimTy" |
| | 185 | }}} |
| | 186 | |
| | 187 | By adding the floatVecPrimTy, several additional relationships and constructs need to be created as well. |
| | 188 | |
| | 189 | ./compiler/prelude/TysPrim.lhs, wires the new type into Prelude: |
| | 190 | {{{ |
| | 191 | module TysPrim( |
| | 192 | .... |
| | 193 | -- Added |
| | 194 | floatVecPrimTyCon, floatVecPrimTy, |
| | 195 | ... |
| | 196 | |
| | 197 | primTyCons |
| | 198 | = [ addrPrimTyCon |
| | 199 | ... |
| | 200 | -- Added |
| | 201 | , floatVecPrimTyCon |
| | 202 | |
| | 203 | ... |
| | 204 | floatVecPrimTyConName = mkPrimTc (fsLit "FloatVec#") floatVecPrimTyConKey floatVecPrimTyCon |
| | 205 | |
| | 206 | ... |
| | 207 | -- Add a new subsection for primitive types (others will be added here as well) |
| | 208 | %************************************************************************ |
| | 209 | %* * |
| | 210 | \subsection[TysPrim-SIMDvectors]{The primitive SIMD vector types} |
| | 211 | %* * |
| | 212 | %************************************************************************ |
| | 213 | |
| | 214 | \begin{code} |
| | 215 | floatVecPrimTyCon :: TyCon |
| | 216 | floatVecPrimTyCon = pcPrimTyCon floatVecPrimTyConName 1 PtrRep |
| | 217 | |
| | 218 | floatVecPrimTy :: Type |
| | 219 | floatVecPrimTy = mkTyConTy floatVecPrimTyCon |
| | 220 | \end{code} |
| | 221 | }}} |
| | 222 | |
| | 223 | ./compiler/prelude/PrelNames.lhs gives keys for each of the primtypes |
| | 224 | {{{ |
| | 225 | \subsection[Uniques-prelude-TyCons] ... |
| | 226 | ... |
| | 227 | floatVecPrimTyConKey = mkPreludeTyConUnique 38 |
| | 228 | }}} |
| | 229 | |
| | 230 | ./compiler/ghci/ByteCodeGen.lhs |
| | 231 | {{{ |
| | 232 | }}} |
| | 233 | |
| | 234 | ./compiler/ghci/RtClosureInspect.hs |
| | 235 | {{{ |
| | 236 | repPrim t = rep where |
| | 237 | ... |
| | 238 | -- Added |
| | 239 | | t == floatVecPrimTyCon = "<floatvec>" |