83#include "llvm/IR/IntrinsicsARM.h"
118#define DEBUG_TYPE "arm-isel"
121STATISTIC(NumMovwMovt,
"Number of GAs materialized with movw + movt");
122STATISTIC(NumLoopByVals,
"Number of loops generated for byval arguments");
124 "Number of constants with their storage promoted into constant pools");
128 cl::desc(
"Enable / disable ARM interworking (for debugging only)"),
133 cl::desc(
"Enable / disable promotion of unnamed_addr constants into "
138 cl::desc(
"Maximum size of constant to promote into a constant pool"),
142 cl::desc(
"Maximum size of ALL constants to promote into a constant pool"),
147 cl::desc(
"Maximum interleave factor for MVE VLDn to generate."),
152 cl::desc(
"Maximum number of base-updates to check generating postindex."),
160 ARM::R0, ARM::R1, ARM::R2, ARM::R3
174void ARMTargetLowering::addTypeForNEON(
MVT VT,
MVT PromotedLdStVT) {
175 if (VT != PromotedLdStVT) {
184 if (ElemTy != MVT::f64)
188 if (ElemTy == MVT::i32) {
232void ARMTargetLowering::addDRTypeForNEON(
MVT VT) {
234 addTypeForNEON(VT, MVT::f64);
237void ARMTargetLowering::addQRTypeForNEON(
MVT VT) {
239 addTypeForNEON(VT, MVT::v2f64);
242void ARMTargetLowering::setAllExpand(
MVT VT) {
255void ARMTargetLowering::addAllExtLoads(
const MVT From,
const MVT To,
262void ARMTargetLowering::addMVEVectorTypes(
bool HasMVEFP) {
263 const MVT IntTypes[] = { MVT::v16i8, MVT::v8i16, MVT::v4i32 };
265 for (
auto VT : IntTypes) {
339 const MVT FloatTypes[] = { MVT::v8f16, MVT::v4f32 };
340 for (
auto VT : FloatTypes) {
414 const MVT LongTypes[] = { MVT::v2i64, MVT::v2f64 };
415 for (
auto VT : LongTypes) {
432 addAllExtLoads(MVT::v8i16, MVT::v8i8,
Legal);
433 addAllExtLoads(MVT::v4i32, MVT::v4i16,
Legal);
434 addAllExtLoads(MVT::v4i32, MVT::v4i8,
Legal);
451 for (
auto VT : {MVT::v8i8, MVT::v4i8, MVT::v4i16}) {
460 const MVT pTypes[] = {MVT::v16i1, MVT::v8i1, MVT::v4i1, MVT::v2i1};
461 for (
auto VT : pTypes) {
512 RegInfo(Subtarget->getRegisterInfo()),
513 Itins(Subtarget->getInstrItineraryData()) {
519 const Triple &TT = TM.getTargetTriple();
521 if (Subtarget->isThumb1Only())
526 if (!Subtarget->useSoftFloat() && !Subtarget->isThumb1Only() &&
527 Subtarget->hasFPRegs()) {
536 if (!Subtarget->hasVFP2Base()) {
537 setAllExpand(MVT::f32);
543 if (!Subtarget->hasFP64()) {
544 setAllExpand(MVT::f64);
554 if (Subtarget->hasFullFP16()) {
569 if (Subtarget->hasBF16()) {
571 setAllExpand(MVT::bf16);
572 if (!Subtarget->hasFullFP16())
584 addAllExtLoads(VT, InnerVT,
Expand);
593 if (!Subtarget->isThumb1Only() && !Subtarget->hasV8_1MMainlineOps())
596 if (!Subtarget->hasV8_1MMainlineOps())
599 if (!Subtarget->isThumb1Only())
608 if (Subtarget->hasMVEIntegerOps())
609 addMVEVectorTypes(Subtarget->hasMVEFloatOps());
612 if (Subtarget->hasLOB()) {
616 if (Subtarget->hasNEON()) {
617 addDRTypeForNEON(MVT::v2f32);
618 addDRTypeForNEON(MVT::v8i8);
619 addDRTypeForNEON(MVT::v4i16);
620 addDRTypeForNEON(MVT::v2i32);
621 addDRTypeForNEON(MVT::v1i64);
623 addQRTypeForNEON(MVT::v4f32);
624 addQRTypeForNEON(MVT::v2f64);
625 addQRTypeForNEON(MVT::v16i8);
626 addQRTypeForNEON(MVT::v8i16);
627 addQRTypeForNEON(MVT::v4i32);
628 addQRTypeForNEON(MVT::v2i64);
630 if (Subtarget->hasFullFP16()) {
631 addQRTypeForNEON(MVT::v8f16);
632 addDRTypeForNEON(MVT::v4f16);
635 if (Subtarget->hasBF16()) {
636 addQRTypeForNEON(MVT::v8bf16);
637 addDRTypeForNEON(MVT::v4bf16);
641 if (Subtarget->hasMVEIntegerOps() || Subtarget->hasNEON()) {
681 if (Subtarget->hasNEON()) {
794 if (!Subtarget->hasVFP4Base()) {
803 for (
MVT Ty : {MVT::v8i8, MVT::v4i8, MVT::v2i8, MVT::v4i16, MVT::v2i16,
812 for (
auto VT : {MVT::v8i8, MVT::v4i16, MVT::v2i32, MVT::v16i8, MVT::v8i16,
821 if (Subtarget->hasNEON() || Subtarget->hasMVEIntegerOps()) {
829 if (Subtarget->hasMVEIntegerOps()) {
834 if (Subtarget->hasMVEFloatOps()) {
838 if (!Subtarget->hasFP64()) {
884 if (!Subtarget->hasFP64() || !Subtarget->hasFPARMv8Base()) {
887 if (Subtarget->hasFullFP16()) {
895 if (!Subtarget->hasFP16()) {
924 if (!Subtarget->isThumb1Only()) {
949 if (Subtarget->hasDSP()) {
959 if (Subtarget->hasBaseDSP()) {
967 if (Subtarget->isThumb1Only()) {
971 if (Subtarget->isThumb1Only() || !Subtarget->hasV6Ops()
972 || (Subtarget->isThumb2() && !Subtarget->hasDSP()))
987 if (Subtarget->hasMVEIntegerOps())
991 if (Subtarget->isThumb1Only()) {
997 if (!Subtarget->isThumb1Only() && Subtarget->hasV6T2Ops())
1011 if (!Subtarget->hasV5TOps() || Subtarget->isThumb1Only()) {
1020 if (Subtarget->hasPerfMon())
1024 if (!Subtarget->hasV6Ops())
1027 bool hasDivide = Subtarget->isThumb() ? Subtarget->hasDivideInThumbMode()
1028 : Subtarget->hasDivideInARMMode();
1035 if (TT.isOSWindows() && !Subtarget->hasDivideInThumbMode()) {
1047 if (TT.isTargetAEABI() || TT.isAndroid() || TT.isTargetGNUAEABI() ||
1048 TT.isTargetMuslAEABI() || TT.isOSFuchsia() || TT.isOSWindows()) {
1051 HasStandaloneRem =
false;
1078 if (TT.isOSWindows())
1085 InsertFencesForAtomic =
false;
1086 if (Subtarget->hasAnyDataBarrier() &&
1087 (!Subtarget->isThumb() || Subtarget->hasV8MBaselineOps())) {
1091 if (!Subtarget->isThumb() || !Subtarget->isMClass())
1096 if (!Subtarget->hasAcquireRelease() ||
1099 InsertFencesForAtomic =
true;
1105 if (Subtarget->hasDataBarrier())
1106 InsertFencesForAtomic =
true;
1126 if (!InsertFencesForAtomic) {
1133 if (TT.isOSLinux() || (!Subtarget->isMClass() && Subtarget->hasV6Ops())) {
1145 }
else if ((Subtarget->isMClass() && Subtarget->hasV8MBaselineOps()) ||
1146 Subtarget->hasForced32BitAtomics()) {
1160 if (!Subtarget->hasV6Ops()) {
1166 if (!Subtarget->useSoftFloat() && Subtarget->hasFPRegs() &&
1167 !Subtarget->isThumb1Only()) {
1196 if (Subtarget->hasFullFP16()) {
1206 if (Subtarget->hasFullFP16())
1221 if (!Subtarget->useSoftFloat() && Subtarget->hasVFP2Base() &&
1222 !Subtarget->isThumb1Only()) {
1229 if (!Subtarget->hasVFP4Base()) {
1235 if (!Subtarget->useSoftFloat() && !Subtarget->isThumb1Only()) {
1237 if (!Subtarget->hasFPARMv8Base() || !Subtarget->hasFP64()) {
1245 if (!Subtarget->hasFP16()) {
1265 if (Subtarget->hasFPARMv8Base()) {
1275 if (Subtarget->hasFP64())
1279 if (Subtarget->hasNEON()) {
1289 if (Subtarget->hasFullFP16()) {
1326 if (Subtarget->hasNEON()) {
1338 if (Subtarget->hasV8Ops()) {
1353 if (Subtarget->hasFullFP16()) {
1381 if (TT.isOSWindows()) {
1398 if (Subtarget->hasMVEIntegerOps())
1401 if (Subtarget->hasV6Ops())
1403 if (Subtarget->isThumb1Only())
1406 if ((!Subtarget->isThumb() && Subtarget->hasV6Ops()) ||
1407 Subtarget->isThumb2()) {
1413 if (Subtarget->useSoftFloat() || Subtarget->isThumb1Only() ||
1414 !Subtarget->hasVFP2Base() || Subtarget->hasMinSize())
1436 Align(1ULL << Subtarget->getPreferBranchLogAlignment()));
1444 return Subtarget->useSoftFloat();
1448 return !Subtarget->isThumb1Only() && VT.
getSizeInBits() <= 32;
1461std::pair<const TargetRegisterClass *, uint8_t>
1472 case MVT::f32:
case MVT::f64:
case MVT::v8i8:
case MVT::v4i16:
1473 case MVT::v2i32:
case MVT::v1i64:
case MVT::v2f32:
1474 RRC = &ARM::DPRRegClass;
1479 if (Subtarget->useNEONForSinglePrecisionFP())
1482 case MVT::v16i8:
case MVT::v8i16:
case MVT::v4i32:
case MVT::v2i64:
1483 case MVT::v4f32:
case MVT::v2f64:
1484 RRC = &ARM::DPRRegClass;
1488 RRC = &ARM::DPRRegClass;
1492 RRC = &ARM::DPRRegClass;
1496 return std::make_pair(RRC,
Cost);
1505 if ((Subtarget->hasMVEIntegerOps() &&
1506 (VT == MVT::v2i64 || VT == MVT::v4i32 || VT == MVT::v8i16 ||
1507 VT == MVT::v16i8)) ||
1508 (Subtarget->hasMVEFloatOps() &&
1509 (VT == MVT::v2f64 || VT == MVT::v4f32 || VT == MVT::v8f16)))
1523 if (Subtarget->hasNEON()) {
1524 if (VT == MVT::v4i64)
1525 return &ARM::QQPRRegClass;
1526 if (VT == MVT::v8i64)
1527 return &ARM::QQQQPRRegClass;
1529 if (Subtarget->hasMVEIntegerOps()) {
1530 if (VT == MVT::v4i64)
1531 return &ARM::MQQPRRegClass;
1532 if (VT == MVT::v8i64)
1533 return &ARM::MQQQQPRRegClass;
1542 Align &PrefAlign)
const {
1549 (Subtarget->hasV6Ops() && !Subtarget->isMClass() ?
Align(8) :
Align(4));
1561 unsigned NumVals =
N->getNumValues();
1565 for (
unsigned i = 0; i != NumVals; ++i) {
1566 EVT VT =
N->getValueType(i);
1567 if (VT == MVT::Glue || VT == MVT::Other)
1573 if (!
N->isMachineOpcode())
1581 if (
MCID.getNumDefs() == 0)
1583 if (!Itins->isEmpty() &&
1584 Itins->getOperandCycle(
MCID.getSchedClass(), 0) > 2U)
1598 return Const->getZExtValue() == 16;
1606 return Const->getZExtValue() == 16;
1614 return Const->getZExtValue() == 16;
1683 bool isVarArg)
const {
1702 if (!
getTM().isAAPCS_ABI())
1704 else if (Subtarget->hasFPRegs() && !Subtarget->isThumb1Only() &&
1712 if (!
getTM().isAAPCS_ABI()) {
1713 if (Subtarget->hasVFP2Base() && !Subtarget->isThumb1Only() && !isVarArg)
1716 }
else if (Subtarget->hasVFP2Base() && !Subtarget->isThumb1Only() &&
1725 bool isVarArg)
const {
1726 return CCAssignFnForNode(CC,
false, isVarArg);
1730 bool isVarArg)
const {
1731 return CCAssignFnForNode(CC,
true, isVarArg);
1738 bool isVarArg)
const {
1739 switch (getEffectiveCallingConv(CC, isVarArg)) {
1765 if (Subtarget->hasFullFP16()) {
1766 Val = DAG.
getNode(ARMISD::VMOVhr, dl, ValVT, Val);
1778 if (Subtarget->hasFullFP16()) {
1779 Val = DAG.
getNode(ARMISD::VMOVrh, dl,
1792SDValue ARMTargetLowering::LowerCallResult(
1796 SDValue ThisVal,
bool isCmseNSCall)
const {
1804 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
1805 CCValAssign VA = RVLocs[i];
1809 if (i == 0 && isThisReturn) {
1811 "unexpected return calling convention register assignment");
1829 if (!Subtarget->isLittle())
1831 Val = DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64,
Lo,
Hi);
1846 if (!Subtarget->isLittle())
1848 Val = DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64,
Lo,
Hi);
1878 const ISD::InputArg &Arg = Ins[VA.
getValNo()];
1889std::pair<SDValue, MachinePointerInfo> ARMTargetLowering::computeAddrForCallArg(
1891 bool IsTailCall,
int SPDiff)
const {
1893 MachinePointerInfo DstInfo;
1913 return std::make_pair(DstAddr, DstInfo);
1922ARMTargetLowering::ByValCopyKind ARMTargetLowering::ByValNeedsCopyForTailCall(
1935 if (!SrcFrameIdxNode || !DstFrameIdxNode)
1938 int SrcFI = SrcFrameIdxNode->getIndex();
1939 int DstFI = DstFrameIdxNode->getIndex();
1941 "byval passed in non-fixed stack slot");
1963 if (SrcOffset == DstOffset)
1971 RegsToPassVector &RegsToPass,
1978 DAG.
getVTList(MVT::i32, MVT::i32), Arg);
1979 unsigned id = Subtarget->isLittle() ? 0 : 1;
1991 MachinePointerInfo DstInfo;
1992 std::tie(DstAddr, DstInfo) =
1993 computeAddrForCallArg(dl, DAG, NextVA, StackPtr, IsTailCall, SPDiff);
2010 SelectionDAG &DAG = CLI.
DAG;
2012 SmallVectorImpl<ISD::OutputArg> &Outs = CLI.
Outs;
2013 SmallVectorImpl<SDValue> &OutVals = CLI.
OutVals;
2014 SmallVectorImpl<ISD::InputArg> &Ins = CLI.
Ins;
2021 const CallBase *CB = CLI.
CB;
2024 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
2026 MachineFunction::CallSiteInfo CSInfo;
2027 bool isStructRet = (Outs.
empty()) ?
false : Outs[0].Flags.isSRet();
2028 bool isThisReturn =
false;
2029 bool isCmseNSCall =
false;
2030 bool isSibCall =
false;
2031 bool PreferIndirect =
false;
2032 bool GuardWithBTI =
false;
2042 !Subtarget->noBTIAtReturnTwice())
2047 CSInfo = MachineFunction::CallSiteInfo(*CB);
2051 isCmseNSCall =
true;
2054 if (!Subtarget->supportsTailCall())
2070 PreferIndirect = Subtarget->isThumb() && Subtarget->hasMinSize() &&
2071 count_if(GV->users(), [&BB](
const User *U) {
2072 return isa<Instruction>(U) &&
2073 cast<Instruction>(U)->getParent() == BB;
2080 IsEligibleForTailCallOptimization(CLI, CCInfo, ArgLocs, PreferIndirect);
2094 "site marked musttail");
2097 unsigned NumBytes = CCInfo.getStackSize();
2106 if (isTailCall && !isSibCall) {
2107 auto FuncInfo = MF.
getInfo<ARMFunctionInfo>();
2108 unsigned NumReusableBytes = FuncInfo->getArgumentStackSize();
2113 assert(StackAlign &&
"data layout string is missing stack alignment");
2114 NumBytes =
alignTo(NumBytes, *StackAlign);
2119 SPDiff = NumReusableBytes - NumBytes;
2123 if (SPDiff < 0 && AFI->getArgRegsSaveSize() < (
unsigned)-SPDiff)
2139 RegsToPassVector RegsToPass;
2148 DenseMap<unsigned, SDValue> ByValTemporaries;
2152 for (
const CCValAssign &VA : ArgLocs) {
2154 SDValue Src = OutVals[ArgIdx];
2155 ISD::ArgFlagsTy
Flags = Outs[ArgIdx].Flags;
2157 if (!
Flags.isByVal())
2161 MachinePointerInfo DstInfo;
2162 std::tie(Dst, DstInfo) =
2163 computeAddrForCallArg(dl, DAG, VA,
SDValue(),
true, SPDiff);
2164 ByValCopyKind
Copy = ByValNeedsCopyForTailCall(DAG, Src, Dst, Flags);
2166 if (Copy == NoCopy) {
2171 }
else if (Copy == CopyOnce) {
2175 ByValTemporaries[ArgIdx] = Src;
2177 assert(Copy == CopyViaTemp &&
"unexpected enum value");
2181 int TempFrameIdx = MFI.CreateStackObject(
2182 Flags.getByValSize(),
Flags.getNonZeroByValAlign(),
false);
2190 SDVTList VTs = DAG.
getVTList(MVT::Other, MVT::Glue);
2191 SDValue Ops[] = {Chain, Temp, Src, SizeNode, AlignNode};
2193 DAG.
getNode(ARMISD::COPY_STRUCT_BYVAL, dl, VTs,
Ops));
2194 ByValTemporaries[ArgIdx] = Temp;
2197 if (!ByValCopyChains.
empty())
2207 bool AfterFormalArgLoads =
false;
2211 for (
unsigned i = 0, realArgIdx = 0, e = ArgLocs.size();
2213 ++i, ++realArgIdx) {
2214 CCValAssign &VA = ArgLocs[i];
2215 SDValue Arg = OutVals[realArgIdx];
2216 ISD::ArgFlagsTy
Flags = Outs[realArgIdx].Flags;
2217 bool isByVal =
Flags.isByVal();
2237 if (isTailCall && VA.
isMemLoc() && !AfterFormalArgLoads) {
2239 if (ByValTempChain) {
2244 for (
unsigned I = 0;
I < OutVals.
size(); ++
I) {
2245 if (Outs[
I].
Flags.isByVal())
2253 FrameIndexSDNode *FIN =
2258 if (!MFI.isFixedObjectIndex(FIN->
getIndex()))
2261 for (
const CCValAssign &VA : ArgLocs) {
2269 if (!IncomingLoad.
empty()) {
2277 AfterFormalArgLoads =
true;
2289 auto ArgVT = Outs[realArgIdx].ArgVT;
2290 if (isCmseNSCall && (ArgVT == MVT::f16)) {
2308 PassF64ArgInRegs(dl, DAG, Chain, Op0, RegsToPass, VA, ArgLocs[++i],
2309 StackPtr, MemOpChains, isTailCall, SPDiff);
2313 PassF64ArgInRegs(dl, DAG, Chain, Op1, RegsToPass, VA, ArgLocs[++i],
2314 StackPtr, MemOpChains, isTailCall, SPDiff);
2318 MachinePointerInfo DstInfo;
2319 std::tie(DstAddr, DstInfo) =
2320 computeAddrForCallArg(dl, DAG, VA, StackPtr, isTailCall, SPDiff);
2324 PassF64ArgInRegs(dl, DAG, Chain, Arg, RegsToPass, VA, ArgLocs[++i],
2325 StackPtr, MemOpChains, isTailCall, SPDiff);
2327 if (realArgIdx == 0 &&
Flags.isReturned() && !
Flags.isSwiftSelf() &&
2328 Outs[0].VT == MVT::i32) {
2330 "unexpected calling convention register assignment");
2332 "unexpected use of 'returned'");
2333 isThisReturn =
true;
2338 RegsToPass.push_back(std::make_pair(VA.
getLocReg(), Arg));
2339 }
else if (isByVal) {
2341 unsigned offset = 0;
2345 unsigned ByValArgsCount = CCInfo.getInRegsParamsCount();
2346 unsigned CurByValIdx = CCInfo.getInRegsParamsProcessed();
2349 bool NeedsStackCopy;
2350 if (
auto It = ByValTemporaries.
find(realArgIdx);
2351 It != ByValTemporaries.
end()) {
2352 ByValSrc = It->second;
2353 NeedsStackCopy =
true;
2356 NeedsStackCopy = !isTailCall;
2360 if (CurByValIdx < ByValArgsCount) {
2361 unsigned RegBegin, RegEnd;
2362 CCInfo.getInRegsParamInfo(CurByValIdx, RegBegin, RegEnd);
2366 for (i = 0, j = RegBegin;
j < RegEnd; i++,
j++) {
2370 DAG.
getLoad(PtrVT, dl, Chain, AddArg, MachinePointerInfo(),
2373 RegsToPass.push_back(std::make_pair(j, Load));
2378 offset = RegEnd - RegBegin;
2380 CCInfo.nextInRegsParam();
2385 if (NeedsStackCopy &&
Flags.getByValSize() > 4 * offset) {
2388 MachinePointerInfo DstInfo;
2389 std::tie(Dst, DstInfo) =
2390 computeAddrForCallArg(dl, DAG, VA, StackPtr, isTailCall, SPDiff);
2398 SDVTList VTs = DAG.
getVTList(MVT::Other, MVT::Glue);
2399 SDValue Ops[] = { Chain, Dst, Src, SizeNode, AlignNode};
2406 MachinePointerInfo DstInfo;
2407 std::tie(DstAddr, DstInfo) =
2408 computeAddrForCallArg(dl, DAG, VA, StackPtr, isTailCall, SPDiff);
2415 if (!MemOpChains.
empty())
2421 for (
const auto &[
Reg,
N] : RegsToPass) {
2429 bool isDirect =
false;
2432 const GlobalValue *GVal =
nullptr;
2434 GVal =
G->getGlobal();
2435 bool isStub = !TM.shouldAssumeDSOLocal(GVal) && Subtarget->isTargetMachO();
2437 bool isARMFunc = !Subtarget->isThumb() || (isStub && !Subtarget->isMClass());
2438 bool isLocalARMFunc =
false;
2441 if (Subtarget->genLongCalls()) {
2443 "long-calls codegen is not position independent!");
2448 if (Subtarget->genExecuteOnly()) {
2449 if (Subtarget->useMovt())
2461 Addr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, Addr);
2467 const char *Sym = S->getSymbol();
2469 if (Subtarget->genExecuteOnly()) {
2470 if (Subtarget->useMovt())
2482 Addr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, Addr);
2489 if (!PreferIndirect) {
2494 isLocalARMFunc = !Subtarget->isThumb() && (isDef || !
ARMInterworking);
2496 if (isStub && Subtarget->isThumb1Only() && !Subtarget->hasV5TOps()) {
2497 assert(Subtarget->isTargetMachO() &&
"WrapperPIC use on non-MachO?");
2499 ARMISD::WrapperPIC, dl, PtrVt,
2506 }
else if (Subtarget->isTargetCOFF()) {
2507 assert(Subtarget->isTargetWindows() &&
2508 "Windows is the only supported COFF target");
2512 else if (!TM.shouldAssumeDSOLocal(GVal))
2519 DAG.
getNode(ARMISD::Wrapper, dl, PtrVt, Callee),
2528 const char *Sym = S->getSymbol();
2529 if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget->hasV5TOps()) {
2531 ARMConstantPoolValue *CPV =
2533 ARMPCLabelIndex, 4);
2535 CPAddr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
2540 Callee = DAG.
getNode(ARMISD::PIC_ADD, dl, PtrVt, Callee, PICLabel);
2547 assert(!isARMFunc && !isDirect &&
2548 "Cannot handle call to ARM function or direct call");
2552 "call to non-secure function would require "
2553 "passing arguments on stack",
2559 "call to non-secure function would return value through pointer",
2566 if (Subtarget->isThumb()) {
2568 CallOpc = ARMISD::t2CALL_BTI;
2569 else if (isCmseNSCall)
2570 CallOpc = ARMISD::tSECALL;
2571 else if ((!isDirect || isARMFunc) && !Subtarget->hasV5TOps())
2572 CallOpc = ARMISD::CALL_NOLINK;
2574 CallOpc = ARMISD::CALL;
2576 if (!isDirect && !Subtarget->hasV5TOps())
2577 CallOpc = ARMISD::CALL_NOLINK;
2578 else if (doesNotRet && isDirect && Subtarget->hasRetAddrStack() &&
2580 !Subtarget->hasMinSize())
2582 CallOpc = ARMISD::CALL_NOLINK;
2584 CallOpc = isLocalARMFunc ? ARMISD::CALL_PRED : ARMISD::CALL;
2591 if (isTailCall && !isSibCall) {
2596 std::vector<SDValue>
Ops;
2597 Ops.push_back(Chain);
2598 Ops.push_back(Callee);
2606 for (
const auto &[
Reg,
N] : RegsToPass)
2610 const uint32_t *
Mask;
2611 const ARMBaseRegisterInfo *ARI = Subtarget->getRegisterInfo();
2619 isThisReturn =
false;
2625 assert(Mask &&
"Missing call preserved mask for calling convention");
2629 Ops.push_back(InGlue);
2642 Chain = DAG.
getNode(CallOpc, dl, {MVT::Other, MVT::Glue},
Ops);
2653 uint64_t CalleePopBytes =
2656 Chain = DAG.
getCALLSEQ_END(Chain, NumBytes, CalleePopBytes, InGlue, dl);
2662 return LowerCallResult(Chain, InGlue, CallConv, isVarArg, Ins, dl, DAG,
2663 InVals, isThisReturn,
2664 isThisReturn ? OutVals[0] :
SDValue(), isCmseNSCall);
2671void ARMTargetLowering::HandleByVal(
CCState *State,
unsigned &
Size,
2672 Align Alignment)
const {
2674 Alignment = std::max(Alignment,
Align(4));
2680 unsigned AlignInRegs = Alignment.
value() / 4;
2681 unsigned Waste = (ARM::R4 -
Reg) % AlignInRegs;
2682 for (
unsigned i = 0; i < Waste; ++i)
2688 unsigned Excess = 4 * (ARM::R4 -
Reg);
2695 if (NSAAOffset != 0 &&
Size > Excess) {
2707 unsigned ByValRegBegin =
Reg;
2708 unsigned ByValRegEnd = std::min<unsigned>(
Reg +
Size / 4, ARM::R4);
2712 for (
unsigned i =
Reg + 1; i != ByValRegEnd; ++i)
2718 Size = std::max<int>(
Size - Excess, 0);
2726bool ARMTargetLowering::IsEligibleForTailCallOptimization(
2732 const SmallVectorImpl<ISD::OutputArg> &Outs = CLI.
Outs;
2733 const SmallVectorImpl<SDValue> &OutVals = CLI.
OutVals;
2734 const SmallVectorImpl<ISD::InputArg> &Ins = CLI.
Ins;
2735 const SelectionDAG &DAG = CLI.
DAG;
2740 assert(Subtarget->supportsTailCall());
2753 SmallSet<MCPhysReg, 5> AddressRegisters = {ARM::R0, ARM::R1, ARM::R2,
2755 if (!(Subtarget->isThumb1Only() ||
2756 MF.
getInfo<ARMFunctionInfo>()->shouldSignReturnAddress(
true)))
2757 AddressRegisters.
insert(ARM::R12);
2758 for (
const CCValAssign &AL : ArgLocs)
2760 AddressRegisters.
erase(
AL.getLocReg());
2761 if (AddressRegisters.
empty()) {
2762 LLVM_DEBUG(
dbgs() <<
"false (no reg to hold function pointer)\n");
2781 <<
" (guaranteed tail-call CC)\n");
2782 return CalleeCC == CallerCC;
2787 bool isCalleeStructRet = Outs.
empty() ?
false : Outs[0].Flags.isSRet();
2789 if (isCalleeStructRet != isCallerStructRet) {
2802 const GlobalValue *GV =
G->getGlobal();
2805 (!
TT.isOSWindows() ||
TT.isOSBinFormatELF() ||
2806 TT.isOSBinFormatMachO())) {
2815 getEffectiveCallingConv(CalleeCC, isVarArg),
2816 getEffectiveCallingConv(CallerCC, CallerF.
isVarArg()), MF,
C, Ins,
2823 const ARMBaseRegisterInfo *
TRI = Subtarget->getRegisterInfo();
2824 const uint32_t *CallerPreserved =
TRI->getCallPreservedMask(MF, CallerCC);
2825 if (CalleeCC != CallerCC) {
2826 const uint32_t *CalleePreserved =
TRI->getCallPreservedMask(MF, CalleeCC);
2827 if (!
TRI->regmaskSubsetEqual(CallerPreserved, CalleePreserved)) {
2836 const ARMFunctionInfo *AFI_Caller = MF.
getInfo<ARMFunctionInfo>();
2846 LLVM_DEBUG(
dbgs() <<
"false (parameters in CSRs do not match)\n");
2865 CCState CCInfo(CallConv, isVarArg, MF, RVLocs,
Context);
2874 StringRef IntKind =
F.getFnAttribute(
"interrupt").getValueAsString();
2887 if (IntKind ==
"" || IntKind ==
"IRQ" || IntKind ==
"FIQ" ||
2890 else if (IntKind ==
"SWI" || IntKind ==
"UNDEF")
2894 "must be one of: IRQ, FIQ, SWI, ABORT or UNDEF");
2899 return DAG.
getNode(ARMISD::INTRET_GLUE,
DL, MVT::Other, RetOps);
2921 bool isLittleEndian = Subtarget->isLittle();
2924 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
2933 "secure entry function would return value through pointer",
2938 for (
unsigned i = 0, realRVLocIdx = 0;
2940 ++i, ++realRVLocIdx) {
2941 CCValAssign &VA = RVLocs[i];
2944 SDValue Arg = OutVals[realRVLocIdx];
2945 bool ReturnF16 =
false;
2947 if (Subtarget->hasFullFP16() &&
getTM().isTargetHardFloat()) {
2980 auto RetVT = Outs[realRVLocIdx].ArgVT;
3002 DAG.
getVTList(MVT::i32, MVT::i32), Half);
3006 HalfGPRs.
getValue(isLittleEndian ? 0 : 1), Glue);
3012 HalfGPRs.
getValue(isLittleEndian ? 1 : 0), Glue);
3024 DAG.
getVTList(MVT::i32, MVT::i32), Arg);
3026 fmrrd.
getValue(isLittleEndian ? 0 : 1), Glue);
3031 fmrrd.
getValue(isLittleEndian ? 1 : 0), Glue);
3041 const ARMBaseRegisterInfo *
TRI = Subtarget->getRegisterInfo();
3067 !Subtarget->isMClass()) {
3068 if (Subtarget->isThumb1Only())
3075 return DAG.
getNode(RetNode, dl, MVT::Other, RetOps);
3078bool ARMTargetLowering::isUsedByReturnOnly(
SDNode *
N,
SDValue &Chain)
const {
3079 if (
N->getNumValues() != 1)
3081 if (!
N->hasNUsesOfValue(1, 0))
3085 SDNode *
Copy = *
N->user_begin();
3089 if (
Copy->getOperand(
Copy->getNumOperands()-1).getValueType() == MVT::Glue)
3091 TCChain =
Copy->getOperand(0);
3092 }
else if (
Copy->getOpcode() == ARMISD::VMOVRRD) {
3093 SDNode *VMov =
Copy;
3095 SmallPtrSet<SDNode*, 2>
Copies;
3096 for (SDNode *U : VMov->
users()) {
3104 for (SDNode *U : VMov->
users()) {
3105 SDValue UseChain =
U->getOperand(0);
3113 if (
U->getOperand(
U->getNumOperands() - 1).getValueType() == MVT::Glue)
3121 if (!
Copy->hasOneUse())
3128 if (
Copy->getOperand(
Copy->getNumOperands()-1).getValueType() == MVT::Glue)
3130 TCChain =
Copy->getOperand(0);
3135 bool HasRet =
false;
3136 for (
const SDNode *U :
Copy->users()) {
3137 if (
U->getOpcode() != ARMISD::RET_GLUE &&
3138 U->getOpcode() != ARMISD::INTRET_GLUE)
3150bool ARMTargetLowering::mayBeEmittedAsTailCall(
const CallInst *CI)
const {
3151 if (!Subtarget->supportsTailCall())
3168 &&
"LowerWRITE_REGISTER called for non-i64 type argument.");
3184 EVT PtrVT =
Op.getValueType();
3194 if (Subtarget->genExecuteOnly()) {
3196 auto *
T =
CP->getType();
3197 auto C =
const_cast<Constant*
>(
CP->getConstVal());
3199 auto GV =
new GlobalVariable(
3207 return LowerGlobalAddress(GA, DAG);
3212 Align CPAlign =
CP->getAlign();
3213 if (Subtarget->isThumb1Only())
3214 CPAlign = std::max(CPAlign,
Align(4));
3215 if (
CP->isMachineConstantPoolEntry())
3220 return DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, Res);
3227 if (Subtarget->genExecuteOnly() && !Subtarget->hasV8MBaselineOps())
3236 unsigned ARMPCLabelIndex = 0;
3242 if (!IsPositionIndependent) {
3245 unsigned PCAdj = Subtarget->isThumb() ? 4 : 8;
3252 CPAddr = DAG.
getNode(ARMISD::Wrapper,
DL, PtrVT, CPAddr);
3256 if (!IsPositionIndependent)
3259 return DAG.
getNode(ARMISD::PIC_ADD,
DL, PtrVT, Result, PICLabel);
3287ARMTargetLowering::LowerGlobalTLSAddressDarwin(
SDValue Op,
3289 assert(Subtarget->isTargetDarwin() &&
3290 "This function expects a Darwin target");
3295 SDValue DescAddr = LowerGlobalAddressDarwin(
Op, DAG);
3301 MVT::i32,
DL, Chain, DescAddr,
3316 auto ARI =
static_cast<const ARMRegisterInfo *
>(
TRI);
3325 Chain, FuncTLVGet, DAG.
getRegister(ARM::R0, MVT::i32),
3331ARMTargetLowering::LowerGlobalTLSAddressWindows(
SDValue Op,
3333 assert(Subtarget->isTargetWindows() &&
"Windows specific TLS lowering");
3357 TLSArray = DAG.
getLoad(PtrVT,
DL, Chain, TLSArray, MachinePointerInfo());
3365 TLSIndex = DAG.
getNode(ARMISD::Wrapper,
DL, PtrVT, TLSIndex);
3366 TLSIndex = DAG.
getLoad(PtrVT,
DL, Chain, TLSIndex, MachinePointerInfo());
3372 MachinePointerInfo());
3379 DAG.
getNode(ARMISD::Wrapper,
DL, MVT::i32,
3392 unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8;
3394 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
3396 ARMConstantPoolValue *CPV =
3407 Argument = DAG.
getNode(ARMISD::PIC_ADD, dl, PtrVT, Argument, PICLabel);
3414 TargetLowering::CallLoweringInfo CLI(DAG);
3419 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
3420 return CallResult.first;
3429 const GlobalValue *GV = GA->
getGlobal();
3435 SDValue ThreadPointer = DAG.
getNode(ARMISD::THREAD_POINTER, dl, PtrVT);
3439 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
3442 unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8;
3443 ARMConstantPoolValue *CPV =
3450 PtrVT, dl, Chain,
Offset,
3458 PtrVT, dl, Chain,
Offset,
3463 ARMConstantPoolValue *CPV =
3468 PtrVT, dl, Chain,
Offset,
3483 if (Subtarget->isTargetDarwin())
3484 return LowerGlobalTLSAddressDarwin(
Op, DAG);
3486 if (Subtarget->isTargetWindows())
3487 return LowerGlobalTLSAddressWindows(
Op, DAG);
3490 assert(Subtarget->isTargetELF() &&
"Only ELF implemented here");
3496 return LowerToTLSGeneralDynamicModel(GA, DAG);
3499 return LowerToTLSExecModels(GA, DAG, model);
3508 while (!Worklist.
empty()) {
3516 if (!
I ||
I->getParent()->getParent() !=
F)
3545 if (!GVar || !GVar->hasInitializer() ||
3546 !GVar->isConstant() || !GVar->hasGlobalUnnamedAddr() ||
3547 !GVar->hasLocalLinkage())
3552 auto *
Init = GVar->getInitializer();
3554 Init->needsDynamicRelocation())
3566 unsigned RequiredPadding = 4 - (
Size % 4);
3567 bool PaddingPossible =
3568 RequiredPadding == 4 || (CDAInit && CDAInit->isString());
3573 unsigned PaddedSize =
Size + ((RequiredPadding == 4) ? 0 : RequiredPadding);
3597 if (RequiredPadding != 4) {
3602 while (RequiredPadding--)
3614 ++NumConstpoolPromoted;
3615 return DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
3620 if (!(GV = GA->getAliaseeObject()))
3623 return V->isConstant();
3632 return LowerGlobalAddressWindows(
Op, DAG);
3634 return LowerGlobalAddressELF(
Op, DAG);
3636 return LowerGlobalAddressDarwin(
Op, DAG);
3648 if (GV->
isDSOLocal() && !Subtarget->genExecuteOnly())
3661 }
else if (Subtarget->isROPI() && IsRO) {
3666 }
else if (Subtarget->isRWPI() && !IsRO) {
3669 if (Subtarget->useMovt()) {
3672 RelAddr = DAG.
getNode(ARMISD::Wrapper, dl, PtrVT,
G);
3674 ARMConstantPoolValue *CPV =
3677 CPAddr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
3691 if (Subtarget->useMovt() || Subtarget->genExecuteOnly()) {
3692 if (Subtarget->useMovt())
3696 return DAG.
getNode(ARMISD::Wrapper, dl, PtrVT,
3700 CPAddr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
3709 assert(!Subtarget->isROPI() && !Subtarget->isRWPI() &&
3710 "ROPI/RWPI not currently supported for Darwin");
3715 if (Subtarget->useMovt())
3726 if (Subtarget->isGVIndirectSymbol(GV))
3734 assert(Subtarget->isTargetWindows() &&
"non-Windows COFF is not supported");
3735 assert(Subtarget->useMovt() &&
3736 "Windows on ARM expects to use movw/movt");
3737 assert(!Subtarget->isROPI() && !Subtarget->isRWPI() &&
3738 "ROPI/RWPI not currently supported for Windows");
3745 else if (!TM.shouldAssumeDSOLocal(GV))
3768 return DAG.
getNode(ARMISD::EH_SJLJ_SETJMP, dl,
3769 DAG.
getVTList(MVT::i32, MVT::Other),
Op.getOperand(0),
3770 Op.getOperand(1), Val);
3776 return DAG.
getNode(ARMISD::EH_SJLJ_LONGJMP, dl, MVT::Other,
Op.getOperand(0),
3783 return DAG.
getNode(ARMISD::EH_SJLJ_SETUP_DISPATCH, dl, MVT::Other,
3787SDValue ARMTargetLowering::LowerINTRINSIC_VOID(
3790 Op.getConstantOperandVal(
Op.getOperand(0).getValueType() == MVT::Other);
3794 case Intrinsic::arm_gnu_eabi_mcount: {
3800 const ARMBaseRegisterInfo *ARI = Subtarget->getRegisterInfo();
3801 const uint32_t *
Mask =
3803 assert(Mask &&
"Missing call preserved mask for calling convention");
3808 constexpr EVT ResultTys[] = {MVT::Other, MVT::Glue};
3812 if (Subtarget->isThumb())
3815 ARM::tBL_PUSHLR, dl, ResultTys,
3816 {ReturnAddress, DAG.getTargetConstant(ARMCC::AL, dl, PtrVT),
3817 DAG.getRegister(0, PtrVT), Callee, RegisterMask, Chain}),
3821 {ReturnAddress, Callee, RegisterMask, Chain}),
3830 unsigned IntNo =
Op.getConstantOperandVal(0);
3834 case Intrinsic::thread_pointer: {
3836 return DAG.
getNode(ARMISD::THREAD_POINTER, dl, PtrVT);
3838 case Intrinsic::arm_cls: {
3839 const SDValue &Operand =
Op.getOperand(1);
3840 const EVT VTy =
Op.getValueType();
3851 case Intrinsic::arm_cls64: {
3854 const SDValue &Operand =
Op.getOperand(1);
3855 const EVT VTy =
Op.getValueType();
3878 case Intrinsic::eh_sjlj_lsda: {
3880 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
3885 unsigned PCAdj = IsPositionIndependent ? (Subtarget->isThumb() ? 4 : 8) : 0;
3886 ARMConstantPoolValue *CPV =
3890 CPAddr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
3895 if (IsPositionIndependent) {
3897 Result = DAG.
getNode(ARMISD::PIC_ADD, dl, PtrVT, Result, PICLabel);
3901 case Intrinsic::arm_neon_vabs:
3904 case Intrinsic::arm_neon_vabds:
3905 if (
Op.getValueType().isInteger())
3907 Op.getOperand(1),
Op.getOperand(2));
3909 case Intrinsic::arm_neon_vabdu:
3911 Op.getOperand(1),
Op.getOperand(2));
3912 case Intrinsic::arm_neon_vmulls:
3913 case Intrinsic::arm_neon_vmullu: {
3914 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmulls)
3915 ? ARMISD::VMULLs : ARMISD::VMULLu;
3916 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
3917 Op.getOperand(1),
Op.getOperand(2));
3919 case Intrinsic::arm_neon_vminnm:
3920 case Intrinsic::arm_neon_vmaxnm: {
3921 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vminnm)
3923 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
3924 Op.getOperand(1),
Op.getOperand(2));
3926 case Intrinsic::arm_neon_vminu:
3927 case Intrinsic::arm_neon_vmaxu: {
3928 if (
Op.getValueType().isFloatingPoint())
3930 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vminu)
3932 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
3933 Op.getOperand(1),
Op.getOperand(2));
3935 case Intrinsic::arm_neon_vmins:
3936 case Intrinsic::arm_neon_vmaxs: {
3938 if (!
Op.getValueType().isFloatingPoint()) {
3939 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmins)
3941 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
3942 Op.getOperand(1),
Op.getOperand(2));
3944 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmins)
3946 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
3947 Op.getOperand(1),
Op.getOperand(2));
3949 case Intrinsic::arm_neon_vtbl1:
3950 return DAG.
getNode(ARMISD::VTBL1, SDLoc(
Op),
Op.getValueType(),
3951 Op.getOperand(1),
Op.getOperand(2));
3952 case Intrinsic::arm_neon_vtbl2:
3953 return DAG.
getNode(ARMISD::VTBL2, SDLoc(
Op),
Op.getValueType(),
3954 Op.getOperand(1),
Op.getOperand(2),
Op.getOperand(3));
3955 case Intrinsic::arm_mve_pred_i2v:
3956 case Intrinsic::arm_mve_pred_v2i:
3957 return DAG.
getNode(ARMISD::PREDICATE_CAST, SDLoc(
Op),
Op.getValueType(),
3959 case Intrinsic::arm_mve_vreinterpretq:
3960 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, SDLoc(
Op),
Op.getValueType(),
3962 case Intrinsic::arm_mve_lsll:
3963 return DAG.
getNode(ARMISD::LSLL, SDLoc(
Op),
Op->getVTList(),
3964 Op.getOperand(1),
Op.getOperand(2),
Op.getOperand(3));
3965 case Intrinsic::arm_mve_asrl:
3966 return DAG.
getNode(ARMISD::ASRL, SDLoc(
Op),
Op->getVTList(),
3967 Op.getOperand(1),
Op.getOperand(2),
Op.getOperand(3));
3978 if (!Subtarget->hasDataBarrier()) {
3982 assert(Subtarget->hasV6Ops() && !Subtarget->isThumb() &&
3983 "Unexpected ISD::ATOMIC_FENCE encountered. Should be libcall!");
3984 return DAG.
getNode(ARMISD::MEMBARRIER_MCR, dl, MVT::Other,
Op.getOperand(0),
3994 }
else if (Subtarget->preferISHSTBarriers() &&
4003 DAG.
getConstant(Intrinsic::arm_dmb, dl, MVT::i32),
4011 (!Subtarget->
isThumb1Only() && Subtarget->hasV5TEOps())))
4013 return Op.getOperand(0);
4016 unsigned isRead =
~Op.getConstantOperandVal(2) & 1;
4018 (!Subtarget->hasV7Ops() || !Subtarget->hasMPExtension()))
4020 return Op.getOperand(0);
4022 unsigned isData =
Op.getConstantOperandVal(4);
4023 if (Subtarget->isThumb()) {
4025 isRead = ~isRead & 1;
4026 isData = ~isData & 1;
4029 return DAG.
getNode(ARMISD::PRELOAD, dl, MVT::Other,
Op.getOperand(0),
4044 return DAG.
getStore(
Op.getOperand(0), dl, FR,
Op.getOperand(1),
4052 const SDLoc &dl)
const {
4054 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
4056 const TargetRegisterClass *RC;
4058 RC = &ARM::tGPRRegClass;
4060 RC = &ARM::GPRRegClass;
4074 MVT::i32, dl, Root, FIN,
4080 if (!Subtarget->isLittle())
4082 return DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64, ArgValue, ArgValue2);
4095 const Value *OrigArg,
4096 unsigned InRegsParamRecordIdx,
4097 int ArgOffset,
unsigned ArgSize)
const {
4111 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
4112 unsigned RBegin, REnd;
4117 RBegin = RBeginIdx == 4 ? (unsigned)ARM::R4 :
GPRArgRegs[RBeginIdx];
4122 ArgOffset = -4 * (ARM::R4 - RBegin);
4129 const TargetRegisterClass *RC =
4132 for (
unsigned Reg = RBegin, i = 0;
Reg < REnd; ++
Reg, ++i) {
4136 MachinePointerInfo(OrigArg, 4 * i));
4141 if (!MemOps.
empty())
4150 unsigned TotalArgRegsSaveSize,
4151 bool ForceMutable)
const {
4153 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
4162 CCInfo.
getStackSize(), std::max(4U, TotalArgRegsSaveSize));
4166bool ARMTargetLowering::splitValueIntoRegisterParts(
4168 unsigned NumParts,
MVT PartVT, std::optional<CallingConv::ID> CC)
const {
4170 if ((ValueVT == MVT::f16 || ValueVT == MVT::bf16) && PartVT == MVT::f32) {
4182SDValue ARMTargetLowering::joinRegisterPartsIntoValue(
4184 MVT PartVT,
EVT ValueVT, std::optional<CallingConv::ID> CC)
const {
4185 if ((ValueVT == MVT::f16 || ValueVT == MVT::bf16) && PartVT == MVT::f32) {
4198SDValue ARMTargetLowering::LowerFormalArguments(
4205 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
4214 unsigned CurArgIdx = 0;
4226 unsigned ArgRegBegin = ARM::R4;
4227 for (
const CCValAssign &VA : ArgLocs) {
4233 if (!
Flags.isByVal())
4237 unsigned RBegin, REnd;
4239 ArgRegBegin = std::min(ArgRegBegin, RBegin);
4245 int lastInsIndex = -1;
4249 ArgRegBegin = std::min(ArgRegBegin, (
unsigned)
GPRArgRegs[RegIdx]);
4252 unsigned TotalArgRegsSaveSize = 4 * (ARM::R4 - ArgRegBegin);
4256 for (
unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
4257 CCValAssign &VA = ArgLocs[i];
4258 if (Ins[VA.
getValNo()].isOrigArg()) {
4259 std::advance(CurOrigArg,
4260 Ins[VA.
getValNo()].getOrigArgIndex() - CurArgIdx);
4261 CurArgIdx = Ins[VA.
getValNo()].getOrigArgIndex();
4272 GetF64FormalArgument(VA, ArgLocs[++i], Chain, DAG, dl);
4279 MVT::f64, dl, Chain, FIN,
4282 ArgValue2 = GetF64FormalArgument(VA, ArgLocs[++i], Chain, DAG, dl);
4290 ArgValue = GetF64FormalArgument(VA, ArgLocs[++i], Chain, DAG, dl);
4292 const TargetRegisterClass *RC;
4294 if (RegVT == MVT::f16 || RegVT == MVT::bf16)
4295 RC = &ARM::HPRRegClass;
4296 else if (RegVT == MVT::f32)
4297 RC = &ARM::SPRRegClass;
4298 else if (RegVT == MVT::f64 || RegVT == MVT::v4f16 ||
4299 RegVT == MVT::v4bf16)
4300 RC = &ARM::DPRRegClass;
4301 else if (RegVT == MVT::v2f64 || RegVT == MVT::v8f16 ||
4302 RegVT == MVT::v8bf16)
4303 RC = &ARM::QPRRegClass;
4304 else if (RegVT == MVT::i32)
4306 : &ARM::GPRRegClass;
4343 const ISD::InputArg &Arg = Ins[VA.
getValNo()];
4352 assert(VA.
getValVT() != MVT::i64 &&
"i64 should already be lowered");
4358 if (index != lastInsIndex)
4360 ISD::ArgFlagsTy
Flags = Ins[index].Flags;
4366 if (
Flags.isByVal()) {
4367 assert(Ins[index].isOrigArg() &&
4368 "Byval arguments cannot be implicit");
4372 CCInfo, DAG, dl, Chain, &*CurOrigArg, CurByValIndex,
4406 lastInsIndex = index;
4413 VarArgStyleRegisters(CCInfo, DAG, dl, Chain, CCInfo.
getStackSize(),
4414 TotalArgRegsSaveSize);
4418 "secure entry function must not be variadic", dl.
getDebugLoc()));
4428 assert(StackAlign &&
"data layout string is missing stack alignment");
4429 StackArgSize =
alignTo(StackArgSize, *StackAlign);
4438 "secure entry function requires arguments on stack", dl.
getDebugLoc()));
4447 return CFP->getValueAPF().isPosZero();
4450 if (
Op.getOperand(1).getOpcode() == ARMISD::Wrapper) {
4451 SDValue WrapperOp =
Op.getOperand(1).getOperand(0);
4454 return CFP->getValueAPF().isPosZero();
4457 Op->getValueType(0) == MVT::f64) {
4461 if (BitcastOp->
getOpcode() == ARMISD::VMOVIMM &&
4472 const SDLoc &dl)
const {
4474 unsigned C = RHSC->getZExtValue();
4538 if (Subtarget->isThumb1Only() &&
LHS->getOpcode() ==
ISD::AND &&
4542 unsigned Mask =
LHS.getConstantOperandVal(1);
4544 uint64_t RHSV = RHSC->getZExtValue();
4545 if (
isMask_32(Mask) && (RHSV & ~Mask) == 0 && Mask != 255 && Mask != 65535) {
4547 if (RHSV && (RHSV > 255 || (RHSV << ShiftBits) <= 255)) {
4561 if (Subtarget->isThumb1Only() &&
LHS->getOpcode() ==
ISD::SHL &&
4564 LHS.getConstantOperandVal(1) < 31) {
4565 unsigned ShiftAmt =
LHS.getConstantOperandVal(1) + 1;
4590 unsigned CompareType;
4593 CompareType = ARMISD::CMP;
4598 CompareType = ARMISD::CMPZ;
4608 bool Signaling)
const {
4609 assert(Subtarget->hasFP64() ||
RHS.getValueType() != MVT::f64);
4615 Flags = DAG.
getNode(Signaling ? ARMISD::CMPFPEw0 : ARMISD::CMPFPw0, dl,
4624std::pair<SDValue, SDValue>
4627 assert(
Op.getValueType() == MVT::i32 &&
"Unsupported value type");
4639 switch (
Op.getOpcode()) {
4691 return std::make_pair(
Value, OverflowCmp);
4702 std::tie(
Value, OverflowCmp) = getARMXALUOOp(
Op, DAG, ARMcc);
4707 EVT VT =
Op.getValueType();
4710 DAG.
getNode(ARMISD::CMOV, dl, VT, TVal, FVal, ARMcc, OverflowCmp);
4712 SDVTList VTs = DAG.
getVTList(
Op.getValueType(), MVT::i32);
4750 EVT VT =
Op.getValueType();
4751 SDVTList VTs = DAG.
getVTList(VT, MVT::i32);
4754 switch (
Op.getOpcode()) {
4779 EVT VT =
Op.getValueType();
4780 if (!Subtarget->hasV6Ops() || !Subtarget->hasDSP() || Subtarget->
isThumb1Only())
4790 switch (
Op->getOpcode()) {
4792 NewOpcode = ARMISD::UQADD8b;
4795 NewOpcode = ARMISD::QADD8b;
4798 NewOpcode = ARMISD::UQSUB8b;
4801 NewOpcode = ARMISD::QSUB8b;
4806 switch (
Op->getOpcode()) {
4808 NewOpcode = ARMISD::UQADD16b;
4811 NewOpcode = ARMISD::QADD16b;
4814 NewOpcode = ARMISD::UQSUB16b;
4817 NewOpcode = ARMISD::QSUB16b;
4825 DAG.
getNode(NewOpcode, dl, MVT::i32,
4836 unsigned Opc =
Cond.getOpcode();
4838 if (
Cond.getResNo() == 1 &&
4846 std::tie(
Value, OverflowCmp) = getARMXALUOOp(
Cond, DAG, ARMcc);
4847 EVT VT =
Op.getValueType();
4849 return getCMOV(dl, VT, SelectTrue, SelectFalse, ARMcc, OverflowCmp, DAG);
4857 if (
Cond.getOpcode() == ARMISD::CMOV &&
Cond.hasOneUse()) {
4858 const ConstantSDNode *CMOVTrue =
4860 const ConstantSDNode *CMOVFalse =
4863 if (CMOVTrue && CMOVFalse) {
4869 if (CMOVTrueVal == 1 && CMOVFalseVal == 0) {
4871 False = SelectFalse;
4872 }
else if (CMOVTrueVal == 0 && CMOVFalseVal == 1) {
4878 return getCMOV(dl,
Op.getValueType(), True, False,
Cond.getOperand(2),
4879 Cond.getOperand(3), DAG);
4894 bool &swpCmpOps,
bool &swpVselOps) {
4922 swpCmpOps = !swpCmpOps;
4923 swpVselOps = !swpVselOps;
4946 if (!Subtarget->hasFP64() && VT == MVT::f64) {
4948 DAG.
getVTList(MVT::i32, MVT::i32), FalseVal);
4950 DAG.
getVTList(MVT::i32, MVT::i32), TrueVal);
4964 return DAG.
getNode(ARMISD::CMOV, dl, VT, FalseVal, TrueVal, ARMcc, Flags);
4985 ((K ==
LHS && K == TrueVal) || (K ==
RHS && K == FalseVal))) ||
4987 ((K ==
RHS && K == TrueVal) || (K ==
LHS && K == FalseVal)));
5008 EVT VT =
Op.getValueType();
5030 if (V1Tmp != TrueVal1 || V2Tmp != TrueVal2 || K1 != FalseVal1 ||
5043 int64_t PosVal = std::max(Val1, Val2);
5044 int64_t NegVal = std::min(Val1, Val2);
5056 return DAG.
getNode(ARMISD::SSAT, dl, VT, V2Tmp,
5059 return DAG.
getNode(ARMISD::USAT, dl, VT, V2Tmp,
5091 V = (KTmp == TrueVal) ? FalseVal : TrueVal;
5096 if (*K != KTmp || V != VTmp)
5107bool ARMTargetLowering::isUnsupportedFloatingType(
EVT VT)
const {
5109 return !Subtarget->hasVFP2Base();
5111 return !Subtarget->hasFP64();
5113 return !Subtarget->hasFullFP16();
5118 EVT VT =
Op.getValueType();
5122 if ((!Subtarget->isThumb() && Subtarget->hasV6Ops()) || Subtarget->isThumb2())
5134 if (VT == MVT::i32 &&
5154 if (
Op.getValueType().isInteger()) {
5162 LHS.getValueType() ==
RHS.getValueType()) {
5163 EVT VT =
LHS.getValueType();
5169 Shift = DAG.
getNOT(dl, Shift, VT);
5175 if (Subtarget->hasV8_1MMainlineOps() && CFVal && CTVal &&
5176 LHS.getValueType() == MVT::i32 &&
RHS.getValueType() == MVT::i32) {
5179 unsigned Opcode = 0;
5181 if (TVal == ~FVal) {
5182 Opcode = ARMISD::CSINV;
5183 }
else if (TVal == ~FVal + 1) {
5184 Opcode = ARMISD::CSNEG;
5185 }
else if (TVal + 1 == FVal) {
5186 Opcode = ARMISD::CSINC;
5187 }
else if (TVal == FVal + 1) {
5188 Opcode = ARMISD::CSINC;
5197 if (Opcode != ARMISD::CSINC &&
5207 if (FVal == 0 && Opcode != ARMISD::CSINC) {
5218 EVT VT =
TrueVal.getValueType();
5219 return DAG.
getNode(Opcode, dl, VT, TrueVal, FalseVal, ARMcc, Cmp);
5223 if (isUnsupportedFloatingType(
LHS.getValueType())) {
5228 if (!
RHS.getNode()) {
5234 if (
LHS.getValueType() == MVT::i32) {
5245 if (Subtarget->hasFPARMv8Base() && (
TrueVal.getValueType() == MVT::f16 ||
5246 TrueVal.getValueType() == MVT::f32 ||
5247 TrueVal.getValueType() == MVT::f64)) {
5261 return getCMOV(dl, VT, FalseVal, TrueVal, ARMcc, Cmp, DAG);
5271 if (Subtarget->hasFPARMv8Base() &&
5273 (
TrueVal.getValueType() == MVT::f16 ||
5274 TrueVal.getValueType() == MVT::f32 ||
5275 TrueVal.getValueType() == MVT::f64)) {
5276 bool swpCmpOps =
false;
5277 bool swpVselOps =
false;
5291 SDValue Result = getCMOV(dl, VT, FalseVal, TrueVal, ARMcc, Cmp, DAG);
5294 Result = getCMOV(dl, VT, Result, TrueVal, ARMcc2, Cmp, DAG);
5304 if (!
N->hasOneUse())
5307 if (!
N->getNumValues())
5309 EVT VT =
Op.getValueType();
5310 if (VT != MVT::f32 && !Subtarget->isFPBrccSlow())
5327 return DAG.
getLoad(MVT::i32,
SDLoc(
Op), Ld->getChain(), Ld->getBasePtr(),
5328 Ld->getPointerInfo(), Ld->getAlign(),
5329 Ld->getMemOperand()->getFlags());
5345 SDValue Ptr = Ld->getBasePtr();
5347 DAG.
getLoad(MVT::i32, dl, Ld->getChain(), Ptr, Ld->getPointerInfo(),
5348 Ld->getAlign(), Ld->getMemOperand()->
getFlags());
5353 RetVal2 = DAG.
getLoad(MVT::i32, dl, Ld->getChain(), NewPtr,
5354 Ld->getPointerInfo().getWithOffset(4),
5356 Ld->getMemOperand()->getFlags());
5374 bool LHSSeenZero =
false;
5376 bool RHSSeenZero =
false;
5378 if (LHSOk && RHSOk && (LHSSeenZero || RHSSeenZero)) {
5389 if (
LHS.getValueType() == MVT::f32) {
5395 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, Dest, ARMcc,
5407 SDValue Ops[] = { Chain, ARMcc, LHS1, LHS2, RHS1, RHS2, Dest };
5408 return DAG.
getNode(ARMISD::BCC_i64, dl, MVT::Other,
Ops);
5423 return DAG.
getNode(ARMISD::CMOV,
DL, MVT::i32,
Op.getOperand(0), Neg,
5435 unsigned Opc =
Cond.getOpcode();
5437 !Subtarget->isThumb1Only();
5438 if (
Cond.getResNo() == 1 &&
5448 std::tie(
Value, OverflowCmp) = getARMXALUOOp(
Cond, DAG, ARMcc);
5454 ARMcc = DAG.
getConstant(CondCode, SDLoc(ARMcc), MVT::i32);
5456 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, Dest, ARMcc,
5471 if (isUnsupportedFloatingType(
LHS.getValueType())) {
5476 if (!
RHS.getNode()) {
5484 unsigned Opc =
LHS.getOpcode();
5486 !Subtarget->isThumb1Only();
5498 std::tie(
Value, OverflowCmp) = getARMXALUOOp(
LHS.getValue(0), DAG, ARMcc);
5505 ARMcc = DAG.
getConstant(CondCode, SDLoc(ARMcc), MVT::i32);
5508 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, Dest, ARMcc,
5512 if (
LHS.getValueType() == MVT::i32) {
5515 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, Dest, ARMcc, Cmp);
5518 SDNodeFlags
Flags =
Op->getFlags();
5519 if (
Flags.hasNoNaNs() &&
5524 if (
SDValue Result = OptimizeVFPBrcond(
Op, DAG))
5538 Res = DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other,
Ops);
5552 Table = DAG.
getNode(ARMISD::WrapperJT, dl, MVT::i32, JTI);
5555 if (Subtarget->isThumb2() || (Subtarget->hasV8MBaselineOps() && Subtarget->isThumb())) {
5560 return DAG.
getNode(ARMISD::BR2_JT, dl, MVT::Other, Chain,
5561 Addr,
Op.getOperand(2), JTI);
5565 DAG.
getLoad((EVT)MVT::i32, dl, Chain, Addr,
5569 return DAG.
getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI);
5572 DAG.
getLoad(PTy, dl, Chain, Addr,
5575 return DAG.
getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI);
5580 EVT VT =
Op.getValueType();
5583 if (
Op.getValueType().getVectorElementType() == MVT::i32) {
5584 if (
Op.getOperand(0).getValueType().getVectorElementType() == MVT::f32)
5592 const EVT OpTy =
Op.getOperand(0).getValueType();
5593 if (OpTy == MVT::v4f32)
5595 else if (OpTy == MVT::v4f16 && HasFullFP16)
5597 else if (OpTy == MVT::v8f16 && HasFullFP16)
5602 if (VT != MVT::v4i16 && VT != MVT::v8i16)
5605 Op = DAG.
getNode(
Op.getOpcode(), dl, NewTy,
Op.getOperand(0));
5610 EVT VT =
Op.getValueType();
5614 bool IsStrict =
Op->isStrictFPOpcode();
5615 SDValue SrcVal =
Op.getOperand(IsStrict ? 1 : 0);
5617 if (isUnsupportedFloatingType(SrcVal.
getValueType())) {
5630 std::tie(Result, Chain) =
makeLibCall(DAG, LC,
Op.getValueType(), SrcVal,
5631 CallOptions, Loc, Chain);
5641 Loc,
Op.getValueType(), SrcVal);
5650 EVT VT =
Op.getValueType();
5652 EVT FromVT =
Op.getOperand(0).getValueType();
5654 if (VT == MVT::i32 && ToVT == MVT::i32 && FromVT == MVT::f32)
5656 if (VT == MVT::i32 && ToVT == MVT::i32 && FromVT == MVT::f64 &&
5657 Subtarget->hasFP64())
5659 if (VT == MVT::i32 && ToVT == MVT::i32 && FromVT == MVT::f16 &&
5660 Subtarget->hasFullFP16())
5662 if (VT == MVT::v4i32 && ToVT == MVT::i32 && FromVT == MVT::v4f32 &&
5663 Subtarget->hasMVEFloatOps())
5665 if (VT == MVT::v8i16 && ToVT == MVT::i16 && FromVT == MVT::v8f16 &&
5666 Subtarget->hasMVEFloatOps())
5669 if (FromVT != MVT::v4f32 && FromVT != MVT::v8f16)
5686 EVT VT =
Op.getValueType();
5689 if (
Op.getOperand(0).getValueType().getVectorElementType() == MVT::i32) {
5695 assert((
Op.getOperand(0).getValueType() == MVT::v4i16 ||
5696 Op.getOperand(0).getValueType() == MVT::v8i16) &&
5697 "Invalid type for custom lowering!");
5702 if (VT == MVT::v4f32)
5703 DestVecType = MVT::v4i32;
5704 else if (VT == MVT::v4f16 && HasFullFP16)
5705 DestVecType = MVT::v4i16;
5706 else if (VT == MVT::v8f16 && HasFullFP16)
5707 DestVecType = MVT::v8i16;
5713 switch (
Op.getOpcode()) {
5725 Op = DAG.
getNode(CastOpc, dl, DestVecType,
Op.getOperand(0));
5730 EVT VT =
Op.getValueType();
5733 if (isUnsupportedFloatingType(VT)) {
5743 CallOptions, SDLoc(
Op)).first;
5754 EVT VT =
Op.getValueType();
5758 bool UseNEON = !InGPR && Subtarget->hasNEON();
5765 EVT OpVT = (VT == MVT::f32) ? MVT::v2i32 : MVT::v1i64;
5772 if (SrcVT == MVT::f32) {
5775 Tmp1 = DAG.
getNode(ARMISD::VSHLIMM, dl, OpVT,
5778 }
else if (VT == MVT::f32)
5779 Tmp1 = DAG.
getNode(ARMISD::VSHRuIMM, dl, MVT::v1i64,
5794 if (VT == MVT::f32) {
5806 if (SrcVT == MVT::f64)
5815 if (VT == MVT::f32) {
5828 return DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64,
Lo,
Hi);
5836 EVT VT =
Op.getValueType();
5838 unsigned Depth =
Op.getConstantOperandVal(0);
5840 SDValue FrameAddr = LowerFRAMEADDR(
Op, DAG);
5844 MachinePointerInfo());
5853 const ARMBaseRegisterInfo &ARI =
5854 *
static_cast<const ARMBaseRegisterInfo*
>(RegInfo);
5859 EVT VT =
Op.getValueType();
5861 unsigned Depth =
Op.getConstantOperandVal(0);
5866 MachinePointerInfo());
5874 return StringSwitch<Register>(
RegName)
5875 .Case(
"sp", ARM::SP)
5886 assert(
N->getValueType(0) == MVT::i64
5887 &&
"ExpandREAD_REGISTER called for non-i64 type result.");
5890 DAG.
getVTList(MVT::i32, MVT::i32, MVT::Other),
5930 const APInt &APIntIndex = Index->getAPIntValue();
5932 NewIndex *= APIntIndex;
5961 EVT SrcVT =
Op.getValueType();
5962 EVT DstVT =
N->getValueType(0);
5964 if ((SrcVT == MVT::i16 || SrcVT == MVT::i32) &&
5965 (DstVT == MVT::f16 || DstVT == MVT::bf16))
5966 return MoveToHPR(SDLoc(
N), DAG, MVT::i32, DstVT.
getSimpleVT(),
5969 if ((DstVT == MVT::i16 || DstVT == MVT::i32) &&
5970 (SrcVT == MVT::f16 || SrcVT == MVT::bf16)) {
5971 if (Subtarget->hasFullFP16() && !Subtarget->hasBF16())
5978 if (!(SrcVT == MVT::i64 || DstVT == MVT::i64))
5990 DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64,
Lo,
Hi));
5998 Cvt = DAG.
getNode(ARMISD::VMOVRRD, dl,
6000 DAG.
getNode(ARMISD::VREV64, dl, SrcVT,
Op));
6002 Cvt = DAG.
getNode(ARMISD::VMOVRRD, dl,
6022 SDValue Vmov = DAG.
getNode(ARMISD::VMOVIMM, dl, VmovVT, EncodedVal);
6031 EVT VT =
Op.getValueType();
6053 DAG.
getNode(ARMISD::CMOV, dl, VT, LoSmallShift, LoBigShift, ARMcc, CmpLo);
6063 DAG.
getNode(ARMISD::CMOV, dl, VT, HiSmallShift, HiBigShift, ARMcc, CmpHi);
6074 EVT VT =
Op.getValueType();
6095 DAG.
getNode(ARMISD::CMOV, dl, VT, HiSmallShift, HiBigShift, ARMcc, CmpHi);
6116 DAG.
getConstant(Intrinsic::arm_get_fpscr, dl, MVT::i32)};
6168 Chain, DAG.
getConstant(Intrinsic::arm_set_fpscr,
DL, MVT::i32), FPSCR};
6196 Chain, DAG.
getConstant(Intrinsic::arm_set_fpscr,
DL, MVT::i32), FPSCR};
6226 EVT VT =
N->getValueType(0);
6227 if (VT.
isVector() && ST->hasNEON()) {
6236 if (ElemTy == MVT::i8) {
6244 if ((ElemTy == MVT::i16 || ElemTy == MVT::i32) &&
6247 unsigned NumBits = ElemTy.getSizeInBits();
6249 DAG.
getNode(ARMISD::VMOVIMM, dl, VT,
6259 if (ElemTy == MVT::i64) {
6272 if (!ST->hasV6T2Ops())
6281 EVT VT =
N->getValueType(0);
6284 assert(ST->hasNEON() &&
"Custom ctpop lowering requires NEON.");
6285 assert((VT == MVT::v1i64 || VT == MVT::v2i64 || VT == MVT::v2i32 ||
6286 VT == MVT::v4i32 || VT == MVT::v4i16 || VT == MVT::v8i16) &&
6287 "Unexpected type for custom ctpop lowering");
6295 unsigned EltSize = 8;
6318 Op =
Op.getOperand(0);
6320 APInt SplatBits, SplatUndef;
6321 unsigned SplatBitSize;
6324 !BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs,
6326 SplatBitSize > ElementBits)
6337 assert(VT.
isVector() &&
"vector shift count is not a vector type");
6341 return (Cnt >= 0 && (isLong ? Cnt - 1 : Cnt) < ElementBits);
6352 assert(VT.
isVector() &&
"vector shift count is not a vector type");
6357 return (Cnt >= 1 && Cnt <= (isNarrow ? ElementBits / 2 : ElementBits));
6358 if (Cnt >= -(isNarrow ? ElementBits / 2 : ElementBits) && Cnt <= -1) {
6367 EVT VT =
N->getValueType(0);
6382 return DAG.
getNode(ARMISD::VSHLIMM, dl, VT,
N->getOperand(0),
6384 return DAG.
getNode(ARMISD::VSHLu, dl, VT,
N->getOperand(0),
6389 "unexpected vector shift opcode");
6391 if (
isVShiftRImm(
N->getOperand(1), VT,
false,
false, Cnt)) {
6392 unsigned VShiftOpc =
6393 (
N->getOpcode() ==
ISD::SRA ? ARMISD::VSHRsIMM : ARMISD::VSHRuIMM);
6394 return DAG.
getNode(VShiftOpc, dl, VT,
N->getOperand(0),
6400 EVT ShiftVT =
N->getOperand(1).getValueType();
6403 unsigned VShiftOpc =
6404 (
N->getOpcode() ==
ISD::SRA ? ARMISD::VSHLs : ARMISD::VSHLu);
6405 return DAG.
getNode(VShiftOpc, dl, VT,
N->getOperand(0), NegatedCount);
6410 EVT VT =
N->getValueType(0);
6419 "Unknown shift to lower!");
6421 unsigned ShOpc =
N->getOpcode();
6422 if (ST->hasMVEIntegerOps()) {
6424 unsigned ShPartsOpc = ARMISD::LSLL;
6445 ShPartsOpc = ARMISD::LSRL;
6447 ShPartsOpc = ARMISD::ASRL;
6452 DAG.
SplitScalar(
N->getOperand(0), dl, MVT::i32, MVT::i32);
6466 if (ST->isThumb1Only())
6471 std::tie(
Lo,
Hi) = DAG.
SplitScalar(
N->getOperand(0), dl, MVT::i32, MVT::i32);
6475 unsigned Opc =
N->getOpcode() ==
ISD::SRL ? ARMISD::LSRS1 : ARMISD::ASRS1;
6479 Lo = DAG.
getNode(ARMISD::RRX, dl, MVT::i32,
Lo,
Hi.getValue(1));
6487 bool Invert =
false;
6494 EVT VT =
Op.getValueType();
6502 assert(ST->hasMVEIntegerOps() &&
6503 "No hardware support for integer vector comparison!");
6505 if (
Op.getValueType().getVectorElementType() != MVT::i1)
6526 SDValue Reversed = DAG.
getNode(ARMISD::VREV64, dl, SplitVT, Cmp);
6530 Merged = DAG.
getNOT(dl, Merged, CmpVT);
6540 switch (SetCCOpcode) {
6544 if (ST->hasMVEFloatOps()) {
6547 Invert =
true; [[fallthrough]];
6552 case ISD::SETLT: Swap =
true; [[fallthrough]];
6556 case ISD::SETLE: Swap =
true; [[fallthrough]];
6572 Result = DAG.
getNOT(dl, Result, VT);
6575 case ISD::SETUO: Invert =
true; [[fallthrough]];
6584 Result = DAG.
getNOT(dl, Result, VT);
6590 switch (SetCCOpcode) {
6593 if (ST->hasMVEIntegerOps()) {
6596 Invert =
true; [[fallthrough]];
6599 case ISD::SETLT: Swap =
true; [[fallthrough]];
6601 case ISD::SETLE: Swap =
true; [[fallthrough]];
6618 if (AndOp.getNode() && AndOp.getOpcode() ==
ISD::BITCAST)
6621 if (AndOp.getNode() && AndOp.getOpcode() ==
ISD::AND) {
6626 Result = DAG.
getNOT(dl, Result, VT);
6651 Result = DAG.
getNode(ARMISD::VCMPZ, dl, CmpVT, Op0,
6654 Result = DAG.
getNode(ARMISD::VCMP, dl, CmpVT, Op0, Op1,
6660 Result = DAG.
getNOT(dl, Result, VT);
6672 assert(
LHS.getSimpleValueType().isInteger() &&
"SETCCCARRY is integer only.");
6688 return DAG.
getNode(ARMISD::CMOV,
DL,
Op.getValueType(), FVal, TVal, ARMcc,
6699 unsigned OpCmode, Imm;
6710 switch (SplatBitSize) {
6715 assert((SplatBits & ~0xff) == 0 &&
"one byte splat value is too big");
6718 VT = is128Bits ? MVT::v16i8 : MVT::v8i8;
6723 VT = is128Bits ? MVT::v8i16 : MVT::v4i16;
6724 if ((SplatBits & ~0xff) == 0) {
6730 if ((SplatBits & ~0xff00) == 0) {
6733 Imm = SplatBits >> 8;
6743 VT = is128Bits ? MVT::v4i32 : MVT::v2i32;
6744 if ((SplatBits & ~0xff) == 0) {
6750 if ((SplatBits & ~0xff00) == 0) {
6753 Imm = SplatBits >> 8;
6756 if ((SplatBits & ~0xff0000) == 0) {
6759 Imm = SplatBits >> 16;
6762 if ((SplatBits & ~0xff000000) == 0) {
6765 Imm = SplatBits >> 24;
6772 if ((SplatBits & ~0xffff) == 0 &&
6773 ((SplatBits | SplatUndef) & 0xff) == 0xff) {
6776 Imm = SplatBits >> 8;
6784 if ((SplatBits & ~0xffffff) == 0 &&
6785 ((SplatBits | SplatUndef) & 0xffff) == 0xffff) {
6788 Imm = SplatBits >> 16;
6804 unsigned ImmMask = 1;
6806 for (
int ByteNum = 0; ByteNum < 8; ++ByteNum) {
6807 if (((SplatBits | SplatUndef) & BitMask) == BitMask) {
6809 }
else if ((SplatBits & BitMask) != 0) {
6818 VT = is128Bits ? MVT::v2i64 : MVT::v1i64;
6832 EVT VT =
Op.getValueType();
6833 bool IsDouble = (VT == MVT::f64);
6839 if (
ST->genExecuteOnly()) {
6841 assert((!
ST->isThumb1Only() ||
ST->hasV8MBaselineOps()) &&
6842 "Unexpected architecture");
6860 return DAG.
getNode(ARMISD::VMOVSR,
DL, VT,
6865 if (!
ST->hasVFP3Base())
6870 if (IsDouble && !Subtarget->hasFP64())
6877 if (IsDouble || !
ST->useNEONForSinglePrecisionFP()) {
6895 if (!
ST->hasNEON() || (!IsDouble && !
ST->useNEONForSinglePrecisionFP()))
6904 if (IsDouble && (iVal & 0xffffffff) != (iVal >> 32))
6958 unsigned ExpectedElt = Imm;
6959 for (
unsigned i = 1; i < NumElts; ++i) {
6963 if (ExpectedElt == NumElts)
6966 if (M[i] < 0)
continue;
6967 if (ExpectedElt !=
static_cast<unsigned>(M[i]))
6975 bool &ReverseVEXT,
unsigned &Imm) {
6977 ReverseVEXT =
false;
6988 unsigned ExpectedElt = Imm;
6989 for (
unsigned i = 1; i < NumElts; ++i) {
6993 if (ExpectedElt == NumElts * 2) {
6998 if (M[i] < 0)
continue;
6999 if (ExpectedElt !=
static_cast<unsigned>(M[i]))
7014 return VT == MVT::v8i8 && M.size() == 8;
7019 if (Mask.size() == Elements * 2)
7020 return Index / Elements;
7021 return Mask[Index] == 0 ? 0 : 1;
7051 if ((M.size() != NumElts && M.size() != NumElts * 2) || NumElts % 2 != 0)
7059 for (
unsigned i = 0; i < M.size(); i += NumElts) {
7061 for (
unsigned j = 0; j < NumElts; j += 2) {
7062 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != j + WhichResult) ||
7063 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != j + NumElts + WhichResult))
7068 if (M.size() == NumElts*2)
7083 if ((M.size() != NumElts && M.size() != NumElts * 2) || NumElts % 2 != 0)
7086 for (
unsigned i = 0; i < M.size(); i += NumElts) {
7088 for (
unsigned j = 0; j < NumElts; j += 2) {
7089 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != j + WhichResult) ||
7090 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != j + WhichResult))
7095 if (M.size() == NumElts*2)
7115 if (M.size() != NumElts && M.size() != NumElts*2)
7118 for (
unsigned i = 0; i < M.size(); i += NumElts) {
7120 for (
unsigned j = 0; j < NumElts; ++j) {
7121 if (M[i+j] >= 0 && (
unsigned) M[i+j] != 2 * j + WhichResult)
7126 if (M.size() == NumElts*2)
7145 if (M.size() != NumElts && M.size() != NumElts*2)
7148 unsigned Half = NumElts / 2;
7149 for (
unsigned i = 0; i < M.size(); i += NumElts) {
7151 for (
unsigned j = 0; j < NumElts; j += Half) {
7152 unsigned Idx = WhichResult;
7153 for (
unsigned k = 0; k < Half; ++k) {
7154 int MIdx = M[i + j + k];
7155 if (MIdx >= 0 && (
unsigned) MIdx != Idx)
7162 if (M.size() == NumElts*2)
7186 if ((M.size() != NumElts && M.size() != NumElts * 2) || NumElts % 2 != 0)
7189 for (
unsigned i = 0; i < M.size(); i += NumElts) {
7191 unsigned Idx = WhichResult * NumElts / 2;
7192 for (
unsigned j = 0; j < NumElts; j += 2) {
7193 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != Idx) ||
7194 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != Idx + NumElts))
7200 if (M.size() == NumElts*2)
7219 if ((M.size() != NumElts && M.size() != NumElts * 2) || NumElts % 2 != 0)
7222 for (
unsigned i = 0; i < M.size(); i += NumElts) {
7224 unsigned Idx = WhichResult * NumElts / 2;
7225 for (
unsigned j = 0; j < NumElts; j += 2) {
7226 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != Idx) ||
7227 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != Idx))
7233 if (M.size() == NumElts*2)
7246 unsigned &WhichResult,
7249 if (
isVTRNMask(ShuffleMask, VT, WhichResult))
7250 return ARMISD::VTRN;
7251 if (
isVUZPMask(ShuffleMask, VT, WhichResult))
7252 return ARMISD::VUZP;
7253 if (
isVZIPMask(ShuffleMask, VT, WhichResult))
7254 return ARMISD::VZIP;
7258 return ARMISD::VTRN;
7260 return ARMISD::VUZP;
7262 return ARMISD::VZIP;
7271 if (NumElts != M.size())
7275 for (
unsigned i = 0; i != NumElts; ++i)
7276 if (M[i] >= 0 && M[i] != (
int) (NumElts - 1 - i))
7285 if (NumElts != M.size() || (VT != MVT::v8i16 && VT != MVT::v16i8))
7293 int Ofs = Top ? 1 : 0;
7294 int Upper = SingleSource ? 0 : NumElts;
7295 for (
int i = 0, e = NumElts / 2; i != e; ++i) {
7296 if (M[i] >= 0 && M[i] != (i * 2) + Ofs)
7298 if (M[i + e] >= 0 && M[i + e] != (i * 2) + Ofs +
Upper)
7307 if (NumElts != M.size() || (VT != MVT::v8i16 && VT != MVT::v16i8))
7316 unsigned Offset = Top ? 0 : 1;
7317 unsigned N = SingleSource ? 0 : NumElts;
7318 for (
unsigned i = 0; i < NumElts; i += 2) {
7319 if (M[i] >= 0 && M[i] != (
int)i)
7321 if (M[i + 1] >= 0 && M[i + 1] != (
int)(
N + i +
Offset))
7330 if (NumElts != M.size())
7338 unsigned Off0 = rev ? NumElts / 2 : 0;
7339 unsigned Off1 = rev ? 0 : NumElts / 2;
7340 for (
unsigned i = 0; i < NumElts; i += 2) {
7341 if (M[i] >= 0 && M[i] != (
int)(Off0 + i / 2))
7343 if (M[i + 1] >= 0 && M[i + 1] != (
int)(Off1 + i / 2))
7359 if (!ST->hasMVEFloatOps())
7364 if (VT != MVT::v8f16)
7385 for (
unsigned i = 1; i < 4; i++) {
7400 return DAG.
getNode(ARMISD::VCVTN, dl, VT, N1, Op1,
7412 if (!ST->hasMVEFloatOps())
7417 if (VT != MVT::v4f32)
7433 for (
unsigned i = 1; i < 4; i++) {
7444 return DAG.
getNode(ARMISD::VCVTL, dl, VT, Op0,
7456 Val =
N->getAsZExtVal();
7458 if (ST->isThumb1Only()) {
7459 if (Val <= 255 || ~Val <= 255)
7471 EVT VT =
Op.getValueType();
7473 assert(ST->hasMVEIntegerOps() &&
"LowerBUILD_VECTOR_i1 called without MVE!");
7477 unsigned BitsPerBool;
7481 }
else if (NumElts == 4) {
7484 }
else if (NumElts == 8) {
7487 }
else if (NumElts == 16) {
7498 return U.get().isUndef() || U.get() == FirstOp;
7502 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl,
Op.getValueType(), Ext);
7506 unsigned Bits32 = 0;
7507 for (
unsigned i = 0; i < NumElts; ++i) {
7511 bool BitSet = V.isUndef() ?
false : V->getAsZExtVal();
7513 Bits32 |= BoolMask << (i * BitsPerBool);
7519 for (
unsigned i = 0; i < NumElts; ++i) {
7532 if (!ST->hasMVEIntegerOps())
7536 EVT VT =
Op.getValueType();
7546 if (
N != 1 &&
N != 2 &&
N != 4 &&
N != 8)
7550 for (
unsigned I = 2;
I < NumElts;
I++) {
7566 switch (
N->getOpcode()) {
7577 return N->getOperand(1).getNode() ==
Op;
7579 switch (
N->getConstantOperandVal(0)) {
7580 case Intrinsic::arm_mve_add_predicated:
7581 case Intrinsic::arm_mve_mul_predicated:
7582 case Intrinsic::arm_mve_qadd_predicated:
7583 case Intrinsic::arm_mve_vhadd:
7584 case Intrinsic::arm_mve_hadd_predicated:
7585 case Intrinsic::arm_mve_vqdmulh:
7586 case Intrinsic::arm_mve_qdmulh_predicated:
7587 case Intrinsic::arm_mve_vqrdmulh:
7588 case Intrinsic::arm_mve_qrdmulh_predicated:
7589 case Intrinsic::arm_mve_vqdmull:
7590 case Intrinsic::arm_mve_vqdmull_predicated:
7592 case Intrinsic::arm_mve_sub_predicated:
7593 case Intrinsic::arm_mve_qsub_predicated:
7594 case Intrinsic::arm_mve_vhsub:
7595 case Intrinsic::arm_mve_hsub_predicated:
7596 return N->getOperand(2).getNode() ==
Op;
7611 EVT VT =
Op.getValueType();
7619 APInt SplatBits, SplatUndef;
7620 unsigned SplatBitSize;
7622 if (BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
7629 (SplatBitSize == 8 || SplatBitSize == 16 || SplatBitSize == 32) &&
7631 [BVN](
const SDNode *U) { return IsQRMVEInstruction(U, BVN); })) {
7632 EVT DupVT = SplatBitSize == 32 ? MVT::v4i32
7633 : SplatBitSize == 16 ? MVT::v8i16
7637 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, VDup);
7640 if ((
ST->hasNEON() && SplatBitSize <= 64) ||
7641 (
ST->hasMVEIntegerOps() && SplatBitSize <= 64)) {
7646 SplatBitSize, DAG, dl, VmovVT, VT,
VMOVModImm);
7650 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Vmov);
7654 uint64_t NegatedImm = (~SplatBits).getZExtValue();
7656 NegatedImm, SplatUndef.
getZExtValue(), SplatBitSize, DAG, dl, VmovVT,
7660 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Vmov);
7664 if ((VT == MVT::v2f32 || VT == MVT::v4f32) && SplatBitSize == 32) {
7668 return DAG.
getNode(ARMISD::VMOVFPIMM, dl, VT, Val);
7674 if (
ST->hasMVEIntegerOps() &&
7675 (SplatBitSize == 8 || SplatBitSize == 16 || SplatBitSize == 32)) {
7676 EVT DupVT = SplatBitSize == 32 ? MVT::v4i32
7677 : SplatBitSize == 16 ? MVT::v8i16
7681 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, VDup);
7694 bool isOnlyLowElement =
true;
7695 bool usesOnlyOneValue =
true;
7696 bool hasDominantValue =
false;
7701 DenseMap<SDValue, unsigned> ValueCounts;
7703 for (
unsigned i = 0; i < NumElts; ++i) {
7708 isOnlyLowElement =
false;
7712 unsigned &
Count = ValueCounts[
V];
7715 if (++
Count > (NumElts / 2)) {
7716 hasDominantValue =
true;
7720 if (ValueCounts.
size() != 1)
7721 usesOnlyOneValue =
false;
7722 if (!
Value.getNode() && !ValueCounts.
empty())
7725 if (ValueCounts.
empty())
7737 if (hasDominantValue && EltSize <= 32) {
7746 ConstantSDNode *constIndex;
7753 if (VT !=
Value->getOperand(0).getValueType()) {
7756 N = DAG.
getNode(ARMISD::VDUPLANE, dl, VT,
7761 N = DAG.
getNode(ARMISD::VDUPLANE, dl, VT,
7766 if (!usesOnlyOneValue) {
7769 for (
unsigned I = 0;
I < NumElts; ++
I) {
7774 Ops.push_back(
Op.getOperand(
I));
7784 assert(FVT == MVT::f32 || FVT == MVT::f16);
7785 MVT IVT = (FVT == MVT::f32) ? MVT::i32 : MVT::i16;
7786 for (
unsigned i = 0; i < NumElts; ++i)
7791 Val = LowerBUILD_VECTOR(Val, DAG, ST);
7795 if (usesOnlyOneValue) {
7798 return DAG.
getNode(ARMISD::VDUP, dl, VT, Val);
7822 if (
ST->hasNEON() && VT.
is128BitVector() && VT != MVT::v2f64 && VT != MVT::v4f32) {
7842 if (EltSize >= 32) {
7848 for (
unsigned i = 0; i < NumElts; ++i)
7862 for (
unsigned i = 0 ; i < NumElts; ++i) {
7881 EVT VT =
Op.getValueType();
7884 struct ShuffleSourceInfo {
7886 unsigned MinElt = std::numeric_limits<unsigned>::max();
7887 unsigned MaxElt = 0;
7897 int WindowScale = 1;
7899 ShuffleSourceInfo(
SDValue Vec) : Vec(Vec), ShuffleVec(Vec) {}
7907 for (
unsigned i = 0; i < NumElts; ++i) {
7922 SDValue SourceVec =
V.getOperand(0);
7924 if (Source == Sources.
end())
7928 unsigned EltNo =
V.getConstantOperandVal(1);
7935 if (Sources.
size() > 2)
7941 for (
auto &Source : Sources) {
7942 EVT SrcEltTy =
Source.Vec.getValueType().getVectorElementType();
7943 if (SrcEltTy.
bitsLT(SmallestEltTy))
7944 SmallestEltTy = SrcEltTy;
7946 unsigned ResMultiplier =
7954 for (
auto &Src : Sources) {
7955 EVT SrcVT = Src.ShuffleVec.getValueType();
7959 if (SrcVTSize == VTSize)
7968 if (SrcVTSize < VTSize) {
7969 if (2 * SrcVTSize != VTSize)
7975 DAG.
getUNDEF(Src.ShuffleVec.getValueType()));
7979 if (SrcVTSize != 2 * VTSize)
7982 if (Src.MaxElt - Src.MinElt >= NumSrcElts) {
7987 if (Src.MinElt >= NumSrcElts) {
7992 Src.WindowBase = -NumSrcElts;
7993 }
else if (Src.MaxElt < NumSrcElts) {
8007 Src.ShuffleVec = DAG.
getNode(ARMISD::VEXT, dl, DestVT, VEXTSrc1,
8010 Src.WindowBase = -Src.MinElt;
8017 for (
auto &Src : Sources) {
8018 EVT SrcEltTy = Src.ShuffleVec.getValueType().getVectorElementType();
8019 if (SrcEltTy == SmallestEltTy)
8022 Src.ShuffleVec = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, ShuffleVT, Src.ShuffleVec);
8024 Src.WindowBase *= Src.WindowScale;
8029 for (
auto Src : Sources)
8030 assert(Src.ShuffleVec.getValueType() == ShuffleVT);
8038 if (
Entry.isUndef())
8047 EVT OrigEltTy =
Entry.getOperand(0).getValueType().getVectorElementType();
8050 int LanesDefined = BitsDefined / BitsPerShuffleLane;
8054 int *LaneMask = &
Mask[i * ResMultiplier];
8056 int ExtractBase = EltNo * Src->WindowScale + Src->WindowBase;
8057 ExtractBase += NumElts * (Src - Sources.begin());
8058 for (
int j = 0;
j < LanesDefined; ++
j)
8059 LaneMask[j] = ExtractBase + j;
8065 assert(Sources.size() <= 2 &&
"Too many sources!");
8068 for (
unsigned i = 0; i < Sources.size(); ++i)
8075 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Shuffle);
8097 unsigned OpNum = (PFEntry >> 26) & 0x0F;
8117 unsigned PFIndexes[4];
8118 for (
unsigned i = 0; i != 4; ++i) {
8122 PFIndexes[i] = M[i];
8126 unsigned PFTableIndex =
8127 PFIndexes[0]*9*9*9+PFIndexes[1]*9*9+PFIndexes[2]*9+PFIndexes[3];
8129 unsigned Cost = (PFEntry >> 30);
8135 bool ReverseVEXT, isV_UNDEF;
8136 unsigned Imm, WhichResult;
8139 if (EltSize >= 32 ||
8146 else if (Subtarget->hasNEON() &&
8151 else if ((VT == MVT::v8i16 || VT == MVT::v8f16 || VT == MVT::v16i8) &&
8154 else if (Subtarget->hasMVEIntegerOps() &&
8158 else if (Subtarget->hasMVEIntegerOps() &&
8172 unsigned OpNum = (PFEntry >> 26) & 0x0F;
8173 unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
8174 unsigned RHSID = (PFEntry >> 0) & ((1 << 13)-1);
8177 if (LHSID == (1*9+2)*9+3)
return LHS;
8178 assert(LHSID == ((4*9+5)*9+6)*9+7 &&
"Illegal OP_COPY!");
8192 return DAG.
getNode(ARMISD::VREV64, dl, VT, OpLHS);
8195 return DAG.
getNode(ARMISD::VREV32, dl, VT, OpLHS);
8198 return DAG.
getNode(ARMISD::VREV16, dl, VT, OpLHS);
8203 return DAG.
getNode(ARMISD::VDUPLANE, dl, VT,
8208 return DAG.
getNode(ARMISD::VEXT, dl, VT,
8235 for (
int I : ShuffleMask)
8239 return DAG.
getNode(ARMISD::VTBL1,
DL, MVT::v8i8, V1,
8242 return DAG.
getNode(ARMISD::VTBL2,
DL, MVT::v8i8, V1, V2,
8248 EVT VT =
Op.getValueType();
8250 assert((VT == MVT::v8i16 || VT == MVT::v8f16 || VT == MVT::v16i8) &&
8251 "Expect an v8i16/v16i8 type");
8257 std::vector<int> NewMask;
8261 NewMask.push_back(i);
8291 AllZeroes = DAG.
getNode(ARMISD::VMOVIMM, dl, MVT::v16i8, AllZeroes);
8301 if (VT != MVT::v16i1)
8302 RecastV1 = DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::v16i1, Pred);
8317 EVT VT =
Op.getValueType();
8321 assert(ST->hasMVEIntegerOps() &&
8322 "No support for vector shuffle of boolean predicates");
8332 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl, VT, srl);
8348 "Expected identical vector type in expanded i1 shuffle!");
8352 PredAsVector2, ShuffleMask);
8357 if (VT == MVT::v2i1) {
8358 SDValue BC = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Shuffled);
8361 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::v2i1, Cmp);
8363 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, Shuffled,
8374 EVT VT =
Op.getValueType();
8378 assert((VT == MVT::v8i16 || VT == MVT::v8f16 || VT == MVT::v16i8) &&
8379 "Unexpected vector type");
8381 int QuarterSize = NumElts / 4;
8390 for (
int i = 0; i <
Length; i++) {
8391 if (ShuffleMask[Start + i] >= 0) {
8392 if (ShuffleMask[Start + i] %
Length != i)
8394 MovIdx = ShuffleMask[Start + i] /
Length;
8402 for (
int i = 1; i <
Length; i++) {
8403 if (ShuffleMask[Start + i] >= 0 &&
8404 (ShuffleMask[Start + i] /
Length != MovIdx ||
8405 ShuffleMask[Start + i] %
Length != i))
8411 for (
int Part = 0; Part < 4; ++Part) {
8413 int Elt = getMovIdx(ShuffleMask, Part * QuarterSize, QuarterSize);
8427 if (!Parts[0] && !Parts[1] && !Parts[2] && !Parts[3])
8432 if (!Parts[0] || !Parts[1] || !Parts[2] || !Parts[3]) {
8434 for (
int Part = 0; Part < 4; ++Part)
8435 for (
int i = 0; i < QuarterSize; i++)
8437 Parts[Part] ? -1 : ShuffleMask[Part * QuarterSize + i]);
8439 VT, dl,
Op->getOperand(0),
Op->getOperand(1), NewShuffleMask);
8442 for (
int Part = 0; Part < 4; ++Part)
8458 EVT VT =
Op.getValueType();
8470 for (
int i = 0, NumMaskElts = Mask.size(); i < NumMaskElts; ++i) {
8474 if (Mask[i] != i + BaseOffset) {
8475 if (OffElement == -1)
8481 return NonUndef > 2 && OffElement != -1;
8485 if (isOneOffIdentityMask(ShuffleMask, VT, 0, OffElement))
8487 else if (isOneOffIdentityMask(ShuffleMask, VT, NumElts, OffElement))
8498 ShuffleMask[OffElement] < (
int)NumElts ? V1 : V2,
8509 EVT VT =
Op.getValueType();
8513 if (ST->hasMVEIntegerOps() && EltSize == 1)
8524 if (EltSize <= 32) {
8528 if (Lane == -1) Lane = 0;
8539 bool IsScalarToVector =
true;
8542 IsScalarToVector =
false;
8545 if (IsScalarToVector)
8548 return DAG.
getNode(ARMISD::VDUPLANE, dl, VT, V1,
8552 bool ReverseVEXT =
false;
8554 if (ST->hasNEON() &&
isVEXTMask(ShuffleMask, VT, ReverseVEXT, Imm)) {
8557 return DAG.
getNode(ARMISD::VEXT, dl, VT, V1, V2,
8562 return DAG.
getNode(ARMISD::VREV64, dl, VT, V1);
8564 return DAG.
getNode(ARMISD::VREV32, dl, VT, V1);
8566 return DAG.
getNode(ARMISD::VREV16, dl, VT, V1);
8569 return DAG.
getNode(ARMISD::VEXT, dl, VT, V1, V1,
8578 unsigned WhichResult = 0;
8579 bool isV_UNDEF =
false;
8580 if (ST->hasNEON()) {
8582 ShuffleMask, VT, WhichResult, isV_UNDEF)) {
8589 if (ST->hasMVEIntegerOps()) {
8591 return DAG.
getNode(ARMISD::VMOVN, dl, VT, V2, V1,
8594 return DAG.
getNode(ARMISD::VMOVN, dl, VT, V1, V2,
8597 return DAG.
getNode(ARMISD::VMOVN, dl, VT, V1, V1,
8624 }) &&
"Unexpected shuffle index into UNDEF operand!");
8627 ShuffleMask, SubVT, WhichResult, isV_UNDEF)) {
8630 assert((WhichResult == 0) &&
8631 "In-place shuffle of concat can only have one result!");
8640 if (ST->hasMVEIntegerOps() && EltSize <= 32) {
8644 for (
bool Top : {
false,
true}) {
8645 for (
bool SingleSource : {
false,
true}) {
8646 if (
isTruncMask(ShuffleMask, VT, Top, SingleSource)) {
8651 SingleSource ? V1 : V2);
8667 unsigned PFIndexes[4];
8668 for (
unsigned i = 0; i != 4; ++i) {
8669 if (ShuffleMask[i] < 0)
8672 PFIndexes[i] = ShuffleMask[i];
8676 unsigned PFTableIndex =
8677 PFIndexes[0]*9*9*9+PFIndexes[1]*9*9+PFIndexes[2]*9+PFIndexes[3];
8679 unsigned Cost = (PFEntry >> 30);
8685 unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
8686 unsigned RHSID = (PFEntry >> 0) & ((1 << 13)-1);
8696 if (EltSize >= 32) {
8704 for (
unsigned i = 0; i < NumElts; ++i) {
8705 if (ShuffleMask[i] < 0)
8709 ShuffleMask[i] < (
int)NumElts ? V1 : V2,
8717 if ((VT == MVT::v8i16 || VT == MVT::v8f16 || VT == MVT::v16i8) &&
8721 if (ST->hasNEON() && VT == MVT::v8i8)
8725 if (ST->hasMVEIntegerOps())
8734 EVT VecVT =
Op.getOperand(0).getValueType();
8737 assert(ST->hasMVEIntegerOps() &&
8738 "LowerINSERT_VECTOR_ELT_i1 called without MVE!");
8741 DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::i32,
Op->getOperand(0));
8742 unsigned Lane =
Op.getConstantOperandVal(2);
8743 unsigned LaneWidth =
8745 unsigned Mask = ((1 << LaneWidth) - 1) << Lane * LaneWidth;
8750 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl,
Op.getValueType(), BFI);
8763 if (Subtarget->hasMVEIntegerOps() &&
8764 Op.getValueType().getScalarSizeInBits() == 1)
8788 IVecIn, IElt, Lane);
8797 EVT VecVT =
Op.getOperand(0).getValueType();
8800 assert(ST->hasMVEIntegerOps() &&
8801 "LowerINSERT_VECTOR_ELT_i1 called without MVE!");
8804 DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::i32,
Op->getOperand(0));
8805 unsigned Lane =
Op.getConstantOperandVal(1);
8806 unsigned LaneWidth =
8828 return DAG.
getNode(ARMISD::VGETLANEu, dl, MVT::i32, Vec, Lane);
8837 assert(
Op.getValueType().getScalarSizeInBits() == 1 &&
8838 "Unexpected custom CONCAT_VECTORS lowering");
8840 "Unexpected custom CONCAT_VECTORS lowering");
8841 assert(ST->hasMVEIntegerOps() &&
8842 "CONCAT_VECTORS lowering only supported for MVE");
8846 EVT Op2VT = V2.getValueType();
8847 assert(Op1VT == Op2VT &&
"Operand types don't match!");
8848 assert((Op1VT == MVT::v2i1 || Op1VT == MVT::v4i1 || Op1VT == MVT::v8i1) &&
8849 "Unexpected i1 concat operations!");
8862 if (Op1VT == MVT::v4i1 || Op1VT == MVT::v8i1) {
8867 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, ConVec,
8876 auto ExtractInto = [&DAG, &dl](
SDValue NewV,
SDValue ConVec,
unsigned &j) {
8877 EVT NewVT = NewV.getValueType();
8878 EVT ConcatVT = ConVec.getValueType();
8879 unsigned ExtScale = 1;
8880 if (NewVT == MVT::v2f64) {
8881 NewV = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, NewV);
8894 ConVec = ExtractInto(NewV1, ConVec, j);
8895 ConVec = ExtractInto(NewV2, ConVec, j);
8899 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, ConVec,
8905 while (ConcatOps.
size() > 1) {
8906 for (
unsigned I = 0,
E = ConcatOps.
size();
I !=
E;
I += 2) {
8909 ConcatOps[
I / 2] = ConcatPair(V1, V2);
8913 return ConcatOps[0];
8918 EVT VT =
Op->getValueType(0);
8924 assert(
Op.getValueType().is128BitVector() &&
Op.getNumOperands() == 2 &&
8925 "unexpected CONCAT_VECTORS");
8946 EVT VT =
Op.getValueType();
8952 "Unexpected custom EXTRACT_SUBVECTOR lowering");
8953 assert(ST->hasMVEIntegerOps() &&
8954 "EXTRACT_SUBVECTOR lowering only supported for MVE");
8964 EVT SubVT = MVT::v4i32;
8966 for (
unsigned i = Index, j = 0; i < (Index + NumElts); i++, j += 2) {
8976 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::v2i1, Cmp);
8981 for (
unsigned i = Index, j = 0; i < (Index + NumElts); i++, j++) {
8990 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, SubVec,
8997 assert(ST->hasMVEIntegerOps() &&
"Expected MVE!");
8998 EVT VT =
N->getValueType(0);
8999 assert((VT == MVT::v16i1 || VT == MVT::v8i1 || VT == MVT::v4i1) &&
9000 "Expected a vector i1 type!");
9002 EVT FromVT =
Op.getValueType();
9013 if (!Subtarget->hasMVEIntegerOps())
9016 EVT ToVT =
N->getValueType(0);
9059 if (ToVT != MVT::v8i16 && ToVT != MVT::v16i8)
9061 EVT FromVT =
N->getOperand(0).getValueType();
9062 if (FromVT != MVT::v8i32 && FromVT != MVT::v16i16)
9073 if (!Subtarget->hasMVEIntegerOps())
9078 EVT ToVT =
N->getValueType(0);
9079 if (ToVT != MVT::v16i32 && ToVT != MVT::v8i32 && ToVT != MVT::v16i16)
9082 EVT FromVT =
Op.getValueType();
9083 if (FromVT != MVT::v8i16 && FromVT != MVT::v16i8)
9097 Ext = DAG.
getNode(
N->getOpcode(),
DL, MVT::v8i32, Ext);
9098 Ext1 = DAG.
getNode(
N->getOpcode(),
DL, MVT::v8i32, Ext1);
9110 EVT VT =
N->getValueType(0);
9112 SDNode *BVN =
N->getOperand(0).getNode();
9117 unsigned HiElt = 1 - LoElt;
9122 if (!Lo0 || !Hi0 || !Lo1 || !Hi1)
9138 for (
unsigned i = 0, e =
N->getNumOperands(); i != e; ++i) {
9139 SDNode *Elt =
N->getOperand(i).getNode();
9142 unsigned HalfSize = EltSize / 2;
9144 if (!
isIntN(HalfSize,
C->getSExtValue()))
9147 if (!
isUIntN(HalfSize,
C->getZExtValue()))
9186 switch (OrigSimpleTy) {
9202 unsigned ExtOpcode) {
9225 if (ExtendedTy == LD->getMemoryVT())
9226 return DAG.
getLoad(LD->getMemoryVT(),
SDLoc(LD), LD->getChain(),
9227 LD->getBasePtr(), LD->getPointerInfo(), LD->getAlign(),
9228 LD->getMemOperand()->getFlags());
9234 LD->getChain(), LD->getBasePtr(), LD->getPointerInfo(),
9235 LD->getMemoryVT(), LD->getAlign(),
9236 LD->getMemOperand()->getFlags());
9249 N->getOperand(0)->getValueType(0),
9255 "Expected extending load");
9261 DAG.
getNode(Opcode,
SDLoc(newLoad), LD->getValueType(0), newLoad);
9270 SDNode *BVN =
N->getOperand(0).getNode();
9272 BVN->
getValueType(0) == MVT::v4i32 &&
"expected v4i32 BUILD_VECTOR");
9280 EVT VT =
N->getValueType(0);
9286 for (
unsigned i = 0; i != NumElts; ++i) {
9287 const APInt &CInt =
N->getConstantOperandAPInt(i);
9296 unsigned Opcode =
N->getOpcode();
9298 SDNode *N0 =
N->getOperand(0).getNode();
9299 SDNode *N1 =
N->getOperand(1).getNode();
9307 unsigned Opcode =
N->getOpcode();
9309 SDNode *N0 =
N->getOperand(0).getNode();
9310 SDNode *N1 =
N->getOperand(1).getNode();
9320 EVT VT =
Op.getValueType();
9322 "unexpected type for custom-lowering ISD::MUL");
9323 SDNode *N0 =
Op.getOperand(0).getNode();
9324 SDNode *N1 =
Op.getOperand(1).getNode();
9325 unsigned NewOpc = 0;
9329 if (isN0SExt && isN1SExt)
9330 NewOpc = ARMISD::VMULLs;
9334 if (isN0ZExt && isN1ZExt)
9335 NewOpc = ARMISD::VMULLu;
9336 else if (isN1SExt || isN1ZExt) {
9340 NewOpc = ARMISD::VMULLs;
9343 NewOpc = ARMISD::VMULLu;
9347 NewOpc = ARMISD::VMULLu;
9353 if (VT == MVT::v2i64)
9370 "unexpected types for extended operands to VMULL");
9371 return DAG.
getNode(NewOpc,
DL, VT, Op0, Op1);
9406 DAG.
getConstant(Intrinsic::arm_neon_vrecpe, dl, MVT::i32),
9440 DAG.
getConstant(Intrinsic::arm_neon_vrecpe, dl, MVT::i32),
9443 DAG.
getConstant(Intrinsic::arm_neon_vrecps, dl, MVT::i32),
9464 EVT VT =
Op.getValueType();
9465 assert((VT == MVT::v4i16 || VT == MVT::v8i8) &&
9466 "unexpected type for custom-lowering ISD::SDIV");
9473 if (VT == MVT::v8i8) {
9501 EVT VT =
Op.getValueType();
9502 assert((VT == MVT::v4i16 || VT == MVT::v8i8) &&
9503 "unexpected type for custom-lowering ISD::UDIV");
9510 if (VT == MVT::v8i8) {
9549 DAG.
getConstant(Intrinsic::arm_neon_vrecpe, dl, MVT::i32),
9552 DAG.
getConstant(Intrinsic::arm_neon_vrecps, dl, MVT::i32),
9556 DAG.
getConstant(Intrinsic::arm_neon_vrecps, dl, MVT::i32),
9577 EVT VT =
N->getValueType(0);
9590 Result = DAG.
getNode(ARMISD::ADDE,
DL, VTs,
Op.getOperand(0),
9591 Op.getOperand(1), Carry);
9604 Result = DAG.
getNode(ARMISD::SUBE,
DL, VTs,
Op.getOperand(0),
9605 Op.getOperand(1), Carry);
9622 EVT VT =
Op.getValueType();
9623 assert((VT == MVT::i32 || VT == MVT::i64) &&
9624 "unexpected type for custom lowering DIV");
9630 LC = VT == MVT::i32 ? RTLIB::SDIVREM_I32 : RTLIB::SDIVREM_I64;
9632 LC = VT == MVT::i32 ? RTLIB::UDIVREM_I32 : RTLIB::UDIVREM_I64;
9639 for (
auto AI : {1, 0}) {
9641 Args.emplace_back(Operand,
9648 ES, std::move(Args));
9658ARMTargetLowering::BuildSDIVPow2(
SDNode *
N,
const APInt &Divisor,
9666 const bool MinSize =
ST.hasMinSize();
9667 const bool HasDivide =
ST.isThumb() ?
ST.hasDivideInThumbMode()
9668 :
ST.hasDivideInARMMode();
9672 if (
N->getOperand(0).getValueType().isVector())
9677 if (!(MinSize && HasDivide))
9690 if (Divisor.
sgt(128))
9698 assert(
Op.getValueType() == MVT::i32 &&
9699 "unexpected type for custom lowering DIV");
9702 SDValue DBZCHK = DAG.
getNode(ARMISD::WIN__DBZCHK, dl, MVT::Other,
9705 return LowerWindowsDIVLibCall(
Op, DAG,
Signed, DBZCHK);
9711 if (
N->getValueType(0) == MVT::i32)
9712 return DAG.
getNode(ARMISD::WIN__DBZCHK,
DL, MVT::Other, InChain,
Op);
9715 return DAG.
getNode(ARMISD::WIN__DBZCHK,
DL, MVT::Other, InChain,
9719void ARMTargetLowering::ExpandDIV_Windows(
9724 assert(
Op.getValueType() == MVT::i64 &&
9725 "unexpected type for custom lowering DIV");
9742 EVT MemVT = LD->getMemoryVT();
9743 assert((MemVT == MVT::v2i1 || MemVT == MVT::v4i1 || MemVT == MVT::v8i1 ||
9744 MemVT == MVT::v16i1) &&
9745 "Expected a predicate type!");
9746 assert(MemVT ==
Op.getValueType());
9748 "Expected a non-extending load");
9749 assert(LD->isUnindexed() &&
"Expected a unindexed load");
9763 ISD::EXTLOAD, dl, MVT::i32, LD->getChain(), LD->getBasePtr(),
9765 LD->getMemOperand());
9771 SDValue Pred = DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::v16i1, Val);
9772 if (MemVT != MVT::v16i1)
9781 EVT MemVT =
LD->getMemoryVT();
9782 assert(
LD->isUnindexed() &&
"Loads should be unindexed at this point.");
9784 if (MemVT == MVT::i64 && Subtarget->hasV5TEOps() &&
9785 !Subtarget->isThumb1Only() &&
LD->isVolatile() &&
9786 LD->getAlign() >= Subtarget->getDualLoadStoreAlignment()) {
9789 ARMISD::LDRD, dl, DAG.
getVTList({MVT::i32, MVT::i32, MVT::Other}),
9790 {LD->getChain(), LD->getBasePtr()}, MemVT,
LD->getMemOperand());
9800 EVT MemVT = ST->getMemoryVT();
9801 assert((MemVT == MVT::v2i1 || MemVT == MVT::v4i1 || MemVT == MVT::v8i1 ||
9802 MemVT == MVT::v16i1) &&
9803 "Expected a predicate type!");
9804 assert(MemVT == ST->getValue().getValueType());
9805 assert(!ST->isTruncatingStore() &&
"Expected a non-extending store");
9806 assert(ST->isUnindexed() &&
"Expected a unindexed store");
9811 SDValue Build = ST->getValue();
9812 if (MemVT != MVT::v16i1) {
9825 SDValue GRP = DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::i32, Build);
9831 ST->getChain(), dl, GRP, ST->getBasePtr(),
9833 ST->getMemOperand());
9839 EVT MemVT = ST->getMemoryVT();
9840 assert(ST->isUnindexed() &&
"Stores should be unindexed at this point.");
9842 if (MemVT == MVT::i64 && Subtarget->hasV5TEOps() &&
9858 {ST->getChain(), Lo, Hi, ST->getBasePtr()},
9859 MemVT, ST->getMemOperand());
9860 }
else if (Subtarget->hasMVEIntegerOps() &&
9861 ((MemVT == MVT::v2i1 || MemVT == MVT::v4i1 || MemVT == MVT::v8i1 ||
9862 MemVT == MVT::v16i1))) {
9871 (
N->getOpcode() == ARMISD::VMOVIMM &&
9877 MVT VT =
Op.getSimpleValueType();
9879 SDValue PassThru =
N->getPassThru();
9890 VT, dl,
N->getChain(),
N->getBasePtr(),
N->getOffset(), Mask, ZeroVec,
9891 N->getMemoryVT(),
N->getMemOperand(),
N->getAddressingMode(),
9892 N->getExtensionType(),
N->isExpandingLoad());
9895 PassThru.
getOpcode() == ARMISD::VECTOR_REG_CAST) &&
9897 if (!PassThru.
isUndef() && !PassThruIsCastZero)
9904 if (!ST->hasMVEIntegerOps())
9908 unsigned BaseOpcode = 0;
9909 switch (
Op->getOpcode()) {
9925 unsigned NumActiveLanes = NumElts;
9927 assert((NumActiveLanes == 16 || NumActiveLanes == 8 || NumActiveLanes == 4 ||
9928 NumActiveLanes == 2) &&
9929 "Only expected a power 2 vector size");
9933 while (NumActiveLanes > 4) {
9934 unsigned RevOpcode = NumActiveLanes == 16 ? ARMISD::VREV16 : ARMISD::VREV32;
9936 Op0 = DAG.
getNode(BaseOpcode, dl, VT, Op0, Rev);
9937 NumActiveLanes /= 2;
9941 if (NumActiveLanes == 4) {
9951 SDValue Res0 = DAG.
getNode(BaseOpcode, dl, EltVT, Ext0, Ext1,
Op->getFlags());
9952 SDValue Res1 = DAG.
getNode(BaseOpcode, dl, EltVT, Ext2, Ext3,
Op->getFlags());
9953 Res = DAG.
getNode(BaseOpcode, dl, EltVT, Res0, Res1,
Op->getFlags());
9959 Res = DAG.
getNode(BaseOpcode, dl, EltVT, Ext0, Ext1,
Op->getFlags());
9963 if (EltVT !=
Op->getValueType(0))
9970 if (!ST->hasMVEFloatOps())
9985 unsigned PairwiseIntrinsic = 0;
9986 switch (
Op->getOpcode()) {
9990 PairwiseIntrinsic = Intrinsic::arm_neon_vpminu;
9993 PairwiseIntrinsic = Intrinsic::arm_neon_vpmaxu;
9996 PairwiseIntrinsic = Intrinsic::arm_neon_vpmins;
9999 PairwiseIntrinsic = Intrinsic::arm_neon_vpmaxs;
10005 unsigned NumActiveLanes = NumElts;
10007 assert((NumActiveLanes == 16 || NumActiveLanes == 8 || NumActiveLanes == 4 ||
10008 NumActiveLanes == 2) &&
10009 "Only expected a power 2 vector size");
10015 VT =
Lo.getValueType();
10017 NumActiveLanes /= 2;
10021 while (NumActiveLanes > 1) {
10023 NumActiveLanes /= 2;
10030 if (EltVT !=
Op.getValueType()) {
10031 unsigned Extend = 0;
10032 switch (
Op->getOpcode()) {
10044 Res = DAG.
getNode(Extend, dl,
Op.getValueType(), Res);
10089 const SDValue Ops[] = {RegClass, V0, SubReg0, V1, SubReg1};
10095 SDLoc dl(V.getNode());
10096 auto [VLo, VHi] = DAG.
SplitScalar(V, dl, MVT::i32, MVT::i32);
10106 assert(
N->getValueType(0) == MVT::i64 &&
10107 "AtomicCmpSwap on types less than 64 should be legal");
10116 ARM::CMP_SWAP_64,
SDLoc(
N),
10117 DAG.
getVTList(MVT::Untyped, MVT::Untyped, MVT::Other),
Ops);
10136 EVT VT =
Op.getValueType();
10145 if (isUnsupportedFloatingType(
LHS.getValueType())) {
10147 Chain, IsSignaling);
10148 if (!
RHS.getNode()) {
10164 SDValue Result = getCMOV(dl, VT, False, True, ARMcc, Cmp, DAG);
10166 ARMcc = DAG.
getConstant(CondCode2, dl, MVT::i32);
10167 Result = getCMOV(dl, VT, Result, True, ARMcc, Cmp, DAG);
10184 MVT SVT =
Op.getOperand(0).getSimpleValueType();
10187 makeLibCall(DAG, LC, MVT::f32,
Op.getOperand(0), CallOptions,
DL).first;
10200 if (!IsSigned && Subtarget->isThumb1Only()) {
10218 Sub1Result, Sub1Result, Flags1);
10233 if (
Op.getValueType() != MVT::i32)
10247 unsigned Opcode = ARMISD::SUBC;
10256 bool CanUseAdd =
false;
10272 Opcode = ARMISD::ADDC;
10296 SDValue Result1 = DAG.
getNode(ARMISD::CMOV, dl, MVT::i32, OpResult, One,
10297 GTCondValue, Flags);
10301 SDValue Result2 = DAG.
getNode(ARMISD::CMOV, dl, MVT::i32, Result1, MinusOne,
10302 LTCondValue, Flags);
10304 if (
Op.getValueType() != MVT::i32)
10312 switch (
Op.getOpcode()) {
10344 case ISD::BITCAST:
return ExpandBITCAST(
Op.getNode(), DAG, Subtarget);
10348 case ISD::SREM:
return LowerREM(
Op.getNode(), DAG);
10349 case ISD::UREM:
return LowerREM(
Op.getNode(), DAG);
10371 return LowerSET_FPMODE(
Op, DAG);
10373 return LowerRESET_FPMODE(
Op, DAG);
10376 if (Subtarget->isTargetWindows() && !
Op.getValueType().isVector())
10377 return LowerDIV_Windows(
Op, DAG,
true);
10380 if (Subtarget->isTargetWindows() && !
Op.getValueType().isVector())
10381 return LowerDIV_Windows(
Op, DAG,
false);
10388 return LowerSignedALUO(
Op, DAG);
10391 return LowerUnsignedALUO(
Op, DAG);
10424 if (Subtarget->isTargetWindows())
10425 return LowerDYNAMIC_STACKALLOC(
Op, DAG);
10434 return LowerSPONENTRY(
Op, DAG);
10436 return LowerFP_TO_BF16(
Op, DAG);
10437 case ARMISD::WIN__DBZCHK:
return SDValue();
10440 return LowerCMP(
Op, DAG);
10442 return LowerABS(
Op, DAG);
10447 assert((
Op.getOperand(1).getValueType() == MVT::f16 ||
10448 Op.getOperand(1).getValueType() == MVT::bf16) &&
10449 "Expected custom lowering of rounding operations only for f16");
10452 {
Op.getOperand(0),
Op.getOperand(1)});
10453 return DAG.
getNode(
Op.getOpcode(),
DL, {Op.getValueType(), MVT::Other},
10454 {Ext.getValue(1), Ext.getValue(0)});
10461 unsigned IntNo =
N->getConstantOperandVal(0);
10463 if (IntNo == Intrinsic::arm_smlald)
10464 Opc = ARMISD::SMLALD;
10465 else if (IntNo == Intrinsic::arm_smlaldx)
10466 Opc = ARMISD::SMLALDX;
10467 else if (IntNo == Intrinsic::arm_smlsld)
10468 Opc = ARMISD::SMLSLD;
10469 else if (IntNo == Intrinsic::arm_smlsldx)
10470 Opc = ARMISD::SMLSLDX;
10476 std::tie(
Lo,
Hi) = DAG.
SplitScalar(
N->getOperand(3), dl, MVT::i32, MVT::i32);
10480 N->getOperand(1),
N->getOperand(2),
10492 switch (
N->getOpcode()) {
10499 Res = ExpandBITCAST(
N, DAG, Subtarget);
10508 Res = LowerREM(
N, DAG);
10512 Res = LowerDivRem(
SDValue(
N, 0), DAG);
10528 assert(Subtarget->isTargetWindows() &&
"can only expand DIV on Windows");
10566 "ROPI/RWPI not currently supported with SjLj");
10575 bool isThumb = Subtarget->isThumb();
10576 bool isThumb2 = Subtarget->
isThumb2();
10579 unsigned PCAdj = (
isThumb || isThumb2) ? 4 : 8;
10585 : &ARM::GPRRegClass;
10603 Register NewVReg1 =
MRI->createVirtualRegister(TRC);
10609 Register NewVReg2 =
MRI->createVirtualRegister(TRC);
10615 Register NewVReg3 =
MRI->createVirtualRegister(TRC);
10633 Register NewVReg1 =
MRI->createVirtualRegister(TRC);
10638 Register NewVReg2 =
MRI->createVirtualRegister(TRC);
10643 Register NewVReg3 =
MRI->createVirtualRegister(TRC);
10648 Register NewVReg4 =
MRI->createVirtualRegister(TRC);
10654 Register NewVReg5 =
MRI->createVirtualRegister(TRC);
10669 Register NewVReg1 =
MRI->createVirtualRegister(TRC);
10675 Register NewVReg2 =
MRI->createVirtualRegister(TRC);
10691 const TargetInstrInfo *
TII = Subtarget->getInstrInfo();
10698 const TargetRegisterClass *TRC = Subtarget->isThumb() ? &ARM::tGPRRegClass
10699 : &ARM::GPRnopcRegClass;
10703 DenseMap<unsigned, SmallVector<MachineBasicBlock*, 2>> CallSiteNumToLPad;
10704 unsigned MaxCSNum = 0;
10705 for (MachineBasicBlock &BB : *MF) {
10711 for (MachineInstr &
II : BB) {
10712 if (!
II.isEHLabel())
10715 MCSymbol *Sym =
II.getOperand(0).getMCSymbol();
10716 if (!MF->hasCallSiteLandingPad(Sym))
continue;
10718 SmallVectorImpl<unsigned> &CallSiteIdxs = MF->getCallSiteLandingPad(Sym);
10719 for (
unsigned Idx : CallSiteIdxs) {
10720 CallSiteNumToLPad[Idx].push_back(&BB);
10721 MaxCSNum = std::max(MaxCSNum, Idx);
10728 std::vector<MachineBasicBlock*> LPadList;
10729 SmallPtrSet<MachineBasicBlock*, 32> InvokeBBs;
10730 LPadList.reserve(CallSiteNumToLPad.
size());
10731 for (
unsigned I = 1;
I <= MaxCSNum; ++
I) {
10732 SmallVectorImpl<MachineBasicBlock*> &MBBList = CallSiteNumToLPad[
I];
10733 for (MachineBasicBlock *
MBB : MBBList) {
10734 LPadList.push_back(
MBB);
10739 assert(!LPadList.empty() &&
10740 "No landing pad destinations for the dispatch jump table!");
10743 MachineJumpTableInfo *JTI =
10750 MachineBasicBlock *DispatchBB = MF->CreateMachineBasicBlock();
10753 MachineBasicBlock *TrapBB = MF->CreateMachineBasicBlock();
10755 BuildMI(TrapBB, dl,
TII->get(Subtarget->isThumb() ? ARM::tTRAP : ARM::TRAP));
10758 MachineBasicBlock *DispContBB = MF->CreateMachineBasicBlock();
10762 MF->insert(MF->end(), DispatchBB);
10763 MF->insert(MF->end(), DispContBB);
10764 MF->insert(MF->end(), TrapBB);
10768 SetupEntryBlockForSjLj(
MI,
MBB, DispatchBB, FI);
10770 MachineMemOperand *FIMMOLd = MF->getMachineMemOperand(
10774 MachineInstrBuilder MIB;
10775 MIB =
BuildMI(DispatchBB, dl,
TII->get(ARM::Int_eh_sjlj_dispatchsetup));
10777 const ARMBaseInstrInfo *AII =
static_cast<const ARMBaseInstrInfo*
>(
TII);
10787 unsigned NumLPads = LPadList.size();
10788 if (Subtarget->isThumb2()) {
10789 Register NewVReg1 =
MRI->createVirtualRegister(TRC);
10790 BuildMI(DispatchBB, dl,
TII->get(ARM::t2LDRi12), NewVReg1)
10796 if (NumLPads < 256) {
10797 BuildMI(DispatchBB, dl,
TII->get(ARM::t2CMPri))
10799 .
addImm(LPadList.size())
10802 Register VReg1 =
MRI->createVirtualRegister(TRC);
10803 BuildMI(DispatchBB, dl,
TII->get(ARM::t2MOVi16), VReg1)
10804 .
addImm(NumLPads & 0xFFFF)
10807 unsigned VReg2 = VReg1;
10808 if ((NumLPads & 0xFFFF0000) != 0) {
10809 VReg2 =
MRI->createVirtualRegister(TRC);
10810 BuildMI(DispatchBB, dl,
TII->get(ARM::t2MOVTi16), VReg2)
10816 BuildMI(DispatchBB, dl,
TII->get(ARM::t2CMPrr))
10822 BuildMI(DispatchBB, dl,
TII->get(ARM::t2Bcc))
10827 Register NewVReg3 =
MRI->createVirtualRegister(TRC);
10828 BuildMI(DispContBB, dl,
TII->get(ARM::t2LEApcrelJT), NewVReg3)
10832 Register NewVReg4 =
MRI->createVirtualRegister(TRC);
10833 BuildMI(DispContBB, dl,
TII->get(ARM::t2ADDrs), NewVReg4)
10840 BuildMI(DispContBB, dl,
TII->get(ARM::t2BR_JT))
10844 }
else if (Subtarget->isThumb()) {
10845 Register NewVReg1 =
MRI->createVirtualRegister(TRC);
10846 BuildMI(DispatchBB, dl,
TII->get(ARM::tLDRspi), NewVReg1)
10852 if (NumLPads < 256) {
10853 BuildMI(DispatchBB, dl,
TII->get(ARM::tCMPi8))
10858 MachineConstantPool *
ConstantPool = MF->getConstantPool();
10863 Align Alignment = MF->getDataLayout().getPrefTypeAlign(
Int32Ty);
10864 unsigned Idx =
ConstantPool->getConstantPoolIndex(
C, Alignment);
10866 Register VReg1 =
MRI->createVirtualRegister(TRC);
10867 BuildMI(DispatchBB, dl,
TII->get(ARM::tLDRpci))
10871 BuildMI(DispatchBB, dl,
TII->get(ARM::tCMPr))
10877 BuildMI(DispatchBB, dl,
TII->get(ARM::tBcc))
10882 Register NewVReg2 =
MRI->createVirtualRegister(TRC);
10883 BuildMI(DispContBB, dl,
TII->get(ARM::tLSLri), NewVReg2)
10889 Register NewVReg3 =
MRI->createVirtualRegister(TRC);
10890 BuildMI(DispContBB, dl,
TII->get(ARM::tLEApcrelJT), NewVReg3)
10894 Register NewVReg4 =
MRI->createVirtualRegister(TRC);
10895 BuildMI(DispContBB, dl,
TII->get(ARM::tADDrr), NewVReg4)
10901 MachineMemOperand *JTMMOLd =
10905 Register NewVReg5 =
MRI->createVirtualRegister(TRC);
10906 BuildMI(DispContBB, dl,
TII->get(ARM::tLDRi), NewVReg5)
10912 unsigned NewVReg6 = NewVReg5;
10913 if (IsPositionIndependent) {
10914 NewVReg6 =
MRI->createVirtualRegister(TRC);
10915 BuildMI(DispContBB, dl,
TII->get(ARM::tADDrr), NewVReg6)
10922 BuildMI(DispContBB, dl,
TII->get(ARM::tBR_JTr))
10926 Register NewVReg1 =
MRI->createVirtualRegister(TRC);
10927 BuildMI(DispatchBB, dl,
TII->get(ARM::LDRi12), NewVReg1)
10933 if (NumLPads < 256) {
10934 BuildMI(DispatchBB, dl,
TII->get(ARM::CMPri))
10938 }
else if (Subtarget->hasV6T2Ops() &&
isUInt<16>(NumLPads)) {
10939 Register VReg1 =
MRI->createVirtualRegister(TRC);
10940 BuildMI(DispatchBB, dl,
TII->get(ARM::MOVi16), VReg1)
10941 .
addImm(NumLPads & 0xFFFF)
10944 unsigned VReg2 = VReg1;
10945 if ((NumLPads & 0xFFFF0000) != 0) {
10946 VReg2 =
MRI->createVirtualRegister(TRC);
10947 BuildMI(DispatchBB, dl,
TII->get(ARM::MOVTi16), VReg2)
10953 BuildMI(DispatchBB, dl,
TII->get(ARM::CMPrr))
10958 MachineConstantPool *
ConstantPool = MF->getConstantPool();
10963 Align Alignment = MF->getDataLayout().getPrefTypeAlign(
Int32Ty);
10964 unsigned Idx =
ConstantPool->getConstantPoolIndex(
C, Alignment);
10966 Register VReg1 =
MRI->createVirtualRegister(TRC);
10967 BuildMI(DispatchBB, dl,
TII->get(ARM::LDRcp))
10972 BuildMI(DispatchBB, dl,
TII->get(ARM::CMPrr))
10983 Register NewVReg3 =
MRI->createVirtualRegister(TRC);
10984 BuildMI(DispContBB, dl,
TII->get(ARM::MOVsi), NewVReg3)
10989 Register NewVReg4 =
MRI->createVirtualRegister(TRC);
10990 BuildMI(DispContBB, dl,
TII->get(ARM::LEApcrelJT), NewVReg4)
10994 MachineMemOperand *JTMMOLd =
10997 Register NewVReg5 =
MRI->createVirtualRegister(TRC);
10998 BuildMI(DispContBB, dl,
TII->get(ARM::LDRrs), NewVReg5)
11005 if (IsPositionIndependent) {
11006 BuildMI(DispContBB, dl,
TII->get(ARM::BR_JTadd))
11011 BuildMI(DispContBB, dl,
TII->get(ARM::BR_JTr))
11018 SmallPtrSet<MachineBasicBlock*, 8> SeenMBBs;
11019 for (MachineBasicBlock *CurMBB : LPadList) {
11020 if (SeenMBBs.
insert(CurMBB).second)
11027 for (MachineBasicBlock *BB : InvokeBBs) {
11031 SmallVector<MachineBasicBlock*, 4> Successors(BB->successors());
11032 while (!Successors.empty()) {
11033 MachineBasicBlock *SMBB = Successors.pop_back_val();
11035 BB->removeSuccessor(SMBB);
11041 BB->normalizeSuccProbs();
11048 II = BB->rbegin(), IE = BB->rend();
II != IE; ++
II) {
11049 if (!
II->isCall())
continue;
11051 DenseSet<unsigned> DefRegs;
11053 OI =
II->operands_begin(), OE =
II->operands_end();
11055 if (!OI->isReg())
continue;
11056 DefRegs.
insert(OI->getReg());
11059 MachineInstrBuilder MIB(*MF, &*
II);
11061 for (
unsigned i = 0; SavedRegs[i] != 0; ++i) {
11062 unsigned Reg = SavedRegs[i];
11063 if (Subtarget->isThumb2() &&
11064 !ARM::tGPRRegClass.contains(
Reg) &&
11065 !ARM::hGPRRegClass.contains(
Reg))
11067 if (Subtarget->isThumb1Only() && !ARM::tGPRRegClass.contains(
Reg))
11069 if (!Subtarget->isThumb() && !ARM::GPRRegClass.contains(
Reg))
11081 for (MachineBasicBlock *MBBLPad : MBBLPads)
11082 MBBLPad->setIsEHPad(
false);
11085 MI.eraseFromParent();
11098static unsigned getLdOpcode(
unsigned LdSize,
bool IsThumb1,
bool IsThumb2) {
11100 return LdSize == 16 ? ARM::VLD1q32wb_fixed
11101 : LdSize == 8 ? ARM::VLD1d32wb_fixed : 0;
11103 return LdSize == 4 ? ARM::tLDRi
11104 : LdSize == 2 ? ARM::tLDRHi
11105 : LdSize == 1 ? ARM::tLDRBi : 0;
11107 return LdSize == 4 ? ARM::t2LDR_POST
11108 : LdSize == 2 ? ARM::t2LDRH_POST
11109 : LdSize == 1 ? ARM::t2LDRB_POST : 0;
11110 return LdSize == 4 ? ARM::LDR_POST_IMM
11111 : LdSize == 2 ? ARM::LDRH_POST
11112 : LdSize == 1 ? ARM::LDRB_POST_IMM : 0;
11117static unsigned getStOpcode(
unsigned StSize,
bool IsThumb1,
bool IsThumb2) {
11119 return StSize == 16 ? ARM::VST1q32wb_fixed
11120 : StSize == 8 ? ARM::VST1d32wb_fixed : 0;
11122 return StSize == 4 ? ARM::tSTRi
11123 : StSize == 2 ? ARM::tSTRHi
11124 : StSize == 1 ? ARM::tSTRBi : 0;
11126 return StSize == 4 ? ARM::t2STR_POST
11127 : StSize == 2 ? ARM::t2STRH_POST
11128 : StSize == 1 ? ARM::t2STRB_POST : 0;
11129 return StSize == 4 ? ARM::STR_POST_IMM
11130 : StSize == 2 ? ARM::STRH_POST
11131 : StSize == 1 ? ARM::STRB_POST_IMM : 0;
11138 unsigned LdSize,
unsigned Data,
unsigned AddrIn,
11139 unsigned AddrOut,
bool IsThumb1,
bool IsThumb2) {
11140 unsigned LdOpc =
getLdOpcode(LdSize, IsThumb1, IsThumb2);
11141 assert(LdOpc != 0 &&
"Should have a load opcode");
11148 }
else if (IsThumb1) {
11154 BuildMI(*BB, Pos, dl,
TII->get(ARM::tADDi8), AddrOut)
11159 }
else if (IsThumb2) {
11179 unsigned StSize,
unsigned Data,
unsigned AddrIn,
11180 unsigned AddrOut,
bool IsThumb1,
bool IsThumb2) {
11181 unsigned StOpc =
getStOpcode(StSize, IsThumb1, IsThumb2);
11182 assert(StOpc != 0 &&
"Should have a store opcode");
11184 BuildMI(*BB, Pos, dl,
TII->get(StOpc), AddrOut)
11189 }
else if (IsThumb1) {
11196 BuildMI(*BB, Pos, dl,
TII->get(ARM::tADDi8), AddrOut)
11201 }
else if (IsThumb2) {
11202 BuildMI(*BB, Pos, dl,
TII->get(StOpc), AddrOut)
11208 BuildMI(*BB, Pos, dl,
TII->get(StOpc), AddrOut)
11223 const TargetInstrInfo *
TII = Subtarget->getInstrInfo();
11229 unsigned SizeVal =
MI.getOperand(2).getImm();
11230 unsigned Alignment =
MI.getOperand(3).getImm();
11235 unsigned UnitSize = 0;
11236 const TargetRegisterClass *TRC =
nullptr;
11237 const TargetRegisterClass *VecTRC =
nullptr;
11239 bool IsThumb1 = Subtarget->isThumb1Only();
11240 bool IsThumb2 = Subtarget->isThumb2();
11241 bool IsThumb = Subtarget->isThumb();
11243 if (Alignment & 1) {
11245 }
else if (Alignment & 2) {
11250 Subtarget->hasNEON()) {
11251 if ((Alignment % 16 == 0) && SizeVal >= 16)
11253 else if ((Alignment % 8 == 0) && SizeVal >= 8)
11262 bool IsNeon = UnitSize >= 8;
11263 TRC = IsThumb ? &ARM::tGPRRegClass : &ARM::GPRRegClass;
11265 VecTRC = UnitSize == 16 ? &ARM::DPairRegClass
11266 : UnitSize == 8 ? &ARM::DPRRegClass
11269 unsigned BytesLeft = SizeVal % UnitSize;
11270 unsigned LoopSize = SizeVal - BytesLeft;
11272 if (SizeVal <= Subtarget->getMaxInlineSizeThreshold()) {
11276 unsigned srcIn = src;
11277 unsigned destIn = dest;
11278 for (
unsigned i = 0; i < LoopSize; i+=UnitSize) {
11279 Register srcOut =
MRI.createVirtualRegister(TRC);
11280 Register destOut =
MRI.createVirtualRegister(TRC);
11281 Register scratch =
MRI.createVirtualRegister(IsNeon ? VecTRC : TRC);
11283 IsThumb1, IsThumb2);
11285 IsThumb1, IsThumb2);
11293 for (
unsigned i = 0; i < BytesLeft; i++) {
11294 Register srcOut =
MRI.createVirtualRegister(TRC);
11295 Register destOut =
MRI.createVirtualRegister(TRC);
11296 Register scratch =
MRI.createVirtualRegister(TRC);
11298 IsThumb1, IsThumb2);
11300 IsThumb1, IsThumb2);
11304 MI.eraseFromParent();
11330 MF->
insert(It, loopMBB);
11331 MF->
insert(It, exitMBB);
11334 unsigned CallFrameSize =
TII->getCallFrameSizeAt(
MI);
11344 Register varEnd =
MRI.createVirtualRegister(TRC);
11345 if (Subtarget->useMovt()) {
11346 BuildMI(BB, dl,
TII->get(IsThumb ? ARM::t2MOVi32imm : ARM::MOVi32imm),
11349 }
else if (Subtarget->genExecuteOnly()) {
11350 assert(IsThumb &&
"Non-thumb expected to have used movt");
11359 unsigned Idx =
ConstantPool->getConstantPoolIndex(
C, Alignment);
11360 MachineMemOperand *CPMMO =
11384 MachineBasicBlock *entryBB = BB;
11386 Register varLoop =
MRI.createVirtualRegister(TRC);
11387 Register varPhi =
MRI.createVirtualRegister(TRC);
11388 Register srcLoop =
MRI.createVirtualRegister(TRC);
11389 Register srcPhi =
MRI.createVirtualRegister(TRC);
11390 Register destLoop =
MRI.createVirtualRegister(TRC);
11391 Register destPhi =
MRI.createVirtualRegister(TRC);
11399 BuildMI(BB, dl,
TII->get(ARM::PHI), destPhi)
11405 Register scratch =
MRI.createVirtualRegister(IsNeon ? VecTRC : TRC);
11407 IsThumb1, IsThumb2);
11409 IsThumb1, IsThumb2);
11413 BuildMI(*BB, BB->
end(), dl,
TII->get(ARM::tSUBi8), varLoop)
11419 MachineInstrBuilder MIB =
11421 TII->get(IsThumb2 ? ARM::t2SUBri : ARM::SUBri), varLoop);
11430 TII->get(IsThumb1 ? ARM::tBcc : IsThumb2 ? ARM::t2Bcc : ARM::Bcc))
11439 auto StartOfExit = exitMBB->
begin();
11443 unsigned srcIn = srcLoop;
11444 unsigned destIn = destLoop;
11445 for (
unsigned i = 0; i < BytesLeft; i++) {
11446 Register srcOut =
MRI.createVirtualRegister(TRC);
11447 Register destOut =
MRI.createVirtualRegister(TRC);
11448 Register scratch =
MRI.createVirtualRegister(TRC);
11449 emitPostLd(BB, StartOfExit,
TII, dl, 1, scratch, srcIn, srcOut,
11450 IsThumb1, IsThumb2);
11451 emitPostSt(BB, StartOfExit,
TII, dl, 1, scratch, destIn, destOut,
11452 IsThumb1, IsThumb2);
11457 MI.eraseFromParent();
11465 const TargetInstrInfo &
TII = *Subtarget->getInstrInfo();
11468 assert(Subtarget->isTargetWindows() &&
11469 "__chkstk is only supported on Windows");
11470 assert(Subtarget->isThumb2() &&
"Windows on ARM requires Thumb-2 mode");
11490 RTLIB::LibcallImpl ChkStkLibcall =
getLibcallImpl(RTLIB::STACK_PROBE);
11491 if (ChkStkLibcall == RTLIB::Unsupported)
11495 switch (TM.getCodeModel()) {
11537 MI.eraseFromParent();
11546 const TargetInstrInfo *
TII = Subtarget->getInstrInfo();
11561 .
addReg(
MI.getOperand(0).getReg())
11569 MI.eraseFromParent();
11593 if (miI == BB->
end()) {
11595 if (Succ->isLiveIn(ARM::CPSR))
11601 SelectItr->addRegisterKilled(ARM::CPSR,
TRI);
11613 Register AddDestReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11614 BuildMI(TpEntry, Dl,
TII->get(ARM::t2ADDri), AddDestReg)
11620 Register LsrDestReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11621 BuildMI(TpEntry, Dl,
TII->get(ARM::t2LSRri), LsrDestReg)
11627 Register TotalIterationsReg =
MRI.createVirtualRegister(&ARM::GPRlrRegClass);
11628 BuildMI(TpEntry, Dl,
TII->get(ARM::t2WhileLoopSetup), TotalIterationsReg)
11631 BuildMI(TpEntry, Dl,
TII->get(ARM::t2WhileLoopStart))
11632 .
addUse(TotalIterationsReg)
11639 return TotalIterationsReg;
11650 Register TotalIterationsReg,
bool IsMemcpy) {
11657 SrcPhiReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11658 CurrSrcReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11659 BuildMI(TpLoopBody, Dl,
TII->get(ARM::PHI), SrcPhiReg)
11667 Register DestPhiReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11668 Register CurrDestReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11669 BuildMI(TpLoopBody, Dl,
TII->get(ARM::PHI), DestPhiReg)
11676 Register LoopCounterPhiReg =
MRI.createVirtualRegister(&ARM::GPRlrRegClass);
11677 Register RemainingLoopIterationsReg =
11678 MRI.createVirtualRegister(&ARM::GPRlrRegClass);
11679 BuildMI(TpLoopBody, Dl,
TII->get(ARM::PHI), LoopCounterPhiReg)
11680 .
addUse(TotalIterationsReg)
11682 .
addUse(RemainingLoopIterationsReg)
11686 Register PredCounterPhiReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11687 Register RemainingElementsReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11688 BuildMI(TpLoopBody, Dl,
TII->get(ARM::PHI), PredCounterPhiReg)
11689 .
addUse(ElementCountReg)
11691 .
addUse(RemainingElementsReg)
11695 Register VccrReg =
MRI.createVirtualRegister(&ARM::VCCRRegClass);
11696 BuildMI(TpLoopBody, Dl,
TII->get(ARM::MVE_VCTP8), VccrReg)
11697 .
addUse(PredCounterPhiReg)
11702 BuildMI(TpLoopBody, Dl,
TII->get(ARM::t2SUBri), RemainingElementsReg)
11703 .
addUse(PredCounterPhiReg)
11711 SrcValueReg =
MRI.createVirtualRegister(&ARM::MQPRRegClass);
11712 BuildMI(TpLoopBody, Dl,
TII->get(ARM::MVE_VLDRBU8_post))
11721 SrcValueReg = OpSrcReg;
11723 BuildMI(TpLoopBody, Dl,
TII->get(ARM::MVE_VSTRBU8_post))
11734 BuildMI(TpLoopBody, Dl,
TII->get(ARM::t2LoopDec), RemainingLoopIterationsReg)
11735 .
addUse(LoopCounterPhiReg)
11738 BuildMI(TpLoopBody, Dl,
TII->get(ARM::t2LoopEnd))
11739 .
addUse(RemainingLoopIterationsReg)
11757 "Invalid call instruction for a KCFI check");
11760 switch (
MBBI->getOpcode()) {
11763 case ARM::BLX_pred:
11764 case ARM::BLX_noip:
11765 case ARM::BLX_pred_noip:
11767 TargetOp = &
MBBI->getOperand(0);
11769 case ARM::TCRETURNri:
11770 case ARM::TCRETURNrinotr12:
11771 case ARM::TAILJMPr:
11772 case ARM::TAILJMPr4:
11773 TargetOp = &
MBBI->getOperand(0);
11779 case ARM::tBLXr_noip:
11780 case ARM::tBX_CALL:
11781 TargetOp = &
MBBI->getOperand(2);
11784 case ARM::tTAILJMPr:
11785 TargetOp = &
MBBI->getOperand(0);
11791 assert(TargetOp && TargetOp->
isReg() &&
"Invalid target operand");
11795 unsigned KCFICheckOpcode;
11796 if (Subtarget->isThumb()) {
11797 if (Subtarget->isThumb2()) {
11798 KCFICheckOpcode = ARM::KCFI_CHECK_Thumb2;
11800 KCFICheckOpcode = ARM::KCFI_CHECK_Thumb1;
11803 KCFICheckOpcode = ARM::KCFI_CHECK_ARM;
11817 bool isThumb2 = Subtarget->isThumb2();
11818 switch (
MI.getOpcode()) {
11825 case ARM::tLDR_postidx: {
11829 .
add(
MI.getOperand(2))
11830 .
add(
MI.getOperand(3))
11831 .
add(
MI.getOperand(4))
11832 .
add(
MI.getOperand(0))
11834 MI.eraseFromParent();
11838 case ARM::MVE_MEMCPYLOOPINST:
11839 case ARM::MVE_MEMSETLOOPINST: {
11869 Register OpDestReg =
MI.getOperand(0).getReg();
11870 Register OpSrcReg =
MI.getOperand(1).getReg();
11871 Register OpSizeReg =
MI.getOperand(2).getReg();
11891 if (TpExit == BB) {
11893 "block containing memcpy/memset Pseudo");
11906 bool IsMemcpy =
MI.getOpcode() == ARM::MVE_MEMCPYLOOPINST;
11908 OpDestReg, OpSizeReg, TotalIterationsReg, IsMemcpy);
11911 Properties.resetNoPHIs();
11923 MI.eraseFromParent();
11933 case ARM::t2STR_preidx:
11934 MI.setDesc(
TII->get(ARM::t2STR_PRE));
11936 case ARM::t2STRB_preidx:
11937 MI.setDesc(
TII->get(ARM::t2STRB_PRE));
11939 case ARM::t2STRH_preidx:
11940 MI.setDesc(
TII->get(ARM::t2STRH_PRE));
11943 case ARM::STRi_preidx:
11944 case ARM::STRBi_preidx: {
11945 unsigned NewOpc =
MI.getOpcode() == ARM::STRi_preidx ? ARM::STR_PRE_IMM
11946 : ARM::STRB_PRE_IMM;
11948 unsigned Offset =
MI.getOperand(4).getImm();
11956 .
add(
MI.getOperand(0))
11957 .
add(
MI.getOperand(1))
11958 .
add(
MI.getOperand(2))
11960 .
add(
MI.getOperand(5))
11961 .
add(
MI.getOperand(6))
11963 MI.eraseFromParent();
11966 case ARM::STRr_preidx:
11967 case ARM::STRBr_preidx:
11968 case ARM::STRH_preidx: {
11970 switch (
MI.getOpcode()) {
11972 case ARM::STRr_preidx: NewOpc = ARM::STR_PRE_REG;
break;
11973 case ARM::STRBr_preidx: NewOpc = ARM::STRB_PRE_REG;
break;
11974 case ARM::STRH_preidx: NewOpc = ARM::STRH_PRE;
break;
11979 MI.eraseFromParent();
11983 case ARM::tMOVCCr_pseudo: {
12001 F->insert(It, copy0MBB);
12002 F->insert(It, sinkMBB);
12005 unsigned CallFrameSize =
TII->getCallFrameSizeAt(
MI);
12011 if (!
MI.killsRegister(ARM::CPSR,
nullptr) &&
12027 .
addImm(
MI.getOperand(3).getImm())
12028 .
addReg(
MI.getOperand(4).getReg());
12043 .
addReg(
MI.getOperand(1).getReg())
12045 .
addReg(
MI.getOperand(2).getReg())
12048 MI.eraseFromParent();
12053 case ARM::BCCZi64: {
12059 bool RHSisZero =
MI.getOpcode() == ARM::BCCZi64;
12064 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
12068 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
12074 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2CMPrr : ARM::CMPrr))
12078 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2CMPrr : ARM::CMPrr))
12088 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2Bcc : ARM::Bcc))
12097 MI.eraseFromParent();
12101 case ARM::Int_eh_sjlj_setjmp:
12102 case ARM::Int_eh_sjlj_setjmp_nofp:
12103 case ARM::tInt_eh_sjlj_setjmp:
12104 case ARM::t2Int_eh_sjlj_setjmp:
12105 case ARM::t2Int_eh_sjlj_setjmp_nofp:
12108 case ARM::Int_eh_sjlj_setup_dispatch:
12109 EmitSjLjDispatchBlock(
MI, BB);
12111 case ARM::COPY_STRUCT_BYVAL_I32:
12113 return EmitStructByval(
MI, BB);
12114 case ARM::WIN__CHKSTK:
12115 return EmitLowered__chkstk(
MI, BB);
12116 case ARM::WIN__DBZCHK:
12117 return EmitLowered__dbzchk(
MI, BB);
12133 if (!
Node->hasAnyUseOfValue(0)) {
12134 MI.getOperand(0).setIsDead(
true);
12136 if (!
Node->hasAnyUseOfValue(1)) {
12137 MI.getOperand(1).setIsDead(
true);
12141 for (
unsigned I = 0;
I !=
MI.getOperand(4).
getImm(); ++
I) {
12142 Register TmpReg =
MRI.createVirtualRegister(isThumb1 ? &ARM::tGPRRegClass
12143 : &ARM::GPRRegClass);
12150 if (
MI.getOpcode() == ARM::MEMCPY) {
12171 MI.getDesc().getNumOperands() + 5 -
MI.getDesc().getSize()
12172 &&
"converted opcode should be the same except for cc_out"
12173 " (and, on Thumb1, pred)");
12181 if (Subtarget->isThumb1Only()) {
12182 for (
unsigned c =
MCID->getNumOperands() - 4; c--;) {
12183 MI.addOperand(
MI.getOperand(1));
12184 MI.removeOperand(1);
12188 for (
unsigned i =
MI.getNumOperands(); i--;) {
12190 if (
op.isReg() &&
op.isUse()) {
12193 MI.tieOperands(DefIdx, i);
12201 ccOutIdx =
MCID->getNumOperands() - 1;
12203 ccOutIdx =
MCID->getNumOperands() - 1;
12207 if (!
MI.hasOptionalDef() || !
MCID->operands()[ccOutIdx].isOptionalDef()) {
12208 assert(!NewOpc &&
"Optional cc_out operand required");
12213 bool definesCPSR =
false;
12214 bool deadCPSR =
false;
12215 for (
unsigned i =
MCID->getNumOperands(), e =
MI.getNumOperands(); i != e;
12219 definesCPSR =
true;
12222 MI.removeOperand(i);
12226 if (!definesCPSR) {
12227 assert(!NewOpc &&
"Optional cc_out operand required");
12230 assert(deadCPSR == !
Node->hasAnyUseOfValue(1) &&
"inconsistent dead flag");
12232 assert(!
MI.getOperand(ccOutIdx).getReg() &&
12233 "expect uninitialized optional cc_out operand");
12235 if (!Subtarget->isThumb1Only())
12271 switch (
N->getOpcode()) {
12272 default:
return false;
12274 CC =
N->getOperand(0);
12296 EVT VT =
N->getValueType(0);
12297 CC =
N->getOperand(0);
12344 EVT VT =
N->getValueType(0);
12347 bool SwapSelectOps;
12349 NonConstantVal, DAG))
12355 OtherOp, NonConstantVal);
12361 CCOp, TrueVal, FalseVal);
12381 if (
N->getOpcode() == ARMISD::VUZP)
12385 if (
N->getOpcode() == ARMISD::VTRN &&
N->getValueType(0) == MVT::v2i32)
12400 if (!
N->getValueType(0).is64BitVector())
12408 EVT VT =
N->getValueType(0);
12447 EVT VT =
N->getValueType(0);
12453 Opcode = Intrinsic::arm_neon_vpaddls;
12455 Opcode = Intrinsic::arm_neon_vpaddlu;
12483 EVT VT =
N->getValueType(0);
12498 unsigned nextIndex = 0;
12549 Ops.push_back(Vec);
12566 return DAG.
getNode(ExtOp, dl, VT, tmp);
12597 if (SRA.getOpcode() !=
ISD::SRA) {
12604 if (Const->getZExtValue() != 31)
12609 if (SRA.getOperand(0) !=
Mul)
12613 SDLoc dl(AddcNode);
12614 unsigned Opcode = 0;
12619 Opcode = ARMISD::SMLALBB;
12620 Op0 =
Mul.getOperand(0);
12621 Op1 =
Mul.getOperand(1);
12623 Opcode = ARMISD::SMLALBT;
12624 Op0 =
Mul.getOperand(0);
12625 Op1 =
Mul.getOperand(1).getOperand(0);
12627 Opcode = ARMISD::SMLALTB;
12628 Op0 =
Mul.getOperand(0).getOperand(0);
12629 Op1 =
Mul.getOperand(1);
12631 Opcode = ARMISD::SMLALTT;
12632 Op0 =
Mul->getOperand(0).getOperand(0);
12633 Op1 =
Mul->getOperand(1).getOperand(0);
12649 SDValue resNode(AddcNode, 0);
12677 AddeSubeNode->
getOpcode() == ARMISD::SUBE) &&
12678 "Expect an ADDE or SUBE");
12682 "ADDE node has the wrong inputs");
12686 if ((AddeSubeNode->
getOpcode() == ARMISD::ADDE &&
12687 AddcSubcNode->
getOpcode() != ARMISD::ADDC) ||
12688 (AddeSubeNode->
getOpcode() == ARMISD::SUBE &&
12689 AddcSubcNode->
getOpcode() != ARMISD::SUBC))
12701 "Expect ADDC with two result values. First: i32");
12705 if (AddeSubeNode->
getOpcode() == ARMISD::ADDE &&
12721 bool IsLeftOperandMUL =
false;
12726 IsLeftOperandMUL =
true;
12737 SDValue *LowAddSub =
nullptr;
12740 if ((AddeSubeOp0 != MULOp.
getValue(1)) && (AddeSubeOp1 != MULOp.
getValue(1)))
12743 if (IsLeftOperandMUL)
12744 HiAddSub = &AddeSubeOp1;
12746 HiAddSub = &AddeSubeOp0;
12751 if (AddcSubcOp0 == MULOp.
getValue(0)) {
12752 LoMul = &AddcSubcOp0;
12753 LowAddSub = &AddcSubcOp1;
12755 if (AddcSubcOp1 == MULOp.
getValue(0)) {
12756 LoMul = &AddcSubcOp1;
12757 LowAddSub = &AddcSubcOp0;
12765 if (AddcSubcNode == HiAddSub->getNode() ||
12781 if (Subtarget->hasV6Ops() && Subtarget->hasDSP() && Subtarget->
useMulOps() &&
12786 Ops.push_back(*HiAddSub);
12787 if (AddcSubcNode->
getOpcode() == ARMISD::SUBC) {
12788 FinalOpc = ARMISD::SMMLSR;
12790 FinalOpc = ARMISD::SMMLAR;
12795 return SDValue(AddeSubeNode, 0);
12796 }
else if (AddcSubcNode->
getOpcode() == ARMISD::SUBC)
12802 Ops.push_back(*LowAddSub);
12803 Ops.push_back(*HiAddSub);
12816 return SDValue(AddeSubeNode, 0);
12828 if (!Subtarget->hasV6Ops() || !Subtarget->hasDSP())
12833 if (AddcNode->
getOpcode() != ARMISD::ADDC)
12837 SDNode *UmlalNode =
nullptr;
12876 if (!Subtarget->hasV6Ops() || !Subtarget->hasDSP())
12881 SDNode* AddcNode =
N->getOperand(2).getNode();
12882 SDNode* AddeNode =
N->getOperand(3).getNode();
12883 if ((AddcNode->
getOpcode() == ARMISD::ADDC) &&
12884 (AddeNode->
getOpcode() == ARMISD::ADDE) &&
12890 {N->getOperand(0), N->getOperand(1),
12891 AddcNode->getOperand(0), AddcNode->getOperand(1)});
12901 if (
N->getOpcode() == ARMISD::SUBC &&
N->hasAnyUseOfValue(1)) {
12905 if (
LHS->getOpcode() == ARMISD::ADDE &&
12915 int32_t imm =
C->getSExtValue();
12916 if (imm < 0 && imm > std::numeric_limits<int>::min()) {
12919 unsigned Opcode = (
N->getOpcode() == ARMISD::ADDC) ? ARMISD::SUBC
12921 return DAG.
getNode(Opcode,
DL,
N->getVTList(),
N->getOperand(0),
RHS);
12936 int64_t imm =
C->getSExtValue();
12945 unsigned Opcode = (
N->getOpcode() == ARMISD::ADDE) ? ARMISD::SUBE
12947 return DAG.
getNode(Opcode,
DL,
N->getVTList(),
12948 N->getOperand(0),
RHS,
N->getOperand(2));
12960 if (!Subtarget->hasMVEIntegerOps())
12973 SetCC =
N->getOperand(0);
12977 TrueVal =
N->getOperand(1);
12978 FalseVal =
N->getOperand(2);
12980 LHS =
N->getOperand(0);
12981 RHS =
N->getOperand(1);
12983 TrueVal =
N->getOperand(2);
12984 FalseVal =
N->getOperand(3);
12989 unsigned int Opcode = 0;
12993 Opcode = ARMISD::VMINVu;
12999 Opcode = ARMISD::VMINVs;
13005 Opcode = ARMISD::VMAXVu;
13011 Opcode = ARMISD::VMAXVs;
13018 switch (TrueVal->getOpcode()) {
13037 if (TrueVal !=
LHS || FalseVal !=
RHS)
13040 EVT LeftType =
LHS->getValueType(0);
13041 EVT RightType =
RHS->getValueType(0);
13044 if (LeftType != VectorScalarType || RightType != VectorScalarType)
13048 if (VectorScalarType != MVT::i32)
13056 if (VectorScalarType != MVT::i32)
13069 EVT VT =
N->getValueType(0);
13077 Shft =
N->getOperand(0);
13084 Cmp.getOperand(0) !=
N->getOperand(1) ||
13085 Cmp.getOperand(1) !=
N->getOperand(2))
13087 Shft =
N->getOperand(1);
13099 ScalarType = MVT::i8;
13102 case (1 << 15) - 1:
13103 ScalarType = MVT::i16;
13106 case (1ULL << 31) - 1:
13107 ScalarType = MVT::i32;
13138 unsigned LegalLanes = 128 / (ShftAmt + 1);
13150 Inp0 = DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, LegalVecVT, Inp0);
13151 Inp1 = DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, LegalVecVT, Inp1);
13152 SDValue VQDMULH = DAG.
getNode(ARMISD::VQDMULH,
DL, LegalVecVT, Inp0, Inp1);
13153 SDValue Trunc = DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, ExtVecVT, VQDMULH);
13162 for (
unsigned I = 0;
I < NumParts; ++
I) {
13169 SDValue VQDMULH = DAG.
getNode(ARMISD::VQDMULH,
DL, LegalVecVT, Inp0, Inp1);
13179 if (!Subtarget->hasMVEIntegerOps())
13194 if (
N->getOperand(0).getOpcode() !=
ISD::XOR)
13204 if (!Const || !Const->isOne())
13222 EVT VT =
N->getValueType(0);
13224 if (!Subtarget->hasMVEIntegerOps() ||
13253 Opc = Intrinsic::arm_mve_vctp64;
13256 Opc = Intrinsic::arm_mve_vctp32;
13259 Opc = Intrinsic::arm_mve_vctp16;
13262 Opc = Intrinsic::arm_mve_vctp8;
13316 EVT VT =
N->getValueType(0);
13322 switch (
Op.getOpcode()) {
13324 case ARMISD::VADDVs:
13325 case ARMISD::VADDVu:
13326 case ARMISD::VMLAVs:
13327 case ARMISD::VMLAVu:
13347 unsigned N0RedOp = 0;
13354 unsigned N1RedOp = 0;
13368 if (
SDValue R = DistrubuteAddAddVecReduce(N0, N1))
13370 if (
SDValue R = DistrubuteAddAddVecReduce(N1, N0))
13377 auto DistrubuteVecReduceLoad = [&](
SDValue N0,
SDValue N1,
bool IsForward) {
13401 if (!BaseLocDecomp0.getBase() ||
13402 BaseLocDecomp0.getBase() != BaseLocDecomp1.getBase() ||
13403 !BaseLocDecomp0.hasValidOffset() || !BaseLocDecomp1.hasValidOffset())
13405 if (BaseLocDecomp0.getOffset() < BaseLocDecomp1.getOffset())
13407 if (BaseLocDecomp0.getOffset() > BaseLocDecomp1.getOffset())
13417 if (IsBefore < 0) {
13420 }
else if (IsBefore > 0) {
13433 }
else if (IsForward && IsVecReduce(N0) && IsVecReduce(N1) &&
13443 if (!IsVecReduce(N0) || !IsVecReduce(N1))
13453 if (
SDValue R = DistrubuteVecReduceLoad(N0, N1,
true))
13455 if (
SDValue R = DistrubuteVecReduceLoad(N1, N0,
false))
13462 if (!Subtarget->hasMVEIntegerOps())
13468 EVT VT =
N->getValueType(0);
13473 if (VT != MVT::i64)
13484 auto MakeVecReduce = [&](
unsigned Opcode,
unsigned OpcodeA,
SDValue NA,
13504 unsigned S = VecRed->
getOpcode() == OpcodeA ? 2 : 0;
13513 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVs, ARMISD::VADDLVAs, N0, N1))
13515 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVu, ARMISD::VADDLVAu, N0, N1))
13517 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVs, ARMISD::VADDLVAs, N1, N0))
13519 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVu, ARMISD::VADDLVAu, N1, N0))
13521 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVps, ARMISD::VADDLVAps, N0, N1))
13523 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVpu, ARMISD::VADDLVApu, N0, N1))
13525 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVps, ARMISD::VADDLVAps, N1, N0))
13527 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVpu, ARMISD::VADDLVApu, N1, N0))
13529 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVs, ARMISD::VMLALVAs, N0, N1))
13531 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVu, ARMISD::VMLALVAu, N0, N1))
13533 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVs, ARMISD::VMLALVAs, N1, N0))
13535 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVu, ARMISD::VMLALVAu, N1, N0))
13537 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVps, ARMISD::VMLALVAps, N0, N1))
13539 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVpu, ARMISD::VMLALVApu, N0, N1))
13541 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVps, ARMISD::VMLALVAps, N1, N0))
13543 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVpu, ARMISD::VMLALVApu, N1, N0))
13553 "Expected shift op");
13555 SDValue ShiftLHS =
N->getOperand(0);
13569 if (Subtarget->isThumb1Only()) {
13580 if (Const->getAPIntValue().ult(256))
13583 Const->getAPIntValue().sgt(-256))
13599 (
N->getOperand(0).getOpcode() ==
ISD::SHL ||
13600 N->getOperand(0).getOpcode() ==
ISD::SRL) &&
13601 "Expected XOR(SHIFT) pattern");
13606 if (XorC && ShiftC) {
13607 unsigned MaskIdx, MaskLen;
13608 if (XorC->getAPIntValue().isShiftedMask(MaskIdx, MaskLen)) {
13609 unsigned ShiftAmt = ShiftC->getZExtValue();
13610 unsigned BitWidth =
N->getValueType(0).getScalarSizeInBits();
13611 if (
N->getOperand(0).getOpcode() ==
ISD::SHL)
13612 return MaskIdx == ShiftAmt && MaskLen == (
BitWidth - ShiftAmt);
13613 return MaskIdx == 0 && MaskLen == (
BitWidth - ShiftAmt);
13623 N->getOperand(0).getOpcode() ==
ISD::SRL) ||
13625 N->getOperand(0).getOpcode() ==
ISD::SHL)) &&
13626 "Expected shift-shift mask");
13628 if (!Subtarget->isThumb1Only())
13631 EVT VT =
N->getValueType(0);
13639 unsigned BinOpcode,
EVT VT,
unsigned SelectOpcode,
SDValue X,
13641 return Subtarget->hasMVEIntegerOps() &&
isTypeLegal(VT) &&
13646 if (!Subtarget->hasNEON()) {
13647 if (Subtarget->isThumb1Only())
13661 return Subtarget->hasVFP2Base();
13663 return Subtarget->hasVFP2Base();
13665 return Subtarget->hasFP64();
13668 return Subtarget->hasMVEFloatOps();
13697 if (ST->isThumb() && ST->isThumb1Only())
13701 for (
auto *U :
N->users()) {
13702 switch(U->getOpcode()) {
13720 if (U->getOperand(0).getOpcode() ==
ISD::SHL ||
13721 U->getOperand(1).getOpcode() ==
ISD::SHL)
13731 if (
N->getOperand(0).getOpcode() !=
ISD::SHL)
13738 if (!C1ShlC2 || !C2)
13741 APInt C2Int = C2->getAPIntValue();
13742 APInt C1Int = C1ShlC2->getAPIntValue();
13744 if (C2Int.
uge(C2Width))
13750 if ((C1Int & Mask) != C1Int)
13757 auto LargeImm = [](
const APInt &Imm) {
13758 unsigned Zeros = Imm.countl_zero() + Imm.countr_zero();
13759 return Imm.getBitWidth() - Zeros > 8;
13762 if (LargeImm(C1Int) || LargeImm(C2Int))
13774 SHL.dump();
N->dump());
13877 if (!Subtarget->hasMVEIntegerOps() || !
N->getValueType(0).isVector())
13898 return DCI.
DAG.
getNode(ARMISD::VDUP, dl,
N->getValueType(0), Negate);
13919 if (!Subtarget->hasVMLxForwarding())
13938 EVT VT =
N->getValueType(0);
13949 EVT VT =
N->getValueType(0);
13950 if (VT != MVT::v2i64)
13961 return Op->getOperand(0);
13975 And =
And->getOperand(0);
13980 Mask = Mask->getOperand(0);
13983 Mask.getValueType() != MVT::v4i32)
13989 return And->getOperand(0);
13994 if (
SDValue Op0 = IsSignExt(N0)) {
13995 if (
SDValue Op1 = IsSignExt(N1)) {
13996 SDValue New0a = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Op0);
13997 SDValue New1a = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Op1);
13998 return DAG.
getNode(ARMISD::VMULLs, dl, VT, New0a, New1a);
14001 if (
SDValue Op0 = IsZeroExt(N0)) {
14002 if (
SDValue Op1 = IsZeroExt(N1)) {
14003 SDValue New0a = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Op0);
14004 SDValue New1a = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Op1);
14005 return DAG.
getNode(ARMISD::VMULLu, dl, VT, New0a, New1a);
14017 EVT VT =
N->getValueType(0);
14018 if (Subtarget->hasMVEIntegerOps() && VT == MVT::v2i64)
14029 if (VT != MVT::i32)
14036 int64_t MulAmt =
C->getSExtValue();
14039 ShiftAmt = ShiftAmt & (32 - 1);
14044 MulAmt >>= ShiftAmt;
14105 if (
N->getValueType(0) != MVT::i32)
14114 if (C1 == 255 || C1 == 65535)
14117 SDNode *N0 =
N->getOperand(0).getNode();
14131 if (!C2 || C2 >= 32)
14175 if (Trailing == C2 && C2 + C3 < 32) {
14188 if (Leading == C2 && C2 + C3 < 32) {
14216 EVT VT =
N->getValueType(0);
14220 VT == MVT::v4i1 || VT == MVT::v8i1 || VT == MVT::v16i1)
14223 APInt SplatBits, SplatUndef;
14224 unsigned SplatBitSize;
14226 if (BVN && (Subtarget->hasNEON() || Subtarget->hasMVEIntegerOps()) &&
14227 BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
14228 if (SplatBitSize == 8 || SplatBitSize == 16 || SplatBitSize == 32 ||
14229 SplatBitSize == 64) {
14236 DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VbicVT,
N->getOperand(0));
14238 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Vbic);
14263 if (!Subtarget->hasV6Ops() ||
14264 (Subtarget->isThumb() &&
14265 (!Subtarget->hasThumb2() || !Subtarget->hasDSP())))
14268 SDValue SRL = OR->getOperand(0);
14269 SDValue SHL = OR->getOperand(1);
14272 SRL = OR->getOperand(1);
14273 SHL = OR->getOperand(0);
14280 if ((SRL.getOperand(0).getNode() != SHL.getOperand(0).getNode()) ||
14284 SDNode *SMULLOHI = SRL.getOperand(0).getNode();
14285 if (SRL.getOperand(0) !=
SDValue(SMULLOHI, 0) ||
14286 SHL.getOperand(0) !=
SDValue(SMULLOHI, 1))
14305 unsigned Opcode = 0;
14306 if (
isS16(OpS16, DAG))
14307 Opcode = ARMISD::SMULWB;
14309 Opcode = ARMISD::SMULWT;
14324 if (Subtarget->
isThumb1Only() || !Subtarget->hasV6T2Ops())
14327 EVT VT =
N->getValueType(0);
14342 if (VT != MVT::i32)
14355 if (Mask == 0xffff)
14362 if ((Val & ~Mask) != Val)
14368 Res = DAG.
getNode(ARMISD::BFI,
DL, VT, N00,
14387 (Mask == ~Mask2)) {
14390 if (Subtarget->hasDSP() &&
14391 (Mask == 0xffff || Mask == 0xffff0000))
14397 Res = DAG.
getNode(ARMISD::BFI,
DL, VT, N00, Res,
14404 (~Mask == Mask2)) {
14407 if (Subtarget->hasDSP() &&
14408 (Mask2 == 0xffff || Mask2 == 0xffff0000))
14464 if (
N->getOpcode() == ARMISD::VCMP)
14466 else if (
N->getOpcode() == ARMISD::VCMPZ)
14474 return isValidMVECond(CC,
N->getOperand(0).getValueType().isFloatingPoint());
14481 EVT VT =
N->getValueType(0);
14486 auto IsFreelyInvertable = [&](
SDValue V) {
14487 if (V->getOpcode() == ARMISD::VCMP || V->getOpcode() == ARMISD::VCMPZ)
14493 if (!(IsFreelyInvertable(N0) || IsFreelyInvertable(N1)))
14509 EVT VT =
N->getValueType(0);
14515 if (Subtarget->hasMVEIntegerOps() && (VT == MVT::v2i1 || VT == MVT::v4i1 ||
14516 VT == MVT::v8i1 || VT == MVT::v16i1))
14519 APInt SplatBits, SplatUndef;
14520 unsigned SplatBitSize;
14522 if (BVN && (Subtarget->hasNEON() || Subtarget->hasMVEIntegerOps()) &&
14523 BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
14524 if (SplatBitSize == 8 || SplatBitSize == 16 || SplatBitSize == 32 ||
14525 SplatBitSize == 64) {
14532 DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VorrVT,
N->getOperand(0));
14534 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Vorr);
14561 unsigned SplatBitSize;
14564 APInt SplatBits0, SplatBits1;
14568 if (BVN0 && BVN0->
isConstantSplat(SplatBits0, SplatUndef, SplatBitSize,
14569 HasAnyUndefs) && !HasAnyUndefs) {
14570 if (BVN1 && BVN1->
isConstantSplat(SplatBits1, SplatUndef, SplatBitSize,
14571 HasAnyUndefs) && !HasAnyUndefs) {
14576 SplatBits0 == ~SplatBits1) {
14584 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Result);
14606 EVT VT =
N->getValueType(0);
14621 if (Subtarget->hasMVEIntegerOps()) {
14649 assert(
N->getOpcode() == ARMISD::BFI);
14652 ToMask =
~N->getConstantOperandAPInt(2);
14672 unsigned LastActiveBitInA =
A.countr_zero();
14673 unsigned FirstActiveBitInB =
B.getBitWidth() -
B.countl_zero() - 1;
14674 return LastActiveBitInA - 1 == FirstActiveBitInB;
14679 APInt ToMask, FromMask;
14684 if (V.getOpcode() != ARMISD::BFI)
14687 APInt NewToMask, NewFromMask;
14689 if (NewFrom != From)
14693 if ((NewToMask & ToMask).getBoolValue())
14718 unsigned InvMask =
N->getConstantOperandVal(2);
14722 static_cast<unsigned>(std::numeric_limits<unsigned>::digits) &&
14723 "undefined behavior");
14724 unsigned Mask = (1u << Width) - 1;
14726 if ((Mask & (~Mask2)) == 0)
14728 N->getOperand(0), N1.
getOperand(0),
N->getOperand(2));
14735 APInt ToMask1, FromMask1;
14738 APInt ToMask2, FromMask2;
14744 APInt NewFromMask = FromMask1 | FromMask2;
14745 APInt NewToMask = ToMask1 | ToMask2;
14747 EVT VT =
N->getValueType(0);
14750 if (NewFromMask[0] == 0)
14753 return DAG.
getNode(ARMISD::BFI, dl, VT, CombineBFI.getOperand(0), From1,
14761 if (
N->getOperand(0).getOpcode() == ARMISD::BFI) {
14762 APInt ToMask1 =
~N->getConstantOperandAPInt(2);
14763 APInt ToMask2 = ~N0.getConstantOperandAPInt(2);
14765 if (!N0.
hasOneUse() || (ToMask1 & ToMask2) != 0 ||
14769 EVT VT =
N->getValueType(0);
14772 N->getOperand(1),
N->getOperand(2));
14784 if (Cmp->getOpcode() != ARMISD::CMPZ || !
isNullConstant(Cmp->getOperand(1)))
14786 SDValue CSInc = Cmp->getOperand(0);
14796 if (CSInc.
getOpcode() == ARMISD::CSINC &&
14836 if (
N->getConstantOperandVal(2) ==
ARMCC::EQ)
14837 return DAG.
getNode(
N->getOpcode(),
SDLoc(
N), MVT::i32,
N->getOperand(0),
14840 if (
N->getConstantOperandVal(2) ==
ARMCC::NE)
14842 N->getOpcode(),
SDLoc(
N), MVT::i32,
N->getOperand(0),
14855 SDValue InDouble =
N->getOperand(0);
14856 if (InDouble.
getOpcode() == ARMISD::VMOVDRR && Subtarget->hasFP64())
14870 SDValue BasePtr = LD->getBasePtr();
14872 DAG.
getLoad(MVT::i32,
DL, LD->getChain(), BasePtr, LD->getPointerInfo(),
14873 LD->getAlign(), LD->getMemOperand()->getFlags());
14879 LD->getPointerInfo().getWithOffset(4),
14881 LD->getMemOperand()->getFlags());
14900 BV.
getOpcode() == ARMISD::VECTOR_REG_CAST) &&
14914 if (!Subtarget->
isLittle() && BVSwap)
14932 if (!Subtarget->
isLittle() && BVSwap)
14951 if (Op0.
getOpcode() == ARMISD::VMOVRRD &&
14964 if (Op0->
getOpcode() == ARMISD::VMOVrh)
14977 if (Copy.getValueType() == MVT::f32 &&
14979 bool HasGlue = Copy->getNumOperands() == 3;
14980 SDValue Ops[] = {Copy->getOperand(0), Copy->getOperand(1),
14981 HasGlue ? Copy->getOperand(2) :
SDValue()};
14982 EVT OutTys[] = {
N->getValueType(0), MVT::Other, MVT::Glue};
15001 if (LN0->hasOneUse() && LN0->isUnindexed() &&
15002 LN0->getMemoryVT() == MVT::i16) {
15005 LN0->getBasePtr(), LN0->getMemOperand());
15023 EVT VT =
N->getValueType(0);
15057 unsigned NumElts =
N->getValueType(0).getVectorNumElements();
15058 for (
unsigned i = 0; i < NumElts; ++i) {
15059 SDNode *Elt =
N->getOperand(i).getNode();
15076 if (
N->getNumOperands() == 2)
15082 EVT VT =
N->getValueType(0);
15088 for (
unsigned i = 0; i < NumElts; ++i) {
15114 EVT VT =
N->getValueType(0);
15122 assert(EltVT == MVT::f32 &&
"Unexpected type!");
15127 Use->getValueType(0).isFloatingPoint())
15135 unsigned NumOfBitCastedElts = 0;
15137 unsigned NumOfRelevantElts = NumElts;
15138 for (
unsigned Idx = 0; Idx < NumElts; ++Idx) {
15143 ++NumOfBitCastedElts;
15147 --NumOfRelevantElts;
15151 if (NumOfBitCastedElts <= NumOfRelevantElts / 2)
15169 for (
unsigned Idx = 0 ; Idx < NumElts; ++Idx) {
15174 V->getOperand(0).getValueType() == MVT::i32)
15176 V = V.getOperand(0);
15193 EVT VT =
N->getValueType(0);
15198 if (
Op->getOpcode() == ARMISD::PREDICATE_CAST) {
15200 if (
Op->getOperand(0).getValueType() == VT)
15201 return Op->getOperand(0);
15202 return DCI.
DAG.
getNode(ARMISD::PREDICATE_CAST, dl, VT,
Op->getOperand(0));
15209 DCI.
DAG.
getNode(ARMISD::PREDICATE_CAST, dl, VT,
Op->getOperand(0));
15216 if (
Op.getValueType() == MVT::i32) {
15227 EVT VT =
N->getValueType(0);
15232 if (ST->isLittle())
15236 if (
Op.getValueType() == VT)
15243 if (
Op->getOpcode() == ARMISD::VECTOR_REG_CAST) {
15245 if (
Op->getOperand(0).getValueType() == VT)
15246 return Op->getOperand(0);
15247 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT,
Op->getOperand(0));
15255 if (!Subtarget->hasMVEIntegerOps())
15258 EVT VT =
N->getValueType(0);
15266 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, Op0,
N->getOperand(2));
15272 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, Op1,
15276 return DAG.
getNode(ARMISD::VCMP, dl, VT, Op1, Op0,
15289 EVT VT =
N->getValueType(0);
15290 SDNode *Elt =
N->getOperand(1).getNode();
15305 Vec, V,
N->getOperand(2));
15315 EVT VT =
N->getValueType(0);
15343 return V->getOpcode() == ISD::EXTRACT_VECTOR_ELT &&
15344 isa<ConstantSDNode>(V->getOperand(1)) &&
15345 V->getConstantOperandVal(1) == Lane + 1 &&
15346 V->getOperand(0).getResNo() == ResNo;
15348 if (OtherIt == Op0->
users().
end())
15353 SDValue OtherExt(*OtherIt, 0);
15365 DCI.
DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v2f64, Op0),
15368 DCI.
DAG.
getNode(ARMISD::VMOVRRD, dl, {MVT::i32, MVT::i32},
F64);
15378 EVT VT =
N->getValueType(0);
15382 if (Op0->
getOpcode() == ARMISD::VDUP) {
15384 if (VT == MVT::f16 &&
X.getValueType() == MVT::i32)
15385 return DCI.
DAG.
getNode(ARMISD::VMOVhr, dl, VT,
X);
15386 if (VT == MVT::i32 &&
X.getValueType() == MVT::f16)
15387 return DCI.
DAG.
getNode(ARMISD::VMOVrh, dl, VT,
X);
15388 if (VT == MVT::f32 &&
X.getValueType() == MVT::i32)
15391 while (
X.getValueType() != VT &&
X->getOpcode() ==
ISD::BITCAST)
15392 X =
X->getOperand(0);
15393 if (
X.getValueType() == VT)
15401 return Op0.
getOperand(
N->getConstantOperandVal(1));
15411 unsigned Offset =
N->getConstantOperandVal(1);
15413 if (MOV.
getOpcode() == ARMISD::VMOVDRR)
15423 unsigned Idx =
N->getConstantOperandVal(1);
15437 EVT VT =
N->getValueType(0);
15440 if (
Op.getOpcode() == ARMISD::VGETLANEu &&
15442 Op.getOperand(0).getValueType().getScalarType())
15443 return DAG.
getNode(ARMISD::VGETLANEs,
SDLoc(
N), VT,
Op.getOperand(0),
15452 SDValue SubVec =
N->getOperand(1);
15453 uint64_t IdxVal =
N->getConstantOperandVal(2);
15464 if (IdxVal == 0 && Vec.
isUndef())
15470 (IdxVal != 0 && IdxVal != NumSubElts))
15501 ARMISD::VMOVN,
DL, VT,
15507 ARMISD::VMOVN,
DL, VT,
15543 EVT VT =
N->getValueType(0);
15554 unsigned HalfElts = NumElts/2;
15556 for (
unsigned n = 0; n < NumElts; ++n) {
15559 if (MaskElt < (
int)HalfElts)
15561 else if (MaskElt >= (
int)NumElts && MaskElt < (
int)(NumElts + HalfElts))
15562 NewElt = HalfElts + MaskElt - NumElts;
15605 bool SimpleConstIncOnly,
15613 bool isLoadOp =
true;
15614 bool isLaneOp =
false;
15617 bool hasAlignment =
true;
15618 unsigned NewOpc = 0;
15619 unsigned NumVecs = 0;
15620 if (
Target.isIntrinsic) {
15621 unsigned IntNo =
N->getConstantOperandVal(1);
15625 case Intrinsic::arm_neon_vld1:
15629 case Intrinsic::arm_neon_vld2:
15633 case Intrinsic::arm_neon_vld3:
15637 case Intrinsic::arm_neon_vld4:
15641 case Intrinsic::arm_neon_vld1x2:
15644 hasAlignment =
false;
15646 case Intrinsic::arm_neon_vld1x3:
15649 hasAlignment =
false;
15651 case Intrinsic::arm_neon_vld1x4:
15654 hasAlignment =
false;
15656 case Intrinsic::arm_neon_vld2dup:
15660 case Intrinsic::arm_neon_vld3dup:
15664 case Intrinsic::arm_neon_vld4dup:
15668 case Intrinsic::arm_neon_vld2lane:
15673 case Intrinsic::arm_neon_vld3lane:
15678 case Intrinsic::arm_neon_vld4lane:
15683 case Intrinsic::arm_neon_vst1:
15688 case Intrinsic::arm_neon_vst2:
15689 NewOpc = ARMISD::VST2_UPD;
15693 case Intrinsic::arm_neon_vst3:
15698 case Intrinsic::arm_neon_vst4:
15699 NewOpc = ARMISD::VST4_UPD;
15703 case Intrinsic::arm_neon_vst2lane:
15709 case Intrinsic::arm_neon_vst3lane:
15715 case Intrinsic::arm_neon_vst4lane:
15721 case Intrinsic::arm_neon_vst1x2:
15725 hasAlignment =
false;
15727 case Intrinsic::arm_neon_vst1x3:
15731 hasAlignment =
false;
15733 case Intrinsic::arm_neon_vst1x4:
15737 hasAlignment =
false;
15742 switch (
N->getOpcode()) {
15778 VecTy =
N->getValueType(0);
15779 }
else if (
Target.isIntrinsic) {
15780 VecTy =
N->getOperand(
Target.AddrOpIdx + 1).getValueType();
15783 "Node has to be a load, a store, or an intrinsic!");
15784 VecTy =
N->getOperand(1).getValueType();
15792 if (isLaneOp || isVLDDUPOp)
15795 if (NumBytes >= 3 * 16 &&
User.ConstInc != NumBytes) {
15801 if (SimpleConstIncOnly &&
User.ConstInc != NumBytes)
15810 EVT AlignedVecTy = VecTy;
15830 assert(NumVecs == 1 &&
"Unexpected multi-element generic load/store.");
15831 assert(!isLaneOp &&
"Unexpected generic load/store lane.");
15842 Alignment =
Align(1);
15848 unsigned NumResultVecs = (isLoadOp ? NumVecs : 0);
15850 for (n = 0; n < NumResultVecs; ++n)
15851 Tys[n] = AlignedVecTy;
15852 Tys[n++] = MVT::i32;
15853 Tys[n] = MVT::Other;
15858 Ops.push_back(
N->getOperand(0));
15859 Ops.push_back(
N->getOperand(
Target.AddrOpIdx));
15864 Ops.push_back(StN->getValue());
15868 unsigned LastOperand =
15869 hasAlignment ?
N->getNumOperands() - 1 :
N->getNumOperands();
15870 for (
unsigned i =
Target.AddrOpIdx + 1; i < LastOperand; ++i)
15871 Ops.push_back(
N->getOperand(i));
15879 if (AlignedVecTy != VecTy &&
N->getOpcode() ==
ISD::STORE) {
15890 for (
unsigned i = 0; i < NumResultVecs; ++i)
15895 if (AlignedVecTy != VecTy &&
N->getOpcode() ==
ISD::LOAD) {
15896 SDValue &LdVal = NewResults[0];
15932 switch (
N->getOpcode()) {
15936 *Ptr =
N->getOperand(0);
15937 *CInc =
N->getOperand(1);
15944 *Ptr =
N->getOperand(1);
15945 *CInc =
N->getOperand(2);
15972 SDValue Addr =
N->getOperand(AddrOpIdx);
15983 unsigned ConstInc =
15988 if (BaseUpdates.
size() >= MaxBaseUpdates)
16008 unsigned UserOffset =
16011 if (!UserOffset || UserOffset <=
Offset)
16014 unsigned NewConstInc = UserOffset -
Offset;
16017 if (BaseUpdates.
size() >= MaxBaseUpdates)
16024 unsigned NumValidUpd = BaseUpdates.
size();
16025 for (
unsigned I = 0;
I < NumValidUpd;
I++) {
16036 return LHS.ConstInc <
RHS.ConstInc;
16065 unsigned IntNo =
N->getConstantOperandVal(1);
16066 if (IntNo == Intrinsic::arm_mve_vst2q &&
N->getConstantOperandVal(5) != 1)
16068 if (IntNo == Intrinsic::arm_mve_vst4q &&
N->getConstantOperandVal(7) != 3)
16091 bool isLoadOp =
true;
16092 unsigned NewOpc = 0;
16093 unsigned NumVecs = 0;
16097 case Intrinsic::arm_mve_vld2q:
16101 case Intrinsic::arm_mve_vld4q:
16105 case Intrinsic::arm_mve_vst2q:
16106 NewOpc = ARMISD::VST2_UPD;
16110 case Intrinsic::arm_mve_vst4q:
16111 NewOpc = ARMISD::VST4_UPD;
16120 VecTy =
N->getValueType(0);
16122 VecTy =
N->getOperand(3).getValueType();
16136 unsigned NumResultVecs = (isLoadOp ? NumVecs : 0);
16138 for (n = 0; n < NumResultVecs; ++n)
16140 Tys[n++] = MVT::i32;
16141 Tys[n] = MVT::Other;
16146 Ops.push_back(
N->getOperand(0));
16147 Ops.push_back(
N->getOperand(2));
16148 Ops.push_back(Inc);
16150 for (
unsigned i = 3; i <
N->getNumOperands(); ++i)
16151 Ops.push_back(
N->getOperand(i));
16158 for (
unsigned i = 0; i < NumResultVecs; ++i)
16177 EVT VT =
N->getValueType(0);
16183 SDNode *VLD =
N->getOperand(0).getNode();
16186 unsigned NumVecs = 0;
16187 unsigned NewOpc = 0;
16189 if (IntNo == Intrinsic::arm_neon_vld2lane) {
16192 }
else if (IntNo == Intrinsic::arm_neon_vld3lane) {
16195 }
else if (IntNo == Intrinsic::arm_neon_vld4lane) {
16207 if (
Use.getResNo() == NumVecs)
16210 if (
User->getOpcode() != ARMISD::VDUPLANE ||
16211 VLDLaneNo !=
User->getConstantOperandVal(1))
16218 for (n = 0; n < NumVecs; ++n)
16220 Tys[n] = MVT::Other;
16230 unsigned ResNo =
Use.getResNo();
16232 if (ResNo == NumVecs)
16239 std::vector<SDValue> VLDDupResults;
16240 for (
unsigned n = 0; n < NumVecs; ++n)
16254 EVT VT =
N->getValueType(0);
16257 if (Subtarget->hasMVEIntegerOps()) {
16261 ExtractVT = MVT::i32;
16263 N->getOperand(0),
N->getOperand(1));
16275 Op =
Op.getOperand(0);
16276 if (
Op.getOpcode() != ARMISD::VMOVIMM &&
Op.getOpcode() != ARMISD::VMVNIMM)
16280 unsigned EltSize =
Op.getScalarValueSizeInBits();
16282 unsigned Imm =
Op.getConstantOperandVal(0);
16298 if (Subtarget->hasMVEIntegerOps()) {
16301 if (
Op.getValueType() == MVT::f32)
16302 return DAG.
getNode(ARMISD::VDUP, dl,
N->getValueType(0),
16304 else if (
Op.getValueType() == MVT::f16)
16305 return DAG.
getNode(ARMISD::VDUP, dl,
N->getValueType(0),
16306 DAG.
getNode(ARMISD::VMOVrh, dl, MVT::i32,
Op));
16309 if (!Subtarget->hasNEON())
16316 if (LD &&
Op.hasOneUse() && LD->isUnindexed() &&
16317 LD->getMemoryVT() ==
N->getValueType(0).getVectorElementType()) {
16318 SDValue Ops[] = {LD->getOperand(0), LD->getOperand(1),
16323 LD->getMemoryVT(), LD->getMemOperand());
16334 EVT VT =
N->getValueType(0);
16356 assert(StVT != VT &&
"Cannot truncate to the same type");
16366 if (0 != (NumElems * FromEltSz) % ToEltSz)
16369 unsigned SizeRatio = FromEltSz / ToEltSz;
16374 NumElems * SizeRatio);
16380 for (
unsigned i = 0; i < NumElems; ++i)
16394 MVT StoreType = MVT::i8;
16396 if (TLI.
isTypeLegal(Tp) && Tp.getSizeInBits() <= NumElems * ToEltSz)
16416 for (
unsigned I = 0;
I <
E;
I++) {
16447 if (FromEltVT != MVT::f32 || ToEltVT != MVT::f16)
16450 unsigned NumElements = 4;
16467 unsigned Off0 = Rev ? NumElts : 0;
16468 unsigned Off1 = Rev ? 0 : NumElts;
16470 for (
unsigned I = 0;
I < NumElts;
I += 2) {
16471 if (M[
I] >= 0 && M[
I] != (
int)(Off0 +
I / 2))
16473 if (M[
I + 1] >= 0 && M[
I + 1] != (
int)(Off1 +
I / 2))
16481 if (isVMOVNShuffle(Shuffle,
false) || isVMOVNShuffle(Shuffle,
true))
16501 unsigned NewOffset = i * NumElements * ToEltVT.
getSizeInBits() / 8;
16512 Extract = DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, MVT::v4i32, FPTrunc);
16516 NewToVT, Alignment, MMOFlags, AAInfo);
16549 unsigned NewOffset =
16557 NewToVT, Alignment, MMOFlags, AAInfo);
16579 {Extract.getOperand(0), Extract.getOperand(1)});
16610 if (Subtarget->hasNEON())
16614 if (Subtarget->hasMVEFloatOps())
16618 if (Subtarget->hasMVEIntegerOps()) {
16693 if (!Subtarget->hasNEON())
16697 if (!
Op.getValueType().isVector() || !
Op.getValueType().isSimple() ||
16705 MVT FloatTy =
Op.getSimpleValueType().getVectorElementType();
16707 MVT IntTy =
N->getSimpleValueType(0).getVectorElementType();
16708 uint32_t IntBits = IntTy.getSizeInBits();
16709 unsigned NumLanes =
Op.getValueType().getVectorNumElements();
16710 if (FloatBits != 32 || IntBits > 32 || (NumLanes != 4 && NumLanes != 2)) {
16721 if (
C == -1 ||
C == 0 ||
C > 32)
16726 unsigned IntrinsicOpcode = isSigned ? Intrinsic::arm_neon_vcvtfp2fxs :
16727 Intrinsic::arm_neon_vcvtfp2fxu;
16730 DAG.
getConstant(IntrinsicOpcode, dl, MVT::i32),
Op->getOperand(0),
16733 if (IntBits < FloatBits)
16741 if (!Subtarget->hasMVEFloatOps())
16749 EVT VT =
N->getValueType(0);
16754 auto isIdentitySplat = [&](
SDValue Op,
bool NSZ) {
16756 Op.getOperand(0).getOpcode() != ARMISD::VMOVIMM)
16758 uint64_t ImmVal =
Op.getOperand(0).getConstantOperandVal(0);
16759 if (VT == MVT::v4f32 && (ImmVal == 1664 || (ImmVal == 0 && NSZ)))
16761 if (VT == MVT::v8f16 && (ImmVal == 2688 || (ImmVal == 0 && NSZ)))
16774 if (!isIdentitySplat(Op1.
getOperand(2), NSZ))
16785 EVT VT =
N->getValueType(0);
16788 if (!
N->getFlags().hasAllowReassociation())
16795 unsigned Opc =
A.getConstantOperandVal(0);
16796 if (
Opc != Intrinsic::arm_mve_vcmlaq)
16801 A.getOperand(3),
A.getOperand(4));
16833 if (!Subtarget->hasNEON())
16837 unsigned OpOpcode =
Op.getNode()->getOpcode();
16838 if (!
N->getValueType(0).isVector() || !
N->getValueType(0).isSimple() ||
16842 SDValue ConstVec =
N->getOperand(1);
16846 MVT FloatTy =
N->getSimpleValueType(0).getVectorElementType();
16848 MVT IntTy =
Op.getOperand(0).getSimpleValueType().getVectorElementType();
16849 uint32_t IntBits = IntTy.getSizeInBits();
16850 unsigned NumLanes =
Op.getValueType().getVectorNumElements();
16851 if (FloatBits != 32 || IntBits > 32 || (NumLanes != 4 && NumLanes != 2)) {
16871 int32_t
C = IntVal.exactLogBase2();
16872 if (
C == -1 ||
C == 0 ||
C > 32)
16878 if (IntBits < FloatBits)
16880 NumLanes == 2 ? MVT::v2i32 : MVT::v4i32, ConvInput);
16882 unsigned IntrinsicOpcode = isSigned ? Intrinsic::arm_neon_vcvtfxs2fp
16883 : Intrinsic::arm_neon_vcvtfxu2fp;
16891 if (!ST->hasMVEIntegerOps())
16895 EVT ResVT =
N->getValueType(0);
16923 EVT AVT =
A.getValueType();
16929 auto ExtendIfNeeded = [&](
SDValue A,
unsigned ExtendCode) {
16930 EVT AVT =
A.getValueType();
16940 auto IsVADDV = [&](
MVT RetTy,
unsigned ExtendCode,
ArrayRef<MVT> ExtTypes) {
16941 if (ResVT != RetTy || N0->
getOpcode() != ExtendCode)
16944 if (ExtTypeMatches(
A, ExtTypes))
16945 return ExtendIfNeeded(
A, ExtendCode);
16948 auto IsPredVADDV = [&](
MVT RetTy,
unsigned ExtendCode,
16958 if (ExtTypeMatches(
A, ExtTypes))
16959 return ExtendIfNeeded(
A, ExtendCode);
16962 auto IsVMLAV = [&](
MVT RetTy,
unsigned ExtendCode,
ArrayRef<MVT> ExtTypes,
16972 if (ResVT != RetTy)
16975 if (
Mul->getOpcode() == ExtendCode &&
16976 Mul->getOperand(0).getScalarValueSizeInBits() * 2 >=
16978 Mul =
Mul->getOperand(0);
16987 if (ExtTypeMatches(
A, ExtTypes) && ExtTypeMatches(
B, ExtTypes)) {
16988 A = ExtendIfNeeded(
A, ExtendCode);
16989 B = ExtendIfNeeded(
B, ExtendCode);
16994 auto IsPredVMLAV = [&](
MVT RetTy,
unsigned ExtendCode,
ArrayRef<MVT> ExtTypes,
17007 if (
Mul->getOpcode() == ExtendCode &&
17008 Mul->getOperand(0).getScalarValueSizeInBits() * 2 >=
17010 Mul =
Mul->getOperand(0);
17019 if (ExtTypeMatches(
A, ExtTypes) && ExtTypeMatches(
B, ExtTypes)) {
17020 A = ExtendIfNeeded(
A, ExtendCode);
17021 B = ExtendIfNeeded(
B, ExtendCode);
17032 EVT VT =
Ops[0].getValueType();
17033 if (VT == MVT::v16i8) {
17034 assert((Opcode == ARMISD::VMLALVs || Opcode == ARMISD::VMLALVu) &&
17035 "Unexpected illegal long reduction opcode");
17036 bool IsUnsigned = Opcode == ARMISD::VMLALVu;
17048 DAG.
getNode(IsUnsigned ? ARMISD::VMLALVAu : ARMISD::VMLALVAs, dl,
17061 return DAG.
getNode(ARMISD::VMLAVs, dl, ResVT,
A,
B);
17063 return DAG.
getNode(ARMISD::VMLAVu, dl, ResVT,
A,
B);
17064 if (IsVMLAV(MVT::i64,
ISD::SIGN_EXTEND, {MVT::v16i8, MVT::v8i16, MVT::v4i32},
17066 return Create64bitNode(ARMISD::VMLALVs, {
A,
B});
17067 if (IsVMLAV(MVT::i64,
ISD::ZERO_EXTEND, {MVT::v16i8, MVT::v8i16, MVT::v4i32},
17069 return Create64bitNode(ARMISD::VMLALVu, {
A,
B});
17072 DAG.
getNode(ARMISD::VMLAVs, dl, MVT::i32,
A,
B));
17075 DAG.
getNode(ARMISD::VMLAVu, dl, MVT::i32,
A,
B));
17079 return DAG.
getNode(ARMISD::VMLAVps, dl, ResVT,
A,
B, Mask);
17082 return DAG.
getNode(ARMISD::VMLAVpu, dl, ResVT,
A,
B, Mask);
17085 return Create64bitNode(ARMISD::VMLALVps, {
A,
B, Mask});
17088 return Create64bitNode(ARMISD::VMLALVpu, {
A,
B, Mask});
17091 DAG.
getNode(ARMISD::VMLAVps, dl, MVT::i32,
A,
B, Mask));
17094 DAG.
getNode(ARMISD::VMLAVpu, dl, MVT::i32,
A,
B, Mask));
17097 return DAG.
getNode(ARMISD::VADDVs, dl, ResVT,
A);
17099 return DAG.
getNode(ARMISD::VADDVu, dl, ResVT,
A);
17101 return Create64bitNode(ARMISD::VADDLVs, {
A});
17103 return Create64bitNode(ARMISD::VADDLVu, {
A});
17106 DAG.
getNode(ARMISD::VADDVs, dl, MVT::i32,
A));
17109 DAG.
getNode(ARMISD::VADDVu, dl, MVT::i32,
A));
17112 return DAG.
getNode(ARMISD::VADDVps, dl, ResVT,
A, Mask);
17114 return DAG.
getNode(ARMISD::VADDVpu, dl, ResVT,
A, Mask);
17116 return Create64bitNode(ARMISD::VADDLVps, {
A, Mask});
17118 return Create64bitNode(ARMISD::VADDLVpu, {
A, Mask});
17121 DAG.
getNode(ARMISD::VADDVps, dl, MVT::i32,
A, Mask));
17124 DAG.
getNode(ARMISD::VADDVpu, dl, MVT::i32,
A, Mask));
17131 Op =
Op->getOperand(1);
17133 Op->getOperand(0)->getOpcode() ==
ISD::MUL) {
17135 if (
Mul->getOperand(0) ==
Mul->getOperand(1) &&
17152 unsigned VecOp =
N->getOperand(0).getValueType().isVector() ? 0 : 2;
17154 if (!Shuf || !Shuf->getOperand(1).isUndef())
17159 APInt SetElts(Mask.size(), 0);
17160 for (
int E : Mask) {
17168 if (
N->getNumOperands() != VecOp + 1) {
17170 if (!Shuf2 || !Shuf2->getOperand(1).isUndef() || Shuf2->getMask() != Mask)
17176 if (
Op.getValueType().isVector())
17177 Ops.push_back(
Op.getOperand(0));
17188 unsigned IsTop =
N->getConstantOperandVal(2);
17195 if (Op0->
isUndef() && !IsTop)
17200 if ((Op1->
getOpcode() == ARMISD::VQMOVNs ||
17201 Op1->
getOpcode() == ARMISD::VQMOVNu) &&
17209 unsigned NumElts =
N->getValueType(0).getVectorNumElements();
17211 APInt Op0DemandedElts =
17212 IsTop ? Op1DemandedElts
17227 unsigned IsTop =
N->getConstantOperandVal(2);
17229 unsigned NumElts =
N->getValueType(0).getVectorNumElements();
17230 APInt Op0DemandedElts =
17242 EVT VT =
N->getValueType(0);
17249 if (Shuf0 && Shuf1 && Shuf0->getMask().equals(Shuf1->getMask()) &&
17250 LHS.getOperand(1).isUndef() &&
RHS.getOperand(1).isUndef() &&
17254 LHS.getOperand(0),
RHS.getOperand(0));
17269 int ShiftAmt =
C->getSExtValue();
17270 if (ShiftAmt == 0) {
17276 if (ShiftAmt >= -32 && ShiftAmt < 0) {
17277 unsigned NewOpcode =
17278 N->getOpcode() == ARMISD::LSLL ? ARMISD::LSRL : ARMISD::LSLL;
17293 unsigned IntNo =
N->getConstantOperandVal(0);
17304 case Intrinsic::arm_neon_vshifts:
17305 case Intrinsic::arm_neon_vshiftu:
17306 case Intrinsic::arm_neon_vrshifts:
17307 case Intrinsic::arm_neon_vrshiftu:
17308 case Intrinsic::arm_neon_vrshiftn:
17309 case Intrinsic::arm_neon_vqshifts:
17310 case Intrinsic::arm_neon_vqshiftu:
17311 case Intrinsic::arm_neon_vqshiftsu:
17312 case Intrinsic::arm_neon_vqshiftns:
17313 case Intrinsic::arm_neon_vqshiftnu:
17314 case Intrinsic::arm_neon_vqshiftnsu:
17315 case Intrinsic::arm_neon_vqrshiftns:
17316 case Intrinsic::arm_neon_vqrshiftnu:
17317 case Intrinsic::arm_neon_vqrshiftnsu: {
17318 EVT VT =
N->getOperand(1).getValueType();
17320 unsigned VShiftOpc = 0;
17323 case Intrinsic::arm_neon_vshifts:
17324 case Intrinsic::arm_neon_vshiftu:
17326 VShiftOpc = ARMISD::VSHLIMM;
17329 if (
isVShiftRImm(
N->getOperand(2), VT,
false,
true, Cnt)) {
17330 VShiftOpc = (IntNo == Intrinsic::arm_neon_vshifts ? ARMISD::VSHRsIMM
17331 : ARMISD::VSHRuIMM);
17336 case Intrinsic::arm_neon_vrshifts:
17337 case Intrinsic::arm_neon_vrshiftu:
17342 case Intrinsic::arm_neon_vqshifts:
17343 case Intrinsic::arm_neon_vqshiftu:
17348 case Intrinsic::arm_neon_vqshiftsu:
17353 case Intrinsic::arm_neon_vrshiftn:
17354 case Intrinsic::arm_neon_vqshiftns:
17355 case Intrinsic::arm_neon_vqshiftnu:
17356 case Intrinsic::arm_neon_vqshiftnsu:
17357 case Intrinsic::arm_neon_vqrshiftns:
17358 case Intrinsic::arm_neon_vqrshiftnu:
17359 case Intrinsic::arm_neon_vqrshiftnsu:
17371 case Intrinsic::arm_neon_vshifts:
17372 case Intrinsic::arm_neon_vshiftu:
17375 case Intrinsic::arm_neon_vrshifts:
17376 VShiftOpc = ARMISD::VRSHRsIMM;
17378 case Intrinsic::arm_neon_vrshiftu:
17379 VShiftOpc = ARMISD::VRSHRuIMM;
17381 case Intrinsic::arm_neon_vrshiftn:
17382 VShiftOpc = ARMISD::VRSHRNIMM;
17384 case Intrinsic::arm_neon_vqshifts:
17385 VShiftOpc = ARMISD::VQSHLsIMM;
17387 case Intrinsic::arm_neon_vqshiftu:
17388 VShiftOpc = ARMISD::VQSHLuIMM;
17390 case Intrinsic::arm_neon_vqshiftsu:
17391 VShiftOpc = ARMISD::VQSHLsuIMM;
17393 case Intrinsic::arm_neon_vqshiftns:
17394 VShiftOpc = ARMISD::VQSHRNsIMM;
17396 case Intrinsic::arm_neon_vqshiftnu:
17397 VShiftOpc = ARMISD::VQSHRNuIMM;
17399 case Intrinsic::arm_neon_vqshiftnsu:
17400 VShiftOpc = ARMISD::VQSHRNsuIMM;
17402 case Intrinsic::arm_neon_vqrshiftns:
17403 VShiftOpc = ARMISD::VQRSHRNsIMM;
17405 case Intrinsic::arm_neon_vqrshiftnu:
17406 VShiftOpc = ARMISD::VQRSHRNuIMM;
17408 case Intrinsic::arm_neon_vqrshiftnsu:
17409 VShiftOpc = ARMISD::VQRSHRNsuIMM;
17414 return DAG.
getNode(VShiftOpc, dl,
N->getValueType(0),
17415 N->getOperand(1), DAG.
getConstant(Cnt, dl, MVT::i32));
17418 case Intrinsic::arm_neon_vshiftins: {
17419 EVT VT =
N->getOperand(1).getValueType();
17421 unsigned VShiftOpc = 0;
17424 VShiftOpc = ARMISD::VSLIIMM;
17425 else if (
isVShiftRImm(
N->getOperand(3), VT,
false,
true, Cnt))
17426 VShiftOpc = ARMISD::VSRIIMM;
17432 return DAG.
getNode(VShiftOpc, dl,
N->getValueType(0),
17433 N->getOperand(1),
N->getOperand(2),
17437 case Intrinsic::arm_neon_vqrshifts:
17438 case Intrinsic::arm_neon_vqrshiftu:
17442 case Intrinsic::arm_neon_vbsl: {
17444 return DAG.
getNode(ARMISD::VBSP, dl,
N->getValueType(0),
N->getOperand(1),
17445 N->getOperand(2),
N->getOperand(3));
17447 case Intrinsic::arm_mve_vqdmlah:
17448 case Intrinsic::arm_mve_vqdmlash:
17449 case Intrinsic::arm_mve_vqrdmlah:
17450 case Intrinsic::arm_mve_vqrdmlash:
17451 case Intrinsic::arm_mve_vmla_n_predicated:
17452 case Intrinsic::arm_mve_vmlas_n_predicated:
17453 case Intrinsic::arm_mve_vqdmlah_predicated:
17454 case Intrinsic::arm_mve_vqdmlash_predicated:
17455 case Intrinsic::arm_mve_vqrdmlah_predicated:
17456 case Intrinsic::arm_mve_vqrdmlash_predicated: {
17461 unsigned BitWidth =
N->getValueType(0).getScalarSizeInBits();
17468 case Intrinsic::arm_mve_minv:
17469 case Intrinsic::arm_mve_maxv:
17470 case Intrinsic::arm_mve_minav:
17471 case Intrinsic::arm_mve_maxav:
17472 case Intrinsic::arm_mve_minv_predicated:
17473 case Intrinsic::arm_mve_maxv_predicated:
17474 case Intrinsic::arm_mve_minav_predicated:
17475 case Intrinsic::arm_mve_maxav_predicated: {
17478 unsigned BitWidth =
N->getOperand(2)->getValueType(0).getScalarSizeInBits();
17485 case Intrinsic::arm_mve_addv: {
17488 bool Unsigned =
N->getConstantOperandVal(2);
17489 unsigned Opc =
Unsigned ? ARMISD::VADDVu : ARMISD::VADDVs;
17493 case Intrinsic::arm_mve_addlv:
17494 case Intrinsic::arm_mve_addlv_predicated: {
17497 bool Unsigned =
N->getConstantOperandVal(2);
17498 unsigned Opc = IntNo == Intrinsic::arm_mve_addlv ?
17499 (
Unsigned ? ARMISD::VADDLVu : ARMISD::VADDLVs) :
17500 (
Unsigned ? ARMISD::VADDLVpu : ARMISD::VADDLVps);
17503 for (
unsigned i = 1, e =
N->getNumOperands(); i < e; i++)
17505 Ops.push_back(
N->getOperand(i));
17526 EVT VT =
N->getValueType(0);
17528 if (ST->isThumb1Only() &&
N->getOpcode() ==
ISD::SHL && VT == MVT::i32 &&
17529 N->getOperand(0)->getOpcode() ==
ISD::AND &&
17530 N->getOperand(0)->hasOneUse()) {
17547 if (AndMask == 255 || AndMask == 65535)
17551 if (MaskedBits > ShiftAmt) {
17566 if (ST->hasMVEIntegerOps())
17571 switch (
N->getOpcode()) {
17577 return DAG.
getNode(ARMISD::VSHLIMM, dl, VT,
N->getOperand(0),
17584 if (
isVShiftRImm(
N->getOperand(1), VT,
false,
false, Cnt)) {
17585 unsigned VShiftOpc =
17586 (
N->getOpcode() ==
ISD::SRA ? ARMISD::VSHRsIMM : ARMISD::VSHRuIMM);
17588 return DAG.
getNode(VShiftOpc, dl, VT,
N->getOperand(0),
17604 if (!LD->isSimple() || !N0.
hasOneUse() || LD->isIndexed() ||
17607 EVT FromVT = LD->getValueType(0);
17608 EVT ToVT =
N->getValueType(0);
17615 unsigned NumElements = 0;
17616 if (ToEltVT == MVT::i32 && FromEltVT == MVT::i8)
17618 if (ToEltVT == MVT::f32 && FromEltVT == MVT::f16)
17620 if (NumElements == 0 ||
17630 SDValue BasePtr = LD->getBasePtr();
17631 Align Alignment = LD->getBaseAlign();
17652 LD->getPointerInfo().getWithOffset(NewOffset), NewFromVT,
17653 Alignment, MMOFlags, AAInfo);
17659 if (FromEltVT == MVT::f16) {
17662 for (
unsigned i = 0; i < Loads.
size(); i++) {
17664 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, MVT::v8f16, Loads[i]);
17688 if ((ST->hasNEON() || ST->hasMVEIntegerOps()) &&
17692 EVT VT =
N->getValueType(0);
17696 if (VT == MVT::i32 &&
17697 (EltVT == MVT::i8 || EltVT == MVT::i16) &&
17702 switch (
N->getOpcode()) {
17705 Opc = ARMISD::VGETLANEs;
17709 Opc = ARMISD::VGETLANEu;
17716 if (ST->hasMVEIntegerOps())
17725 if (ST->hasMVEFloatOps())
17736 if ((Subtarget->isThumb() || !Subtarget->hasV6Ops()) &&
17740 EVT VT =
Op.getValueType();
17743 if (VT != MVT::i32 ||
17756 APInt MaxC = Max.getConstantOperandAPInt(1);
17759 !(MinC + 1).isPowerOf2())
17777 EVT VT =
N->getValueType(0);
17780 if (VT == MVT::i32)
17783 if (!ST->hasMVEIntegerOps())
17789 if (VT != MVT::v4i32 && VT != MVT::v8i16)
17792 auto IsSignedSaturate = [&](
SDNode *Min,
SDNode *Max) {
17800 if (VT == MVT::v4i32)
17801 SaturateC =
APInt(32, (1 << 15) - 1,
true);
17803 SaturateC =
APInt(16, (1 << 7) - 1,
true);
17810 MaxC != ~SaturateC)
17815 if (IsSignedSaturate(
N, N0.
getNode())) {
17818 if (VT == MVT::v4i32) {
17819 HalfVT = MVT::v8i16;
17820 ExtVT = MVT::v4i16;
17822 HalfVT = MVT::v16i8;
17837 auto IsUnsignedSaturate = [&](
SDNode *Min) {
17843 if (VT == MVT::v4i32)
17844 SaturateC =
APInt(32, (1 << 16) - 1,
true);
17846 SaturateC =
APInt(16, (1 << 8) - 1,
true);
17855 if (IsUnsignedSaturate(
N)) {
17859 if (VT == MVT::v4i32) {
17860 HalfVT = MVT::v8i16;
17861 ExtConst = 0x0000FFFF;
17863 HalfVT = MVT::v16i8;
17885 const APInt *CV = &
C->getAPIntValue();
17903 SDValue Op0 = CMOV->getOperand(0);
17904 SDValue Op1 = CMOV->getOperand(1);
17905 auto CC = CMOV->getConstantOperandAPInt(2).getLimitedValue();
17906 SDValue CmpZ = CMOV->getOperand(3);
17942 unsigned Heuristic = Subtarget->isThumb() ? 3 : 2;
17949 if ((OrCI & Known.
Zero) != OrCI)
17955 EVT VT =
X.getValueType();
17956 unsigned BitInX = AndC->
logBase2();
17964 for (
unsigned BitInY = 0, NumActiveBits = OrCI.
getActiveBits();
17965 BitInY < NumActiveBits; ++BitInY) {
17966 if (OrCI[BitInY] == 0)
17969 Mask.setBit(BitInY);
17970 V = DAG.
getNode(ARMISD::BFI, dl, VT, V,
X,
17986 switch (
N->getOpcode()) {
18001 if (Const->isZero())
18003 else if (Const->isOne())
18011 unsigned IntOp =
N.getConstantOperandVal(1);
18012 if (IntOp != Intrinsic::test_start_loop_iterations &&
18013 IntOp != Intrinsic::loop_decrement_reg)
18039 bool Negate =
false;
18045 Cond =
N->getOperand(1);
18046 Dest =
N->getOperand(2);
18050 Cond =
N->getOperand(2);
18051 Dest =
N->getOperand(4);
18053 if (!Const->isOne() && !Const->isZero())
18055 Imm = Const->getZExtValue();
18083 assert((IsTrueIfZero(CC, Imm) || IsFalseIfZero(CC, Imm)) &&
18084 "unsupported condition");
18089 unsigned IntOp =
Int->getConstantOperandVal(1);
18090 assert((
N->hasOneUse() &&
N->user_begin()->getOpcode() ==
ISD::BR) &&
18091 "expected single br user");
18092 SDNode *Br = *
N->user_begin();
18102 if (IntOp == Intrinsic::test_start_loop_iterations) {
18104 SDValue Setup = DAG.
getNode(ARMISD::WLSSETUP, dl, MVT::i32, Elements);
18106 if (IsTrueIfZero(CC, Imm)) {
18108 Res = DAG.
getNode(ARMISD::WLS, dl, MVT::Other,
Ops);
18112 UpdateUncondBr(Br, Dest, DAG);
18114 SDValue Ops[] = {Chain, Setup, OtherTarget};
18115 Res = DAG.
getNode(ARMISD::WLS, dl, MVT::Other,
Ops);
18127 DAG.
getVTList(MVT::i32, MVT::Other), Args);
18131 SDValue Target = IsFalseIfZero(CC, Imm) ? Dest : OtherTarget;
18135 if (
Target == OtherTarget)
18136 UpdateUncondBr(Br, Dest, DAG);
18142 return DAG.
getNode(ARMISD::LE, dl, MVT::Other, EndArgs);
18151 if (Cmp.getOpcode() != ARMISD::CMPZ)
18156 SDValue LHS = Cmp.getOperand(0);
18157 SDValue RHS = Cmp.getOperand(1);
18166 LHS->getOperand(0)->getOpcode() == ARMISD::CMOV &&
18167 LHS->getOperand(0)->hasOneUse() &&
18171 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, BB,
18183 if (Cmp.getOpcode() != ARMISD::CMPZ)
18187 EVT VT =
N->getValueType(0);
18189 SDValue LHS = Cmp.getOperand(0);
18190 SDValue RHS = Cmp.getOperand(1);
18191 SDValue FalseVal =
N->getOperand(0);
18192 SDValue TrueVal =
N->getOperand(1);
18197 if (!Subtarget->isThumb1Only() && Subtarget->hasV6T2Ops()) {
18221 if (CC ==
ARMCC::NE && FalseVal == RHS && FalseVal != LHS) {
18222 Res = DAG.
getNode(ARMISD::CMOV, dl, VT, LHS, TrueVal, ARMcc, Cmp);
18223 }
else if (CC ==
ARMCC::EQ && TrueVal == RHS) {
18226 Res = DAG.
getNode(ARMISD::CMOV, dl, VT, LHS, FalseVal, ARMcc, NewCmp);
18231 if (CC ==
ARMCC::NE && LHS.getOpcode() == ARMISD::CMOV && LHS->hasOneUse() &&
18234 return DAG.
getNode(ARMISD::CMOV, dl, VT, FalseVal, TrueVal,
18235 LHS->getOperand(2), LHS->getOperand(3));
18245 if (
N->getConstantOperandVal(2) ==
ARMCC::EQ ||
18249 if (
N->getConstantOperandVal(2) ==
ARMCC::NE)
18251 return DAG.
getNode(
N->getOpcode(),
SDLoc(
N), MVT::i32,
N->getOperand(0),
18260 if (!Subtarget->isThumb1Only() && Subtarget->hasV5TOps()) {
18293 Res = DAG.
getNode(ARMISD::CMOV, dl, VT,
Sub, TrueVal, ARMcc,
18305 Res = DAG.
getNode(ARMISD::CMOV, dl, VT,
Sub, FalseVal,
18325 const APInt *TrueConst;
18326 if (Subtarget->isThumb1Only() && CC ==
ARMCC::NE &&
18327 ((FalseVal.getOpcode() == ARMISD::SUBC && FalseVal.getOperand(0) == LHS &&
18328 FalseVal.getOperand(1) == RHS) ||
18332 unsigned ShiftAmount = TrueConst->
logBase2();
18347 if (Known.
Zero == 0xfffffffe)
18350 else if (Known.
Zero == 0xffffff00)
18353 else if (Known.
Zero == 0xffff0000)
18366 EVT DstVT =
N->getValueType(0);
18369 if (ST->hasMVEIntegerOps() && Src.getOpcode() == ARMISD::VDUP) {
18370 EVT SrcVT = Src.getValueType();
18372 return DAG.
getNode(ARMISD::VDUP,
SDLoc(
N), DstVT, Src.getOperand(0));
18377 if (Src.getOpcode() == ARMISD::VECTOR_REG_CAST &&
18378 Src.getOperand(0).getValueType().getScalarSizeInBits() <=
18379 Src.getValueType().getScalarSizeInBits())
18380 Src = Src.getOperand(0);
18384 EVT SrcVT = Src.getValueType();
18385 if ((Src.getOpcode() == ARMISD::VMOVIMM ||
18386 Src.getOpcode() == ARMISD::VMVNIMM ||
18387 Src.getOpcode() == ARMISD::VMOVFPIMM) &&
18390 return DAG.
getNode(ARMISD::VECTOR_REG_CAST,
SDLoc(
N), DstVT, Src);
18404 EVT VT =
N->getValueType(0);
18412 if (
N->getNumOperands() == 2 &&
18416 N->getOperand(0).getOperand(1),
18417 N->getOperand(1).getOperand(0),
18418 N->getOperand(1).getOperand(1));
18421 if (
N->getNumOperands() == 2 &&
18427 if (S0->getOperand(0) ==
S1->getOperand(0) &&
18428 S0->getOperand(1) ==
S1->getOperand(1)) {
18431 Mask.append(
S1->getMask().begin(),
S1->getMask().end());
18435 ARMISD::VMOVN,
DL, VT,
18436 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT, S0->getOperand(0)),
18437 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT, S0->getOperand(1)),
18441 ARMISD::VMOVN,
DL, VT,
18442 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT, S0->getOperand(1)),
18443 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT, S0->getOperand(0)),
18451 return Op.getOpcode() == ISD::BUILD_VECTOR ||
18452 Op.getOpcode() == ISD::VECTOR_SHUFFLE ||
18453 (Op.getOpcode() == ISD::BITCAST &&
18454 Op.getOperand(0).getOpcode() == ISD::BUILD_VECTOR);
18457 for (
unsigned Op = 0;
Op <
N->getNumOperands();
Op++) {
18459 for (
unsigned i = 0; i < O.getValueType().getVectorNumElements(); i++) {
18477 int NumIns =
N->getNumOperands();
18478 assert((NumIns == 2 || NumIns == 4) &&
18479 "Expected 2 or 4 inputs to an MVETrunc");
18481 if (
N->getNumOperands() == 4)
18485 for (
int I = 0;
I < NumIns;
I++) {
18487 ISD::ADD,
DL, StackPtr.getValueType(), StackPtr,
18492 Ptr, MPI, StoreVT,
Align(4));
18507 if (!LD || !LD->isSimple() || !N0.
hasOneUse() || LD->isIndexed())
18510 EVT FromVT = LD->getMemoryVT();
18511 EVT ToVT =
N->getValueType(0);
18518 unsigned NumElements = 0;
18519 if (ToEltVT == MVT::i32 && (FromEltVT == MVT::i16 || FromEltVT == MVT::i8))
18521 if (ToEltVT == MVT::i16 && FromEltVT == MVT::i8)
18523 assert(NumElements != 0);
18529 LD->getExtensionType() != NewExtType)
18536 SDValue BasePtr = LD->getBasePtr();
18537 Align Alignment = LD->getBaseAlign();
18556 LD->getPointerInfo().getWithOffset(NewOffset), NewFromVT,
18557 Alignment, MMOFlags, AAInfo);
18573 EVT VT =
N->getValueType(0);
18575 assert(
N->getNumValues() == 2 &&
"Expected MVEEXT with 2 elements");
18576 assert((VT == MVT::v4i32 || VT == MVT::v8i16) &&
"Unexpected MVEEXT type");
18578 EVT ExtVT =
N->getOperand(0).getValueType().getHalfNumVectorElementsVT(
18580 auto Extend = [&](
SDValue V) {
18589 if (
N->getOperand(0).getOpcode() == ARMISD::VDUP) {
18590 SDValue Ext = Extend(
N->getOperand(0));
18598 assert(Mask.size() == SVN->getValueType(0).getVectorNumElements());
18599 unsigned Rev = VT == MVT::v4i32 ? ARMISD::VREV32 : ARMISD::VREV16;
18603 auto CheckInregMask = [&](
int Start,
int Offset) {
18605 if (Mask[Start + Idx] >= 0 && Mask[Start + Idx] != Idx * 2 +
Offset)
18611 if (CheckInregMask(0, 0))
18613 else if (CheckInregMask(0, 1))
18614 V0 = Extend(DAG.
getNode(Rev,
DL, SVN->getValueType(0), Op0));
18615 else if (CheckInregMask(0, Mask.size()))
18617 else if (CheckInregMask(0, Mask.size() + 1))
18618 V0 = Extend(DAG.
getNode(Rev,
DL, SVN->getValueType(0), Op1));
18623 V1 = Extend(DAG.
getNode(Rev,
DL, SVN->getValueType(0), Op1));
18627 V1 = Extend(DAG.
getNode(Rev,
DL, SVN->getValueType(0), Op0));
18634 if (
N->getOperand(0)->getOpcode() ==
ISD::LOAD)
18645 int NumOuts =
N->getNumValues();
18646 assert((NumOuts == 2 || NumOuts == 4) &&
18647 "Expected 2 or 4 outputs to an MVEEXT");
18648 EVT LoadVT =
N->getOperand(0).getValueType().getHalfNumVectorElementsVT(
18650 if (
N->getNumOperands() == 4)
18656 StackPtr, MPI,
Align(4));
18659 for (
int I = 0;
I < NumOuts;
I++) {
18661 ISD::ADD,
DL, StackPtr.getValueType(), StackPtr,
18662 DAG.
getConstant(
I * 16 / NumOuts,
DL, StackPtr.getValueType()));
18667 VT, Chain, Ptr, MPI, LoadVT,
Align(4));
18676 switch (
N->getOpcode()) {
18736 case ARMISD::BRCOND:
18740 case ARMISD::CSINC:
18741 case ARMISD::CSINV:
18742 case ARMISD::CSNEG:
18755 case ARMISD::PREDICATE_CAST:
18757 case ARMISD::VECTOR_REG_CAST:
18768 case ARMISD::VADDVs:
18769 case ARMISD::VADDVu:
18770 case ARMISD::VADDLVs:
18771 case ARMISD::VADDLVu:
18772 case ARMISD::VADDLVAs:
18773 case ARMISD::VADDLVAu:
18774 case ARMISD::VMLAVs:
18775 case ARMISD::VMLAVu:
18776 case ARMISD::VMLALVs:
18777 case ARMISD::VMLALVu:
18778 case ARMISD::VMLALVAs:
18779 case ARMISD::VMLALVAu:
18781 case ARMISD::VMOVN:
18783 case ARMISD::VQMOVNs:
18784 case ARMISD::VQMOVNu:
18786 case ARMISD::VQDMULH:
18792 case ARMISD::SMULWB: {
18793 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
18799 case ARMISD::SMULWT: {
18800 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
18806 case ARMISD::SMLALBB:
18807 case ARMISD::QADD16b:
18808 case ARMISD::QSUB16b:
18809 case ARMISD::UQADD16b:
18810 case ARMISD::UQSUB16b: {
18811 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
18818 case ARMISD::SMLALBT: {
18819 unsigned LowWidth =
N->getOperand(0).getValueType().getSizeInBits();
18821 unsigned HighWidth =
N->getOperand(1).getValueType().getSizeInBits();
18828 case ARMISD::SMLALTB: {
18829 unsigned HighWidth =
N->getOperand(0).getValueType().getSizeInBits();
18831 unsigned LowWidth =
N->getOperand(1).getValueType().getSizeInBits();
18838 case ARMISD::SMLALTT: {
18839 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
18846 case ARMISD::QADD8b:
18847 case ARMISD::QSUB8b:
18848 case ARMISD::UQADD8b:
18849 case ARMISD::UQSUB8b: {
18850 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
18858 if (
N->getOperand(1) ==
N->getOperand(2))
18859 return N->getOperand(1);
18863 switch (
N->getConstantOperandVal(1)) {
18864 case Intrinsic::arm_neon_vld1:
18865 case Intrinsic::arm_neon_vld1x2:
18866 case Intrinsic::arm_neon_vld1x3:
18867 case Intrinsic::arm_neon_vld1x4:
18868 case Intrinsic::arm_neon_vld2:
18869 case Intrinsic::arm_neon_vld3:
18870 case Intrinsic::arm_neon_vld4:
18871 case Intrinsic::arm_neon_vld2lane:
18872 case Intrinsic::arm_neon_vld3lane:
18873 case Intrinsic::arm_neon_vld4lane:
18874 case Intrinsic::arm_neon_vld2dup:
18875 case Intrinsic::arm_neon_vld3dup:
18876 case Intrinsic::arm_neon_vld4dup:
18877 case Intrinsic::arm_neon_vst1:
18878 case Intrinsic::arm_neon_vst1x2:
18879 case Intrinsic::arm_neon_vst1x3:
18880 case Intrinsic::arm_neon_vst1x4:
18881 case Intrinsic::arm_neon_vst2:
18882 case Intrinsic::arm_neon_vst3:
18883 case Intrinsic::arm_neon_vst4:
18884 case Intrinsic::arm_neon_vst2lane:
18885 case Intrinsic::arm_neon_vst3lane:
18886 case Intrinsic::arm_neon_vst4lane:
18888 case Intrinsic::arm_mve_vld2q:
18889 case Intrinsic::arm_mve_vld4q:
18890 case Intrinsic::arm_mve_vst2q:
18891 case Intrinsic::arm_mve_vst4q:
18908 unsigned *
Fast)
const {
18914 bool AllowsUnaligned = Subtarget->allowsUnalignedMem();
18917 if (Ty == MVT::i8 || Ty == MVT::i16 || Ty == MVT::i32) {
18919 if (AllowsUnaligned) {
18921 *
Fast = Subtarget->hasV7Ops();
18926 if (Ty == MVT::f64 || Ty == MVT::v2f64) {
18930 if (Subtarget->hasNEON() && (AllowsUnaligned || Subtarget->isLittle())) {
18937 if (!Subtarget->hasMVEIntegerOps())
18941 if ((Ty == MVT::v16i1 || Ty == MVT::v8i1 || Ty == MVT::v4i1 ||
18942 Ty == MVT::v2i1)) {
18950 if ((Ty == MVT::v4i8 || Ty == MVT::v8i8 || Ty == MVT::v4i16) &&
18966 if (Ty == MVT::v16i8 || Ty == MVT::v8i16 || Ty == MVT::v8f16 ||
18967 Ty == MVT::v4i32 || Ty == MVT::v4f32 || Ty == MVT::v2i64 ||
18968 Ty == MVT::v2f64) {
18979 const AttributeList &FuncAttributes)
const {
18981 if ((
Op.isMemcpy() ||
Op.isZeroMemset()) && Subtarget->hasNEON() &&
18982 !FuncAttributes.hasFnAttr(Attribute::NoImplicitFloat)) {
18984 if (
Op.size() >= 16 &&
18990 }
else if (
Op.size() >= 8 &&
19007 if (!SrcTy->isIntegerTy() || !DstTy->
isIntegerTy())
19009 unsigned SrcBits = SrcTy->getPrimitiveSizeInBits();
19011 return (SrcBits == 64 && DestBits == 32);
19020 return (SrcBits == 64 && DestBits == 32);
19056 return Subtarget->hasFullFP16();
19063 if (!Subtarget->hasMVEIntegerOps())
19082 if (Ld->isExpandingLoad())
19086 if (Subtarget->hasMVEIntegerOps())
19099 U->getOpcode() ==
ISD::SHL || U->getOpcode() == ARMISD::VSHLIMM))
19131bool ARMTargetLowering::isFMAFasterThanFMulAndFAdd(
const MachineFunction &MF,
19133 if (Subtarget->useSoftFloat())
19142 return Subtarget->hasMVEFloatOps();
19160 unsigned Scale = 1;
19177 if ((V & (Scale - 1)) != 0)
19186 if (VT.
isVector() && Subtarget->hasNEON())
19189 !Subtarget->hasMVEFloatOps())
19192 bool IsNeg =
false;
19198 unsigned NumBytes = std::max((
unsigned)VT.
getSizeInBits() / 8, 1U);
19201 if (VT.
isVector() && Subtarget->hasMVEIntegerOps()) {
19217 if (VT.
isFloatingPoint() && NumBytes == 2 && Subtarget->hasFPRegs16())
19223 if (NumBytes == 1 || NumBytes == 2 || NumBytes == 4) {
19253 default:
return false;
19272 int Scale = AM.
Scale;
19277 default:
return false;
19285 Scale = Scale & ~1;
19286 return Scale == 2 || Scale == 4 || Scale == 8;
19303 if (Scale & 1)
return false;
19310 const int Scale = AM.
Scale;
19320 return (Scale == 1) || (!AM.
HasBaseReg && Scale == 2);
19336 switch (AM.
Scale) {
19347 if (Subtarget->isThumb1Only())
19350 if (Subtarget->isThumb2())
19353 int Scale = AM.
Scale;
19355 default:
return false;
19359 if (Scale < 0) Scale = -Scale;
19367 if (Scale == 1 || (AM.
HasBaseReg && Scale == -1))
19380 if (Scale & 1)
return false;
19393 if (!Subtarget->isThumb())
19396 if (Subtarget->isThumb2())
19400 return Imm >= 0 && Imm <= 255;
19410 if (!Subtarget->isThumb())
19412 if (Subtarget->isThumb2())
19415 return AbsImm <= 255;
19450 if (VT == MVT::i16 || ((VT == MVT::i8 || VT == MVT::i1) && isSEXTLoad)) {
19454 int RHSC = (int)
RHS->getZExtValue();
19455 if (RHSC < 0 && RHSC > -256) {
19465 }
else if (VT == MVT::i32 || VT == MVT::i8 || VT == MVT::i1) {
19468 int RHSC = (int)
RHS->getZExtValue();
19469 if (RHSC < 0 && RHSC > -0x1000) {
19511 int RHSC = (int)
RHS->getZExtValue();
19512 if (RHSC < 0 && RHSC > -0x100) {
19517 }
else if (RHSC > 0 && RHSC < 0x100) {
19528 bool isSEXTLoad,
bool IsMasked,
bool isLE,
19539 bool CanChangeType = isLE && !IsMasked;
19542 int RHSC = (int)
RHS->getZExtValue();
19544 auto IsInRange = [&](
int RHSC,
int Limit,
int Scale) {
19545 if (RHSC < 0 && RHSC > -Limit * Scale && RHSC % Scale == 0) {
19550 }
else if (RHSC > 0 && RHSC < Limit * Scale && RHSC % Scale == 0) {
19561 if (VT == MVT::v4i16) {
19562 if (Alignment >= 2 && IsInRange(RHSC, 0x80, 2))
19564 }
else if (VT == MVT::v4i8 || VT == MVT::v8i8) {
19565 if (IsInRange(RHSC, 0x80, 1))
19567 }
else if (Alignment >= 4 &&
19568 (CanChangeType || VT == MVT::v4i32 || VT == MVT::v4f32) &&
19569 IsInRange(RHSC, 0x80, 4))
19571 else if (Alignment >= 2 &&
19572 (CanChangeType || VT == MVT::v8i16 || VT == MVT::v8f16) &&
19573 IsInRange(RHSC, 0x80, 2))
19575 else if ((CanChangeType || VT == MVT::v16i8) && IsInRange(RHSC, 0x80, 1))
19588 if (Subtarget->isThumb1Only())
19594 bool isSEXTLoad =
false;
19595 bool IsMasked =
false;
19597 Ptr = LD->getBasePtr();
19598 VT = LD->getMemoryVT();
19599 Alignment = LD->getAlign();
19602 Ptr = ST->getBasePtr();
19603 VT = ST->getMemoryVT();
19604 Alignment = ST->getAlign();
19606 Ptr = LD->getBasePtr();
19607 VT = LD->getMemoryVT();
19608 Alignment = LD->getAlign();
19612 Ptr = ST->getBasePtr();
19613 VT = ST->getMemoryVT();
19614 Alignment = ST->getAlign();
19620 bool isLegal =
false;
19622 isLegal = Subtarget->hasMVEIntegerOps() &&
19624 Ptr.
getNode(), VT, Alignment, isSEXTLoad, IsMasked,
19625 Subtarget->isLittle(),
Base,
Offset, isInc, DAG);
19627 if (Subtarget->isThumb2())
19652 bool isSEXTLoad =
false, isNonExt;
19653 bool IsMasked =
false;
19655 VT = LD->getMemoryVT();
19656 Ptr = LD->getBasePtr();
19657 Alignment = LD->getAlign();
19661 VT = ST->getMemoryVT();
19662 Ptr = ST->getBasePtr();
19663 Alignment = ST->getAlign();
19664 isNonExt = !ST->isTruncatingStore();
19666 VT = LD->getMemoryVT();
19667 Ptr = LD->getBasePtr();
19668 Alignment = LD->getAlign();
19673 VT = ST->getMemoryVT();
19674 Ptr = ST->getBasePtr();
19675 Alignment = ST->getAlign();
19676 isNonExt = !ST->isTruncatingStore();
19681 if (Subtarget->isThumb1Only()) {
19684 assert(
Op->getValueType(0) == MVT::i32 &&
"Non-i32 post-inc op?!");
19685 if (
Op->getOpcode() !=
ISD::ADD || !isNonExt)
19688 if (!RHS || RHS->getZExtValue() != 4)
19690 if (Alignment <
Align(4))
19694 Base =
Op->getOperand(0);
19700 bool isLegal =
false;
19702 isLegal = Subtarget->hasMVEIntegerOps() &&
19707 if (Subtarget->isThumb2())
19721 !Subtarget->isThumb2())
19735 const APInt &DemandedElts,
19737 unsigned Depth)
const {
19740 switch (
Op.getOpcode()) {
19747 if (
Op.getResNo() == 0) {
19758 case ARMISD::CMOV: {
19773 case Intrinsic::arm_ldaex:
19774 case Intrinsic::arm_ldrex: {
19782 case ARMISD::BFI: {
19789 const APInt &Mask =
Op.getConstantOperandAPInt(2);
19790 Known.
Zero &= Mask;
19794 case ARMISD::VGETLANEs:
19795 case ARMISD::VGETLANEu: {
19796 const SDValue &SrcSV =
Op.getOperand(0);
19802 "VGETLANE index out of bounds");
19807 EVT VT =
Op.getValueType();
19813 if (
Op.getOpcode() == ARMISD::VGETLANEs)
19814 Known = Known.
sext(DstSz);
19816 Known = Known.
zext(DstSz);
19821 case ARMISD::VMOVrh: {
19824 Known = KnownOp.
zext(32);
19827 case ARMISD::CSINC:
19828 case ARMISD::CSINV:
19829 case ARMISD::CSNEG: {
19837 if (
Op.getOpcode() == ARMISD::CSINC)
19840 else if (
Op.getOpcode() == ARMISD::CSINV)
19842 else if (
Op.getOpcode() == ARMISD::CSNEG)
19849 case ARMISD::VORRIMM:
19850 case ARMISD::VBICIMM: {
19851 unsigned Encoded =
Op.getConstantOperandVal(1);
19852 unsigned DecEltBits = 0;
19855 unsigned EltBits =
Op.getScalarValueSizeInBits();
19856 if (EltBits != DecEltBits) {
19865 bool IsVORR =
Op.getOpcode() == ARMISD::VORRIMM;
19866 APInt Imm(DecEltBits, DecodedVal);
19868 Known.
One = IsVORR ? (KnownLHS.
One | Imm) : (KnownLHS.
One & ~Imm);
19869 Known.
Zero = IsVORR ? (KnownLHS.
Zero & ~Imm) : (KnownLHS.
Zero | Imm);
19887 EVT VT =
Op.getValueType();
19893 assert(VT == MVT::i32 &&
"Unexpected integer type");
19900 unsigned Mask =
C->getZExtValue();
19903 unsigned ShrunkMask = Mask & Demanded;
19904 unsigned ExpandedMask = Mask | ~Demanded;
19908 if (ShrunkMask == 0)
19914 if (ExpandedMask == ~0U)
19917 auto IsLegalMask = [ShrunkMask, ExpandedMask](
unsigned Mask) ->
bool {
19918 return (ShrunkMask & Mask) == ShrunkMask && (~ExpandedMask & Mask) == 0;
19920 auto UseMask = [Mask,
Op, VT, &TLO](
unsigned NewMask) ->
bool {
19921 if (NewMask == Mask)
19930 if (IsLegalMask(0xFF))
19931 return UseMask(0xFF);
19934 if (IsLegalMask(0xFFFF))
19935 return UseMask(0xFFFF);
19939 if (ShrunkMask < 256)
19940 return UseMask(ShrunkMask);
19944 if ((
int)ExpandedMask <= -2 && (
int)ExpandedMask >= -256)
19945 return UseMask(ExpandedMask);
19960 unsigned Depth)
const {
19961 unsigned Opc =
Op.getOpcode();
19965 case ARMISD::LSRL: {
19969 if (
Op.getResNo() == 0 && !
Op->hasAnyUseOfValue(1) &&
19971 unsigned ShAmt =
Op->getConstantOperandVal(2);
19981 case ARMISD::VBICIMM: {
19983 unsigned ModImm =
Op.getConstantOperandVal(1);
19984 unsigned EltBits = 0;
19986 if ((OriginalDemandedBits & Mask) == 0)
19992 Op, OriginalDemandedBits, OriginalDemandedElts, Known, TLO,
Depth);
20007 if (!Subtarget->hasVFP2Base())
20011 if (ConstraintVT.
isVector() && Subtarget->hasNEON() &&
20023 unsigned S = Constraint.
size();
20025 switch (Constraint[0]) {
20037 }
else if (S == 2) {
20038 switch (Constraint[0]) {
20055 Value *CallOperandVal =
info.CallOperandVal;
20058 if (!CallOperandVal)
20062 switch (*constraint) {
20068 if (Subtarget->isThumb())
20083 if (PR == 0 || VT == MVT::Other)
20085 if (ARM::SPRRegClass.
contains(PR))
20086 return VT != MVT::f32 && VT != MVT::f16 && VT != MVT::i32;
20087 if (ARM::DPRRegClass.
contains(PR))
20092using RCPair = std::pair<unsigned, const TargetRegisterClass *>;
20096 switch (Constraint.
size()) {
20099 switch (Constraint[0]) {
20101 if (Subtarget->isThumb())
20102 return RCPair(0U, &ARM::tGPRRegClass);
20103 return RCPair(0U, &ARM::GPRRegClass);
20105 if (Subtarget->isThumb())
20106 return RCPair(0U, &ARM::hGPRRegClass);
20109 if (Subtarget->isThumb1Only())
20110 return RCPair(0U, &ARM::tGPRRegClass);
20111 return RCPair(0U, &ARM::GPRRegClass);
20113 if (VT == MVT::Other)
20115 if (VT == MVT::f32 || VT == MVT::f16 || VT == MVT::bf16)
20116 return RCPair(0U, &ARM::SPRRegClass);
20118 return RCPair(0U, &ARM::DPRRegClass);
20120 return RCPair(0U, &ARM::QPRRegClass);
20123 if (VT == MVT::Other)
20125 if (VT == MVT::f32 || VT == MVT::f16 || VT == MVT::bf16)
20126 return RCPair(0U, &ARM::SPR_8RegClass);
20128 return RCPair(0U, &ARM::DPR_8RegClass);
20130 return RCPair(0U, &ARM::QPR_8RegClass);
20133 if (VT == MVT::Other)
20135 if (VT == MVT::f32 || VT == MVT::i32 || VT == MVT::f16 || VT == MVT::bf16)
20136 return RCPair(0U, &ARM::SPRRegClass);
20138 return RCPair(0U, &ARM::DPR_VFP2RegClass);
20140 return RCPair(0U, &ARM::QPR_VFP2RegClass);
20146 if (Constraint[0] ==
'T') {
20147 switch (Constraint[1]) {
20151 return RCPair(0U, &ARM::tGPREvenRegClass);
20153 return RCPair(0U, &ARM::tGPROddRegClass);
20162 if (
StringRef(
"{cc}").equals_insensitive(Constraint))
20163 return std::make_pair(
unsigned(ARM::CPSR), &ARM::CCRRegClass);
20167 return {0,
nullptr};
20175 std::vector<SDValue> &
Ops,
20180 if (Constraint.
size() != 1)
20183 char ConstraintLetter = Constraint[0];
20184 switch (ConstraintLetter) {
20187 case 'I':
case 'J':
case 'K':
case 'L':
20188 case 'M':
case 'N':
case 'O':
20193 int64_t CVal64 =
C->getSExtValue();
20194 int CVal = (int) CVal64;
20197 if (CVal != CVal64)
20200 switch (ConstraintLetter) {
20204 if (Subtarget->hasV6T2Ops() || (Subtarget->hasV8MBaselineOps()))
20205 if (CVal >= 0 && CVal <= 65535)
20209 if (Subtarget->isThumb1Only()) {
20212 if (CVal >= 0 && CVal <= 255)
20214 }
else if (Subtarget->isThumb2()) {
20228 if (Subtarget->isThumb1Only()) {
20233 if (CVal >= -255 && CVal <= -1)
20239 if (CVal >= -4095 && CVal <= 4095)
20245 if (Subtarget->isThumb1Only()) {
20252 }
else if (Subtarget->isThumb2()) {
20272 if (Subtarget->isThumb1Only()) {
20275 if (CVal >= -7 && CVal < 7)
20277 }
else if (Subtarget->isThumb2()) {
20297 if (Subtarget->isThumb1Only()) {
20300 if ((CVal >= 0 && CVal <= 1020) && ((CVal & 3) == 0))
20306 if ((CVal >= 0 && CVal <= 32) || ((CVal & (CVal - 1)) == 0))
20312 if (Subtarget->isThumb1Only()) {
20314 if (CVal >= 0 && CVal <= 31)
20320 if (Subtarget->isThumb1Only()) {
20323 if ((CVal >= -508 && CVal <= 508) && ((CVal & 3) == 0))
20332 if (Result.getNode()) {
20333 Ops.push_back(Result);
20343 "Unhandled Opcode in getDivRemLibcall");
20349 case MVT::i8: LC = isSigned ? RTLIB::SDIVREM_I8 : RTLIB::UDIVREM_I8;
break;
20350 case MVT::i16: LC = isSigned ? RTLIB::SDIVREM_I16 : RTLIB::UDIVREM_I16;
break;
20351 case MVT::i32: LC = isSigned ? RTLIB::SDIVREM_I32 : RTLIB::UDIVREM_I32;
break;
20352 case MVT::i64: LC = isSigned ? RTLIB::SDIVREM_I64 : RTLIB::UDIVREM_I64;
break;
20361 "Unhandled Opcode in getDivRemArgList");
20365 for (
unsigned i = 0, e =
N->getNumOperands(); i != e; ++i) {
20366 EVT ArgVT =
N->getOperand(i).getValueType();
20369 Entry.IsSExt = isSigned;
20370 Entry.IsZExt = !isSigned;
20371 Args.push_back(Entry);
20379 assert((Subtarget->isTargetAEABI() || Subtarget->isTargetAndroid() ||
20380 Subtarget->isTargetGNUAEABI() || Subtarget->isTargetMuslAEABI() ||
20381 Subtarget->isTargetFuchsia() || Subtarget->isTargetWindows()) &&
20382 "Register-based DivRem lowering only");
20383 unsigned Opcode =
Op->getOpcode();
20385 "Invalid opcode for Div/Rem lowering");
20387 EVT VT =
Op->getValueType(0);
20409 bool hasDivide = Subtarget->isThumb() ? Subtarget->hasDivideInThumbMode()
20410 : Subtarget->hasDivideInARMMode();
20411 if (hasDivide &&
Op->getValueType(0).isSimple() &&
20412 Op->getSimpleValueType(0) == MVT::i32) {
20414 const SDValue Dividend =
Op->getOperand(0);
20415 const SDValue Divisor =
Op->getOperand(1);
20416 SDValue Div = DAG.
getNode(DivOpcode, dl, VT, Dividend, Divisor);
20420 SDValue Values[2] = {Div, Rem};
20438 if (Subtarget->isTargetWindows())
20441 TargetLowering::CallLoweringInfo CLI(DAG);
20450 std::pair<SDValue, SDValue> CallInfo =
LowerCallTo(CLI);
20451 return CallInfo.first;
20457 EVT VT =
N->getValueType(0);
20463 Result[0], Result[1]);
20467 std::vector<Type*> RetTyParams;
20468 Type *RetTyElement;
20478 RetTyParams.push_back(RetTyElement);
20479 RetTyParams.push_back(RetTyElement);
20488 bool isSigned =
N->getOpcode() ==
ISD::SREM;
20494 if (Subtarget->isTargetWindows())
20505 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
20508 SDNode *ResNode = CallResult.first.getNode();
20515 assert(Subtarget->isTargetWindows() &&
"unsupported target platform");
20523 "no-stack-arg-probe")) {
20527 Chain =
SP.getValue(1);
20544 SDVTList NodeTys = DAG.
getVTList(MVT::Other, MVT::Glue);
20545 Chain = DAG.
getNode(ARMISD::WIN__CHKSTK,
DL, NodeTys, Chain, Glue);
20555 bool IsStrict =
Op->isStrictFPOpcode();
20556 SDValue SrcVal =
Op.getOperand(IsStrict ? 1 : 0);
20557 const unsigned DstSz =
Op.getValueType().getSizeInBits();
20559 assert(DstSz > SrcSz && DstSz <= 64 && SrcSz >= 16 &&
20560 "Unexpected type for custom-lowering FP_EXTEND");
20562 assert((!Subtarget->hasFP64() || !Subtarget->hasFPARMv8Base()) &&
20563 "With both FP DP and 16, any FP conversion is legal!");
20565 assert(!(DstSz == 32 && Subtarget->hasFP16()) &&
20566 "With FP16, 16 to 32 conversion is legal!");
20569 if (SrcSz == 32 && DstSz == 64 && Subtarget->hasFP64()) {
20574 Loc,
Op.getValueType(), SrcVal);
20589 for (
unsigned Sz = SrcSz; Sz <= 32 && Sz < DstSz; Sz *= 2) {
20590 bool Supported = (Sz == 16 ? Subtarget->hasFP16() : Subtarget->hasFP64());
20591 MVT SrcVT = (Sz == 16 ? MVT::f16 : MVT::f32);
20592 MVT DstVT = (Sz == 16 ? MVT::f32 : MVT::f64);
20596 {DstVT, MVT::Other}, {Chain, SrcVal});
20603 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
20604 "Unexpected type for custom-lowering FP_EXTEND");
20605 std::tie(SrcVal, Chain) =
makeLibCall(DAG, LC, DstVT, SrcVal, CallOptions,
20610 return IsStrict ? DAG.
getMergeValues({SrcVal, Chain}, Loc) : SrcVal;
20614 bool IsStrict =
Op->isStrictFPOpcode();
20616 SDValue SrcVal =
Op.getOperand(IsStrict ? 1 : 0);
20618 EVT DstVT =
Op.getValueType();
20619 const unsigned DstSz =
Op.getValueType().getSizeInBits();
20622 assert(DstSz < SrcSz && SrcSz <= 64 && DstSz >= 16 &&
20623 "Unexpected type for custom-lowering FP_ROUND");
20625 assert((!Subtarget->hasFP64() || !Subtarget->hasFPARMv8Base()) &&
20626 "With both FP DP and 16, any FP conversion is legal!");
20631 if (SrcSz == 32 && Subtarget->hasFP16())
20636 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
20637 "Unexpected type for custom-lowering FP_ROUND");
20641 std::tie(Result, Chain) =
makeLibCall(DAG, LC, DstVT, SrcVal, CallOptions,
20653 if (v == 0xffffffff)
20665 bool ForCodeSize)
const {
20666 if (!Subtarget->hasVFP3Base())
20668 if (VT == MVT::f16 && Subtarget->hasFullFP16())
20670 if (VT == MVT::f32 && Subtarget->hasFullFP16() &&
20673 if (VT == MVT::f32)
20675 if (VT == MVT::f64 && Subtarget->hasFP64())
20688 case Intrinsic::arm_neon_vld1:
20689 case Intrinsic::arm_neon_vld2:
20690 case Intrinsic::arm_neon_vld3:
20691 case Intrinsic::arm_neon_vld4:
20692 case Intrinsic::arm_neon_vld2lane:
20693 case Intrinsic::arm_neon_vld3lane:
20694 case Intrinsic::arm_neon_vld4lane:
20695 case Intrinsic::arm_neon_vld2dup:
20696 case Intrinsic::arm_neon_vld3dup:
20697 case Intrinsic::arm_neon_vld4dup: {
20700 auto &
DL =
I.getDataLayout();
20701 uint64_t NumElts =
DL.getTypeSizeInBits(
I.getType()) / 64;
20703 Info.ptrVal =
I.getArgOperand(0);
20705 Value *AlignArg =
I.getArgOperand(
I.arg_size() - 1);
20711 case Intrinsic::arm_neon_vld1x2:
20712 case Intrinsic::arm_neon_vld1x3:
20713 case Intrinsic::arm_neon_vld1x4: {
20716 auto &
DL =
I.getDataLayout();
20717 uint64_t NumElts =
DL.getTypeSizeInBits(
I.getType()) / 64;
20719 Info.ptrVal =
I.getArgOperand(
I.arg_size() - 1);
20721 Info.align =
I.getParamAlign(
I.arg_size() - 1).valueOrOne();
20726 case Intrinsic::arm_neon_vst1:
20727 case Intrinsic::arm_neon_vst2:
20728 case Intrinsic::arm_neon_vst3:
20729 case Intrinsic::arm_neon_vst4:
20730 case Intrinsic::arm_neon_vst2lane:
20731 case Intrinsic::arm_neon_vst3lane:
20732 case Intrinsic::arm_neon_vst4lane: {
20735 auto &
DL =
I.getDataLayout();
20736 unsigned NumElts = 0;
20737 for (
unsigned ArgI = 1, ArgE =
I.arg_size(); ArgI < ArgE; ++ArgI) {
20738 Type *ArgTy =
I.getArgOperand(ArgI)->getType();
20741 NumElts +=
DL.getTypeSizeInBits(ArgTy) / 64;
20744 Info.ptrVal =
I.getArgOperand(0);
20746 Value *AlignArg =
I.getArgOperand(
I.arg_size() - 1);
20752 case Intrinsic::arm_neon_vst1x2:
20753 case Intrinsic::arm_neon_vst1x3:
20754 case Intrinsic::arm_neon_vst1x4: {
20757 auto &
DL =
I.getDataLayout();
20758 unsigned NumElts = 0;
20759 for (
unsigned ArgI = 1, ArgE =
I.arg_size(); ArgI < ArgE; ++ArgI) {
20760 Type *ArgTy =
I.getArgOperand(ArgI)->getType();
20763 NumElts +=
DL.getTypeSizeInBits(ArgTy) / 64;
20766 Info.ptrVal =
I.getArgOperand(0);
20768 Info.align =
I.getParamAlign(0).valueOrOne();
20773 case Intrinsic::arm_mve_vld2q:
20774 case Intrinsic::arm_mve_vld4q: {
20778 unsigned Factor =
Intrinsic == Intrinsic::arm_mve_vld2q ? 2 : 4;
20780 Info.ptrVal =
I.getArgOperand(0);
20787 case Intrinsic::arm_mve_vst2q:
20788 case Intrinsic::arm_mve_vst4q: {
20791 Type *VecTy =
I.getArgOperand(1)->getType();
20792 unsigned Factor =
Intrinsic == Intrinsic::arm_mve_vst2q ? 2 : 4;
20794 Info.ptrVal =
I.getArgOperand(0);
20801 case Intrinsic::arm_mve_vldr_gather_base:
20802 case Intrinsic::arm_mve_vldr_gather_base_predicated: {
20804 Info.ptrVal =
nullptr;
20806 Info.align =
Align(1);
20810 case Intrinsic::arm_mve_vldr_gather_base_wb:
20811 case Intrinsic::arm_mve_vldr_gather_base_wb_predicated: {
20813 Info.ptrVal =
nullptr;
20814 Info.memVT =
MVT::getVT(
I.getType()->getContainedType(0));
20815 Info.align =
Align(1);
20819 case Intrinsic::arm_mve_vldr_gather_offset:
20820 case Intrinsic::arm_mve_vldr_gather_offset_predicated: {
20822 Info.ptrVal =
nullptr;
20827 Info.align =
Align(1);
20831 case Intrinsic::arm_mve_vstr_scatter_base:
20832 case Intrinsic::arm_mve_vstr_scatter_base_predicated: {
20834 Info.ptrVal =
nullptr;
20835 Info.memVT =
MVT::getVT(
I.getArgOperand(2)->getType());
20836 Info.align =
Align(1);
20840 case Intrinsic::arm_mve_vstr_scatter_base_wb:
20841 case Intrinsic::arm_mve_vstr_scatter_base_wb_predicated: {
20843 Info.ptrVal =
nullptr;
20844 Info.memVT =
MVT::getVT(
I.getArgOperand(2)->getType());
20845 Info.align =
Align(1);
20849 case Intrinsic::arm_mve_vstr_scatter_offset:
20850 case Intrinsic::arm_mve_vstr_scatter_offset_predicated: {
20852 Info.ptrVal =
nullptr;
20857 Info.align =
Align(1);
20861 case Intrinsic::arm_ldaex:
20862 case Intrinsic::arm_ldrex: {
20863 auto &
DL =
I.getDataLayout();
20864 Type *ValTy =
I.getParamElementType(0);
20867 Info.ptrVal =
I.getArgOperand(0);
20869 Info.align =
DL.getABITypeAlign(ValTy);
20873 case Intrinsic::arm_stlex:
20874 case Intrinsic::arm_strex: {
20875 auto &
DL =
I.getDataLayout();
20876 Type *ValTy =
I.getParamElementType(1);
20879 Info.ptrVal =
I.getArgOperand(1);
20881 Info.align =
DL.getABITypeAlign(ValTy);
20885 case Intrinsic::arm_stlexd:
20886 case Intrinsic::arm_strexd:
20888 Info.memVT = MVT::i64;
20889 Info.ptrVal =
I.getArgOperand(2);
20891 Info.align =
Align(8);
20895 case Intrinsic::arm_ldaexd:
20896 case Intrinsic::arm_ldrexd:
20898 Info.memVT = MVT::i64;
20899 Info.ptrVal =
I.getArgOperand(0);
20901 Info.align =
Align(8);
20916 assert(Ty->isIntegerTy());
20918 unsigned Bits = Ty->getPrimitiveSizeInBits();
20919 if (Bits == 0 || Bits > 32)
20925 unsigned Index)
const {
20935 if (!Subtarget->hasDataBarrier()) {
20939 if (Subtarget->hasV6Ops() && !Subtarget->isThumb()) {
20940 Value*
args[6] = {Builder.getInt32(15), Builder.getInt32(0),
20941 Builder.getInt32(0), Builder.getInt32(7),
20942 Builder.getInt32(10), Builder.getInt32(5)};
20943 return Builder.CreateIntrinsic(Intrinsic::arm_mcr,
args);
20953 return Builder.CreateIntrinsic(Intrinsic::arm_dmb, CDomain);
20974 if (Subtarget->preferISHSTBarriers())
21007 bool has64BitAtomicStore;
21008 if (Subtarget->isMClass())
21009 has64BitAtomicStore =
false;
21010 else if (Subtarget->isThumb())
21011 has64BitAtomicStore = Subtarget->hasV7Ops();
21013 has64BitAtomicStore = Subtarget->hasV6Ops();
21015 unsigned Size =
SI->getValueOperand()->getType()->getPrimitiveSizeInBits();
21029 bool has64BitAtomicLoad;
21030 if (Subtarget->isMClass())
21031 has64BitAtomicLoad =
false;
21032 else if (Subtarget->isThumb())
21033 has64BitAtomicLoad = Subtarget->hasV7Ops();
21035 has64BitAtomicLoad = Subtarget->hasV6Ops();
21051 if (Subtarget->isMClass())
21052 hasAtomicRMW = Subtarget->hasV8MBaselineOps();
21053 else if (Subtarget->isThumb())
21054 hasAtomicRMW = Subtarget->hasV7Ops();
21056 hasAtomicRMW = Subtarget->hasV6Ops();
21057 if (
Size <= (Subtarget->isMClass() ? 32U : 64U) && hasAtomicRMW) {
21080 bool HasAtomicCmpXchg;
21081 if (Subtarget->isMClass())
21082 HasAtomicCmpXchg = Subtarget->hasV8MBaselineOps();
21083 else if (Subtarget->isThumb())
21084 HasAtomicCmpXchg = Subtarget->hasV7Ops();
21086 HasAtomicCmpXchg = Subtarget->hasV6Ops();
21088 HasAtomicCmpXchg &&
Size <= (Subtarget->isMClass() ? 32U : 64U))
21095 return InsertFencesForAtomic;
21100 return !Subtarget->isROPI() && !Subtarget->isRWPI();
21105 RTLIB::LibcallImpl SecurityCheckCookieLibcall =
21108 RTLIB::LibcallImpl SecurityCookieVar =
21110 if (SecurityCheckCookieLibcall != RTLIB::Unsupported &&
21111 SecurityCookieVar != RTLIB::Unsupported) {
21122 F->addParamAttr(0, Attribute::AttrKind::InReg);
21129 unsigned &
Cost)
const {
21131 if (!Subtarget->hasNEON())
21160 unsigned Opcode =
Op.getOpcode();
21162 case ARMISD::VORRIMM:
21163 case ARMISD::VBICIMM:
21171 return Subtarget->hasV5TOps() && !Subtarget->isThumb1Only();
21175 return Subtarget->hasV5TOps() && !Subtarget->isThumb1Only();
21180 if (!Subtarget->hasV7Ops())
21186 if (!Mask || Mask->getValue().getBitWidth() > 32u)
21188 auto MaskVal =
unsigned(Mask->getValue().getZExtValue());
21196 if (Subtarget->hasMinSize() && !Subtarget->isTargetWindows())
21205 Module *M = Builder.GetInsertBlock()->getParent()->getParent();
21211 if (ValueTy->getPrimitiveSizeInBits() == 64) {
21213 IsAcquire ? Intrinsic::arm_ldaexd : Intrinsic::arm_ldrexd;
21216 Builder.CreateIntrinsic(
Int, Addr,
nullptr,
"lohi");
21218 Value *
Lo = Builder.CreateExtractValue(LoHi, 0,
"lo");
21219 Value *
Hi = Builder.CreateExtractValue(LoHi, 1,
"hi");
21220 if (!Subtarget->isLittle())
21222 Lo = Builder.CreateZExt(
Lo, ValueTy,
"lo64");
21223 Hi = Builder.CreateZExt(
Hi, ValueTy,
"hi64");
21224 return Builder.CreateOr(
21225 Lo, Builder.CreateShl(
Hi, ConstantInt::get(ValueTy, 32)),
"val64");
21229 Intrinsic::ID Int = IsAcquire ? Intrinsic::arm_ldaex : Intrinsic::arm_ldrex;
21230 CallInst *CI = Builder.CreateIntrinsic(
Int, Tys, Addr);
21233 0,
Attribute::get(M->getContext(), Attribute::ElementType, ValueTy));
21234 return Builder.CreateTruncOrBitCast(CI, ValueTy);
21239 if (!Subtarget->hasV7Ops())
21241 Builder.CreateIntrinsic(Intrinsic::arm_clrex, {});
21247 Module *M = Builder.GetInsertBlock()->getParent()->getParent();
21255 IsRelease ? Intrinsic::arm_stlexd : Intrinsic::arm_strexd;
21259 Value *
Hi = Builder.CreateTrunc(Builder.CreateLShr(Val, 32),
Int32Ty,
"hi");
21260 if (!Subtarget->isLittle())
21262 return Builder.CreateIntrinsic(
Int, {
Lo,
Hi, Addr});
21265 Intrinsic::ID Int = IsRelease ? Intrinsic::arm_stlex : Intrinsic::arm_strex;
21269 CallInst *CI = Builder.CreateCall(
21270 Strex, {Builder.CreateZExtOrBitCast(
21280 return Subtarget->isMClass();
21288 return (
DL.getTypeSizeInBits(VecTy) + 127) / 128;
21295 unsigned VecSize =
DL.getTypeSizeInBits(VecTy);
21298 if (!Subtarget->hasNEON() && !Subtarget->hasMVEIntegerOps())
21306 if (Subtarget->hasMVEIntegerOps() && Factor == 3)
21314 if (ElSize != 8 && ElSize != 16 && ElSize != 32)
21317 if (Subtarget->hasMVEIntegerOps() && Alignment < ElSize / 8)
21322 if (Subtarget->hasNEON() && VecSize == 64)
21324 return VecSize % 128 == 0;
21328 if (Subtarget->hasNEON())
21330 if (Subtarget->hasMVEIntegerOps())
21350 "Invalid interleave factor");
21351 assert(!Shuffles.
empty() &&
"Empty shufflevector input");
21353 "Unmatched number of shufflevectors and indices");
21358 assert(!Mask && GapMask.
popcount() == Factor &&
"Unexpected mask on a load");
21361 Type *EltTy = VecTy->getElementType();
21364 Align Alignment = LI->getAlign();
21382 Value *BaseAddr = LI->getPointerOperand();
21384 if (NumLoads > 1) {
21388 VecTy->getNumElements() / NumLoads);
21394 if (Subtarget->hasNEON()) {
21395 Type *PtrTy = Builder.getPtrTy(LI->getPointerAddressSpace());
21396 Type *Tys[] = {VecTy, PtrTy};
21397 static const Intrinsic::ID LoadInts[3] = {Intrinsic::arm_neon_vld2,
21398 Intrinsic::arm_neon_vld3,
21399 Intrinsic::arm_neon_vld4};
21402 Ops.push_back(BaseAddr);
21403 Ops.push_back(Builder.getInt32(LI->getAlign().value()));
21405 return Builder.CreateIntrinsic(LoadInts[Factor - 2], Tys,
Ops,
21408 assert((Factor == 2 || Factor == 4) &&
21409 "expected interleave factor of 2 or 4 for MVE");
21411 Factor == 2 ? Intrinsic::arm_mve_vld2q : Intrinsic::arm_mve_vld4q;
21412 Type *PtrTy = Builder.getPtrTy(LI->getPointerAddressSpace());
21413 Type *Tys[] = {VecTy, PtrTy};
21416 Ops.push_back(BaseAddr);
21417 return Builder.CreateIntrinsic(LoadInts, Tys,
Ops,
nullptr,
21427 for (
unsigned LoadCount = 0; LoadCount < NumLoads; ++LoadCount) {
21431 BaseAddr = Builder.CreateConstGEP1_32(VecTy->getElementType(), BaseAddr,
21432 VecTy->getNumElements() * Factor);
21438 for (
unsigned i = 0; i < Shuffles.
size(); i++) {
21440 unsigned Index = Indices[i];
21442 Value *SubVec = Builder.CreateExtractValue(VldN, Index);
21446 SubVec = Builder.CreateIntToPtr(
21450 SubVecs[SV].push_back(SubVec);
21459 auto &SubVec = SubVecs[SVI];
21462 SVI->replaceAllUsesWith(WideVec);
21498 const APInt &GapMask)
const {
21500 "Invalid interleave factor");
21505 "Unexpected mask on store");
21508 assert(VecTy->getNumElements() % Factor == 0 &&
"Invalid interleaved store");
21510 unsigned LaneLen = VecTy->getNumElements() / Factor;
21511 Type *EltTy = VecTy->getElementType();
21515 Align Alignment =
SI->getAlign();
21532 Type *IntTy =
DL.getIntPtrType(EltTy);
21537 Op0 = Builder.CreatePtrToInt(Op0, IntVecTy);
21538 Op1 = Builder.CreatePtrToInt(Op1, IntVecTy);
21544 Value *BaseAddr =
SI->getPointerOperand();
21546 if (NumStores > 1) {
21549 LaneLen /= NumStores;
21559 if (Subtarget->hasNEON()) {
21560 static const Intrinsic::ID StoreInts[3] = {Intrinsic::arm_neon_vst2,
21561 Intrinsic::arm_neon_vst3,
21562 Intrinsic::arm_neon_vst4};
21563 Type *PtrTy = Builder.getPtrTy(
SI->getPointerAddressSpace());
21564 Type *Tys[] = {PtrTy, SubVecTy};
21567 Ops.push_back(BaseAddr);
21569 Ops.push_back(Builder.getInt32(
SI->getAlign().value()));
21570 Builder.CreateIntrinsic(StoreInts[Factor - 2], Tys,
Ops);
21572 assert((Factor == 2 || Factor == 4) &&
21573 "expected interleave factor of 2 or 4 for MVE");
21575 Factor == 2 ? Intrinsic::arm_mve_vst2q : Intrinsic::arm_mve_vst4q;
21576 Type *PtrTy = Builder.getPtrTy(
SI->getPointerAddressSpace());
21577 Type *Tys[] = {PtrTy, SubVecTy};
21580 Ops.push_back(BaseAddr);
21582 for (
unsigned F = 0;
F < Factor;
F++) {
21583 Ops.push_back(Builder.getInt32(
F));
21584 Builder.CreateIntrinsic(StoreInts, Tys,
Ops);
21590 for (
unsigned StoreCount = 0; StoreCount < NumStores; ++StoreCount) {
21593 if (StoreCount > 0)
21594 BaseAddr = Builder.CreateConstGEP1_32(SubVecTy->getElementType(),
21595 BaseAddr, LaneLen * Factor);
21600 for (
unsigned i = 0; i < Factor; i++) {
21601 unsigned IdxI = StoreCount * LaneLen * Factor + i;
21602 if (Mask[IdxI] >= 0) {
21603 Shuffles.
push_back(Builder.CreateShuffleVector(
21606 unsigned StartMask = 0;
21607 for (
unsigned j = 1; j < LaneLen; j++) {
21608 unsigned IdxJ = StoreCount * LaneLen * Factor + j;
21609 if (Mask[IdxJ * Factor + IdxI] >= 0) {
21610 StartMask = Mask[IdxJ * Factor + IdxI] - IdxJ;
21620 Shuffles.
push_back(Builder.CreateShuffleVector(
21641 for (
unsigned i = 0; i < ST->getNumElements(); ++i) {
21645 Members += SubMembers;
21651 Members += SubMembers * AT->getNumElements();
21652 }
else if (Ty->isFloatTy()) {
21657 }
else if (Ty->isDoubleTy()) {
21669 return VT->getPrimitiveSizeInBits().getFixedValue() == 64;
21671 return VT->getPrimitiveSizeInBits().getFixedValue() == 128;
21673 switch (VT->getPrimitiveSizeInBits().getFixedValue()) {
21686 return (Members > 0 && Members <= 4);
21692 const Align ABITypeAlign =
DL.getABITypeAlign(ArgTy);
21694 return ABITypeAlign;
21699 assert(StackAlign &&
"data layout string is missing stack alignment");
21700 return std::min(ABITypeAlign, *StackAlign);
21709 if (getEffectiveCallingConv(CallConv, isVarArg) !=
21718 bool IsIntArray = Ty->isArrayTy() && Ty->getArrayElementType()->isIntegerTy();
21719 return IsHA || IsIntArray;
21723 const Constant *PersonalityFn)
const {
21731 const Constant *PersonalityFn)
const {
21744void ARMTargetLowering::insertCopiesSplitCSR(
21748 const MCPhysReg *IStart =
TRI->getCalleeSavedRegsViaCopy(Entry->getParent());
21758 RC = &ARM::GPRRegClass;
21759 else if (ARM::DPRRegClass.
contains(*
I))
21760 RC = &ARM::DPRRegClass;
21770 assert(Entry->getParent()->getFunction().hasFnAttribute(
21771 Attribute::NoUnwind) &&
21772 "Function should be nounwind in insertCopiesSplitCSR!");
21773 Entry->addLiveIn(*
I);
21778 for (
auto *Exit : Exits)
21780 TII->get(TargetOpcode::COPY), *
I)
21791 return Subtarget->hasMVEIntegerOps();
21801 unsigned NumElements = VTy->getNumElements();
21808 if (ScalarTy->isHalfTy() || ScalarTy->isFloatTy())
21809 return Subtarget->hasMVEFloatOps();
21814 return Subtarget->hasMVEIntegerOps() &&
21815 (ScalarTy->isIntegerTy(8) || ScalarTy->isIntegerTy(16) ||
21816 ScalarTy->isIntegerTy(32));
21820 static const MCPhysReg RCRegs[] = {ARM::FPSCR_RM};
21831 unsigned TyWidth = Ty->getScalarSizeInBits() * Ty->getNumElements();
21833 assert(TyWidth >= 128 &&
"Width of vector type must be at least 128 bits");
21835 if (TyWidth > 128) {
21836 int Stride = Ty->getNumElements() / 2;
21840 ArrayRef<int> UpperSplitMask(&SplitSeqVec[Stride], Stride);
21842 auto *LowerSplitA =
B.CreateShuffleVector(InputA, LowerSplitMask);
21843 auto *LowerSplitB =
B.CreateShuffleVector(InputB, LowerSplitMask);
21844 auto *UpperSplitA =
B.CreateShuffleVector(InputA, UpperSplitMask);
21845 auto *UpperSplitB =
B.CreateShuffleVector(InputB, UpperSplitMask);
21846 Value *LowerSplitAcc =
nullptr;
21847 Value *UpperSplitAcc =
nullptr;
21850 LowerSplitAcc =
B.CreateShuffleVector(
Accumulator, LowerSplitMask);
21851 UpperSplitAcc =
B.CreateShuffleVector(
Accumulator, UpperSplitMask);
21855 B, OperationType, Rotation, LowerSplitA, LowerSplitB, LowerSplitAcc);
21857 B, OperationType, Rotation, UpperSplitA, UpperSplitB, UpperSplitAcc);
21859 ArrayRef<int> JoinMask(&SplitSeqVec[0], Ty->getNumElements());
21860 return B.CreateShuffleVector(LowerSplitInt, UpperSplitInt, JoinMask);
21867 ConstRotation = ConstantInt::get(IntTy, (
int)Rotation);
21870 return B.CreateIntrinsic(Intrinsic::arm_mve_vcmlaq, Ty,
21872 return B.CreateIntrinsic(Intrinsic::arm_mve_vcmulq, Ty,
21873 {ConstRotation, InputB, InputA});
21878 auto *ConstHalving = ConstantInt::get(IntTy, 1);
21881 ConstRotation = ConstantInt::get(IntTy, 0);
21883 ConstRotation = ConstantInt::get(IntTy, 1);
21885 if (!ConstRotation)
21888 return B.CreateIntrinsic(Intrinsic::arm_mve_vcaddq, Ty,
21889 {ConstHalving, ConstRotation, InputA, InputB});
unsigned const MachineRegisterInfo * MRI
static bool isAddSubSExt(SDValue N, SelectionDAG &DAG)
static bool isVShiftRImm(SDValue Op, EVT VT, bool isNarrow, int64_t &Cnt)
isVShiftRImm - Check if this is a valid build_vector for the immediate operand of a vector shift righ...
static bool isExtendedBUILD_VECTOR(SDValue N, SelectionDAG &DAG, bool isSigned)
static bool isZeroExtended(SDValue N, SelectionDAG &DAG)
static const MCPhysReg GPRArgRegs[]
static SDValue GeneratePerfectShuffle(unsigned ID, SDValue V1, SDValue V2, unsigned PFEntry, SDValue LHS, SDValue RHS, SelectionDAG &DAG, const SDLoc &DL)
GeneratePerfectShuffle - Given an entry in the perfect-shuffle table, emit the specified operations t...
constexpr MVT FlagsVT
Value type used for NZCV flags.
static bool isNegatedInteger(SDValue Op)
static bool getVShiftImm(SDValue Op, unsigned ElementBits, int64_t &Cnt)
getVShiftImm - Check if this is a valid build_vector for the immediate operand of a vector shift oper...
static SDValue LowerPREFETCH(SDValue Op, SelectionDAG &DAG)
static bool isSignExtended(SDValue N, SelectionDAG &DAG)
static bool isAddSubZExt(SDValue N, SelectionDAG &DAG)
static bool isVShiftLImm(SDValue Op, EVT VT, bool isLong, int64_t &Cnt)
isVShiftLImm - Check if this is a valid build_vector for the immediate operand of a vector shift left...
static bool canGuaranteeTCO(CallingConv::ID CC, bool GuaranteeTailCalls)
Return true if the calling convention is one that we can guarantee TCO for.
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
amdgpu aa AMDGPU Address space based Alias Analysis Wrapper
static bool isConstant(const MachineInstr &MI)
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements a class to represent arbitrary precision integral constant values and operations...
static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG)
static bool isStore(int Opcode)
static bool isThumb(const MCSubtargetInfo &STI)
static SDValue LowerUADDSUBO_CARRY(SDValue Op, SelectionDAG &DAG)
static SDValue PerformExtractEltToVMOVRRD(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static bool isIncompatibleReg(const MCPhysReg &PR, MVT VT)
static SDValue PerformVQDMULHCombine(SDNode *N, SelectionDAG &DAG)
static SDValue LowerBUILD_VECTOR_i1(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue LowerShift(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue AddRequiredExtensionForVMULL(SDValue N, SelectionDAG &DAG, const EVT &OrigTy, const EVT &ExtTy, unsigned ExtOpcode)
AddRequiredExtensionForVMULL - Add a sign/zero extension to extend the total value size to 64 bits.
static cl::opt< unsigned > ConstpoolPromotionMaxSize("arm-promote-constant-max-size", cl::Hidden, cl::desc("Maximum size of constant to promote into a constant pool"), cl::init(64))
static bool isZeroOrAllOnes(SDValue N, bool AllOnes)
static SDValue LowerINSERT_VECTOR_ELT_i1(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static bool isVTBLMask(ArrayRef< int > M, EVT VT)
static SDValue PerformSUBCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformSUBCombine - Target-specific dag combine xforms for ISD::SUB.
static cl::opt< bool > EnableConstpoolPromotion("arm-promote-constant", cl::Hidden, cl::desc("Enable / disable promotion of unnamed_addr constants into " "constant pools"), cl::init(false))
static SDValue PerformFAddVSelectCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue PerformExtractFpToIntStores(StoreSDNode *St, SelectionDAG &DAG)
static SDValue PerformVDUPCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
PerformVDUPCombine - Target-specific dag combine xforms for ARMISD::VDUP.
static SDValue PerformExtractEltCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *ST)
static const APInt * isPowerOf2Constant(SDValue V)
static SDValue PerformVCVTCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
PerformVCVTCombine - VCVT (floating-point to fixed-point, Advanced SIMD) can replace combinations of ...
static SDValue PerformVMOVhrCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static SDValue LowerVectorFP_TO_INT(SDValue Op, SelectionDAG &DAG)
static SDValue LowerVECTOR_SHUFFLEUsingOneOff(SDValue Op, ArrayRef< int > ShuffleMask, SelectionDAG &DAG)
static bool isValidMVECond(unsigned CC, bool IsFloat)
static SDValue PerformPREDICATE_CASTCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static ARMCC::CondCodes IntCCToARMCC(ISD::CondCode CC)
IntCCToARMCC - Convert a DAG integer condition code to an ARM CC.
static SDValue PerformSTORECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformSTORECombine - Target-specific dag combine xforms for ISD::STORE.
static SDValue ConvertBooleanCarryToCarryFlag(SDValue BoolCarry, SelectionDAG &DAG)
static SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static bool isGTorGE(ISD::CondCode CC)
static bool CombineVLDDUP(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
CombineVLDDUP - For a VDUPLANE node N, check if its source operand is a vldN-lane (N > 1) intrinsic,...
static SDValue ParseBFI(SDNode *N, APInt &ToMask, APInt &FromMask)
static bool isReverseMask(ArrayRef< int > M, EVT VT)
static bool isVZIP_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isVZIP_v_undef_Mask - Special case of isVZIPMask for canonical form of "vector_shuffle v,...
static SDValue PerformSELECTCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue AddCombineTo64bitUMAAL(SDNode *AddeNode, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue PerformVECTOR_REG_CASTCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue PerformVMulVCTPCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
PerformVMulVCTPCombine - VCVT (fixed-point to floating-point, Advanced SIMD) can replace combinations...
static SDValue createGPRPairNode2xi32(SelectionDAG &DAG, SDValue V0, SDValue V1)
static SDValue bitcastf32Toi32(SDValue Op, SelectionDAG &DAG)
static bool findPointerConstIncrement(SDNode *N, SDValue *Ptr, SDValue *CInc)
static bool isVTRNMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
static SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static bool CanInvertMVEVCMP(SDValue N)
static SDValue PerformLongShiftCombine(SDNode *N, SelectionDAG &DAG)
static SDValue AddCombineToVPADD(SDNode *N, SDValue N0, SDValue N1, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue PerformShiftCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *ST)
PerformShiftCombine - Checks for immediate versions of vector shifts and lowers them.
static void FPCCToARMCC(ISD::CondCode CC, ARMCC::CondCodes &CondCode, ARMCC::CondCodes &CondCode2)
FPCCToARMCC - Convert a DAG fp condition code to an ARM CC.
static void ExpandREAD_REGISTER(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
static EVT getVectorTyFromPredicateVector(EVT VT)
static SDValue PerformFADDVCMLACombine(SDNode *N, SelectionDAG &DAG)
static SDValue handleCMSEValue(const SDValue &Value, const ISD::InputArg &Arg, SelectionDAG &DAG, const SDLoc &DL)
static SDValue PerformARMBUILD_VECTORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
Target-specific dag combine xforms for ARMISD::BUILD_VECTOR.
static bool isSRL16(const SDValue &Op)
static SDValue PerformVMOVrhCombine(SDNode *N, SelectionDAG &DAG)
static SDValue PerformLOADCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue IsCMPZCSINC(SDNode *Cmp, ARMCC::CondCodes &CC)
static unsigned getPointerConstIncrement(unsigned Opcode, SDValue Ptr, SDValue Inc, const SelectionDAG &DAG)
static SDValue combineSelectAndUseCommutative(SDNode *N, bool AllOnes, TargetLowering::DAGCombinerInfo &DCI)
static SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static Register genTPEntry(MachineBasicBlock *TpEntry, MachineBasicBlock *TpLoopBody, MachineBasicBlock *TpExit, Register OpSizeReg, const TargetInstrInfo *TII, DebugLoc Dl, MachineRegisterInfo &MRI)
Adds logic in loop entry MBB to calculate loop iteration count and adds t2WhileLoopSetup and t2WhileL...
static SDValue createGPRPairNodei64(SelectionDAG &DAG, SDValue V)
static bool isLTorLE(ISD::CondCode CC)
static SDValue PerformVCMPCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue PerformMVEVMULLCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue LowerSDIV_v4i16(SDValue N0, SDValue N1, const SDLoc &dl, SelectionDAG &DAG)
static SDValue performNegCMovCombine(SDNode *N, SelectionDAG &DAG)
static EVT getExtensionTo64Bits(const EVT &OrigVT)
static SDValue PerformBITCASTCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *ST)
static SDValue AddCombineTo64bitMLAL(SDNode *AddeSubeNode, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue LowerWRITE_REGISTER(SDValue Op, SelectionDAG &DAG)
static bool checkAndUpdateCPSRKill(MachineBasicBlock::iterator SelectItr, MachineBasicBlock *BB, const TargetRegisterInfo *TRI)
static SDValue PerformCMPZCombine(SDNode *N, SelectionDAG &DAG)
static bool hasNormalLoadOperand(SDNode *N)
hasNormalLoadOperand - Check if any of the operands of a BUILD_VECTOR node are normal,...
static SDValue PerformInsertEltCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
PerformInsertEltCombine - Target-specific dag combine xforms for ISD::INSERT_VECTOR_ELT.
static SDValue PerformVDUPLANECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformVDUPLANECombine - Target-specific dag combine xforms for ARMISD::VDUPLANE.
static SDValue LowerBuildVectorOfFPTrunc(SDValue BV, SelectionDAG &DAG, const ARMSubtarget *ST)
static cl::opt< unsigned > ConstpoolPromotionMaxTotal("arm-promote-constant-max-total", cl::Hidden, cl::desc("Maximum size of ALL constants to promote into a constant pool"), cl::init(128))
static SDValue LowerTruncatei1(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
static RTLIB::Libcall getDivRemLibcall(const SDNode *N, MVT::SimpleValueType SVT)
static SDValue SkipLoadExtensionForVMULL(LoadSDNode *LD, SelectionDAG &DAG)
SkipLoadExtensionForVMULL - return a load of the original vector size that does not do any sign/zero ...
static SDValue AddCombineVUZPToVPADDL(SDNode *N, SDValue N0, SDValue N1, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue PerformADDCombineWithOperands(SDNode *N, SDValue N0, SDValue N1, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformADDCombineWithOperands - Try DAG combinations for an ADD with operands N0 and N1.
static SDValue PromoteMVEPredVector(SDLoc dl, SDValue Pred, EVT VT, SelectionDAG &DAG)
static bool isVZIPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
static SDValue PerformORCombineToSMULWBT(SDNode *OR, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static bool isVTRN_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isVTRN_v_undef_Mask - Special case of isVTRNMask for canonical form of "vector_shuffle v,...
static SDValue LowerUDIV(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue FindBFIToCombineWith(SDNode *N)
static SDValue LowerADDSUBSAT(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue ConvertCarryFlagToBooleanCarry(SDValue Flags, EVT VT, SelectionDAG &DAG)
static void checkVSELConstraints(ISD::CondCode CC, ARMCC::CondCodes &CondCode, bool &swpCmpOps, bool &swpVselOps)
static void ReplaceLongIntrinsic(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
static bool isS16(const SDValue &Op, SelectionDAG &DAG)
static bool isSRA16(const SDValue &Op)
static SDValue AddCombineBUILD_VECTORToVPADDL(SDNode *N, SDValue N0, SDValue N1, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue LowerVECTOR_SHUFFLEUsingMovs(SDValue Op, ArrayRef< int > ShuffleMask, SelectionDAG &DAG)
static SDValue LowerInterruptReturn(SmallVectorImpl< SDValue > &RetOps, const SDLoc &DL, SelectionDAG &DAG)
static SDValue LowerEXTRACT_VECTOR_ELT_i1(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue LowerSDIV_v4i8(SDValue X, SDValue Y, const SDLoc &dl, SelectionDAG &DAG)
static void expandf64Toi32(SDValue Op, SelectionDAG &DAG, SDValue &RetVal1, SDValue &RetVal2)
static SDValue LowerCONCAT_VECTORS_i1(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue LowerCTTZ(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue PerformVLDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static bool isSHL16(const SDValue &Op)
static bool isVEXTMask(ArrayRef< int > M, EVT VT, bool &ReverseVEXT, unsigned &Imm)
static SDValue PerformMVEVLDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
cl::opt< unsigned > ArmMaxBaseUpdatesToCheck("arm-max-base-updates-to-check", cl::Hidden, cl::desc("Maximum number of base-updates to check generating postindex."), cl::init(64))
static bool isTruncMask(ArrayRef< int > M, EVT VT, bool Top, bool SingleSource)
static SDValue PerformADDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformADDCombine - Target-specific dag combine xforms for ISD::ADD.
static unsigned getLdOpcode(unsigned LdSize, bool IsThumb1, bool IsThumb2)
Return the load opcode for a given load size.
static bool isLegalT2AddressImmediate(int64_t V, EVT VT, const ARMSubtarget *Subtarget)
static bool isLegalMVEShuffleOp(unsigned PFEntry)
static SDValue PerformSignExtendInregCombine(SDNode *N, SelectionDAG &DAG)
static SDValue PerformShuffleVMOVNCombine(ShuffleVectorSDNode *N, SelectionDAG &DAG)
static bool isVUZPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
static SDValue PerformVECTOR_SHUFFLECombine(SDNode *N, SelectionDAG &DAG)
PerformVECTOR_SHUFFLECombine - Target-specific dag combine xforms for ISD::VECTOR_SHUFFLE.
static SDValue SkipExtensionForVMULL(SDNode *N, SelectionDAG &DAG)
SkipExtensionForVMULL - For a node that is a SIGN_EXTEND, ZERO_EXTEND, ANY_EXTEND,...
static bool isVMOVNTruncMask(ArrayRef< int > M, EVT ToVT, bool rev)
static SDValue PerformVQMOVNCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static MachineBasicBlock * OtherSucc(MachineBasicBlock *MBB, MachineBasicBlock *Succ)
static SDValue LowerVecReduceMinMax(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue PerformFPExtendCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue PerformAddcSubcCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue PerformVSELECTCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static TargetLowering::ArgListTy getDivRemArgList(const SDNode *N, LLVMContext *Context, const ARMSubtarget *Subtarget)
static SDValue PerformVECREDUCE_ADDCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue getZeroVector(EVT VT, SelectionDAG &DAG, const SDLoc &dl)
getZeroVector - Returns a vector of specified type with all zero elements.
static SDValue LowerAtomicLoadStore(SDValue Op, SelectionDAG &DAG)
static SDValue PerformSplittingToNarrowingStores(StoreSDNode *St, SelectionDAG &DAG)
static bool getT2IndexedAddressParts(SDNode *Ptr, EVT VT, bool isSEXTLoad, SDValue &Base, SDValue &Offset, bool &isInc, SelectionDAG &DAG)
static ARMCC::CondCodes getVCMPCondCode(SDValue N)
static cl::opt< bool > ARMInterworking("arm-interworking", cl::Hidden, cl::desc("Enable / disable ARM interworking (for debugging only)"), cl::init(true))
static void ReplaceREADCYCLECOUNTER(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue PerformORCombineToBFI(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static bool isConditionalZeroOrAllOnes(SDNode *N, bool AllOnes, SDValue &CC, bool &Invert, SDValue &OtherOp, SelectionDAG &DAG)
static SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue PerformVSetCCToVCTPCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue LowerBUILD_VECTORToVIDUP(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static bool isZeroVector(SDValue N)
static SDValue PerformAddeSubeCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static void ReplaceCMP_SWAP_64Results(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
static bool isLowerSaturate(const SDValue LHS, const SDValue RHS, const SDValue TrueVal, const SDValue FalseVal, const ISD::CondCode CC, const SDValue K)
static SDValue LowerPredicateLoad(SDValue Op, SelectionDAG &DAG)
static void emitPostSt(MachineBasicBlock *BB, MachineBasicBlock::iterator Pos, const TargetInstrInfo *TII, const DebugLoc &dl, unsigned StSize, unsigned Data, unsigned AddrIn, unsigned AddrOut, bool IsThumb1, bool IsThumb2)
Emit a post-increment store operation with given size.
static bool isVMOVNMask(ArrayRef< int > M, EVT VT, bool Top, bool SingleSource)
static SDValue CombineBaseUpdate(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
CombineBaseUpdate - Target-specific DAG combine function for VLDDUP, NEON load/store intrinsics,...
static SDValue LowerSaturatingConditional(SDValue Op, SelectionDAG &DAG)
static SDValue PerformSubCSINCCombine(SDNode *N, SelectionDAG &DAG)
static SDValue PerformVMOVRRDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformVMOVRRDCombine - Target-specific dag combine xforms for ARMISD::VMOVRRD.
static SDValue LowerFP_TO_INT_SAT(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue PerformCSETCombine(SDNode *N, SelectionDAG &DAG)
static SDValue PerformVMOVNCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static SDValue PerformInsertSubvectorCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static SDValue LowerVectorExtend(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue WinDBZCheckDenominator(SelectionDAG &DAG, SDNode *N, SDValue InChain)
static SDValue LowerVECTOR_SHUFFLEv8i8(SDValue Op, ArrayRef< int > ShuffleMask, SelectionDAG &DAG)
static SDValue PerformVMULCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformVMULCombine Distribute (A + B) * C to (A * C) + (B * C) to take advantage of the special multi...
static SDValue LowerMUL(SDValue Op, SelectionDAG &DAG)
static SDValue PerformBFICombine(SDNode *N, SelectionDAG &DAG)
static SDValue PerformORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformORCombine - Target-specific dag combine xforms for ISD::OR.
static SDValue LowerMLOAD(SDValue Op, SelectionDAG &DAG)
static SDValue PerformTruncatingStoreCombine(StoreSDNode *St, SelectionDAG &DAG)
static unsigned SelectPairHalf(unsigned Elements, ArrayRef< int > Mask, unsigned Index)
static void emitPostLd(MachineBasicBlock *BB, MachineBasicBlock::iterator Pos, const TargetInstrInfo *TII, const DebugLoc &dl, unsigned LdSize, unsigned Data, unsigned AddrIn, unsigned AddrOut, bool IsThumb1, bool IsThumb2)
Emit a post-increment load operation with given size.
static SDValue TryDistrubutionADDVecReduce(SDNode *N, SelectionDAG &DAG)
static bool isValidBaseUpdate(SDNode *N, SDNode *User)
static SDValue IsSingleInstrConstant(SDValue N, SelectionDAG &DAG, const ARMSubtarget *ST, const SDLoc &dl)
static bool IsQRMVEInstruction(const SDNode *N, const SDNode *Op)
static SDValue PerformMinMaxToSatCombine(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue PerformXORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static bool getMVEIndexedAddressParts(SDNode *Ptr, EVT VT, Align Alignment, bool isSEXTLoad, bool IsMasked, bool isLE, SDValue &Base, SDValue &Offset, bool &isInc, SelectionDAG &DAG)
std::pair< unsigned, const TargetRegisterClass * > RCPair
static SDValue combineSelectAndUse(SDNode *N, SDValue Slct, SDValue OtherOp, TargetLowering::DAGCombinerInfo &DCI, bool AllOnes=false)
static SDValue PerformExtendCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
PerformExtendCombine - Target-specific DAG combining for ISD::SIGN_EXTEND, ISD::ZERO_EXTEND,...
static SDValue LowerSDIV(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
cl::opt< unsigned > MVEMaxSupportedInterleaveFactor("mve-max-interleave-factor", cl::Hidden, cl::desc("Maximum interleave factor for MVE VLDn to generate."), cl::init(2))
static SDValue isVMOVModifiedImm(uint64_t SplatBits, uint64_t SplatUndef, unsigned SplatBitSize, SelectionDAG &DAG, const SDLoc &dl, EVT &VT, EVT VectorVT, VMOVModImmType type)
isVMOVModifiedImm - Check if the specified splat value corresponds to a valid vector constant for a N...
static SDValue LowerBuildVectorOfFPExt(SDValue BV, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue CombineVMOVDRRCandidateWithVecOp(const SDNode *BC, SelectionDAG &DAG)
BC is a bitcast that is about to be turned into a VMOVDRR.
static SDValue promoteToConstantPool(const ARMTargetLowering *TLI, const GlobalValue *GV, SelectionDAG &DAG, EVT PtrVT, const SDLoc &dl)
static unsigned isNEONTwoResultShuffleMask(ArrayRef< int > ShuffleMask, EVT VT, unsigned &WhichResult, bool &isV_UNDEF)
Check if ShuffleMask is a NEON two-result shuffle (VZIP, VUZP, VTRN), and return the corresponding AR...
static bool BitsProperlyConcatenate(const APInt &A, const APInt &B)
static bool getARMIndexedAddressParts(SDNode *Ptr, EVT VT, bool isSEXTLoad, SDValue &Base, SDValue &Offset, bool &isInc, SelectionDAG &DAG)
static SDValue LowerVecReduce(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue LowerVectorINT_TO_FP(SDValue Op, SelectionDAG &DAG)
static bool TryCombineBaseUpdate(struct BaseUpdateTarget &Target, struct BaseUpdateUser &User, bool SimpleConstIncOnly, TargetLowering::DAGCombinerInfo &DCI)
static bool allUsersAreInFunction(const Value *V, const Function *F)
Return true if all users of V are within function F, looking through ConstantExprs.
static bool isSingletonVEXTMask(ArrayRef< int > M, EVT VT, unsigned &Imm)
static SDValue PerformVMOVDRRCombine(SDNode *N, SelectionDAG &DAG)
PerformVMOVDRRCombine - Target-specific dag combine xforms for ARMISD::VMOVDRR.
static bool isLowerSaturatingConditional(const SDValue &Op, SDValue &V, SDValue &SatK)
static bool isLegalAddressImmediate(int64_t V, EVT VT, const ARMSubtarget *Subtarget)
isLegalAddressImmediate - Return true if the integer value can be used as the offset of the target ad...
static SDValue LowerVSETCC(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static bool isLegalT1AddressImmediate(int64_t V, EVT VT)
static SDValue CombineANDShift(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG)
static SDValue PerformSHLSimplify(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *ST)
static SDValue PerformADDECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformADDECombine - Target-specific dag combine transform from ARMISD::ADDC, ARMISD::ADDE,...
static SDValue PerformReduceShuffleCombine(SDNode *N, SelectionDAG &DAG)
static SDValue PerformUMLALCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue LowerTruncate(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue PerformHWLoopCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *ST)
static SDValue PerformSplittingMVETruncToNarrowingStores(StoreSDNode *St, SelectionDAG &DAG)
static bool isVUZP_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isVUZP_v_undef_Mask - Special case of isVUZPMask for canonical form of "vector_shuffle v,...
static bool isHomogeneousAggregate(Type *Ty, HABaseType &Base, uint64_t &Members)
static SDValue PerformMULCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue PerformFADDCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue LowerReverse_VECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG)
static SDValue PerformANDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue PerformADDVecReduce(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue LowerPredicateStore(SDValue Op, SelectionDAG &DAG)
static SDValue SearchLoopIntrinsic(SDValue N, ISD::CondCode &CC, int &Imm, bool &Negate)
static bool canChangeToInt(SDValue Op, bool &SeenZero, const ARMSubtarget *Subtarget)
canChangeToInt - Given the fp compare operand, return true if it is suitable to morph to an integer c...
static unsigned getStOpcode(unsigned StSize, bool IsThumb1, bool IsThumb2)
Return the store opcode for a given store size.
static bool IsVUZPShuffleNode(SDNode *N)
static SDValue Expand64BitShift(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue AddCombineTo64BitSMLAL16(SDNode *AddcNode, SDNode *AddeNode, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static void attachMEMCPYScratchRegs(const ARMSubtarget *Subtarget, MachineInstr &MI, const SDNode *Node)
Attaches vregs to MEMCPY that it will use as scratch registers when it is expanded into LDM/STM.
static bool isFloatingPointZero(SDValue Op)
isFloatingPointZero - Return true if this is +0.0.
static SDValue findMUL_LOHI(SDValue V)
static SDValue LowerVECTOR_SHUFFLE_i1(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue PerformORCombine_i1(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue PerformSplittingMVEEXTToWideningLoad(SDNode *N, SelectionDAG &DAG)
static SDValue PerformSplittingToWideningLoad(SDNode *N, SelectionDAG &DAG)
static void genTPLoopBody(MachineBasicBlock *TpLoopBody, MachineBasicBlock *TpEntry, MachineBasicBlock *TpExit, const TargetInstrInfo *TII, DebugLoc Dl, MachineRegisterInfo &MRI, Register OpSrcReg, Register OpDestReg, Register ElementCountReg, Register TotalIterationsReg, bool IsMemcpy)
Adds logic in the loopBody MBB to generate MVE_VCTP, t2DoLoopDec and t2DoLoopEnd.
static SDValue PerformBUILD_VECTORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformBUILD_VECTORCombine - Target-specific dag combine xforms for ISD::BUILD_VECTOR.
static SDValue LowerVecReduceF(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue PerformMinMaxCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
PerformMinMaxCombine - Target-specific DAG combining for creating truncating saturates.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
Function Alias Analysis false
Function Alias Analysis Results
Atomic ordering constants.
This file contains the simple types necessary to represent the attributes associated with functions a...
This file implements the BitVector class.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static std::optional< bool > isBigEndian(const SmallDenseMap< int64_t, int64_t, 8 > &MemOffset2Idx, int64_t LowestIdx)
Given a map from byte offsets in memory to indices in a load/store, determine if that map corresponds...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static void createLoadIntrinsic(IntrinsicInst *II, LoadInst *LI, dxil::ResourceTypeInfo &RTI)
static void createStoreIntrinsic(IntrinsicInst *II, StoreInst *SI, dxil::ResourceTypeInfo &RTI)
This file defines the DenseMap class.
const HexagonInstrInfo * TII
Module.h This file contains the declarations for the Module class.
std::pair< Value *, Value * > ShuffleOps
We are building a shuffle to create V, which is a sequence of insertelement, extractelement pairs.
static Value * LowerCTPOP(LLVMContext &Context, Value *V, Instruction *IP)
Emit the code to lower ctpop of V before the specified instruction IP.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first DebugLoc that has line number information, given a range of instructions.
Register const TargetRegisterInfo * TRI
Promote Memory to Register
uint64_t IntrinsicInst * II
PowerPC Reduce CR logical Operation
const SmallVectorImpl< MachineOperand > & Cond
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
static cl::opt< unsigned > MaxSteps("has-predecessor-max-steps", cl::Hidden, cl::init(8192), cl::desc("DAG combiner limit number of steps when searching DAG " "for predecessor nodes"))
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
static SymbolRef::Type getType(const Symbol *Sym)
This file describes how to lower LLVM code to machine code.
static X86::CondCode getSwappedCondition(X86::CondCode CC)
Assuming the flags are set by MI(a,b), return the condition code if we modify the instructions such t...
static constexpr int Concat[]
static bool isIntrinsic(const CallBase &Call, Intrinsic::ID ID)
static constexpr roundingMode rmTowardZero
LLVM_ABI bool getExactInverse(APFloat *Inv) const
If this value is normal and has an exact, normal, multiplicative inverse, store it in inv and return ...
APInt bitcastToAPInt() const
opStatus convertToInteger(MutableArrayRef< integerPart > Input, unsigned int Width, bool IsSigned, roundingMode RM, bool *IsExact) const
Class for arbitrary precision integers.
static APInt getAllOnes(unsigned numBits)
Return an APInt of a specified width with all bits set.
bool isMinSignedValue() const
Determine if this is the smallest signed value.
uint64_t getZExtValue() const
Get zero extended value.
unsigned popcount() const
Count the number of bits set.
LLVM_ABI APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
unsigned getActiveBits() const
Compute the number of active bits in the value.
LLVM_ABI APInt trunc(unsigned width) const
Truncate to new width.
void setBit(unsigned BitPosition)
Set the given bit to 1 whose position is given as "bitPosition".
bool sgt(const APInt &RHS) const
Signed greater than comparison.
bool isAllOnes() const
Determine if all bits are set. This is true for zero-width values.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool ult(const APInt &RHS) const
Unsigned less than comparison.
unsigned countr_zero() const
Count the number of trailing zero bits.
unsigned countl_zero() const
The APInt version of std::countl_zero.
static LLVM_ABI APInt getSplat(unsigned NewLen, const APInt &V)
Return a value containing V broadcasted over NewLen bits.
unsigned logBase2() const
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const
If this value is smaller than the specified limit, return it, otherwise return the limit value.
bool isSubsetOf(const APInt &RHS) const
This operation checks that all bits set in this APInt are also set in RHS.
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Constructs an APInt value that has the bottom loBitsSet bits set.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Constructs an APInt value that has the top hiBitsSet bits set.
static APInt getOneBitSet(unsigned numBits, unsigned BitNo)
Return an APInt with exactly one bit set in the result.
int64_t getSExtValue() const
Get sign extended value.
void lshrInPlace(unsigned ShiftAmt)
Logical right-shift this APInt by ShiftAmt in place.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
unsigned countr_one() const
Count the number of trailing one bits.
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
An arbitrary precision integer that knows its signedness.
const ARMBaseRegisterInfo & getRegisterInfo() const
const uint32_t * getSjLjDispatchPreservedMask(const MachineFunction &MF) const
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...
Register getFrameRegister(const MachineFunction &MF) const override
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
const uint32_t * getTLSCallPreservedMask(const MachineFunction &MF) const
const uint32_t * getThisReturnPreservedMask(const MachineFunction &MF, CallingConv::ID) const
getThisReturnPreservedMask - Returns a call preserved mask specific to the case that 'returned' is on...
static ARMConstantPoolConstant * Create(const Constant *C, unsigned ID)
static ARMConstantPoolMBB * Create(LLVMContext &C, const MachineBasicBlock *mbb, unsigned ID, unsigned char PCAdj)
static ARMConstantPoolSymbol * Create(LLVMContext &C, StringRef s, unsigned ID, unsigned char PCAdj)
ARMConstantPoolValue - ARM specific constantpool value.
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
int getVarArgsFrameIndex() const
int getPromotedConstpoolIncrease() const
SmallPtrSet< const GlobalVariable *, 2 > & getGlobalsPromotedToConstantPool()
void setArgumentStackToRestore(unsigned v)
bool branchTargetEnforcement() const
unsigned createPICLabelUId()
void setPromotedConstpoolIncrease(int Sz)
bool isThumb1OnlyFunction() const
void setArgRegsSaveSize(unsigned s)
bool isCmseNSEntryFunction() const
void setReturnRegsCount(unsigned s)
void setVarArgsFrameIndex(int Index)
unsigned getArgRegsSaveSize() const
void markGlobalAsPromotedToConstantPool(const GlobalVariable *GV)
Indicate to the backend that GV has had its storage changed to inside a constant pool.
void setIsSplitCSR(bool s)
void setArgumentStackSize(unsigned size)
unsigned getArgumentStackSize() const
const Triple & getTargetTriple() const
const ARMBaseInstrInfo * getInstrInfo() const override
bool isThumb1Only() const
bool isTargetWindows() const
const ARMTargetLowering * getTargetLowering() const override
const ARMBaseRegisterInfo * getRegisterInfo() const override
Align getDualLoadStoreAlignment() const
bool shouldFoldSelectWithIdentityConstant(unsigned BinOpcode, EVT VT, unsigned SelectOpcode, SDValue X, SDValue Y) const override
Return true if pulling a binary operation into a select with an identity constant is profitable.
bool isReadOnly(const GlobalValue *GV) const
unsigned getMaxSupportedInterleaveFactor() const override
Get the maximum supported factor for interleaved memory accesses.
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicLoadInIR(LoadInst *LI) const override
Returns how the given (atomic) load should be expanded by the IR-level AtomicExpand pass.
unsigned getNumInterleavedAccesses(VectorType *VecTy, const DataLayout &DL) const
Returns the number of interleaved accesses that will be generated when lowering accesses of the given...
bool shouldInsertFencesForAtomic(const Instruction *I) const override
Whether AtomicExpandPass should automatically insert fences and reduce ordering for this atomic.
Align getABIAlignmentForCallingConv(Type *ArgTy, const DataLayout &DL) const override
Return the correct alignment for the current calling convention.
bool isDesirableToCommuteWithShift(const SDNode *N, CombineLevel Level) const override
Return true if it is profitable to move this shift by a constant amount through its operand,...
Register getExceptionPointerRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const override
Examine constraint string and operand type and determine a weight value.
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I=nullptr) const override
isLegalAddressingMode - Return true if the addressing mode represented by AM is legal for this target...
const ARMSubtarget * getSubtarget() const
bool isLegalT2ScaledAddressingMode(const AddrMode &AM, EVT VT) const
bool isLegalT1ScaledAddressingMode(const AddrMode &AM, EVT VT) const
Returns true if the addressing mode representing by AM is legal for the Thumb1 target,...
bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, SDValue &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) const override
getPreIndexedAddressParts - returns true by value, base pointer and offset pointer and addressing mod...
bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallBase &I, MachineFunction &MF, unsigned Intrinsic) const override
getTgtMemIntrinsic - Represent NEON load and store intrinsics as MemIntrinsicNodes.
MachineInstr * EmitKCFICheck(MachineBasicBlock &MBB, MachineBasicBlock::instr_iterator &MBBI, const TargetInstrInfo *TII) const override
bool shouldAlignPointerArgs(CallInst *CI, unsigned &MinSize, Align &PrefAlign) const override
Return true if the pointer arguments to CI should be aligned by aligning the object whose address is ...
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
ReplaceNodeResults - Replace the results of node with an illegal result type with new values built ou...
void emitAtomicCmpXchgNoStoreLLBalance(IRBuilderBase &Builder) const override
bool isMulAddWithConstProfitable(SDValue AddNode, SDValue ConstNode) const override
Return true if it may be profitable to transform (mul (add x, c1), c2) -> (add (mul x,...
bool isLegalAddImmediate(int64_t Imm) const override
isLegalAddImmediate - Return true if the specified immediate is legal add immediate,...
EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op, const AttributeList &FuncAttributes) const override
Returns the target specific optimal type for load and store operations as a result of memset,...
Instruction * emitTrailingFence(IRBuilderBase &Builder, Instruction *Inst, AtomicOrdering Ord) const override
bool isFNegFree(EVT VT) const override
Return true if an fneg operation is free to the point where it is never worthwhile to replace it with...
void finalizeLowering(MachineFunction &MF) const override
Execute target specific actions to finalize target lowering.
SDValue PerformMVETruncCombine(SDNode *N, DAGCombinerInfo &DCI) const
bool isFPImmLegal(const APFloat &Imm, EVT VT, bool ForCodeSize=false) const override
isFPImmLegal - Returns true if the target can instruction select the specified FP immediate natively.
ConstraintType getConstraintType(StringRef Constraint) const override
getConstraintType - Given a constraint letter, return the type of constraint it is for this target.
bool preferIncOfAddToSubOfNot(EVT VT) const override
These two forms are equivalent: sub y, (xor x, -1) add (add x, 1), y The variant with two add's is IR...
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicStoreInIR(StoreInst *SI) const override
Returns how the given (atomic) store should be expanded by the IR-level AtomicExpand pass into.
void insertSSPDeclarations(Module &M) const override
Inserts necessary declarations for SSP (stack protection) purpose.
SDValue PerformIntrinsicCombine(SDNode *N, DAGCombinerInfo &DCI) const
PerformIntrinsicCombine - ARM-specific DAG combining for intrinsics.
bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override
Return true if it is profitable to fold a pair of shifts into a mask.
bool isDesirableToCommuteXorWithShift(const SDNode *N) const override
Return true if it is profitable to combine an XOR of a logical shift to create a logical shift of NOT...
SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG) const
PerformCMOVCombine - Target-specific DAG combining for ARMISD::CMOV.
Value * createComplexDeinterleavingIR(IRBuilderBase &B, ComplexDeinterleavingOperation OperationType, ComplexDeinterleavingRotation Rotation, Value *InputA, Value *InputB, Value *Accumulator=nullptr) const override
Create the IR node for the given complex deinterleaving operation.
bool isComplexDeinterleavingSupported() const override
Does this target support complex deinterleaving.
SDValue PerformMVEExtCombine(SDNode *N, DAGCombinerInfo &DCI) const
bool SimplifyDemandedBitsForTargetNode(SDValue Op, const APInt &OriginalDemandedBits, const APInt &OriginalDemandedElts, KnownBits &Known, TargetLoweringOpt &TLO, unsigned Depth) const override
Attempt to simplify any target nodes based on the demanded bits/elts, returning true on success.
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
getSetCCResultType - Return the value type to use for ISD::SETCC.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
Value * emitStoreConditional(IRBuilderBase &Builder, Value *Val, Value *Addr, AtomicOrdering Ord) const override
Perform a store-conditional operation to Addr.
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...
CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC, bool isVarArg) const
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo) const override
createFastISel - This method returns a target specific FastISel object, or null if the target does no...
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag.
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all.
bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT, unsigned Index) const override
Return true if EXTRACT_SUBVECTOR is cheap for this result type with this index.
bool isTruncateFree(Type *SrcTy, Type *DstTy) const override
Return true if it's free to truncate a value of type FromTy to type ToTy.
bool isShuffleMaskLegal(ArrayRef< int > M, EVT VT) const override
isShuffleMaskLegal - Targets can use this to indicate that they only support some VECTOR_SHUFFLE oper...
bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const override
Returns true if it is beneficial to convert a load of a constant to just the constant itself.
bool lowerInterleavedStore(Instruction *Store, Value *Mask, ShuffleVectorInst *SVI, unsigned Factor, const APInt &GapMask) const override
Lower an interleaved store into a vstN intrinsic.
bool canCreateUndefOrPoisonForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, bool PoisonOnly, bool ConsiderFlags, unsigned Depth) const override
Return true if Op can create undef or poison from non-undef & non-poison operands.
const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const override
getRegClassFor - Return the register class that should be used for the specified value type.
bool useLoadStackGuardNode(const Module &M) const override
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
bool lowerInterleavedLoad(Instruction *Load, Value *Mask, ArrayRef< ShuffleVectorInst * > Shuffles, ArrayRef< unsigned > Indices, unsigned Factor, const APInt &GapMask) const override
Lower an interleaved load into a vldN intrinsic.
std::pair< const TargetRegisterClass *, uint8_t > findRepresentativeClass(const TargetRegisterInfo *TRI, MVT VT) const override
Return the largest legal super-reg register class of the register class for the specified type and it...
bool preferSelectsOverBooleanArithmetic(EVT VT) const override
Should we prefer selects to doing arithmetic on boolean types.
bool isZExtFree(SDValue Val, EVT VT2) const override
Return true if zero-extending the specific node Val to type VT2 is free (either because it's implicit...
bool isCheapToSpeculateCttz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic cttz.
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...
bool isCheapToSpeculateCtlz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
bool targetShrinkDemandedConstant(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, TargetLoweringOpt &TLO) const override
ARMTargetLowering(const TargetMachine &TM, const ARMSubtarget &STI)
bool isComplexDeinterleavingOperationSupported(ComplexDeinterleavingOperation Operation, Type *Ty) const override
Does this target support complex deinterleaving with the given operation and type.
bool supportKCFIBundles() const override
Return true if the target supports kcfi operand bundles.
SDValue PerformBRCONDCombine(SDNode *N, SelectionDAG &DAG) const
PerformBRCONDCombine - Target-specific DAG combining for ARMISD::BRCOND.
Register getExceptionSelectorRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
Type * shouldConvertSplatType(ShuffleVectorInst *SVI) const override
Given a shuffle vector SVI representing a vector splat, return a new scalar type of size equal to SVI...
Value * emitLoadLinked(IRBuilderBase &Builder, Type *ValueTy, Value *Addr, AtomicOrdering Ord) const override
Perform a load-linked operation on Addr, returning a "Value *" with the corresponding pointee type.
Instruction * makeDMB(IRBuilderBase &Builder, ARM_MB::MemBOpt Domain) const
bool isLegalICmpImmediate(int64_t Imm) const override
isLegalICmpImmediate - Return true if the specified immediate is legal icmp immediate,...
const char * LowerXConstraint(EVT ConstraintVT) const override
Try to replace an X constraint, which matches anything, with another that has more specific requireme...
unsigned getJumpTableEncoding() const override
Return the entry encoding for a jump table in the current function.
bool isDesirableToTransformToIntegerOp(unsigned Opc, EVT VT) const override
Return true if it is profitable for dag combiner to transform a floating point op of specified opcode...
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override
Returns how the given atomic cmpxchg should be expanded by the IR-level AtomicExpand pass.
CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool isVarArg) const
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags Flags, unsigned *Fast) const override
allowsMisalignedMemoryAccesses - Returns true if the target allows unaligned memory accesses of the s...
bool isLegalInterleavedAccessType(unsigned Factor, FixedVectorType *VecTy, Align Alignment, const DataLayout &DL) const
Returns true if VecTy is a legal interleaved access type.
bool isVectorLoadExtDesirable(SDValue ExtVal) const override
Return true if folding a vector load into ExtVal (a sign, zero, or any extend node) is profitable.
bool canCombineStoreAndExtract(Type *VectorTy, Value *Idx, unsigned &Cost) const override
Return true if the target can combine store(extractelement VectorTy,Idx).
bool useSoftFloat() const override
bool alignLoopsWithOptSize() const override
Should loops be aligned even when the function is marked OptSize (but not MinSize).
SDValue PerformCMOVToBFICombine(SDNode *N, SelectionDAG &DAG) const
bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const override
Return true if a truncation from FromTy to ToTy is permitted when deciding whether a call is in tail ...
void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
LowerAsmOperandForConstraint - Lower the specified operand into the Ops vector.
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
bool shouldConvertFpToSat(unsigned Op, EVT FPVT, EVT VT) const override
Should we generate fp_to_si_sat and fp_to_ui_sat from type FPVT to type VT from min(max(fptoi)) satur...
bool functionArgumentNeedsConsecutiveRegisters(Type *Ty, CallingConv::ID CallConv, bool isVarArg, const DataLayout &DL) const override
Returns true if an argument of type Ty needs to be passed in a contiguous block of registers in calli...
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
const ARMBaseTargetMachine & getTM() const
bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override
Return if the target supports combining a chain like:
ShiftLegalizationStrategy preferredShiftLegalizationStrategy(SelectionDAG &DAG, SDNode *N, unsigned ExpansionFactor) const override
bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDValue &Base, SDValue &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) const override
getPostIndexedAddressParts - returns true by value, base pointer and offset pointer and addressing mo...
Instruction * emitLeadingFence(IRBuilderBase &Builder, Instruction *Inst, AtomicOrdering Ord) const override
Inserts in the IR a target-specific intrinsic specifying a fence.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
An instruction that atomically checks whether a specified value is in a memory location,...
an instruction that atomically reads a memory location, combines it with another value,...
bool isFloatingPointOperation() const
static LLVM_ABI Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
static LLVM_ABI BaseIndexOffset match(const SDNode *N, const SelectionDAG &DAG)
Parses tree in N for base, index, offset addresses.
LLVM Basic Block Representation.
The address of a basic block.
static BranchProbability getZero()
A "pseudo-class" with methods for operating on BUILD_VECTORs.
LLVM_ABI bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef, unsigned &SplatBitSize, bool &HasAnyUndefs, unsigned MinSplatBits=0, bool isBigEndian=false) const
Check if this is a constant splat, and if so, find the smallest element size that splats the vector.
LLVM_ABI int32_t getConstantFPSplatPow2ToLog2Int(BitVector *UndefElements, uint32_t BitWidth) const
If this is a constant FP splat and the splatted constant FP is an exact power or 2,...
CCState - This class holds information needed while lowering arguments and return values.
void getInRegsParamInfo(unsigned InRegsParamRecordIndex, unsigned &BeginReg, unsigned &EndReg) const
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set,...
static LLVM_ABI 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.
MCRegister AllocateReg(MCPhysReg Reg)
AllocateReg - Attempt to allocate one register.
LLVM_ABI 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 ...
LLVM_ABI void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
void rewindByValRegsInfo()
unsigned getInRegsParamsProcessed() const
uint64_t getStackSize() const
Returns the size of the currently allocated portion of the stack.
void addInRegsParamInfo(unsigned RegBegin, unsigned RegEnd)
LLVM_ABI void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
unsigned getInRegsParamsCount() const
CCValAssign - Represent assignment of one arg/retval to a location.
Register getLocReg() const
LocInfo getLocInfo() const
int64_t getLocMemOffset() const
unsigned getValNo() const
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
LLVM_ABI bool isMustTailCall() const
Tests if this call site must be tail call optimized.
LLVM_ABI bool isIndirectCall() const
Return true if the callsite is an indirect call.
AttributeList getAttributes() const
Return the attributes for this call.
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
This class represents a function call, abstracting a target machine's calling convention.
static Constant * get(LLVMContext &Context, ArrayRef< ElementTy > Elts)
get() constructor - Return a constant with array type with an element count and element type matching...
const APFloat & getValueAPF() const
ConstantFP - Floating Point Values [float, double].
This is the shared class of boolean and integer constants.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
uint64_t getZExtValue() const
const APInt & getAPIntValue() const
int64_t getSExtValue() const
This is an important base class in LLVM.
uint64_t getNumOperands() const
A parsed version of the target data layout string in and methods for querying it.
bool isLittleEndian() const
Layout endianness...
MaybeAlign getStackAlignment() const
Returns the natural stack alignment, or MaybeAlign() if one wasn't specified.
LLVM_ABI TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
LLVM_ABI Align getPreferredAlign(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global.
StringRef getPrivateGlobalPrefix() const
LLVM_ABI Align getPrefTypeAlign(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
iterator find(const_arg_type_t< KeyT > Val)
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
Class to represent fixed width SIMD vectors.
unsigned getNumElements() const
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Type * getParamType(unsigned i) const
Parameter type accessors.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
bool hasStructRetAttr() const
Determine if the function returns a structure through first or second pointer argument.
const Argument * const_arg_iterator
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
const GlobalValue * getGlobal() const
bool hasExternalWeakLinkage() const
bool hasDLLImportStorageClass() const
Module * getParent()
Get the module that this global value is contained inside of...
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
@ InternalLinkage
Rename collisions when linking (static functions).
Common base class shared among various IRBuilders.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
LLVM_ABI bool hasAtomicStore() const LLVM_READONLY
Return true if this atomic instruction stores to memory.
This is an important class for using LLVM in a threaded context.
LLVM_ABI void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
An instruction for reading from memory.
This class is used to represent ISD::LOAD nodes.
const SDValue & getBasePtr() const
Describe properties that are true of each instruction in the target description file.
static MVT getFloatingPointVT(unsigned BitWidth)
static auto integer_fixedlen_vector_valuetypes()
uint64_t getScalarSizeInBits() const
unsigned getVectorNumElements() const
bool isInteger() const
Return true if this is an integer or a vector integer type.
static LLVM_ABI MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
static auto integer_valuetypes()
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
static auto fixedlen_vector_valuetypes()
uint64_t getFixedSizeInBits() const
Return the size of the specified fixed width value type in bits.
bool isScalarInteger() const
Return true if this is an integer, not including vectors.
static MVT getVectorVT(MVT VT, unsigned NumElements)
MVT getVectorElementType() const
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
static MVT getIntegerVT(unsigned BitWidth)
static auto fp_valuetypes()
bool is64BitVector() const
Return true if this is a 64-bit vector type.
LLVM_ABI void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
bool isEHPad() const
Returns true if the block is a landing pad.
LLVM_ABI MachineBasicBlock * getFallThrough(bool JumpToFallThrough=true)
Return the fallthrough block if the block can implicitly transfer control to the block after it by fa...
void setCallFrameSize(unsigned N)
Set the call frame size on entry to this basic block.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
LLVM_ABI bool canFallThrough()
Return true if the block can implicitly transfer control to the block after it by falling off the end...
LLVM_ABI void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
Instructions::iterator instr_iterator
MachineInstrBundleIterator< MachineInstr, true > reverse_iterator
LLVM_ABI MachineBasicBlock * splitAt(MachineInstr &SplitInst, bool UpdateLiveIns=true, LiveIntervals *LIS=nullptr)
Split a basic block into 2 pieces at SplitPoint.
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
LLVM_ABI instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
iterator_range< succ_iterator > successors()
iterator_range< pred_iterator > predecessors()
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 '...
MachineInstrBundleIterator< MachineInstr > iterator
LLVM_ABI void moveAfter(MachineBasicBlock *NewBefore)
void setIsEHPad(bool V=true)
Indicates the block is a landing pad.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
unsigned getConstantPoolIndex(const Constant *C, Align Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one.
LLVM_ABI 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_ABI void computeMaxCallFrameSize(MachineFunction &MF, std::vector< MachineBasicBlock::iterator > *FrameSDOps=nullptr)
Computes the maximum size of a callframe.
void setAdjustsStack(bool V)
void setFrameAddressIsTaken(bool T)
void setHasTailCall(bool V=true)
void setReturnAddressIsTaken(bool s)
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
bool hasVAStart() const
Returns true if the function calls the llvm.va_start intrinsic.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
int getFunctionContextIndex() const
Return the index for the function context object.
Properties which a MachineFunction may have at a given point in time.
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
void push_back(MachineBasicBlock *MBB)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
Function & getFunction()
Return the LLVM function that this machine code represents.
BasicBlockListType::iterator iterator
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
const MachineFunctionProperties & getProperties() const
Get the function properties.
Register addLiveIn(MCRegister PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *BB=nullptr, std::optional< UniqueBBID > BBID=std::nullopt)
CreateMachineInstr - Allocate a new MachineInstr.
void insert(iterator MBBI, MachineBasicBlock *MBB)
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned TargetFlags=0) const
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addFrameIndex(int Idx) const
const MachineInstrBuilder & addConstantPoolIndex(unsigned Idx, int Offset=0, unsigned TargetFlags=0) const
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addJumpTableIndex(unsigned Idx, unsigned TargetFlags=0) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & cloneMemRefs(const MachineInstr &OtherMI) const
const MachineInstrBuilder & addUse(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
const MachineInstrBuilder & addDef(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register definition operand.
Representation of each machine instruction.
bool readsRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr reads the specified register.
bool definesRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr fully defines the specified register.
MachineOperand * mop_iterator
iterator/begin/end - Iterate over all operands of a machine instruction.
const MachineOperand & getOperand(unsigned i) const
LLVM_ABI unsigned createJumpTableIndex(const std::vector< MachineBasicBlock * > &DestBBs)
createJumpTableIndex - Create a new jump table.
@ EK_Inline
EK_Inline - Jump table entries are emitted inline at their point of use.
@ EK_BlockAddress
EK_BlockAddress - Each entry is a plain address of block, e.g.: .word LBB123.
A description of a memory reference used in the backend.
Flags
Flags values. These may be or'd together.
@ MOVolatile
The memory access is volatile.
@ MODereferenceable
The memory access is dereferenceable (i.e., doesn't trap).
@ MOLoad
The memory access reads data.
@ MONonTemporal
The memory access is non-temporal.
@ MOInvariant
The memory access always returns the same value (or traps).
@ MOStore
The memory access writes data.
Flags getFlags() const
Return the raw flags of the source value,.
MachineOperand class - Representation of each machine instruction operand.
LLVM_ABI void setIsRenamable(bool Val=true)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
static MachineOperand CreateImm(int64_t Val)
Register getReg() const
getReg - Returns the register number.
LLVM_ABI void setIsDef(bool Val=true)
Change a def to a use, or a use to a def.
static MachineOperand CreateReg(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
This class is used to represent an MLOAD node.
This class is used to represent an MSTORE node.
This SDNode is used for target intrinsics that touch memory and need an associated MachineMemOperand.
This is an abstract virtual class for memory operations.
Align getBaseAlign() const
Returns alignment and volatility of the memory access.
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
bool isSimple() const
Returns true if the memory operation is neither atomic or volatile.
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
const MachinePointerInfo & getPointerInfo() const
const SDValue & getChain() const
EVT getMemoryVT() const
Return the type of the in-memory value.
A Module instance is used to store all the information related to an LLVM module.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
Wrapper class representing virtual and physical registers.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
const DebugLoc & getDebugLoc() const
Represents one node in the SelectionDAG.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
bool hasOneUse() const
Return true if there is exactly one use of this node.
LLVM_ABI bool isOnlyUserOf(const SDNode *N) const
Return true if this node is the only use of N.
iterator_range< use_iterator > uses()
SDNodeFlags getFlags() const
static bool hasPredecessorHelper(const SDNode *N, SmallPtrSetImpl< const SDNode * > &Visited, SmallVectorImpl< const SDNode * > &Worklist, unsigned int MaxSteps=0, bool TopologicalPrune=false)
Returns true if N is a predecessor of any node in Worklist.
uint64_t getAsZExtVal() const
Helper method returns the zero-extended integer value of a ConstantSDNode.
bool use_empty() const
Return true if there are no uses of this node.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
unsigned getNumOperands() const
Return the number of values used by this operation.
const SDValue & getOperand(unsigned Num) const
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
const APInt & getConstantOperandAPInt(unsigned Num) const
Helper method returns the APInt of a ConstantSDNode operand.
bool isPredecessorOf(const SDNode *N) const
Return true if this node is a predecessor of N.
LLVM_ABI bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
void setCFIType(uint32_t Type)
bool isUndef() const
Returns true if the node type is UNDEF or POISON.
iterator_range< user_iterator > users()
void setFlags(SDNodeFlags NewFlags)
user_iterator user_begin() const
Provide iteration support to walk over all users of an SDNode.
Represents a use of a SDNode.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
const SDValue & getOperand(unsigned i) const
const APInt & getConstantOperandAPInt(unsigned i) const
uint64_t getScalarValueSizeInBits() const
unsigned getResNo() const
get the index which selects a specific result in the SDNode
uint64_t getConstantOperandVal(unsigned i) const
unsigned getOpcode() const
unsigned getNumOperands() const
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
LLVM_ABI SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned TargetFlags=0)
LLVM_ABI SDValue getStackArgumentTokenFactor(SDValue Chain)
Compute a TokenFactor to force all the incoming stack arguments to be loaded from the stack.
const TargetSubtargetInfo & getSubtarget() const
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, Register Reg, SDValue N)
LLVM_ABI SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
LLVM_ABI SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
LLVM_ABI SDValue getSplatValue(SDValue V, bool LegalTypes=false)
If V is a splat vector, return its scalar source operand by extracting that element from the source v...
LLVM_ABI SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
LLVM_ABI MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s),...
LLVM_ABI SDNode * getNodeIfExists(unsigned Opcode, SDVTList VTList, ArrayRef< SDValue > Ops, const SDNodeFlags Flags, bool AllowCommute=false)
Get the specified node if it's already available, or else return NULL.
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...
LLVM_ABI SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
LLVM_ABI bool haveNoCommonBitsSet(SDValue A, SDValue B) const
Return true if A and B have no common bits set.
LLVM_ABI SDValue getRegister(Register Reg, EVT VT)
LLVM_ABI SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), 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,...
LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, LocationSize Size=LocationSize::precise(0), const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge)
Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
std::pair< SDValue, SDValue > SplitVectorOperand(const SDNode *N, unsigned OpNo)
Split the node's operand with EXTRACT_SUBVECTOR and return the low/high part.
LLVM_ABI SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
const TargetLowering & getTargetLoweringInfo() const
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags=0)
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
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).
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
LLVM_ABI SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type.
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, Register Reg, EVT VT)
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, SDValue RHS, SDNodeFlags Flags=SDNodeFlags())
Helper function to make it easier to build Select's if you just have operands and don't want to check...
LLVM_ABI SDValue getNegative(SDValue Val, const SDLoc &DL, EVT VT)
Create negative operation as (SUB 0, Val).
LLVM_ABI void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand * > NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
LLVM_ABI 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.
const DataLayout & getDataLayout() const
LLVM_ABI SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getSignedTargetConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
LLVM_ABI SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
LLVM_ABI void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
LLVM_ABI std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the vector with EXTRACT_SUBVECTOR using the provided VTs and return the low/high part.
LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
LLVM_ABI SDValue getSignedConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
LLVM_ABI MaybeAlign InferPtrAlign(SDValue Ptr) const
Infer alignment of a load / store address.
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 ...
LLVM_ABI SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond, SDNodeFlags Flags=SDNodeFlags())
Helper function to make it easier to build SelectCC's if you just have an ISD::CondCode instead of an...
LLVM_ABI 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...
LLVM_ABI bool isKnownNeverZero(SDValue Op, unsigned Depth=0) const
Test whether the given SDValue is known to contain non-zero value(s).
LLVM_ABI SDValue getExternalSymbol(const char *Sym, EVT VT)
const TargetMachine & getTarget() const
LLVM_ABI SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
LLVM_ABI SDValue getValueType(EVT)
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
LLVM_ABI unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits.
LLVM_ABI SDValue getVectorIdxConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
LLVM_ABI void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone.
MachineFunction & getMachineFunction() const
LLVM_ABI SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
LLVM_ABI KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
LLVM_ABI SDValue getRegisterMask(const uint32_t *RegMask)
LLVM_ABI SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
LLVM_ABI SDValue getCondCode(ISD::CondCode Cond)
void addCallSiteInfo(const SDNode *Node, CallSiteInfo &&CallInfo)
Set CallSiteInfo to be associated with Node.
LLVM_ABI bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, TypeSize Offset)
Create an add instruction with appropriate flags when used for addressing some offset of an object.
LLVMContext * getContext() const
LLVM_ABI SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
LLVM_ABI SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment)
Create a stack temporary based on the size in bytes and the alignment.
SDValue getTargetConstantPool(const Constant *C, EVT VT, MaybeAlign Align=std::nullopt, int Offset=0, unsigned TargetFlags=0)
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
LLVM_ABI SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Base, SDValue Offset, SDValue Mask, SDValue Src0, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, ISD::LoadExtType, bool IsExpanding=false)
DenormalMode getDenormalMode(EVT VT) const
Return the current function's default denormal handling kind for the given floating point type.
LLVM_ABI std::pair< SDValue, SDValue > SplitScalar(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the scalar node with EXTRACT_ELEMENT using the provided VTs and return the low/high part.
LLVM_ABI SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
LLVM_ABI SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a logical NOT operation as (XOR Val, BooleanOne).
This instruction constructs a fixed permutation of two input vectors.
VectorType * getType() const
Overload to return most specific vector type.
static LLVM_ABI void getShuffleMask(const Constant *Mask, SmallVectorImpl< int > &Result)
Convert the input shuffle mask operand to a vector of integers.
static LLVM_ABI bool isIdentityMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses elements from exactly one source vector without lane crossin...
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
int getMaskElt(unsigned Idx) const
int getSplatIndex() const
ArrayRef< int > getMask() const
static LLVM_ABI bool isSplatMask(ArrayRef< int > Mask)
void insert_range(Range &&R)
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
iterator insert(iterator I, T &&Elt)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
This class is used to represent ISD::STORE nodes.
const SDValue & getBasePtr() const
const SDValue & getValue() const
bool isTruncatingStore() const
Return true if the op does a truncation before store.
StringRef - Represent a constant reference to a string, i.e.
const unsigned char * bytes_end() const
constexpr size_t size() const
size - Get the string size.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
const unsigned char * bytes_begin() const
static LLVM_ABI StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
TargetInstrInfo - Interface to description of machine instruction set.
Provides information about what library functions are available for the current target.
bool isOperationExpand(unsigned Op, EVT VT) const
Return true if the specified operation is illegal on this target or unlikely to be made legal with cu...
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...
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...
virtual void finalizeLowering(MachineFunction &MF) const
Execute target specific actions to finalize target lowering.
void setMaxDivRemBitWidthSupported(unsigned SizeInBits)
Set the size in bits of the maximum div/rem the backend supports.
bool PredictableSelectIsExpensive
Tells the code generator that select is more expensive than a branch if the branch is usually predict...
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
unsigned MaxStoresPerMemcpyOptSize
Likewise for functions with the OptSize attribute.
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
ShiftLegalizationStrategy
Return the preferred strategy to legalize tihs SHIFT instruction, with ExpansionFactor being the recu...
void setMinStackArgumentAlignment(Align Alignment)
Set the minimum stack alignment of an argument.
const TargetMachine & getTargetMachine() const
void setIndexedMaskedLoadAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
Indicate that the specified indexed masked load does or does not work with the specified type and ind...
void setIndexedLoadAction(ArrayRef< unsigned > IdxModes, MVT VT, LegalizeAction Action)
Indicate that the specified indexed load does or does not work with the specified type and indicate w...
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall implementation.
void setPrefLoopAlignment(Align Alignment)
Set the target's preferred loop alignment.
void setMaxAtomicSizeInBitsSupported(unsigned SizeInBits)
Set the maximum atomic operation size supported by the backend.
Sched::Preference getSchedulingPreference() const
Return target scheduling preference.
void setMinFunctionAlignment(Align Alignment)
Set the target's minimum function alignment.
unsigned MaxStoresPerMemsetOptSize
Likewise for functions with the OptSize attribute.
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
unsigned MaxStoresPerMemmove
Specify maximum number of store instructions per memmove call.
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose.
unsigned MaxStoresPerMemmoveOptSize
Likewise for functions with the OptSize attribute.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
void setIndexedStoreAction(ArrayRef< unsigned > IdxModes, MVT VT, LegalizeAction Action)
Indicate that the specified indexed store does or does not work with the specified type and indicate ...
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...
void setPrefFunctionAlignment(Align Alignment)
Set the target's preferred function alignment.
virtual unsigned getMaxSupportedInterleaveFactor() const
Get the maximum supported factor for interleaved memory accesses.
void setIndexedMaskedStoreAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
Indicate that the specified indexed masked store does or does not work with the specified type and in...
unsigned MaxStoresPerMemset
Specify maximum number of store instructions per memset call.
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
@ ZeroOrOneBooleanContent
@ ZeroOrNegativeOneBooleanContent
virtual ShiftLegalizationStrategy preferredShiftLegalizationStrategy(SelectionDAG &DAG, SDNode *N, unsigned ExpansionFactor) const
bool isOperationLegalOrCustom(unsigned Op, EVT VT, bool LegalOnly=false) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
void setStackPointerRegisterToSaveRestore(Register R)
If set to a physical register, this specifies the register that llvm.savestack/llvm....
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/...
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
virtual std::pair< const TargetRegisterClass *, uint8_t > findRepresentativeClass(const TargetRegisterInfo *TRI, MVT VT) const
Return the largest legal super-reg register class of the register class for the specified type and it...
RTLIB::LibcallImpl getLibcallImpl(RTLIB::Libcall Call) const
Get the libcall impl routine name for the specified libcall.
static StringRef getLibcallImplName(RTLIB::LibcallImpl Call)
Get the libcall routine name for the specified libcall implementation.
void setTargetDAGCombine(ArrayRef< ISD::NodeType > NTs)
Targets should invoke this method for each target independent node that they want to provide a custom...
void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified load with extension does not work with the specified type and indicate wh...
LegalizeTypeAction getTypeAction(LLVMContext &Context, EVT VT) const
Return how we should legalize values of this type, either it is already legal (return 'Legal') or we ...
std::vector< ArgListEntry > ArgListTy
unsigned MaxStoresPerMemcpy
Specify maximum number of store instructions per memcpy call.
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
virtual void insertSSPDeclarations(Module &M) const
Inserts necessary declarations for SSP (stack protection) purpose.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool SimplifyDemandedVectorElts(SDValue Op, const APInt &DemandedEltMask, APInt &KnownUndef, APInt &KnownZero, TargetLoweringOpt &TLO, unsigned Depth=0, bool AssumeSingleUse=false) const
Look at Vector Op.
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, const SDLoc &DL, const SDValue OldLHS, const SDValue OldRHS) const
Soften the operands of a comparison.
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
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...
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
bool expandDIVREMByConstant(SDNode *N, SmallVectorImpl< SDValue > &Result, EVT HiLoVT, SelectionDAG &DAG, SDValue LL=SDValue(), SDValue LH=SDValue()) const
Attempt to expand an n-bit div/rem/divrem by constant using a n/2-bit urem by constant and other arit...
bool isPositionIndependent() const
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
SDValue buildLegalVectorShuffle(EVT VT, const SDLoc &DL, SDValue N0, SDValue N1, MutableArrayRef< int > Mask, SelectionDAG &DAG) const
Tries to build a legal vector shuffle using the provided parameters or equivalent variations.
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, KnownBits &Known, TargetLoweringOpt &TLO, unsigned Depth=0, bool AssumeSingleUse=false) const
Look at Op.
virtual bool SimplifyDemandedBitsForTargetNode(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, KnownBits &Known, TargetLoweringOpt &TLO, unsigned Depth=0) const
Attempt to simplify any target nodes based on the demanded bits/elts, returning true on success.
TargetLowering(const TargetLowering &)=delete
bool isConstTrueVal(SDValue N) const
Return if the N is a constant or constant vector equal to the true value from getBooleanContents().
virtual ArrayRef< MCPhysReg > getRoundingControlRegisters() const
Returns a 0 terminated array of rounding control registers that can be attached into strict FP call.
virtual void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::LibcallImpl LibcallImpl, EVT RetVT, ArrayRef< SDValue > Ops, MakeLibCallOptions CallOptions, const SDLoc &dl, SDValue Chain=SDValue()) const
Returns a pair of (return value, chain).
virtual bool canCreateUndefOrPoisonForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, bool PoisonOnly, bool ConsiderFlags, unsigned Depth) const
Return true if Op can create undef or poison from non-undef & non-poison operands.
Primary interface to the complete machine description for the target machine.
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
ExceptionHandling getExceptionModel() const
Return the ExceptionHandling to use, considering TargetOptions and the Triple's default.
const Triple & getTargetTriple() const
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline.
unsigned EmitCallGraphSection
Emit section containing call graph metadata.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
ObjectFormatType getObjectFormat() const
Get the object format for this triple.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
bool isVectorTy() const
True if this is an instance of VectorType.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
bool isPointerTy() const
True if this is an instance of PointerType.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
static LLVM_ABI IntegerType * getInt16Ty(LLVMContext &C)
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
bool isIntegerTy() const
True if this is an instance of IntegerType.
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
A Use represents the edge between a Value definition and its users.
LLVM_ABI unsigned getOperandNo() const
Return the operand # of this use in its User.
User * getUser() const
Returns the User that contains this Use.
Value * getOperand(unsigned i) const
unsigned getNumOperands() const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
bool hasOneUse() const
Return true if there is exactly one use of this value.
Base class of all SIMD vector types.
Type * getElementType() const
std::pair< iterator, bool > insert(const ValueT &V)
bool contains(const_arg_type_t< ValueT > V) const
Check if the set contains the given element.
constexpr ScalarTy getFixedValue() const
const ParentTy * getParent() const
self_iterator getIterator()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
static CondCodes getOppositeCondition(CondCodes CC)
@ SECREL
Thread Pointer Offset.
@ SBREL
Section Relative (Windows TLS)
@ GOTTPOFF
Global Offset Table, PC Relative.
@ TPOFF
Global Offset Table, Thread Pointer Offset.
TOF
Target Operand Flag enum.
@ MO_NONLAZY
MO_NONLAZY - This is an independent flag, on a symbol operand "FOO" it represents a symbol which,...
@ MO_SBREL
MO_SBREL - On a symbol operand, this represents a static base relative relocation.
@ MO_DLLIMPORT
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
@ MO_GOT
MO_GOT - On a symbol operand, this represents a GOT relative relocation.
@ MO_COFFSTUB
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "....
static ShiftOpc getShiftOpcForNode(unsigned Opcode)
int getSOImmVal(unsigned Arg)
getSOImmVal - Given a 32-bit immediate, if it is something that can fit into an shifter_operand immed...
int getFP32Imm(const APInt &Imm)
getFP32Imm - Return an 8-bit floating-point version of the 32-bit floating-point value.
uint64_t decodeVMOVModImm(unsigned ModImm, unsigned &EltBits)
decodeVMOVModImm - Decode a NEON/MVE modified immediate value into the element value and the element ...
unsigned getAM2Offset(unsigned AM2Opc)
bool isThumbImmShiftedVal(unsigned V)
isThumbImmShiftedVal - Return true if the specified value can be obtained by left shifting a 8-bit im...
int getT2SOImmVal(unsigned Arg)
getT2SOImmVal - Given a 32-bit immediate, if it is something that can fit into a Thumb-2 shifter_oper...
unsigned createVMOVModImm(unsigned OpCmode, unsigned Val)
int getFP64Imm(const APInt &Imm)
getFP64Imm - Return an 8-bit floating-point version of the 64-bit floating-point value.
int getFP16Imm(const APInt &Imm)
getFP16Imm - Return an 8-bit floating-point version of the 16-bit floating-point value.
unsigned getSORegOpc(ShiftOpc ShOp, unsigned Imm)
int getFP32FP16Imm(const APInt &Imm)
If this is a FP16Imm encoded as a fp32 value, return the 8-bit encoding for it.
AddrOpc getAM2Op(unsigned AM2Opc)
bool isBitFieldInvertedMask(unsigned v)
const unsigned FPStatusBits
const unsigned FPReservedBits
const unsigned RoundingBitsPos
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ Swift
Calling convention for Swift.
@ ARM_APCS
ARM Procedure Calling Standard (obsolete, but still used on some targets).
@ CFGuard_Check
Special calling convention on Windows for calling the Control Guard Check ICall funtion.
@ PreserveMost
Used for runtime calls that preserves most registers.
@ ARM_AAPCS
ARM Architecture Procedure Calling Standard calling convention (aka EABI).
@ CXX_FAST_TLS
Used for access functions.
@ GHC
Used by the Glasgow Haskell Compiler (GHC).
@ PreserveAll
Used for runtime calls that preserves (almost) all registers.
@ Fast
Attempts to make calls as fast as possible (e.g.
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
@ SwiftTail
This follows the Swift calling convention in how arguments are passed but guarantees tail calls will ...
@ ARM_AAPCS_VFP
Same as ARM_AAPCS, but uses hard floating point ABI.
@ C
The default llvm calling convention, compatible with C.
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
@ MERGE_VALUES
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
@ STACKRESTORE
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain.
@ STACKSAVE
STACKSAVE - STACKSAVE has one operand, an input chain.
@ STRICT_FSETCC
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only.
@ SET_FPENV
Sets the current floating-point environment.
@ MLOAD
Masked load and store - consecutive vector load and store operations with additional mask operand tha...
@ EH_SJLJ_LONGJMP
OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.longjmp intrinsic.
@ FGETSIGN
INT = FGETSIGN(FP) - Return the sign bit of the specified floating point value as an integer 0/1 valu...
@ SMUL_LOHI
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
@ INSERT_SUBVECTOR
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1.
@ BSWAP
Byte Swap and Counting operators.
@ VAEND
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE.
@ ATOMIC_STORE
OUTCHAIN = ATOMIC_STORE(INCHAIN, val, ptr) This corresponds to "store atomic" instruction.
@ RESET_FPENV
Set floating-point environment to default state.
@ ADD
Simple integer binary arithmetic operators.
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ SET_FPMODE
Sets the current dynamic floating-point control modes.
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
@ FMA
FMA - Perform a * b + c with no intermediate rounding step.
@ FMODF
FMODF - Decomposes the operand into integral and fractional parts, each having the same type and sign...
@ FATAN2
FATAN2 - atan2, inspired by libm.
@ FSINCOSPI
FSINCOSPI - Compute both the sine and cosine times pi more accurately than FSINCOS(pi*x),...
@ INTRINSIC_VOID
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
@ EH_SJLJ_SETUP_DISPATCH
OUTCHAIN = EH_SJLJ_SETUP_DISPATCH(INCHAIN) The target initializes the dispatch table here.
@ SINT_TO_FP
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
@ CONCAT_VECTORS
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
@ VECREDUCE_FMAX
FMIN/FMAX nodes can have flags, for NaN/NoNaN variants.
@ FADD
Simple binary floating point operators.
@ ABS
ABS - Determine the unsigned absolute value of a signed integer value of the same bitwidth.
@ ATOMIC_FENCE
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
@ RESET_FPMODE
Sets default dynamic floating-point control modes.
@ SDIVREM
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
@ FP16_TO_FP
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
@ BUILD_PAIR
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
@ FLDEXP
FLDEXP - ldexp, inspired by libm (op0 * 2**op1).
@ STRICT_FSQRT
Constrained versions of libm-equivalent floating point intrinsics.
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
@ SET_ROUNDING
Set rounding mode.
@ SIGN_EXTEND
Conversion operators.
@ AVGCEILS
AVGCEILS/AVGCEILU - Rounding averaging add - Add two integers using an integer of type i[N+2],...
@ SCALAR_TO_VECTOR
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
@ BR
Control flow instructions. These all have token chains.
@ VECREDUCE_FADD
These reductions have relaxed evaluation order semantics, and have a single vector operand.
@ CTTZ_ZERO_UNDEF
Bit counting operators with an undefined result for zero inputs.
@ PREFETCH
PREFETCH - This corresponds to a prefetch intrinsic.
@ FSINCOS
FSINCOS - Compute both fsin and fcos as a single operation.
@ SETCCCARRY
Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, but op #2 is a boolean indicating ...
@ FNEG
Perform various unary floating-point operations inspired by libm.
@ BR_CC
BR_CC - Conditional branch.
@ SSUBO
Same for subtraction.
@ BR_JT
BR_JT - Jumptable branch.
@ SSUBSAT
RESULT = [US]SUBSAT(LHS, RHS) - Perform saturation subtraction on 2 integers with the same bit width ...
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
@ ATOMIC_LOAD
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
@ UNDEF
UNDEF - An undefined node.
@ EXTRACT_ELEMENT
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant,...
@ VACOPY
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer,...
@ BasicBlock
Various leaf nodes.
@ CopyFromReg
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
@ SADDO
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
@ VECREDUCE_ADD
Integer reductions may have a result type larger than the vector element type.
@ GET_ROUNDING
Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest, ties to even 2 Round to ...
@ MULHU
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
@ GET_FPMODE
Reads the current dynamic floating-point control modes.
@ GET_FPENV
Gets the current floating-point environment.
@ SHL
Shift and rotation operations.
@ VECTOR_SHUFFLE
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
@ EXTRACT_SUBVECTOR
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR.
@ READ_REGISTER
READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on the DAG, which implements the n...
@ EXTRACT_VECTOR_ELT
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
@ CopyToReg
CopyToReg - This node has three operands: a chain, a register number to set to this value,...
@ ZERO_EXTEND
ZERO_EXTEND - Used for integer types, zeroing the new bits.
@ DEBUGTRAP
DEBUGTRAP - Trap intended to get the attention of a debugger.
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
@ ATOMIC_CMP_SWAP
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo,...
@ FMINNUM
FMINNUM/FMAXNUM - Perform floating-point minimum maximum on two values, following IEEE-754 definition...
@ SMULO
Same for multiplication.
@ DYNAMIC_STACKALLOC
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary.
@ SIGN_EXTEND_INREG
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
@ SMIN
[US]{MIN/MAX} - Binary minimum or maximum of signed or unsigned integers.
@ FP_EXTEND
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ VSELECT
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
@ UADDO_CARRY
Carry-using nodes for multiple precision addition and subtraction.
@ BF16_TO_FP
BF16_TO_FP, FP_TO_BF16 - These operators are used to perform promotions and truncation for bfloat16.
@ FRAMEADDR
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG.
@ STRICT_FP_ROUND
X = STRICT_FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision ...
@ STRICT_FP_TO_SINT
STRICT_FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
@ FMINIMUM
FMINIMUM/FMAXIMUM - NaN-propagating minimum/maximum that also treat -0.0 as less than 0....
@ FP_TO_SINT
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
@ READCYCLECOUNTER
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
@ STRICT_FP_EXTEND
X = STRICT_FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ AND
Bitwise operators - logical and, logical or, logical xor.
@ TRAP
TRAP - Trapping instruction.
@ INTRINSIC_WO_CHAIN
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
@ SCMP
[US]CMP - 3-way comparison of signed or unsigned integers.
@ AVGFLOORS
AVGFLOORS/AVGFLOORU - Averaging add - Add two integers using an integer of type i[N+1],...
@ STRICT_FADD
Constrained versions of the binary floating point operators.
@ INSERT_VECTOR_ELT
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL.
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
@ ATOMIC_SWAP
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN,...
@ FFREXP
FFREXP - frexp, extract fractional and exponent component of a floating-point value.
@ FP_ROUND
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
@ SPONENTRY
SPONENTRY - Represents the llvm.sponentry intrinsic.
@ FP_TO_SINT_SAT
FP_TO_[US]INT_SAT - Convert floating point value in operand 0 to a signed or unsigned scalar integer ...
@ EH_SJLJ_SETJMP
RESULT, OUTCHAIN = EH_SJLJ_SETJMP(INCHAIN, buffer) This corresponds to the eh.sjlj....
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
@ VAARG
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
@ BRCOND
BRCOND - Conditional branch.
@ SHL_PARTS
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations.
@ FCOPYSIGN
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
@ SADDSAT
RESULT = [US]ADDSAT(LHS, RHS) - Perform saturation addition on 2 integers with the same bit width (W)...
@ ABDS
ABDS/ABDU - Absolute difference - Return the absolute difference between two numbers interpreted as s...
@ INTRINSIC_W_CHAIN
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
bool isNormalStore(const SDNode *N)
Returns true if the specified node is a non-truncating and unindexed store.
bool isZEXTLoad(const SDNode *N)
Returns true if the specified node is a ZEXTLOAD.
LLVM_ABI CondCode getSetCCInverse(CondCode Operation, EVT Type)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
bool isEXTLoad(const SDNode *N)
Returns true if the specified node is a EXTLOAD.
LLVM_ABI CondCode getSetCCSwappedOperands(CondCode Operation)
Return the operation corresponding to (Y op X) when given the operation for (X op Y).
LLVM_ABI bool isBuildVectorAllZeros(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are 0 or undef.
bool isSignedIntSetCC(CondCode Code)
Return true if this is a setcc instruction that performs a signed comparison when used with integer o...
LLVM_ABI bool isConstantSplatVector(const SDNode *N, APInt &SplatValue)
Node predicates.
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
bool isSEXTLoad(const SDNode *N)
Returns true if the specified node is a SEXTLOAD.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
static const int LAST_INDEXED_MODE
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > Tys={})
Look up the Function declaration of the intrinsic id in the Module M.
LLVM_ABI Libcall getSINTTOFP(EVT OpVT, EVT RetVT)
getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
LLVM_ABI Libcall getUINTTOFP(EVT OpVT, EVT RetVT)
getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
LLVM_ABI Libcall getFPTOUINT(EVT OpVT, EVT RetVT)
getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
LLVM_ABI Libcall getFPTOSINT(EVT OpVT, EVT RetVT)
getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
LLVM_ABI Libcall getFPEXT(EVT OpVT, EVT RetVT)
getFPEXT - Return the FPEXT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
LLVM_ABI Libcall getFPROUND(EVT OpVT, EVT RetVT)
getFPROUND - Return the FPROUND_*_* value for the given types, or UNKNOWN_LIBCALL if there is none.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Define
Register definition.
@ Kill
The last use of a register.
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
bool RetFastCC_ARM_APCS(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
@ Low
Lower the current thread's priority such that it does not affect foreground tasks significantly.
FunctionAddr VTableAddr Value
void stable_sort(R &&Range)
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
bool HasLowerConstantMaterializationCost(unsigned Val1, unsigned Val2, const ARMSubtarget *Subtarget, bool ForCodesize=false)
Returns true if Val1 has a lower Constant Materialization Cost than Val2.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
LLVM_ABI bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isStrongerThanMonotonic(AtomicOrdering AO)
int countr_one(T Value)
Count the number of ones from the least significant bit to the first zero bit.
FunctionAddr VTableAddr uintptr_t uintptr_t Int32Ty
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
bool CC_ARM_AAPCS(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
constexpr bool isMask_32(uint32_t Value)
Return true if the argument is a non-empty sequence of ones starting at the least significant bit wit...
@ SjLj
setjmp/longjmp based exceptions
bool RetCC_ARM_AAPCS_VFP(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
bool RetCC_ARM_APCS(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
int bit_width(T Value)
Returns the number of bits needed to represent Value if Value is nonzero.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
constexpr bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
bool RetCC_ARM_AAPCS(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
LLVM_ABI Value * concatenateVectors(IRBuilderBase &Builder, ArrayRef< Value * > Vecs)
Concatenate a list of vectors.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
void shuffle(Iterator first, Iterator last, RNG &&g)
bool CC_ARM_APCS_GHC(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
static std::array< MachineOperand, 2 > predOps(ARMCC::CondCodes Pred, unsigned PredReg=0)
Get the operands corresponding to the given Pred value.
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
constexpr bool isShiftedMask_32(uint32_t Value)
Return true if the argument contains a non-empty sequence of ones with the remainder zero (32 bit ver...
LLVM_ABI ConstantFPSDNode * isConstOrConstSplatFP(SDValue N, bool AllowUndefs=false)
Returns the SDNode if it is a constant splat BuildVector or constant float.
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
bool isReleaseOrStronger(AtomicOrdering AO)
auto dyn_cast_or_null(const Y &Val)
constexpr bool has_single_bit(T Value) noexcept
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
int countl_zero(T Val)
Count number of 0's from the most significant bit to the least stopping at the first 1.
LLVM_ABI bool isBitwiseNot(SDValue V, bool AllowUndefs=false)
Returns true if V is a bitwise not operation.
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
bool FastCC_ARM_APCS(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
ComplexDeinterleavingOperation
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool CC_ARM_Win32_CFGuard_Check(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
FunctionAddr VTableAddr Count
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
SmallVector< ValueTypeFromRangeType< R >, Size > to_vector(R &&Range)
Given a range of type R, iterate the entire range and return a SmallVector with elements of the vecto...
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
AtomicOrdering
Atomic ordering for LLVM's memory model.
ComplexDeinterleavingRotation
FunctionAddr VTableAddr uintptr_t uintptr_t Data
unsigned ConstantMaterializationCost(unsigned Val, const ARMSubtarget *Subtarget, bool ForCodesize=false)
Returns the number of instructions required to materialize the given constant in a register,...
@ Mul
Product of integers.
@ And
Bitwise or logical AND of integers.
@ Sub
Subtraction of integers.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
LLVM_ABI ConstantSDNode * isConstOrConstSplat(SDValue N, bool AllowUndefs=false, bool AllowTruncation=false)
Returns the SDNode if it is a constant splat BuildVector or constant int.
constexpr U AbsoluteValue(T X)
Return the absolute value of a signed integer, converted to the corresponding unsigned integer type.
bool isAcquireOrStronger(AtomicOrdering AO)
constexpr unsigned BitWidth
static MachineOperand t1CondCodeOp(bool isDead=false)
Get the operand corresponding to the conditional code result for Thumb1.
auto count_if(R &&Range, UnaryPredicate P)
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
Align commonAlignment(Align A, uint64_t Offset)
Returns the alignment that satisfies both alignments.
static MachineOperand condCodeOp(unsigned CCReg=0)
Get the operand corresponding to the conditional code result.
bool isVREVMask(ArrayRef< int > M, EVT VT, unsigned BlockSize)
isVREVMask - Check if a vector shuffle corresponds to a VREV instruction with the specified blocksize...
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
unsigned gettBLXrOpcode(const MachineFunction &MF)
bool CC_ARM_APCS(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
@ Increment
Incrementally increasing token ID.
bool CC_ARM_AAPCS_VFP(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
LLVM_ABI llvm::SmallVector< int, 16 > createSequentialMask(unsigned Start, unsigned NumInts, unsigned NumUndefs)
Create a sequential shuffle mask.
constexpr bool isShiftedUInt(uint64_t x)
Checks if a unsigned integer is an N bit number shifted left by S.
unsigned convertAddSubFlagsOpcode(unsigned OldOpc)
Map pseudo instructions that imply an 'S' bit onto real opcodes.
LLVM_ABI bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
static const unsigned PerfectShuffleTable[6561+1]
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Load/store instruction that can be merged with a base address update.
SDNode * N
Instruction that updates a pointer.
unsigned ConstInc
Pointer increment value if it is a constant, or 0 otherwise.
SDValue Inc
Pointer increment operand.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
This struct is a compact representation of a valid (non-zero power of two) alignment.
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
static constexpr DenormalMode getIEEE()
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
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.
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
ElementCount getVectorElementCount() const
EVT getDoubleNumVectorElementsVT(LLVMContext &Context) const
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
unsigned getVectorMinNumElements() const
Given a vector type, return the minimum number of elements it contains.
uint64_t getScalarSizeInBits() const
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
static LLVM_ABI EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
EVT changeVectorElementType(LLVMContext &Context, EVT EltVT) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element type...
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
uint64_t getFixedSizeInBits() const
Return the size of the specified fixed width value type in bits.
bool isFixedLengthVector() const
static EVT getFloatingPointVT(unsigned BitWidth)
Returns the EVT that represents a floating-point type with the given number of bits.
bool isVector() const
Return true if this is a vector value type.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
LLVM_ABI Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
EVT getHalfNumVectorElementsVT(LLVMContext &Context) const
bool isInteger() const
Return true if this is an integer or a vector integer type.
bool is64BitVector() const
Return true if this is a 64-bit vector type.
static KnownBits makeConstant(const APInt &C)
Create known bits from a known constant.
bool isUnknown() const
Returns true if we don't know any bits.
unsigned getBitWidth() const
Get the bit width of this value.
KnownBits zext(unsigned BitWidth) const
Return known bits for a zero extension of the value we're tracking.
void resetAll()
Resets the known state of all bits.
KnownBits intersectWith(const KnownBits &RHS) const
Returns KnownBits information that is known to be true for both this and RHS.
KnownBits sext(unsigned BitWidth) const
Return known bits for a sign extension of the value we're tracking.
static KnownBits add(const KnownBits &LHS, const KnownBits &RHS, bool NSW=false, bool NUW=false)
Compute knownbits resulting from addition of LHS and RHS.
static LLVM_ABI KnownBits mul(const KnownBits &LHS, const KnownBits &RHS, bool NoUndefSelfMultiply=false)
Compute known bits resulting from multiplying LHS and RHS.
APInt getSignedMinValue() const
Return the minimal signed value possible given these KnownBits.
SmallVector< ArgRegPair, 1 > ArgRegPairs
Vector of call argument and its forwarding register.
This class contains a discriminated union of information about pointers in memory operands,...
static LLVM_ABI MachinePointerInfo getJumpTable(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a jump table entry.
static LLVM_ABI MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)
Stack pointer relative access.
static LLVM_ABI MachinePointerInfo getConstantPool(MachineFunction &MF)
Return a MachinePointerInfo record that refers to the constant pool.
MachinePointerInfo getWithOffset(int64_t O) const
static LLVM_ABI MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
These are IR-level optimization flags that may be propagated to SDNodes.
bool hasNoSignedZeros() const
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg + ScalableOffset*...
This contains information for each constraint that we are lowering.
This structure contains all information that is necessary for lowering calls.
CallLoweringInfo & setInRegister(bool Value=true)
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
SmallVector< ISD::InputArg, 32 > Ins
const ConstantInt * CFIType
CallLoweringInfo & setZExtResult(bool Value=true)
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
CallLoweringInfo & setSExtResult(bool Value=true)
SmallVector< ISD::OutputArg, 32 > Outs
SmallVector< SDValue, 32 > OutVals
CallLoweringInfo & setChain(SDValue InChain)
CallLoweringInfo & setCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList, AttributeSet ResultAttrs={})
bool isAfterLegalizeDAG() const
LLVM_ABI void AddToWorklist(SDNode *N)
bool isCalledByLegalizer() const
bool isBeforeLegalize() const
LLVM_ABI SDValue CombineTo(SDNode *N, ArrayRef< SDValue > To, bool AddTo=true)
This structure is used to pass arguments to makeLibCall function.
A convenience struct that encapsulates a DAG, and two SDValues for returning information from TargetL...
bool CombineTo(SDValue O, SDValue N)