55 if (RegResult == AMDGPU::NoRegister)
71 return allocateCCRegs(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State,
72 &AMDGPU::SGPR_64RegClass, 20);
91 return allocateCCRegs(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State,
92 &AMDGPU::VReg_64RegClass, 31);
98 return allocateCCRegs(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State,
99 &AMDGPU::VReg_128RegClass, 29);
103 return allocateCCRegs(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State,
104 &AMDGPU::VReg_256RegClass, 25);
109 return allocateCCRegs(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State,
110 &AMDGPU::VReg_512RegClass, 17);
118 #include "AMDGPUGenCallingConv.inc"
126 assert(StoreSize % 32 == 0 &&
"Store size not a multiple of 32");
136 EVT VT = N0.getValueType();
145 if (!(~RHSKnown.
Zero & ~LHSKnown.
Zero))
368 for (
MVT VT : ScalarIntVTs) {
439 for (
MVT VT : VectorIntTypes) {
484 for (
MVT VT : FloatVectorTypes) {
622 if (isa<MemSDNode>(N))
646 unsigned CostThreshold) {
652 unsigned NumMayIncreaseSize = 0;
661 if (++NumMayIncreaseSize > CostThreshold)
711 return (OldSize < 32);
725 return (LScalarSize < CastScalarSize) ||
726 (CastScalarSize >= 32);
784 return DestSize < SrcSize && DestSize % 32 == 0 ;
794 return SrcSize >= 32;
796 return DestSize < SrcSize && DestSize % 32 == 0;
804 return DestSize >= 32;
806 return SrcSize == 32 && DestSize == 64;
844 return CC_AMDGPU_Kernel;
853 return CC_AMDGPU_Func;
864 return CC_AMDGPU_Kernel;
870 return RetCC_SI_Shader;
873 return RetCC_AMDGPU_Func;
907 for (
unsigned i = 0, e = Ins.
size(); i != e; ++i) {
917 }
else if (NumRegs == 1) {
949 assert(MemoryBits % NumElements == 0);
953 MemoryBits / NumElements);
1013 FuncName =
G->getSymbol();
1015 FuncName =
G->getGlobal()->getName();
1018 Fn,
"unsupported call to function " + FuncName, CLI.
DL.
getDebugLoc());
1034 SDLoc(Op).getDebugLoc());
1046 "instruction is not implemented yet!");
1109 "Do not know what to do with an non-zero offset");
1120 Fn,
"unsupported initializer for address space",
SDLoc(Op).getDebugLoc());
1139 unsigned Start = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
1153 if (!(LHS == True && RHS == False) && !(LHS == False && RHS == True))
1221 std::pair<SDValue, SDValue>
1233 return std::make_pair(Lo, Hi);
1260 if (VT.getVectorNumElements() == 2)
1271 EVT LoMemVT, HiMemVT;
1276 std::tie(Lo, Hi) = DAG.
SplitVector(Op, SL, LoVT, HiVT);
1280 unsigned HiAlign =
MinAlign(BaseAlign, Size);
1283 Load->
getChain(), BasePtr, SrcValue, LoMemVT,
1289 HiPtr, SrcValue.getWithOffset(LoMemVT.getStoreSize()),
1305 EVT VT = Val.getValueType();
1318 EVT LoMemVT, HiMemVT;
1323 std::tie(Lo, Hi) = DAG.
SplitVector(Val, SL, LoVT, HiVT);
1333 unsigned HiAlign =
MinAlign(BaseAlign, Size);
1336 DAG.
getTruncStore(Chain, SL, Lo, BasePtr, SrcValue, LoMemVT, BaseAlign,
1358 if (LHSSignBits < 9)
1362 if (RHSSignBits < 9)
1366 unsigned SignBits =
std::min(LHSSignBits, RHSSignBits);
1367 unsigned DivBits = BitSize - SignBits;
1503 for (
unsigned i = 0; i < halfBitWidth; ++i) {
1504 const unsigned bitPos = halfBitWidth - i - 1;
1750 const unsigned FractBits = 52;
1751 const unsigned ExpBits = 11;
1780 const unsigned FractBits = 52;
2022 SrcIsZero, Bits32, NewCtlz);
2139 "operation should be legal");
2166 "operation should be legal");
2235 const unsigned ExpMask = 0x7ff;
2236 const unsigned ExpBiasf64 = 1023;
2237 const unsigned ExpBiasf16 = 15;
2381 for (
unsigned I = 0;
I < NElts; ++
I)
2418 APInt KnownZero, KnownOne;
2426 template <
typename IntTy>
2429 if (Width + Offset < 32) {
2431 IntTy Result =
static_cast<IntTy
>(Shl) >> (32 - Width);
2440 if (
MemSDNode *M = dyn_cast<MemSDNode>(U)) {
2441 if (M->isVolatile())
2459 if ((Size == 1 || Size == 2 || Size == 4) && !VT.
isVector())
2462 if (Size == 3 || (Size > 4 && (Size % 4 != 0)))
2608 EVT ExtVT = cast<VTSDNode>(N1)->getVT();
2613 if (SrcVT.
bitsGE(ExtVT)) {
2836 Mul =
getMul24(DAG, DL, N0, N1, Size,
false);
2840 Mul =
getMul24(DAG, DL, N0, N1, Size,
true);
2923 return C->isAllOnesValue();
2933 const SDLoc &DL)
const {
2973 return getFFBH_U32(DAG, CmpLHS, SL);
2981 return getFFBH_U32(DAG, CmpLHS, SL);
2999 return DAG.
getNode(Op, SL, VT, NewSelect);
3020 SDLoc(N), Cond, LHS, RHS);
3039 bool ShouldFoldNeg =
true;
3044 ShouldFoldNeg =
false;
3046 ShouldFoldNeg =
false;
3049 if (ShouldFoldNeg) {
3059 Cond, NewLHS, NewRHS);
3119 return C->isZero() && !
C->isNegative();
3390 uint64_t CVal =
C->getZExtValue();
3397 const APInt &Val =
C->getValueAPF().bitcastToAPInt();
3454 "Vector handling of BFE not implemented");
3459 uint32_t WidthVal = Width->getZExtValue() & 0x1f;
3472 if (OffsetVal == 0) {
3474 unsigned SignBits = Signed ? (32 - WidthVal + 1) : (32 - WidthVal);
3477 if (OpSignBits >= SignBits)
3497 return constantFoldBFE<int32_t>(DAG,
3498 CVal->getSExtValue(),
3504 return constantFoldBFE<uint32_t>(DAG,
3505 CVal->getZExtValue(),
3511 if ((OffsetVal + WidthVal) >= 32 &&
3515 BitsFrom, ShiftVal);
3521 OffsetVal + WidthVal);
3527 if (TLI.ShrinkDemandedConstant(BitsFrom, Demanded, TLO) ||
3528 TLI.SimplifyDemandedBits(BitsFrom, Demanded, Known, TLO)) {
3542 if (
const auto *CFP = dyn_cast<ConstantFPSDNode>(N->
getOperand(0))) {
3544 const APFloat &Val = CFP->getValueAPF();
3566 bool RawReg)
const {
3592 return ArgOffset + 4;
3597 #define NODE_NAME_CASE(node) case AMDGPUISD::node: return #node;
3714 int &RefinementSteps,
3715 bool &UseOneConstNR,
3716 bool Reciprocal)
const {
3720 RefinementSteps = 0;
3732 int &RefinementSteps)
const {
3741 RefinementSteps = 0;
3795 unsigned Depth)
const {
3808 return std::max(SignBits, Op0SignBits);
3813 return Width ? 32 - (Width->
getZExtValue() & 0x1f) : 1;
unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
This method can be implemented by targets that want to expose additional information about sign bits ...
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
Calling convention used for Mesa compute shaders.
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SDLoc &DL, SelectionDAG &DAG) const override
This hook must be implemented to lower outgoing return values, described by the Outs array...
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
SDValue getValue(unsigned R) const
void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified load with extension does not work with the specified type and indicate wh...
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
CombineLevel getDAGCombineLevel()
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV)
SDValue performLoadCombine(SDNode *N, DAGCombinerInfo &DCI) const
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
Flags getFlags() const
Return the raw flags of the source value,.
LLVMContext * getContext() const
static SDValue distributeOpThroughSelect(TargetLowering::DAGCombinerInfo &DCI, unsigned Op, const SDLoc &SL, SDValue Cond, SDValue N1, SDValue N2)
Diagnostic information for unsupported feature in backend.
AMDGPU specific subclass of TargetSubtarget.
uint64_t getZExtValue() const
Get zero extended value.
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
SDValue CombineTo(SDNode *N, ArrayRef< SDValue > To, bool AddTo=true)
SDValue scalarizeVectorStore(StoreSDNode *ST, SelectionDAG &DAG) const
void LowerUDIVREM64(SDValue Op, SelectionDAG &DAG, SmallVectorImpl< SDValue > &Results) const
static bool allocateVGPRTuple(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
bool shouldReduceLoadWidth(SDNode *Load, ISD::LoadExtType ExtType, EVT ExtVT) const override
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
unsigned getNumRegisters(LLVMContext &Context, EVT VT) const
Return the number of registers that this ValueType will eventually require.
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
SDValue getHiHalf64(SDValue Op, SelectionDAG &DAG) const
static bool isConstantFPZero(SDValue N)
const TargetMachine & getTargetMachine() const
SDValue performMulhuCombine(SDNode *N, DAGCombinerInfo &DCI) const
unsigned createVirtualRegister(const TargetRegisterClass *RegClass)
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
bool isCalledByLegalizer() const
void addLiveIn(unsigned Reg, unsigned vreg=0)
addLiveIn - Add the specified register as a live-in.
constexpr uint32_t Lo_32(uint64_t Value)
Return the low 32 bits of a 64 bit value.
virtual SDValue LowerGlobalAddress(AMDGPUMachineFunction *MFI, SDValue Op, SelectionDAG &DAG) const
Carry-setting nodes for multiple precision addition and subtraction.
bool isExtended() const
Test if the given EVT is extended (as opposed to being simple).
SDValue LowerFRINT(SDValue Op, SelectionDAG &DAG) const
This file describes how to lower LLVM calls to machine code calls.
SDValue LowerINT_TO_FP64(SDValue Op, SelectionDAG &DAG, bool Signed) const
SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) const
SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const
static CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg)
SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG) const
SDValue LowerCTLZ(SDValue Op, SelectionDAG &DAG) const
std::pair< EVT, EVT > GetSplitDestVTs(const EVT &VT) const
Compute the VTs needed for the low/hi parts of a type which is split (or expanded) into two not neces...
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
const GlobalValue * getGlobal() const
void setHasFloatingPointExceptions(bool FPExceptions=true)
Tells the code generator that this target supports floating point exceptions and cares about preservi...
AMDGPUAS getAMDGPUAS(const Module &M)
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change...
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
Function Alias Analysis Results
static CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg)
unsigned getNumOperands() const
Return the number of values used by this operation.
void setBooleanVectorContents(BooleanContent Ty)
Specify how the target extends the result of a vector boolean value from a vector of i1 to a wider ty...
const SDValue & getOperand(unsigned Num) const
Calling convention used for Mesa geometry shaders.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, SDValue RHS)
Helper function to make it easier to build Select's if you just have operands and don't want to check...
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
virtual bool allowsMisalignedMemoryAccesses(EVT, unsigned AddrSpace=0, unsigned Align=1, bool *=nullptr) const
Determine if the target supports unaligned memory accesses.
static APFloat getZero(const fltSemantics &Sem, bool Negative=false)
Factory for Positive and Negative Zero.
static SDValue extractF64Exponent(SDValue Hi, const SDLoc &SL, SelectionDAG &DAG)
SDValue getLoHalf64(SDValue Op, SelectionDAG &DAG) const
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT TVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
const MachinePointerInfo & getPointerInfo() const
SDValue LowerCall(CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower calls into the specified DAG.
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
SDValue scalarizeVectorLoad(LoadSDNode *LD, SelectionDAG &DAG) const
Turn load of vector type into a load of the individual elements.
SDValue performMulCombine(SDNode *N, DAGCombinerInfo &DCI) const
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
CLAMP value between 0.0 and 1.0.
const SDValue & getBasePtr() const
std::pair< SDValue, SDValue > split64BitValue(SDValue Op, SelectionDAG &DAG) const
Return 64-bit value Op as two 32-bit integers.
LLVMContext & getContext() const
bool hasFPExceptions() const
SDValue performSrlCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue splitBinaryBitConstantOpImpl(DAGCombinerInfo &DCI, const SDLoc &SL, unsigned Opc, SDValue LHS, uint32_t ValLo, uint32_t ValHi) const
Split the 64-bit value LHS into two 32-bit components, and perform the binary operation Opc to it wit...
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
static bool simplifyI24(SDNode *Node24, unsigned OpIdx, TargetLowering::DAGCombinerInfo &DCI)
SDValue LowerDIVREM24(SDValue Op, SelectionDAG &DAG, bool sign) const
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
static const unsigned LOCAL_ADDRESS
Address space for local memory.
bool storeOfVectorConstantIsCheap(EVT MemVT, unsigned NumElem, unsigned AS) const override
Return true if it is expected to be cheaper to do a store of a non-zero vector constant with the give...
bool isCheapToSpeculateCttz() const override
Return true if it is cheap to speculate a call to intrinsic cttz.
A convenience struct that encapsulates a DAG, and two SDValues for returning information from TargetL...
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
SDValue expandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG) const
Expands an unaligned store to 2 half-size stores for integer values, and possibly more for vectors...
bool isVector() const
Return true if this is a vector value type.
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
bool isNegative() const
Return true if the value is negative.
uint64_t allocateKernArg(uint64_t Size, unsigned Align)
SDValue LowerUDIVREM(SDValue Op, SelectionDAG &DAG) const
SDValue LowerFP_TO_UINT(SDValue Op, SelectionDAG &DAG) const
Pointer to the start of the shader's constant data.
int64_t getOffset() const
unsigned getABIArgOffset() const
SDValue performMulLoHi24Combine(SDNode *N, DAGCombinerInfo &DCI) const
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Shift and rotation operations.
bool isNormalStore(const SDNode *N)
Returns true if the specified node is a non-truncating and unindexed store.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
MachineFunction & getMachineFunction() const
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
CopyToReg - This node has three operands: a chain, a register number to set to this value...
void addLoc(const CCValAssign &V)
SDValue getRecipEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled, int &RefinementSteps) const override
Return a reciprocal estimate value for the input operand.
iterator begin() const
begin/end - Return all of the registers in this class.
unsigned getAddressSpace() const
Reg
All possible values of the reg field in the ModR/M byte.
MachinePointerInfo getWithOffset(int64_t O) const
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
static bool isI24(SDValue Op, SelectionDAG &DAG)
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
SDValue combineFMinMaxLegacy(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, SDValue True, SDValue False, SDValue CC, DAGCombinerInfo &DCI) const
Generate Min/Max node.
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
Indicate that the specified operation does not work with the specified type and indicate what to do a...
SDValue LowerFROUND32_16(SDValue Op, SelectionDAG &DAG) const
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
void setJumpIsExpensive(bool isExpensive=true)
Tells the code generator not to expand logic operations on comparison predicates into separate sequen...
SDValue LowerFROUND(SDValue Op, SelectionDAG &DAG) const
Interface to describe a layout of a stack frame on an AMDGPU target.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
This callback is invoked for operations that are unsupported by the target, which are registered to u...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool isInteger() const
Return true if this is an integer or a vector integer type.
Calling convention used for Mesa hull shaders.
INLINEASM - Represents an inline asm block.
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
bool getBoolValue() const
Convert APInt to a boolean value.
SmallVector< ISD::InputArg, 32 > Ins
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
TargetRegisterInfo interface that is implemented by all hw codegen targets.
MachineFunction & getMachineFunction() const
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
This callback is invoked when a node result type is illegal for the target, and the operation was reg...
SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign-extending or trunca...
static bool allocateCCRegs(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State, const TargetRegisterClass *RC, unsigned NumRegs)
bool isCheapToSpeculateCtlz() const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
const AMDGPUSubtarget * Subtarget
bool isLiveIn(unsigned Reg) const
SDValue performSelectCombine(SDNode *N, DAGCombinerInfo &DCI) const
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
Simple integer binary arithmetic operators.
static bool hasVolatileUser(SDNode *Val)
const SDValue & getBasePtr() const
EVT getHalfSizedIntegerVT(LLVMContext &Context) const
Finds the smallest simple value type that is greater than or equal to half the width of this EVT...
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
cmpResult
IEEE-754R 5.11: Floating Point Comparison Relations.
static mvt_range integer_vector_valuetypes()
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
static const fltSemantics & IEEEdouble() LLVM_READNONE
EVT getMemoryVT() const
Return the type of the in-memory value.
static SDValue getMul24(SelectionDAG &DAG, const SDLoc &SL, SDValue N0, SDValue N1, unsigned Size, bool Signed)
unsigned getBitWidth() const
Get the bit width of this value.
Generation getGeneration() const
const DataLayout & getDataLayout() const
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
This node is for VLIW targets and it is used to represent a vector that is stored in consecutive regi...
static LLVM_READNONE bool fnegFoldsIntoOp(unsigned Opc)
static CCValAssign getReg(unsigned ValNo, MVT ValVT, unsigned RegNo, MVT LocVT, LocInfo HTP)
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
static bool isCtlzOpc(unsigned Opc)
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
SDValue performAssertSZExtCombine(SDNode *N, DAGCombinerInfo &DCI) const
SPIR_KERNEL - Calling convention for SPIR kernel functions.
SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const
SDValue LowerFP_TO_FP16(SDValue Op, SelectionDAG &DAG) const
static SDValue constantFoldBFE(SelectionDAG &DAG, IntTy Src0, uint32_t Offset, uint32_t Width, const SDLoc &DL)
SDNode * getNode() const
get the SDNode which holds the desired result
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getScalarSizeInBits() const
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
SDValue LowerFCEIL(SDValue Op, SelectionDAG &DAG) const
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
SDValue LowerFREM(SDValue Op, SelectionDAG &DAG) const
Split a vector store into multiple scalar stores.
unsigned getStoreSizeInBits() const
Return the number of bits overwritten by a store of the specified value type.
bool isInteger() const
Return true if this is an integer or a vector integer type.
std::pair< SDValue, SDValue > expandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG) const
Expands an unaligned load to 2 half-size loads for an integer, and possibly more for vectors...
unsigned const MachineRegisterInfo * MRI
unsigned getVectorNumElements() const
SDValue performFNegCombine(SDNode *N, DAGCombinerInfo &DCI) const
const SDValue & getOperand(unsigned i) const
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Simple binary floating point operators.
void setTargetDAGCombine(ISD::NodeType NT)
Targets should invoke this method for each target independent node that they want to provide a custom...
SDValue performSraCombine(SDNode *N, DAGCombinerInfo &DCI) const
unsigned countMinLeadingZeros() const
Returns the minimum number of leading zero bits.
void resetAll()
Resets the known state of all bits.
SDValue performShlCombine(SDNode *N, DAGCombinerInfo &DCI) const
bool isVector() const
Return true if this is a vector value type.
const SDNodeFlags getFlags() const
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
bool isBeforeLegalizeOps() const
Carry-using nodes for multiple precision addition and subtraction.
unsigned getLiveInVirtReg(unsigned PReg) const
getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in physical ...
bool shouldCombineMemoryType(EVT VT) const
static unsigned inverseMinMax(unsigned Opc)
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
static bool hasDefinedInitializer(const GlobalValue *GV)
void AddToWorklist(SDNode *N)
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
SDValue performFAbsCombine(SDNode *N, DAGCombinerInfo &DCI) const
bool isBeforeLegalize() const
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
static bool allocateKernArg(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
unsigned getOpcode() const
TRAP - Trapping instruction.
static bool isOrEquivalentToAdd(SelectionDAG &DAG, SDValue Op)
bool hasFP32Denormals() const
static bool allocateSGPRTuple(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
bool isLoadBitCastBeneficial(EVT, EVT) const final
Return true if the following transform is beneficial: fold (conv (load x)) -> (load (conv*)x) On archi...
const SDValue & getValue() const
void AddPromotedToType(unsigned Opc, MVT OrigVT, MVT DestVT)
If Opc/OrigVT is specified as being promoted, the promotion code defaults to trying a larger integer/...
bool has16BitInsts() const
unsigned MaxStoresPerMemmove
Specify maximum bytes of store instructions per memmove call.
Bit counting operators with an undefined result for zero inputs.
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
const APFloat & getValueAPF() const
SDValue LowerFFLOOR(SDValue Op, SelectionDAG &DAG) const
Calling convention used for Mesa vertex shaders.
This structure contains all information that is necessary for lowering calls.
This class contains a discriminated union of information about pointers in memory operands...
bool isFPImmLegal(const APFloat &Imm, EVT VT) const override
Returns true if the target can instruction select the specified FP immediate natively.
unsigned GatherAllAliasesMaxDepth
Depth that GatherAllAliases should should continue looking for chain dependencies when trying to find...
SDValue LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands...
void print(raw_ostream &OS, const SelectionDAG *G=nullptr) const
static CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg)
Selects the correct CCAssignFn for a given CallingConvention value.
void setHasExtractBitsInsn(bool hasExtractInsn=true)
Tells the code generator that the target has BitExtract instructions.
SDValue LowerFNEARBYINT(SDValue Op, SelectionDAG &DAG) const
static LLVM_READONLY bool hasSourceMods(const SDNode *N)
SDValue SplitVectorStore(SDValue Op, SelectionDAG &DAG) const
Split a vector store into 2 stores of half the vector.
static bool isU24(SDValue Op, SelectionDAG &DAG)
TokenFactor - This node takes multiple tokens as input and produces a single token result...
SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const
CCState - This class holds information needed while lowering arguments and return values...
const DebugLoc & getDebugLoc() const
SDValue SplitVectorLoad(SDValue Op, SelectionDAG &DAG) const
Split a vector load into 2 loads of half the vector.
void computeKnownBits(SDValue Op, KnownBits &Known, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
bool isFAbsFree(EVT VT) const override
Return true if an fabs operation is free to the point where it is never worthwhile to replace it with...
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the vector with EXTRACT_SUBVECTOR using the provides VTs and return the low/high part...
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Interface definition of the TargetLowering class that is common to all AMD GPUs.
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...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Calling convention used for Mesa pixel shaders.
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
virtual EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const
Return the ValueType of the result of SETCC operations.
const SDValue & getChain() const
Byte Swap and Counting operators.
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
SDValue performCtlzCombine(const SDLoc &SL, SDValue Cond, SDValue LHS, SDValue RHS, DAGCombinerInfo &DCI) const
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
This is an abstract virtual class for memory operations.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
void setHasMultipleConditionRegisters(bool hasManyRegs=true)
Tells the code generator that the target has multiple (allocatable) condition registers that can be u...
void ExtractVectorElements(SDValue Op, SmallVectorImpl< SDValue > &Args, unsigned Start=0, unsigned Count=0)
Append the extracted elements from Start to Count out of the vector Op in Args.
Represents one node in the SelectionDAG.
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
SDValue LowerFTRUNC(SDValue Op, SelectionDAG &DAG) const
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
double BitsToDouble(uint64_t Bits)
This function takes a 64-bit integer and returns the bit equivalent double.
static mvt_range integer_valuetypes()
static bool allUsesHaveSourceMods(const SDNode *N, unsigned CostThreshold=4)
C - The default llvm calling convention, compatible with C.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT...
Class for arbitrary precision integers.
bool hasInitializer() const
Definitions have initializers, declarations don't.
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
iterator_range< use_iterator > uses()
Select(COND, TRUEVAL, FALSEVAL).
Interface for the AMDGPU Implementation of the Intrinsic Info class.
ZERO_EXTEND - Used for integer types, zeroing the new bits.
SDValue LowerINT_TO_FP32(SDValue Op, SelectionDAG &DAG, bool Signed) const
ANY_EXTEND - Used for integer types. The high bits are undefined.
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit)
Get a value with a block of bits set.
llvm_unreachable("Unknown RegBank!")
unsigned getAddressSpace() const
Return the address space for the associated pointer.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
static CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg)
bool isConstantValueOfAnyType(SDValue N)
SDValue LowerFP64_TO_INT(SDValue Op, SelectionDAG &DAG, bool Signed) const
BR_JT - Jumptable branch.
ConstantFPSDNode * isConstOrConstSplatFP(SDValue V)
Returns the SDNode if it is a constant splat BuildVector or constant float.
Represents a use of a SDNode.
Interface definition for SIInstrInfo.
Bitwise operators - logical and, logical or, logical xor.
bool isNarrowingProfitable(EVT VT1, EVT VT2) const override
Return true if it's profitable to narrow operations of type VT1 to VT2.
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
SelectSupportKind
Enum that describes what type of support for selects the target has.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
SDValue performMulhsCombine(SDNode *N, DAGCombinerInfo &DCI) const
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
static CCValAssign getCustomMem(unsigned ValNo, MVT ValVT, unsigned Offset, MVT LocVT, LocInfo HTP)
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
void ReplaceAllUsesWith(SDValue From, SDValue Op)
Modify anything using 'From' to use 'To' instead.
ArrayRef< SDUse > ops() const
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
bool isTruncateFree(EVT Src, EVT Dest) const override
AMDGPUTargetLowering(const TargetMachine &TM, const AMDGPUSubtarget &STI)
bool enableDX10Clamp() const
#define NODE_NAME_CASE(node)
Fast - This calling convention attempts to make calls as fast as possible (e.g.
void setLibcallName(RTLIB::Libcall Call, const char *Name)
Rename the default libcall routine name for the specified libcall.
void analyzeFormalArgumentsCompute(CCState &State, const SmallVectorImpl< ISD::InputArg > &Ins) const
The SelectionDAGBuilder will automatically promote function arguments with illegal types...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
SDValue performStoreCombine(SDNode *N, DAGCombinerInfo &DCI) const
unsigned MaxStoresPerMemcpy
Specify maximum bytes of store instructions per memcpy call.
static bool isNegativeOne(SDValue Val)
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
bool isFNegFree(EVT VT) const override
Return true if an fneg operation is free to the point where it is never worthwhile to replace it with...
EVT getValueType() const
Return the ValueType of the referenced return value.
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
EVT getPow2VectorType(LLVMContext &Context) const
Widens the length of the given vector EVT up to the nearest power of 2 and returns that type...
SDValue LowerFROUND64(SDValue Op, SelectionDAG &DAG) const
bool isByteSized() const
Return true if the bit size is a multiple of 8.
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
static LLVM_READONLY bool opMustUseVOP3Encoding(const SDNode *N, MVT VT)
returns true if the operation will definitely need to use a 64-bit encoding, and thus will use a VOP3...
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
SDValue CreateLiveInRegister(SelectionDAG &DAG, const TargetRegisterClass *RC, unsigned Reg, EVT VT, const SDLoc &SL, bool RawReg=false) const
Helper function that adds Reg to the LiveIn list of the DAG's MachineFunction.
constexpr uint32_t Hi_32(uint64_t Value)
Return the high 32 bits of a 64 bit value.
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
FMA - Perform a * b + c with no intermediate rounding step.
SDValue getRegister(unsigned Reg, EVT VT)
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond)
Helper function to make it easier to build SelectCC's if you just have an ISD::CondCode instead of an...
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
SDValue getValueType(EVT)
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits...
bool hasVOP3PInsts() const
const TargetLowering & getTargetLoweringInfo() const
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.Val alone...
static EVT getEquivalentMemType(LLVMContext &Context, EVT VT)
bool hasFminFmaxLegacy() const
cmpResult compare(const APFloat &RHS) const
Primary interface to the complete machine description for the target machine.
static SDValue foldFreeOpFromSelect(TargetLowering::DAGCombinerInfo &DCI, SDValue N)
bool hasBCNT(unsigned Size) const
bool isZExtFree(Type *Src, Type *Dest) const override
Return true if any actual instruction that defines a value of type FromTy implicitly zero-extends the...
StringRef - Represent a constant reference to a string, i.e.
FMAD - Perform a * b + c, while getting the same result as the separately rounded operations...
SetCC operator - This evaluates to a true value iff the condition is true.
uint32_t getImplicitParameterOffset(const AMDGPUMachineFunction *MFI, const ImplicitParameter Param) const
Helper function that returns the byte offset of the given type of implicit parameter.
unsigned MaxStoresPerMemset
Specify maximum number of store instructions per memset call.
unsigned getOrigAlign() const
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, SelectionDAG &DAG) const
bool aggressivelyPreferBuildVectorSources(EVT VecVT) const override
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
SDValue LowerSDIVREM(SDValue Op, SelectionDAG &DAG) const
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT SrcTy)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value...
TRUNCATE - Completely drop the high bits.
unsigned getAlignment() const
unsigned AllocateReg(unsigned Reg)
AllocateReg - Attempt to allocate one register.
bool ShouldShrinkFPConstant(EVT VT) const override
If true, then instruction selection should seek to shrink the FP constant of the specified type to a ...
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
Calling convention for AMDGPU code object kernels.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
bool SimplifyDemandedBits(SDNode *User, unsigned OpIdx, const APInt &Demanded, DAGCombinerInfo &DCI, TargetLoweringOpt &TLO) const
Helper for SimplifyDemandedBits that can simplify an operation with multiple uses.
const fltSemantics & getSemantics() const
MVT getVectorIdxTy(const DataLayout &) const override
Returns the type to be used for the index operand of: ISD::INSERT_VECTOR_ELT, ISD::EXTRACT_VECTOR_ELT...
SDValue getSqrtEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled, int &RefinementSteps, bool &UseOneConstNR, bool Reciprocal) const override
Hooks for building estimates in place of slower divisions and square roots.
bool PredictableSelectIsExpensive
Tells the code generator that select is more expensive than a branch if the branch is usually predict...
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
bool mayIgnoreSignedZero(SDValue Op) const
void CommitTargetLoweringOpt(const TargetLoweringOpt &TLO)
bool isSelectSupported(SelectSupportKind) const override
uint64_t getZExtValue() const
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
unsigned getAlignmentForImplicitArgPtr() const
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
SDValue performClampCombine(SDNode *N, DAGCombinerInfo &DCI) const
This class is used to represent ISD::LOAD nodes.
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...