Add support for vector data types in the LLVM interpreter.

Patch by:
Veselov, Yuri <Yuri.Veselov@intel.com>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178469 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nadav Rotem
2013-04-01 15:53:30 +00:00
parent f170cc9b2e
commit 953783e00c
5 changed files with 274 additions and 6 deletions

View File

@ -1187,6 +1187,39 @@ void Interpreter::visitVAArgInst(VAArgInst &I) {
++VAList.UIntPairVal.second;
}
void Interpreter::visitExtractElementInst(ExtractElementInst &I) {
ExecutionContext &SF = ECStack.back();
GenericValue Src1 = getOperandValue(I.getOperand(0), SF);
GenericValue Src2 = getOperandValue(I.getOperand(1), SF);
GenericValue Dest;
Type *Ty = I.getType();
const unsigned indx = unsigned(Src2.IntVal.getZExtValue());
if(Src1.AggregateVal.size() > indx) {
switch (Ty->getTypeID()) {
default:
dbgs() << "Unhandled destination type for extractelement instruction: "
<< *Ty << "\n";
llvm_unreachable(0);
break;
case Type::IntegerTyID:
Dest.IntVal = Src1.AggregateVal[indx].IntVal;
break;
case Type::FloatTyID:
Dest.FloatVal = Src1.AggregateVal[indx].FloatVal;
break;
case Type::DoubleTyID:
Dest.DoubleVal = Src1.AggregateVal[indx].DoubleVal;
break;
}
} else {
dbgs() << "Invalid index in extractelement instruction\n";
}
SetValue(&I, Dest, SF);
}
GenericValue Interpreter::getConstantExprValue (ConstantExpr *CE,
ExecutionContext &SF) {
switch (CE->getOpcode()) {