16#define GET_SDNODE_DESC
17#include "AArch64GenSDNodeInfo.inc"
22#define DEBUG_TYPE "aarch64-selectiondag-info"
26 cl::desc(
"Enable AArch64 SME memory operations "
27 "to lower to librt functions"),
40 switch (
N->getOpcode()) {
41 case AArch64ISD::SUBS:
48 case AArch64ISD::ADCS:
49 case AArch64ISD::SBCS:
53 case AArch64ISD::CSEL:
54 case AArch64ISD::CSINC:
55 case AArch64ISD::BRCOND:
58 case AArch64ISD::SADDWT:
59 case AArch64ISD::SADDWB:
60 case AArch64ISD::UADDWT:
61 case AArch64ISD::UADDWB: {
62 assert(
N->getNumValues() == 1 &&
"Expected one result!");
63 assert(
N->getNumOperands() == 2 &&
"Expected two operands!");
64 EVT VT =
N->getValueType(0);
65 EVT Op0VT =
N->getOperand(0).getValueType();
66 EVT Op1VT =
N->getOperand(1).getValueType();
69 "Expected integer vectors!");
71 "Expected result and first input to have the same type!");
73 "Expected vectors of equal size!");
75 "Expected result vector and first input vector to have half the "
76 "lanes of the second input vector!");
79 case AArch64ISD::SUNPKLO:
80 case AArch64ISD::SUNPKHI:
81 case AArch64ISD::UUNPKLO:
82 case AArch64ISD::UUNPKHI: {
83 assert(
N->getNumValues() == 1 &&
"Expected one result!");
84 assert(
N->getNumOperands() == 1 &&
"Expected one operand!");
85 EVT VT =
N->getValueType(0);
86 EVT OpVT =
N->getOperand(0).getValueType();
88 VT.
isInteger() &&
"Expected integer vectors!");
90 "Expected vectors of equal size!");
92 "Expected result vector with half the lanes of its input!");
95 case AArch64ISD::TRN1:
96 case AArch64ISD::TRN2:
97 case AArch64ISD::UZP1:
98 case AArch64ISD::UZP2:
99 case AArch64ISD::ZIP1:
100 case AArch64ISD::ZIP2: {
101 assert(
N->getNumValues() == 1 &&
"Expected one result!");
102 assert(
N->getNumOperands() == 2 &&
"Expected two operands!");
103 EVT VT =
N->getValueType(0);
104 EVT Op0VT =
N->getOperand(0).getValueType();
105 EVT Op1VT =
N->getOperand(1).getValueType();
107 "Expected vectors!");
108 assert(VT == Op0VT && VT == Op1VT &&
"Expected matching vectors!");
111 case AArch64ISD::RSHRNB_I: {
112 assert(
N->getNumValues() == 1 &&
"Expected one result!");
113 assert(
N->getNumOperands() == 2 &&
"Expected two operands!");
114 EVT VT =
N->getValueType(0);
115 EVT Op0VT =
N->getOperand(0).getValueType();
116 EVT Op1VT =
N->getOperand(1).getValueType();
118 "Expected integer vector result type!");
120 "Expected first operand to be an integer vector!");
122 "Expected vectors of equal size!");
124 "Expected input vector with half the lanes of its result!");
125 assert(Op1VT == MVT::i32 && isa<ConstantSDNode>(
N->getOperand(1)) &&
126 "Expected second operand to be a constant i32!");
143 if (
auto *
C = dyn_cast<ConstantSDNode>(
Size))
144 ConstSize =
C->getZExtValue();
146 const bool IsSet = Opcode == AArch64::MOPSMemorySetPseudo ||
147 Opcode == AArch64::MOPSMemorySetTaggingPseudo;
162 const EVT ResultTys[] = {MVT::i64, MVT::i64, MVT::Other};
168 const EVT ResultTys[] = {MVT::i64, MVT::i64, MVT::i64, MVT::Other};
188 RTLIB::Libcall NewLC;
190 case RTLIB::MEMCPY: {
191 NewLC = RTLIB::SC_MEMCPY;
195 case RTLIB::MEMMOVE: {
196 NewLC = RTLIB::SC_MEMMOVE;
200 case RTLIB::MEMSET: {
201 NewLC = RTLIB::SC_MEMSET;
217 TLI->getLibcallCallingConv(NewLC),
RetTy, Symbol, std::move(Args));
218 return TLI->LowerCallTo(CLI).second;
229 return EmitMOPS(AArch64::MOPSMemoryCopyPseudo, DAG,
DL, Chain, Dst, Src,
230 Size, Alignment, isVolatile, DstPtrInfo, SrcPtrInfo);
233 SMEAttrs Attrs = AFI->getSMEFnAttrs();
248 return EmitMOPS(AArch64::MOPSMemorySetPseudo, DAG, dl, Chain, Dst, Src,
249 Size, Alignment, isVolatile, DstPtrInfo,
253 SMEAttrs Attrs = AFI->getSMEFnAttrs();
268 return EmitMOPS(AArch64::MOPSMemoryMovePseudo, DAG, dl, Chain, Dst, Src,
269 Size, Alignment, isVolatile, DstPtrInfo, SrcPtrInfo);
272 SMEAttrs Attrs = AFI->getSMEFnAttrs();
286 unsigned ObjSizeScaled = ObjSize / 16;
290 int FI = cast<FrameIndexSDNode>(
Ptr)->getIndex();
297 const unsigned OpCode1 = ZeroData ? AArch64ISD::STZG : AArch64ISD::STG;
298 const unsigned OpCode2 = ZeroData ? AArch64ISD::STZ2G : AArch64ISD::ST2G;
301 unsigned OffsetScaled = 0;
302 while (OffsetScaled < ObjSizeScaled) {
303 if (ObjSizeScaled - OffsetScaled >= 2) {
308 {Chain, TagSrc, AddrNode},
316 if (ObjSizeScaled - OffsetScaled > 0) {
321 {Chain, TagSrc, AddrNode},
337 assert(ObjSize % 16 == 0);
343 bool UseSetTagRangeLoop =
345 if (!UseSetTagRangeLoop)
349 const EVT ResTys[] = {MVT::i64, MVT::i64, MVT::Other};
353 int FI = cast<FrameIndexSDNode>(
Addr)->getIndex();
355 Opcode = ZeroData ? AArch64::STZGloop : AArch64::STGloop;
357 Opcode = ZeroData ? AArch64::STZGloop_wback : AArch64::STGloop_wback;
constexpr MVT FlagsVT
Value type used for NZCV flags.
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static SDValue EmitUnrolledSetTag(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Ptr, uint64_t ObjSize, const MachineMemOperand *BaseMemOperand, bool ZeroData)
static cl::opt< bool > LowerToSMERoutines("aarch64-lower-to-sme-routines", cl::Hidden, cl::desc("Enable AArch64 SME memory operations " "to lower to librt functions"), cl::init(true))
static const int kSetTagLoopThreshold
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
AArch64FunctionInfo - This class is derived from MachineFunctionInfo and contains private AArch64-spe...
SDValue EmitMOPS(unsigned Opcode, SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue SrcOrValue, SDValue Size, Align Alignment, bool isVolatile, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const
SDValue EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVolatile, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const override
Emit target-specific code that performs a memmove.
SDValue EmitStreamingCompatibleMemLibCall(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, RTLIB::Libcall LC) const
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const override
Emit target-specific code that performs a memcpy.
void verifyTargetNode(const SelectionDAG &DAG, const SDNode *N) const override
Checks that the given target-specific node is valid. Aborts if it is not.
SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo) const override
Emit target-specific code that performs a memset.
SDValue EmitTargetCodeForSetTag(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2, MachinePointerInfo DstPtrInfo, bool ZeroData) const override
AArch64SelectionDAGInfo()
const AArch64TargetLowering * getTargetLowering() const override
LLVM_ABI IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
A description of a memory reference used in the backend.
@ MOVolatile
The memory access is volatile.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
An SDNode that represents everything that will be needed to construct a MachineInstr.
Class to represent pointers.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
EVT getValueType() const
Return the ValueType of the referenced return value.
SMEAttrs is a utility class to parse the SME ACLE attributes on functions.
Proxy class that targets should inherit from if they wish to use the generated node descriptions.
void verifyTargetNode(const SelectionDAG &DAG, const SDNode *N) const override
Checks that the given target-specific node is valid. Aborts if it is not.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
LLVM_ABI SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
LLVM_ABI MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s),...
LLVM_ABI SDValue getRegister(Register Reg, EVT VT)
LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, LocationSize Size=LocationSize::precise(0), const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
LLVM_ABI void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand * > NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
const DataLayout & getDataLayout() const
SDValue getTargetFrameIndex(int FI, EVT VT)
LLVM_ABI SDValue getMemBasePlusOffset(SDValue Base, TypeSize Offset, const SDLoc &DL, const SDNodeFlags Flags=SDNodeFlags())
Returns sum of the base pointer and offset.
LLVM_ABI SDValue getExternalSymbol(const char *Sym, EVT VT)
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
MachineFunction & getMachineFunction() const
LLVM_ABI SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
LLVMContext * getContext() const
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
std::vector< ArgListEntry > ArgListTy
static constexpr TypeSize getFixed(ScalarTy ExactSize)
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
@ C
The default llvm calling convention, compatible with C.
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
This struct is a compact representation of a valid (non-zero power of two) alignment.
ElementCount getVectorElementCount() const
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
bool isVector() const
Return true if this is a vector value type.
bool isInteger() const
Return true if this is an integer or a vector integer type.
This class contains a discriminated union of information about pointers in memory operands,...
This structure contains all information that is necessary for lowering calls.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
CallLoweringInfo & setChain(SDValue InChain)