16#include "llvm/IR/IntrinsicsPowerPC.h"
24#define DEBUG_TYPE "ppctti"
41std::optional<Instruction *>
47 case Intrinsic::ppc_altivec_lvx:
48 case Intrinsic::ppc_altivec_lvxl:
53 Value *Ptr =
II.getArgOperand(0);
57 case Intrinsic::ppc_vsx_lxvw4x:
58 case Intrinsic::ppc_vsx_lxvd2x: {
60 Value *Ptr =
II.getArgOperand(0);
63 case Intrinsic::ppc_altivec_stvx:
64 case Intrinsic::ppc_altivec_stvxl:
69 Value *Ptr =
II.getArgOperand(1);
73 case Intrinsic::ppc_vsx_stxvw4x:
74 case Intrinsic::ppc_vsx_stxvd2x: {
76 Value *Ptr =
II.getArgOperand(1);
79 case Intrinsic::ppc_altivec_vperm:
88 "Bad type for intrinsic!");
91 bool AllEltsOk =
true;
92 for (
unsigned I = 0;
I != 16; ++
I) {
93 Constant *Elt = Mask->getAggregateElement(
I);
109 Value *ExtractedElts[32];
110 memset(ExtractedElts, 0,
sizeof(ExtractedElts));
112 for (
unsigned I = 0;
I != 16; ++
I) {
118 if (
DL.isLittleEndian())
121 if (!ExtractedElts[Idx]) {
122 Value *Op0ToUse = (
DL.isLittleEndian()) ? Op1 : Op0;
123 Value *Op1ToUse = (
DL.isLittleEndian()) ? Op0 : Op1;
125 Idx < 16 ? Op0ToUse : Op1ToUse, Idx & 15);
142 if (!ST->getCLOpts().constant_hoisting)
145 assert(Ty->isIntegerTy());
147 unsigned BitSize = Ty->getPrimitiveSizeInBits();
154 if (
Imm.getBitWidth() <= 64) {
160 if ((
Imm.getZExtValue() & 0xFFFF) == 0)
174 if (!ST->getCLOpts().constant_hoisting)
177 assert(Ty->isIntegerTy());
179 unsigned BitSize = Ty->getPrimitiveSizeInBits();
186 case Intrinsic::sadd_with_overflow:
187 case Intrinsic::uadd_with_overflow:
188 case Intrinsic::ssub_with_overflow:
189 case Intrinsic::usub_with_overflow:
190 if ((Idx == 1) &&
Imm.getBitWidth() <= 64 &&
isInt<16>(
Imm.getSExtValue()))
193 case Intrinsic::experimental_stackmap:
194 if ((Idx < 2) || (
Imm.getBitWidth() <= 64 &&
isInt<64>(
Imm.getSExtValue())))
197 case Intrinsic::experimental_patchpoint_void:
198 case Intrinsic::experimental_patchpoint:
199 if ((Idx < 4) || (
Imm.getBitWidth() <= 64 &&
isInt<64>(
Imm.getSExtValue())))
210 if (!ST->getCLOpts().constant_hoisting)
213 assert(Ty->isIntegerTy());
215 unsigned BitSize = Ty->getPrimitiveSizeInBits();
219 unsigned ImmIdx = ~0U;
220 bool ShiftedFree =
false, RunFree =
false, UnsignedFree =
false,
225 case Instruction::GetElementPtr:
232 case Instruction::And:
235 case Instruction::Add:
236 case Instruction::Or:
237 case Instruction::Xor:
240 case Instruction::Sub:
241 case Instruction::Mul:
242 case Instruction::Shl:
243 case Instruction::LShr:
244 case Instruction::AShr:
247 case Instruction::ICmp:
252 case Instruction::Select:
255 case Instruction::PHI:
256 case Instruction::Call:
257 case Instruction::Ret:
258 case Instruction::Load:
259 case Instruction::Store:
263 if (ZeroFree &&
Imm == 0)
266 if (Idx == ImmIdx &&
Imm.getBitWidth() <= 64) {
271 if (
Imm.getBitWidth() <= 32 &&
285 if (ShiftedFree && (
Imm.getZExtValue() & 0xFFFF) == 0)
295 return Ty->isVectorTy() && (Ty->getScalarSizeInBits() == 1) &&
296 (Ty->getPrimitiveSizeInBits() > 128);
307 if (U->getType()->isVectorTy()) {
326 if (ConstTripCount &&
327 ConstTripCount < ST->getCLOpts().min_ctr_loop_threshold) {
345 for (
auto *BB : L->getBlocks())
348 if (
Call->getIntrinsicID() == Intrinsic::set_loop_iterations ||
349 Call->getIntrinsicID() == Intrinsic::loop_decrement)
353 L->getExitingBlocks(ExitingBlocks);
357 for (
auto &BB : ExitingBlocks) {
360 uint64_t TrueWeight = 0, FalseWeight = 0;
366 bool TrueIsExit = !L->contains(BI->getSuccessor(0));
367 if (( TrueIsExit && FalseWeight < TrueWeight) ||
368 (!TrueIsExit && FalseWeight > TrueWeight))
405 return ST->getCLOpts().enable_coldcc;
413 return LoopHasReductions;
419 if (getST()->hasAltivec())
420 Options.LoadSizes = {16, 8, 4, 2, 1};
422 Options.LoadSizes = {8, 4, 2, 1};
424 Options.MaxNumLoads = TLI->getMaxExpandSizeMemcmp(OptSize);
435 return ClassID ==
VSXRC ? 64 : 32;
445 (Ty->getScalarType()->isFloatTy() || Ty->getScalarType()->isDoubleTy()))
447 if (Ty && (Ty->getScalarType()->isFP128Ty() ||
448 Ty->getScalarType()->isPPC_FP128Ty()))
450 if (Ty && Ty->getScalarType()->isHalfTy())
460 return "PPC::unknown register class";
461 case GPRRC:
return "PPC::GPRRC";
462 case FPRRC:
return "PPC::FPRRC";
463 case VRRC:
return "PPC::VRRC";
464 case VSXRC:
return "PPC::VSXRC";
484 unsigned Directive = ST->getCPUDirective();
500 bool HasUnorderedReductions)
const {
501 unsigned Directive = ST->getCPUDirective();
545 if (!ST->vectorsUseTwoUnits() || !Ty1->
isVectorTy())
551 if (LT1.first != 1 || !LT1.second.isVector())
554 int ISD = TLI->InstructionOpcodeToISD(Opcode);
555 if (TLI->isOperationExpand(
ISD, LT1.second))
560 if (LT2.first != 1 || !LT2.second.isVector())
571 assert(TLI->InstructionOpcodeToISD(Opcode) &&
"Invalid opcode");
580 Op2Info, Args, CtxI);
584 Opcode, Ty, CostKind, Op1Info, Op2Info);
585 return Cost * CostFactor;
607 return LT.first * CostFactor;
614 return Opcode == Instruction::PHI ? 0 : 1;
624 assert(TLI->InstructionOpcodeToISD(Opcode) &&
"Invalid opcode");
635 return Cost == 0 ? 0 : 1;
649 Opcode, ValTy, CondTy, VecPred, CostKind, Op1Info, Op2Info,
I);
653 return Cost * CostFactor;
661 int ISD = TLI->InstructionOpcodeToISD(Opcode);
675 Index == (ST->isLittleEndian() ? 1 : 0))
683 unsigned MaskCostForOneBitSize =
684 (ST->getCLOpts().vec_mask_cost && EltSize == 1) ? 1 : 0;
686 unsigned MaskCostForIdx = (Index != -1U) ? 0 : 1;
687 if (ST->hasP9Altivec()) {
693 if (ST->hasP10Vector())
694 return CostFactor + MaskCostForIdx;
696 return 2 * CostFactor;
701 if (EltSize == 64 && Index != -1U)
704 unsigned MfvsrwzIndex = ST->isLittleEndian() ? 2 : 1;
705 if (Index == MfvsrwzIndex)
710 return CostFactor + MaskCostForIdx;
716 return CostFactor + MaskCostForOneBitSize + MaskCostForIdx;
718 }
else if (ST->hasDirectMove() && Index != -1U) {
723 return 3 + MaskCostForOneBitSize;
731 unsigned LHSPenalty = 2;
741 return LHSPenalty +
Cost;
756 if (TLI->getValueType(
DL, Src,
true) == MVT::Other)
761 assert((Opcode == Instruction::Load || Opcode == Instruction::Store) &&
772 bool IsAltivecType = ST->hasAltivec() &&
773 (LT.second == MVT::v16i8 || LT.second == MVT::v8i16 ||
774 LT.second == MVT::v4i32 || LT.second == MVT::v4f32);
775 bool IsVSXType = ST->hasVSX() &&
776 (LT.second == MVT::v2f64 || LT.second == MVT::v2i64);
783 unsigned MemBits = Src->getPrimitiveSizeInBits();
784 unsigned SrcBytes = LT.second.getStoreSize();
785 if (ST->hasVSX() && IsAltivecType) {
786 if (MemBits == 64 || (ST->hasP8Vector() && MemBits == 32))
790 if (Opcode == Instruction::Load && MemBits == 32 && Alignment < SrcBytes)
795 if (!SrcBytes || Alignment >= SrcBytes)
805 if (Opcode == Instruction::Load && (!ST->hasP8Vector() && IsAltivecType) &&
806 Alignment >= LT.second.getScalarType().getStoreSize())
807 return Cost + LT.first;
813 if (IsVSXType || (ST->hasVSX() && IsAltivecType))
817 if (TLI->allowsMisalignedMemoryAccesses(LT.second, 0))
824 Cost += LT.first * ((SrcBytes / Alignment.value()) - 1);
829 if (Src->isVectorTy() && Opcode == Instruction::Store)
842 bool UseMaskForCond,
bool UseMaskForGaps)
const {
848 if (UseMaskForCond || UseMaskForGaps)
851 UseMaskForCond, UseMaskForGaps);
854 "Expect a vector type for interleaved memory op");
868 Cost += Factor*(LT.first-1);
880 if (ICA.
getID() == Intrinsic::vp_load) {
886 if (ICA.
getID() == Intrinsic::vp_store) {
909 return Ty->isIntOrIntVectorTy(1) && Ty->getPrimitiveSizeInBits() > 128;
942 if (!ST->getCLOpts().lsr_no_insns_cost)
943 return std::tie(
C1.Insns,
C1.NumRegs,
C1.AddRecCost,
C1.NumIVMuls,
944 C1.NumBaseAdds,
C1.ScaleCost,
C1.ImmCost,
C1.SetupCost) <
954 if (!ST->isELFv2ABI())
962 case Intrinsic::ppc_altivec_lvx:
963 case Intrinsic::ppc_altivec_lvxl:
964 case Intrinsic::ppc_altivec_lvebx:
965 case Intrinsic::ppc_altivec_lvehx:
966 case Intrinsic::ppc_altivec_lvewx:
967 case Intrinsic::ppc_vsx_lxvd2x:
968 case Intrinsic::ppc_vsx_lxvw4x:
969 case Intrinsic::ppc_vsx_lxvd2x_be:
970 case Intrinsic::ppc_vsx_lxvw4x_be:
971 case Intrinsic::ppc_vsx_lxvl:
972 case Intrinsic::ppc_vsx_lxvll:
973 case Intrinsic::ppc_vsx_lxvp: {
976 Info.WriteMem =
false;
979 case Intrinsic::ppc_altivec_stvx:
980 case Intrinsic::ppc_altivec_stvxl:
981 case Intrinsic::ppc_altivec_stvebx:
982 case Intrinsic::ppc_altivec_stvehx:
983 case Intrinsic::ppc_altivec_stvewx:
984 case Intrinsic::ppc_vsx_stxvd2x:
985 case Intrinsic::ppc_vsx_stxvw4x:
986 case Intrinsic::ppc_vsx_stxvd2x_be:
987 case Intrinsic::ppc_vsx_stxvw4x_be:
988 case Intrinsic::ppc_vsx_stxvl:
989 case Intrinsic::ppc_vsx_stxvll:
990 case Intrinsic::ppc_vsx_stxvp: {
992 Info.ReadMem =
false;
993 Info.WriteMem =
true;
996 case Intrinsic::ppc_stbcx:
997 case Intrinsic::ppc_sthcx:
998 case Intrinsic::ppc_stdcx:
999 case Intrinsic::ppc_stwcx: {
1001 Info.ReadMem =
false;
1002 Info.WriteMem =
true;
1013 return TLI->supportsTailCallFor(CB);
1022 unsigned Directive = ST->getCPUDirective();
1026 return DefaultLegalization;
1029 return DefaultLegalization;
1032 if (IID != Intrinsic::vp_load && IID != Intrinsic::vp_store)
1033 return DefaultLegalization;
1035 bool IsLoad = IID == Intrinsic::vp_load;
1037 EVT VT = TLI->getValueType(
DL, VecTy,
true);
1038 if (VT != MVT::v2i64 && VT != MVT::v4i32 && VT != MVT::v8i16 &&
1040 return DefaultLegalization;
1042 auto IsAllTrueMask = [](
Value *MaskVal) {
1045 return ConstValue->isAllOnesValue();
1048 unsigned MaskIx = IsLoad ? 1 : 2;
1050 return DefaultLegalization;
1056 if (!ST->getCLOpts().evl || !ST->isPPC64())
1058 unsigned CPU = ST->getCPUDirective();
1069 auto IsLegalLoadWithLengthType = [](
EVT VT) {
1070 if (VT != MVT::i64 && VT != MVT::i32 && VT != MVT::i16 && VT != MVT::i8)
1075 return IsLegalLoadWithLengthType(TLI->getValueType(
DL, DataType,
true));
1091 switch (MICA.
getID()) {
1092 case Intrinsic::masked_load:
1093 Opcode = Instruction::Load;
1095 case Intrinsic::masked_store:
1096 Opcode = Instruction::Store;
1109 if (Opcode == Instruction::Load) {
1116 if (VecTy->getPrimitiveSizeInBits() > 128)
1125 VecTy->getScalarSizeInBits() != 8)
1131 unsigned Opcode,
Type *InputTypeA,
Type *InputTypeB,
Type *AccumType,
1137 if (!getST()->hasAltivec())
1139 if (Opcode != Instruction::Add)
1142 EVT AccVT = TLI->getValueType(
DL, AccumType,
true);
1143 if (AccVT != MVT::i32)
1147 EVT AVT = TLI->getValueType(
DL, ATy,
true);
1154 if (AVT != MVT::v16i8 && AVT != MVT::v8i16)
1160 if (BinOp.value() != Instruction::Mul)
1162 if (InputTypeA != InputTypeB)
1167 if (AVT == MVT::v16i8) {
1176 }
else if (AVT == MVT::v8i16) {
1178 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
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 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
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
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
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 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
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 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...
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
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.