Path: blob/main/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.h
35269 views
//==-- AArch64ISelLowering.h - AArch64 DAG Lowering Interface ----*- C++ -*-==//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file defines the interfaces that AArch64 uses to lower LLVM code into a9// selection DAG.10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64ISELLOWERING_H14#define LLVM_LIB_TARGET_AARCH64_AARCH64ISELLOWERING_H1516#include "AArch64.h"17#include "Utils/AArch64SMEAttributes.h"18#include "llvm/CodeGen/CallingConvLower.h"19#include "llvm/CodeGen/MachineFunction.h"20#include "llvm/CodeGen/SelectionDAG.h"21#include "llvm/CodeGen/TargetLowering.h"22#include "llvm/IR/CallingConv.h"23#include "llvm/IR/Instruction.h"2425namespace llvm {2627namespace AArch64ISD {2829// For predicated nodes where the result is a vector, the operation is30// controlled by a governing predicate and the inactive lanes are explicitly31// defined with a value, please stick the following naming convention:32//33// _MERGE_OP<n> The result value is a vector with inactive lanes equal34// to source operand OP<n>.35//36// _MERGE_ZERO The result value is a vector with inactive lanes37// actively zeroed.38//39// _MERGE_PASSTHRU The result value is a vector with inactive lanes equal40// to the last source operand which only purpose is being41// a passthru value.42//43// For other cases where no explicit action is needed to set the inactive lanes,44// or when the result is not a vector and it is needed or helpful to45// distinguish a node from similar unpredicated nodes, use:46//47// _PRED48//49enum NodeType : unsigned {50FIRST_NUMBER = ISD::BUILTIN_OP_END,51WrapperLarge, // 4-instruction MOVZ/MOVK sequence for 64-bit addresses.52CALL, // Function call.5354// Pseudo for a OBJC call that gets emitted together with a special `mov55// x29, x29` marker instruction.56CALL_RVMARKER,5758CALL_BTI, // Function call followed by a BTI instruction.5960// Function call, authenticating the callee value first:61// AUTH_CALL chain, callee, auth key #, int disc, addr disc, operands.62AUTH_CALL,63// AUTH_TC_RETURN chain, callee, fpdiff, auth key #, int disc, addr disc,64// operands.65AUTH_TC_RETURN,6667// Authenticated variant of CALL_RVMARKER.68AUTH_CALL_RVMARKER,6970COALESCER_BARRIER,7172VG_SAVE,73VG_RESTORE,7475SMSTART,76SMSTOP,77RESTORE_ZA,78RESTORE_ZT,79SAVE_ZT,8081// A call with the callee in x16, i.e. "blr x16".82CALL_ARM64EC_TO_X64,8384// Produces the full sequence of instructions for getting the thread pointer85// offset of a variable into X0, using the TLSDesc model.86TLSDESC_CALLSEQ,87ADRP, // Page address of a TargetGlobalAddress operand.88ADR, // ADR89ADDlow, // Add the low 12 bits of a TargetGlobalAddress operand.90LOADgot, // Load from automatically generated descriptor (e.g. Global91// Offset Table, TLS record).92RET_GLUE, // Return with a glue operand. Operand 0 is the chain operand.93BRCOND, // Conditional branch instruction; "b.cond".94CSEL,95CSINV, // Conditional select invert.96CSNEG, // Conditional select negate.97CSINC, // Conditional select increment.9899// Pointer to the thread's local storage area. Materialised from TPIDR_EL0 on100// ELF.101THREAD_POINTER,102ADC,103SBC, // adc, sbc instructions104105// To avoid stack clash, allocation is performed by block and each block is106// probed.107PROBED_ALLOCA,108109// Predicated instructions where inactive lanes produce undefined results.110ABDS_PRED,111ABDU_PRED,112FADD_PRED,113FDIV_PRED,114FMA_PRED,115FMAX_PRED,116FMAXNM_PRED,117FMIN_PRED,118FMINNM_PRED,119FMUL_PRED,120FSUB_PRED,121HADDS_PRED,122HADDU_PRED,123MUL_PRED,124MULHS_PRED,125MULHU_PRED,126RHADDS_PRED,127RHADDU_PRED,128SDIV_PRED,129SHL_PRED,130SMAX_PRED,131SMIN_PRED,132SRA_PRED,133SRL_PRED,134UDIV_PRED,135UMAX_PRED,136UMIN_PRED,137138// Unpredicated vector instructions139BIC,140141SRAD_MERGE_OP1,142143// Predicated instructions with the result of inactive lanes provided by the144// last operand.145FABS_MERGE_PASSTHRU,146FCEIL_MERGE_PASSTHRU,147FFLOOR_MERGE_PASSTHRU,148FNEARBYINT_MERGE_PASSTHRU,149FNEG_MERGE_PASSTHRU,150FRECPX_MERGE_PASSTHRU,151FRINT_MERGE_PASSTHRU,152FROUND_MERGE_PASSTHRU,153FROUNDEVEN_MERGE_PASSTHRU,154FSQRT_MERGE_PASSTHRU,155FTRUNC_MERGE_PASSTHRU,156FP_ROUND_MERGE_PASSTHRU,157FP_EXTEND_MERGE_PASSTHRU,158UINT_TO_FP_MERGE_PASSTHRU,159SINT_TO_FP_MERGE_PASSTHRU,160FCVTZU_MERGE_PASSTHRU,161FCVTZS_MERGE_PASSTHRU,162SIGN_EXTEND_INREG_MERGE_PASSTHRU,163ZERO_EXTEND_INREG_MERGE_PASSTHRU,164ABS_MERGE_PASSTHRU,165NEG_MERGE_PASSTHRU,166167SETCC_MERGE_ZERO,168169// Arithmetic instructions which write flags.170ADDS,171SUBS,172ADCS,173SBCS,174ANDS,175176// Conditional compares. Operands: left,right,falsecc,cc,flags177CCMP,178CCMN,179FCCMP,180181// Floating point comparison182FCMP,183184// Scalar-to-vector duplication185DUP,186DUPLANE8,187DUPLANE16,188DUPLANE32,189DUPLANE64,190DUPLANE128,191192// Vector immedate moves193MOVI,194MOVIshift,195MOVIedit,196MOVImsl,197FMOV,198MVNIshift,199MVNImsl,200201// Vector immediate ops202BICi,203ORRi,204205// Vector bitwise select: similar to ISD::VSELECT but not all bits within an206// element must be identical.207BSP,208209// Vector shuffles210ZIP1,211ZIP2,212UZP1,213UZP2,214TRN1,215TRN2,216REV16,217REV32,218REV64,219EXT,220SPLICE,221222// Vector shift by scalar223VSHL,224VLSHR,225VASHR,226227// Vector shift by scalar (again)228SQSHL_I,229UQSHL_I,230SQSHLU_I,231SRSHR_I,232URSHR_I,233URSHR_I_PRED,234235// Vector narrowing shift by immediate (bottom)236RSHRNB_I,237238// Vector shift by constant and insert239VSLI,240VSRI,241242// Vector comparisons243CMEQ,244CMGE,245CMGT,246CMHI,247CMHS,248FCMEQ,249FCMGE,250FCMGT,251252// Vector zero comparisons253CMEQz,254CMGEz,255CMGTz,256CMLEz,257CMLTz,258FCMEQz,259FCMGEz,260FCMGTz,261FCMLEz,262FCMLTz,263264// Round wide FP to narrow FP with inexact results to odd.265FCVTXN,266267// Vector across-lanes addition268// Only the lower result lane is defined.269SADDV,270UADDV,271272// Unsigned sum Long across Vector273UADDLV,274SADDLV,275276// Add Pairwise of two vectors277ADDP,278// Add Long Pairwise279SADDLP,280UADDLP,281282// udot/sdot instructions283UDOT,284SDOT,285286// Vector across-lanes min/max287// Only the lower result lane is defined.288SMINV,289UMINV,290SMAXV,291UMAXV,292293SADDV_PRED,294UADDV_PRED,295SMAXV_PRED,296UMAXV_PRED,297SMINV_PRED,298UMINV_PRED,299ORV_PRED,300EORV_PRED,301ANDV_PRED,302303// Compare-and-branch304CBZ,305CBNZ,306TBZ,307TBNZ,308309// Tail calls310TC_RETURN,311312// Custom prefetch handling313PREFETCH,314315// {s|u}int to FP within a FP register.316SITOF,317UITOF,318319/// Natural vector cast. ISD::BITCAST is not natural in the big-endian320/// world w.r.t vectors; which causes additional REV instructions to be321/// generated to compensate for the byte-swapping. But sometimes we do322/// need to re-interpret the data in SIMD vector registers in big-endian323/// mode without emitting such REV instructions.324NVCAST,325326MRS, // MRS, also sets the flags via a glue.327328SMULL,329UMULL,330331PMULL,332333// Reciprocal estimates and steps.334FRECPE,335FRECPS,336FRSQRTE,337FRSQRTS,338339SUNPKHI,340SUNPKLO,341UUNPKHI,342UUNPKLO,343344CLASTA_N,345CLASTB_N,346LASTA,347LASTB,348TBL,349350// Floating-point reductions.351FADDA_PRED,352FADDV_PRED,353FMAXV_PRED,354FMAXNMV_PRED,355FMINV_PRED,356FMINNMV_PRED,357358INSR,359PTEST,360PTEST_ANY,361PTRUE,362363CTTZ_ELTS,364365BITREVERSE_MERGE_PASSTHRU,366BSWAP_MERGE_PASSTHRU,367REVH_MERGE_PASSTHRU,368REVW_MERGE_PASSTHRU,369CTLZ_MERGE_PASSTHRU,370CTPOP_MERGE_PASSTHRU,371DUP_MERGE_PASSTHRU,372INDEX_VECTOR,373374// Cast between vectors of the same element type but differ in length.375REINTERPRET_CAST,376377// Nodes to build an LD64B / ST64B 64-bit quantity out of i64, and vice versa378LS64_BUILD,379LS64_EXTRACT,380381LD1_MERGE_ZERO,382LD1S_MERGE_ZERO,383LDNF1_MERGE_ZERO,384LDNF1S_MERGE_ZERO,385LDFF1_MERGE_ZERO,386LDFF1S_MERGE_ZERO,387LD1RQ_MERGE_ZERO,388LD1RO_MERGE_ZERO,389390// Structured loads.391SVE_LD2_MERGE_ZERO,392SVE_LD3_MERGE_ZERO,393SVE_LD4_MERGE_ZERO,394395// Unsigned gather loads.396GLD1_MERGE_ZERO,397GLD1_SCALED_MERGE_ZERO,398GLD1_UXTW_MERGE_ZERO,399GLD1_SXTW_MERGE_ZERO,400GLD1_UXTW_SCALED_MERGE_ZERO,401GLD1_SXTW_SCALED_MERGE_ZERO,402GLD1_IMM_MERGE_ZERO,403GLD1Q_MERGE_ZERO,404GLD1Q_INDEX_MERGE_ZERO,405406// Signed gather loads407GLD1S_MERGE_ZERO,408GLD1S_SCALED_MERGE_ZERO,409GLD1S_UXTW_MERGE_ZERO,410GLD1S_SXTW_MERGE_ZERO,411GLD1S_UXTW_SCALED_MERGE_ZERO,412GLD1S_SXTW_SCALED_MERGE_ZERO,413GLD1S_IMM_MERGE_ZERO,414415// Unsigned gather loads.416GLDFF1_MERGE_ZERO,417GLDFF1_SCALED_MERGE_ZERO,418GLDFF1_UXTW_MERGE_ZERO,419GLDFF1_SXTW_MERGE_ZERO,420GLDFF1_UXTW_SCALED_MERGE_ZERO,421GLDFF1_SXTW_SCALED_MERGE_ZERO,422GLDFF1_IMM_MERGE_ZERO,423424// Signed gather loads.425GLDFF1S_MERGE_ZERO,426GLDFF1S_SCALED_MERGE_ZERO,427GLDFF1S_UXTW_MERGE_ZERO,428GLDFF1S_SXTW_MERGE_ZERO,429GLDFF1S_UXTW_SCALED_MERGE_ZERO,430GLDFF1S_SXTW_SCALED_MERGE_ZERO,431GLDFF1S_IMM_MERGE_ZERO,432433// Non-temporal gather loads434GLDNT1_MERGE_ZERO,435GLDNT1_INDEX_MERGE_ZERO,436GLDNT1S_MERGE_ZERO,437438// Contiguous masked store.439ST1_PRED,440441// Scatter store442SST1_PRED,443SST1_SCALED_PRED,444SST1_UXTW_PRED,445SST1_SXTW_PRED,446SST1_UXTW_SCALED_PRED,447SST1_SXTW_SCALED_PRED,448SST1_IMM_PRED,449SST1Q_PRED,450SST1Q_INDEX_PRED,451452// Non-temporal scatter store453SSTNT1_PRED,454SSTNT1_INDEX_PRED,455456// SME457RDSVL,458REVD_MERGE_PASSTHRU,459ALLOCATE_ZA_BUFFER,460INIT_TPIDR2OBJ,461462// Asserts that a function argument (i32) is zero-extended to i8 by463// the caller464ASSERT_ZEXT_BOOL,465466// 128-bit system register accesses467// lo64, hi64, chain = MRRS(chain, sysregname)468MRRS,469// chain = MSRR(chain, sysregname, lo64, hi64)470MSRR,471472// Strict (exception-raising) floating point comparison473STRICT_FCMP = ISD::FIRST_TARGET_STRICTFP_OPCODE,474STRICT_FCMPE,475476// SME ZA loads and stores477SME_ZA_LDR,478SME_ZA_STR,479480// NEON Load/Store with post-increment base updates481LD2post = ISD::FIRST_TARGET_MEMORY_OPCODE,482LD3post,483LD4post,484ST2post,485ST3post,486ST4post,487LD1x2post,488LD1x3post,489LD1x4post,490ST1x2post,491ST1x3post,492ST1x4post,493LD1DUPpost,494LD2DUPpost,495LD3DUPpost,496LD4DUPpost,497LD1LANEpost,498LD2LANEpost,499LD3LANEpost,500LD4LANEpost,501ST2LANEpost,502ST3LANEpost,503ST4LANEpost,504505STG,506STZG,507ST2G,508STZ2G,509510LDP,511LDIAPP,512LDNP,513STP,514STILP,515STNP,516517// Memory Operations518MOPS_MEMSET,519MOPS_MEMSET_TAGGING,520MOPS_MEMCOPY,521MOPS_MEMMOVE,522};523524} // end namespace AArch64ISD525526namespace AArch64 {527/// Possible values of current rounding mode, which is specified in bits528/// 23:22 of FPCR.529enum Rounding {530RN = 0, // Round to Nearest531RP = 1, // Round towards Plus infinity532RM = 2, // Round towards Minus infinity533RZ = 3, // Round towards Zero534rmMask = 3 // Bit mask selecting rounding mode535};536537// Bit position of rounding mode bits in FPCR.538const unsigned RoundingBitsPos = 22;539540// Reserved bits should be preserved when modifying FPCR.541const uint64_t ReservedFPControlBits = 0xfffffffff80040f8;542543// Registers used to pass function arguments.544ArrayRef<MCPhysReg> getGPRArgRegs();545ArrayRef<MCPhysReg> getFPRArgRegs();546547/// Maximum allowed number of unprobed bytes above SP at an ABI548/// boundary.549const unsigned StackProbeMaxUnprobedStack = 1024;550551/// Maximum number of iterations to unroll for a constant size probing loop.552const unsigned StackProbeMaxLoopUnroll = 4;553554} // namespace AArch64555556class AArch64Subtarget;557558class AArch64TargetLowering : public TargetLowering {559public:560explicit AArch64TargetLowering(const TargetMachine &TM,561const AArch64Subtarget &STI);562563/// Control the following reassociation of operands: (op (op x, c1), y) -> (op564/// (op x, y), c1) where N0 is (op x, c1) and N1 is y.565bool isReassocProfitable(SelectionDAG &DAG, SDValue N0,566SDValue N1) const override;567568/// Selects the correct CCAssignFn for a given CallingConvention value.569CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg) const;570571/// Selects the correct CCAssignFn for a given CallingConvention value.572CCAssignFn *CCAssignFnForReturn(CallingConv::ID CC) const;573574/// Determine which of the bits specified in Mask are known to be either zero575/// or one and return them in the KnownZero/KnownOne bitsets.576void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known,577const APInt &DemandedElts,578const SelectionDAG &DAG,579unsigned Depth = 0) const override;580581unsigned ComputeNumSignBitsForTargetNode(SDValue Op,582const APInt &DemandedElts,583const SelectionDAG &DAG,584unsigned Depth) const override;585586MVT getPointerTy(const DataLayout &DL, uint32_t AS = 0) const override {587// Returning i64 unconditionally here (i.e. even for ILP32) means that the588// *DAG* representation of pointers will always be 64-bits. They will be589// truncated and extended when transferred to memory, but the 64-bit DAG590// allows us to use AArch64's addressing modes much more easily.591return MVT::getIntegerVT(64);592}593594bool targetShrinkDemandedConstant(SDValue Op, const APInt &DemandedBits,595const APInt &DemandedElts,596TargetLoweringOpt &TLO) const override;597598MVT getScalarShiftAmountTy(const DataLayout &DL, EVT) const override;599600/// Returns true if the target allows unaligned memory accesses of the601/// specified type.602bool allowsMisalignedMemoryAccesses(603EVT VT, unsigned AddrSpace = 0, Align Alignment = Align(1),604MachineMemOperand::Flags Flags = MachineMemOperand::MONone,605unsigned *Fast = nullptr) const override;606/// LLT variant.607bool allowsMisalignedMemoryAccesses(LLT Ty, unsigned AddrSpace,608Align Alignment,609MachineMemOperand::Flags Flags,610unsigned *Fast = nullptr) const override;611612/// Provide custom lowering hooks for some operations.613SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;614615const char *getTargetNodeName(unsigned Opcode) const override;616617SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;618619/// This method returns a target specific FastISel object, or null if the620/// target does not support "fast" ISel.621FastISel *createFastISel(FunctionLoweringInfo &funcInfo,622const TargetLibraryInfo *libInfo) const override;623624bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;625626bool isFPImmLegal(const APFloat &Imm, EVT VT,627bool ForCodeSize) const override;628629/// Return true if the given shuffle mask can be codegen'd directly, or if it630/// should be stack expanded.631bool isShuffleMaskLegal(ArrayRef<int> M, EVT VT) const override;632633/// Similar to isShuffleMaskLegal. Return true is the given 'select with zero'634/// shuffle mask can be codegen'd directly.635bool isVectorClearMaskLegal(ArrayRef<int> M, EVT VT) const override;636637/// Return the ISD::SETCC ValueType.638EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context,639EVT VT) const override;640641SDValue ReconstructShuffle(SDValue Op, SelectionDAG &DAG) const;642643MachineBasicBlock *EmitF128CSEL(MachineInstr &MI,644MachineBasicBlock *BB) const;645646MachineBasicBlock *EmitLoweredCatchRet(MachineInstr &MI,647MachineBasicBlock *BB) const;648649MachineBasicBlock *EmitDynamicProbedAlloc(MachineInstr &MI,650MachineBasicBlock *MBB) const;651652MachineBasicBlock *EmitTileLoad(unsigned Opc, unsigned BaseReg,653MachineInstr &MI,654MachineBasicBlock *BB) const;655MachineBasicBlock *EmitFill(MachineInstr &MI, MachineBasicBlock *BB) const;656MachineBasicBlock *EmitZAInstr(unsigned Opc, unsigned BaseReg,657MachineInstr &MI, MachineBasicBlock *BB) const;658MachineBasicBlock *EmitZTInstr(MachineInstr &MI, MachineBasicBlock *BB,659unsigned Opcode, bool Op0IsDef) const;660MachineBasicBlock *EmitZero(MachineInstr &MI, MachineBasicBlock *BB) const;661MachineBasicBlock *EmitInitTPIDR2Object(MachineInstr &MI,662MachineBasicBlock *BB) const;663MachineBasicBlock *EmitAllocateZABuffer(MachineInstr &MI,664MachineBasicBlock *BB) const;665666MachineBasicBlock *667EmitInstrWithCustomInserter(MachineInstr &MI,668MachineBasicBlock *MBB) const override;669670bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I,671MachineFunction &MF,672unsigned Intrinsic) const override;673674bool shouldReduceLoadWidth(SDNode *Load, ISD::LoadExtType ExtTy,675EVT NewVT) const override;676677bool shouldRemoveRedundantExtend(SDValue Op) const override;678679bool isTruncateFree(Type *Ty1, Type *Ty2) const override;680bool isTruncateFree(EVT VT1, EVT VT2) const override;681682bool isProfitableToHoist(Instruction *I) const override;683684bool isZExtFree(Type *Ty1, Type *Ty2) const override;685bool isZExtFree(EVT VT1, EVT VT2) const override;686bool isZExtFree(SDValue Val, EVT VT2) const override;687688bool shouldSinkOperands(Instruction *I,689SmallVectorImpl<Use *> &Ops) const override;690691bool optimizeExtendOrTruncateConversion(692Instruction *I, Loop *L, const TargetTransformInfo &TTI) const override;693694bool hasPairedLoad(EVT LoadedType, Align &RequiredAligment) const override;695696unsigned getMaxSupportedInterleaveFactor() const override { return 4; }697698bool lowerInterleavedLoad(LoadInst *LI,699ArrayRef<ShuffleVectorInst *> Shuffles,700ArrayRef<unsigned> Indices,701unsigned Factor) const override;702bool lowerInterleavedStore(StoreInst *SI, ShuffleVectorInst *SVI,703unsigned Factor) const override;704705bool lowerDeinterleaveIntrinsicToLoad(IntrinsicInst *DI,706LoadInst *LI) const override;707708bool lowerInterleaveIntrinsicToStore(IntrinsicInst *II,709StoreInst *SI) const override;710711bool isLegalAddImmediate(int64_t) const override;712bool isLegalAddScalableImmediate(int64_t) const override;713bool isLegalICmpImmediate(int64_t) const override;714715bool isMulAddWithConstProfitable(SDValue AddNode,716SDValue ConstNode) const override;717718bool shouldConsiderGEPOffsetSplit() const override;719720EVT getOptimalMemOpType(const MemOp &Op,721const AttributeList &FuncAttributes) const override;722723LLT getOptimalMemOpLLT(const MemOp &Op,724const AttributeList &FuncAttributes) const override;725726/// Return true if the addressing mode represented by AM is legal for this727/// target, for a load/store of the specified type.728bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,729unsigned AS,730Instruction *I = nullptr) const override;731732int64_t getPreferredLargeGEPBaseOffset(int64_t MinOffset,733int64_t MaxOffset) const override;734735/// Return true if an FMA operation is faster than a pair of fmul and fadd736/// instructions. fmuladd intrinsics will be expanded to FMAs when this method737/// returns true, otherwise fmuladd is expanded to fmul + fadd.738bool isFMAFasterThanFMulAndFAdd(const MachineFunction &MF,739EVT VT) const override;740bool isFMAFasterThanFMulAndFAdd(const Function &F, Type *Ty) const override;741742bool generateFMAsInMachineCombiner(EVT VT,743CodeGenOptLevel OptLevel) const override;744745const MCPhysReg *getScratchRegisters(CallingConv::ID CC) const override;746ArrayRef<MCPhysReg> getRoundingControlRegisters() const override;747748/// Returns false if N is a bit extraction pattern of (X >> C) & Mask.749bool isDesirableToCommuteWithShift(const SDNode *N,750CombineLevel Level) const override;751752bool isDesirableToPullExtFromShl(const MachineInstr &MI) const override {753return false;754}755756/// Returns false if N is a bit extraction pattern of (X >> C) & Mask.757bool isDesirableToCommuteXorWithShift(const SDNode *N) const override;758759/// Return true if it is profitable to fold a pair of shifts into a mask.760bool shouldFoldConstantShiftPairToMask(const SDNode *N,761CombineLevel Level) const override;762763bool shouldFoldSelectWithIdentityConstant(unsigned BinOpcode,764EVT VT) const override;765766/// Returns true if it is beneficial to convert a load of a constant767/// to just the constant itself.768bool shouldConvertConstantLoadToIntImm(const APInt &Imm,769Type *Ty) const override;770771/// Return true if EXTRACT_SUBVECTOR is cheap for this result type772/// with this index.773bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT,774unsigned Index) const override;775776bool shouldFormOverflowOp(unsigned Opcode, EVT VT,777bool MathUsed) const override {778// Using overflow ops for overflow checks only should beneficial on779// AArch64.780return TargetLowering::shouldFormOverflowOp(Opcode, VT, true);781}782783Value *emitLoadLinked(IRBuilderBase &Builder, Type *ValueTy, Value *Addr,784AtomicOrdering Ord) const override;785Value *emitStoreConditional(IRBuilderBase &Builder, Value *Val, Value *Addr,786AtomicOrdering Ord) const override;787788void emitAtomicCmpXchgNoStoreLLBalance(IRBuilderBase &Builder) const override;789790bool isOpSuitableForLDPSTP(const Instruction *I) const;791bool isOpSuitableForLSE128(const Instruction *I) const;792bool isOpSuitableForRCPC3(const Instruction *I) const;793bool shouldInsertFencesForAtomic(const Instruction *I) const override;794bool795shouldInsertTrailingFenceForAtomicStore(const Instruction *I) const override;796797TargetLoweringBase::AtomicExpansionKind798shouldExpandAtomicLoadInIR(LoadInst *LI) const override;799TargetLoweringBase::AtomicExpansionKind800shouldExpandAtomicStoreInIR(StoreInst *SI) const override;801TargetLoweringBase::AtomicExpansionKind802shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override;803804TargetLoweringBase::AtomicExpansionKind805shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override;806807bool useLoadStackGuardNode() const override;808TargetLoweringBase::LegalizeTypeAction809getPreferredVectorAction(MVT VT) const override;810811/// If the target has a standard location for the stack protector cookie,812/// returns the address of that location. Otherwise, returns nullptr.813Value *getIRStackGuard(IRBuilderBase &IRB) const override;814815void insertSSPDeclarations(Module &M) const override;816Value *getSDagStackGuard(const Module &M) const override;817Function *getSSPStackGuardCheck(const Module &M) const override;818819/// If the target has a standard location for the unsafe stack pointer,820/// returns the address of that location. Otherwise, returns nullptr.821Value *getSafeStackPointerLocation(IRBuilderBase &IRB) const override;822823/// If a physical register, this returns the register that receives the824/// exception address on entry to an EH pad.825Register826getExceptionPointerRegister(const Constant *PersonalityFn) const override {827// FIXME: This is a guess. Has this been defined yet?828return AArch64::X0;829}830831/// If a physical register, this returns the register that receives the832/// exception typeid on entry to a landing pad.833Register834getExceptionSelectorRegister(const Constant *PersonalityFn) const override {835// FIXME: This is a guess. Has this been defined yet?836return AArch64::X1;837}838839bool isIntDivCheap(EVT VT, AttributeList Attr) const override;840841bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT,842const MachineFunction &MF) const override {843// Do not merge to float value size (128 bytes) if no implicit844// float attribute is set.845846bool NoFloat = MF.getFunction().hasFnAttribute(Attribute::NoImplicitFloat);847848if (NoFloat)849return (MemVT.getSizeInBits() <= 64);850return true;851}852853bool isCheapToSpeculateCttz(Type *) const override {854return true;855}856857bool isCheapToSpeculateCtlz(Type *) const override {858return true;859}860861bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override;862863bool hasAndNotCompare(SDValue V) const override {864// We can use bics for any scalar.865return V.getValueType().isScalarInteger();866}867868bool hasAndNot(SDValue Y) const override {869EVT VT = Y.getValueType();870871if (!VT.isVector())872return hasAndNotCompare(Y);873874TypeSize TS = VT.getSizeInBits();875// TODO: We should be able to use bic/bif too for SVE.876return !TS.isScalable() && TS.getFixedValue() >= 64; // vector 'bic'877}878879bool shouldProduceAndByConstByHoistingConstFromShiftsLHSOfAnd(880SDValue X, ConstantSDNode *XC, ConstantSDNode *CC, SDValue Y,881unsigned OldShiftOpcode, unsigned NewShiftOpcode,882SelectionDAG &DAG) const override;883884ShiftLegalizationStrategy885preferredShiftLegalizationStrategy(SelectionDAG &DAG, SDNode *N,886unsigned ExpansionFactor) const override;887888bool shouldTransformSignedTruncationCheck(EVT XVT,889unsigned KeptBits) const override {890// For vectors, we don't have a preference..891if (XVT.isVector())892return false;893894auto VTIsOk = [](EVT VT) -> bool {895return VT == MVT::i8 || VT == MVT::i16 || VT == MVT::i32 ||896VT == MVT::i64;897};898899// We are ok with KeptBitsVT being byte/word/dword, what SXT supports.900// XVT will be larger than KeptBitsVT.901MVT KeptBitsVT = MVT::getIntegerVT(KeptBits);902return VTIsOk(XVT) && VTIsOk(KeptBitsVT);903}904905bool preferIncOfAddToSubOfNot(EVT VT) const override;906907bool shouldConvertFpToSat(unsigned Op, EVT FPVT, EVT VT) const override;908909bool shouldExpandCmpUsingSelects() const override { return true; }910911bool isComplexDeinterleavingSupported() const override;912bool isComplexDeinterleavingOperationSupported(913ComplexDeinterleavingOperation Operation, Type *Ty) const override;914915Value *createComplexDeinterleavingIR(916IRBuilderBase &B, ComplexDeinterleavingOperation OperationType,917ComplexDeinterleavingRotation Rotation, Value *InputA, Value *InputB,918Value *Accumulator = nullptr) const override;919920bool supportSplitCSR(MachineFunction *MF) const override {921return MF->getFunction().getCallingConv() == CallingConv::CXX_FAST_TLS &&922MF->getFunction().hasFnAttribute(Attribute::NoUnwind);923}924void initializeSplitCSR(MachineBasicBlock *Entry) const override;925void insertCopiesSplitCSR(926MachineBasicBlock *Entry,927const SmallVectorImpl<MachineBasicBlock *> &Exits) const override;928929bool supportSwiftError() const override {930return true;931}932933bool supportPtrAuthBundles() const override { return true; }934935bool supportKCFIBundles() const override { return true; }936937MachineInstr *EmitKCFICheck(MachineBasicBlock &MBB,938MachineBasicBlock::instr_iterator &MBBI,939const TargetInstrInfo *TII) const override;940941/// Enable aggressive FMA fusion on targets that want it.942bool enableAggressiveFMAFusion(EVT VT) const override;943944/// Returns the size of the platform's va_list object.945unsigned getVaListSizeInBits(const DataLayout &DL) const override;946947/// Returns true if \p VecTy is a legal interleaved access type. This948/// function checks the vector element type and the overall width of the949/// vector.950bool isLegalInterleavedAccessType(VectorType *VecTy, const DataLayout &DL,951bool &UseScalable) const;952953/// Returns the number of interleaved accesses that will be generated when954/// lowering accesses of the given type.955unsigned getNumInterleavedAccesses(VectorType *VecTy, const DataLayout &DL,956bool UseScalable) const;957958MachineMemOperand::Flags getTargetMMOFlags(959const Instruction &I) const override;960961bool functionArgumentNeedsConsecutiveRegisters(962Type *Ty, CallingConv::ID CallConv, bool isVarArg,963const DataLayout &DL) const override;964965/// Used for exception handling on Win64.966bool needsFixedCatchObjects() const override;967968bool fallBackToDAGISel(const Instruction &Inst) const override;969970/// SVE code generation for fixed length vectors does not custom lower971/// BUILD_VECTOR. This makes BUILD_VECTOR legalisation a source of stores to972/// merge. However, merging them creates a BUILD_VECTOR that is just as973/// illegal as the original, thus leading to an infinite legalisation loop.974/// NOTE: Once BUILD_VECTOR is legal or can be custom lowered for all legal975/// vector types this override can be removed.976bool mergeStoresAfterLegalization(EVT VT) const override;977978// If the platform/function should have a redzone, return the size in bytes.979unsigned getRedZoneSize(const Function &F) const {980if (F.hasFnAttribute(Attribute::NoRedZone))981return 0;982return 128;983}984985bool isAllActivePredicate(SelectionDAG &DAG, SDValue N) const;986EVT getPromotedVTForPredicate(EVT VT) const;987988EVT getAsmOperandValueType(const DataLayout &DL, Type *Ty,989bool AllowUnknown = false) const override;990991bool shouldExpandGetActiveLaneMask(EVT VT, EVT OpVT) const override;992993bool shouldExpandCttzElements(EVT VT) const override;994995/// If a change in streaming mode is required on entry to/return from a996/// function call it emits and returns the corresponding SMSTART or SMSTOP997/// node. \p Condition should be one of the enum values from998/// AArch64SME::ToggleCondition.999SDValue changeStreamingMode(SelectionDAG &DAG, SDLoc DL, bool Enable,1000SDValue Chain, SDValue InGlue, unsigned Condition,1001SDValue PStateSM = SDValue()) const;10021003bool isVScaleKnownToBeAPowerOfTwo() const override { return true; }10041005// Normally SVE is only used for byte size vectors that do not fit within a1006// NEON vector. This changes when OverrideNEON is true, allowing SVE to be1007// used for 64bit and 128bit vectors as well.1008bool useSVEForFixedLengthVectorVT(EVT VT, bool OverrideNEON = false) const;10091010// Follow NEON ABI rules even when using SVE for fixed length vectors.1011MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC,1012EVT VT) const override;1013unsigned getNumRegistersForCallingConv(LLVMContext &Context,1014CallingConv::ID CC,1015EVT VT) const override;1016unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context,1017CallingConv::ID CC, EVT VT,1018EVT &IntermediateVT,1019unsigned &NumIntermediates,1020MVT &RegisterVT) const override;10211022/// True if stack clash protection is enabled for this functions.1023bool hasInlineStackProbe(const MachineFunction &MF) const override;10241025#ifndef NDEBUG1026void verifyTargetSDNode(const SDNode *N) const override;1027#endif10281029private:1030/// Keep a pointer to the AArch64Subtarget around so that we can1031/// make the right decision when generating code for different targets.1032const AArch64Subtarget *Subtarget;10331034llvm::BumpPtrAllocator BumpAlloc;1035llvm::StringSaver Saver{BumpAlloc};10361037bool isExtFreeImpl(const Instruction *Ext) const override;10381039void addTypeForNEON(MVT VT);1040void addTypeForFixedLengthSVE(MVT VT);1041void addDRType(MVT VT);1042void addQRType(MVT VT);10431044bool shouldExpandBuildVectorWithShuffles(EVT, unsigned) const override;10451046SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,1047bool isVarArg,1048const SmallVectorImpl<ISD::InputArg> &Ins,1049const SDLoc &DL, SelectionDAG &DAG,1050SmallVectorImpl<SDValue> &InVals) const override;10511052void AdjustInstrPostInstrSelection(MachineInstr &MI,1053SDNode *Node) const override;10541055SDValue LowerCall(CallLoweringInfo & /*CLI*/,1056SmallVectorImpl<SDValue> &InVals) const override;10571058SDValue LowerCallResult(SDValue Chain, SDValue InGlue,1059CallingConv::ID CallConv, bool isVarArg,1060const SmallVectorImpl<CCValAssign> &RVLocs,1061const SDLoc &DL, SelectionDAG &DAG,1062SmallVectorImpl<SDValue> &InVals, bool isThisReturn,1063SDValue ThisVal, bool RequiresSMChange) const;10641065SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const;1066SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const;1067SDValue LowerStore128(SDValue Op, SelectionDAG &DAG) const;1068SDValue LowerABS(SDValue Op, SelectionDAG &DAG) const;10691070SDValue LowerMGATHER(SDValue Op, SelectionDAG &DAG) const;1071SDValue LowerMSCATTER(SDValue Op, SelectionDAG &DAG) const;10721073SDValue LowerMLOAD(SDValue Op, SelectionDAG &DAG) const;10741075SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;1076SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;1077SDValue LowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const;10781079bool1080isEligibleForTailCallOptimization(const CallLoweringInfo &CLI) const;10811082/// Finds the incoming stack arguments which overlap the given fixed stack1083/// object and incorporates their load into the current chain. This prevents1084/// an upcoming store from clobbering the stack argument before it's used.1085SDValue addTokenForArgument(SDValue Chain, SelectionDAG &DAG,1086MachineFrameInfo &MFI, int ClobberedFI) const;10871088bool DoesCalleeRestoreStack(CallingConv::ID CallCC, bool TailCallOpt) const;10891090void saveVarArgRegisters(CCState &CCInfo, SelectionDAG &DAG, const SDLoc &DL,1091SDValue &Chain) const;10921093bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,1094bool isVarArg,1095const SmallVectorImpl<ISD::OutputArg> &Outs,1096LLVMContext &Context) const override;10971098SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,1099const SmallVectorImpl<ISD::OutputArg> &Outs,1100const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,1101SelectionDAG &DAG) const override;11021103SDValue getTargetNode(GlobalAddressSDNode *N, EVT Ty, SelectionDAG &DAG,1104unsigned Flag) const;1105SDValue getTargetNode(JumpTableSDNode *N, EVT Ty, SelectionDAG &DAG,1106unsigned Flag) const;1107SDValue getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG,1108unsigned Flag) const;1109SDValue getTargetNode(BlockAddressSDNode *N, EVT Ty, SelectionDAG &DAG,1110unsigned Flag) const;1111SDValue getTargetNode(ExternalSymbolSDNode *N, EVT Ty, SelectionDAG &DAG,1112unsigned Flag) const;1113template <class NodeTy>1114SDValue getGOT(NodeTy *N, SelectionDAG &DAG, unsigned Flags = 0) const;1115template <class NodeTy>1116SDValue getAddrLarge(NodeTy *N, SelectionDAG &DAG, unsigned Flags = 0) const;1117template <class NodeTy>1118SDValue getAddr(NodeTy *N, SelectionDAG &DAG, unsigned Flags = 0) const;1119template <class NodeTy>1120SDValue getAddrTiny(NodeTy *N, SelectionDAG &DAG, unsigned Flags = 0) const;1121SDValue LowerADDROFRETURNADDR(SDValue Op, SelectionDAG &DAG) const;1122SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;1123SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;1124SDValue LowerDarwinGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;1125SDValue LowerELFGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;1126SDValue LowerELFTLSLocalExec(const GlobalValue *GV, SDValue ThreadBase,1127const SDLoc &DL, SelectionDAG &DAG) const;1128SDValue LowerELFTLSDescCallSeq(SDValue SymAddr, const SDLoc &DL,1129SelectionDAG &DAG) const;1130SDValue LowerWindowsGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;1131SDValue LowerPtrAuthGlobalAddress(SDValue Op, SelectionDAG &DAG) const;1132SDValue LowerPtrAuthGlobalAddressStatically(SDValue TGA, SDLoc DL, EVT VT,1133AArch64PACKey::ID Key,1134SDValue Discriminator,1135SDValue AddrDiscriminator,1136SelectionDAG &DAG) const;1137SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;1138SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG) const;1139SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;1140SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;1141SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;1142SDValue LowerSELECT_CC(ISD::CondCode CC, SDValue LHS, SDValue RHS,1143SDValue TVal, SDValue FVal, const SDLoc &dl,1144SelectionDAG &DAG) const;1145SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;1146SDValue LowerADJUST_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;1147SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;1148SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const;1149SDValue LowerBRIND(SDValue Op, SelectionDAG &DAG) const;1150SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;1151SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;1152SDValue LowerAAPCS_VASTART(SDValue Op, SelectionDAG &DAG) const;1153SDValue LowerDarwin_VASTART(SDValue Op, SelectionDAG &DAG) const;1154SDValue LowerWin64_VASTART(SDValue Op, SelectionDAG &DAG) const;1155SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;1156SDValue LowerVACOPY(SDValue Op, SelectionDAG &DAG) const;1157SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG) const;1158SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;1159SDValue LowerSPONENTRY(SDValue Op, SelectionDAG &DAG) const;1160SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;1161SDValue LowerGET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;1162SDValue LowerSET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;1163SDValue LowerGET_FPMODE(SDValue Op, SelectionDAG &DAG) const;1164SDValue LowerSET_FPMODE(SDValue Op, SelectionDAG &DAG) const;1165SDValue LowerRESET_FPMODE(SDValue Op, SelectionDAG &DAG) const;1166SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;1167SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;1168SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;1169SDValue LowerZERO_EXTEND_VECTOR_INREG(SDValue Op, SelectionDAG &DAG) const;1170SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;1171SDValue LowerSPLAT_VECTOR(SDValue Op, SelectionDAG &DAG) const;1172SDValue LowerDUPQLane(SDValue Op, SelectionDAG &DAG) const;1173SDValue LowerToPredicatedOp(SDValue Op, SelectionDAG &DAG,1174unsigned NewOp) const;1175SDValue LowerToScalableOp(SDValue Op, SelectionDAG &DAG) const;1176SDValue LowerVECTOR_SPLICE(SDValue Op, SelectionDAG &DAG) const;1177SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, SelectionDAG &DAG) const;1178SDValue LowerINSERT_SUBVECTOR(SDValue Op, SelectionDAG &DAG) const;1179SDValue LowerVECTOR_DEINTERLEAVE(SDValue Op, SelectionDAG &DAG) const;1180SDValue LowerVECTOR_INTERLEAVE(SDValue Op, SelectionDAG &DAG) const;1181SDValue LowerVECTOR_HISTOGRAM(SDValue Op, SelectionDAG &DAG) const;1182SDValue LowerDIV(SDValue Op, SelectionDAG &DAG) const;1183SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const;1184SDValue LowerVectorSRA_SRL_SHL(SDValue Op, SelectionDAG &DAG) const;1185SDValue LowerShiftParts(SDValue Op, SelectionDAG &DAG) const;1186SDValue LowerVSETCC(SDValue Op, SelectionDAG &DAG) const;1187SDValue LowerCTPOP_PARITY(SDValue Op, SelectionDAG &DAG) const;1188SDValue LowerCTTZ(SDValue Op, SelectionDAG &DAG) const;1189SDValue LowerBitreverse(SDValue Op, SelectionDAG &DAG) const;1190SDValue LowerMinMax(SDValue Op, SelectionDAG &DAG) const;1191SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;1192SDValue LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const;1193SDValue LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const;1194SDValue LowerVectorFP_TO_INT(SDValue Op, SelectionDAG &DAG) const;1195SDValue LowerVectorFP_TO_INT_SAT(SDValue Op, SelectionDAG &DAG) const;1196SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const;1197SDValue LowerFP_TO_INT_SAT(SDValue Op, SelectionDAG &DAG) const;1198SDValue LowerVectorXRINT(SDValue Op, SelectionDAG &DAG) const;1199SDValue LowerINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;1200SDValue LowerVectorINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;1201SDValue LowerVectorOR(SDValue Op, SelectionDAG &DAG) const;1202SDValue LowerXOR(SDValue Op, SelectionDAG &DAG) const;1203SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const;1204SDValue LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const;1205SDValue LowerBITCAST(SDValue Op, SelectionDAG &DAG) const;1206SDValue LowerVSCALE(SDValue Op, SelectionDAG &DAG) const;1207SDValue LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) const;1208SDValue LowerVECREDUCE(SDValue Op, SelectionDAG &DAG) const;1209SDValue LowerATOMIC_LOAD_AND(SDValue Op, SelectionDAG &DAG) const;1210SDValue LowerWindowsDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;1211SDValue LowerInlineDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;1212SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;12131214SDValue LowerAVG(SDValue Op, SelectionDAG &DAG, unsigned NewOp) const;12151216SDValue LowerFixedLengthVectorIntDivideToSVE(SDValue Op,1217SelectionDAG &DAG) const;1218SDValue LowerFixedLengthVectorIntExtendToSVE(SDValue Op,1219SelectionDAG &DAG) const;1220SDValue LowerFixedLengthVectorLoadToSVE(SDValue Op, SelectionDAG &DAG) const;1221SDValue LowerFixedLengthVectorMLoadToSVE(SDValue Op, SelectionDAG &DAG) const;1222SDValue LowerVECREDUCE_SEQ_FADD(SDValue ScalarOp, SelectionDAG &DAG) const;1223SDValue LowerPredReductionToSVE(SDValue ScalarOp, SelectionDAG &DAG) const;1224SDValue LowerReductionToSVE(unsigned Opcode, SDValue ScalarOp,1225SelectionDAG &DAG) const;1226SDValue LowerFixedLengthVectorSelectToSVE(SDValue Op, SelectionDAG &DAG) const;1227SDValue LowerFixedLengthVectorSetccToSVE(SDValue Op, SelectionDAG &DAG) const;1228SDValue LowerFixedLengthVectorStoreToSVE(SDValue Op, SelectionDAG &DAG) const;1229SDValue LowerFixedLengthVectorMStoreToSVE(SDValue Op,1230SelectionDAG &DAG) const;1231SDValue LowerFixedLengthVectorTruncateToSVE(SDValue Op,1232SelectionDAG &DAG) const;1233SDValue LowerFixedLengthExtractVectorElt(SDValue Op, SelectionDAG &DAG) const;1234SDValue LowerFixedLengthInsertVectorElt(SDValue Op, SelectionDAG &DAG) const;1235SDValue LowerFixedLengthBitcastToSVE(SDValue Op, SelectionDAG &DAG) const;1236SDValue LowerFixedLengthConcatVectorsToSVE(SDValue Op,1237SelectionDAG &DAG) const;1238SDValue LowerFixedLengthFPExtendToSVE(SDValue Op, SelectionDAG &DAG) const;1239SDValue LowerFixedLengthFPRoundToSVE(SDValue Op, SelectionDAG &DAG) const;1240SDValue LowerFixedLengthIntToFPToSVE(SDValue Op, SelectionDAG &DAG) const;1241SDValue LowerFixedLengthFPToIntToSVE(SDValue Op, SelectionDAG &DAG) const;1242SDValue LowerFixedLengthVECTOR_SHUFFLEToSVE(SDValue Op,1243SelectionDAG &DAG) const;12441245SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG,1246SmallVectorImpl<SDNode *> &Created) const override;1247SDValue BuildSREMPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG,1248SmallVectorImpl<SDNode *> &Created) const override;1249SDValue getSqrtEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled,1250int &ExtraSteps, bool &UseOneConst,1251bool Reciprocal) const override;1252SDValue getRecipEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled,1253int &ExtraSteps) const override;1254SDValue getSqrtInputTest(SDValue Operand, SelectionDAG &DAG,1255const DenormalMode &Mode) const override;1256SDValue getSqrtResultForDenormInput(SDValue Operand,1257SelectionDAG &DAG) const override;1258unsigned combineRepeatedFPDivisors() const override;12591260ConstraintType getConstraintType(StringRef Constraint) const override;1261Register getRegisterByName(const char* RegName, LLT VT,1262const MachineFunction &MF) const override;12631264/// Examine constraint string and operand type and determine a weight value.1265/// The operand object must already have been set up with the operand type.1266ConstraintWeight1267getSingleConstraintMatchWeight(AsmOperandInfo &info,1268const char *constraint) const override;12691270std::pair<unsigned, const TargetRegisterClass *>1271getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,1272StringRef Constraint, MVT VT) const override;12731274const char *LowerXConstraint(EVT ConstraintVT) const override;12751276void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint,1277std::vector<SDValue> &Ops,1278SelectionDAG &DAG) const override;12791280InlineAsm::ConstraintCode1281getInlineAsmMemConstraint(StringRef ConstraintCode) const override {1282if (ConstraintCode == "Q")1283return InlineAsm::ConstraintCode::Q;1284// FIXME: clang has code for 'Ump', 'Utf', 'Usa', and 'Ush' but these are1285// followed by llvm_unreachable so we'll leave them unimplemented in1286// the backend for now.1287return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);1288}12891290/// Handle Lowering flag assembly outputs.1291SDValue LowerAsmOutputForConstraint(SDValue &Chain, SDValue &Flag,1292const SDLoc &DL,1293const AsmOperandInfo &Constraint,1294SelectionDAG &DAG) const override;12951296bool shouldExtendGSIndex(EVT VT, EVT &EltTy) const override;1297bool shouldRemoveExtendFromGSIndex(SDValue Extend, EVT DataVT) const override;1298bool isVectorLoadExtDesirable(SDValue ExtVal) const override;1299bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override;1300bool mayBeEmittedAsTailCall(const CallInst *CI) const override;1301bool getIndexedAddressParts(SDNode *N, SDNode *Op, SDValue &Base,1302SDValue &Offset, SelectionDAG &DAG) const;1303bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, SDValue &Offset,1304ISD::MemIndexedMode &AM,1305SelectionDAG &DAG) const override;1306bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDValue &Base,1307SDValue &Offset, ISD::MemIndexedMode &AM,1308SelectionDAG &DAG) const override;1309bool isIndexingLegal(MachineInstr &MI, Register Base, Register Offset,1310bool IsPre, MachineRegisterInfo &MRI) const override;13111312void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue> &Results,1313SelectionDAG &DAG) const override;1314void ReplaceBITCASTResults(SDNode *N, SmallVectorImpl<SDValue> &Results,1315SelectionDAG &DAG) const;1316void ReplaceExtractSubVectorResults(SDNode *N,1317SmallVectorImpl<SDValue> &Results,1318SelectionDAG &DAG) const;13191320bool shouldNormalizeToSelectSequence(LLVMContext &, EVT) const override;13211322void finalizeLowering(MachineFunction &MF) const override;13231324bool shouldLocalize(const MachineInstr &MI,1325const TargetTransformInfo *TTI) const override;13261327bool SimplifyDemandedBitsForTargetNode(SDValue Op,1328const APInt &OriginalDemandedBits,1329const APInt &OriginalDemandedElts,1330KnownBits &Known,1331TargetLoweringOpt &TLO,1332unsigned Depth) const override;13331334bool isTargetCanonicalConstantNode(SDValue Op) const override;13351336// With the exception of data-predicate transitions, no instructions are1337// required to cast between legal scalable vector types. However:1338// 1. Packed and unpacked types have different bit lengths, meaning BITCAST1339// is not universally useable.1340// 2. Most unpacked integer types are not legal and thus integer extends1341// cannot be used to convert between unpacked and packed types.1342// These can make "bitcasting" a multiphase process. REINTERPRET_CAST is used1343// to transition between unpacked and packed types of the same element type,1344// with BITCAST used otherwise.1345// This function does not handle predicate bitcasts.1346SDValue getSVESafeBitCast(EVT VT, SDValue Op, SelectionDAG &DAG) const;13471348// Returns the runtime value for PSTATE.SM by generating a call to1349// __arm_sme_state.1350SDValue getRuntimePStateSM(SelectionDAG &DAG, SDValue Chain, SDLoc DL,1351EVT VT) const;13521353bool preferScalarizeSplat(SDNode *N) const override;13541355unsigned getMinimumJumpTableEntries() const override;13561357bool softPromoteHalfType() const override { return true; }1358};13591360namespace AArch64 {1361FastISel *createFastISel(FunctionLoweringInfo &funcInfo,1362const TargetLibraryInfo *libInfo);1363} // end namespace AArch6413641365} // end namespace llvm13661367#endif136813691370