52 #define DEBUG_TYPE "x86tti" 135 if (ST->
hasAVX512() && PreferVectorWidth >= 512)
137 if (ST->
hasAVX() && PreferVectorWidth >= 256)
139 if (ST->
hasSSE1() && PreferVectorWidth >= 128)
173 unsigned Opcode,
Type *Ty,
182 assert(ISD &&
"Invalid opcode");
194 return LT.first * Entry->Cost;
223 bool Op1Signed =
false;
225 bool Op2Signed =
false;
228 bool signedMode = Op1Signed | Op2Signed;
229 unsigned OpMinSize =
std::max(Op1MinSize, Op2MinSize);
233 if (!signedMode && OpMinSize <= 8)
237 if (!signedMode && OpMinSize <= 16)
243 return LT.first * Entry->Cost;
289 static const CostTblEntry AVX512BWUniformConstCostTable[] = {
297 if (
const auto *Entry =
CostTableLookup(AVX512BWUniformConstCostTable, ISD,
299 return LT.first * Entry->Cost;
302 static const CostTblEntry AVX512UniformConstCostTable[] = {
310 if (
const auto *Entry =
CostTableLookup(AVX512UniformConstCostTable, ISD,
312 return LT.first * Entry->Cost;
315 static const CostTblEntry AVX2UniformConstCostTable[] = {
325 if (
const auto *Entry =
CostTableLookup(AVX2UniformConstCostTable, ISD,
327 return LT.first * Entry->Cost;
330 static const CostTblEntry SSE2UniformConstCostTable[] = {
343 if (
const auto *Entry =
345 return LT.first * Entry->Cost;
362 if (
const auto *Entry =
364 return LT.first * Entry->Cost;
377 if (
const auto *Entry =
379 return LT.first * Entry->Cost;
401 return LT.first * Entry->Cost;
436 return LT.first * 32;
438 return LT.first * 38;
440 return LT.first * 15;
442 return LT.first * 20;
445 return LT.first * Entry->Cost;
458 if (
const auto *Entry =
460 return LT.first * Entry->Cost;
480 if (
const auto *Entry =
482 return LT.first * Entry->Cost;
494 return LT.first * Entry->Cost;
521 return LT.first * Entry->Cost;
553 return LT.first * Entry->Cost;
582 return LT.first * Entry->Cost;
623 if (
const auto *Entry =
625 return LT.first * Entry->Cost;
628 static const CostTblEntry SSE2UniformShiftCostTable[] = {
652 if (
const auto *Entry =
654 return LT.first * Entry->Cost;
712 return LT.first * Entry->Cost;
748 return LT.first * Entry->Cost;
774 return LT.first * Entry->Cost;
803 return LT.first * Entry->Cost;
845 return LT.first * Entry->Cost;
868 return LT.first * Entry->Cost;
879 Opcode, Ty->getScalarType(), Op1Info, Op2Info,
881 return 20 *
LT.first *
LT.second.getVectorNumElements() * ScalarCost;
907 int NumElts = LT.second.getVectorNumElements();
908 if ((Index % NumElts) == 0)
911 if (SubLT.second.isVector()) {
912 int NumSubElts = SubLT.second.getVectorNumElements();
913 if ((Index % NumSubElts) == 0 && (NumElts % NumSubElts) == 0)
922 MVT LegalVT = LT.second;
931 unsigned NumOfSrcs = (VecTySize + LegalVTSize - 1) / LegalVTSize;
933 unsigned NumOfDests = LT.first;
938 unsigned NumOfShuffles = (NumOfSrcs - 1) * NumOfDests;
939 return NumOfShuffles *
949 int NumOfDests = LT.first;
950 int NumOfShufflesPerDest = LT.first * 2 - 1;
951 LT.first = NumOfDests * NumOfShufflesPerDest;
967 if (
const auto *Entry =
969 return LT.first * Entry->Cost;
994 if (
const auto *Entry =
996 return LT.first * Entry->Cost;
1039 return LT.first * Entry->Cost;
1080 return LT.first * Entry->Cost;
1102 return LT.first * Entry->Cost;
1149 return LT.first * Entry->Cost;
1162 return LT.first * Entry->Cost;
1183 return LT.first * Entry->Cost;
1222 return LT.first * Entry->Cost;
1234 return LT.first * Entry->Cost;
1242 assert(ISD &&
"Invalid opcode");
1582 LTDest.second, LTSrc.second))
1583 return LTSrc.first * Entry->Cost;
1603 SimpleDstTy, SimpleSrcTy))
1608 SimpleDstTy, SimpleSrcTy))
1613 SimpleDstTy, SimpleSrcTy))
1619 SimpleDstTy, SimpleSrcTy))
1625 SimpleDstTy, SimpleSrcTy))
1631 SimpleDstTy, SimpleSrcTy))
1637 SimpleDstTy, SimpleSrcTy))
1649 MVT MTy = LT.second;
1652 assert(ISD &&
"Invalid opcode");
1698 return LT.first * Entry->Cost;
1702 return LT.first * Entry->Cost;
1706 return LT.first * Entry->Cost;
1710 return LT.first * Entry->Cost;
1714 return LT.first * Entry->Cost;
1718 return LT.first * Entry->Cost;
1727 unsigned ScalarizationCostPassed) {
1995 MVT MTy = LT.second;
2000 return LT.first * Entry->Cost;
2004 return LT.first * Entry->Cost;
2008 return LT.first * Entry->Cost;
2012 return LT.first * Entry->Cost;
2016 return LT.first * Entry->Cost;
2020 return LT.first * Entry->Cost;
2024 return LT.first * Entry->Cost;
2028 return LT.first * Entry->Cost;
2032 return LT.first * Entry->Cost;
2036 return LT.first * Entry->Cost;
2040 return LT.first * Entry->Cost;
2044 return LT.first * Entry->Cost;
2048 return LT.first * Entry->Cost;
2051 return LT.first * Entry->Cost;
2116 if (Args[0] == Args[1])
2122 if (Args[0] == Args[1])
2130 MVT MTy = LT.second;
2135 return LT.first * Entry->Cost;
2139 return LT.first * Entry->Cost;
2143 return LT.first * Entry->Cost;
2146 return LT.first * Entry->Cost;
2162 if (!LT.second.isVector())
2166 unsigned Width = LT.second.getVectorNumElements();
2167 Index = Index % Width;
2170 if (ScalarType->isFloatingPointTy() && Index == 0)
2176 int RegisterFileMoveCost = 0;
2177 if (Opcode == Instruction::ExtractElement && ScalarType->isPointerTy())
2178 RegisterFileMoveCost = 1;
2186 if (
VectorType *VTy = dyn_cast<VectorType>(Src)) {
2187 unsigned NumElem = VTy->getVectorNumElements();
2191 if (NumElem == 3 && VTy->getScalarSizeInBits() == 32)
2196 if (NumElem == 3 && VTy->getScalarSizeInBits() == 64)
2206 return NumElem * Cost + SplitCost;
2216 int Cost = LT.first * 1;
2245 int MaskCmpCost = NumElem * (BranchCost + ScalarCompareCost);
2252 return MemopCost + ValueSplitCost + MaskSplitCost + MaskCmpCost;
2259 if (VT.isSimple() && LT.second != VT.getSimpleVT() &&
2260 LT.second.getVectorNumElements() == NumElem)
2265 else if (LT.second.getVectorNumElements() > NumElem) {
2272 return Cost + LT.first*4;
2275 return Cost+LT.first;
2284 unsigned NumVectorInstToHideOverhead = 10;
2295 return NumVectorInstToHideOverhead;
2308 MVT MTy = LT.second;
2311 assert(ISD &&
"Invalid opcode");
2356 if (
const auto *Entry =
CostTableLookup(AVX1CostTblPairWise, ISD, MTy))
2357 return LT.first * Entry->Cost;
2360 if (
const auto *Entry =
CostTableLookup(SSE42CostTblPairWise, ISD, MTy))
2361 return LT.first * Entry->Cost;
2364 if (
const auto *Entry =
CostTableLookup(AVX1CostTblNoPairWise, ISD, MTy))
2365 return LT.first * Entry->Cost;
2368 if (
const auto *Entry =
CostTableLookup(SSE42CostTblNoPairWise, ISD, MTy))
2369 return LT.first * Entry->Cost;
2376 bool IsPairwise,
bool IsUnsigned) {
2379 MVT MTy = LT.second;
2386 "Expected float point or integer vector type.");
2474 static const CostTblEntry AVX512CostTblNoPairWise[] = {
2485 if (
const auto *Entry =
CostTableLookup(AVX512CostTblPairWise, ISD, MTy))
2486 return LT.first * Entry->Cost;
2489 if (
const auto *Entry =
CostTableLookup(AVX2CostTblPairWise, ISD, MTy))
2490 return LT.first * Entry->Cost;
2493 if (
const auto *Entry =
CostTableLookup(AVX1CostTblPairWise, ISD, MTy))
2494 return LT.first * Entry->Cost;
2497 if (
const auto *Entry =
CostTableLookup(SSE42CostTblPairWise, ISD, MTy))
2498 return LT.first * Entry->Cost;
2501 if (
const auto *Entry =
2503 return LT.first * Entry->Cost;
2506 if (
const auto *Entry =
CostTableLookup(AVX2CostTblNoPairWise, ISD, MTy))
2507 return LT.first * Entry->Cost;
2510 if (
const auto *Entry =
CostTableLookup(AVX1CostTblNoPairWise, ISD, MTy))
2511 return LT.first * Entry->Cost;
2514 if (
const auto *Entry =
CostTableLookup(SSE42CostTblNoPairWise, ISD, MTy))
2515 return LT.first * Entry->Cost;
2553 if (BitSize % 64 != 0)
2559 for (
unsigned ShiftVal = 0; ShiftVal < BitSize; ShiftVal += 64) {
2578 unsigned ImmIdx = ~0U;
2582 case Instruction::GetElementPtr:
2592 case Instruction::ICmp:
2600 if (ImmVal == 0x100000000ULL || ImmVal == 0xffffffff)
2605 case Instruction::And:
2614 case Instruction::Sub:
2620 case Instruction::UDiv:
2621 case Instruction::SDiv:
2622 case Instruction::URem:
2623 case Instruction::SRem:
2628 case Instruction::Mul:
2629 case Instruction::Or:
2630 case Instruction::Xor:
2634 case Instruction::Shl:
2635 case Instruction::LShr:
2636 case Instruction::AShr:
2640 case Instruction::Trunc:
2641 case Instruction::ZExt:
2642 case Instruction::SExt:
2643 case Instruction::IntToPtr:
2644 case Instruction::PtrToInt:
2645 case Instruction::BitCast:
2646 case Instruction::PHI:
2654 if (Idx == ImmIdx) {
2702 if (isa<StoreInst>(U)) {
2706 if (
auto GEP = dyn_cast<GetElementPtrInst>(Ptr)) {
2707 if (!
all_of(
GEP->indices(), [](
Value *V) {
return isa<Constant>(V); }))
2716 int X86TTIImpl::getGSVectorCost(
unsigned Opcode,
Type *SrcVTy,
Value *Ptr,
2719 assert(isa<VectorType>(SrcVTy) &&
"Unexpected type in getGSVectorCost");
2730 if (IndexSize < 64 || !GEP)
2733 unsigned NumOfVarIndices = 0;
2745 ++NumOfVarIndices > 1)
2748 return (
unsigned)32;
2754 unsigned IndexSize = (ST->
hasAVX512() && VF >= 16)
2755 ? getIndexSizeInBits(Ptr,
DL)
2762 int SplitFactor =
std::max(IdxsLT.first, SrcLT.first);
2763 if (SplitFactor > 1) {
2766 return SplitFactor * getGSVectorCost(Opcode, SplitSrcTy, Ptr, Alignment,
2787 int X86TTIImpl::getGSScalarCost(
unsigned Opcode,
Type *SrcVTy,
2788 bool VariableMask,
unsigned Alignment,
2789 unsigned AddressSpace) {
2792 int MaskUnpackCost = 0;
2797 int ScalarCompareCost =
2801 MaskUnpackCost += VF * (BranchCost + ScalarCompareCost);
2808 int InsertExtractCost = 0;
2810 for (
unsigned i = 0; i < VF; ++i)
2812 InsertExtractCost +=
2815 for (
unsigned i = 0; i < VF; ++i)
2817 InsertExtractCost +=
2820 return MemoryOpCost + MaskUnpackCost + InsertExtractCost;
2825 Value *Ptr,
bool VariableMask,
2826 unsigned Alignment) {
2832 assert(PtrTy &&
"Unexpected type for Ptr argument");
2835 bool Scalarize =
false;
2849 return getGSScalarCost(Opcode, SrcVTy, VariableMask, Alignment,
2852 return getGSVectorCost(Opcode, SrcVTy, Ptr, Alignment, AddressSpace);
2875 int DataWidth = isa<PointerType>(ScalarTy) ?
2878 return ((DataWidth == 32 || DataWidth == 64) && ST->
hasAVX()) ||
2879 ((DataWidth == 8 || DataWidth == 16) && ST->
hasBWI());
2899 if (isa<VectorType>(DataTy)) {
2905 int DataWidth = isa<PointerType>(ScalarTy) ?
2911 return (DataWidth == 32 || DataWidth == 64) &&
2944 return (CallerBits & CalleeBits) == CalleeBits;
2951 static const auto ThreeWayOptions = [
this]() {
2961 static const auto EqZeroOptions = [
this]() {
2978 return IsZeroCmp ? &EqZeroOptions : &ThreeWayOptions;
3004 unsigned AddressSpace,
3005 bool UseMaskForCond,
3006 bool UseMaskForGaps) {
3008 if (UseMaskForCond || UseMaskForGaps)
3010 Alignment, AddressSpace,
3011 UseMaskForCond, UseMaskForGaps);
3015 if (Indices.
size() && Indices.
size() != Factor)
3017 Alignment, AddressSpace);
3029 Alignment, AddressSpace);
3038 unsigned NumOfMemOps = (VecTySize + LegalVTSize - 1) / LegalVTSize;
3043 unsigned MemOpCost =
3050 Alignment, AddressSpace);
3079 static const CostTblEntry AVX2InterleavedStoreTbl[] = {
3097 if (
const auto *Entry =
3099 return NumOfMemOps * MemOpCost + Entry->Cost;
3102 "Expected Store Instruction at this point");
3103 if (
const auto *Entry =
3105 return NumOfMemOps * MemOpCost + Entry->Cost;
3109 Alignment, AddressSpace);
3120 unsigned AddressSpace,
3121 bool UseMaskForCond,
3122 bool UseMaskForGaps) {
3124 if (UseMaskForCond || UseMaskForGaps)
3126 Alignment, AddressSpace,
3127 UseMaskForCond, UseMaskForGaps);
3138 unsigned NumOfMemOps = (VecTySize + LegalVTSize - 1) / LegalVTSize;
3143 unsigned MemOpCost =
3156 static const CostTblEntry AVX512InterleavedLoadTbl[] = {
3162 if (
const auto *Entry =
3164 return NumOfMemOps * MemOpCost + Entry->Cost;
3173 unsigned ShuffleCost =
3176 unsigned NumOfLoadsInInterleaveGrp =
3177 Indices.
size() ? Indices.
size() : Factor;
3180 unsigned NumOfResults =
3182 NumOfLoadsInInterleaveGrp;
3186 unsigned NumOfUnfoldedLoads =
3187 NumOfResults > 1 ? NumOfMemOps : NumOfMemOps / 2;
3190 unsigned NumOfShufflesPerResult =
3191 std::max((
unsigned)1, (
unsigned)(NumOfMemOps - 1));
3196 unsigned NumOfMoves = 0;
3198 NumOfMoves = NumOfResults * NumOfShufflesPerResult / 2;
3200 int Cost = NumOfResults * NumOfShufflesPerResult * ShuffleCost +
3201 NumOfUnfoldedLoads * MemOpCost + NumOfMoves;
3208 "Expected Store Instruction at this point");
3210 static const CostTblEntry AVX512InterleavedStoreTbl[] = {
3221 if (
const auto *Entry =
3223 return NumOfMemOps * MemOpCost + Entry->Cost;
3228 unsigned NumOfSources = Factor;
3229 unsigned ShuffleCost =
3231 unsigned NumOfShufflesPerStore = NumOfSources - 1;
3235 unsigned NumOfMoves = NumOfMemOps * NumOfShufflesPerStore / 2;
3236 int Cost = NumOfMemOps * (MemOpCost + NumOfShufflesPerStore * ShuffleCost) +
3245 unsigned AddressSpace,
3246 bool UseMaskForCond,
3247 bool UseMaskForGaps) {
3248 auto isSupportedOnAVX512 = [](
Type *VecTy,
bool HasBW) {
3259 Alignment, AddressSpace,
3260 UseMaskForCond, UseMaskForGaps);
3263 Alignment, AddressSpace,
3264 UseMaskForCond, UseMaskForGaps);
3267 Alignment, AddressSpace,
3268 UseMaskForCond, UseMaskForGaps);
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()
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 * >())
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.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
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)
The main scalar evolution driver.
unsigned getRegisterBitWidth(bool Vector) const
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
unsigned getVectorNumElements() const
bool isLegalMaskedScatter(Type *DataType)
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 ...
Type Conversion Cost Table.
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
bool isVectorTy() const
True if this is an instance of VectorType.
unsigned getAtomicMemIntrinsicMaxElementSize() const
unsigned getBitWidth() const
Return the number of bits in the APInt.
unsigned getNumberOfRegisters(bool Vector)
int getGatherOverhead() const
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
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.
bool isLegalMaskedStore(Type *DataType)
unsigned getAddressComputationCost(Type *Ty, ScalarEvolution *, const SCEV *)
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 *>())
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 ==. ...
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
bool isLSRCostLess(TargetTransformInfo::LSRCost &C1, TargetTransformInfo::LSRCost &C2)
unsigned getSizeInBits() const
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)...
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 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.
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.
bool isLegalMaskedGather(Type *DataType)
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 isLegalMaskedLoad(Type *DataType)
const TTI::MemCmpExpansionOptions * enableMemCmpExpansion(bool IsZeroCmp) const
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.
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.
int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace, const Instruction *I=nullptr)
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)
unsigned getPreferVectorWidth() const
Byte Swap and Counting operators.
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...
unsigned getVectorNumElements() const
Class to represent vector types.
Class for arbitrary precision integers.
int getScatterOverhead() const
ZERO_EXTEND - Used for integer types, zeroing the new bits.
unsigned getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace, const Instruction *I=nullptr)
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 ==.
This class represents an analyzed expression in the program.
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 isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
LLVM Value Representation.
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
bool hasDivRemOp(Type *DataType, bool IsSigned)
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
bool hasMacroFusion() const
Primary interface to the complete machine description for the target machine.
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).
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.
This file describes how to lower LLVM code to machine code.