16#include "llvm/IR/IntrinsicsPowerPC.h"
24#define DEBUG_TYPE "ppctti"
32std::optional<Instruction *>
38 case Intrinsic::ppc_altivec_lvx:
39 case Intrinsic::ppc_altivec_lvxl:
44 Value *Ptr =
II.getArgOperand(0);
48 case Intrinsic::ppc_vsx_lxvw4x:
49 case Intrinsic::ppc_vsx_lxvd2x: {
51 Value *Ptr =
II.getArgOperand(0);
54 case Intrinsic::ppc_altivec_stvx:
55 case Intrinsic::ppc_altivec_stvxl:
60 Value *Ptr =
II.getArgOperand(1);
64 case Intrinsic::ppc_vsx_stxvw4x:
65 case Intrinsic::ppc_vsx_stxvd2x: {
67 Value *Ptr =
II.getArgOperand(1);
70 case Intrinsic::ppc_altivec_vperm:
79 "Bad type for intrinsic!");
82 bool AllEltsOk =
true;
83 for (
unsigned I = 0;
I != 16; ++
I) {
84 Constant *Elt = Mask->getAggregateElement(
I);
100 Value *ExtractedElts[32];
101 memset(ExtractedElts, 0,
sizeof(ExtractedElts));
103 for (
unsigned I = 0;
I != 16; ++
I) {
109 if (
DL.isLittleEndian())
112 if (!ExtractedElts[Idx]) {
113 Value *Op0ToUse = (
DL.isLittleEndian()) ? Op1 : Op0;
114 Value *Op1ToUse = (
DL.isLittleEndian()) ? Op0 : Op1;
116 Idx < 16 ? Op0ToUse : Op1ToUse, Idx & 15);
133 if (!ST->getCLOpts().constant_hoisting)
136 assert(Ty->isIntegerTy());
138 unsigned BitSize = Ty->getPrimitiveSizeInBits();
145 if (
Imm.getBitWidth() <= 64) {
151 if ((
Imm.getZExtValue() & 0xFFFF) == 0)
165 if (!ST->getCLOpts().constant_hoisting)
168 assert(Ty->isIntegerTy());
170 unsigned BitSize = Ty->getPrimitiveSizeInBits();
177 case Intrinsic::sadd_with_overflow:
178 case Intrinsic::uadd_with_overflow:
179 case Intrinsic::ssub_with_overflow:
180 case Intrinsic::usub_with_overflow:
181 if ((Idx == 1) &&
Imm.getBitWidth() <= 64 &&
isInt<16>(
Imm.getSExtValue()))
184 case Intrinsic::experimental_stackmap:
185 if ((Idx < 2) || (
Imm.getBitWidth() <= 64 &&
isInt<64>(
Imm.getSExtValue())))
188 case Intrinsic::experimental_patchpoint_void:
189 case Intrinsic::experimental_patchpoint:
190 if ((Idx < 4) || (
Imm.getBitWidth() <= 64 &&
isInt<64>(
Imm.getSExtValue())))
201 if (!ST->getCLOpts().constant_hoisting)
204 assert(Ty->isIntegerTy());
206 unsigned BitSize = Ty->getPrimitiveSizeInBits();
210 unsigned ImmIdx = ~0U;
211 bool ShiftedFree =
false, RunFree =
false, UnsignedFree =
false,
216 case Instruction::GetElementPtr:
223 case Instruction::And:
226 case Instruction::Add:
227 case Instruction::Or:
228 case Instruction::Xor:
231 case Instruction::Sub:
232 case Instruction::Mul:
233 case Instruction::Shl:
234 case Instruction::LShr:
235 case Instruction::AShr:
238 case Instruction::ICmp:
243 case Instruction::Select:
246 case Instruction::PHI:
247 case Instruction::Call:
248 case Instruction::Ret:
249 case Instruction::Load:
250 case Instruction::Store:
254 if (ZeroFree &&
Imm == 0)
257 if (Idx == ImmIdx &&
Imm.getBitWidth() <= 64) {
262 if (
Imm.getBitWidth() <= 32 &&
276 if (ShiftedFree && (
Imm.getZExtValue() & 0xFFFF) == 0)
286 return Ty->isVectorTy() && (Ty->getScalarSizeInBits() == 1) &&
287 (Ty->getPrimitiveSizeInBits() > 128);
298 if (U->getType()->isVectorTy()) {
317 if (ConstTripCount &&
318 ConstTripCount < ST->getCLOpts().min_ctr_loop_threshold) {
336 for (
auto *BB : L->getBlocks())
339 if (
Call->getIntrinsicID() == Intrinsic::set_loop_iterations ||
340 Call->getIntrinsicID() == Intrinsic::loop_decrement)
344 L->getExitingBlocks(ExitingBlocks);
348 for (
auto &BB : ExitingBlocks) {
351 uint64_t TrueWeight = 0, FalseWeight = 0;
357 bool TrueIsExit = !L->contains(BI->getSuccessor(0));
358 if (( TrueIsExit && FalseWeight < TrueWeight) ||
359 (!TrueIsExit && FalseWeight > TrueWeight))
396 return ST->getCLOpts().enable_coldcc;
404 return LoopHasReductions;
410 if (getST()->hasAltivec())
411 Options.LoadSizes = {16, 8, 4, 2, 1};
413 Options.LoadSizes = {8, 4, 2, 1};
415 Options.MaxNumLoads = TLI->getMaxExpandSizeMemcmp(OptSize);
426 return ClassID ==
VSXRC ? 64 : 32;
436 (Ty->getScalarType()->isFloatTy() || Ty->getScalarType()->isDoubleTy()))
438 if (Ty && (Ty->getScalarType()->isFP128Ty() ||
439 Ty->getScalarType()->isPPC_FP128Ty()))
441 if (Ty && Ty->getScalarType()->isHalfTy())
451 return "PPC::unknown register class";
452 case GPRRC:
return "PPC::GPRRC";
453 case FPRRC:
return "PPC::FPRRC";
454 case VRRC:
return "PPC::VRRC";
455 case VSXRC:
return "PPC::VSXRC";
475 unsigned Directive = ST->getCPUDirective();
491 bool HasUnorderedReductions)
const {
492 unsigned Directive = ST->getCPUDirective();
536 if (!ST->vectorsUseTwoUnits() || !Ty1->
isVectorTy())
542 if (LT1.first != 1 || !LT1.second.isVector())
545 int ISD = TLI->InstructionOpcodeToISD(Opcode);
546 if (TLI->isOperationExpand(
ISD, LT1.second))
551 if (LT2.first != 1 || !LT2.second.isVector())
563 assert(TLI->InstructionOpcodeToISD(Opcode) &&
"Invalid opcode");
572 Args, CtxI, TLibInfo, Scalars);
576 Opcode, Ty, CostKind, Op1Info, Op2Info);
577 return Cost * CostFactor;
599 return LT.first * CostFactor;
606 return Opcode == Instruction::PHI ? 0 : 1;
616 assert(TLI->InstructionOpcodeToISD(Opcode) &&
"Invalid opcode");
627 return Cost == 0 ? 0 : 1;
641 Opcode, ValTy, CondTy, VecPred, CostKind, Op1Info, Op2Info,
I);
645 return Cost * CostFactor;
653 int ISD = TLI->InstructionOpcodeToISD(Opcode);
667 Index == (ST->isLittleEndian() ? 1 : 0))
675 unsigned MaskCostForOneBitSize =
676 (ST->getCLOpts().vec_mask_cost && EltSize == 1) ? 1 : 0;
678 unsigned MaskCostForIdx = (Index != -1U) ? 0 : 1;
679 if (ST->hasP9Altivec()) {
685 if (ST->hasP10Vector())
686 return CostFactor + MaskCostForIdx;
688 return 2 * CostFactor;
693 if (EltSize == 64 && Index != -1U)
696 unsigned MfvsrwzIndex = ST->isLittleEndian() ? 2 : 1;
697 if (Index == MfvsrwzIndex)
702 return CostFactor + MaskCostForIdx;
708 return CostFactor + MaskCostForOneBitSize + MaskCostForIdx;
710 }
else if (ST->hasDirectMove() && Index != -1U) {
715 return 3 + MaskCostForOneBitSize;
723 unsigned LHSPenalty = 2;
733 return LHSPenalty +
Cost;
748 if (TLI->getValueType(
DL, Src,
true) == MVT::Other)
753 assert((Opcode == Instruction::Load || Opcode == Instruction::Store) &&
764 bool IsAltivecType = ST->hasAltivec() &&
765 (LT.second == MVT::v16i8 || LT.second == MVT::v8i16 ||
766 LT.second == MVT::v4i32 || LT.second == MVT::v4f32);
767 bool IsVSXType = ST->hasVSX() &&
768 (LT.second == MVT::v2f64 || LT.second == MVT::v2i64);
775 unsigned MemBits = Src->getPrimitiveSizeInBits();
776 unsigned SrcBytes = LT.second.getStoreSize();
777 if (ST->hasVSX() && IsAltivecType) {
778 if (MemBits == 64 || (ST->hasP8Vector() && MemBits == 32))
782 if (Opcode == Instruction::Load && MemBits == 32 && Alignment < SrcBytes)
787 if (!SrcBytes || Alignment >= SrcBytes)
797 if (Opcode == Instruction::Load && (!ST->hasP8Vector() && IsAltivecType) &&
798 Alignment >= LT.second.getScalarType().getStoreSize())
799 return Cost + LT.first;
805 if (IsVSXType || (ST->hasVSX() && IsAltivecType))
809 if (TLI->allowsMisalignedMemoryAccesses(LT.second, 0))
816 Cost += LT.first * ((SrcBytes / Alignment.value()) - 1);
821 if (Src->isVectorTy() && Opcode == Instruction::Store)
834 bool UseMaskForCond,
bool UseMaskForGaps)
const {
840 if (UseMaskForCond || UseMaskForGaps)
843 UseMaskForCond, UseMaskForGaps);
846 "Expect a vector type for interleaved memory op");
860 Cost += Factor*(LT.first-1);
872 if (ICA.
getID() == Intrinsic::vp_load) {
878 if (ICA.
getID() == Intrinsic::vp_store) {
901 return Ty->isIntOrIntVectorTy(1) && Ty->getPrimitiveSizeInBits() > 128;
934 if (!ST->getCLOpts().lsr_no_insns_cost)
935 return std::tie(
C1.Insns,
C1.NumRegs,
C1.AddRecCost,
C1.NumIVMuls,
936 C1.NumBaseAdds,
C1.ScaleCost,
C1.ImmCost,
C1.SetupCost) <
946 if (!ST->isELFv2ABI())
954 case Intrinsic::ppc_altivec_lvx:
955 case Intrinsic::ppc_altivec_lvxl:
956 case Intrinsic::ppc_altivec_lvebx:
957 case Intrinsic::ppc_altivec_lvehx:
958 case Intrinsic::ppc_altivec_lvewx:
959 case Intrinsic::ppc_vsx_lxvd2x:
960 case Intrinsic::ppc_vsx_lxvw4x:
961 case Intrinsic::ppc_vsx_lxvd2x_be:
962 case Intrinsic::ppc_vsx_lxvw4x_be:
963 case Intrinsic::ppc_vsx_lxvl:
964 case Intrinsic::ppc_vsx_lxvll:
965 case Intrinsic::ppc_vsx_lxvp: {
968 Info.WriteMem =
false;
971 case Intrinsic::ppc_altivec_stvx:
972 case Intrinsic::ppc_altivec_stvxl:
973 case Intrinsic::ppc_altivec_stvebx:
974 case Intrinsic::ppc_altivec_stvehx:
975 case Intrinsic::ppc_altivec_stvewx:
976 case Intrinsic::ppc_vsx_stxvd2x:
977 case Intrinsic::ppc_vsx_stxvw4x:
978 case Intrinsic::ppc_vsx_stxvd2x_be:
979 case Intrinsic::ppc_vsx_stxvw4x_be:
980 case Intrinsic::ppc_vsx_stxvl:
981 case Intrinsic::ppc_vsx_stxvll:
982 case Intrinsic::ppc_vsx_stxvp: {
984 Info.ReadMem =
false;
985 Info.WriteMem =
true;
988 case Intrinsic::ppc_stbcx:
989 case Intrinsic::ppc_sthcx:
990 case Intrinsic::ppc_stdcx:
991 case Intrinsic::ppc_stwcx: {
993 Info.ReadMem =
false;
994 Info.WriteMem =
true;
1005 return TLI->supportsTailCallFor(CB);
1014 unsigned Directive = ST->getCPUDirective();
1018 return DefaultLegalization;
1021 return DefaultLegalization;
1024 if (IID != Intrinsic::vp_load && IID != Intrinsic::vp_store)
1025 return DefaultLegalization;
1027 bool IsLoad = IID == Intrinsic::vp_load;
1029 EVT VT = TLI->getValueType(
DL, VecTy,
true);
1030 if (VT != MVT::v2i64 && VT != MVT::v4i32 && VT != MVT::v8i16 &&
1032 return DefaultLegalization;
1034 auto IsAllTrueMask = [](
Value *MaskVal) {
1037 return ConstValue->isAllOnesValue();
1040 unsigned MaskIx = IsLoad ? 1 : 2;
1042 return DefaultLegalization;
1048 if (!ST->getCLOpts().evl || !ST->isPPC64())
1050 unsigned CPU = ST->getCPUDirective();
1061 auto IsLegalLoadWithLengthType = [](
EVT VT) {
1062 if (VT != MVT::i64 && VT != MVT::i32 && VT != MVT::i16 && VT != MVT::i8)
1067 return IsLegalLoadWithLengthType(TLI->getValueType(
DL, DataType,
true));
1083 switch (MICA.
getID()) {
1084 case Intrinsic::masked_load:
1085 Opcode = Instruction::Load;
1087 case Intrinsic::masked_store:
1088 Opcode = Instruction::Store;
1101 if (Opcode == Instruction::Load) {
1108 if (VecTy->getPrimitiveSizeInBits() > 128)
1117 VecTy->getScalarSizeInBits() != 8)
1123 unsigned Opcode,
Type *InputTypeA,
Type *InputTypeB,
Type *AccumType,
1129 if (!getST()->hasAltivec())
1131 if (Opcode != Instruction::Add)
1134 EVT AccVT = TLI->getValueType(
DL, AccumType,
true);
1135 if (AccVT != MVT::i32)
1139 EVT AVT = TLI->getValueType(
DL, ATy,
true);
1146 if (AVT != MVT::v16i8 && AVT != MVT::v8i16)
1152 if (BinOp.value() != Instruction::Mul)
1154 if (InputTypeA != InputTypeB)
1159 if (AVT == MVT::v16i8) {
1168 }
else if (AVT == MVT::v8i16) {
1170 if (OpAExtend != OpBExtend)
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 GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
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.
This file describes how to lower LLVM code to machine code.
Class for arbitrary precision integers.
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
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 getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1, TTI::VectorInstrContext VIC=TTI::VectorInstrContext::None) const override
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
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 *CtxI=nullptr, const TargetLibraryInfo *TLibInfo=nullptr, ArrayRef< const Value * > Scalars={}) const override
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.
Conditional Branch instruction.
This is an important base class in LLVM.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Value * CreateInsertElement(Type *VecTy, Value *NewElt, Value *Idx, const Twine &Name="")
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
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.
Information for memory intrinsic cost model.
Align getAlignment() const
unsigned getAddressSpace() const
Type * getDataType() const
Intrinsic::ID getID() 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 *CtxI=nullptr, const TargetLibraryInfo *TLibInfo=nullptr, ArrayRef< const Value * > Scalars={}) const override
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2) const override
InstructionCost vectorCostAdjustmentFactor(unsigned Opcode, Type *Ty1, Type *Ty2) const
unsigned getMaxInterleaveFactor(ElementCount VF, bool HasUnorderedReductions) const override
InstructionCost getPartialReductionCost(unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType, ElementCount VF, TTI::PartialReductionExtendKind OpAExtend, TTI::PartialReductionExtendKind OpBExtend, std::optional< unsigned > BinOp, TTI::TargetCostKind CostKind, std::optional< FastMathFlags > FMF) 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
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
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1, TTI::VectorInstrContext VIC=TTI::VectorInstrContext::None) 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 getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy, TTI::TargetCostKind CostKind, ArrayRef< int > Mask, int Index, VectorType *SubTp, ArrayRef< const Value * > Args={}, const Instruction *CtxI=nullptr, TTI::VectorInstrContext VIC=TTI::VectorInstrContext::None) 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
bool shouldBuildRelLookupTables() const override
bool supportsTailCallFor(const CallBase *CB) const override
bool canSaveCmp(Loop *L, CondBrInst **BI, ScalarEvolution *SE, LoopInfo *LI, DominatorTree *DT, AssumptionCache *AC, TargetLibraryInfo *LibInfo) 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
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 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.
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.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
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.
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)
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
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.
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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.
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.
LLVM_ABI Align getOrEnforceKnownAlignment(Value *V, MaybeAlign PrefAlign, const DataLayout &DL, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr)
Try to ensure that the alignment of V is at least PrefAlign bytes.
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...
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.
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.