LLVM 20.0.0git
Macros | Functions | Variables
AArch64TargetTransformInfo.cpp File Reference
#include "AArch64TargetTransformInfo.h"
#include "AArch64ExpandImm.h"
#include "AArch64PerfectShuffle.h"
#include "MCTargetDesc/AArch64AddressingModes.h"
#include "llvm/Analysis/IVDescriptors.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/BasicTTIImpl.h"
#include "llvm/CodeGen/CostTable.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsAArch64.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/InstCombine/InstCombiner.h"
#include "llvm/Transforms/Vectorize/LoopVectorizationLegality.h"
#include <algorithm>
#include <optional>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "aarch64tti"
 

Functions

static bool isSMEABIRoutineCall (const CallInst &CI)
 
static bool hasPossibleIncompatibleOps (const Function *F)
 Returns true if the function has explicit operations that can only be lowered using incompatible instructions for the selected mode.
 
static bool isUnpackedVectorVT (EVT VecVT)
 
static InstructionCost getHistogramCost (const IntrinsicCostAttributes &ICA)
 
static std::optional< Instruction * > processPhiNode (InstCombiner &IC, IntrinsicInst &II)
 The function will remove redundant reinterprets casting in the presence of the control flow.
 
static std::optional< Instruction * > tryCombineFromSVBoolBinOp (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineConvertFromSVBool (InstCombiner &IC, IntrinsicInst &II)
 
static bool isAllActivePredicate (Value *Pred)
 
static std::optional< Instruction * > instCombineSVENoActiveUnaryErase (InstCombiner &IC, IntrinsicInst &II, int PredPos)
 
static std::optional< Instruction * > instCombineSVENoActiveUnaryZero (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVESel (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEDup (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEDupX (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVECmpNE (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVELast (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVECondLast (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineRDFFR (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVECntElts (InstCombiner &IC, IntrinsicInst &II, unsigned NumElts)
 
static std::optional< Instruction * > instCombineSVEPTest (InstCombiner &IC, IntrinsicInst &II)
 
template<Intrinsic::ID MulOpc, typename Intrinsic::ID FuseOpc>
static std::optional< Instruction * > instCombineSVEVectorFuseMulAddSub (InstCombiner &IC, IntrinsicInst &II, bool MergeIntoAddendOp)
 
static std::optional< Instruction * > instCombineSVELD1 (InstCombiner &IC, IntrinsicInst &II, const DataLayout &DL)
 
static std::optional< Instruction * > instCombineSVEST1 (InstCombiner &IC, IntrinsicInst &II, const DataLayout &DL)
 
static Instruction::BinaryOps intrinsicIDToBinOpCode (unsigned Intrinsic)
 
static std::optional< Instruction * > instCombineSVEVectorBinOp (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEAllActive (IntrinsicInst &II, Intrinsic::ID IID)
 
static std::optional< Instruction * > instCombineSVEAllOrNoActive (InstCombiner &IC, IntrinsicInst &II, Intrinsic::ID IID)
 
static std::optional< Instruction * > instCombineSVEVectorAdd (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEVectorFAdd (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEVectorFAddU (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEVectorFSub (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEVectorFSubU (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEVectorSub (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEVectorMul (InstCombiner &IC, IntrinsicInst &II, Intrinsic::ID IID)
 
static std::optional< Instruction * > instCombineSVEUnpack (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVETBL (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEUzp1 (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVEZip (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineLD1GatherIndex (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineST1ScatterIndex (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVESDIV (InstCombiner &IC, IntrinsicInst &II)
 
bool SimplifyValuePattern (SmallVector< Value * > &Vec, bool AllowPoison)
 
static std::optional< Instruction * > instCombineSVEDupqLane (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineMaxMinNM (InstCombiner &IC, IntrinsicInst &II)
 
static std::optional< Instruction * > instCombineSVESrshl (InstCombiner &IC, IntrinsicInst &II)
 
static unsigned getSVEGatherScatterOverhead (unsigned Opcode, const AArch64Subtarget *ST)
 
static void getFalkorUnrollingPreferences (Loop *L, ScalarEvolution &SE, TargetTransformInfo::UnrollingPreferences &UP)
 
static bool containsDecreasingPointers (Loop *TheLoop, PredicatedScalarEvolution *PSE)
 

Variables

static cl::opt< boolEnableFalkorHWPFUnrollFix ("enable-falkor-hwpf-unroll-fix", cl::init(true), cl::Hidden)
 
static cl::opt< unsignedSVEGatherOverhead ("sve-gather-overhead", cl::init(10), cl::Hidden)
 
static cl::opt< unsignedSVEScatterOverhead ("sve-scatter-overhead", cl::init(10), cl::Hidden)
 
static cl::opt< unsignedSVETailFoldInsnThreshold ("sve-tail-folding-insn-threshold", cl::init(15), cl::Hidden)
 
static cl::opt< unsignedNeonNonConstStrideOverhead ("neon-nonconst-stride-overhead", cl::init(10), cl::Hidden)
 
static cl::opt< unsignedCallPenaltyChangeSM ("call-penalty-sm-change", cl::init(5), cl::Hidden, cl::desc("Penalty of calling a function that requires a change to PSTATE.SM"))
 
static cl::opt< unsignedInlineCallPenaltyChangeSM ("inline-call-penalty-sm-change", cl::init(10), cl::Hidden, cl::desc("Penalty of inlining a call that requires a change to PSTATE.SM"))
 
static cl::opt< boolEnableOrLikeSelectOpt ("enable-aarch64-or-like-select", cl::init(true), cl::Hidden)
 
static cl::opt< boolEnableLSRCostOpt ("enable-aarch64-lsr-cost-opt", cl::init(true), cl::Hidden)
 
static cl::opt< unsignedBaseHistCntCost ("aarch64-base-histcnt-cost", cl::init(8), cl::Hidden, cl::desc("The cost of a histcnt instruction"))
 
TailFoldingOption TailFoldingOptionLoc
 
cl::opt< TailFoldingOption, true, cl::parser< std::string > > SVETailFolding ("sve-tail-folding", cl::desc("Control the use of vectorisation using tail-folding for SVE where the" " option is specified in the form (Initial)[+(Flag1|Flag2|...)]:" "\ndisabled (Initial) No loop types will vectorize using " "tail-folding" "\ndefault (Initial) Uses the default tail-folding settings for " "the target CPU" "\nall (Initial) All legal loop types will vectorize using " "tail-folding" "\nsimple (Initial) Use tail-folding for simple loops (not " "reductions or recurrences)" "\nreductions Use tail-folding for loops containing reductions" "\nnoreductions Inverse of above" "\nrecurrences Use tail-folding for loops containing fixed order " "recurrences" "\nnorecurrences Inverse of above" "\nreverse Use tail-folding for loops requiring reversed " "predicates" "\nnoreverse Inverse of above"), cl::location(TailFoldingOptionLoc))
 
static cl::opt< boolEnableFixedwidthAutovecInStreamingMode ("enable-fixedwidth-autovec-in-streaming-mode", cl::init(false), cl::Hidden)
 
static cl::opt< boolEnableScalableAutovecInStreamingMode ("enable-scalable-autovec-in-streaming-mode", cl::init(false), cl::Hidden)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "aarch64tti"

Definition at line 31 of file AArch64TargetTransformInfo.cpp.

Function Documentation

◆ containsDecreasingPointers()

static bool containsDecreasingPointers ( Loop TheLoop,
PredicatedScalarEvolution PSE 
)
static

◆ getFalkorUnrollingPreferences()

static void getFalkorUnrollingPreferences ( Loop L,
ScalarEvolution SE,
TargetTransformInfo::UnrollingPreferences UP 
)
static

◆ getHistogramCost()

static InstructionCost getHistogramCost ( const IntrinsicCostAttributes ICA)
static

◆ getSVEGatherScatterOverhead()

static unsigned getSVEGatherScatterOverhead ( unsigned  Opcode,
const AArch64Subtarget ST 
)
static

◆ hasPossibleIncompatibleOps()

static bool hasPossibleIncompatibleOps ( const Function F)
static

Returns true if the function has explicit operations that can only be lowered using incompatible instructions for the selected mode.

This also returns true if the function F may use or modify ZA state.

Definition at line 226 of file AArch64TargetTransformInfo.cpp.

References F, I, and isSMEABIRoutineCall().

Referenced by llvm::AArch64TTIImpl::areInlineCompatible().

◆ instCombineConvertFromSVBool()

static std::optional< Instruction * > instCombineConvertFromSVBool ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineLD1GatherIndex()

static std::optional< Instruction * > instCombineLD1GatherIndex ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineMaxMinNM()

static std::optional< Instruction * > instCombineMaxMinNM ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineRDFFR()

static std::optional< Instruction * > instCombineRDFFR ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineST1ScatterIndex()

static std::optional< Instruction * > instCombineST1ScatterIndex ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEAllActive()

static std::optional< Instruction * > instCombineSVEAllActive ( IntrinsicInst II,
Intrinsic::ID  IID 
)
static

◆ instCombineSVEAllOrNoActive()

static std::optional< Instruction * > instCombineSVEAllOrNoActive ( InstCombiner IC,
IntrinsicInst II,
Intrinsic::ID  IID 
)
static

◆ instCombineSVECmpNE()

static std::optional< Instruction * > instCombineSVECmpNE ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVECntElts()

static std::optional< Instruction * > instCombineSVECntElts ( InstCombiner IC,
IntrinsicInst II,
unsigned  NumElts 
)
static

◆ instCombineSVECondLast()

static std::optional< Instruction * > instCombineSVECondLast ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEDup()

static std::optional< Instruction * > instCombineSVEDup ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEDupqLane()

static std::optional< Instruction * > instCombineSVEDupqLane ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEDupX()

static std::optional< Instruction * > instCombineSVEDupX ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVELast()

static std::optional< Instruction * > instCombineSVELast ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVELD1()

static std::optional< Instruction * > instCombineSVELD1 ( InstCombiner IC,
IntrinsicInst II,
const DataLayout DL 
)
static

◆ instCombineSVENoActiveUnaryErase()

static std::optional< Instruction * > instCombineSVENoActiveUnaryErase ( InstCombiner IC,
IntrinsicInst II,
int  PredPos 
)
static

◆ instCombineSVENoActiveUnaryZero()

static std::optional< Instruction * > instCombineSVENoActiveUnaryZero ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEPTest()

static std::optional< Instruction * > instCombineSVEPTest ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVESDIV()

static std::optional< Instruction * > instCombineSVESDIV ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVESel()

static std::optional< Instruction * > instCombineSVESel ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVESrshl()

static std::optional< Instruction * > instCombineSVESrshl ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEST1()

static std::optional< Instruction * > instCombineSVEST1 ( InstCombiner IC,
IntrinsicInst II,
const DataLayout DL 
)
static

◆ instCombineSVETBL()

static std::optional< Instruction * > instCombineSVETBL ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEUnpack()

static std::optional< Instruction * > instCombineSVEUnpack ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEUzp1()

static std::optional< Instruction * > instCombineSVEUzp1 ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEVectorAdd()

static std::optional< Instruction * > instCombineSVEVectorAdd ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEVectorBinOp()

static std::optional< Instruction * > instCombineSVEVectorBinOp ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEVectorFAdd()

static std::optional< Instruction * > instCombineSVEVectorFAdd ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEVectorFAddU()

static std::optional< Instruction * > instCombineSVEVectorFAddU ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEVectorFSub()

static std::optional< Instruction * > instCombineSVEVectorFSub ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEVectorFSubU()

static std::optional< Instruction * > instCombineSVEVectorFSubU ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEVectorFuseMulAddSub()

template<Intrinsic::ID MulOpc, typename Intrinsic::ID FuseOpc>
static std::optional< Instruction * > instCombineSVEVectorFuseMulAddSub ( InstCombiner IC,
IntrinsicInst II,
bool  MergeIntoAddendOp 
)
static

◆ instCombineSVEVectorMul()

static std::optional< Instruction * > instCombineSVEVectorMul ( InstCombiner IC,
IntrinsicInst II,
Intrinsic::ID  IID 
)
static

◆ instCombineSVEVectorSub()

static std::optional< Instruction * > instCombineSVEVectorSub ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ instCombineSVEZip()

static std::optional< Instruction * > instCombineSVEZip ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ intrinsicIDToBinOpCode()

static Instruction::BinaryOps intrinsicIDToBinOpCode ( unsigned  Intrinsic)
static

Definition at line 1561 of file AArch64TargetTransformInfo.cpp.

Referenced by instCombineSVEVectorBinOp().

◆ isAllActivePredicate()

static bool isAllActivePredicate ( Value Pred)
static

◆ isSMEABIRoutineCall()

static bool isSMEABIRoutineCall ( const CallInst CI)
static

◆ isUnpackedVectorVT()

static bool isUnpackedVectorVT ( EVT  VecVT)
static

◆ processPhiNode()

static std::optional< Instruction * > processPhiNode ( InstCombiner IC,
IntrinsicInst II 
)
static

◆ SimplifyValuePattern()

bool SimplifyValuePattern ( SmallVector< Value * > &  Vec,
bool  AllowPoison 
)

◆ tryCombineFromSVBoolBinOp()

static std::optional< Instruction * > tryCombineFromSVBoolBinOp ( InstCombiner IC,
IntrinsicInst II 
)
static

Variable Documentation

◆ BaseHistCntCost

cl::opt< unsigned > BaseHistCntCost("aarch64-base-histcnt-cost", cl::init(8), cl::Hidden, cl::desc("The cost of a histcnt instruction")) ( "aarch64-base-histcnt-cost"  ,
cl::init(8)  ,
cl::Hidden  ,
cl::desc("The cost of a histcnt instruction")   
)
static

Referenced by getHistogramCost().

◆ CallPenaltyChangeSM

cl::opt< unsigned > CallPenaltyChangeSM("call-penalty-sm-change", cl::init(5), cl::Hidden, cl::desc( "Penalty of calling a function that requires a change to PSTATE.SM")) ( "call-penalty-sm-change"  ,
cl::init(5)  ,
cl::Hidden  ,
cl::desc( "Penalty of calling a function that requires a change to PSTATE.SM")   
)
static

◆ EnableFalkorHWPFUnrollFix

cl::opt< bool > EnableFalkorHWPFUnrollFix("enable-falkor-hwpf-unroll-fix", cl::init(true), cl::Hidden) ( "enable-falkor-hwpf-unroll-fix"  ,
cl::init(true ,
cl::Hidden   
)
static

◆ EnableFixedwidthAutovecInStreamingMode

cl::opt< bool > EnableFixedwidthAutovecInStreamingMode("enable-fixedwidth-autovec-in-streaming-mode", cl::init(false), cl::Hidden) ( "enable-fixedwidth-autovec-in-streaming-mode"  ,
cl::init(false)  ,
cl::Hidden   
)
static

◆ EnableLSRCostOpt

cl::opt< bool > EnableLSRCostOpt("enable-aarch64-lsr-cost-opt", cl::init(true), cl::Hidden) ( "enable-aarch64-lsr-cost-opt"  ,
cl::init(true ,
cl::Hidden   
)
static

◆ EnableOrLikeSelectOpt

cl::opt< bool > EnableOrLikeSelectOpt("enable-aarch64-or-like-select", cl::init(true), cl::Hidden) ( "enable-aarch64-or-like-select"  ,
cl::init(true ,
cl::Hidden   
)
static

◆ EnableScalableAutovecInStreamingMode

cl::opt< bool > EnableScalableAutovecInStreamingMode("enable-scalable-autovec-in-streaming-mode", cl::init(false), cl::Hidden) ( "enable-scalable-autovec-in-streaming-mode"  ,
cl::init(false)  ,
cl::Hidden   
)
static

◆ InlineCallPenaltyChangeSM

cl::opt< unsigned > InlineCallPenaltyChangeSM("inline-call-penalty-sm-change", cl::init(10), cl::Hidden, cl::desc("Penalty of inlining a call that requires a change to PSTATE.SM")) ( "inline-call-penalty-sm-change"  ,
cl::init(10)  ,
cl::Hidden  ,
cl::desc("Penalty of inlining a call that requires a change to PSTATE.SM")   
)
static

◆ NeonNonConstStrideOverhead

cl::opt< unsigned > NeonNonConstStrideOverhead("neon-nonconst-stride-overhead", cl::init(10), cl::Hidden) ( "neon-nonconst-stride-overhead"  ,
cl::init(10)  ,
cl::Hidden   
)
static

◆ SVEGatherOverhead

cl::opt< unsigned > SVEGatherOverhead("sve-gather-overhead", cl::init(10), cl::Hidden) ( "sve-gather-overhead"  ,
cl::init(10)  ,
cl::Hidden   
)
static

◆ SVEScatterOverhead

cl::opt< unsigned > SVEScatterOverhead("sve-scatter-overhead", cl::init(10), cl::Hidden) ( "sve-scatter-overhead"  ,
cl::init(10)  ,
cl::Hidden   
)
static

◆ SVETailFolding

cl::opt< TailFoldingOption, true, cl::parser< std::string > > SVETailFolding("sve-tail-folding", cl::desc( "Control the use of vectorisation using tail-folding for SVE where the" " option is specified in the form (Initial)[+(Flag1|Flag2|...)]:" "\ndisabled (Initial) No loop types will vectorize using " "tail-folding" "\ndefault (Initial) Uses the default tail-folding settings for " "the target CPU" "\nall (Initial) All legal loop types will vectorize using " "tail-folding" "\nsimple (Initial) Use tail-folding for simple loops (not " "reductions or recurrences)" "\nreductions Use tail-folding for loops containing reductions" "\nnoreductions Inverse of above" "\nrecurrences Use tail-folding for loops containing fixed order " "recurrences" "\nnorecurrences Inverse of above" "\nreverse Use tail-folding for loops requiring reversed " "predicates" "\nnoreverse Inverse of above"), cl::location(TailFoldingOptionLoc)) ( "sve-tail-folding"  ,
cl::desc( "Control the use of vectorisation using tail-folding for SVE where the" " option is specified in the form (Initial)[+(Flag1|Flag2|...)]:" "\ndisabled (Initial) No loop types will vectorize using " "tail-folding" "\ndefault (Initial) Uses the default tail-folding settings for " "the target CPU" "\nall (Initial) All legal loop types will vectorize using " "tail-folding" "\nsimple (Initial) Use tail-folding for simple loops (not " "reductions or recurrences)" "\nreductions Use tail-folding for loops containing reductions" "\nnoreductions Inverse of above" "\nrecurrences Use tail-folding for loops containing fixed order " "recurrences" "\nnorecurrences Inverse of above" "\nreverse Use tail-folding for loops requiring reversed " "predicates" "\nnoreverse Inverse of above")  ,
cl::location(TailFoldingOptionLoc  
)

◆ SVETailFoldInsnThreshold

cl::opt< unsigned > SVETailFoldInsnThreshold("sve-tail-folding-insn-threshold", cl::init(15), cl::Hidden) ( "sve-tail-folding-insn-threshold"  ,
cl::init(15)  ,
cl::Hidden   
)
static

◆ TailFoldingOptionLoc

TailFoldingOption TailFoldingOptionLoc