19 #define DEBUG_TYPE "ppctti" 28 cl::desc(
"The loop prefetch cache line size"));
32 cl::desc(
"Enable using coldcc calling conv for cold " 33 "internal functions"));
124 unsigned ImmIdx = ~0U;
125 bool ShiftedFree =
false, RunFree =
false, UnsignedFree =
false,
130 case Instruction::GetElementPtr:
137 case Instruction::And:
141 case Instruction::Or:
142 case Instruction::Xor:
145 case Instruction::Sub:
146 case Instruction::Mul:
147 case Instruction::Shl:
148 case Instruction::LShr:
149 case Instruction::AShr:
152 case Instruction::ICmp:
160 case Instruction::PHI:
168 if (ZeroFree && Imm == 0)
239 return LoopHasReductions;
244 static const auto Options = []() {
262 return ST->
hasVSX() ? 64 : 32;
267 if (ST->
hasQPX())
return 256;
335 Opd1PropInfo, Opd2PropInfo);
367 assert(ISD &&
"Invalid opcode");
387 unsigned LHSPenalty = 2;
414 bool IsVSXType = ST->
hasVSX() &&
416 bool IsQPXType = ST->
hasQPX() &&
425 (MemBytes == 64 || (ST->
hasP8Vector() && MemBytes == 32)))
429 unsigned SrcBytes = LT.second.getStoreSize();
430 if (!SrcBytes || !Alignment || Alignment >= SrcBytes)
441 ((!ST->
hasP8Vector() && IsAltivecType) || IsQPXType) &&
442 Alignment >= LT.second.getScalarType().getStoreSize())
443 return Cost + LT.first;
449 if (IsVSXType || (ST->
hasVSX() && IsAltivecType))
460 Cost += LT.first*(SrcBytes/Alignment-1);
478 bool UseMaskForGaps) {
479 if (UseMaskForCond || UseMaskForGaps)
481 Alignment, AddressSpace,
482 UseMaskForCond, UseMaskForGaps);
484 assert(isa<VectorType>(VecTy) &&
485 "Expect a vector type for interleaved memory op");
498 Cost += Factor*(LT.first-1);
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 * >())
uint64_t getZExtValue() const
Get zero extended value.
bool useColdCCForColdCall(Function &F)
This class represents lattice values for constants.
Cost tables and simple lookup functions.
bool isPPC64() const
isPPC64 - Return true if we are generating code for 64-bit pointer mode.
void push_back(const T &Elt)
The main scalar evolution driver.
bool enableInterleavedAccessVectorization()
constexpr bool isInt< 16 >(int64_t x)
bool isVectorTy() const
True if this is an instance of VectorType.
unsigned getPrefetchDistance()
unsigned getBitWidth() const
Return the number of bits in the APInt.
int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp)
unsigned getUserCost(const User *U, ArrayRef< const Value *> Operands)
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace, unsigned Align=1, bool *Fast=nullptr) const override
Is unaligned memory access allowed for the given type, and is it fast relative to software emulation...
int getIntImmCost(const APInt &Imm, Type *Ty)
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
bool isIntegerTy() const
True if this is an instance of IntegerType.
unsigned getMaxInterleaveFactor(unsigned VF)
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.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
const TTI::MemCmpExpansionOptions * enableMemCmpExpansion(bool IsZeroCmp) const
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP)
initializer< Ty > init(const Ty &Val)
unsigned getRegisterBitWidth(bool Vector) const
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
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)
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
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 *>())
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
unsigned getCacheLineSize()
unsigned getDarwinDirective() const
getDarwinDirective - Returns the -m directive specified for the cpu.
unsigned getNumberOfRegisters(bool Vector)
constexpr bool isInt< 32 >(int64_t x)
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
bool enableAggressiveInterleaving(bool LoopHasReductions)
unsigned getVectorNumElements() const
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP)
Class for arbitrary precision integers.
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.
int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I=nullptr)
constexpr bool isShiftedMask_64(uint64_t Value)
Return true if the argument contains a non-empty sequence of ones with the remainder zero (64 bit ver...
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
Represents a single loop in the control flow graph.
unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
constexpr bool isUInt< 16 >(uint64_t x)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
POPCNTDKind hasPOPCNTD() const
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, const Instruction *I=nullptr)
constexpr bool isShiftedMask_32(uint32_t Value)
Return true if the argument contains a non-empty sequence of ones with the remainder zero (32 bit ver...
int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
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.
This file describes how to lower LLVM code to machine code.
int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace, const Instruction *I=nullptr)