41 #include "AMDGPUGenCallingConv.inc"
153 for (
unsigned int x = 0; x < NumIntTypes; ++x) {
179 for (
unsigned int x = 0; x < NumFloatTypes; ++x) {
207 return ((LScalarSize <= CastScalarSize) ||
208 (CastScalarSize >= 32) ||
255 assert(0 &&
"Custom lowering code for this"
256 "instruction is not implemented yet!");
259 case ISD::SDIV:
return LowerSDIV(Op, DAG);
260 case ISD::SREM:
return LowerSREM(Op, DAG);
284 "Do not know what to do with an non-zero offset");
305 unsigned Count)
const {
307 for (
unsigned i = Start, e = Start + Count; i != e; ++i) {
320 ExtractVectorElements(A, DAG, Args, 0,
322 ExtractVectorElements(B, DAG, Args, 0,
326 &Args[0], Args.
size());
334 unsigned Start = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
335 ExtractVectorElements(Op.
getOperand(0), DAG, Args, Start,
339 &Args[0], Args.size());
360 unsigned IntrinsicID = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
364 switch (IntrinsicID) {
366 case AMDGPUIntrinsic::AMDIL_abs:
368 case AMDGPUIntrinsic::AMDIL_exp:
370 case AMDGPUIntrinsic::AMDGPU_lrp:
372 case AMDGPUIntrinsic::AMDIL_fraction:
374 case AMDGPUIntrinsic::AMDIL_max:
377 case AMDGPUIntrinsic::AMDGPU_imax:
380 case AMDGPUIntrinsic::AMDGPU_umax:
383 case AMDGPUIntrinsic::AMDIL_min:
386 case AMDGPUIntrinsic::AMDGPU_imin:
389 case AMDGPUIntrinsic::AMDGPU_umin:
392 case AMDGPUIntrinsic::AMDIL_round_nearest:
438 !((LHS == True && RHS == False) || (LHS == False && RHS == True))) {
456 assert(0 &&
"Operation should already be optimised !");
480 assert(0 &&
"Invalid setcc condcode !");
495 for (
unsigned i = 0, e = NumElts; i != e; ++i) {
497 DAG.
getConstant(i * (MemEltVT.getSizeInBits() / 8), PtrVT));
517 if (!MemVT.isVector() || MemBits > 32) {
527 unsigned MemNumElements = MemVT.getVectorNumElements();
541 for (
unsigned i = 0; i < MemNumElements; ++i) {
552 PackedValue = DAG.
getNode(
ISD::OR, DL, PackedVT, PackedValue, Elt);
572 for (
unsigned i = 0, e = NumElts; i != e; ++i) {
577 DAG.
getConstant(i * (MemEltVT.getSizeInBits() / 8),
588 SDValue Result = AMDGPUTargetLowering::MergeVectorStore(Op, DAG);
737 for (
unsigned i = 0, e = Ins.
size(); i < e; ++i) {
738 if (Ins[i].ArgVT == Ins[i].VT) {
744 if (Ins[i].ArgVT.isVector() && !Ins[i].VT.isVector()) {
746 VT = Ins[i].ArgVT.getVectorElementType();
747 }
else if (Ins[i].VT.
isVector() && Ins[i].ArgVT.isVector() &&
748 Ins[i].ArgVT.getVectorElementType() !=
749 Ins[i].VT.getVectorElementType()) {
758 Ins[i].OrigArgIndex, Ins[i].PartOffset);
765 return CFP->isExactlyValue(1.0);
768 return C->isAllOnesValue();
775 return CFP->getValueAPF().isZero();
778 return C->isNullValue();
785 unsigned Reg,
EVT VT)
const {
788 unsigned VirtualRegister;
798 #define NODE_NAME_CASE(node) case AMDGPUISD::node: return #node;
void push_back(const T &Elt)
SDValue getConstant(uint64_t Val, EVT VT, bool isTarget=false)
virtual int getFrameIndexOffset(const MachineFunction &MF, int FI) const
LLVMContext * getContext() const
AMDGPU specific subclass of TargetSubtarget.
void dump() const
dump - Dump this node, for debugging.
AMDGPUTargetLowering(TargetMachine &TM)
Address space for local memory.
void AnalyzeFormalArguments(CCState &State, const SmallVectorImpl< ISD::InputArg > &Ins) const
const TargetMachine & getTargetMachine() const
unsigned createVirtualRegister(const TargetRegisterClass *RegClass)
void addLiveIn(unsigned Reg, unsigned vreg=0)
SDValue LowerGlobalAddress(AMDGPUMachineFunction *MFI, SDValue Op, SelectionDAG &DAG) const
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
const GlobalValue * getGlobal() const
SDValue getSelectCC(SDLoc DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond)
unsigned getSizeInBits() const
const SDValue & getBasePtr() const
virtual SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, SDLoc DL, SelectionDAG &DAG) const
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
bool isVector() const
isVector - Return true if this is a vector value type.
SDValue getStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, bool isVolatile, bool isNonTemporal, unsigned Alignment, const MDNode *TBAAInfo=0)
int64_t getOffset() const
virtual bool isFNegFree(EVT VT) const
#define llvm_unreachable(msg)
MachineFunction & getMachineFunction() const
virtual SDValue CreateLiveInRegister(SelectionDAG &DAG, const TargetRegisterClass *RC, unsigned Reg, EVT VT) const
Helper function that adds Reg to the LiveIn list of the DAG's MachineFunction.
void addLoc(const CCValAssign &V)
unsigned getAddressSpace() const
SDValue LowerIntrinsicIABS(SDValue Op, SelectionDAG &DAG) const
IABS(a) = SMAX(sub(0, a), a)
EVT getScalarType() const
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
virtual MVT getPointerTy(uint32_t=0) const
ID
LLVM Calling Convention Representation.
Interface to describe a layout of a stack frame on a AMDIL target machine.
SDValue getConstantFP(double Val, EVT VT, bool isTarget=false)
EVT getVectorElementType() const
TargetRegisterInfo interface that is implemented by all hw codegen targets.
size_t array_lengthof(T(&)[N])
Find the length of an array.
bool isLiveIn(unsigned Reg) const
Simple integer binary arithmetic operators.
const SDValue & getBasePtr() const
EVT getMemoryVT() const
getMemoryVT - Return the type of the in-memory value.
bool isHWTrueValue(SDValue Op) const
SDNode * getNode() const
get the SDNode which holds the desired result
virtual bool isFAbsFree(EVT VT) const
const SDValue & getOperand(unsigned i) const
Simple binary floating point operators.
bool isNonTemporal() const
unsigned getLiveInVirtReg(unsigned PReg) const
virtual const char * getTargetNodeName(unsigned Opcode) const
This method returns the name of a target specific DAG node.
unsigned getOpcode() const
virtual bool isLoadBitCastBeneficial(EVT, EVT) const LLVM_OVERRIDE
const SDValue & getValue() const
void AddPromotedToType(unsigned Opc, MVT OrigVT, MVT DestVT)
SDValue LowerIntrinsicLRP(SDValue Op, SelectionDAG &DAG) const
virtual const TargetFrameLowering * getFrameLowering() const
bool isHWFalseValue(SDValue Op) const
void setLoadExtAction(unsigned ExtType, MVT VT, LegalizeAction Action)
SDValue SplitVectorStore(SDValue Op, SelectionDAG &DAG) const
unsigned LDSSize
Number of bytes in the LDS that are being used.
uint64_t getTypeAllocSize(Type *Ty) const
Interface definition of the TargetLowering class that is common to all AMD GPUs.
static bool allocateStack(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
SDValue getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, bool isVolatile, bool isNonTemporal, unsigned Alignment, const MDNode *TBAAInfo=0)
const SDValue & getChain() const
MachineMemOperand * getMemOperand() const
SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const
virtual unsigned getStackWidth(const MachineFunction &MF) const
virtual MVT getVectorIdxTy() const
ISD::LoadExtType getExtensionType() const
const Value * getValue() const
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT)
Address space for private memory.
std::map< const GlobalValue *, unsigned > LocalMemoryObjects
unsigned getAddressSpace() const
getAddressSpace - Return the address space for the associated pointer
Bitwise operators - logical and, logical or, logical xor.
MachineRegisterInfo & getRegInfo()
Information about the stack frame layout on the AMDGPU targets.
unsigned getSizeInBits() const
getSizeInBits - Return the size of the specified value type in bits.
virtual const DataLayout * getDataLayout() const
SDValue getTruncStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT TVT, bool isNonTemporal, bool isVolatile, unsigned Alignment, const MDNode *TBAAInfo=0)
#define NODE_NAME_CASE(node)
static CCValAssign getMem(unsigned ValNo, MVT ValVT, unsigned Offset, MVT LocVT, LocInfo HTP)
SDValue SplitVectorLoad(const SDValue &Op, SelectionDAG &DAG) const
Split a vector load into multiple scalar loads.
void getOriginalFunctionArgs(SelectionDAG &DAG, const Function *F, const SmallVectorImpl< ISD::InputArg > &Ins, SmallVectorImpl< ISD::InputArg > &OrigIns) const
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const
bool isFloatingPoint() const
isFloatingPoint - Return true if this is a FP, or a vector FP type.
SDValue getZExtOrTrunc(SDValue Op, SDLoc DL, EVT VT)
LLVM Value Representation.
SDValue getRegister(unsigned Reg, EVT VT)
Interface for the AMDGPU Implementation of the Intrinsic Info class.
SDValue getMergeValues(const SDValue *Ops, unsigned NumOps, SDLoc dl)
getMergeValues - Create a MERGE_VALUES node from the given operands.
unsigned getOrigAlign() const
const MCRegisterInfo & MRI
unsigned getAlignment() const
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
unsigned AllocateStack(unsigned Size, unsigned Align)
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD
SDValue LowerMinMax(SDValue Op, SelectionDAG &DAG) const
Generate Min/Max node.
unsigned getVectorNumElements() const