51 #define DEBUG_TYPE "x86tti" 120 bool Vector = (ClassID == 1);
135 if (ST->
hasAVX512() && PreferVectorWidth >= 512)
137 if (ST->
hasAVX() && PreferVectorWidth >= 256)
139 if (ST->
hasSSE1() && PreferVectorWidth >= 128)
183 assert(ISD &&
"Invalid opcode");
195 return LT.first *
Entry->Cost;
224 bool Op1Signed =
false;
226 bool Op2Signed =
false;
229 bool signedMode = Op1Signed | Op2Signed;
230 unsigned OpMinSize =
std::max(Op1MinSize, Op2MinSize);
234 if (!signedMode && OpMinSize <= 8)
238 if (!signedMode && OpMinSize <= 16)
290 static const CostTblEntry AVX512BWUniformConstCostTable[] = {
303 static const CostTblEntry AVX512UniformConstCostTable[] = {
316 static const CostTblEntry AVX2UniformConstCostTable[] = {
331 static const CostTblEntry SSE2UniformConstCostTable[] = {
344 if (
const auto *
Entry =
363 if (
const auto *
Entry =
378 if (
const auto *
Entry =
437 return LT.first * 32;
439 return LT.first * 38;
441 return LT.first * 15;
443 return LT.first * 20;
459 if (
const auto *
Entry =
481 if (
const auto *
Entry =
624 if (
const auto *
Entry =
629 static const CostTblEntry SSE2UniformShiftCostTable[] = {
880 Opcode, Ty->getScalarType(), Op1Info, Op2Info,
882 return 20 *
LT.first *
LT.second.getVectorNumElements() * ScalarCost;
908 int NumElts = LT.second.getVectorNumElements();
909 if ((Index % NumElts) == 0)
912 if (SubLT.second.isVector()) {
913 int NumSubElts = SubLT.second.getVectorNumElements();
914 if ((Index % NumSubElts) == 0 && (NumElts % NumSubElts) == 0)
923 if (NumSubElts > OrigSubElts &&
924 (Index % OrigSubElts) == 0 && (NumSubElts % OrigSubElts) == 0 &&
925 LT.second.getVectorElementType() ==
926 SubLT.second.getVectorElementType() &&
927 LT.second.getVectorElementType().getSizeInBits() ==
929 assert(NumElts >= NumSubElts && NumElts > OrigSubElts &&
930 "Unexpected number of elements!");
935 int ExtractIndex =
alignDown((Index % NumElts), NumSubElts);
937 ExtractIndex, SubTy);
942 return ExtractCost + 1;
945 "Unexpected vector size");
947 return ExtractCost + 2;
956 MVT LegalVT = LT.second;
965 unsigned NumOfSrcs = (VecTySize + LegalVTSize - 1) / LegalVTSize;
967 unsigned NumOfDests = LT.first;
972 unsigned NumOfShuffles = (NumOfSrcs - 1) * NumOfDests;
973 return NumOfShuffles *
983 int NumOfDests = LT.first;
984 int NumOfShufflesPerDest = LT.first * 2 - 1;
985 LT.first = NumOfDests * NumOfShufflesPerDest;
1001 if (
const auto *
Entry =
1003 return LT.first *
Entry->Cost;
1028 if (
const auto *
Entry =
1030 return LT.first *
Entry->Cost;
1073 return LT.first *
Entry->Cost;
1114 return LT.first *
Entry->Cost;
1136 return LT.first *
Entry->Cost;
1183 return LT.first *
Entry->Cost;
1196 return LT.first *
Entry->Cost;
1217 return LT.first *
Entry->Cost;
1256 return LT.first *
Entry->Cost;
1268 return LT.first *
Entry->Cost;
1276 assert(ISD &&
"Invalid opcode");
1641 LTDest.second, LTSrc.second))
1642 return LTSrc.first *
Entry->Cost;
1662 SimpleDstTy, SimpleSrcTy))
1667 SimpleDstTy, SimpleSrcTy))
1672 SimpleDstTy, SimpleSrcTy))
1678 SimpleDstTy, SimpleSrcTy))
1684 SimpleDstTy, SimpleSrcTy))
1690 SimpleDstTy, SimpleSrcTy))
1696 SimpleDstTy, SimpleSrcTy))
1708 MVT MTy = LT.second;
1711 assert(ISD &&
"Invalid opcode");
1713 unsigned ExtraCost = 0;
1714 if (I && (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp)) {
1720 switch (cast<CmpInst>(I)->getPredicate()) {
1721 case CmpInst::Predicate::ICMP_NE:
1725 case CmpInst::Predicate::ICMP_SGE:
1726 case CmpInst::Predicate::ICMP_SLE:
1730 case CmpInst::Predicate::ICMP_ULT:
1731 case CmpInst::Predicate::ICMP_UGT:
1736 case CmpInst::Predicate::ICMP_ULE:
1737 case CmpInst::Predicate::ICMP_UGE:
1847 return LT.first * (ExtraCost +
Entry->Cost);
1851 return LT.first * (ExtraCost +
Entry->Cost);
1855 return LT.first * (ExtraCost +
Entry->Cost);
1859 return LT.first * (ExtraCost +
Entry->Cost);
1863 return LT.first * (ExtraCost +
Entry->Cost);
1867 return LT.first * (ExtraCost +
Entry->Cost);
1871 return LT.first * (ExtraCost +
Entry->Cost);
1875 return LT.first * (ExtraCost +
Entry->Cost);
1879 return LT.first * (ExtraCost +
Entry->Cost);
1888 unsigned ScalarizationCostPassed) {
2161 case Intrinsic::bitreverse:
2164 case Intrinsic::bswap:
2167 case Intrinsic::ctlz:
2170 case Intrinsic::ctpop:
2173 case Intrinsic::cttz:
2176 case Intrinsic::sadd_sat:
2179 case Intrinsic::ssub_sat:
2182 case Intrinsic::uadd_sat:
2185 case Intrinsic::usub_sat:
2188 case Intrinsic::sqrt:
2191 case Intrinsic::sadd_with_overflow:
2192 case Intrinsic::ssub_with_overflow:
2197 case Intrinsic::uadd_with_overflow:
2198 case Intrinsic::usub_with_overflow:
2208 MVT MTy = LT.second;
2213 return LT.first *
Entry->Cost;
2217 return LT.first *
Entry->Cost;
2221 return LT.first *
Entry->Cost;
2225 return LT.first *
Entry->Cost;
2229 return LT.first *
Entry->Cost;
2233 return LT.first *
Entry->Cost;
2237 return LT.first *
Entry->Cost;
2241 return LT.first *
Entry->Cost;
2245 return LT.first *
Entry->Cost;
2249 return LT.first *
Entry->Cost;
2253 return LT.first *
Entry->Cost;
2257 return LT.first *
Entry->Cost;
2262 return LT.first *
Entry->Cost;
2265 return LT.first *
Entry->Cost;
2271 return LT.first *
Entry->Cost;
2274 return LT.first *
Entry->Cost;
2281 return LT.first *
Entry->Cost;
2284 return LT.first *
Entry->Cost;
2347 case Intrinsic::fshl:
2349 if (Args[0] == Args[1])
2352 case Intrinsic::fshr:
2355 if (Args[0] == Args[1])
2363 MVT MTy = LT.second;
2368 return LT.first *
Entry->Cost;
2372 return LT.first *
Entry->Cost;
2376 return LT.first *
Entry->Cost;
2379 return LT.first *
Entry->Cost;
2402 if (!LT.second.isVector())
2406 unsigned Width = LT.second.getVectorNumElements();
2407 Index = Index %
Width;
2411 if (ScalarType->isFloatingPointTy())
2415 if (ScalarType->isIntegerTy())
2420 assert(ISD &&
"Unexpected vector opcode");
2424 return LT.first *
Entry->Cost;
2429 int RegisterFileMoveCost = 0;
2430 if (Opcode == Instruction::ExtractElement && ScalarType->isPointerTy())
2431 RegisterFileMoveCost = 1;
2440 if (
VectorType *VTy = dyn_cast<VectorType>(Src)) {
2441 unsigned NumElem = VTy->getVectorNumElements();
2445 if (NumElem == 3 && VTy->getScalarSizeInBits() == 32)
2450 if (NumElem == 3 && VTy->getScalarSizeInBits() == 64)
2460 return NumElem * Cost + SplitCost;
2470 int Cost = LT.first * 1;
2502 int MaskCmpCost = NumElem * (BranchCost + ScalarCompareCost);
2508 return MemopCost + ValueSplitCost + MaskSplitCost + MaskCmpCost;
2515 if (VT.isSimple() && LT.second != VT.getSimpleVT() &&
2516 LT.second.getVectorNumElements() == NumElem)
2521 else if (LT.second.getVectorNumElements() > NumElem) {
2530 return Cost + LT.first * (IsLoad ? 2 : 8);
2533 return Cost + LT.first;
2542 const unsigned NumVectorInstToHideOverhead = 10;
2553 return NumVectorInstToHideOverhead;
2628 assert(ISD &&
"Invalid opcode");
2665 MVT MTy = LT.second;
2670 return LT.first *
Entry->Cost;
2674 return LT.first *
Entry->Cost;
2678 return LT.first *
Entry->Cost;
2682 return LT.first *
Entry->Cost;
2686 return LT.first *
Entry->Cost;
2690 return LT.first *
Entry->Cost;
2744 return LT.first *
Entry->Cost;
2747 return LT.first *
Entry->Cost;
2750 return LT.first *
Entry->Cost;
2753 return LT.first *
Entry->Cost;
2760 bool IsPairwise,
bool IsUnsigned) {
2763 MVT MTy = LT.second;
2770 "Expected float point or integer vector type.");
2918 static const CostTblEntry AVX512CostTblNoPairWise[] = {
2930 return LT.first *
Entry->Cost;
2934 return LT.first *
Entry->Cost;
2938 return LT.first *
Entry->Cost;
2942 return LT.first *
Entry->Cost;
2946 return LT.first *
Entry->Cost;
2950 return LT.first *
Entry->Cost;
2954 return LT.first *
Entry->Cost;
2957 if (
const auto *
Entry =
2959 return LT.first *
Entry->Cost;
2963 return LT.first *
Entry->Cost;
2967 return LT.first *
Entry->Cost;
2971 return LT.first *
Entry->Cost;
2975 return LT.first *
Entry->Cost;
2979 return LT.first *
Entry->Cost;
2983 return LT.first *
Entry->Cost;
3021 if (BitSize % 64 != 0)
3027 for (
unsigned ShiftVal = 0; ShiftVal < BitSize; ShiftVal += 64) {
3046 unsigned ImmIdx = ~0U;
3050 case Instruction::GetElementPtr:
3060 case Instruction::ICmp:
3068 if (ImmVal == 0x100000000ULL || ImmVal == 0xffffffff)
3073 case Instruction::And:
3082 case Instruction::Sub:
3088 case Instruction::UDiv:
3089 case Instruction::SDiv:
3090 case Instruction::URem:
3091 case Instruction::SRem:
3096 case Instruction::Mul:
3097 case Instruction::Or:
3098 case Instruction::Xor:
3102 case Instruction::Shl:
3103 case Instruction::LShr:
3104 case Instruction::AShr:
3108 case Instruction::Trunc:
3109 case Instruction::ZExt:
3110 case Instruction::SExt:
3111 case Instruction::IntToPtr:
3112 case Instruction::PtrToInt:
3113 case Instruction::BitCast:
3114 case Instruction::PHI:
3122 if (Idx == ImmIdx) {
3146 case Intrinsic::sadd_with_overflow:
3147 case Intrinsic::uadd_with_overflow:
3148 case Intrinsic::ssub_with_overflow:
3149 case Intrinsic::usub_with_overflow:
3150 case Intrinsic::smul_with_overflow:
3151 case Intrinsic::umul_with_overflow:
3155 case Intrinsic::experimental_stackmap:
3159 case Intrinsic::experimental_patchpoint_void:
3160 case Intrinsic::experimental_patchpoint_i64:
3170 if (isa<StoreInst>(U)) {
3174 if (
auto GEP = dyn_cast<GetElementPtrInst>(Ptr)) {
3175 if (!
all_of(
GEP->indices(), [](
Value *V) {
return isa<Constant>(V); }))
3184 int X86TTIImpl::getGSVectorCost(
unsigned Opcode,
Type *SrcVTy,
Value *Ptr,
3187 assert(isa<VectorType>(SrcVTy) &&
"Unexpected type in getGSVectorCost");
3198 if (IndexSize < 64 || !GEP)
3201 unsigned NumOfVarIndices = 0;
3213 ++NumOfVarIndices > 1)
3216 return (
unsigned)32;
3222 unsigned IndexSize = (ST->
hasAVX512() && VF >= 16)
3223 ? getIndexSizeInBits(Ptr,
DL)
3230 int SplitFactor =
std::max(IdxsLT.first, SrcLT.first);
3231 if (SplitFactor > 1) {
3234 return SplitFactor * getGSVectorCost(Opcode, SplitSrcTy, Ptr, Alignment,
3255 int X86TTIImpl::getGSScalarCost(
unsigned Opcode,
Type *SrcVTy,
3256 bool VariableMask,
unsigned Alignment,
3257 unsigned AddressSpace) {
3260 int MaskUnpackCost = 0;
3265 int ScalarCompareCost =
3269 MaskUnpackCost += VF * (BranchCost + ScalarCompareCost);
3276 int InsertExtractCost = 0;
3278 for (
unsigned i = 0; i < VF; ++i)
3280 InsertExtractCost +=
3283 for (
unsigned i = 0; i < VF; ++i)
3285 InsertExtractCost +=
3288 return MemoryOpCost + MaskUnpackCost + InsertExtractCost;
3293 Value *Ptr,
bool VariableMask,
3294 unsigned Alignment) {
3300 assert(PtrTy &&
"Unexpected type for Ptr argument");
3303 bool Scalarize =
false;
3319 return getGSScalarCost(Opcode, SrcVTy, VariableMask, Alignment,
3322 return getGSVectorCost(Opcode, SrcVTy, Ptr, Alignment, AddressSpace);
3359 return IntWidth == 32 || IntWidth == 64 ||
3360 ((IntWidth == 8 || IntWidth == 16) && ST->
hasBWI());
3372 if (Alignment >= DataSize && (DataSize == 16 || DataSize == 32))
3389 if (Alignment < DataSize || DataSize < 4 || DataSize > 32 ||
3397 else if (DataSize == 16)
3403 if (!isa<VectorType>(DataTy))
3422 return IntWidth == 32 || IntWidth == 64 ||
3423 ((IntWidth == 8 || IntWidth == 16) && ST->
hasVBMI2());
3449 if (isa<VectorType>(DataTy)) {
3465 return IntWidth == 32 || IntWidth == 64;
3494 FeatureBitset RealCallerBits = CallerBits & ~InlineFeatureIgnoreList;
3495 FeatureBitset RealCalleeBits = CalleeBits & ~InlineFeatureIgnoreList;
3496 return (RealCallerBits & RealCalleeBits) == RealCalleeBits;
3562 unsigned AddressSpace,
3563 bool UseMaskForCond,
3564 bool UseMaskForGaps) {
3566 if (UseMaskForCond || UseMaskForGaps)
3568 Alignment, AddressSpace,
3569 UseMaskForCond, UseMaskForGaps);
3573 if (Indices.
size() && Indices.
size() != Factor)
3575 Alignment, AddressSpace);
3587 Alignment, AddressSpace);
3596 unsigned NumOfMemOps = (VecTySize + LegalVTSize - 1) / LegalVTSize;
3608 Alignment, AddressSpace);
3637 static const CostTblEntry AVX2InterleavedStoreTbl[] = {
3655 if (
const auto *
Entry =
3657 return NumOfMemOps * MemOpCost +
Entry->Cost;
3660 "Expected Store Instruction at this point");
3661 if (
const auto *
Entry =
3663 return NumOfMemOps * MemOpCost +
Entry->Cost;
3667 Alignment, AddressSpace);
3678 unsigned AddressSpace,
3679 bool UseMaskForCond,
3680 bool UseMaskForGaps) {
3682 if (UseMaskForCond || UseMaskForGaps)
3684 Alignment, AddressSpace,
3685 UseMaskForCond, UseMaskForGaps);
3696 unsigned NumOfMemOps = (VecTySize + LegalVTSize - 1) / LegalVTSize;
3714 static const CostTblEntry AVX512InterleavedLoadTbl[] = {
3720 if (
const auto *
Entry =
3722 return NumOfMemOps * MemOpCost +
Entry->Cost;
3731 unsigned ShuffleCost =
3734 unsigned NumOfLoadsInInterleaveGrp =
3735 Indices.
size() ? Indices.
size() : Factor;
3738 unsigned NumOfResults =
3740 NumOfLoadsInInterleaveGrp;
3744 unsigned NumOfUnfoldedLoads =
3745 NumOfResults > 1 ? NumOfMemOps : NumOfMemOps / 2;
3748 unsigned NumOfShufflesPerResult =
3749 std::max((
unsigned)1, (
unsigned)(NumOfMemOps - 1));
3754 unsigned NumOfMoves = 0;
3756 NumOfMoves = NumOfResults * NumOfShufflesPerResult / 2;
3758 int Cost = NumOfResults * NumOfShufflesPerResult * ShuffleCost +
3759 NumOfUnfoldedLoads * MemOpCost + NumOfMoves;
3766 "Expected Store Instruction at this point");
3768 static const CostTblEntry AVX512InterleavedStoreTbl[] = {
3779 if (
const auto *
Entry =
3781 return NumOfMemOps * MemOpCost +
Entry->Cost;
3786 unsigned NumOfSources = Factor;
3787 unsigned ShuffleCost =
3789 unsigned NumOfShufflesPerStore = NumOfSources - 1;
3793 unsigned NumOfMoves = NumOfMemOps * NumOfShufflesPerStore / 2;
3794 int Cost = NumOfMemOps * (MemOpCost + NumOfShufflesPerStore * ShuffleCost) +
3803 unsigned AddressSpace,
3804 bool UseMaskForCond,
3805 bool UseMaskForGaps) {
3806 auto isSupportedOnAVX512 = [](
Type *VecTy,
bool HasBW) {
3817 Alignment, AddressSpace,
3818 UseMaskForCond, UseMaskForGaps);
3821 Alignment, AddressSpace,
3822 UseMaskForCond, UseMaskForGaps);
3825 Alignment, AddressSpace,
3826 UseMaskForCond, UseMaskForGaps);
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
Type * getVectorElementType() const
constexpr bool isUInt< 32 >(uint64_t x)
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
A parsed version of the target data layout string in and methods for querying it. ...
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
Value * getPointerOperand()
static IntegerType * getInt1Ty(LLVMContext &C)
llvm::Optional< unsigned > getCacheSize(TargetTransformInfo::CacheLevel Level) const
uint64_t getZExtValue() const
Get zero extended value.
APInt sext(unsigned width) const
Sign extend to a new width.
DELETED_NODE - This is an illegal value that is used to catch errors.
This class represents lattice values for constants.
static MVT getVectorVT(MVT VT, unsigned NumElements)
Cost tables and simple lookup functions.
int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
bool isFCmpOrdCheaperThanFCmpZero(Type *Ty)
int getGatherScatterOpCost(unsigned Opcode, Type *DataTy, Value *Ptr, bool VariableMask, unsigned Alignment)
Calculate the cost of Gather / Scatter operation.
const Value * getSplatValue(const Value *V)
Get splat value if the input is a splat vector or return nullptr.
bool isVector() const
Return true if this is a vector value type.
unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract)
Estimate the overhead of scalarizing an instruction.
void push_back(const T &Elt)
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
The main scalar evolution driver.
unsigned getNumberOfRegisters(unsigned ClassID) const
unsigned getRegisterBitWidth(bool Vector) const
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
unsigned getVectorNumElements() const
bool isLegalMaskedLoad(Type *DataType, MaybeAlign Alignment)
bool isLegalMaskedStore(Type *DataType, MaybeAlign Alignment)
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
bool useAVX512Regs() const
Type Conversion Cost Table.
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
bool isVectorTy() const
True if this is an instance of VectorType.
bool isLegalNTLoad(Type *DataType, Align Alignment)
bool isLegalNTStore(Type *DataType, Align Alignment)
unsigned getAtomicMemIntrinsicMaxElementSize() const
unsigned getBitWidth() const
Return the number of bits in the APInt.
int getGatherOverhead() const
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
unsigned getMaxInterleaveFactor(unsigned VF)
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
bool areInlineCompatible(const Function *Caller, const Function *Callee) const
bool isUnalignedMem32Slow() const
unsigned getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy, ArrayRef< Value * > Args, FastMathFlags FMF, unsigned VF=1)
Get intrinsic cost based on arguments.
uint64_t alignDown(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the largest uint64_t less than or equal to Value and is Skew mod Align.
unsigned getAddressComputationCost(Type *Ty, ScalarEvolution *, const SCEV *)
int getInterleavedMemoryOpCostAVX2(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
const FeatureBitset & getFeatureBits() const
Shift and rotation operations.
bool isIntegerTy() const
True if this is an instance of IntegerType.
unsigned getArithmeticReductionCost(unsigned Opcode, Type *Ty, bool IsPairwise)
Try to calculate arithmetic and shuffle op costs for reduction operations.
const TypeConversionCostTblEntry * ConvertCostTableLookup(ArrayRef< TypeConversionCostTblEntry > Tbl, int ISD, MVT Dst, MVT Src)
Find in type conversion cost table, TypeTy must be comparable to CompareTy by ==. ...
mir Rename Register Operands
bool isLSRCostLess(TargetTransformInfo::LSRCost &C1, TargetTransformInfo::LSRCost &C2)
unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I)
int64_t getSExtValue() const
Get sign extended value.
unsigned getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, const Instruction *I=nullptr)
Type * getType() const
All values are typed, get the type of this value.
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
TypeSize getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
Simple integer binary arithmetic operators.
llvm::Optional< unsigned > getCacheAssociativity(TargetTransformInfo::CacheLevel Level) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
int getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE, const SCEV *Ptr)
MVT getVectorElementType() const
Value * getOperand(unsigned i) const
Class to represent pointers.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
Container class for subtarget features.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
The instances of the Type class are immutable: once they are created, they are never changed...
unsigned getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
Simple binary floating point operators.
size_t size() const
size - Get the array size.
unsigned getMinMaxReductionCost(Type *Ty, Type *CondTy, bool IsPairwise, bool)
Try to calculate op costs for min/max reduction operations.
bool isPointerTy() const
True if this is an instance of PointerType.
int getInterleavedMemoryOpCostAVX512(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
bool isLegalMaskedGather(Type *DataType, MaybeAlign Alignment)
unsigned getAddressSpace() const
Return the address space of the Pointer type.
int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace)
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
static MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
bool useGLMDivSqrtCosts() const
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
int getArithmeticReductionCost(unsigned Opcode, Type *Ty, bool IsPairwiseForm)
unsigned getUserCost(const User *U, ArrayRef< const Value *> Operands)
const TargetMachine & getTargetMachine() const
bool enableInterleavedAccessVectorization()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
This struct is a compact representation of a valid (non-zero power of two) alignment.
int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp)
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
unsigned getCFInstrCost(unsigned Opcode)
bool isAtom() const
TODO: to be removed later and replaced with suitable properties.
unsigned getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp)
APInt ashr(unsigned ShiftAmt) const
Arithmetic right-shift function.
RESULT = [US]ADDSAT(LHS, RHS) - Perform saturation addition on 2 integers with the same bit width (W)...
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
unsigned getNumOperands() const
constexpr bool isInt< 32 >(int64_t x)
Align max(MaybeAlign Lhs, Align Rhs)
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
bool areFunctionArgsABICompatible(const Function *Caller, const Function *Callee, SmallPtrSetImpl< Argument *> &Args) const
unsigned getPreferVectorWidth() const
Byte Swap and Counting operators.
unsigned getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, const Instruction *I=nullptr)
unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::OperandValueKind Opd1Info=TTI::OK_AnyValue, TTI::OperandValueKind Opd2Info=TTI::OK_AnyValue, TTI::OperandValueProperties Opd1PropInfo=TTI::OP_None, TTI::OperandValueProperties Opd2PropInfo=TTI::OP_None, ArrayRef< const Value * > Args=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
TypeSize getScalarSizeInBits() const
TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const
int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I=nullptr)
int getMinMaxReductionCost(Type *Ty, Type *CondTy, bool IsPairwiseForm, bool IsUnsigned)
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
unsigned getVectorNumElements() const
Class to represent vector types.
Class for arbitrary precision integers.
int getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, const Instruction *I=nullptr)
int getScatterOverhead() const
Select(COND, TRUEVAL, FALSEVAL).
unsigned getMaxExpandSizeMemcmp(bool OptSize) const
Get maximum # of load operations permitted for memcmp.
ZERO_EXTEND - Used for integer types, zeroing the new bits.
bool isLegalMaskedScatter(Type *DataType, MaybeAlign Alignment)
int InstructionOpcodeToISD(unsigned Opcode) const
Get the ISD node that corresponds to the Instruction class opcode.
unsigned getLoadStoreVecRegBitWidth(unsigned AS) const
const CostTblEntry * CostTableLookup(ArrayRef< CostTblEntry > Tbl, int ISD, MVT Ty)
Find in cost table, TypeTy must be comparable to CompareTy by ==.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Bitwise operators - logical and, logical or, logical xor.
This class represents an analyzed expression in the program.
int getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty)
unsigned getIntegerBitWidth() const
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
LegalizeTypeAction getTypeAction(LLVMContext &Context, EVT VT) const
Return how we should legalize values of this type, either it is already legal (return 'Legal') or we ...
int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, const Instruction *I=nullptr)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
RESULT = [US]SUBSAT(LHS, RHS) - Perform saturation subtraction on 2 integers with the same bit width ...
uint64_t divideCeil(uint64_t Numerator, uint64_t Denominator)
Returns the integer ceil(Numerator / Denominator).
bool isLegalMaskedCompressStore(Type *DataType)
bool hasBranchFusion() const
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
int getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::OperandValueKind Opd1Info=TTI::OK_AnyValue, TTI::OperandValueKind Opd2Info=TTI::OK_AnyValue, TTI::OperandValueProperties Opd1PropInfo=TTI::OP_None, TTI::OperandValueProperties Opd2PropInfo=TTI::OP_None, ArrayRef< const Value *> Args=ArrayRef< const Value *>(), const Instruction *CxtI=nullptr)
LLVM Value Representation.
bool isLegalMaskedExpandLoad(Type *DataType)
bool hasDivRemOp(Type *DataType, bool IsSigned)
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
bool hasMacroFusion() const
Primary interface to the complete machine description for the target machine.
int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty)
Convenience struct for specifying and reasoning about fast-math flags.
SetCC operator - This evaluates to a true value iff the condition is true.
bool hasFastGather() const
TRUNCATE - Completely drop the high bits.
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
const STC & getSubtarget(const Function &F) const
This method returns a pointer to the specified type of TargetSubtargetInfo.
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
int getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy, ArrayRef< Type *> Tys, FastMathFlags FMF, unsigned ScalarizationCostPassed=UINT_MAX)
static IntegerType * getInt8Ty(LLVMContext &C)
int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
std::pair< int, MVT > getTypeLegalizationCost(const DataLayout &DL, Type *Ty) const
Estimate the cost of type-legalization and the legalized type.
int getIntImmCost(int64_t)
Calculate the cost of materializing a 64-bit value.
Type * getContainedType(unsigned i) const
This method is used to implement the type iterator (defined at the end of the file).
This file describes how to lower LLVM code to machine code.