14 #if defined(_MSC_VER) || defined(__MINGW32__) 16 #define _USE_MATH_DEFINES 89 #define DEBUG_TYPE "si-lower" 91 STATISTIC(NumTailCalls,
"Number of tail calls");
94 "amdgpu-disable-loop-alignment",
95 cl::desc(
"Do not align and prefetch loops"),
109 unsigned NumSGPRs = AMDGPU::SGPR_32RegClass.getNumRegs();
112 return AMDGPU::SGPR0 +
Reg;
384 if (!Subtarget->
hasBFI()) {
781 EVT DestVT,
EVT SrcVT)
const {
833 return NumElts * ((Size + 31) / 32);
836 return (NumElts + 1) / 2;
845 EVT VT,
EVT &IntermediateVT,
846 unsigned &NumIntermediates,
MVT &RegisterVT)
const {
853 IntermediateVT = RegisterVT;
854 NumIntermediates = NumElts;
855 return NumIntermediates;
860 IntermediateVT = RegisterVT;
861 NumIntermediates = NumElts * ((Size + 31) / 32);
862 return NumIntermediates;
870 IntermediateVT = RegisterVT;
871 NumIntermediates = (NumElts + 1) / 2;
872 return NumIntermediates;
877 Context, CC, VT, IntermediateVT, NumIntermediates, RegisterVT);
885 Type *ElementType =
nullptr;
899 unsigned Pow2Elts = 0;
900 unsigned ElementSize;
901 switch (ElementType->getTypeID()) {
905 ElementSize = cast<IntegerType>(ElementType)->
getBitWidth();
914 unsigned AdditionalElts = ElementSize == 16 ? 2 : 1;
924 unsigned IntrID)
const {
934 if (RsrcIntr->IsImage) {
974 case Intrinsic::amdgcn_atomic_inc:
975 case Intrinsic::amdgcn_atomic_dec:
976 case Intrinsic::amdgcn_ds_ordered_add:
977 case Intrinsic::amdgcn_ds_ordered_swap:
978 case Intrinsic::amdgcn_ds_fadd:
979 case Intrinsic::amdgcn_ds_fmin:
980 case Intrinsic::amdgcn_ds_fmax: {
993 case Intrinsic::amdgcn_buffer_atomic_fadd: {
1005 if (!Vol || !Vol->
isZero())
1010 case Intrinsic::amdgcn_global_atomic_fadd: {
1020 case Intrinsic::amdgcn_ds_append:
1021 case Intrinsic::amdgcn_ds_consume: {
1034 case Intrinsic::amdgcn_ds_gws_init:
1035 case Intrinsic::amdgcn_ds_gws_barrier:
1036 case Intrinsic::amdgcn_ds_gws_sema_v:
1037 case Intrinsic::amdgcn_ds_gws_sema_br:
1038 case Intrinsic::amdgcn_ds_gws_sema_p:
1039 case Intrinsic::amdgcn_ds_gws_sema_release_all: {
1052 if (IntrID == Intrinsic::amdgcn_ds_gws_barrier)
1063 Type *&AccessTy)
const {
1065 case Intrinsic::amdgcn_atomic_inc:
1066 case Intrinsic::amdgcn_atomic_dec:
1067 case Intrinsic::amdgcn_ds_ordered_add:
1068 case Intrinsic::amdgcn_ds_ordered_swap:
1069 case Intrinsic::amdgcn_ds_fadd:
1070 case Intrinsic::amdgcn_ds_fmin:
1071 case Intrinsic::amdgcn_ds_fmax: {
1082 bool SITargetLowering::isLegalFlatAddressingMode(
const AddrMode &AM)
const {
1089 return AM.
Scale == 0 &&
1097 return AM.
Scale == 0 &&
1112 return isLegalFlatAddressingMode(AM);
1115 return isLegalMUBUFAddressingMode(AM);
1118 bool SITargetLowering::isLegalMUBUFAddressingMode(
const AddrMode &AM)
const {
1170 return isLegalMUBUFAddressingMode(AM);
1204 return isLegalMUBUFAddressingMode(AM);
1228 return isLegalFlatAddressingMode(AM);
1248 unsigned Size,
unsigned AddrSpace,
unsigned Align,
1258 bool AlignedBy4 = (Align % 4 == 0);
1260 *IsFast = AlignedBy4;
1271 bool AlignedBy4 = Align >= 4;
1273 *IsFast = AlignedBy4;
1284 (Align % 4 == 0) :
true;
1300 return Size >= 32 && Align >= 4;
1305 bool *IsFast)
const {
1319 Align, Flags, IsFast);
1323 uint64_t
Size,
unsigned DstAlign,
unsigned SrcAlign,
bool IsMemset,
1324 bool ZeroMemset,
bool MemcpyStrSrc,
1331 if (Size >= 16 && DstAlign >= 4)
1334 if (Size >= 8 && DstAlign >= 4)
1342 unsigned DestAS)
const {
1347 const MemSDNode *MemNode = cast<MemSDNode>(
N);
1349 const Instruction *
I = dyn_cast_or_null<Instruction>(Ptr);
1354 unsigned DestAS)
const {
1364 const MemSDNode *MemNode = cast<MemSDNode>(
N);
1420 std::tie(InputPtrReg, RC)
1432 const SDLoc &SL)
const {
1460 Val = getFPExtOrFPTrunc(DAG, Val, SL, VT);
1469 SDValue SITargetLowering::lowerKernargMemParameter(
1472 uint64_t Offset,
unsigned Align,
bool Signed,
1481 int64_t AlignDownOffset =
alignDown(Offset, 4);
1482 int64_t OffsetDiff = Offset - AlignDownOffset;
1488 SDValue Ptr = lowerKernArgParameterPtr(DAG, SL, Chain, AlignDownOffset);
1498 ArgVal = convertArgType(DAG, VT, MemVT, SL, ArgVal, Signed, Arg);
1504 SDValue Ptr = lowerKernArgParameterPtr(DAG, SL, Chain, Offset);
1509 SDValue Val = convertArgType(DAG, VT, MemVT, SL, Load, Signed, Arg);
1556 ExtType, SL, VA.
getLocVT(), Chain, FIN,
1579 for (
unsigned I = 0,
E = Ins.
size(), PSInputNum = 0;
I !=
E; ++
I) {
1583 "vector type argument should have been split");
1597 "unexpected vector split in ps argument type");
1667 if (RegIdx == ArgVGPRs.
size()) {
1674 unsigned Reg = ArgVGPRs[RegIdx];
1676 assert(Reg != AMDGPU::NoRegister);
1686 unsigned NumArgRegs) {
1689 if (RegIdx == ArgSGPRs.
size())
1692 unsigned Reg = ArgSGPRs[RegIdx];
1694 assert(Reg != AMDGPU::NoRegister);
1713 const unsigned Mask = 0x3ff;
1773 MF.
addLiveIn(ImplicitBufferPtrReg, &AMDGPU::SGPR_64RegClass);
1780 MF.
addLiveIn(PrivateSegmentBufferReg, &AMDGPU::SGPR_128RegClass);
1786 MF.
addLiveIn(DispatchPtrReg, &AMDGPU::SGPR_64RegClass);
1792 MF.
addLiveIn(QueuePtrReg, &AMDGPU::SGPR_64RegClass);
1807 MF.
addLiveIn(DispatchIDReg, &AMDGPU::SGPR_64RegClass);
1813 MF.
addLiveIn(FlatScratchInitReg, &AMDGPU::SGPR_64RegClass);
1826 bool IsShader)
const {
1829 MF.
addLiveIn(Reg, &AMDGPU::SGPR_32RegClass);
1835 MF.
addLiveIn(Reg, &AMDGPU::SGPR_32RegClass);
1841 MF.
addLiveIn(Reg, &AMDGPU::SGPR_32RegClass);
1847 MF.
addLiveIn(Reg, &AMDGPU::SGPR_32RegClass);
1853 unsigned PrivateSegmentWaveByteOffsetReg;
1856 PrivateSegmentWaveByteOffsetReg =
1861 if (PrivateSegmentWaveByteOffsetReg == AMDGPU::NoRegister) {
1868 MF.
addLiveIn(PrivateSegmentWaveByteOffsetReg, &AMDGPU::SGPR_32RegClass);
1869 CCInfo.
AllocateReg(PrivateSegmentWaveByteOffsetReg);
1885 if (HasStackObjects)
1891 HasStackObjects =
true;
1895 bool RequiresStackAccess = HasStackObjects || MFI.
hasCalls();
1928 if (!MRI.
isLiveIn(AMDGPU::SGPR32)) {
1936 for (
unsigned Reg : AMDGPU::SGPR_32RegClass) {
1951 unsigned ReservedOffsetReg =
1956 }
else if (RequiresStackAccess) {
1975 unsigned ReservedOffsetReg
2006 if (AMDGPU::SReg_64RegClass.
contains(*
I))
2007 RC = &AMDGPU::SGPR_64RegClass;
2008 else if (AMDGPU::SReg_32RegClass.
contains(*
I))
2009 RC = &AMDGPU::SGPR_32RegClass;
2020 for (
auto *Exit : Exits)
2022 TII->
get(TargetOpcode::COPY), *
I)
2040 Fn,
"unsupported non-compute shaders with HSA", DL.
getDebugLoc());
2090 if ((PsInputBits & 0x7F) == 0 ||
2091 ((PsInputBits & 0xF) == 0 &&
2092 (PsInputBits >> 11 & 1)))
2104 }
else if (IsKernel) {
2129 const unsigned KernelArgBaseAlign = 16;
2131 for (
unsigned i = 0,
e = Ins.
size(), ArgIdx = 0; i !=
e; ++i) {
2141 if (IsEntryFunc && VA.
isMemLoc()) {
2146 unsigned Align =
MinAlign(KernelArgBaseAlign, Offset);
2148 SDValue Arg = lowerKernargMemParameter(
2149 DAG, VT, MemVT, DL, Chain, Offset, Align, Ins[i].Flags.isSExt(), &Ins[i]);
2166 }
else if (!IsEntryFunc && VA.
isMemLoc()) {
2167 SDValue Val = lowerStackParameter(DAG, VA, DL, Chain, Arg);
2239 auto &ArgUsageInfo =
2246 return Chains.
empty() ? Chain :
2264 CCState CCInfo(CallConv, IsVarArg, MF, RVLocs, Context);
2312 DAG.
getCopyToReg(Chain, DL, ReturnAddrVirtualReg, ReturnAddrReg, Flag);
2318 for (
unsigned I = 0, RealRVLocIdx = 0,
E = RVLocs.
size();
I !=
E;
2319 ++
I, ++RealRVLocIdx) {
2323 SDValue Arg = OutVals[RealRVLocIdx];
2357 if (AMDGPU::SReg_64RegClass.
contains(*I))
2359 else if (AMDGPU::SReg_32RegClass.
contains(*I))
2392 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
2456 auto &ArgUsageInfo =
2459 = ArgUsageInfo.lookupFuncArgInfo(*CalleeFunc);
2477 for (
auto InputID : InputRegs) {
2481 std::tie(OutgoingArg, ArgRC) = CalleeArgInfo.getPreloadedValue(InputID);
2487 std::tie(IncomingArg, IncomingArgRC)
2489 assert(IncomingArgRC == ArgRC);
2500 assert(InputID == AMDGPUFunctionArgInfo::IMPLICIT_ARG_PTR);
2501 InputReg = getImplicitArgPtr(DAG, DL);
2505 RegsToPass.emplace_back(OutgoingArg->
getRegister(), InputReg);
2519 std::tie(OutgoingArg, ArgRC) =
2522 std::tie(OutgoingArg, ArgRC) =
2525 std::tie(OutgoingArg, ArgRC) =
2541 if (IncomingArgX && !IncomingArgX->
isMasked() && CalleeArgInfo.WorkItemIDX)
2544 if (IncomingArgY && !IncomingArgY->
isMasked() && CalleeArgInfo.WorkItemIDY) {
2548 InputReg = InputReg.
getNode() ?
2552 if (IncomingArgZ && !IncomingArgZ->
isMasked() && CalleeArgInfo.WorkItemIDZ) {
2556 InputReg = InputReg.
getNode() ?
2564 IncomingArgX ? *IncomingArgX :
2565 IncomingArgY ? *IncomingArgY :
2566 *IncomingArgZ, ~0u);
2571 RegsToPass.emplace_back(OutgoingArg->
getRegister(), InputReg);
2610 if (!CallerPreserved)
2613 bool CCMatch = CallerCC == CalleeCC;
2626 if (Arg.hasByValAttr())
2641 if (!TRI->regmaskSubsetEqual(CallerPreserved, CalleePreserved))
2650 CCState CCInfo(CalleeCC, IsVarArg, MF, ArgLocs, Ctx);
2688 bool IsSibCall =
false;
2689 bool IsThisReturn =
false;
2694 for (
unsigned I = 0,
E = CLI.
Ins.size();
I !=
E; ++
I)
2703 "unsupported call to variadic function ");
2711 "unsupported indirect call to function ");
2716 "unsupported required tail call to function ");
2723 "unsupported call from graphics shader of function ");
2728 Callee, CallConv, IsVarArg, Outs, OutVals, Ins, DAG);
2731 "site marked musttail");
2738 if (!TailCallOpt && IsTailCall)
2782 RegsToPass.
emplace_back(AMDGPU::SGPR0_SGPR1_SGPR2_SGPR3, ScratchRSrcReg);
2791 for (
unsigned i = 0,
e = ArgLocs.size(); i !=
e; ++i) {
2827 int32_t Offset = LocMemOffset;
2834 unsigned OpSize = Flags.
isByVal() ?
2843 Offset = Offset + FPDiff;
2864 if (Outs[i].Flags.isByVal()) {
2868 Chain, DL, DstAddr, Arg, SizeNode, Outs[i].Flags.getByValAlign(),
2876 Alignment ? Alignment->value() : 0);
2885 if (!MemOpChains.
empty())
2891 for (
auto &RegToPass : RegsToPass) {
2893 RegToPass.second, InFlag);
2909 Chain = DAG.
getCopyToReg(Chain, DL, PhysReturnAddrReg, ReturnAddrReg, InFlag);
2917 if (IsTailCall && !IsSibCall) {
2925 std::vector<SDValue> Ops;
2926 Ops.push_back(Chain);
2927 Ops.push_back(Callee);
2940 Ops.push_back(PhysReturnAddrReg);
2945 for (
auto &RegToPass : RegsToPass) {
2947 RegToPass.second.getValueType()));
2954 assert(Mask &&
"Missing call preserved mask for calling convention");
2958 Ops.push_back(InFlag);
2974 uint64_t CalleePopBytes = NumBytes;
2983 return LowerCallResult(Chain, InFlag, CallConv, IsVarArg, Ins, DL, DAG,
2984 InVals, IsThisReturn,
2985 IsThisReturn ? OutVals[0] :
SDValue());
2991 .Case(
"m0", AMDGPU::M0)
2992 .
Case(
"exec", AMDGPU::EXEC)
2993 .
Case(
"exec_lo", AMDGPU::EXEC_LO)
2994 .
Case(
"exec_hi", AMDGPU::EXEC_HI)
2995 .
Case(
"flat_scratch", AMDGPU::FLAT_SCR)
2996 .
Case(
"flat_scratch_lo", AMDGPU::FLAT_SCR_LO)
2997 .
Case(
"flat_scratch_hi", AMDGPU::FLAT_SCR_HI)
3000 if (Reg == AMDGPU::NoRegister) {
3009 +
StringRef(RegName) +
"\" for subtarget."));
3014 case AMDGPU::EXEC_LO:
3015 case AMDGPU::EXEC_HI:
3016 case AMDGPU::FLAT_SCR_LO:
3017 case AMDGPU::FLAT_SCR_HI:
3022 case AMDGPU::FLAT_SCR:
3043 if (SplitPoint == BB->
end()) {
3068 static std::pair<MachineBasicBlock *, MachineBasicBlock *>
3080 MF->
insert(MBBI, LoopBB);
3081 MF->
insert(MBBI, RemainderBB);
3090 auto Next = std::next(I);
3096 RemainderBB->
splice(RemainderBB->
begin(), &MBB, Next, MBB.
end());
3103 return std::make_pair(LoopBB, RemainderBB);
3111 auto E = std::next(
I);
3133 Src->setIsKill(
false);
3143 BuildMI(*LoopBB, LoopBB->
begin(), DL, TII->get(AMDGPU::S_SETREG_IMM32_B32))
3152 BuildMI(*LoopBB, I, DL, TII->get(AMDGPU::S_GETREG_B32),
Reg)
3153 .addImm(EncodedReg);
3156 BuildMI(*LoopBB, I, DL, TII->get(AMDGPU::S_CMP_LG_U32))
3159 BuildMI(*LoopBB, I, DL, TII->get(AMDGPU::S_CBRANCH_SCC1))
3180 unsigned InitSaveExecReg,
3183 bool IsIndirectSrc) {
3195 BuildMI(LoopBB, I, DL, TII->get(TargetOpcode::PHI), PhiReg)
3201 BuildMI(LoopBB, I, DL, TII->get(TargetOpcode::PHI), PhiExec)
3202 .addReg(InitSaveExecReg)
3208 BuildMI(LoopBB, I, DL, TII->get(AMDGPU::V_READFIRSTLANE_B32), CurrentIdxReg)
3212 BuildMI(LoopBB, I, DL, TII->get(AMDGPU::V_CMP_EQ_U32_e64), CondReg)
3213 .addReg(CurrentIdxReg)
3217 BuildMI(LoopBB, I, DL, TII->get(ST.
isWave32() ? AMDGPU::S_AND_SAVEEXEC_B32
3218 : AMDGPU::S_AND_SAVEEXEC_B64),
3224 if (UseGPRIdxMode) {
3227 IdxReg = CurrentIdxReg;
3230 BuildMI(LoopBB, I, DL, TII->get(AMDGPU::S_ADD_I32), IdxReg)
3234 unsigned IdxMode = IsIndirectSrc ?
3237 BuildMI(LoopBB, I, DL, TII->get(AMDGPU::S_SET_GPR_IDX_ON))
3244 BuildMI(LoopBB, I, DL, TII->get(AMDGPU::S_MOV_B32), AMDGPU::M0)
3247 BuildMI(LoopBB, I, DL, TII->get(AMDGPU::S_ADD_I32), AMDGPU::M0)
3254 unsigned Exec = ST.
isWave32() ? AMDGPU::EXEC_LO : AMDGPU::EXEC;
3256 BuildMI(LoopBB, I, DL, TII->get(ST.
isWave32() ? AMDGPU::S_XOR_B32_term
3257 : AMDGPU::S_XOR_B64_term), Exec)
3265 BuildMI(LoopBB, I, DL, TII->get(AMDGPU::S_CBRANCH_EXECNZ))
3279 unsigned InitResultReg,
3283 bool IsIndirectSrc) {
3291 const auto *BoolXExecRC = TRI->getRegClass(AMDGPU::SReg_1_XEXECRegClassID);
3295 unsigned Exec = ST.
isWave32() ? AMDGPU::EXEC_LO : AMDGPU::EXEC;
3296 unsigned MovExecOpc = ST.
isWave32() ? AMDGPU::S_MOV_B32 : AMDGPU::S_MOV_B64;
3298 BuildMI(MBB, I, DL, TII->get(TargetOpcode::IMPLICIT_DEF), TmpExec);
3301 BuildMI(MBB, I, DL, TII->get(MovExecOpc), SaveExec)
3311 InitResultReg, DstReg, PhiReg, TmpExec,
3312 Offset, UseGPRIdxMode, IsIndirectSrc);
3315 BuildMI(*RemainderBB, First, DL, TII->get(MovExecOpc), Exec)
3322 static std::pair<unsigned, int>
3327 int NumElts = TRI.getRegSizeInBits(*SuperRC) / 32;
3331 if (Offset >= NumElts || Offset < 0)
3332 return std::make_pair(AMDGPU::sub0, Offset);
3334 return std::make_pair(AMDGPU::sub0 + Offset, 0);
3343 bool IsIndirectSrc) {
3356 if (UseGPRIdxMode) {
3357 unsigned IdxMode = IsIndirectSrc ?
3361 BuildMI(*MBB, I, DL, TII->get(AMDGPU::S_SET_GPR_IDX_ON))
3368 BuildMI(*MBB, I, DL, TII->get(AMDGPU::S_ADD_I32), Tmp)
3372 BuildMI(*MBB, I, DL, TII->get(AMDGPU::S_SET_GPR_IDX_ON))
3383 BuildMI(*MBB, I, DL, TII->get(AMDGPU::S_MOV_B32), AMDGPU::M0)
3386 BuildMI(*MBB, I, DL, TII->get(AMDGPU::S_ADD_I32), AMDGPU::M0)
3410 std::tie(SubReg, Offset)
3419 if (UseGPRIdxMode) {
3423 BuildMI(MBB, I, DL, TII->get(AMDGPU::V_MOV_B32_e32), Dst)
3427 BuildMI(MBB, I, DL, TII->get(AMDGPU::S_SET_GPR_IDX_OFF));
3429 BuildMI(MBB, I, DL, TII->get(AMDGPU::V_MOVRELS_B32_e32), Dst)
3445 BuildMI(MBB, I, DL, TII->get(TargetOpcode::IMPLICIT_DEF), InitReg);
3448 Offset, UseGPRIdxMode,
true);
3451 if (UseGPRIdxMode) {
3452 BuildMI(*LoopBB, InsPt, DL, TII->get(AMDGPU::V_MOV_B32_e32), Dst)
3456 BuildMI(*LoopBB, InsPt, DL, TII->get(AMDGPU::S_SET_GPR_IDX_OFF));
3458 BuildMI(*LoopBB, InsPt, DL, TII->get(AMDGPU::V_MOVRELS_B32_e32), Dst)
3470 switch (TRI.getRegSizeInBits(*VecRC)) {
3472 return AMDGPU::V_MOVRELD_B32_V1;
3474 return AMDGPU::V_MOVRELD_B32_V2;
3476 return AMDGPU::V_MOVRELD_B32_V4;
3478 return AMDGPU::V_MOVRELD_B32_V8;
3480 return AMDGPU::V_MOVRELD_B32_V16;
3510 if (Idx->
getReg() == AMDGPU::NoRegister) {
3516 BuildMI(MBB, I, DL, TII->get(TargetOpcode::INSERT_SUBREG), Dst)
3529 if (UseGPRIdxMode) {
3530 BuildMI(MBB, I, DL, TII->get(AMDGPU::V_MOV_B32_indirect))
3537 BuildMI(MBB, I, DL, TII->get(AMDGPU::S_SET_GPR_IDX_OFF));
3541 BuildMI(MBB, I, DL, MovRelDesc)
3545 .addImm(SubReg - AMDGPU::sub0);
3560 Offset, UseGPRIdxMode,
false);
3563 if (UseGPRIdxMode) {
3564 BuildMI(*LoopBB, InsPt, DL, TII->get(AMDGPU::V_MOV_B32_indirect))
3570 BuildMI(*LoopBB, InsPt, DL, TII->get(AMDGPU::S_SET_GPR_IDX_OFF));
3574 BuildMI(*LoopBB, InsPt, DL, MovRelDesc)
3578 .
addImm(SubReg - AMDGPU::sub0);
3604 case AMDGPU::S_ADD_U64_PSEUDO:
3605 case AMDGPU::S_SUB_U64_PSEUDO: {
3620 Src0, BoolRC, AMDGPU::sub0,
3621 &AMDGPU::SReg_32RegClass);
3623 Src0, BoolRC, AMDGPU::sub1,
3624 &AMDGPU::SReg_32RegClass);
3627 Src1, BoolRC, AMDGPU::sub0,
3628 &AMDGPU::SReg_32RegClass);
3630 Src1, BoolRC, AMDGPU::sub1,
3631 &AMDGPU::SReg_32RegClass);
3633 bool IsAdd = (MI.
getOpcode() == AMDGPU::S_ADD_U64_PSEUDO);
3635 unsigned LoOpc = IsAdd ? AMDGPU::S_ADD_U32 : AMDGPU::S_SUB_U32;
3636 unsigned HiOpc = IsAdd ? AMDGPU::S_ADDC_U32 : AMDGPU::S_SUBB_U32;
3637 BuildMI(*BB, MI, DL, TII->get(LoOpc), DestSub0)
3640 BuildMI(*BB, MI, DL, TII->get(HiOpc), DestSub1)
3643 BuildMI(*BB, MI, DL, TII->get(TargetOpcode::REG_SEQUENCE), Dest.
getReg())
3651 case AMDGPU::SI_INIT_M0: {
3653 TII->get(AMDGPU::S_MOV_B32), AMDGPU::M0)
3658 case AMDGPU::SI_INIT_EXEC:
3666 case AMDGPU::SI_INIT_EXEC_LO:
3674 case AMDGPU::SI_INIT_EXEC_FROM_INPUT: {
3690 if (
I->getOpcode() != TargetOpcode::COPY ||
3691 I->getOperand(0).getReg() != InputReg)
3695 FirstMI = &*++BB->
begin();
3697 I->removeFromParent();
3709 unsigned Exec = isWave32 ? AMDGPU::EXEC_LO : AMDGPU::EXEC;
3710 BuildMI(*BB, FirstMI,
DebugLoc(), TII->get(AMDGPU::S_BFE_U32), CountReg)
3714 TII->get(isWave32 ? AMDGPU::S_BFM_B32 : AMDGPU::S_BFM_B64),
3722 TII->get(isWave32 ? AMDGPU::S_CMOV_B32 : AMDGPU::S_CMOV_B64),
3729 case AMDGPU::GET_GROUPSTATICSIZE: {
3733 BuildMI(*BB, MI, DL, TII->get(AMDGPU::S_MOV_B32))
3739 case AMDGPU::SI_INDIRECT_SRC_V1:
3740 case AMDGPU::SI_INDIRECT_SRC_V2:
3741 case AMDGPU::SI_INDIRECT_SRC_V4:
3742 case AMDGPU::SI_INDIRECT_SRC_V8:
3743 case AMDGPU::SI_INDIRECT_SRC_V16:
3745 case AMDGPU::SI_INDIRECT_DST_V1:
3746 case AMDGPU::SI_INDIRECT_DST_V2:
3747 case AMDGPU::SI_INDIRECT_DST_V4:
3748 case AMDGPU::SI_INDIRECT_DST_V8:
3749 case AMDGPU::SI_INDIRECT_DST_V16:
3751 case AMDGPU::SI_KILL_F32_COND_IMM_PSEUDO:
3752 case AMDGPU::SI_KILL_I1_PSEUDO:
3754 case AMDGPU::V_CNDMASK_B64_PSEUDO: {
3767 const auto *CondRC = TRI->getRegClass(AMDGPU::SReg_1_XEXECRegClassID);
3770 BuildMI(*BB, MI, DL, TII->get(AMDGPU::COPY), SrcCondCopy)
3772 BuildMI(*BB, MI, DL, TII->get(AMDGPU::V_CNDMASK_B32_e64), DstLo)
3774 .
addReg(Src0, 0, AMDGPU::sub0)
3776 .
addReg(Src1, 0, AMDGPU::sub0)
3778 BuildMI(*BB, MI, DL, TII->get(AMDGPU::V_CNDMASK_B32_e64), DstHi)
3780 .
addReg(Src0, 0, AMDGPU::sub1)
3782 .
addReg(Src1, 0, AMDGPU::sub1)
3785 BuildMI(*BB, MI, DL, TII->get(AMDGPU::REG_SEQUENCE), Dst)
3793 case AMDGPU::SI_BR_UNDEF: {
3802 case AMDGPU::ADJCALLSTACKUP:
3803 case AMDGPU::ADJCALLSTACKDOWN: {
3815 case AMDGPU::SI_CALL_ISEL: {
3822 MIB =
BuildMI(*BB, MI, DL, TII->get(AMDGPU::SI_CALL), ReturnAddrReg);
3831 case AMDGPU::V_ADD_I32_e32:
3832 case AMDGPU::V_SUB_I32_e32:
3833 case AMDGPU::V_SUBREV_I32_e32: {
3838 bool NeedClampOperand =
false;
3841 NeedClampOperand =
true;
3852 if (NeedClampOperand)
3860 case AMDGPU::DS_GWS_INIT:
3861 case AMDGPU::DS_GWS_SEMA_V:
3862 case AMDGPU::DS_GWS_SEMA_BR:
3863 case AMDGPU::DS_GWS_SEMA_P:
3864 case AMDGPU::DS_GWS_SEMA_RELEASE_ALL:
3865 case AMDGPU::DS_GWS_BARRIER:
4041 SDValue Result = LowerLOAD(Op, DAG);
4044 "Load should return a value and a chain");
4050 return LowerTrig(Op, DAG);
4052 case ISD::FDIV:
return LowerFDIV(Op, DAG);
4058 return LowerGlobalAddress(MFI, Op, DAG);
4065 return lowerINSERT_SUBVECTOR(Op, DAG);
4067 return lowerINSERT_VECTOR_ELT(Op, DAG);
4069 return lowerEXTRACT_VECTOR_ELT(Op, DAG);
4071 return lowerVECTOR_SHUFFLE(Op, DAG);
4073 return lowerBUILD_VECTOR(Op, DAG);
4075 return lowerFP_ROUND(Op, DAG);
4077 return lowerTRAP(Op, DAG);
4079 return lowerDEBUGTRAP(Op, DAG);
4086 return lowerFMINNUM_FMAXNUM(Op, DAG);
4135 SDValue SITargetLowering::adjustLoadValueType(
unsigned Opcode,
4139 bool IsIntrinsic)
const {
4145 EVT EquivLoadVT = LoadVT;
4146 if (Unpacked && LoadVT.
isVector()) {
4187 return handleByteShortBufferLoads(DAG, LoadVT, DL, Ops, M);
4190 return getMemIntrinsicNode(Opc, DL, M->
getVTList(), Ops, IntVT,
4196 SDValue MemNode = getMemIntrinsicNode(Opc, DL, VTList, Ops, CastVT,
4206 const auto *CD = cast<ConstantSDNode>(N->
getOperand(3));
4208 if (CondCode < ICmpInst::Predicate::FIRST_ICMP_PREDICATE ||
4209 CondCode > ICmpInst::Predicate::LAST_ICMP_PREDICATE)
4242 const auto *CD = cast<ConstantSDNode>(N->
getOperand(3));
4245 if (CondCode < FCmpInst::Predicate::FIRST_FCMP_PREDICATE ||
4246 CondCode > FCmpInst::Predicate::LAST_FCMP_PREDICATE) {
4286 unsigned IID = cast<ConstantSDNode>(N->
getOperand(0))->getZExtValue();
4288 case Intrinsic::amdgcn_cvt_pkrtz: {
4297 case Intrinsic::amdgcn_cvt_pknorm_i16:
4298 case Intrinsic::amdgcn_cvt_pknorm_u16:
4299 case Intrinsic::amdgcn_cvt_pk_i16:
4300 case Intrinsic::amdgcn_cvt_pk_u16: {
4306 if (IID == Intrinsic::amdgcn_cvt_pknorm_i16)
4308 else if (IID == Intrinsic::amdgcn_cvt_pknorm_u16)
4310 else if (IID == Intrinsic::amdgcn_cvt_pk_i16)
4349 EVT SelectVT = NewVT;
4359 if (NewVT != SelectVT)
4402 if (
I.getUse().get() !=
Value)
4405 if (
I->getOpcode() == Opcode)
4411 unsigned SITargetLowering::isCFIntrinsic(
const SDNode *
Intr)
const {
4413 switch (cast<ConstantSDNode>(Intr->
getOperand(1))->getZExtValue()) {
4414 case Intrinsic::amdgcn_if:
4416 case Intrinsic::amdgcn_else:
4418 case Intrinsic::amdgcn_loop:
4420 case Intrinsic::amdgcn_end_cf:
4483 unsigned CFNode = isCFIntrinsic(Intr);
4533 for (
unsigned i = 1,
e = Intr->
getNumValues() - 1; i !=
e; ++i) {
4560 if (cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue() != 0)
4591 "Do not know how to custom lower FP_ROUND for non-f16 type");
4594 EVT SrcVT = Src.getValueType();
4635 assert(UserSGPR != AMDGPU::NoRegister);
4637 DAG, &AMDGPU::SReg_64RegClass, UserSGPR,
MVT::i64);
4658 "debugtrap handler not supported",
4673 SDValue SITargetLowering::getSegmentAperture(
unsigned AS,
const SDLoc &DL,
4698 assert(UserSGPR != AMDGPU::NoRegister);
4701 DAG, &AMDGPU::SReg_64RegClass, UserSGPR,
MVT::i64);
4742 NonNull, Ptr, SegmentNullPtr);
4792 unsigned IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
4795 for (
unsigned I = 0;
I != InsNumElts; ++
I) {
4821 if (NumElts == 4 && EltSize == 16 && KIdx) {
4832 unsigned Idx = KIdx->getZExtValue();
4833 bool InsertLo = Idx < 2;
4835 InsertLo ? LoVec : HiVec,
4848 if (isa<ConstantSDNode>(Idx))
4874 DAG.
getNOT(SL, BFM, IntVT), BCVec);
4898 if (
SDValue Combined = performExtractVectorEltCombine(Op.
getNode(), DCI))
4923 return Mask[Elt + 1] == Mask[Elt] + 1 && (Mask[Elt] % 2 == 0);
4950 int VecIdx = Idx < SrcNumElts ? 0 : 1;
4951 int EltIdx = Idx < SrcNumElts ? Idx : Idx - SrcNumElts;
4959 int VecIdx0 = Idx0 < SrcNumElts ? 0 : 1;
4960 int VecIdx1 = Idx1 < SrcNumElts ? 0 : 1;
4961 int EltIdx0 = Idx0 < SrcNumElts ? Idx0 : Idx0 - SrcNumElts;
4962 int EltIdx1 = Idx1 < SrcNumElts ? Idx1 : Idx1 - SrcNumElts;
5039 const SDLoc &DL,
unsigned Offset,
EVT PtrVT,
5089 (!GV->hasExternalLinkage() ||
5145 unsigned Offset)
const {
5157 "non-hsa intrinsic with hsa target",
5166 "intrinsic not supported on subtarget",
5178 if (Elts.
size() == 1) {
5181 }
else if (Elts.
size() == 2) {
5184 }
else if (Elts.
size() <= 4) {
5187 }
else if (Elts.
size() <= 8) {
5197 for (
unsigned i = 0; i < Elts.
size(); ++i) {
5203 for (
unsigned i = Elts.
size(); i < NumElts; ++i)
5213 auto CachePolicyConst = cast<ConstantSDNode>(CachePolicy.
getNode());
5215 uint64_t
Value = CachePolicyConst->getZExtValue();
5216 SDLoc DL(CachePolicy);
5219 Value &= ~(uint64_t)0x1;
5223 Value &= ~(uint64_t)0x2;
5227 Value &= ~(uint64_t)0x4;
5239 bool IsTexFail,
bool Unpacked,
bool IsD16,
5240 int DMaskPop,
int NumVDataDwords,
5243 EVT ReqRetVT = ResultTypes[0];
5246 EVT AdjEltVT = Unpacked && IsD16 ?
MVT::i32 : ReqRetEltVT;
5247 EVT AdjVT = Unpacked ? ReqRetNumElts > 1 ?
EVT::getVectorVT(Context, AdjEltVT, ReqRetNumElts)
5254 if (IsD16 && !Unpacked)
5255 NumElts = NumVDataDwords << 1;
5257 NumElts = NumVDataDwords;
5264 bool V6F16Special =
false;
5268 ReqRetNumElts >>= 1;
5269 V6F16Special =
true;
5284 int ExtraElts = ReqRetNumElts - DMaskPop;
5289 if (ReqRetNumElts > 1) {
5291 if (IsD16 && Unpacked)
5296 PreTFCRes = BVElts[0];
5317 SDValue *LWE,
bool &IsTexFail) {
5318 auto TexFailCtrlConst = cast<ConstantSDNode>(TexFailCtrl.
getNode());
5320 uint64_t
Value = TexFailCtrlConst->getZExtValue();
5325 SDLoc DL(TexFailCtrlConst);
5327 Value &= ~(uint64_t)0x1;
5329 Value &= ~(uint64_t)0x2;
5335 const AMDGPU::ImageDimIntrinsicInfo *Intr,
5340 const AMDGPU::MIMGBaseOpcodeInfo *BaseOpcode =
5343 const AMDGPU::MIMGLZMappingInfo *LZMappingInfo =
5345 const AMDGPU::MIMGMIPMappingInfo *MIPMappingInfo =
5347 unsigned IntrOpcode = Intr->BaseOpcode;
5356 bool AdjustRetType =
false;
5360 unsigned DMaskLanes = 0;
5362 if (BaseOpcode->Atomic) {
5366 if (BaseOpcode->AtomicX2) {
5374 DMask = Is64Bit ? 0xf : 0x3;
5375 NumVDataDwords = Is64Bit ? 4 : 2;
5378 DMask = Is64Bit ? 0x3 : 0x1;
5379 NumVDataDwords = Is64Bit ? 2 : 1;
5383 unsigned DMaskIdx = BaseOpcode->Store ? 3 : isa<MemSDNode>(
Op) ? 2 : 1;
5384 auto DMaskConst = cast<ConstantSDNode>(Op.
getOperand(DMaskIdx));
5385 DMask = DMaskConst->getZExtValue();
5388 if (BaseOpcode->Store) {
5397 VData = handleD16VData(VData, DAG);
5404 MVT LoadVT = ResultTypes[0].getSimpleVT();
5414 (!LoadVT.
isVector() && DMaskLanes > 1))
5418 NumVDataDwords = (DMaskLanes + 1) / 2;
5420 NumVDataDwords = DMaskLanes;
5422 AdjustRetType =
true;
5425 AddrIdx = DMaskIdx + 1;
5428 unsigned NumGradients = BaseOpcode->Gradients ? DimInfo->NumGradients : 0;
5429 unsigned NumCoords = BaseOpcode->Coordinates ? DimInfo->NumCoords : 0;
5430 unsigned NumLCM = BaseOpcode->LodOrClampOrMip ? 1 : 0;
5431 unsigned NumVAddrs = BaseOpcode->NumExtraArgs + NumGradients +
5433 unsigned NumMIVAddrs = NumVAddrs;
5438 if (LZMappingInfo) {
5439 if (
auto ConstantLod =
5440 dyn_cast<ConstantFPSDNode>(Op.
getOperand(AddrIdx+NumVAddrs-1))) {
5441 if (ConstantLod->isZero() || ConstantLod->isNegative()) {
5442 IntrOpcode = LZMappingInfo->LZ;
5449 if (MIPMappingInfo) {
5450 if (
auto ConstantLod =
5451 dyn_cast<ConstantSDNode>(Op.
getOperand(AddrIdx+NumVAddrs-1))) {
5452 if (ConstantLod->isNullValue()) {
5453 IntrOpcode = MIPMappingInfo->NONMIP;
5460 unsigned DimIdx = AddrIdx + BaseOpcode->NumExtraArgs;
5464 ST->hasFeature(AMDGPU::FeatureR128A16)) {
5467 for (
unsigned i = AddrIdx; i < (AddrIdx + NumMIVAddrs); ++i) {
5476 if (((i + 1) >= (AddrIdx + NumMIVAddrs)) ||
5477 ((NumGradients / 2) % 2 == 1 &&
5478 (i == DimIdx + (NumGradients / 2) - 1 ||
5479 i == DimIdx + NumGradients - 1))) {
5492 for (
unsigned i = 0; i < NumMIVAddrs; ++i)
5508 ST->hasFeature(AMDGPU::FeatureNSAEncoding) && VAddrs.
size() >= 3;
5517 if (!BaseOpcode->Sampler) {
5519 CtrlIdx = AddrIdx + NumVAddrs + 1;
5522 cast<ConstantSDNode>(Op.
getOperand(AddrIdx + NumVAddrs + 2));
5524 Unorm = UnormConst->getZExtValue() ? True : False;
5525 CtrlIdx = AddrIdx + NumVAddrs + 3;
5531 bool IsTexFail =
false;
5532 if (!
parseTexFail(TexFail, DAG, &TFE, &LWE, IsTexFail))
5543 NumVDataDwords += 1;
5544 AdjustRetType =
true;
5549 if (AdjustRetType) {
5551 if (DMaskLanes == 0 && !BaseOpcode->Store) {
5554 if (isa<MemSDNode>(Op))
5559 EVT NewVT = NumVDataDwords > 1 ?
5563 ResultTypes[0] = NewVT;
5564 if (ResultTypes.size() == 3) {
5568 ResultTypes.erase(&ResultTypes[1]);
5575 if (BaseOpcode->Atomic) {
5578 IsGFX10 ? &DLC :
nullptr))
5582 IsGFX10 ? &DLC :
nullptr))
5587 if (BaseOpcode->Store || BaseOpcode->Atomic)
5590 for (
const SDValue &Addr : VAddrs)
5596 if (BaseOpcode->Sampler)
5607 ST->hasFeature(AMDGPU::FeatureR128A16) ? True : False);
5611 Ops.
push_back(DimInfo->DA ? True : False);
5612 if (BaseOpcode->HasD16)
5614 if (isa<MemSDNode>(Op))
5617 int NumVAddrDwords =
5623 UseNSA ? AMDGPU::MIMGEncGfx10NSA
5624 : AMDGPU::MIMGEncGfx10Default,
5625 NumVDataDwords, NumVAddrDwords);
5629 NumVDataDwords, NumVAddrDwords);
5632 NumVDataDwords, NumVAddrDwords);
5637 if (
auto MemOp = dyn_cast<MemSDNode>(Op)) {
5642 if (BaseOpcode->AtomicX2) {
5646 }
else if (!BaseOpcode->Store) {
5648 OrigResultTypes, IsTexFail,
5650 DMaskLanes, NumVDataDwords, DL,
5700 unsigned NumLoads = 1;
5706 if (NumElts == 8 || NumElts == 16) {
5707 NumLoads = NumElts / 4;
5712 unsigned CachePolicy = cast<ConstantSDNode>(GLC)->getZExtValue();
5726 setBufferOffsets(Offset, DAG, &Ops[3], NumLoads > 1 ? 16 * NumLoads : 4);
5728 uint64_t InstOffset = cast<ConstantSDNode>(Ops[5])->getZExtValue();
5729 for (
unsigned i = 0; i < NumLoads; ++i) {
5748 unsigned IntrinsicID = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
5752 switch (IntrinsicID) {
5753 case Intrinsic::amdgcn_implicit_buffer_ptr: {
5756 return getPreloadedValue(DAG, *MFI, VT,
5759 case Intrinsic::amdgcn_dispatch_ptr:
5760 case Intrinsic::amdgcn_queue_ptr: {
5763 MF.
getFunction(),
"unsupported hsa intrinsic without hsa target",
5769 auto RegID = IntrinsicID == Intrinsic::amdgcn_dispatch_ptr ?
5771 return getPreloadedValue(DAG, *MFI, VT, RegID);
5773 case Intrinsic::amdgcn_implicitarg_ptr: {
5775 return getImplicitArgPtr(DAG, DL);
5776 return getPreloadedValue(DAG, *MFI, VT,
5779 case Intrinsic::amdgcn_kernarg_segment_ptr: {
5780 return getPreloadedValue(DAG, *MFI, VT,
5783 case Intrinsic::amdgcn_dispatch_id: {
5786 case Intrinsic::amdgcn_rcp:
5788 case Intrinsic::amdgcn_rsq:
5790 case Intrinsic::amdgcn_rsq_legacy:
5795 case Intrinsic::amdgcn_rcp_legacy:
5799 case Intrinsic::amdgcn_rsq_clamp: {
5813 case Intrinsic::r600_read_ngroups_x:
5817 return lowerKernargMemParameter(DAG, VT, VT, DL, DAG.
getEntryNode(),
5819 case Intrinsic::r600_read_ngroups_y:
5823 return lowerKernargMemParameter(DAG, VT, VT, DL, DAG.
getEntryNode(),
5825 case Intrinsic::r600_read_ngroups_z:
5829 return lowerKernargMemParameter(DAG, VT, VT, DL, DAG.
getEntryNode(),
5831 case Intrinsic::r600_read_global_size_x:
5835 return lowerKernargMemParameter(DAG, VT, VT, DL, DAG.
getEntryNode(),
5837 case Intrinsic::r600_read_global_size_y:
5841 return lowerKernargMemParameter(DAG, VT, VT, DL, DAG.
getEntryNode(),
5843 case Intrinsic::r600_read_global_size_z:
5847 return lowerKernargMemParameter(DAG, VT, VT, DL, DAG.
getEntryNode(),
5849 case Intrinsic::r600_read_local_size_x:
5853 return lowerImplicitZextParam(DAG, Op,
MVT::i16,
5855 case Intrinsic::r600_read_local_size_y:
5859 return lowerImplicitZextParam(DAG, Op,
MVT::i16,
5861 case Intrinsic::r600_read_local_size_z:
5865 return lowerImplicitZextParam(DAG, Op,
MVT::i16,
5867 case Intrinsic::amdgcn_workgroup_id_x:
5868 case Intrinsic::r600_read_tgid_x:
5869 return getPreloadedValue(DAG, *MFI, VT,
5871 case Intrinsic::amdgcn_workgroup_id_y:
5872 case Intrinsic::r600_read_tgid_y:
5873 return getPreloadedValue(DAG, *MFI, VT,
5875 case Intrinsic::amdgcn_workgroup_id_z:
5876 case Intrinsic::r600_read_tgid_z:
5877 return getPreloadedValue(DAG, *MFI, VT,
5879 case Intrinsic::amdgcn_workitem_id_x:
5880 case Intrinsic::r600_read_tidig_x:
5883 MFI->getArgInfo().WorkItemIDX);
5884 case Intrinsic::amdgcn_workitem_id_y:
5885 case Intrinsic::r600_read_tidig_y:
5888 MFI->getArgInfo().WorkItemIDY);
5889 case Intrinsic::amdgcn_workitem_id_z:
5890 case Intrinsic::r600_read_tidig_z:
5893 MFI->getArgInfo().WorkItemIDZ);
5894 case Intrinsic::amdgcn_wavefrontsize:
5897 case Intrinsic::amdgcn_s_buffer_load: {
5902 IsGFX10 ? &DLC :
nullptr))
5907 case Intrinsic::amdgcn_fdiv_fast:
5908 return lowerFDIV_FAST(Op, DAG);
5909 case Intrinsic::amdgcn_interp_p1_f16: {
5951 case Intrinsic::amdgcn_sin:
5954 case Intrinsic::amdgcn_cos:
5957 case Intrinsic::amdgcn_mul_u24:
5959 case Intrinsic::amdgcn_mul_i24:
5962 case Intrinsic::amdgcn_log_clamp: {
5967 MF.
getFunction(),
"intrinsic not supported on subtarget",
5972 case Intrinsic::amdgcn_ldexp:
5976 case Intrinsic::amdgcn_fract:
5979 case Intrinsic::amdgcn_class:
5982 case Intrinsic::amdgcn_div_fmas:
5987 case Intrinsic::amdgcn_div_fixup:
5991 case Intrinsic::amdgcn_trig_preop:
5994 case Intrinsic::amdgcn_div_scale: {
6010 Denominator, Numerator);
6012 case Intrinsic::amdgcn_icmp: {
6020 case Intrinsic::amdgcn_fcmp: {
6023 case Intrinsic::amdgcn_fmed3:
6026 case Intrinsic::amdgcn_fdot2:
6030 case Intrinsic::amdgcn_fmul_legacy:
6033 case Intrinsic::amdgcn_sffbh:
6035 case Intrinsic::amdgcn_sbfe:
6038 case Intrinsic::amdgcn_ubfe:
6041 case Intrinsic::amdgcn_cvt_pkrtz:
6042 case Intrinsic::amdgcn_cvt_pknorm_i16:
6043 case Intrinsic::amdgcn_cvt_pknorm_u16:
6044 case Intrinsic::amdgcn_cvt_pk_i16:
6045 case Intrinsic::amdgcn_cvt_pk_u16: {
6050 if (IntrinsicID == Intrinsic::amdgcn_cvt_pkrtz)
6052 else if (IntrinsicID == Intrinsic::amdgcn_cvt_pknorm_i16)
6054 else if (IntrinsicID == Intrinsic::amdgcn_cvt_pknorm_u16)
6056 else if (IntrinsicID == Intrinsic::amdgcn_cvt_pk_i16)
6068 case Intrinsic::amdgcn_fmad_ftz:
6072 case Intrinsic::amdgcn_if_break:
6076 case Intrinsic::amdgcn_groupstaticsize: {
6088 case Intrinsic::amdgcn_is_shared:
6089 case Intrinsic::amdgcn_is_private: {
6091 unsigned AS = (IntrinsicID == Intrinsic::amdgcn_is_shared) ?
6093 SDValue Aperture = getSegmentAperture(AS, SL, DAG);
6102 if (
const AMDGPU::ImageDimIntrinsicInfo *ImageDimIntr =
6104 return lowerImage(Op, ImageDimIntr, DAG);
6120 if (!isa<ConstantSDNode>(VOffset) || !isa<ConstantSDNode>(SOffset) ||
6121 !isa<ConstantSDNode>(Offset))
6125 if (!isa<ConstantSDNode>(VIndex) || !cast<ConstantSDNode>(VIndex)->isNullValue())
6129 return cast<ConstantSDNode>(VOffset)->getSExtValue() +
6130 cast<ConstantSDNode>(SOffset)->getSExtValue() +
6131 cast<ConstantSDNode>(
Offset)->getSExtValue();
6136 unsigned IntrID = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
6140 case Intrinsic::amdgcn_ds_ordered_add:
6141 case Intrinsic::amdgcn_ds_ordered_swap: {
6149 unsigned ShaderType;
6152 unsigned OrderedCountIndex = IndexOperand & 0x3f;
6153 IndexOperand &= ~0x3f;
6154 unsigned CountDw = 0;
6157 CountDw = (IndexOperand >> 24) & 0xf;
6158 IndexOperand &= ~(0xf << 24);
6160 if (CountDw < 1 || CountDw > 4) {
6162 "ds_ordered_count: dword count must be between 1 and 4");
6170 case Intrinsic::amdgcn_ds_ordered_add:
6173 case Intrinsic::amdgcn_ds_ordered_swap:
6178 if (WaveDone && !WaveRelease)
6199 unsigned Offset0 = OrderedCountIndex << 2;
6200 unsigned Offset1 = WaveRelease | (WaveDone << 1) | (ShaderType << 2) |
6204 Offset1 |= (CountDw - 1) << 6;
6206 unsigned Offset = Offset0 | (Offset1 << 8);
6218 case Intrinsic::amdgcn_ds_fadd: {
6222 case Intrinsic::amdgcn_ds_fadd:
6231 case Intrinsic::amdgcn_atomic_inc:
6232 case Intrinsic::amdgcn_atomic_dec:
6233 case Intrinsic::amdgcn_ds_fmin:
6234 case Intrinsic::amdgcn_ds_fmax: {
6238 case Intrinsic::amdgcn_atomic_inc:
6241 case Intrinsic::amdgcn_atomic_dec:
6244 case Intrinsic::amdgcn_ds_fmin:
6247 case Intrinsic::amdgcn_ds_fmax:
6262 case Intrinsic::amdgcn_buffer_load:
6263 case Intrinsic::amdgcn_buffer_load_format: {
6264 unsigned Glc = cast<ConstantSDNode>(Op.
getOperand(5))->getZExtValue();
6265 unsigned Slc = cast<ConstantSDNode>(Op.
getOperand(6))->getZExtValue();
6267 if (
auto Idx = dyn_cast<ConstantSDNode>(Op.
getOperand(3)))
6268 IdxEn = Idx->getZExtValue() != 0;
6280 unsigned Offset = setBufferOffsets(Op.
getOperand(4), DAG, &Ops[3]);
6285 unsigned Opc = (IntrID == Intrinsic::amdgcn_buffer_load) ?
6290 auto *M = cast<MemSDNode>(
Op);
6301 return handleByteShortBufferLoads(DAG, LoadVT, DL, Ops, M);
6303 return getMemIntrinsicNode(Opc, DL, Op->
getVTList(), Ops, IntVT,
6306 case Intrinsic::amdgcn_raw_buffer_load:
6307 case Intrinsic::amdgcn_raw_buffer_load_format: {
6308 const bool IsFormat = IntrID == Intrinsic::amdgcn_raw_buffer_load_format;
6322 auto *M = cast<MemSDNode>(
Op);
6324 return lowerIntrinsicLoad(M, IsFormat, DAG, Ops);
6326 case Intrinsic::amdgcn_struct_buffer_load:
6327 case Intrinsic::amdgcn_struct_buffer_load_format: {
6328 const bool IsFormat = IntrID == Intrinsic::amdgcn_struct_buffer_load_format;
6342 auto *M = cast<MemSDNode>(
Op);
6345 return lowerIntrinsicLoad(cast<MemSDNode>(Op), IsFormat, DAG, Ops);
6347 case Intrinsic::amdgcn_tbuffer_load: {
6351 unsigned Dfmt = cast<ConstantSDNode>(Op.
getOperand(7))->getZExtValue();
6352 unsigned Nfmt = cast<ConstantSDNode>(Op.
getOperand(8))->getZExtValue();
6353 unsigned Glc = cast<ConstantSDNode>(Op.
getOperand(9))->getZExtValue();
6354 unsigned Slc = cast<ConstantSDNode>(Op.
getOperand(10))->getZExtValue();
6356 if (
auto Idx = dyn_cast<ConstantSDNode>(Op.
getOperand(3)))
6357 IdxEn = Idx->getZExtValue() != 0;
6370 if (LoadVT.getScalarType() ==
MVT::f16)
6377 case Intrinsic::amdgcn_raw_tbuffer_load: {
6394 if (LoadVT.getScalarType() ==
MVT::f16)
6401 case Intrinsic::amdgcn_struct_tbuffer_load: {
6418 if (LoadVT.getScalarType() ==
MVT::f16)
6425 case Intrinsic::amdgcn_buffer_atomic_swap:
6426 case Intrinsic::amdgcn_buffer_atomic_add:
6427 case Intrinsic::amdgcn_buffer_atomic_sub:
6428 case Intrinsic::amdgcn_buffer_atomic_smin:
6429 case Intrinsic::amdgcn_buffer_atomic_umin:
6430 case Intrinsic::amdgcn_buffer_atomic_smax:
6431 case Intrinsic::amdgcn_buffer_atomic_umax:
6432 case Intrinsic::amdgcn_buffer_atomic_and:
6433 case Intrinsic::amdgcn_buffer_atomic_or:
6434 case Intrinsic::amdgcn_buffer_atomic_xor: {
6435 unsigned Slc = cast<ConstantSDNode>(Op.
getOperand(6))->getZExtValue();
6437 if (
auto Idx = dyn_cast<ConstantSDNode>(Op.
getOperand(4)))
6438 IdxEn = Idx->getZExtValue() != 0;
6450 unsigned Offset = setBufferOffsets(Op.
getOperand(5), DAG, &Ops[4]);
6456 auto *M = cast<MemSDNode>(
Op);
6458 unsigned Opcode = 0;
6461 case Intrinsic::amdgcn_buffer_atomic_swap:
6464 case Intrinsic::amdgcn_buffer_atomic_add:
6467 case Intrinsic::amdgcn_buffer_atomic_sub:
6470 case Intrinsic::amdgcn_buffer_atomic_smin:
6473 case Intrinsic::amdgcn_buffer_atomic_umin:
6476 case Intrinsic::amdgcn_buffer_atomic_smax:
6479 case Intrinsic::amdgcn_buffer_atomic_umax:
6482 case Intrinsic::amdgcn_buffer_atomic_and:
6485 case Intrinsic::amdgcn_buffer_atomic_or:
6488 case Intrinsic::amdgcn_buffer_atomic_xor:
6498 case Intrinsic::amdgcn_raw_buffer_atomic_swap:
6499 case Intrinsic::amdgcn_raw_buffer_atomic_add:
6500 case Intrinsic::amdgcn_raw_buffer_atomic_sub:
6501 case Intrinsic::amdgcn_raw_buffer_atomic_smin:
6502 case Intrinsic::amdgcn_raw_buffer_atomic_umin:
6503 case Intrinsic::amdgcn_raw_buffer_atomic_smax:
6504 case Intrinsic::amdgcn_raw_buffer_atomic_umax:
6505 case Intrinsic::amdgcn_raw_buffer_atomic_and:
6506 case Intrinsic::amdgcn_raw_buffer_atomic_or:
6507 case Intrinsic::amdgcn_raw_buffer_atomic_xor:
6508 case Intrinsic::amdgcn_raw_buffer_atomic_inc:
6509 case Intrinsic::amdgcn_raw_buffer_atomic_dec: {
6524 auto *M = cast<MemSDNode>(
Op);
6526 unsigned Opcode = 0;
6529 case Intrinsic::amdgcn_raw_buffer_atomic_swap:
6532 case Intrinsic::amdgcn_raw_buffer_atomic_add:
6535 case Intrinsic::amdgcn_raw_buffer_atomic_sub:
6538 case Intrinsic::amdgcn_raw_buffer_atomic_smin:
6541 case Intrinsic::amdgcn_raw_buffer_atomic_umin:
6544 case Intrinsic::amdgcn_raw_buffer_atomic_smax:
6547 case Intrinsic::amdgcn_raw_buffer_atomic_umax:
6550 case Intrinsic::amdgcn_raw_buffer_atomic_and:
6553 case Intrinsic::amdgcn_raw_buffer_atomic_or:
6556 case Intrinsic::amdgcn_raw_buffer_atomic_xor:
6559 case Intrinsic::amdgcn_raw_buffer_atomic_inc:
6562 case Intrinsic::amdgcn_raw_buffer_atomic_dec:
6572 case Intrinsic::amdgcn_struct_buffer_atomic_swap:
6573 case Intrinsic::amdgcn_struct_buffer_atomic_add:
6574 case Intrinsic::amdgcn_struct_buffer_atomic_sub:
6575 case Intrinsic::amdgcn_struct_buffer_atomic_smin:
6576 case Intrinsic::amdgcn_struct_buffer_atomic_umin:
6577 case Intrinsic::amdgcn_struct_buffer_atomic_smax:
6578 case Intrinsic::amdgcn_struct_buffer_atomic_umax:
6579 case Intrinsic::amdgcn_struct_buffer_atomic_and:
6580 case Intrinsic::amdgcn_struct_buffer_atomic_or:
6581 case Intrinsic::amdgcn_struct_buffer_atomic_xor:
6582 case Intrinsic::amdgcn_struct_buffer_atomic_inc:
6583 case Intrinsic::amdgcn_struct_buffer_atomic_dec: {
6598 auto *M = cast<MemSDNode>(
Op);
6601 unsigned Opcode = 0;
6604 case Intrinsic::amdgcn_struct_buffer_atomic_swap:
6607 case Intrinsic::amdgcn_struct_buffer_atomic_add:
6610 case Intrinsic::amdgcn_struct_buffer_atomic_sub:
6613 case Intrinsic::amdgcn_struct_buffer_atomic_smin:
6616 case Intrinsic::amdgcn_struct_buffer_atomic_umin:
6619 case Intrinsic::amdgcn_struct_buffer_atomic_smax:
6622 case Intrinsic::amdgcn_struct_buffer_atomic_umax:
6625 case Intrinsic::amdgcn_struct_buffer_atomic_and:
6628 case Intrinsic::amdgcn_struct_buffer_atomic_or:
6631 case Intrinsic::amdgcn_struct_buffer_atomic_xor:
6634 case Intrinsic::amdgcn_struct_buffer_atomic_inc:
6637 case Intrinsic::amdgcn_struct_buffer_atomic_dec:
6647 case Intrinsic::amdgcn_buffer_atomic_cmpswap: {
6648 unsigned Slc = cast<ConstantSDNode>(Op.
getOperand(7))->getZExtValue();
6650 if (
auto Idx = dyn_cast<ConstantSDNode>(Op.
getOperand(5)))
6651 IdxEn = Idx->getZExtValue() != 0;
6664 unsigned Offset = setBufferOffsets(Op.
getOperand(6), DAG, &Ops[5]);
6669 auto *M = cast<MemSDNode>(
Op);
6675 case Intrinsic::amdgcn_raw_buffer_atomic_cmpswap: {
6690 auto *M = cast<MemSDNode>(
Op);
6696 case Intrinsic::amdgcn_struct_buffer_atomic_cmpswap: {
6711 auto *M = cast<MemSDNode>(
Op);
6720 if (
const AMDGPU::ImageDimIntrinsicInfo *ImageDimIntr =
6722 return lowerImage(Op, ImageDimIntr, DAG);
6730 SDValue SITargetLowering::getMemIntrinsicNode(
unsigned Opcode,
const SDLoc &DL,
6737 EVT WidenedMemVT = MemVT;
6743 WidenedMemVT.getVectorElementType(), 4);
6752 if (WidenedVT != VT) {
6791 unsigned IntrinsicID = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
6794 switch (IntrinsicID) {
6795 case Intrinsic::amdgcn_exp: {
6813 unsigned Opc = Done->isNullValue() ?
6817 case Intrinsic::amdgcn_exp_compr: {
6842 case Intrinsic::amdgcn_s_barrier: {
6852 case Intrinsic::amdgcn_tbuffer_store: {
6856 VData = handleD16VData(VData, DAG);
6857 unsigned Dfmt = cast<ConstantSDNode>(Op.
getOperand(8))->getZExtValue();
6858 unsigned Nfmt = cast<ConstantSDNode>(Op.
getOperand(9))->getZExtValue();
6859 unsigned Glc = cast<ConstantSDNode>(Op.
getOperand(10))->getZExtValue();
6860 unsigned Slc = cast<ConstantSDNode>(Op.
getOperand(11))->getZExtValue();
6862 if (
auto Idx = dyn_cast<ConstantSDNode>(Op.
getOperand(4)))
6863 IdxEn = Idx->getZExtValue() != 0;
6883 case Intrinsic::amdgcn_struct_tbuffer_store: {
6887 VData = handleD16VData(VData, DAG);
6908 case Intrinsic::amdgcn_raw_tbuffer_store: {
6912 VData = handleD16VData(VData, DAG);
6933 case Intrinsic::amdgcn_buffer_store:
6934 case Intrinsic::amdgcn_buffer_store_format: {
6938 VData = handleD16VData(VData, DAG);
6939 unsigned Glc = cast<ConstantSDNode>(Op.
getOperand(6))->getZExtValue();
6940 unsigned Slc = cast<ConstantSDNode>(Op.
getOperand(7))->getZExtValue();
6942 if (
auto Idx = dyn_cast<ConstantSDNode>(Op.
getOperand(4)))
6943 IdxEn = Idx->getZExtValue() != 0;
6955 unsigned Offset = setBufferOffsets(Op.
getOperand(5), DAG, &Ops[4]);
6959 unsigned Opc = IntrinsicID == Intrinsic::amdgcn_buffer_store ?
6968 return handleByteShortBufferStores(DAG, VDataType, DL, Ops, M);
6974 case Intrinsic::amdgcn_raw_buffer_store:
6975 case Intrinsic::amdgcn_raw_buffer_store_format: {
6976 const bool IsFormat =
6977 IntrinsicID == Intrinsic::amdgcn_raw_buffer_store_format;
6984 VData = handleD16VData(VData, DAG);
7012 return handleByteShortBufferStores(DAG, VDataVT, DL, Ops, M);
7018 case Intrinsic::amdgcn_struct_buffer_store:
7019 case Intrinsic::amdgcn_struct_buffer_store_format: {
7020 const bool IsFormat =
7021 IntrinsicID == Intrinsic::amdgcn_struct_buffer_store_format;
7029 VData = handleD16VData(VData, DAG);
7049 unsigned Opc = IntrinsicID == Intrinsic::amdgcn_struct_buffer_store ?
7059 return handleByteShortBufferStores(DAG, VDataType, DL, Ops, M);
7065 case Intrinsic::amdgcn_buffer_atomic_fadd: {
7066 unsigned Slc = cast<ConstantSDNode>(Op.
getOperand(6))->getZExtValue();
7068 if (
auto Idx = dyn_cast<ConstantSDNode>(Op.
getOperand(4)))
7069 IdxEn = Idx->getZExtValue() != 0;
7081 unsigned Offset = setBufferOffsets(Op.
getOperand(5), DAG, &Ops[4]);
7087 auto *M = cast<MemSDNode>(
Op);
7096 case Intrinsic::amdgcn_global_atomic_fadd: {
7104 auto *M = cast<MemSDNode>(
Op);
7115 case Intrinsic::amdgcn_end_cf:
7120 if (
const AMDGPU::ImageDimIntrinsicInfo *ImageDimIntr =
7122 return lowerImage(Op, ImageDimIntr, DAG);
7135 std::pair<SDValue, SDValue> SITargetLowering::splitBufferOffsets(
7138 const unsigned MaxImm = 4095;
7142 if ((C1 = dyn_cast<ConstantSDNode>(N0)))
7158 unsigned Overflow = ImmOffset & ~MaxImm;
7159 ImmOffset -= Overflow;
7160 if ((int32_t)Overflow < 0) {
7161 Overflow += ImmOffset;
7170 SDValue Ops[] = { N0, OverflowVal };
7185 unsigned SITargetLowering::setBufferOffsets(
SDValue CombinedOffset,
7187 unsigned Align)
const {
7188 SDLoc DL(CombinedOffset);
7189 if (
auto C = dyn_cast<ConstantSDNode>(CombinedOffset)) {
7196 return SOffset + ImmOffset;
7203 int Offset = cast<ConstantSDNode>(N1)->getSExtValue();
7205 Subtarget, Align)) {
7212 Offsets[0] = CombinedOffset;
7246 Ops[1] = BufferStoreExt;
7274 SDValue SITargetLowering::widenLoad(
LoadSDNode *Ld, DAGCombinerInfo &DCI)
const {
7290 if ((MemVT.
isSimple() && !DCI.isAfterLegalizeDAG()) ||
7297 "unexpected vector extload");
7313 "unexpected fp extload");
7331 DCI.AddToWorklist(Cvt.
getNode());
7336 DCI.AddToWorklist(Cvt.
getNode());
7364 BasePtr, RealMemVT, MMO);
7395 "Custom lowering for non-i32 vectors hasn't been implemented.");
7424 if (!Op->
isDivergent() && Alignment >= 4 && NumElements < 32) {
7427 if (NumElements == 3)
7442 Alignment >= 4 && NumElements < 32) {
7445 if (NumElements == 3)
7458 if (NumElements > 4)
7477 if (NumElements > 2)
7482 if (NumElements > 4)
7497 if (NumElements > 2)
7557 if (CLHS->isExactlyValue(1.0)) {
7577 if (CLHS->isExactlyValue(-1.0)) {
7598 return DAG.
getNode(Opcode, SL, VT, A, B);
7619 return DAG.
getNode(Opcode, SL, VT, A, B, C);
7637 if (
SDValue FastLowered = lowerFastUnsafeFDIV(Op, DAG))
7699 int Mode = SPDenormMode | (DPDenormModeDefault << 2);
7704 if (
SDValue FastLowered = lowerFastUnsafeFDIV(Op, DAG))
7733 if (!HasFP32Denormals) {
7738 const SDValue EnableDenormValue =
7761 ApproxRcp, One, NegDivScale0);
7770 NumeratorScaled, Mul);
7775 NumeratorScaled, Fma3);
7777 if (!HasFP32Denormals) {
7780 const SDValue DisableDenormValue =
7784 Fma4.
getValue(1), DisableDenormValue,
7787 const SDValue DisableDenormValue =
7791 Fma4.
getValue(1), DisableDenormValue,
7796 DisableDenorm, DAG.
getRoot());
7802 Fma4, Fma1, Fma3, Scale);
7809 return lowerFastUnsafeFDIV(Op, DAG);
7837 NegDivScale0, Mul, DivScale1);
7869 Fma4, Fma3, Mul, Scale);
7878 return LowerFDIV32(Op, DAG);
7881 return LowerFDIV64(Op, DAG);
7884 return LowerFDIV16(Op, DAG);
7911 Store->
getAlignment() < VT.getStoreSize() && VT.getSizeInBits() > 32) {
7923 unsigned NumElements = VT.getVectorNumElements();
7926 if (NumElements > 4)
7937 if (NumElements > 2)
7941 if (NumElements > 4 || NumElements == 3)
7950 VT.getStoreSize() == 16 && NumElements != 3)
7953 if (NumElements > 2)
7962 NumElements == 2 && VT.getStoreSize() == 8 &&
8021 SDValue Ops[] = { ChainIn, Addr, NewOld };
8032 DAGCombinerInfo &DCI)
const {
8048 if (DCI.isAfterLegalizeDAG() && SrcVT ==
MVT::i32) {
8051 DCI.AddToWorklist(Cvt.
getNode());
8076 DAGCombinerInfo &DCI)
const {
8121 DAGCombinerInfo &DCI)
const {
8142 return (Opc ==
ISD::AND && (Val == 0 || Val == 0xffffffff)) ||
8143 (Opc ==
ISD::OR && (Val == 0xffffffff || Val == 0)) ||
8152 SDValue SITargetLowering::splitBinaryBitConstantOp(
8153 DAGCombinerInfo &DCI,
8196 if (!(C & 0x000000ff)) ZeroByteMask |= 0x000000ff;
8197 if (!(C & 0x0000ff00)) ZeroByteMask |= 0x0000ff00;
8198 if (!(C & 0x00ff0000)) ZeroByteMask |= 0x00ff0000;
8199 if (!(C & 0xff000000)) ZeroByteMask |= 0xff000000;
8200 uint32_t NonZeroByteMask = ~ZeroByteMask;
8201 if ((NonZeroByteMask & C) != NonZeroByteMask)
8230 return (0x03020100 & ConstMask) | (0x0c0c0c0c & ~ConstMask);
8236 return (0x03020100 & ~ConstMask) | ConstMask;
8244 return uint32_t((0x030201000c0c0c0cull << C) >> 32);
8250 return uint32_t(0x0c0c0c0c03020100ull >> C);
8257 DAGCombinerInfo &DCI)
const {
8258 if (DCI.isBeforeLegalize())
8270 = splitBinaryBitConstantOp(DCI,
SDLoc(N),
ISD::AND, LHS, CRHS))
8283 if (
auto *CShift = dyn_cast<ConstantSDNode>(LHS->
getOperand(1))) {
8284 unsigned Shift = CShift->getZExtValue();
8286 unsigned Offset = NB + Shift;
8287 if ((Offset & (Bits - 1)) == 0) {
8397 if (LHSMask != ~0u && RHSMask != ~0u) {
8400 if (LHSMask > RHSMask) {
8407 uint32_t LHSUsedLanes = ~(LHSMask & 0x0c0c0c0c) & 0x0c0c0c0c;
8408 uint32_t RHSUsedLanes = ~(RHSMask & 0x0c0c0c0c) & 0x0c0c0c0c;
8411 if (!(LHSUsedLanes & RHSUsedLanes) &&
8414 !(LHSUsedLanes == 0x0c0c0000 && RHSUsedLanes == 0x00000c0c)) {
8421 for (
unsigned I = 0;
I < 32;
I += 8) {
8423 if ((LHSMask & ByteSel) == 0x0c || (RHSMask & ByteSel) == 0x0c)
8424 Mask &= (0x0c <<
I) & 0xffffffff;
8429 uint32_t Sel = Mask | (LHSUsedLanes & 0x04040404);
8443 DAGCombinerInfo &DCI)
const {
8463 static const uint32_t MaxMask = 0x3ff;
8475 if (isa<ConstantSDNode>(RHS) && LHS.
hasOneUse() &&
8494 if (LHSMask != ~0u && RHSMask != ~0u) {
8497 if (LHSMask > RHSMask) {
8504 uint32_t LHSUsedLanes = ~(LHSMask & 0x0c0c0c0c) & 0x0c0c0c0c;
8505 uint32_t RHSUsedLanes = ~(RHSMask & 0x0c0c0c0c) & 0x0c0c0c0c;
8508 if (!(LHSUsedLanes & RHSUsedLanes) &&
8511 !(LHSUsedLanes == 0x0c0c0000 && RHSUsedLanes == 0x00000c0c)) {
8513 LHSMask &= ~RHSUsedLanes;
8514 RHSMask &= ~LHSUsedLanes;
8516 LHSMask |= LHSUsedLanes & 0x04040404;
8549 DCI.AddToWorklist(LowOr.
getNode());
8550 DCI.AddToWorklist(HiBits.
getNode());
8561 = splitBinaryBitConstantOp(DCI,
SDLoc(N),
ISD::OR, LHS, CRHS))
8569 DAGCombinerInfo &DCI)
const {
8580 = splitBinaryBitConstantOp(DCI,
SDLoc(N),
ISD::XOR, LHS, CRHS))
8644 SDValue SITargetLowering::performZeroExtendCombine(
SDNode *N,
8645 DAGCombinerInfo &DCI)
const {
8670 SDValue SITargetLowering::performSignExtendInRegCombine(
SDNode *N,
8671 DAGCombinerInfo &DCI)
8674 auto *VTSign = cast<VTSDNode>(N->
getOperand(1));
8677 VTSign->getVT() ==
MVT::i8) ||
8681 auto *M = cast<MemSDNode>(Src);
8697 SDValue BufferLoadSignExt = DCI.DAG.getMemIntrinsicNode(Opc,
SDLoc(N),
8701 return DCI.DAG.getMergeValues({BufferLoadSignExt,
8708 DAGCombinerInfo &DCI)
const {
8713 if (
const ConstantSDNode *CMask = dyn_cast<ConstantSDNode>(Mask)) {
8714 if (CMask->isNullValue())
8725 DAGCombinerInfo &DCI)
const {
8747 if (
auto *CFP = dyn_cast<ConstantFPSDNode>(Op)) {
8748 auto F = CFP->getValueAPF();
8749 if (
F.isNaN() &&
F.isSignaling())
8876 unsigned IntrinsicID
8877 = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
8879 switch (IntrinsicID) {
8880 case Intrinsic::amdgcn_cvt_pkrtz:
8881 case Intrinsic::amdgcn_cubeid:
8882 case Intrinsic::amdgcn_frexp_mant:
8883 case Intrinsic::amdgcn_fdot2:
8900 SDValue SITargetLowering::getCanonicalConstantFP(
8927 return Op.
isUndef() || isa<ConstantFPSDNode>(
Op);
8930 SDValue SITargetLowering::performFCanonicalizeCombine(
8932 DAGCombinerInfo &DCI)
const {
8945 return getCanonicalConstantFP(DAG,
SDLoc(N), VT, CFP->getValueAPF());
8964 for (
unsigned I = 0;
I != 2; ++
I) {
8967 NewElts[
I] = getCanonicalConstantFP(DAG, SL, EltVT,
8968 CFP->getValueAPF());
8981 if (isa<ConstantFPSDNode>(NewElts[1]))
8982 NewElts[0] = isa<ConstantFPSDNode>(NewElts[1]) ?
8987 NewElts[1] = isa<ConstantFPSDNode>(NewElts[0]) ?
9008 SDValue Canon1 = getCanonicalConstantFP(DAG, SL, VT, CRHS->getValueAPF());
9009 DCI.AddToWorklist(Canon0.
getNode());
9039 SDValue SITargetLowering::performIntMed3ImmCombine(
9061 return DAG.
getNode(Med3Opc, SL, VT,
9144 DAGCombinerInfo &DCI)
const {
9187 if (
SDValue Med3 = performIntMed3ImmCombine(DAG,
SDLoc(N), Op0, Op1,
true))
9192 if (
SDValue Med3 = performIntMed3ImmCombine(DAG,
SDLoc(N), Op0, Op1,
false))
9205 if (
SDValue Res = performFPMed3ImmCombine(DAG,
SDLoc(N), Op0, Op1))
9216 return (CA->isExactlyValue(0.0) && CB->isExactlyValue(1.0)) ||
9217 (CA->isExactlyValue(1.0) && CB->isExactlyValue(0.0));
9226 DAGCombinerInfo &DCI)
const {
9253 if (isa<ConstantFPSDNode>(Src0) && !isa<ConstantFPSDNode>(Src1))
9256 if (isa<ConstantFPSDNode>(Src1) && !isa<ConstantFPSDNode>(Src2))
9259 if (isa<ConstantFPSDNode>(Src0) && !isa<ConstantFPSDNode>(Src1))
9270 DAGCombinerInfo &DCI)
const {
9278 SDValue SITargetLowering::performExtractVectorEltCombine(
9279 SDNode *N, DAGCombinerInfo &DCI)
const {
9301 if (Vec.
hasOneUse() && DCI.isBeforeLegalize()) {
9328 DCI.AddToWorklist(Elt0.
getNode());
9329 DCI.AddToWorklist(Elt1.
getNode());
9343 if (VecSize <= 256 && (VecSize > 64 || EltSize >= 32) &&
9360 if (!DCI.isBeforeLegalize())
9367 if (isa<MemSDNode>(Vec) &&
9371 VecSize % 32 == 0 &&
9375 unsigned BitIndex = Idx->getZExtValue() * EltSize;
9376 unsigned EltIdx = BitIndex / 32;
9377 unsigned LeftoverBitIdx = BitIndex % 32;
9381 DCI.AddToWorklist(Cast.
getNode());
9385 DCI.AddToWorklist(Elt.
getNode());
9388 DCI.AddToWorklist(Srl.
getNode());
9391 DCI.AddToWorklist(Trunc.
getNode());
9399 SITargetLowering::performInsertVectorEltCombine(
SDNode *N,
9400 DAGCombinerInfo &DCI)
const {
9414 if (isa<ConstantSDNode>(Idx) ||
9415 VecSize > 256 || (VecSize <= 64 && EltSize < 32))
9434 unsigned SITargetLowering::getFusedOpcode(
const SelectionDAG &DAG,
9436 const SDNode *N1)
const {
9495 return DAG.
getNode(Opc, SL, VT, Add1, Op2);
9509 DAGCombinerInfo &DCI)
const {
9533 return getMad64_32(DAG, SL, VT, MulLHS, MulRHS, AddRHS,
false);
9540 return getMad64_32(DAG, SL, VT, MulLHS, MulRHS, AddRHS,
true);
9546 if (
SDValue V = reassociateScalarOps(N, DAG)) {
9550 if (VT !=
MVT::i32 || !DCI.isAfterLegalizeDAG())
9574 return DAG.
getNode(Opc, SL, VTList, Args);
9579 if (!C || C->getZExtValue() != 0)
break;
9588 DAGCombinerInfo &DCI)
const {
9615 return DAG.
getNode(Opc, SL, VTList, Args);
9622 if (!C || !C->isNullValue())
9630 SDValue SITargetLowering::performAddCarrySubCarryCombine(
SDNode *N,
9631 DAGCombinerInfo &DCI)
const {
9637 if (!C || C->getZExtValue() != 0)
9656 DAGCombinerInfo &DCI)
const {
9674 unsigned FusedOp = getFusedOpcode(DAG, N, LHS.
getNode());
9677 return DAG.
getNode(FusedOp, SL, VT, A, Two, RHS);
9686 unsigned FusedOp = getFusedOpcode(DAG, N, RHS.
getNode());
9689 return DAG.
getNode(FusedOp, SL, VT, A, Two, LHS);
9698 DAGCombinerInfo &DCI)
const {
9716 SDValue A = LHS.getOperand(0);
9718 unsigned FusedOp = getFusedOpcode(DAG, N, LHS.getNode());
9723 return DAG.
getNode(FusedOp, SL, VT, A, Two, NegRHS);
9733 unsigned FusedOp = getFusedOpcode(DAG, N, RHS.
getNode());
9736 return DAG.
getNode(FusedOp, SL, VT, A, NegTwo, LHS);
9745 DAGCombinerInfo &DCI)
const {
9804 if (Vec1 == Vec2 || Vec3 == Vec4)
9810 if ((Vec1 == Vec3 && Vec2 == Vec4) ||
9811 (Vec1 == Vec4 && Vec2 == Vec3)) {
9820 DAGCombinerInfo &DCI)
const {
9915 SDValue SITargetLowering::performCvtF32UByteNCombine(
SDNode *N,
9916 DAGCombinerInfo &DCI)
const {
9933 dyn_cast<ConstantSDNode>(Srl.
getOperand(1))) {
9937 unsigned SrcOffset = C->getZExtValue() + 8 *
Offset;
9938 if (SrcOffset < 32 && SrcOffset % 8 == 0) {
9949 !DCI.isBeforeLegalizeOps());
9951 if (TLI.SimplifyDemandedBits(Src, Demanded, Known, TLO)) {
9952 DCI.CommitTargetLoweringOpt(TLO);
9959 DAGCombinerInfo &DCI)
const {
9991 return performAddCombine(N, DCI);
9993 return performSubCombine(N, DCI);
9996 return performAddCarrySubCarryCombine(N, DCI);
9998 return performFAddCombine(N, DCI);
10000 return performFSubCombine(N, DCI);
10002 return performSetCCCombine(N, DCI);
10013 return performMinMaxCombine(N, DCI);
10015 return performFMACombine(N, DCI);
10017 if (
SDValue Widended = widenLoad(cast<LoadSDNode>(N), DCI))
10044 return performMemSDNodeCombine(cast<MemSDNode>(N), DCI);
10046 return performAndCombine(N, DCI);
10048 return performOrCombine(N, DCI);
10050 return performXorCombine(N, DCI);
10052 return performZeroExtendCombine(N, DCI);
10054 return performSignExtendInRegCombine(N , DCI);
10056 return performClassCombine(N, DCI);
10058 return performFCanonicalizeCombine(N, DCI);
10060 return performRcpCombine(N, DCI);
10075 return performUCharToFloatCombine(N, DCI);
10080 return performCvtF32UByteNCombine(N, DCI);
10082 return performFMed3Combine(N, DCI);
10084 return performCvtPkRTZCombine(N, DCI);
10086 return performClampCombine(N, DCI);
10106 return performExtractVectorEltCombine(N, DCI);
10108 return performInsertVectorEltCombine(N, DCI);
10117 case AMDGPU::sub0:
return 0;
10118 case AMDGPU::sub1:
return 1;
10119 case AMDGPU::sub2:
return 2;
10120 case AMDGPU::sub3:
return 3;
10121 case AMDGPU::sub4:
return 4;
10139 unsigned NewDmask = 0;
10144 unsigned TFCLane = 0;
10147 if (OldDmask == 0) {
10155 TFCLane = OldBitsSet;
10163 if (
I.getUse().getResNo() != 0)
10167 if (!
I->isMachineOpcode() ||
10168 I->getMachineOpcode() != TargetOpcode::EXTRACT_SUBREG)
10178 if (UsesTFC && Lane == TFCLane) {
10183 for (
unsigned i = 0, Dmask = OldDmask; (i <= Lane) && (Dmask != 0); i++) {
10185 Dmask &= ~(1 << Comp);
10193 NewDmask |= 1 << Comp;
10198 bool NoChannels = !NewDmask;
10205 if (OldBitsSet == 1)
10211 if (NewDmask == OldDmask)
10220 unsigned NewChannels = BitsSet + UsesTFC;
10224 assert(NewOpcode != -1 &&
10226 "failed to find equivalent MIMG op");
10236 MVT ResultVT = NewChannels == 1 ?
10238 NewChannels == 5 ? 8 : NewChannels);
10252 if (NewChannels == 1) {
10262 for (
unsigned i = 0, Idx = AMDGPU::sub0; i < 5; ++i) {
10267 if (i || !NoChannels)
10276 case AMDGPU::sub0: Idx = AMDGPU::sub1;
break;
10277 case AMDGPU::sub1: Idx = AMDGPU::sub2;
break;
10278 case AMDGPU::sub2: Idx = AMDGPU::sub3;
break;
10279 case AMDGPU::sub3: Idx = AMDGPU::sub4;
break;
10291 return isa<FrameIndexSDNode>(
Op);
10305 if (SrcVal.getValueType() ==
MVT::i1 &&
10321 return ToResultReg.
getNode();
10348 if (TII->
isMIMG(Opcode) && !TII->get(Opcode).mayStore() &&
10350 return adjustWritemask(Node, DAG);
10353 if (Opcode == AMDGPU::INSERT_SUBREG ||
10354 Opcode == AMDGPU::REG_SEQUENCE) {
10360 case AMDGPU::V_DIV_SCALE_F32:
10361 case AMDGPU::V_DIV_SCALE_F64: {
10371 (Src0 == Src1 || Src0 == Src2))
10386 if (Src0.isMachineOpcode() &&
10387 Src0.getMachineOpcode() == AMDGPU::IMPLICIT_DEF) {
10409 case AMDGPU::V_PERMLANE16_B32:
10410 case AMDGPU::V_PERMLANEX16_B32: {
10457 if ((OpInfo[
I].RegClass != llvm::AMDGPU::AV_64RegClassID &&
10458 OpInfo[
I].RegClass != llvm::AMDGPU::AV_32RegClassID) ||
10463 if (!Src || !Src->isCopy() ||
10464 !TRI->
isSGPRReg(MRI, Src->getOperand(1).getReg()))
10480 if (NoRetAtomicOp != -1) {
10482 MI.
setDesc(TII->get(NoRetAtomicOp));
10500 MI.
setDesc(TII->get(NoRetAtomicOp));
10508 TII->get(AMDGPU::IMPLICIT_DEF),
Def);
10557 uint64_t RsrcDword2And3)
const {
10567 RsrcDword2And3 & UINT64_C(0xFFFFFFFF));
10589 std::pair<unsigned, const TargetRegisterClass *>
10594 if (Constraint.
size() == 1) {
10595 switch (Constraint[0]) {
10602 return std::make_pair(0U,
nullptr);
10605 RC = &AMDGPU::SReg_32RegClass;
10608 RC = &AMDGPU::SGPR_64RegClass;
10611 RC = &AMDGPU::SReg_96RegClass;
10614 RC = &AMDGPU::SGPR_128RegClass;
10617 RC = &AMDGPU::SReg_160RegClass;
10620 RC = &AMDGPU::SReg_256RegClass;
10623 RC = &AMDGPU::SReg_512RegClass;
10630 return std::make_pair(0U,
nullptr);
10633 RC = &AMDGPU::VGPR_32RegClass;
10636 RC = &AMDGPU::VReg_64RegClass;
10639 RC = &AMDGPU::VReg_96RegClass;
10642 RC = &AMDGPU::VReg_128RegClass;
10645 RC = &AMDGPU::VReg_160RegClass;
10648 RC = &AMDGPU::VReg_256RegClass;
10651 RC = &AMDGPU::VReg_512RegClass;
10660 return std::make_pair(0U,
nullptr);
10663 RC = &AMDGPU::AGPR_32RegClass;
10666 RC = &AMDGPU::AReg_64RegClass;
10669 RC = &AMDGPU::AReg_128RegClass;
10672 RC = &AMDGPU::AReg_512RegClass;
10675 RC = &AMDGPU::AReg_1024RegClass;
10677 return std::make_pair(0U, RC);
10685 return std::make_pair(0U, RC);
10688 if (Constraint.
size() > 1) {
10689 if (Constraint[1] ==
'v') {
10690 RC = &AMDGPU::VGPR_32RegClass;
10691 }
else if (Constraint[1] ==
's') {
10692 RC = &AMDGPU::SGPR_32RegClass;
10693 }
else if (Constraint[1] ==
'a') {
10694 RC = &AMDGPU::AGPR_32RegClass;
10700 if (!Failed && Idx < RC->getNumRegs())
10709 if (Constraint.
size() == 1) {
10710 switch (Constraint[0]) {
10755 if (ST.isWave32() && !MF.
empty()) {
10765 BuildMI(MBB, I, DL, TII->get(TargetOpcode::IMPLICIT_DEF), AMDGPU::VCC_HI);
10767 for (
auto &MBB : MF) {
10768 for (
auto &
MI : MBB) {
10779 const APInt &DemandedElts,
10781 unsigned Depth)
const {
10793 const Align CacheLineAlign =
Align(64);
10816 unsigned LoopSize = 0;
10821 LoopSize += MBB->getAlignment().value() / 2;
10825 if (LoopSize > 192)
10830 if (LoopSize <= 64)
10833 if (LoopSize <= 128)
10834 return CacheLineAlign;
10840 auto I = Exit->getFirstNonDebugInstr();
10841 if (
I != Exit->end() &&
I->getOpcode() == AMDGPU::S_INST_PREFETCH)
10842 return CacheLineAlign;
10851 TII->get(AMDGPU::S_INST_PREFETCH))
10855 TII->get(AMDGPU::S_INST_PREFETCH))
10859 return CacheLineAlign;
10890 if (MRI.isLiveIn(Reg)) {
10922 cast<ConstantSDNode>(N->
getOperand(0))->getZExtValue());
10925 cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue());
10946 unsigned Depth)
const {
10996 if (RC == &AMDGPU::VReg_1RegClass && !isDivergent)
10998 : &AMDGPU::SReg_32RegClass;
11008 if (!isa<Instruction>(V))
11010 if (!Visited.
insert(V).second)
11012 bool Result =
false;
11013 for (
auto U : V->
users()) {
11014 if (
const IntrinsicInst *Intrinsic = dyn_cast<IntrinsicInst>(U)) {
11015 if (V == U->getOperand(1)) {
11016 switch (Intrinsic->getIntrinsicID()) {
11020 case Intrinsic::amdgcn_if_break:
11021 case Intrinsic::amdgcn_if:
11022 case Intrinsic::amdgcn_else:
11027 if (V == U->getOperand(0)) {
11028 switch (Intrinsic->getIntrinsicID()) {
11032 case Intrinsic::amdgcn_end_cf:
11033 case Intrinsic::amdgcn_loop:
11048 const Value *V)
const {
11049 if (
const IntrinsicInst *Intrinsic = dyn_cast<IntrinsicInst>(V)) {
11050 switch (Intrinsic->getIntrinsicID()) {
11053 case Intrinsic::amdgcn_if_break:
11059 dyn_cast<IntrinsicInst>(ExtValue->getOperand(0))) {
11060 switch (Intrinsic->getIntrinsicID()) {
11063 case Intrinsic::amdgcn_if:
11064 case Intrinsic::amdgcn_else: {
11066 if (Indices.
size() == 1 && Indices[0] == 1) {
11073 if (
const CallInst *CI = dyn_cast<CallInst>(V)) {
11074 if (isa<InlineAsm>(CI->getCalledValue())) {
11079 for (
auto &TC : TargetConstraints) {
11082 unsigned AssignedReg;
11085 SIRI, TC.ConstraintCode, TC.ConstraintVT);
11088 if (AssignedReg != 0 && SIRI->
isSGPRReg(MRI, AssignedReg))
bool hasBCNT(unsigned Size) const
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
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.
unsigned addImplicitBufferPtr(const SIRegisterInfo &TRI)
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
unsigned getFrameOffsetReg() const
static SDValue lowerICMPIntrinsic(const SITargetLowering &TLI, SDNode *N, SelectionDAG &DAG)
unsigned getScratchWaveOffsetReg() const
void setWorkItemIDX(ArgDescriptor Arg)
bool hasDispatchPtr() const
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
constexpr bool isUInt< 32 >(uint64_t x)
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set, or Regs.size() if they are all allocated.
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...
static MVT getIntegerVT(unsigned BitWidth)
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
ArgDescriptor DispatchPtr
bool hasLDSMisalignedBug() const
const MachineInstrBuilder & add(const MachineOperand &MO) const
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
bool hasUsableDSOffset() const
True if the offset field of DS instructions works as expected.
BUILTIN_OP_END - This must be the last enum value in this list.
static void r3(uint32_t &A, uint32_t &B, uint32_t &C, uint32_t &D, uint32_t &E, int I, uint32_t *Buf)
A parsed version of the target data layout string in and methods for querying it. ...
unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const override
Certain targets such as MIPS require that some types such as vectors are always broken down into scal...
reference emplace_back(ArgTypes &&... Args)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred)
getICmpCondCode - Return the ISD condition code corresponding to the given LLVM IR integer condition ...
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
EVT getValueType() const
Return the ValueType of the referenced return value.
bool isLegalGlobalAddressingMode(const AddrMode &AM) const
Interface definition for SIRegisterInfo.
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
void setFuncArgInfo(const Function &F, const AMDGPUFunctionArgInfo &ArgInfo)
static void r2(uint32_t &A, uint32_t &B, uint32_t &C, uint32_t &D, uint32_t &E, int I, uint32_t *Buf)
Register getRegister() const
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
const SDValue & getOffset() const
bool shouldEmitFixup(const GlobalValue *GV) const
bool hasPrivateSegmentBuffer() const
static LLT pointer(unsigned AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space.
unsigned reservedPrivateSegmentBufferReg(const MachineFunction &MF) const
Return the end register initially reserved for the scratch buffer in case spilling is needed...
uint64_t encodeHwreg(uint64_t Id, uint64_t Offset, uint64_t Width)
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
const GlobalValue * getGlobal() const
bool hasApertureRegs() const
bool isDivergent(const Value *V) const
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
This class represents an incoming formal argument to a Function.
Diagnostic information for unsupported feature in backend.
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
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.
AMDGPU specific subclass of TargetSubtarget.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
bool isPSInputAllocated(unsigned Index) const
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
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 getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, const SDLoc &DL)
Return a new CALLSEQ_END node, which always must have a glue result (to ensure it's not CSE'd)...
static ConstantFPSDNode * getSplatConstantFP(SDValue Op)
bool hasPrivateSegmentWaveByteOffset() const
void allocateHSAUserSGPRs(CCState &CCInfo, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
bool hasFlatScrRegister() const
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.
BR_CC - Conditional branch.
This class represents lattice values for constants.
bool getTgtMemIntrinsic(IntrinsicInfo &, const CallInst &, MachineFunction &MF, unsigned IntrinsicID) const override
Given an intrinsic, checks if on the target the intrinsic will need to map to a MemIntrinsicNode (tou...
Address space for 160-bit buffer fat pointers.
Register getLocReg() const
bool hasUsableDivScaleConditionOutput() const
Condition output from div_scale is usable.
void analyzeFormalArgumentsCompute(CCState &State, const SmallVectorImpl< ISD::InputArg > &Ins) const
The SelectionDAGBuilder will automatically promote function arguments with illegal types...
value_iterator value_end() const
Type * getParamType(unsigned i) const
Parameter type accessors.
bool isCompareAndSwap() const
Returns true if this SDNode represents cmpxchg atomic operation, false otherwise. ...
static MVT getVectorVT(MVT VT, unsigned NumElements)
bool supportSplitCSR(MachineFunction *MF) const override
Return true if the target supports that a subset of CSRs for the given machine function is handled ex...
uint64_t getDefaultRsrcDataFormat() const
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
iterator begin() const
begin/end - Return all of the registers in this class.
static bool isBoolSGPR(SDValue V)
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
A Module instance is used to store all the information related to an LLVM module. ...
unsigned getStackPtrOffsetReg() const
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
SDValue scalarizeVectorStore(StoreSDNode *ST, SelectionDAG &DAG) const
2: 32-bit floating point type
static const SDValue getSPDenormModeValue(int SPDenormMode, SelectionDAG &DAG, const SDLoc &SL, const GCNSubtarget *ST)
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain targets require unusual breakdowns of certain types.
SDValue copyToM0(SelectionDAG &DAG, SDValue Chain, const SDLoc &DL, SDValue V) const
bool isVector() const
Return true if this is a vector value type.
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
bool hasStackObjects() const
Return true if there are any stack objects in this function.
bool isAllocated(unsigned Reg) const
isAllocated - Return true if the specified register (or an alias) is allocated.
const SDValue & getBasePtr() const
constexpr uint32_t Lo_32(uint64_t Value)
Return the low 32 bits of a 64 bit value.
const TargetRegisterClass * getEquivalentVGPRClass(const TargetRegisterClass *SRC) const
unsigned getRegister(unsigned i) const
Return the specified register in the class.
bool isNegative() const
Return true if the value is negative.
bool hasFlatGlobalInsts() const
bool canMergeStoresTo(unsigned AS, EVT MemVT, const SelectionDAG &DAG) const override
Returns if it's reasonable to merge stores to MemVT size.
SDValue loadInputValue(SelectionDAG &DAG, const TargetRegisterClass *RC, EVT VT, const SDLoc &SL, const ArgDescriptor &Arg) const
bool supportsMinMaxDenormModes() const
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
void push_back(const T &Elt)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
virtual unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const
Certain targets such as MIPS require that some types such as vectors are always broken down into scal...
iterator getFirstNonDebugInstr()
Returns an iterator to the first non-debug instruction in the basic block, or end().
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
bool useVGPRIndexMode() const
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
void allocateSpecialInputVGPRs(CCState &CCInfo, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
Describe properties that are true of each instruction in the target description file.
void setIsUndef(bool Val=true)
bool hasFmaMixInsts() const
MachineMemOperand::Flags flags
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
const SDValue & getValue() const
unsigned addKernargSegmentPtr(const SIRegisterInfo &TRI)
bool hasImplicitBufferPtr() const
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
SDVTList getVTList() const
This class represents a function call, abstracting a target machine's calling convention.
static ArgDescriptor allocateVGPR32Input(CCState &CCInfo, unsigned Mask=~0u, ArgDescriptor Arg=ArgDescriptor())
Address space for global memory (RAT0, VTX0).
unsigned addWorkGroupIDY()
unsigned getSubReg() const
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
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...
const GCNSubtarget * getSubtarget() const
bool hasAtomicFaddInsts() const
bool hasTrigReducedRange() const
float BitsToFloat(uint32_t Bits)
This function takes a 32-bit integer and returns the bit equivalent float.
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
static bool hasFP32Denormals(const MachineFunction &MF)
unsigned getVectorNumElements() const
const SDValue & getChain() const
Function Alias Analysis Results
SDValue getTokenFactor(const SDLoc &DL, SmallVectorImpl< SDValue > &Vals)
Creates a new TokenFactor containing Vals.
LLVMContext & getContext() const
All values hold a context through their type.
bool mayLoadOrStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read or modify memory.
const SIInstrInfo * getInstrInfo() const override
static const fltSemantics & EVTToAPFloatSemantics(EVT VT)
Returns an APFloat semantics tag appropriate for the given type.
static bool bitOpWithConstantIsReducible(unsigned Opc, uint32_t Val)
unsigned getAlignment() const
unsigned getPSInputAddr() const
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
Return the ValueType of the result of SETCC operations.
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
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...
C - The default llvm calling convention, compatible with C.
bool hasWorkItemIDZ() const
SDNode * legalizeTargetIndependentNode(SDNode *Node, SelectionDAG &DAG) const
Legalize target independent instructions (e.g.
static SDValue getFPTernOp(SelectionDAG &DAG, unsigned Opcode, const SDLoc &SL, EVT VT, SDValue A, SDValue B, SDValue C, SDValue GlueChain)
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
virtual AsmOperandInfoVector ParseConstraints(const DataLayout &DL, const TargetRegisterInfo *TRI, ImmutableCallSite CS) const
Split up the constraint string from the inline assembly value into the specific constraints and their...
bool isInteger() const
Return true if this is an integer or a vector integer type.
bool isAGPR(const MachineRegisterInfo &MRI, unsigned Reg) const
void markPSInputEnabled(unsigned Index)
const TargetRegisterClass * getEquivalentSGPRClass(const TargetRegisterClass *VRC) const
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...
const fltSemantics & getSemantics() const
static APFloat getZero(const fltSemantics &Sem, bool Negative=false)
Factory for Positive and Negative Zero.
1: 16-bit floating point type
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
virtual bool isTypeDesirableForOp(unsigned, EVT VT) const
Return true if the target has native support for the specified value type and it is 'desirable' to us...
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
const SDNodeFlags getFlags() const
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
MachineFunction & getMachineFunction() const
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool isVectorTy() const
True if this is an instance of VectorType.
iv Induction Variable Users
const SDValue & setRoot(SDValue N)
Set the current root tag of the SelectionDAG.
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
LLVM_READONLY int getAtomicNoRetOp(uint16_t Opcode)
bool isByteSized() const
Return true if the bit size is a multiple of 8.
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
CLAMP value between 0.0 and 1.0.
static MachineBasicBlock * emitIndirectDst(MachineInstr &MI, MachineBasicBlock &MBB, const GCNSubtarget &ST)
bool isInlineConstant(const APInt &Imm) const
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1 at the ...
Align getPrefLoopAlignment(MachineLoop *ML) const override
Return the preferred loop alignment.
bool hasFastFMAF32() const
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
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...
Address space for flat memory.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
bool hasDispatchID() const
StringSwitch & Case(StringLiteral S, T Value)
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
const DebugLoc & getDebugLoc() const
Calling convention used for Mesa/AMDPAL geometry shaders.
void legalizeOperands(MachineInstr &MI, MachineDominatorTree *MDT=nullptr) const
Legalize all operands in this instruction.
LLVM_READONLY const MIMGLZMappingInfo * getMIMGLZMappingInfo(unsigned L)
const SIRegisterInfo & getRegisterInfo() const
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
return AArch64::GPR64RegClass contains(Reg)
bool isAllOnesValue() const
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
bool hasWorkItemIDX() const
LLVM_READONLY int getVOPe64(uint16_t Opcode)
bool hasVOP3PInsts() const
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
unsigned getAddressSpace() const
Return the address space for the associated pointer.
A convenience struct that encapsulates a DAG, and two SDValues for returning information from TargetL...
bool hasFlatScratchInit() const
SDValue LowerCall(CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower calls into the specified DAG.
MachineSDNode * wrapAddr64Rsrc(SelectionDAG &DAG, const SDLoc &DL, SDValue Ptr) const
static SDValue emitRemovedIntrinsicError(SelectionDAG &DAG, const SDLoc &DL, EVT VT)
TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(MVT VT) const override
Return the preferred vector type legalization action.
Value * getArgOperand(unsigned i) const
LLVM_READONLY int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx)
unsigned countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
void setPrivateSegmentWaveByteOffset(unsigned Reg)
#define FP_DENORM_FLUSH_NONE
static unsigned numBitsUnsigned(SDValue Op, SelectionDAG &DAG)
uint64_t alignDown(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the largest uint64_t less than or equal to Value and is Skew mod Align.
bool hasOneUse() const
Return true if there is exactly one use of this node.
void setScratchRSrcReg(unsigned Reg)
bool isBeforeLegalize() const
static unsigned findFirstFreeSGPR(CCState &CCInfo)
A description of a memory reference used in the backend.
unsigned DemoteRegister
DemoteRegister - if CanLowerReturn is false, DemoteRegister is a vreg allocated to hold a pointer to ...
static bool elementPairIsContiguous(ArrayRef< int > Mask, int Elt)
static ArgDescriptor createRegister(Register Reg, unsigned Mask=~0u)
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
bool hasDwordx3LoadStores() const
unsigned getBytesInStackArgArea() const
Type * getPointerElementType() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
void setHighBits(unsigned hiBits)
Set the top hiBits bits.
const HexagonInstrInfo * TII
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
bool isSGPRReg(const MachineRegisterInfo &MRI, unsigned Reg) const
Shift and rotation operations.
unsigned getNumOperands() const
Retuns the total number of operands.
static bool isGather4(const MachineInstr &MI)
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
void setHasNonSpillStackObjects(bool StackObject=true)
virtual MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
unsigned addDispatchID(const SIRegisterInfo &TRI)
bool isEntryFunction() const
EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, const AttributeList &FuncAttributes) const override
Returns the target specific optimal type for load and store operations as a result of memset...
static bool isMIMG(const MachineInstr &MI)
void setIfReturnsVoid(bool Value)
bool isKnownNeverNaNForTargetNode(SDValue Op, const SelectionDAG &DAG, bool SNaN=false, unsigned Depth=0) const override
If SNaN is false,.
SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
The returned value is undefined.
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), MachineInstr opcode, and operands.
bool IEEE
Floating point opcodes that support exception flag gathering quiet and propagate signaling NaN inputs...
BinOp getOperation() const
bool isMemOpUniform(const SDNode *N) const
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, int64_t Offset)
Create an add instruction with appropriate flags when used for addressing some offset of an object...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
static unsigned SubIdx2Lane(unsigned Idx)
Helper function for adjustWritemask.
CopyToReg - This node has three operands: a chain, a register number to set to this value...
ArrayRef< MachineMemOperand * > memoperands() const
MachineOperand buildExtractSubRegOrImm(MachineBasicBlock::iterator MI, MachineRegisterInfo &MRI, MachineOperand &SuperReg, const TargetRegisterClass *SuperRC, unsigned SubIdx, const TargetRegisterClass *SubRC) const
static bool mayTailCallThisCC(CallingConv::ID CC)
Return true if we might ever do TCO for calls with this calling convention.
bool isIntegerTy() const
True if this is an instance of IntegerType.
op_iterator op_end() const
bool hasD16Images() const
uint64_t getConstantOperandVal(unsigned i) const
LLVM_NODISCARD R Default(T Value)
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
static ArgDescriptor allocateSGPR64Input(CCState &CCInfo)
static MVT memVTFromAggregate(Type *Ty)
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
The memory access is dereferenceable (i.e., doesn't trap).
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) For double-word atomic operations: ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) These correspond to the atomicrmw instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
bool isTrapHandlerEnabled() const
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...
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
Address space for 32-bit constant memory.
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
This is an SDNode representing atomic operations.
int getMaskedMIMGOp(unsigned Opc, unsigned NewChannels)
uint64_t getNumElements() const
For scalable vectors, this will return the minimum number of elements in the vector.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned 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.
LocInfo getLocInfo() const
Align commonAlignment(Align A, Align B)
Returns the alignment that satisfies both alignments.
bool isSGPRClass(const TargetRegisterClass *RC) const
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...
Align getAlignment() const
Return alignment of the basic block.
This file implements a class to represent arbitrary precision integral constant values and operations...
INLINEASM - Represents an inline asm block.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
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 isSDNodeSourceOfDivergence(const SDNode *N, FunctionLoweringInfo *FLI, LegacyDivergenceAnalysis *DA) const override
BlockT * getHeader() const
SmallVector< ISD::InputArg, 32 > Ins
void legalizeOperandsVOP3(MachineRegisterInfo &MRI, MachineInstr &MI) const
Fix operands in MI to satisfy constant bus requirements.
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
static void reservePrivateMemoryRegs(const TargetMachine &TM, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info)
Address space for region memory. (GDS)
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
InstrTy * getInstruction() const
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...
Class to represent function types.
unsigned getNextStackOffset() const
getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment r...
int64_t getSExtValue() const
Get sign extended value.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
SDValue SplitVectorLoad(SDValue Op, SelectionDAG &DAG) const
Split a vector load into 2 loads of half the vector.
Type * getType() const
All values are typed, get the type of this value.
MachineFunction & getMachineFunction() const
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose...
void setStackPtrOffsetReg(unsigned Reg)
void limitOccupancy(const MachineFunction &MF)
static unsigned getBufferOffsetForMMO(SDValue VOffset, SDValue SOffset, SDValue Offset, SDValue VIndex=SDValue())
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
void clearKillFlags(unsigned Reg) const
clearKillFlags - Iterate over all the uses of the given register and clear the kill flag from the Mac...
TypeSize getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
bool useFlatForGlobal() const
SDValue getRegisterMask(const uint32_t *RegMask)
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I=nullptr) const override
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
bool splitMUBUFOffset(uint32_t Imm, uint32_t &SOffset, uint32_t &ImmOffset, const GCNSubtarget *Subtarget, uint32_t Align)
static cl::opt< bool > DisableLoopAlignment("amdgpu-disable-loop-alignment", cl::desc("Do not align and prefetch loops"), cl::init(false))
LLVM_READONLY MachineOperand * getNamedOperand(MachineInstr &MI, unsigned OperandName) const
Returns the operand named Op.
const TargetMachine & getTarget() const
bool shouldEmitGOTReloc(const GlobalValue *GV) const
Simple integer binary arithmetic operators.
static ArgDescriptor createArg(const ArgDescriptor &Arg, unsigned Mask)
SITargetLowering(const TargetMachine &tm, const GCNSubtarget &STI)
SmallVector< ISD::OutputArg, 32 > Outs
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
void allocateSpecialInputSGPRs(CCState &CCInfo, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
Align getStackAlignment() const
static bool vectorEltWillFoldAway(SDValue Op)
GlobalValue * getNamedValue(StringRef Name) const
Return the global value in the module with the specified name, of arbitrary type. ...
static LLVM_ATTRIBUTE_UNUSED bool isCopyFromRegOfInlineAsm(const SDNode *N)
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
bool enableAggressiveFMAFusion(EVT VT) const override
Return true if target always beneficiates from combining into FMA for a given value type...
LLVM_NODISCARD size_t size() const
size - Get the string size.
const ImageDimIntrinsicInfo * getImageDimIntrinsicInfo(unsigned Intr)
static unsigned minMaxOpcToMin3Max3Opc(unsigned Opc)
uint32_t getImplicitParameterOffset(const MachineFunction &MF, const ImplicitParameter Param) const
Helper function that returns the byte offset of the given type of implicit parameter.
static SDValue lowerFCMPIntrinsic(const SITargetLowering &TLI, SDNode *N, SelectionDAG &DAG)
ConstraintType getConstraintType(StringRef Constraint) const override
Given a constraint, return the type of constraint it is for this target.
bool FP32Denormals
If this is set, neither input or output denormals are flushed for most f32 instructions.
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
LLVM_READONLY const MIMGBaseOpcodeInfo * getMIMGBaseOpcodeInfo(unsigned BaseOpcode)
cmpResult
IEEE-754R 5.11: Floating Point Comparison Relations.
bool isKnownNeverNaN(SDValue Op, bool SNaN=false, unsigned Depth=0) const
Test whether the given SDValue is known to never be NaN.
std::pair< SDValue, SDValue > split64BitValue(SDValue Op, SelectionDAG &DAG) const
Return 64-bit value Op as two 32-bit integers.
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
op_iterator op_begin() const
static SDValue getLoadExtOrTrunc(SelectionDAG &DAG, ISD::LoadExtType ExtType, SDValue Op, const SDLoc &SL, EVT VT)
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...
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
ISD::CondCode getFCmpCondCode(FCmpInst::Predicate Pred)
getFCmpCondCode - Return the ISD condition code corresponding to the given LLVM IR floating-point con...
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool getAddrModeArguments(IntrinsicInst *, SmallVectorImpl< Value *> &, Type *&) const override
CodeGenPrepare sinks address calculations into the same BB as Load/Store instructions reading the add...
SDValue getSplatBuildVector(EVT VT, const SDLoc &DL, SDValue Op)
Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all elements. ...
void insertCopiesSplitCSR(MachineBasicBlock *Entry, const SmallVectorImpl< MachineBasicBlock *> &Exits) const override
Insert explicit copies in entry and exit blocks.
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
bool parametersInCSRMatch(const MachineRegisterInfo &MRI, const uint32_t *CallerPreservedMask, const SmallVectorImpl< CCValAssign > &ArgLocs, const SmallVectorImpl< SDValue > &OutVals) const
Check whether parameters to a call that are passed in callee saved registers are the same as from the...
unsigned getUndefRegState(bool B)
void markPSInputAllocated(unsigned Index)
bool hasWorkGroupIDX() const
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
static SDValue emitNonHSAIntrinsicError(SelectionDAG &DAG, const SDLoc &DL, EVT VT)
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
static bool parseTexFail(SDValue TexFailCtrl, SelectionDAG &DAG, SDValue *TFE, SDValue *LWE, bool &IsTexFail)
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, MachineMemOperand *MMO)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands...
unsigned getSrcAddressSpace() const
static bool hasFP64FP16Denormals(const MachineFunction &MF)
Value * getOperand(unsigned i) const
Analysis containing CSE Info
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
Class to represent pointers.
unsigned getByValSize() const
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
SDValue splitBinaryVectorOp(SDValue Op, SelectionDAG &DAG) const
Flag
These should be considered private to the implementation of the MCInstrDesc class.
bool hasAllowReciprocal() const
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
TargetInstrInfo - Interface to description of machine instruction set.
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
const Value * getValue() const
Return the base address of the memory access.
Calling convention used for Mesa/AMDPAL compute shaders.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
bool hasUnalignedBufferAccess() const
11: Arbitrary bit width integers
bool hasDot2Insts() const
bool hasAllowContract() const
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
The memory access is volatile.
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
const SDValue & getBasePtr() const
static bool fp16SrcZerosHighBits(unsigned Opc)
A switch()-like statement whose cases are string literals.
initializer< Ty > init(const Ty &Val)
int64_t getOffset() const
std::vector< AsmOperandInfo > AsmOperandInfoVector
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
SDValue performRcpCombine(SDNode *N, DAGCombinerInfo &DCI) const
FPOpFusion::FPOpFusionMode AllowFPOpFusion
AllowFPOpFusion - This flag is set by the -fuse-fp-ops=xxx option.
Control flow instructions. These all have token chains.
bool isMemOpHasNoClobberedMemOperand(const SDNode *N) const
bool isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, EVT VT) const override
Return true if an FMA operation is faster than a pair of fmul and fadd instructions.
const AMDGPUGWSResourcePseudoSourceValue * getGWSPSV(const SIInstrInfo &TII)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void setFrameOffsetReg(unsigned Reg)
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
MachineBasicBlock * splitKillBlock(MachineInstr &MI, MachineBasicBlock *BB) const
constexpr bool isUInt< 8 >(uint64_t x)
unsigned const MachineRegisterInfo * MRI
const MCInstrDesc & getKillTerminatorFromPseudo(unsigned Opcode) const
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
unsigned getKnownHighZeroBitsForFrameIndex() const
Return the number of high bits known to be zero fror a frame index.
unsigned addWorkGroupInfo()
unsigned reservedPrivateSegmentWaveByteOffsetReg(const MachineFunction &MF) const
Return the end register initially reserved for the scratch wave offset in case spilling is needed...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
The instances of the Type class are immutable: once they are created, they are never changed...
void allocateSpecialEntryInputVGPRs(CCState &CCInfo, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
This is an important class for using LLVM in a threaded context.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type...
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
Simple binary floating point operators.
SDValue storeStackInputValue(SelectionDAG &DAG, const SDLoc &SL, SDValue Chain, SDValue ArgVal, int64_t Offset) const
void setTargetDAGCombine(ISD::NodeType NT)
Targets should invoke this method for each target independent node that they want to provide a custom...
bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
bool isMachineOpcode() const
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
size_t size() const
size - Get the array size.
SDNode * PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const override
Fold the instructions after selecting them.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
unsigned getReturnAddressReg(const MachineFunction &MF) const
void fixImplicitOperands(MachineInstr &MI) const
const RsrcIntrinsic * lookupRsrcIntrinsic(unsigned Intr)
constexpr char WavefrontSize[]
Key for Kernel::CodeProps::Metadata::mWavefrontSize.
const SDValue & getOperand(unsigned Num) const
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
bool hasBitPreservingFPLogic(EVT VT) const override
Return true if it is safe to transform an integer-domain bitwise operation into the equivalent floati...
std::pair< const ArgDescriptor *, const TargetRegisterClass * > getPreloadedValue(PreloadedValue Value) const
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
bool isKnownNeverSNaN(SDValue Op, unsigned Depth=0) const
bool has16BitInsts() const
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
bool isEntryFunctionCC(CallingConv::ID CC)
SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize, const SDLoc &DL)
Return a new CALLSEQ_START node, that starts new call frame, in which InSize bytes are set up inside ...
static bool isUniformMMO(const MachineMemOperand *MMO)
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
bool isEligibleForTailCallOptimization(SDValue Callee, CallingConv::ID CalleeCC, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SmallVectorImpl< ISD::InputArg > &Ins, SelectionDAG &DAG) const
std::pair< SDValue, SDValue > SplitVectorOperand(const SDNode *N, unsigned OpNo)
Split the node's operand with EXTRACT_SUBVECTOR and return the low/high part.
AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all...
virtual SDValue LowerGlobalAddress(AMDGPUMachineFunction *MFI, SDValue Op, SelectionDAG &DAG) const
virtual void computeKnownBitsForFrameIndex(const SDValue FIOp, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const
Determine which of the bits of FrameIndex FIOp are known to be 0.
const AMDGPUBufferPseudoSourceValue * getBufferPSV(const SIInstrInfo &TII, const Value *BufferRsrc)
void setType(unsigned VReg, LLT Ty)
Set the low-level type of VReg to Ty.
bool isKnownNeverNaNForTargetNode(SDValue Op, const SelectionDAG &DAG, bool SNaN=false, unsigned Depth=0) const override
If SNaN is false,.
SI DAG Lowering interface definition.
virtual Align getPrefLoopAlignment(MachineLoop *ML=nullptr) const
Return the preferred loop alignment.
static std::pair< MachineBasicBlock *, MachineBasicBlock * > splitBlockForLoop(MachineInstr &MI, MachineBasicBlock &MBB, bool InstInLoop)
const SIFrameLowering * getFrameLowering() const override
unsigned getDestAddressSpace() const
AMDGPU::SIModeRegisterDefaults getMode() const
bool isIntrinsicSourceOfDivergence(unsigned IntrID)
bool mayBeEmittedAsTailCall(const CallInst *) const override
Return true if the target may be able emit the call instruction as a tail call.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This class provides iterator support for SDUse operands that use a specific SDNode.
std::pair< SDValue, SDValue > scalarizeVectorLoad(LoadSDNode *LD, SelectionDAG &DAG) const
Turn load of vector type into a load of the individual elements.
bool isExactlyValue(double V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
bool hasLDSFPAtomics() const
bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side...
MachineBasicBlock::instr_iterator begin() const
Return an iterator to the first bundled instruction.
unsigned getMachineOpcode() const
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
#define LLVM_ATTRIBUTE_UNUSED
static SDValue constructRetValue(SelectionDAG &DAG, MachineSDNode *Result, ArrayRef< EVT > ResultTypes, bool IsTexFail, bool Unpacked, bool IsD16, int DMaskPop, int NumVDataDwords, const SDLoc &DL, LLVMContext &Context)
unsigned getAddressSpace() const
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
void setOffset(int64_t NewOffset)
bool DX10Clamp
Used by the vector ALU to force DX10-style treatment of NaNs: when set, clamp NaN to zero; otherwise...
unsigned addQueuePtr(const SIRegisterInfo &TRI)
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
static unsigned getMOVRELDPseudo(const SIRegisterInfo &TRI, const TargetRegisterClass *VecRC)
TRAP - Trapping instruction.
bool hasWorkItemIDY() const
bool bitsLE(MVT VT) const
Return true if this has no more bits than VT.
const APInt & getAPIntValue() const
Generation getGeneration() const
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline...
const Triple & getTargetTriple() const
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
static ArgDescriptor createStack(unsigned Offset, unsigned Mask=~0u)
static bool resultsCompatible(CallingConv::ID CalleeCC, CallingConv::ID CallerCC, MachineFunction &MF, LLVMContext &C, const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn CalleeFn, CCAssignFn CallerFn)
Returns true if the results of the two calling conventions are compatible.
DEBUGTRAP - Trap intended to get the attention of a debugger.
static SDValue getMad64_32(SelectionDAG &DAG, const SDLoc &SL, EVT VT, SDValue N0, SDValue N1, SDValue N2, bool Signed)
#define FP_DENORM_FLUSH_IN_FLUSH_OUT
SDNode * getGluedNode() const
If this node has a glue operand, return the node to which the glue operand points.
void RemoveDeadNode(SDNode *N)
Remove the specified node from the system.
self_iterator getIterator()
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
bool hasWorkGroupIDY() const
virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
CondCode getSetCCSwappedOperands(CondCode Operation)
Return the operation corresponding to (Y op X) when given the operation for (X op Y)...
static MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
static std::pair< unsigned, int > computeIndirectRegAndOffset(const SIRegisterInfo &TRI, const TargetRegisterClass *SuperRC, unsigned VecReg, int Offset)
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
AMDGPUFunctionArgInfo & getArgInfo()
The AMDGPU TargetMachine interface definition for hw codgen targets.
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/...
static void r1(uint32_t &A, uint32_t &B, uint32_t &C, uint32_t &D, uint32_t &E, int I, uint32_t *Buf)
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...
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
BlockT * getExitBlock() const
If getExitBlocks would return exactly one block, return that block.
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
static MachineBasicBlock * emitIndirectSrc(MachineInstr &MI, MachineBasicBlock &MBB, const GCNSubtarget &ST)
const Pass * getPass() const
void setScratchWaveOffsetReg(unsigned Reg)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
SDValue expandFMINNUM_FMAXNUM(SDNode *N, SelectionDAG &DAG) const
Expand fminnum/fmaxnum into fminnum_ieee/fmaxnum_ieee with quieted inputs.
const MachineBasicBlock & front() const
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
This structure contains all information that is necessary for lowering calls.
bool hasUnalignedScratchAccess() const
const TargetMachine & getTargetMachine() const
This class contains a discriminated union of information about pointers in memory operands...
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
unsigned getNumOperands() const
Return the number of values used by this operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
TrapHandlerAbi getTrapHandlerAbi() const
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
constexpr char NumSGPRs[]
Key for Kernel::CodeProps::Metadata::mNumSGPRs.
bool hasImplicitArgPtr() const
This struct is a compact representation of a valid (non-zero power of two) alignment.
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value...
unsigned addDispatchPtr(const SIRegisterInfo &TRI)
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...
Triple - Helper class for working with autoconf configuration names.
ConstantFPSDNode * isConstOrConstSplatFP(SDValue N, bool AllowUndefs=false)
Returns the SDNode if it is a constant splat BuildVector or constant float.
int getMIMGOpcode(unsigned BaseOpcode, unsigned MIMGEncoding, unsigned VDataDwords, unsigned VAddrDwords)
static CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg)
Selects the correct CCAssignFn for a given CallingConvention value.
bool hasUnpackedD16VMem() const
unsigned getAddressSpace() const
unsigned getQueuePtrUserSGPR() const
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
The memory access writes data.
void setHasExtractBitsInsn(bool hasExtractInsn=true)
Tells the code generator that the target has BitExtract instructions.
bool getScalarizeGlobalBehavior() const
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
uint64_t getNullPointerValue(unsigned AddrSpace) const
Get the integer value of a null pointer in the given address space.
static bool setM0ToIndexFromSGPR(const SIInstrInfo *TII, MachineRegisterInfo &MRI, MachineInstr &MI, int Offset, bool UseGPRIdxMode, bool IsIndirectSrc)
void allocateSystemSGPRs(CCState &CCInfo, MachineFunction &MF, SIMachineFunctionInfo &Info, CallingConv::ID CallConv, bool IsShader) const
bool hasFlatAddressSpace() const
unsigned getWavefrontSize() const
static SDValue buildPCRelGlobalAddress(SelectionDAG &DAG, const GlobalValue *GV, const SDLoc &DL, unsigned Offset, EVT PtrVT, unsigned GAFlags=SIInstrInfo::MO_NONE)
SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type...
SDValue addTokenForArgument(SDValue Chain, SelectionDAG &DAG, MachineFrameInfo &MFI, int ClobberedFI) const
bool allowsMemoryAccessForAlignment(LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace=0, unsigned Alignment=1, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, bool *Fast=nullptr) const
This function returns true if the memory access is aligned or if the target allows this specific unal...
MachineBasicBlock * emitGWSMemViolTestLoop(MachineInstr &MI, MachineBasicBlock *BB) const
static bool isUndef(ArrayRef< int > Mask)
static ArgDescriptor allocateSGPR32InputImpl(CCState &CCInfo, const TargetRegisterClass *RC, unsigned NumArgRegs)
TokenFactor - This node takes multiple tokens as input and produces a single token result...
MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override
EVT is not used in-tree, but is used by out-of-tree target.
int pseudoToMCOpcode(int Opcode) const
Return a target-specific opcode if Opcode is a pseudo instruction.
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
MachineSDNode * buildRSRC(SelectionDAG &DAG, const SDLoc &DL, SDValue Ptr, uint32_t RsrcDword1, uint64_t RsrcDword2And3) const
Return a resource descriptor with the 'Add TID' bit enabled The TID (Thread ID) is multiplied by the ...
const TargetLowering & getTargetLoweringInfo() const
Iterator for intrusive lists based on ilist_node.
bool isFPExtFoldable(const SelectionDAG &DAG, unsigned Opcode, EVT DestVT, EVT SrcVT) const override
Return true if an fpext operation input to an Opcode operation is free (for instance, because half-precision floating-point numbers are implicitly extended to float-precision) for an FMA instruction.
virtual unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const
Certain targets require unusual breakdowns of certain types.
CCState - This class holds information needed while lowering arguments and return values...
void setNoUnsignedWrap(bool b)
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned TargetFlags=0)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
unsigned countPopulation(T Value)
Count the number of set bits in a value.
unsigned getWavefrontSize(const MCSubtargetInfo *STI)
static ArgDescriptor allocateSGPR32Input(CCState &CCInfo)
bool haveRoundOpsF64() const
Have v_trunc_f64, v_ceil_f64, v_rndne_f64.
static uint32_t getPermuteMask(SelectionDAG &DAG, SDValue V)
bool hasDenormModeInst() const
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
This is the shared class of boolean and integer constants.
bool hasKernargSegmentPtr() const
Returns platform specific canonical encoding of a floating point number.
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
EVT getVectorElementType() const
Given a vector type, return the type of each element.
testing::Matcher< const detail::ErrorHolder & > Failed()
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
unsigned getLDSSize() const
SDValue splitTernaryVectorOp(SDValue Op, SelectionDAG &DAG) const
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
SDValue lowerUnhandledCall(CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals, StringRef Reason) const
bool hasMadMixInsts() const
static uint64_t add(uint64_t LeftOp, uint64_t RightOp)
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...
Address space for local memory.
ADDRSPACECAST - This operator converts between pointers of different address spaces.
MachineOperand class - Representation of each machine instruction operand.
value_iterator value_begin() const
Calling convention used for Mesa/AMDPAL pixel shaders.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
unsigned getScratchRSrcReg() const
Returns the physical register reserved for use as the resource descriptor for scratch accesses...
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
const DebugLoc & getDebugLoc() const
bool isFMADLegalForFAddFSub(const SelectionDAG &DAG, const SDNode *N) const override
Returns true if the FADD or FSUB node passed could legally be combined with an fmul to form an ISD::F...
CCValAssign - Represent assignment of one arg/retval to a location.
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool AlwaysInline, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
bool isFreeAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override
Returns true if a cast from SrcAS to DestAS is "cheap", such that e.g.
SDValue WidenVectorLoad(SDValue Op, SelectionDAG &DAG) const
Widen a vector load from vec3 to vec4.
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
BRCOND - Conditional branch.
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
FMINNUM_IEEE/FMAXNUM_IEEE - Perform floating-point minimum or maximum on two values, following the IEEE-754 2008 definition.
An SDNode that represents everything that will be needed to construct a MachineInstr.
Promote Memory to Register
bool hasMin3Max3_16() const
Byte Swap and Counting operators.
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
static SDValue getFPBinOp(SelectionDAG &DAG, unsigned Opcode, const SDLoc &SL, EVT VT, SDValue A, SDValue B, SDValue GlueChain)
This is an abstract virtual class for memory operations.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
LLVM_READNONE bool isKernel(CallingConv::ID CC)
TypeSize getScalarSizeInBits() const
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static uint32_t getConstantPermuteMask(uint32_t C)
static MachineBasicBlock::iterator loadM0FromVGPR(const SIInstrInfo *TII, MachineBasicBlock &MBB, MachineInstr &MI, unsigned InitResultReg, unsigned PhiReg, int Offset, bool UseGPRIdxMode, bool IsIndirectSrc)
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.
SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &DL, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower the incoming (formal) arguments, described by the Ins array...
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
LLVM_READONLY const MIMGMIPMappingInfo * getMIMGMIPMappingInfo(unsigned L)
MachineInstr * getUniqueVRegDef(unsigned Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
const Function & getFunction() const
Return the LLVM function that this machine code represents.
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
static SDNode * findUser(SDValue Value, unsigned Opcode)
Helper function for LowerBRCOND.
const TargetRegisterClass * getRegClassForReg(const MachineRegisterInfo &MRI, unsigned Reg) const
void setWorkItemIDZ(ArgDescriptor Arg)
static bool allUsesHaveSourceMods(const SDNode *N, unsigned CostThreshold=4)
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
unsigned getPrivateSegmentWaveByteOffsetSystemSGPR() const
Class to represent vector types.
SDNode * isConstantIntBuildVectorOrConstantInt(SDValue N)
Test whether the given value is a constant int or similar node.
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...
EVT getMemoryVT() const
Return the type of the in-memory value.
Target - Wrapper for Target specific information.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
Class for arbitrary precision integers.
unsigned getByValAlign() const
virtual void ComputeConstraintToUse(AsmOperandInfo &OpInfo, SDValue Op, SelectionDAG *DAG=nullptr) const
Determines the constraint code and constraint type to use for the specific AsmOperandInfo, setting OpInfo.ConstraintCode and OpInfo.ConstraintType.
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
amdgpu Simplify well known AMD library false FunctionCallee Callee
bool isShader(CallingConv::ID cc)
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
void finalizeLowering(MachineFunction &MF) const override
Execute target specific actions to finalize target lowering.
static SDValue getBuildDwordsVector(SelectionDAG &DAG, SDLoc DL, ArrayRef< SDValue > Elts)
bool sge(const APInt &RHS) const
Signed greater or equal comparison.
static use_iterator use_end()
iterator_range< user_iterator > users()
ZERO_EXTEND - Used for integer types, zeroing the new bits.
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, LLVMContext &Context) const override
This hook should be implemented to check whether the return values described by the Outs array can fi...
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
ANY_EXTEND - Used for integer types. The high bits are undefined.
static unsigned numBitsSigned(SDValue Op, SelectionDAG &DAG)
int getLDSBankCount() const
iterator insert(iterator I, T &&Elt)
void replaceRegWith(unsigned FromReg, unsigned ToReg)
replaceRegWith - Replace all instances of FromReg with ToReg in the machine function.
SDValue expandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG) const
Expands an unaligned store to 2 half-size stores for integer values, and possibly more for vectors...
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
int getMaskElt(unsigned Idx) const
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
Assign the register class depending on the number of bits set in the writemask.
LLVM_READONLY const MIMGDimInfo * getMIMGDimInfo(unsigned DimEnum)
static bool isFlatGlobalAddrSpace(unsigned AS)
static bool isVOP3(const MachineInstr &MI)
static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit)
Get a value with a block of bits set.
unsigned addPrivateSegmentBuffer(const SIRegisterInfo &TRI)
Flags
Flags values. These may be or'd together.
bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override
Returns true if a cast between SrcAS and DestAS is a noop.
const MachineBasicBlock * getParent() const
unsigned addFlatScratchInit(const SIRegisterInfo &TRI)
static CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg)
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
The memory access reads data.
std::pair< const ArgDescriptor *, const TargetRegisterClass * > getPreloadedValue(AMDGPUFunctionArgInfo::PreloadedValue Value) const
unsigned getPSInputEnable() const
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
LoopT * getParentLoop() const
bool isLiveIn(unsigned Reg) const
void bundleInstWithWaitcnt(MachineInstr &MI) const
Insert MI into a BUNDLE with an S_WAITCNT 0 immediately following it.
Provides AMDGPU specific target descriptions.
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
These are IR-level optimization flags that may be propagated to SDNodes.
static SDValue buildSMovImm32(SelectionDAG &DAG, const SDLoc &DL, uint64_t Val)
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...
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
SmallVector< SDValue, 32 > OutVals
Interface definition for SIInstrInfo.
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent) const override
Return the register class that should be used for the specified value type.
constexpr bool isShiftedMask_64(uint64_t Value)
Return true if the argument contains a non-empty sequence of ones with the remainder zero (64 bit ver...
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, unsigned Align, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, bool *IsFast=nullptr) const override
Determine if the target supports unaligned memory accesses.
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
bool isVector() const
Return true if this is a vector value type.
unsigned AllocateStack(unsigned Size, unsigned Alignment)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
bool isFunctionTy() const
True if this is an instance of FunctionType.
bool isCanonicalized(SelectionDAG &DAG, SDValue Op, unsigned MaxDepth=5) const
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Bitwise operators - logical and, logical or, logical xor.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
unsigned getLocMemOffset() const
LLVM_NODISCARD bool empty() const
static MachineBasicBlock::iterator emitLoadM0FromVGPRLoop(const SIInstrInfo *TII, MachineRegisterInfo &MRI, MachineBasicBlock &OrigBB, MachineBasicBlock &LoopBB, const DebugLoc &DL, const MachineOperand &IdxReg, unsigned InitReg, unsigned ResultReg, unsigned PhiReg, unsigned InitSaveExecReg, int Offset, bool UseGPRIdxMode, bool IsIndirectSrc)
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
static bool isClampZeroToOne(SDValue A, SDValue B)
PointerUnion< const Value *, const PseudoSourceValue * > ptrVal
Establish a view to a call site for examination.
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...
const Function * getParent() const
Return the enclosing method, or null if none.
Calling convention used for Mesa vertex shaders, or AMDPAL last shader stage before rasterization (ve...
bool isShuffleMaskLegal(ArrayRef< int >, EVT) const override
Targets can use this to indicate that they only support some VECTOR_SHUFFLE operations, those with specific masks.
bool allowsMisalignedMemoryAccessesImpl(unsigned Size, unsigned AS, unsigned Align, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, bool *IsFast=nullptr) const
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Flags getFlags() const
Return the raw flags of the source value,.
const MachineInstrBuilder & cloneMemRefs(const MachineInstr &OtherMI) const
MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
The memory access always returns the same value (or traps).
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
bool hasFlatInstOffsets() const
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
SDValue getShiftAmountConstant(uint64_t Val, EVT VT, const SDLoc &DL, bool LegalTypes=true)
bool isAmdHsaOrMesa(const Function &F) const
static bool parseCachePolicy(SDValue CachePolicy, SelectionDAG &DAG, SDValue *GLC, SDValue *SLC, SDValue *DLC)
bool shouldEmitConstantsToTextSection(const Triple &TT)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool denormalsEnabledForType(const SelectionDAG &DAG, EVT VT) const
Type * getValueType() const
SDValue splitUnaryVectorOp(SDValue Op, SelectionDAG &DAG) const
const Value * getValueFromVirtualReg(unsigned Vreg)
This method is called from TargetLowerinInfo::isSDNodeSourceOfDivergence to get the Value correspondi...
unsigned addWorkGroupIDZ()
bool FP64FP16Denormals
If this is set, neither input or output denormals are flushed for both f64 and f16/v2f16 instructions...
static void r0(uint32_t &A, uint32_t &B, uint32_t &C, uint32_t &D, uint32_t &E, int I, uint32_t *Buf)
unsigned getOpcode() const
FSINCOS - Compute both fsin and fcos as a single operation.
Address space for private memory.
virtual bool requiresUniformRegister(MachineFunction &MF, const Value *V) const override
Allows target to decide about the register class of the specific value that is live outside the defin...
SDValue getValue(unsigned R) const
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
static APFloat getLargest(const fltSemantics &Sem, bool Negative=false)
Returns the largest finite number in the given semantics.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
bool isInfinity() const
Return true if the value is an infinity.
constexpr bool isUInt< 16 >(uint64_t x)
void setSimpleHint(unsigned VReg, unsigned PrefReg)
Specify the preferred (target independent) register allocation hint for the specified virtual registe...
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getCondCode(ISD::CondCode Cond)
static bool isFrameIndexOp(SDValue Op)
bool hasWorkGroupInfo() const
const MachinePointerInfo & getPointerInfo() const
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, uint64_t Size=0, const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
unsigned addPrivateSegmentWaveByteOffset()
bool hasFnAttribute(Attribute::AttrKind Kind) const
Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but may be faster. ...
bool memoperands_empty() const
Return true if we don't have any memory operands which described the memory access done by this instr...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
void insert(iterator MBBI, MachineBasicBlock *MBB)
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
LegalizeTypeAction
This enum indicates whether a types are legal for a target, and if not, what action should be used to...
static bool canGuaranteeTCO(CallingConv::ID CC)
void setReturnAddressIsTaken(bool s)
INLINEASM_BR - Terminator version of inline asm. Used by asm-goto.
TypeSize getScalarSizeInBits() const
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
static MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
constexpr uint32_t Hi_32(uint64_t Value)
Return the high 32 bits of a 64 bit value.
ArrayRef< int > getMask() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
FMA - Perform a * b + c with no intermediate rounding step.
const AMDGPUImagePseudoSourceValue * getImagePSV(const SIInstrInfo &TII, const Value *ImgRsrc)
SDValue getRegister(unsigned Reg, EVT VT)
Fast - This calling convention attempts to make calls as fast as possible (e.g.
SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either any-extending or truncat...
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
virtual void finalizeLowering(MachineFunction &MF) const
Execute target specific actions to finalize target lowering.
EVT changeTypeToInteger()
Return the type converted to an equivalently sized integer or vector with integer element type...
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
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.
bool hasNoUnsignedWrap() const
SDValue getValueType(EVT)
const MCOperandInfo * OpInfo
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.
static SDValue adjustLoadValueTypeImpl(SDValue Result, EVT LoadVT, const SDLoc &DL, SelectionDAG &DAG, bool Unpacked)
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...
void computeKnownBitsForFrameIndex(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
Determine which of the bits of FrameIndex FIOp are known to be 0.
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone...
static EVT getEquivalentMemType(LLVMContext &Context, EVT VT)
Primary interface to the complete machine description for the target machine.
bool hasWorkGroupIDZ() const
Type * getElementType() const
const APFloat & getValueAPF() const
bool isLegalFLATOffset(int64_t Offset, unsigned AddrSpace, bool Signed) const
Returns if Offset is legal for the subtarget as the offset to a FLAT encoded instruction.
static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)
Stack pointer relative access.
void setRegClass(unsigned Reg, const TargetRegisterClass *RC)
setRegClass - Set the register class of the specified virtual register.
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.
void RemoveOperand(unsigned OpNo)
Erase an operand from an instruction, leaving it with one fewer operand than it started with...
APInt bitcastToAPInt() const
void setWorkItemIDY(ArgDescriptor Arg)
SDValue SplitVectorStore(SDValue Op, SelectionDAG &DAG) const
Split a vector store into 2 stores of half the vector.
bool bitsEq(EVT VT) const
Return true if this has the same number of bits as VT.
unsigned getNumOperands() const
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
Register getReg() const
getReg - Returns the register number.
bool isTypeDesirableForOp(unsigned Op, EVT VT) const override
Return true if the target has native support for the specified value type and it is 'desirable' to us...
const SDValue & getOperand(unsigned i) const
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
uint64_t getZExtValue() const
TRUNCATE - Completely drop the high bits.
This holds information about one operand of a machine instruction, indicating the register class for ...
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
void passSpecialInputs(CallLoweringInfo &CLI, CCState &CCInfo, const SIMachineFunctionInfo &Info, SmallVectorImpl< std::pair< unsigned, SDValue >> &RegsToPass, SmallVectorImpl< SDValue > &MemOpChains, SDValue Chain) const
SDValue LowerCallResult(SDValue Chain, SDValue InFlag, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &DL, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals, bool isThisReturn, SDValue ThisVal) const
void setBytesInStackArgArea(unsigned Bytes)
std::pair< unsigned, unsigned > getFlatWorkGroupSizes(const Function &F) const
unsigned AllocateReg(unsigned Reg)
AllocateReg - Attempt to allocate one register.
AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all...
unsigned addWorkGroupIDX()
unsigned getLiveInVirtReg(unsigned PReg) const
getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in physical ...
void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand *> NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
const MachineOperand & getOperand(unsigned i) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
iterator_range< block_iterator > blocks() const
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *BB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
void finalizeBundle(MachineBasicBlock &MBB, MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
finalizeBundle - Finalize a machine instruction bundle which includes a sequence of instructions star...
Perform various unary floating-point operations inspired by libm.
static bool hasCFUser(const Value *V, SmallPtrSet< const Value *, 16 > &Visited)
Calling convention for AMDGPU code object kernels.
unsigned getMaxPrivateElementSize() const
static void processShaderInputArgs(SmallVectorImpl< ISD::InputArg > &Splits, CallingConv::ID CallConv, ArrayRef< ISD::InputArg > Ins, BitVector &Skipped, FunctionType *FType, SIMachineFunctionInfo *Info)
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
virtual TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(MVT VT) const
Return the preferred vector type legalization action.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
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...
const SDValue & getBasePtr() const
LLVMContext * getContext() const
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
static APFloat getQNaN(const fltSemantics &Sem, bool Negative=false, const APInt *payload=nullptr)
Factory for QNaN values.
bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const override
Return true if it is beneficial to convert a load of a constant to just the constant itself...
void initializeSplitCSR(MachineBasicBlock *Entry) const override
Perform necessary initialization to handle a subset of CSRs explicitly via copies.
Address space for constant memory (VTX2).
Carry-using nodes for multiple precision addition and subtraction.
iterator_range< arg_iterator > args()
Wrapper class representing virtual and physical registers.
bool isStructTy() const
True if this is an instance of StructType.
bool empty() const
empty - Check if the array is empty.
cmpResult compare(const APFloat &RHS) const
Helper class for constructing bundles of MachineInstrs.
Type * getContainedType(unsigned i) const
This method is used to implement the type iterator (defined at the end of the file).
A wrapper class for inspecting calls to intrinsic functions.
const BasicBlock * getParent() const
bool hasCalls() const
Return true if the current function has any function calls.
const fltSemantics & getFltSemantics() const
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...
Register getPreloadedReg(AMDGPUFunctionArgInfo::PreloadedValue Value) const
This class is used to represent ISD::LOAD nodes.
const SIRegisterInfo * getRegisterInfo() const override
bool shouldEmitPCReloc(const GlobalValue *GV) const