16#include "llvm/IR/IntrinsicsPowerPC.h"
25#define DEBUG_TYPE "ppctti"
28 cl::desc(
"Allow EVL type vp.load/vp.store"),
32 cl::desc(
"Allow vp.load and vp.store for pwr9"),
43 cl::desc(
"Enable using coldcc calling conv for cold "
44 "internal functions"));
48 cl::desc(
"Do not add instruction count to lsr cost model"));
54 cl::desc(
"Loops with a constant trip count smaller than "
55 "this value will not use the count register."));
72std::optional<Instruction *>
78 case Intrinsic::ppc_altivec_lvx:
79 case Intrinsic::ppc_altivec_lvxl:
84 Value *Ptr =
II.getArgOperand(0);
88 case Intrinsic::ppc_vsx_lxvw4x:
89 case Intrinsic::ppc_vsx_lxvd2x: {
91 Value *Ptr =
II.getArgOperand(0);
94 case Intrinsic::ppc_altivec_stvx:
95 case Intrinsic::ppc_altivec_stvxl:
100 Value *Ptr =
II.getArgOperand(1);
104 case Intrinsic::ppc_vsx_stxvw4x:
105 case Intrinsic::ppc_vsx_stxvd2x: {
107 Value *Ptr =
II.getArgOperand(1);
110 case Intrinsic::ppc_altivec_vperm:
119 "Bad type for intrinsic!");
122 bool AllEltsOk =
true;
123 for (
unsigned I = 0;
I != 16; ++
I) {
124 Constant *Elt = Mask->getAggregateElement(
I);
140 Value *ExtractedElts[32];
141 memset(ExtractedElts, 0,
sizeof(ExtractedElts));
143 for (
unsigned I = 0;
I != 16; ++
I) {
149 if (
DL.isLittleEndian())
152 if (!ExtractedElts[Idx]) {
153 Value *Op0ToUse = (
DL.isLittleEndian()) ? Op1 : Op0;
154 Value *Op1ToUse = (
DL.isLittleEndian()) ? Op0 : Op1;
176 assert(Ty->isIntegerTy());
178 unsigned BitSize = Ty->getPrimitiveSizeInBits();
185 if (Imm.getBitWidth() <= 64) {
191 if ((Imm.getZExtValue() & 0xFFFF) == 0)
208 assert(Ty->isIntegerTy());
210 unsigned BitSize = Ty->getPrimitiveSizeInBits();
217 case Intrinsic::sadd_with_overflow:
218 case Intrinsic::uadd_with_overflow:
219 case Intrinsic::ssub_with_overflow:
220 case Intrinsic::usub_with_overflow:
221 if ((Idx == 1) && Imm.getBitWidth() <= 64 &&
isInt<16>(Imm.getSExtValue()))
224 case Intrinsic::experimental_stackmap:
225 if ((Idx < 2) || (Imm.getBitWidth() <= 64 &&
isInt<64>(Imm.getSExtValue())))
228 case Intrinsic::experimental_patchpoint_void:
229 case Intrinsic::experimental_patchpoint:
230 if ((Idx < 4) || (Imm.getBitWidth() <= 64 &&
isInt<64>(Imm.getSExtValue())))
244 assert(Ty->isIntegerTy());
246 unsigned BitSize = Ty->getPrimitiveSizeInBits();
250 unsigned ImmIdx = ~0U;
251 bool ShiftedFree =
false, RunFree =
false, UnsignedFree =
false,
256 case Instruction::GetElementPtr:
263 case Instruction::And:
266 case Instruction::Add:
267 case Instruction::Or:
268 case Instruction::Xor:
271 case Instruction::Sub:
272 case Instruction::Mul:
273 case Instruction::Shl:
274 case Instruction::LShr:
275 case Instruction::AShr:
278 case Instruction::ICmp:
283 case Instruction::Select:
286 case Instruction::PHI:
287 case Instruction::Call:
288 case Instruction::Ret:
289 case Instruction::Load:
290 case Instruction::Store:
294 if (ZeroFree && Imm == 0)
297 if (Idx == ImmIdx && Imm.getBitWidth() <= 64) {
302 if (Imm.getBitWidth() <= 32 &&
313 if (UnsignedFree &&
isUInt<16>(Imm.getZExtValue()))
316 if (ShiftedFree && (Imm.getZExtValue() & 0xFFFF) == 0)
326 return Ty->isVectorTy() && (Ty->getScalarSizeInBits() == 1) &&
327 (Ty->getPrimitiveSizeInBits() > 128);
338 if (U->getType()->isVectorTy()) {
366 Metrics.analyzeBasicBlock(BB, TTI, EphValues);
373 for (
auto *BB : L->getBlocks())
376 if (
Call->getIntrinsicID() == Intrinsic::set_loop_iterations ||
377 Call->getIntrinsicID() == Intrinsic::loop_decrement)
381 L->getExitingBlocks(ExitingBlocks);
385 for (
auto &BB : ExitingBlocks) {
390 uint64_t TrueWeight = 0, FalseWeight = 0;
391 if (!BI->isConditional() ||
397 bool TrueIsExit = !L->contains(BI->getSuccessor(0));
398 if (( TrueIsExit && FalseWeight < TrueWeight) ||
399 (!TrueIsExit && FalseWeight > TrueWeight))
444 return LoopHasReductions;
450 if (getST()->hasAltivec())
451 Options.LoadSizes = {16, 8, 4, 2, 1};
453 Options.LoadSizes = {8, 4, 2, 1};
455 Options.MaxNumLoads = TLI->getMaxExpandSizeMemcmp(OptSize);
466 return ClassID ==
VSXRC ? 64 : 32;
476 (Ty->getScalarType()->isFloatTy() || Ty->getScalarType()->isDoubleTy()))
478 if (Ty && (Ty->getScalarType()->isFP128Ty() ||
479 Ty->getScalarType()->isPPC_FP128Ty()))
481 if (Ty && Ty->getScalarType()->isHalfTy())
491 return "PPC::unknown register class";
492 case GPRRC:
return "PPC::GPRRC";
493 case FPRRC:
return "PPC::FPRRC";
494 case VRRC:
return "PPC::VRRC";
495 case VSXRC:
return "PPC::VSXRC";
515 unsigned Directive = ST->getCPUDirective();
531 unsigned Directive = ST->getCPUDirective();
575 if (!ST->vectorsUseTwoUnits() || !Ty1->
isVectorTy())
581 if (LT1.first != 1 || !LT1.second.isVector())
584 int ISD = TLI->InstructionOpcodeToISD(Opcode);
585 if (TLI->isOperationExpand(
ISD, LT1.second))
590 if (LT2.first != 1 || !LT2.second.isVector())
601 assert(TLI->InstructionOpcodeToISD(Opcode) &&
"Invalid opcode");
610 Op2Info, Args, CxtI);
614 Opcode, Ty,
CostKind, Op1Info, Op2Info);
615 return Cost * CostFactor;
639 return LT.first * CostFactor;
646 return Opcode == Instruction::PHI ? 0 : 1;
656 assert(TLI->InstructionOpcodeToISD(Opcode) &&
"Invalid opcode");
667 return Cost == 0 ? 0 : 1;
681 Opcode, ValTy, CondTy, VecPred,
CostKind, Op1Info, Op2Info,
I);
685 return Cost * CostFactor;
690 unsigned Index,
const Value *Op0,
691 const Value *Op1)
const {
694 int ISD = TLI->InstructionOpcodeToISD(Opcode);
708 Index == (ST->isLittleEndian() ? 1 : 0))
716 unsigned MaskCostForOneBitSize = (
VecMaskCost && EltSize == 1) ? 1 : 0;
718 unsigned MaskCostForIdx = (Index != -1U) ? 0 : 1;
719 if (ST->hasP9Altivec()) {
725 if (ST->hasP10Vector())
726 return CostFactor + MaskCostForIdx;
728 return 2 * CostFactor;
733 if (EltSize == 64 && Index != -1U)
736 unsigned MfvsrwzIndex = ST->isLittleEndian() ? 2 : 1;
737 if (Index == MfvsrwzIndex)
742 return CostFactor + MaskCostForIdx;
748 return CostFactor + MaskCostForOneBitSize + MaskCostForIdx;
750 }
else if (ST->hasDirectMove() && Index != -1U) {
755 return 3 + MaskCostForOneBitSize;
763 unsigned LHSPenalty = 2;
773 return LHSPenalty +
Cost;
789 if (TLI->getValueType(
DL, Src,
true) == MVT::Other)
794 assert((Opcode == Instruction::Load || Opcode == Instruction::Store) &&
805 bool IsAltivecType = ST->hasAltivec() &&
806 (LT.second == MVT::v16i8 || LT.second == MVT::v8i16 ||
807 LT.second == MVT::v4i32 || LT.second == MVT::v4f32);
808 bool IsVSXType = ST->hasVSX() &&
809 (LT.second == MVT::v2f64 || LT.second == MVT::v2i64);
816 unsigned MemBits = Src->getPrimitiveSizeInBits();
817 unsigned SrcBytes = LT.second.getStoreSize();
818 if (ST->hasVSX() && IsAltivecType) {
819 if (MemBits == 64 || (ST->hasP8Vector() && MemBits == 32))
823 if (Opcode == Instruction::Load && MemBits == 32 && Alignment < SrcBytes)
828 if (!SrcBytes || Alignment >= SrcBytes)
838 if (Opcode == Instruction::Load && (!ST->hasP8Vector() && IsAltivecType) &&
839 Alignment >= LT.second.getScalarType().getStoreSize())
840 return Cost + LT.first;
846 if (IsVSXType || (ST->hasVSX() && IsAltivecType))
850 if (TLI->allowsMisalignedMemoryAccesses(LT.second, 0))
857 Cost += LT.first * ((SrcBytes / Alignment.
value()) - 1);
862 if (Src->isVectorTy() && Opcode == Instruction::Store)
874 bool UseMaskForCond,
bool UseMaskForGaps)
const {
880 if (UseMaskForCond || UseMaskForGaps)
883 UseMaskForCond, UseMaskForGaps);
886 "Expect a vector type for interleaved memory op");
900 Cost += Factor*(LT.first-1);
912 if (ICA.
getID() == Intrinsic::vp_load) {
918 if (ICA.
getID() == Intrinsic::vp_store) {
938 return CallerBits == CalleeBits;
955 return Ty->isIntOrIntVectorTy(1) && Ty->getPrimitiveSizeInBits() > 128;
1009 case Intrinsic::ppc_altivec_lvx:
1010 case Intrinsic::ppc_altivec_lvxl:
1011 case Intrinsic::ppc_altivec_lvebx:
1012 case Intrinsic::ppc_altivec_lvehx:
1013 case Intrinsic::ppc_altivec_lvewx:
1014 case Intrinsic::ppc_vsx_lxvd2x:
1015 case Intrinsic::ppc_vsx_lxvw4x:
1016 case Intrinsic::ppc_vsx_lxvd2x_be:
1017 case Intrinsic::ppc_vsx_lxvw4x_be:
1018 case Intrinsic::ppc_vsx_lxvl:
1019 case Intrinsic::ppc_vsx_lxvll:
1020 case Intrinsic::ppc_vsx_lxvp: {
1022 Info.ReadMem =
true;
1023 Info.WriteMem =
false;
1026 case Intrinsic::ppc_altivec_stvx:
1027 case Intrinsic::ppc_altivec_stvxl:
1028 case Intrinsic::ppc_altivec_stvebx:
1029 case Intrinsic::ppc_altivec_stvehx:
1030 case Intrinsic::ppc_altivec_stvewx:
1031 case Intrinsic::ppc_vsx_stxvd2x:
1032 case Intrinsic::ppc_vsx_stxvw4x:
1033 case Intrinsic::ppc_vsx_stxvd2x_be:
1034 case Intrinsic::ppc_vsx_stxvw4x_be:
1035 case Intrinsic::ppc_vsx_stxvl:
1036 case Intrinsic::ppc_vsx_stxvll:
1037 case Intrinsic::ppc_vsx_stxvp: {
1039 Info.ReadMem =
false;
1040 Info.WriteMem =
true;
1043 case Intrinsic::ppc_stbcx:
1044 case Intrinsic::ppc_sthcx:
1045 case Intrinsic::ppc_stdcx:
1046 case Intrinsic::ppc_stwcx: {
1048 Info.ReadMem =
false;
1049 Info.WriteMem =
true;
1060 return TLI->supportsTailCallFor(CB);
1069 unsigned Directive = ST->getCPUDirective();
1073 return DefaultLegalization;
1076 return DefaultLegalization;
1079 if (IID != Intrinsic::vp_load && IID != Intrinsic::vp_store)
1080 return DefaultLegalization;
1082 bool IsLoad = IID == Intrinsic::vp_load;
1084 EVT VT = TLI->getValueType(
DL, VecTy,
true);
1085 if (VT != MVT::v2i64 && VT != MVT::v4i32 && VT != MVT::v8i16 &&
1087 return DefaultLegalization;
1089 auto IsAllTrueMask = [](
Value *MaskVal) {
1092 return ConstValue->isAllOnesValue();
1095 unsigned MaskIx = IsLoad ? 1 : 2;
1097 return DefaultLegalization;
1103 if (!
PPCEVL || !ST->isPPC64())
1105 unsigned CPU = ST->getCPUDirective();
1116 auto IsLegalLoadWithLengthType = [](
EVT VT) {
1117 if (VT != MVT::i64 && VT != MVT::i32 && VT != MVT::i16 && VT != MVT::i8)
1122 return IsLegalLoadWithLengthType(TLI->getValueType(
DL, DataType,
true));
1138 switch (MICA.
getID()) {
1139 case Intrinsic::masked_load:
1140 Opcode = Instruction::Load;
1142 case Intrinsic::masked_store:
1143 Opcode = Instruction::Store;
1156 if (Opcode == Instruction::Load) {
1163 if (VecTy->getPrimitiveSizeInBits() > 128)
1172 VecTy->getScalarSizeInBits() != 8)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
static cl::opt< OutputCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(OutputCostKind::RecipThroughput), cl::values(clEnumValN(OutputCostKind::RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(OutputCostKind::Latency, "latency", "Instruction latency"), clEnumValN(OutputCostKind::CodeSize, "code-size", "Code size"), clEnumValN(OutputCostKind::SizeAndLatency, "size-latency", "Code size and latency"), clEnumValN(OutputCostKind::All, "all", "Print all cost kinds")))
TargetTransformInfo::VPLegalization VPLegalization
This file provides the interface for the instcombine pass implementation.
uint64_t IntrinsicInst * II
This file contains the declarations for profiling metadata utility functions.
static unsigned getNumElements(Type *Ty)
This file describes how to lower LLVM code to machine code.
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false) const override
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1) const override
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Opd1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Opd2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr) const override
bool shouldBuildRelLookupTables() const override
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE) const override
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP) const override
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const override
std::pair< InstructionCost, MVT > getTypeLegalizationCost(Type *Ty) const
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) const override
InstructionCost getMemIntrinsicInstrCost(const MemIntrinsicCostAttributes &MICA, TTI::TargetCostKind CostKind) const override
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
Conditional or Unconditional Branch instruction.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Value * getArgOperand(unsigned i) const
static LLVM_ABI CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", InsertPosition InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
This is an important base class in LLVM.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Container class for subtarget features.
Value * CreateInsertElement(Type *VecTy, Value *NewElt, Value *Idx, const Twine &Name="")
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
The core instruction combiner logic.
const DataLayout & getDataLayout() const
DominatorTree & getDominatorTree() const
AssumptionCache & getAssumptionCache() const
static InstructionCost getInvalid(CostType Val=0)
static InstructionCost getMax()
const SmallVectorImpl< Type * > & getArgTypes() const
Type * getReturnType() const
Intrinsic::ID getID() const
A wrapper class for inspecting calls to intrinsic functions.
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
This is an important class for using LLVM in a threaded context.
An instruction for reading from memory.
Represents a single loop in the control flow graph.
const FeatureBitset & getFeatureBits() const
Information for memory intrinsic cost model.
Align getAlignment() const
unsigned getAddressSpace() const
Type * getDataType() const
Intrinsic::ID getID() const
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2) const override
InstructionCost vectorCostAdjustmentFactor(unsigned Opcode, Type *Ty1, Type *Ty2) const
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr) const override
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
bool isLegalMaskedLoad(Type *DataType, Align Alignment, unsigned AddressSpace, TTI::MaskKind MaskKind=TTI::MaskKind::VariableOrConstantMask) const override
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false) const override
bool enableInterleavedAccessVectorization() const override
unsigned getRegisterClassForType(bool Vector, Type *Ty=nullptr) const override
bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI, DominatorTree *DT, AssumptionCache *AC, TargetLibraryInfo *LibInfo) const override
TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const override
unsigned getCacheLineSize() const override
bool hasActiveVectorLength() const override
InstructionCost getMemIntrinsicInstrCost(const MemIntrinsicCostAttributes &MICA, TTI::TargetCostKind CostKind) const override
Get memory intrinsic cost based on arguments.
bool useColdCCForColdCall(Function &F) const override
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE) const override
bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info) const override
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override
bool isLegalMaskedStore(Type *DataType, Align Alignment, unsigned AddressSpace, TTI::MaskKind MaskKind=TTI::MaskKind::VariableOrConstantMask) const override
bool isNumRegsMajorCostOfLSR() const override
unsigned getPrefetchDistance() const override
TargetTransformInfo::VPLegalization getVPLegalizationStrategy(const VPIntrinsic &PI) const override
bool areInlineCompatible(const Function *Caller, const Function *Callee) const override
unsigned getNumberOfRegisters(unsigned ClassID) const override
bool isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo) const override
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP) const override
InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr) const override
InstructionCost getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const override
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) const override
Get intrinsic cost based on arguments.
const char * getRegisterClassName(unsigned ClassID) const override
InstructionCost getInstructionCost(const User *U, ArrayRef< const Value * > Operands, TTI::TargetCostKind CostKind) const override
unsigned getMaxInterleaveFactor(ElementCount VF) const override
bool shouldBuildRelLookupTables() const override
bool supportsTailCallFor(const CallBase *CB) const override
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr) const override
InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const override
bool areTypesABICompatible(const Function *Caller, const Function *Callee, ArrayRef< Type * > Types) const override
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const override
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
bool enableAggressiveInterleaving(bool LoopHasReductions) const override
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const override
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1) const override
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const override
std::optional< Instruction * > instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const override
Common code between 32-bit and 64-bit PowerPC targets.
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
The main scalar evolution driver.
LLVM_ABI unsigned getSmallConstantTripCount(const Loop *L)
Returns the exact trip count of the loop if we can compute it, and the result is a small constant.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
Provides information about what library functions are available for the current target.
Primary interface to the complete machine description for the target machine.
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
Provide an instruction scheduling machine model to CodeGen passes.
unsigned getIssueWidth() const
Maximum number of micro-ops that may be scheduled per cycle.
LLVM_ABI void init(const TargetSubtargetInfo *TSInfo, bool EnableSModel=true, bool EnableSItins=true)
Initialize the machine model for instruction scheduling.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static constexpr TypeSize getFixed(ScalarTy ExactSize)
static constexpr TypeSize getScalable(ScalarTy MinimumSize)
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
bool isVectorTy() const
True if this is an instance of VectorType.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
bool isIntegerTy() const
True if this is an instance of IntegerType.
Value * getOperand(unsigned i) const
This is the common base class for vector predication intrinsics.
static LLVM_ABI bool isVPIntrinsic(Intrinsic::ID)
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
Base class of all SIMD vector types.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
ISD namespace - This namespace contains an enum which represents all of the SelectionDAG node types a...
@ EXTRACT_VECTOR_ELT
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
@ INSERT_VECTOR_ELT
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI Value * getSplatValue(const Value *V)
Get splat value if the input is a splat vector or return 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...
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...
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
LLVM_ABI Align getOrEnforceKnownAlignment(Value *V, MaybeAlign PrefAlign, const DataLayout &DL, const Instruction *CxtI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr)
Try to ensure that the alignment of V is at least PrefAlign bytes.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI bool extractBranchWeights(const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
Extract branch weights from MD_prof metadata.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
This struct is a compact representation of a valid (non-zero power of two) alignment.
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
Utility to calculate the size and a few similar metrics for a set of basic blocks.
static LLVM_ABI void collectEphemeralValues(const Loop *L, AssumptionCache *AC, SmallPtrSetImpl< const Value * > &EphValues)
Collect a loop's ephemeral values (those used only by an assume or similar intrinsics in the loop).
Attributes of a target dependent hardware loop.
LLVM_ABI bool canAnalyze(LoopInfo &LI)
LLVM_ABI bool isHardwareLoopCandidate(ScalarEvolution &SE, LoopInfo &LI, DominatorTree &DT, bool ForceNestedLoop=false, bool ForceHardwareLoopPHI=false)
Information about a load/store intrinsic defined by the target.