mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
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:
@ -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()) {
|
||||
|
Reference in New Issue
Block a user