diff options
| author | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-09-04 11:45:52 +0000 |
|---|---|---|
| committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-09-04 11:45:52 +0000 |
| commit | c92151516f4630a2cabcb9b8e5edbd565e16a219 (patch) | |
| tree | 5d4c4792280a2410f000635dcc113773decf4372 /polly/lib/CodeGeneration.cpp | |
| parent | 8b00a5116410697a35cd56250c96516ec964a262 (diff) | |
| download | bcm5719-llvm-c92151516f4630a2cabcb9b8e5edbd565e16a219.tar.gz bcm5719-llvm-c92151516f4630a2cabcb9b8e5edbd565e16a219.zip | |
CodeGen: Support for Cast Operations in vector code generation
llvm-svn: 139097
Diffstat (limited to 'polly/lib/CodeGeneration.cpp')
| -rw-r--r-- | polly/lib/CodeGeneration.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/polly/lib/CodeGeneration.cpp b/polly/lib/CodeGeneration.cpp index cb8a01f4ed4..10e96baa20b 100644 --- a/polly/lib/CodeGeneration.cpp +++ b/polly/lib/CodeGeneration.cpp @@ -409,6 +409,21 @@ public: vectorMap[load] = newLoad; } + void copyUnaryInst(const UnaryInstruction *Inst, ValueMapT &BBMap, + ValueMapT &VectorMap, int VectorDimension, + int VectorWidth) { + Value *NewOperand = getOperand(Inst->getOperand(0), BBMap, &VectorMap); + NewOperand = makeVectorOperand(NewOperand, VectorWidth); + + if (const CastInst *Cast = dyn_cast<CastInst>(Inst)) { + VectorType *DestType = VectorType::get(Inst->getType(), VectorWidth); + VectorMap[Inst] = Builder.CreateCast(Cast->getOpcode(), NewOperand, + DestType); + } else + llvm_unreachable("Can not generate vector code for instruction"); + return; + } + void copyBinInst(const BinaryOperator *Inst, ValueMapT &BBMap, ValueMapT &vectorMap, int vectorDimension, int vectorWidth) { Value *opZero = Inst->getOperand(0); @@ -529,7 +544,11 @@ public: } if (isVectorBlock() && hasVectorOperands(Inst, vectorMap)) { - if (const BinaryOperator *binaryInst = dyn_cast<BinaryOperator>(Inst)) + if (const UnaryInstruction *UnaryInst = dyn_cast<UnaryInstruction>(Inst)) + copyUnaryInst(UnaryInst, BBMap, vectorMap, vectorDimension, + vectorWidth); + else if + (const BinaryOperator *binaryInst = dyn_cast<BinaryOperator>(Inst)) copyBinInst(binaryInst, BBMap, vectorMap, vectorDimension, vectorWidth); else if (const StoreInst *store = dyn_cast<StoreInst>(Inst)) copyVectorStore(store, BBMap, vectorMap, scalarMaps, vectorDimension, |

