Lines Matching +full:num +full:- +full:vectors
1 //===-- Execution.cpp - Implement code to simulate the program ------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
34 static cl::opt<bool> PrintVolatile("interpreter-print-volatile", cl::Hidden,
37 //===----------------------------------------------------------------------===//
39 //===----------------------------------------------------------------------===//
45 //===----------------------------------------------------------------------===//
47 //===----------------------------------------------------------------------===//
50 switch (Ty->getTypeID()) {
52 Dest.FloatVal = -Src.FloatVal;
55 Dest.DoubleVal = -Src.DoubleVal;
64 Type *Ty = I.getOperand(0)->getType();
69 if (Ty->isVectorTy()) {
77 if (cast<VectorType>(Ty)->getElementType()->isFloatTy()) {
79 R.AggregateVal[i].FloatVal = -Src.AggregateVal[i].FloatVal;
80 } else if (cast<VectorType>(Ty)->getElementType()->isDoubleTy()) {
82 R.AggregateVal[i].DoubleVal = -Src.AggregateVal[i].DoubleVal;
99 //===----------------------------------------------------------------------===//
101 //===----------------------------------------------------------------------===//
110 switch (Ty->getTypeID()) {
121 switch (Ty->getTypeID()) {
122 IMPLEMENT_BINARY_OPERATOR(-, Float);
123 IMPLEMENT_BINARY_OPERATOR(-, Double);
132 switch (Ty->getTypeID()) {
143 switch (Ty->getTypeID()) {
154 switch (Ty->getTypeID()) {
184 // running on a 32-bit target, otherwise the upper 32 bits might mess up
195 switch (Ty->getTypeID()) {
209 switch (Ty->getTypeID()) {
223 switch (Ty->getTypeID()) {
237 switch (Ty->getTypeID()) {
251 switch (Ty->getTypeID()) {
265 switch (Ty->getTypeID()) {
279 switch (Ty->getTypeID()) {
293 switch (Ty->getTypeID()) {
307 switch (Ty->getTypeID()) {
321 switch (Ty->getTypeID()) {
334 Type *Ty = I.getOperand(0)->getType();
351 dbgs() << "Don't know how to handle this ICmp predicate!\n-->" << I;
374 if (cast<VectorType>(Ty)->getElementType()->isFloatTy()) { \
383 switch (Ty->getTypeID()) {
395 if (TY->isFloatTy()) { \
420 if (TY->isVectorTy()) { \
421 if (cast<VectorType>(TY)->getElementType()->isFloatTy()) { \
439 switch (Ty->getTypeID()) {
448 if (Ty->isVectorTy())
459 switch (Ty->getTypeID()) {
473 switch (Ty->getTypeID()) {
487 switch (Ty->getTypeID()) {
501 switch (Ty->getTypeID()) {
513 if (TY->isFloatTy()) { \
524 if (TY->isVectorTy()) { \
591 if(Ty->isVectorTy()) {
594 if (cast<VectorType>(Ty)->getElementType()->isFloatTy()) {
609 } else if (Ty->isFloatTy())
622 if(Ty->isVectorTy()) {
625 if (cast<VectorType>(Ty)->getElementType()->isFloatTy()) {
640 } else if (Ty->isFloatTy())
653 if(Ty->isVectorTy()) {
667 Type *Ty = I.getOperand(0)->getType();
674 dbgs() << "Don't know how to handle this FCmp predicate!\n-->" << I;
702 Type *Ty = I.getOperand(0)->getType();
708 if (Ty->isVectorTy()) {
712 // Macros to execute binary operation 'OP' over integer vectors
726 // (float or double) vectors
735 if (cast<VectorType>(Ty)->getElementType()->isFloatTy()) \
738 if (cast<VectorType>(Ty)->getElementType()->isDoubleTy()) \
749 dbgs() << "Don't know how to handle this binary operator!\n-->" << I;
753 case Instruction::Sub: INTEGER_VECTOR_OPERATION(-) break;
763 case Instruction::FSub: FLOAT_VECTOR_OP(-) break;
767 if (cast<VectorType>(Ty)->getElementType()->isFloatTy())
772 if (cast<VectorType>(Ty)->getElementType()->isDoubleTy())
786 dbgs() << "Don't know how to handle this binary operator!\n-->" << I;
790 case Instruction::Sub: R.IntVal = Src1.IntVal - Src2.IntVal; break;
812 if(Ty->isVectorTy()) {
827 Type * Ty = I.getOperand(0)->getType();
835 //===----------------------------------------------------------------------===//
837 //===----------------------------------------------------------------------===//
862 if (RetTy && !RetTy->isVoidTy()) { // Nonvoid return type?
873 if (!CallingSF.Caller->getType()->isVoidTy())
876 SwitchToNewBasicBlock (II->getNormalDest (), CallingSF);
889 RetTy = I.getReturnValue()->getType();
916 Type *ElTy = Cond->getType();
939 // SwitchToNewBasicBlock - This method is used to jump to a new basic block.
952 SF.CurInst = SF.CurBB->begin(); // Update new instruction ptr...
961 int i = PN->getBasicBlockIndex(PrevBB);
962 assert(i != -1 && "PHINode doesn't contain entry for predecessor??");
963 Value *IncomingValue = PN->getIncomingValue(i);
970 SF.CurInst = SF.CurBB->begin();
977 //===----------------------------------------------------------------------===//
979 //===----------------------------------------------------------------------===//
992 // Avoid malloc-ing zero bytes, use max()...
1010 // getElementOffset - The workhorse for getelementptr.
1015 assert(Ptr->getType()->isPointerTy() &&
1025 unsigned Index = unsigned(CPU->getZExtValue());
1027 Total += SLO->getElementOffset(Index);
1034 cast<IntegerType>(I.getOperand()->getType())->getBitWidth();
1073 I.getOperand(0)->getType());
1078 //===----------------------------------------------------------------------===//
1080 //===----------------------------------------------------------------------===//
1085 ArgIndex.UIntPairVal.first = ECStack.size() - 1;
1107 bool atBegin(Parent->begin() == Me);
1109 --Me;
1110 IL->LowerIntrinsicCall(&I);
1115 SF.CurInst = Parent->begin();
1127 const unsigned NumArgs = SF.Caller->arg_size();
1129 for (Value *V : SF.Caller->args())
1134 GenericValue SRC = getOperandValue(SF.Caller->getCalledOperand(), SF);
1146 return (NextPowerOf2(valueWidth-1) - 1) & orgShiftAmount;
1157 if (Ty->isVectorTy()) {
1184 if (Ty->isVectorTy()) {
1211 if (Ty->isVectorTy()) {
1234 Type *SrcTy = SrcVal->getType();
1235 if (SrcTy->isVectorTy()) {
1236 Type *DstVecTy = DstTy->getScalarType();
1237 unsigned DBitWidth = cast<IntegerType>(DstVecTy)->getBitWidth();
1239 // the sizes of src and dst vectors must be equal
1245 unsigned DBitWidth = DITy->getBitWidth();
1253 Type *SrcTy = SrcVal->getType();
1255 if (SrcTy->isVectorTy()) {
1256 Type *DstVecTy = DstTy->getScalarType();
1257 unsigned DBitWidth = cast<IntegerType>(DstVecTy)->getBitWidth();
1259 // the sizes of src and dst vectors must be equal.
1265 unsigned DBitWidth = DITy->getBitWidth();
1273 Type *SrcTy = SrcVal->getType();
1275 if (SrcTy->isVectorTy()) {
1276 Type *DstVecTy = DstTy->getScalarType();
1277 unsigned DBitWidth = cast<IntegerType>(DstVecTy)->getBitWidth();
1280 // the sizes of src and dst vectors must be equal.
1286 unsigned DBitWidth = DITy->getBitWidth();
1296 if (isa<VectorType>(SrcVal->getType())) {
1297 assert(SrcVal->getType()->getScalarType()->isDoubleTy() &&
1298 DstTy->getScalarType()->isFloatTy() &&
1302 // the sizes of src and dst vectors must be equal.
1307 assert(SrcVal->getType()->isDoubleTy() && DstTy->isFloatTy() &&
1319 if (isa<VectorType>(SrcVal->getType())) {
1320 assert(SrcVal->getType()->getScalarType()->isFloatTy() &&
1321 DstTy->getScalarType()->isDoubleTy() && "Invalid FPExt instruction");
1324 // the sizes of src and dst vectors must be equal.
1329 assert(SrcVal->getType()->isFloatTy() && DstTy->isDoubleTy() &&
1339 Type *SrcTy = SrcVal->getType();
1343 Type *DstVecTy = DstTy->getScalarType();
1344 Type *SrcVecTy = SrcTy->getScalarType();
1345 uint32_t DBitWidth = cast<IntegerType>(DstVecTy)->getBitWidth();
1347 // the sizes of src and dst vectors must be equal.
1350 if (SrcVecTy->getTypeID() == Type::FloatTyID) {
1351 assert(SrcVecTy->isFloatingPointTy() && "Invalid FPToUI instruction");
1362 uint32_t DBitWidth = cast<IntegerType>(DstTy)->getBitWidth();
1363 assert(SrcTy->isFloatingPointTy() && "Invalid FPToUI instruction");
1365 if (SrcTy->getTypeID() == Type::FloatTyID)
1377 Type *SrcTy = SrcVal->getType();
1381 Type *DstVecTy = DstTy->getScalarType();
1382 Type *SrcVecTy = SrcTy->getScalarType();
1383 uint32_t DBitWidth = cast<IntegerType>(DstVecTy)->getBitWidth();
1385 // the sizes of src and dst vectors must be equal
1388 if (SrcVecTy->getTypeID() == Type::FloatTyID) {
1389 assert(SrcVecTy->isFloatingPointTy() && "Invalid FPToSI instruction");
1400 unsigned DBitWidth = cast<IntegerType>(DstTy)->getBitWidth();
1401 assert(SrcTy->isFloatingPointTy() && "Invalid FPToSI instruction");
1403 if (SrcTy->getTypeID() == Type::FloatTyID)
1416 if (isa<VectorType>(SrcVal->getType())) {
1417 Type *DstVecTy = DstTy->getScalarType();
1419 // the sizes of src and dst vectors must be equal
1422 if (DstVecTy->getTypeID() == Type::FloatTyID) {
1423 assert(DstVecTy->isFloatingPointTy() && "Invalid UIToFP instruction");
1434 assert(DstTy->isFloatingPointTy() && "Invalid UIToFP instruction");
1435 if (DstTy->getTypeID() == Type::FloatTyID)
1448 if (isa<VectorType>(SrcVal->getType())) {
1449 Type *DstVecTy = DstTy->getScalarType();
1451 // the sizes of src and dst vectors must be equal
1454 if (DstVecTy->getTypeID() == Type::FloatTyID) {
1455 assert(DstVecTy->isFloatingPointTy() && "Invalid SIToFP instruction");
1466 assert(DstTy->isFloatingPointTy() && "Invalid SIToFP instruction");
1468 if (DstTy->getTypeID() == Type::FloatTyID)
1480 uint32_t DBitWidth = cast<IntegerType>(DstTy)->getBitWidth();
1482 assert(SrcVal->getType()->isPointerTy() && "Invalid PtrToInt instruction");
1491 assert(DstTy->isPointerTy() && "Invalid PtrToInt instruction");
1504 // This instruction supports bitwise conversion of vectors to integers and
1505 // to vectors of other types (as long as they have the same size)
1506 Type *SrcTy = SrcVal->getType();
1522 SrcElemTy = SrcTy->getScalarType();
1523 SrcBitSize = SrcTy->getScalarSizeInBits();
1529 SrcBitSize = SrcTy->getPrimitiveSizeInBits();
1535 DstElemTy = DstTy->getScalarType();
1536 DstBitSize = DstTy->getScalarSizeInBits();
1540 DstBitSize = DstTy->getPrimitiveSizeInBits();
1549 if (SrcElemTy->isFloatTy()) {
1554 } else if (SrcElemTy->isDoubleTy()) {
1558 } else if (SrcElemTy->isIntegerTy()) {
1575 unsigned ShiftAmt = isLittleEndian ? 0 : SrcBitSize * (Ratio - 1);
1582 ShiftAmt += isLittleEndian ? SrcBitSize : -SrcBitSize;
1591 unsigned ShiftAmt = isLittleEndian ? 0 : DstBitSize * (Ratio - 1);
1600 ShiftAmt += isLittleEndian ? DstBitSize : -DstBitSize;
1608 if (DstElemTy->isDoubleTy()) {
1613 } else if (DstElemTy->isFloatTy()) {
1622 if (DstElemTy->isDoubleTy())
1624 else if (DstElemTy->isFloatTy()) {
1633 if (DstTy->isPointerTy()) {
1634 assert(SrcTy->isPointerTy() && "Invalid BitCast");
1636 } else if (DstTy->isIntegerTy()) {
1637 if (SrcTy->isFloatTy())
1639 else if (SrcTy->isDoubleTy()) {
1641 } else if (SrcTy->isIntegerTy()) {
1646 } else if (DstTy->isFloatTy()) {
1647 if (SrcTy->isIntegerTy())
1652 } else if (DstTy->isDoubleTy()) {
1653 if (SrcTy->isIntegerTy())
1733 // (ec-stack-depth var-arg-index) pair.
1739 switch (Ty->getTypeID()) {
1768 switch (Ty->getTypeID()) {
1800 Type *TyContained = Ty->getElementType();
1807 switch (TyContained->getTypeID()) {
1836 Type *TyContained = Ty->getElementType();
1843 switch (TyContained->getTypeID()) {
1853 Dest.AggregateVal[i].IntVal = Src2.AggregateVal[j-src1Size].IntVal;
1869 Dest.AggregateVal[i].FloatVal = Src2.AggregateVal[j-src1Size].FloatVal;
1881 Src2.AggregateVal[j-src1Size].DoubleVal;
1897 unsigned Num = I.getNumIndices();
1900 for (unsigned i = 0 ; i < Num; ++i) {
1901 pSrc = &pSrc->AggregateVal[*IdxBegin];
1905 Type *IndexedType = ExtractValueInst::getIndexedType(Agg->getType(), I.getIndices());
1906 switch (IndexedType->getTypeID()) {
1911 Dest.IntVal = pSrc->IntVal;
1914 Dest.FloatVal = pSrc->FloatVal;
1917 Dest.DoubleVal = pSrc->DoubleVal;
1923 Dest.AggregateVal = pSrc->AggregateVal;
1926 Dest.PointerVal = pSrc->PointerVal;
1943 unsigned Num = I.getNumIndices();
1946 for (unsigned i = 0 ; i < Num; ++i) {
1947 pDest = &pDest->AggregateVal[*IdxBegin];
1952 Type *IndexedType = ExtractValueInst::getIndexedType(Agg->getType(), I.getIndices());
1954 switch (IndexedType->getTypeID()) {
1959 pDest->IntVal = Src2.IntVal;
1962 pDest->FloatVal = Src2.FloatVal;
1965 pDest->DoubleVal = Src2.DoubleVal;
1971 pDest->AggregateVal = Src2.AggregateVal;
1974 pDest->PointerVal = Src2.PointerVal;
1983 switch (CE->getOpcode()) {
1985 return executeTruncInst(CE->getOperand(0), CE->getType(), SF);
1987 return executePtrToIntInst(CE->getOperand(0), CE->getType(), SF);
1989 return executeIntToPtrInst(CE->getOperand(0), CE->getType(), SF);
1991 return executeBitCastInst(CE->getOperand(0), CE->getType(), SF);
1993 return executeGEPOperation(CE->getOperand(0), gep_type_begin(CE),
2000 GenericValue Op0 = getOperandValue(CE->getOperand(0), SF);
2001 GenericValue Op1 = getOperandValue(CE->getOperand(1), SF);
2003 switch (CE->getOpcode()) {
2005 case Instruction::Sub: Dest.IntVal = Op0.IntVal - Op1.IntVal; break;
2030 //===----------------------------------------------------------------------===//
2032 //===----------------------------------------------------------------------===//
2034 //===----------------------------------------------------------------------===//
2035 // callFunction - Execute the specified function...
2039 ECStack.back().Caller->arg_size() == ArgVals.size()) &&
2047 if (F->isDeclaration()) {
2050 popStackAndReturnValueToCaller (F->getReturnType (), Result);
2055 StackFrame.CurBB = &F->front();
2056 StackFrame.CurInst = StackFrame.CurBB->begin();
2059 assert((ArgVals.size() == F->arg_size() ||
2060 (ArgVals.size() > F->arg_size() && F->getFunctionType()->isVarArg()))&&
2063 // Handle non-varargs arguments...
2065 for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();