84#include "llvm/IR/IntrinsicsARM.h"
119#define DEBUG_TYPE "arm-isel"
122STATISTIC(NumOptimizedImms,
"Number of times immediates were optimized");
123STATISTIC(NumMovwMovt,
"Number of GAs materialized with movw + movt");
124STATISTIC(NumLoopByVals,
"Number of loops generated for byval arguments");
126 "Number of constants with their storage promoted into constant pools");
130 cl::desc(
"Enable / disable ARM interworking (for debugging only)"),
135 cl::desc(
"Enable / disable promotion of unnamed_addr constants into "
140 cl::desc(
"Maximum size of constant to promote into a constant pool"),
144 cl::desc(
"Maximum size of ALL constants to promote into a constant pool"),
149 cl::desc(
"Maximum interleave factor for MVE VLDn to generate."),
154 cl::desc(
"Maximum number of base-updates to check generating postindex."),
162 ARM::R0, ARM::R1, ARM::R2, ARM::R3
176void ARMTargetLowering::addTypeForNEON(
MVT VT,
MVT PromotedLdStVT) {
177 if (VT != PromotedLdStVT) {
186 if (ElemTy != MVT::f64)
190 if (ElemTy == MVT::i32) {
234void ARMTargetLowering::addDRTypeForNEON(
MVT VT) {
236 addTypeForNEON(VT, MVT::f64);
239void ARMTargetLowering::addQRTypeForNEON(
MVT VT) {
241 addTypeForNEON(VT, MVT::v2f64);
244void ARMTargetLowering::setAllExpand(
MVT VT) {
257void ARMTargetLowering::addAllExtLoads(
const MVT From,
const MVT To,
264void ARMTargetLowering::addMVEVectorTypes(
bool HasMVEFP) {
265 const MVT IntTypes[] = { MVT::v16i8, MVT::v8i16, MVT::v4i32 };
267 for (
auto VT : IntTypes) {
342 const MVT FloatTypes[] = { MVT::v8f16, MVT::v4f32 };
343 for (
auto VT : FloatTypes) {
417 const MVT LongTypes[] = { MVT::v2i64, MVT::v2f64 };
418 for (
auto VT : LongTypes) {
435 addAllExtLoads(MVT::v8i16, MVT::v8i8,
Legal);
436 addAllExtLoads(MVT::v4i32, MVT::v4i16,
Legal);
437 addAllExtLoads(MVT::v4i32, MVT::v4i8,
Legal);
454 for (
auto VT : {MVT::v8i8, MVT::v4i8, MVT::v4i16}) {
463 const MVT pTypes[] = {MVT::v16i1, MVT::v8i1, MVT::v4i1, MVT::v2i1};
464 for (
auto VT : pTypes) {
509 return ST.hasAnyDataBarrier() && (!ST.isThumb() || ST.hasV8MBaselineOps());
519 RegInfo(Subtarget->getRegisterInfo()),
520 Itins(Subtarget->getInstrItineraryData()) {
526 const Triple &TT = TM.getTargetTriple();
528 if (Subtarget->isThumb1Only())
533 if (!Subtarget->useSoftFloat() && !Subtarget->isThumb1Only() &&
534 Subtarget->hasFPRegs()) {
538 if (!Subtarget->hasVFP2Base()) {
539 setAllExpand(MVT::f32);
548 if (!Subtarget->hasFP64()) {
549 setAllExpand(MVT::f64);
559 if (Subtarget->hasFullFP16()) {
574 if (Subtarget->hasBF16()) {
576 setAllExpand(MVT::bf16);
577 if (!Subtarget->hasFullFP16()) {
617 addAllExtLoads(VT, InnerVT,
Expand);
626 if (!Subtarget->isThumb1Only() && !Subtarget->hasV8_1MMainlineOps())
629 if (!Subtarget->hasV8_1MMainlineOps())
632 if (!Subtarget->isThumb1Only())
641 if (Subtarget->hasMVEIntegerOps())
642 addMVEVectorTypes(Subtarget->hasMVEFloatOps());
645 if (Subtarget->hasLOB()) {
649 if (Subtarget->hasNEON()) {
650 addDRTypeForNEON(MVT::v2f32);
651 addDRTypeForNEON(MVT::v8i8);
652 addDRTypeForNEON(MVT::v4i16);
653 addDRTypeForNEON(MVT::v2i32);
654 addDRTypeForNEON(MVT::v1i64);
656 addQRTypeForNEON(MVT::v4f32);
657 addQRTypeForNEON(MVT::v2f64);
658 addQRTypeForNEON(MVT::v16i8);
659 addQRTypeForNEON(MVT::v8i16);
660 addQRTypeForNEON(MVT::v4i32);
661 addQRTypeForNEON(MVT::v2i64);
663 if (Subtarget->hasFullFP16()) {
664 addQRTypeForNEON(MVT::v8f16);
665 addDRTypeForNEON(MVT::v4f16);
668 if (Subtarget->hasBF16()) {
669 addQRTypeForNEON(MVT::v8bf16);
670 addDRTypeForNEON(MVT::v4bf16);
674 if (Subtarget->hasMVEIntegerOps() || Subtarget->hasNEON()) {
714 if (Subtarget->hasNEON()) {
827 if (!Subtarget->hasVFP4Base()) {
836 for (
MVT Ty : {MVT::v8i8, MVT::v4i8, MVT::v2i8, MVT::v4i16, MVT::v2i16,
845 for (
auto VT : {MVT::v8i8, MVT::v4i16, MVT::v2i32, MVT::v16i8, MVT::v8i16,
854 if (Subtarget->hasNEON() || Subtarget->hasMVEIntegerOps()) {
862 if (Subtarget->hasMVEIntegerOps()) {
867 if (Subtarget->hasMVEFloatOps()) {
871 if (!Subtarget->hasFP64()) {
923 if (!Subtarget->hasFP64() || !Subtarget->hasFPARMv8Base()) {
924 if (Subtarget->hasFullFP16()) {
930 if (Subtarget->hasFP16()) {
960 if (!Subtarget->isThumb1Only()) {
979 if (TT.isTargetAEABI() && !Subtarget->allowsUnalignedMem()) {
991 if (!Subtarget->isThumb1Only()) {
1000 if (Subtarget->hasDSP()) {
1010 if (Subtarget->hasBaseDSP()) {
1018 if (Subtarget->isThumb1Only()) {
1022 if (Subtarget->isThumb1Only() || !Subtarget->hasV6Ops()
1023 || (Subtarget->isThumb2() && !Subtarget->hasDSP()))
1038 if (Subtarget->hasMVEIntegerOps())
1042 if (Subtarget->isThumb1Only()) {
1048 if (!Subtarget->isThumb1Only() && Subtarget->hasV6T2Ops())
1062 if (!Subtarget->hasV5TOps() || Subtarget->isThumb1Only()) {
1071 if (Subtarget->hasPerfMon())
1075 if (!Subtarget->hasV6Ops())
1078 bool hasDivide = Subtarget->isThumb() ? Subtarget->hasDivideInThumbMode()
1079 : Subtarget->hasDivideInARMMode();
1086 if (TT.isOSWindows() && !Subtarget->hasDivideInThumbMode()) {
1098 if (TT.isTargetAEABI() || TT.isAndroid() || TT.isTargetGNUAEABI() ||
1099 TT.isTargetMuslAEABI() || TT.isOSFuchsia() || TT.isOSWindows()) {
1102 HasStandaloneRem =
false;
1129 if (TT.isOSWindows())
1136 InsertFencesForAtomic =
false;
1141 if (!Subtarget->isThumb() || !Subtarget->isMClass())
1146 if (!Subtarget->hasAcquireRelease() ||
1149 InsertFencesForAtomic =
true;
1155 if (Subtarget->hasDataBarrier())
1156 InsertFencesForAtomic =
true;
1167 {MVT::i8, MVT::i16, MVT::i32, MVT::i64},
LibCall);
1173 if (TT.isOSLinux() || (!Subtarget->isMClass() && Subtarget->hasV6Ops())) {
1185 }
else if ((Subtarget->isMClass() && Subtarget->hasV8MBaselineOps()) ||
1186 Subtarget->hasForced32BitAtomics()) {
1200 if (!Subtarget->hasV6Ops()) {
1206 if (!Subtarget->useSoftFloat() && Subtarget->hasFPRegs() &&
1207 !Subtarget->isThumb1Only()) {
1236 if (Subtarget->hasFullFP16()) {
1246 if (Subtarget->hasFullFP16())
1261 if (!Subtarget->useSoftFloat() && Subtarget->hasVFP2Base() &&
1262 !Subtarget->isThumb1Only()) {
1269 if (!Subtarget->hasVFP4Base()) {
1275 if (!Subtarget->useSoftFloat() && !Subtarget->isThumb1Only()) {
1277 if (!Subtarget->hasFPARMv8Base() || !Subtarget->hasFP64()) {
1285 if (!Subtarget->hasFP16()) {
1302 if (Subtarget->hasFPARMv8Base()) {
1312 if (Subtarget->hasFP64())
1316 if (Subtarget->hasNEON()) {
1326 if (Subtarget->hasFullFP16()) {
1363 if (Subtarget->hasNEON()) {
1375 if (Subtarget->hasV8Ops()) {
1385 if (Subtarget->hasFullFP16()) {
1408 if (TT.isOSWindows()) {
1425 if (Subtarget->hasMVEIntegerOps())
1428 if (Subtarget->hasV6Ops())
1430 if (Subtarget->isThumb1Only())
1433 if ((!Subtarget->isThumb() && Subtarget->hasV6Ops()) ||
1434 Subtarget->isThumb2()) {
1440 if (Subtarget->useSoftFloat() || Subtarget->isThumb1Only() ||
1441 !Subtarget->hasVFP2Base() || Subtarget->hasMinSize())
1472 return Subtarget->useSoftFloat();
1476 return !Subtarget->isThumb1Only() && VT.
getSizeInBits() <= 32;
1489std::pair<const TargetRegisterClass *, uint8_t>
1500 case MVT::f32:
case MVT::f64:
case MVT::v8i8:
case MVT::v4i16:
1501 case MVT::v2i32:
case MVT::v1i64:
case MVT::v2f32:
1502 RRC = &ARM::DPRRegClass;
1507 if (Subtarget->useNEONForSinglePrecisionFP())
1510 case MVT::v16i8:
case MVT::v8i16:
case MVT::v4i32:
case MVT::v2i64:
1511 case MVT::v4f32:
case MVT::v2f64:
1512 RRC = &ARM::DPRRegClass;
1516 RRC = &ARM::DPRRegClass;
1520 RRC = &ARM::DPRRegClass;
1524 return std::make_pair(RRC,
Cost);
1533 if (Subtarget->hasMVEIntegerOps())
1548 if (Subtarget->hasNEON()) {
1549 if (VT == MVT::v4i64)
1550 return &ARM::QQPRRegClass;
1551 if (VT == MVT::v8i64)
1552 return &ARM::QQQQPRRegClass;
1554 if (Subtarget->hasMVEIntegerOps()) {
1555 if (VT == MVT::v4i64)
1556 return &ARM::MQQPRRegClass;
1557 if (VT == MVT::v8i64)
1558 return &ARM::MQQQQPRRegClass;
1567 Align &PrefAlign)
const {
1574 (Subtarget->hasV6Ops() && !Subtarget->isMClass() ?
Align(8) :
Align(4));
1586 unsigned NumVals =
N->getNumValues();
1590 for (
unsigned i = 0; i != NumVals; ++i) {
1591 EVT VT =
N->getValueType(i);
1592 if (VT == MVT::Glue || VT == MVT::Other)
1598 if (!
N->isMachineOpcode())
1606 if (
MCID.getNumDefs() == 0)
1608 if (!Itins->isEmpty() &&
1609 Itins->getOperandCycle(
MCID.getSchedClass(), 0) > 2U)
1623 return Const->getZExtValue() == 16;
1631 return Const->getZExtValue() == 16;
1639 return Const->getZExtValue() == 16;
1708 bool isVarArg)
const {
1727 if (!Subtarget->isAAPCS_ABI())
1729 else if (Subtarget->isTargetHardFloat() && !isVarArg)
1735 if (!Subtarget->isAAPCS_ABI()) {
1736 if (Subtarget->hasFPRegs() && !Subtarget->isThumb1Only() && !isVarArg)
1739 }
else if (Subtarget->hasFPRegs() && !Subtarget->isThumb1Only() &&
1740 !Subtarget->useSoftFloat() && !isVarArg)
1748 bool isVarArg)
const {
1749 return CCAssignFnForNode(
CC,
false, isVarArg);
1753 bool isVarArg)
const {
1754 return CCAssignFnForNode(
CC,
true, isVarArg);
1761 bool isVarArg)
const {
1788 if (Subtarget->hasFullFP16()) {
1789 Val = DAG.
getNode(ARMISD::VMOVhr, dl, ValVT, Val);
1801 if (Subtarget->hasFullFP16()) {
1802 Val = DAG.
getNode(ARMISD::VMOVrh, dl,
1815SDValue ARMTargetLowering::LowerCallResult(
1819 SDValue ThisVal,
bool isCmseNSCall)
const {
1827 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
1828 CCValAssign VA = RVLocs[i];
1832 if (i == 0 && isThisReturn) {
1834 "unexpected return calling convention register assignment");
1852 if (!Subtarget->isLittle())
1854 Val = DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64,
Lo,
Hi);
1869 if (!Subtarget->isLittle())
1871 Val = DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64,
Lo,
Hi);
1901 const ISD::InputArg &Arg = Ins[VA.
getValNo()];
1912std::pair<SDValue, MachinePointerInfo> ARMTargetLowering::computeAddrForCallArg(
1914 bool IsTailCall,
int SPDiff)
const {
1916 MachinePointerInfo DstInfo;
1936 return std::make_pair(DstAddr, DstInfo);
1945ARMTargetLowering::ByValCopyKind ARMTargetLowering::ByValNeedsCopyForTailCall(
1958 if (!SrcFrameIdxNode || !DstFrameIdxNode)
1961 int SrcFI = SrcFrameIdxNode->getIndex();
1962 int DstFI = DstFrameIdxNode->getIndex();
1964 "byval passed in non-fixed stack slot");
1986 if (SrcOffset == DstOffset)
1994 RegsToPassVector &RegsToPass,
2001 DAG.
getVTList(MVT::i32, MVT::i32), Arg);
2002 unsigned id = Subtarget->isLittle() ? 0 : 1;
2014 MachinePointerInfo DstInfo;
2015 std::tie(DstAddr, DstInfo) =
2016 computeAddrForCallArg(dl, DAG, NextVA, StackPtr, IsTailCall, SPDiff);
2033 SelectionDAG &DAG = CLI.
DAG;
2035 SmallVectorImpl<ISD::OutputArg> &Outs = CLI.
Outs;
2036 SmallVectorImpl<SDValue> &OutVals = CLI.
OutVals;
2037 SmallVectorImpl<ISD::InputArg> &Ins = CLI.
Ins;
2044 const CallBase *CB = CLI.
CB;
2047 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
2049 MachineFunction::CallSiteInfo CSInfo;
2050 bool isStructRet = (Outs.
empty()) ?
false : Outs[0].Flags.isSRet();
2051 bool isThisReturn =
false;
2052 bool isCmseNSCall =
false;
2053 bool isSibCall =
false;
2054 bool PreferIndirect =
false;
2055 bool GuardWithBTI =
false;
2065 !Subtarget->noBTIAtReturnTwice())
2073 isCmseNSCall =
true;
2076 if (!Subtarget->supportsTailCall())
2092 PreferIndirect = Subtarget->isThumb() && Subtarget->hasMinSize() &&
2093 count_if(GV->users(), [&BB](
const User *U) {
2094 return isa<Instruction>(U) &&
2095 cast<Instruction>(U)->getParent() == BB;
2102 IsEligibleForTailCallOptimization(CLI, CCInfo, ArgLocs, PreferIndirect);
2116 "site marked musttail");
2119 unsigned NumBytes = CCInfo.getStackSize();
2128 if (isTailCall && !isSibCall) {
2129 auto FuncInfo = MF.
getInfo<ARMFunctionInfo>();
2130 unsigned NumReusableBytes = FuncInfo->getArgumentStackSize();
2135 assert(StackAlign &&
"data layout string is missing stack alignment");
2136 NumBytes =
alignTo(NumBytes, *StackAlign);
2141 SPDiff = NumReusableBytes - NumBytes;
2145 if (SPDiff < 0 && AFI->getArgRegsSaveSize() < (
unsigned)-SPDiff)
2161 RegsToPassVector RegsToPass;
2169 for (
const ForwardedRegister &
F : Forwards) {
2171 RegsToPass.push_back(std::make_pair(
F.PReg, Val));
2181 DenseMap<unsigned, SDValue> ByValTemporaries;
2185 for (
const CCValAssign &VA : ArgLocs) {
2187 SDValue Src = OutVals[ArgIdx];
2188 ISD::ArgFlagsTy
Flags = Outs[ArgIdx].Flags;
2190 if (!
Flags.isByVal())
2194 MachinePointerInfo DstInfo;
2195 std::tie(Dst, DstInfo) =
2196 computeAddrForCallArg(dl, DAG, VA,
SDValue(),
true, SPDiff);
2197 ByValCopyKind
Copy = ByValNeedsCopyForTailCall(DAG, Src, Dst, Flags);
2199 if (Copy == NoCopy) {
2204 }
else if (Copy == CopyOnce) {
2208 ByValTemporaries[ArgIdx] = Src;
2210 assert(Copy == CopyViaTemp &&
"unexpected enum value");
2214 int TempFrameIdx = MFI.CreateStackObject(
2215 Flags.getByValSize(),
Flags.getNonZeroByValAlign(),
false);
2223 SDVTList VTs = DAG.
getVTList(MVT::Other, MVT::Glue);
2224 SDValue Ops[] = {Chain, Temp, Src, SizeNode, AlignNode};
2226 DAG.
getNode(ARMISD::COPY_STRUCT_BYVAL, dl, VTs,
Ops));
2227 ByValTemporaries[ArgIdx] = Temp;
2230 if (!ByValCopyChains.
empty())
2240 bool AfterFormalArgLoads =
false;
2244 for (
unsigned i = 0, realArgIdx = 0, e = ArgLocs.size();
2246 ++i, ++realArgIdx) {
2247 CCValAssign &VA = ArgLocs[i];
2248 SDValue Arg = OutVals[realArgIdx];
2249 ISD::ArgFlagsTy
Flags = Outs[realArgIdx].Flags;
2250 bool isByVal =
Flags.isByVal();
2270 if (isTailCall && VA.
isMemLoc() && !AfterFormalArgLoads) {
2272 if (ByValTempChain) {
2277 for (
unsigned I = 0;
I < OutVals.
size(); ++
I) {
2278 if (Outs[
I].
Flags.isByVal())
2286 FrameIndexSDNode *FIN =
2291 if (!MFI.isFixedObjectIndex(FIN->
getIndex()))
2294 for (
const CCValAssign &VA : ArgLocs) {
2302 if (!IncomingLoad.
empty()) {
2310 AfterFormalArgLoads =
true;
2322 auto ArgVT = Outs[realArgIdx].ArgVT;
2323 if (isCmseNSCall && (ArgVT == MVT::f16)) {
2341 PassF64ArgInRegs(dl, DAG, Chain, Op0, RegsToPass, VA, ArgLocs[++i],
2342 StackPtr, MemOpChains, isTailCall, SPDiff);
2346 PassF64ArgInRegs(dl, DAG, Chain, Op1, RegsToPass, VA, ArgLocs[++i],
2347 StackPtr, MemOpChains, isTailCall, SPDiff);
2351 MachinePointerInfo DstInfo;
2352 std::tie(DstAddr, DstInfo) =
2353 computeAddrForCallArg(dl, DAG, VA, StackPtr, isTailCall, SPDiff);
2357 PassF64ArgInRegs(dl, DAG, Chain, Arg, RegsToPass, VA, ArgLocs[++i],
2358 StackPtr, MemOpChains, isTailCall, SPDiff);
2360 if (realArgIdx == 0 &&
Flags.isReturned() && !
Flags.isSwiftSelf() &&
2361 Outs[0].VT == MVT::i32) {
2363 "unexpected calling convention register assignment");
2365 "unexpected use of 'returned'");
2366 isThisReturn =
true;
2371 RegsToPass.push_back(std::make_pair(VA.
getLocReg(), Arg));
2372 }
else if (isByVal) {
2374 unsigned offset = 0;
2378 unsigned ByValArgsCount = CCInfo.getInRegsParamsCount();
2379 unsigned CurByValIdx = CCInfo.getInRegsParamsProcessed();
2382 bool NeedsStackCopy;
2383 if (
auto It = ByValTemporaries.
find(realArgIdx);
2384 It != ByValTemporaries.
end()) {
2385 ByValSrc = It->second;
2386 NeedsStackCopy =
true;
2389 NeedsStackCopy = !isTailCall;
2393 if (CurByValIdx < ByValArgsCount) {
2394 unsigned RegBegin, RegEnd;
2395 CCInfo.getInRegsParamInfo(CurByValIdx, RegBegin, RegEnd);
2399 for (i = 0, j = RegBegin;
j < RegEnd; i++,
j++) {
2403 DAG.
getLoad(PtrVT, dl, Chain, AddArg, MachinePointerInfo(),
2406 RegsToPass.push_back(std::make_pair(j,
Load));
2411 offset = RegEnd - RegBegin;
2413 CCInfo.nextInRegsParam();
2418 if (NeedsStackCopy &&
Flags.getByValSize() > 4 * offset) {
2421 MachinePointerInfo DstInfo;
2422 std::tie(Dst, DstInfo) =
2423 computeAddrForCallArg(dl, DAG, VA, StackPtr, isTailCall, SPDiff);
2431 SDVTList VTs = DAG.
getVTList(MVT::Other, MVT::Glue);
2432 SDValue Ops[] = { Chain, Dst, Src, SizeNode, AlignNode};
2439 MachinePointerInfo DstInfo;
2440 std::tie(DstAddr, DstInfo) =
2441 computeAddrForCallArg(dl, DAG, VA, StackPtr, isTailCall, SPDiff);
2448 if (!MemOpChains.
empty())
2454 for (
const auto &[
Reg,
N] : RegsToPass) {
2462 bool isDirect =
false;
2465 const Triple &
TT = TM.getTargetTriple();
2466 const GlobalValue *GVal =
nullptr;
2468 GVal =
G->getGlobal();
2469 bool isStub = !TM.shouldAssumeDSOLocal(GVal) &&
TT.isOSBinFormatMachO();
2471 bool isARMFunc = !Subtarget->isThumb() || (isStub && !Subtarget->isMClass());
2472 bool isLocalARMFunc =
false;
2475 if (Subtarget->genLongCalls()) {
2477 if (isPIC && Subtarget->genExecuteOnly())
2479 "position-independent code is not supported");
2480 if (Subtarget->isROPI())
2487 if (Subtarget->genExecuteOnly()) {
2490 if (Subtarget->useMovt())
2513 Addr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, Addr);
2519 const char *Sym = S->getSymbol();
2521 if (Subtarget->genExecuteOnly()) {
2524 if (Subtarget->useMovt())
2531 unsigned PCAdj = Subtarget->isThumb() ? 4 : 8;
2537 CPAddr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
2542 Callee = DAG.
getNode(ARMISD::PIC_ADD, dl, PtrVt, GOTOffset, PICLabel);
2554 Addr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, Addr);
2561 if (!PreferIndirect) {
2566 isLocalARMFunc = !Subtarget->isThumb() && (isDef || !
ARMInterworking);
2568 if (isStub && Subtarget->isThumb1Only() && !Subtarget->hasV5TOps()) {
2569 assert(
TT.isOSBinFormatMachO() &&
"WrapperPIC use on non-MachO?");
2571 ARMISD::WrapperPIC, dl, PtrVt,
2578 }
else if (Subtarget->isTargetCOFF()) {
2579 assert(Subtarget->isTargetWindows() &&
2580 "Windows is the only supported COFF target");
2584 else if (!TM.shouldAssumeDSOLocal(GVal))
2591 DAG.
getNode(ARMISD::Wrapper, dl, PtrVt, Callee),
2600 const char *Sym = S->getSymbol();
2601 if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget->hasV5TOps()) {
2603 ARMConstantPoolValue *CPV =
2605 ARMPCLabelIndex, 4);
2607 CPAddr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
2612 Callee = DAG.
getNode(ARMISD::PIC_ADD, dl, PtrVt, Callee, PICLabel);
2619 assert(!isARMFunc && !isDirect &&
2620 "Cannot handle call to ARM function or direct call");
2624 "call to non-secure function would require "
2625 "passing arguments on stack",
2631 "call to non-secure function would return value through pointer",
2638 if (Subtarget->isThumb()) {
2640 CallOpc = ARMISD::t2CALL_BTI;
2641 else if (isCmseNSCall)
2642 CallOpc = ARMISD::tSECALL;
2643 else if ((!isDirect || isARMFunc) && !Subtarget->hasV5TOps())
2644 CallOpc = ARMISD::CALL_NOLINK;
2646 CallOpc = ARMISD::CALL;
2648 if (!isDirect && !Subtarget->hasV5TOps())
2649 CallOpc = ARMISD::CALL_NOLINK;
2650 else if (doesNotRet && isDirect && Subtarget->hasRetAddrStack() &&
2652 !Subtarget->hasMinSize())
2654 CallOpc = ARMISD::CALL_NOLINK;
2656 CallOpc = isLocalARMFunc ? ARMISD::CALL_PRED : ARMISD::CALL;
2663 if (isTailCall && !isSibCall) {
2668 std::vector<SDValue>
Ops;
2669 Ops.push_back(Chain);
2670 Ops.push_back(Callee);
2678 for (
const auto &[
Reg,
N] : RegsToPass)
2682 const uint32_t *
Mask;
2683 const ARMBaseRegisterInfo *ARI = Subtarget->getRegisterInfo();
2691 isThisReturn =
false;
2697 assert(Mask &&
"Missing call preserved mask for calling convention");
2701 Ops.push_back(InGlue);
2714 Chain = DAG.
getNode(CallOpc, dl, {MVT::Other, MVT::Glue},
Ops);
2728 Chain = DAG.
getCALLSEQ_END(Chain, NumBytes, CalleePopBytes, InGlue, dl);
2734 return LowerCallResult(Chain, InGlue, CallConv, isVarArg, Ins, dl, DAG,
2735 InVals, isThisReturn,
2736 isThisReturn ? OutVals[0] :
SDValue(), isCmseNSCall);
2743void ARMTargetLowering::HandleByVal(
CCState *State,
unsigned &
Size,
2744 Align Alignment)
const {
2752 unsigned AlignInRegs =
Alignment.value() / 4;
2753 unsigned Waste = (ARM::R4 -
Reg) % AlignInRegs;
2754 for (
unsigned i = 0; i < Waste; ++i)
2760 unsigned Excess = 4 * (ARM::R4 -
Reg);
2767 if (NSAAOffset != 0 &&
Size > Excess) {
2779 unsigned ByValRegBegin =
Reg;
2780 unsigned ByValRegEnd = std::min<unsigned>(
Reg +
Size / 4, ARM::R4);
2784 for (
unsigned i =
Reg + 1; i != ByValRegEnd; ++i)
2790 Size = std::max<int>(
Size - Excess, 0);
2798bool ARMTargetLowering::IsEligibleForTailCallOptimization(
2804 const SmallVectorImpl<ISD::OutputArg> &Outs = CLI.
Outs;
2805 const SmallVectorImpl<SDValue> &OutVals = CLI.
OutVals;
2806 const SmallVectorImpl<ISD::InputArg> &Ins = CLI.
Ins;
2807 const SelectionDAG &DAG = CLI.
DAG;
2812 assert(Subtarget->supportsTailCall());
2825 SmallSet<MCPhysReg, 5> AddressRegisters = {ARM::R0, ARM::R1, ARM::R2,
2827 if (!(Subtarget->isThumb1Only() ||
2828 MF.
getInfo<ARMFunctionInfo>()->shouldSignReturnAddress(
true)))
2829 AddressRegisters.
insert(ARM::R12);
2830 for (
const CCValAssign &AL : ArgLocs)
2832 AddressRegisters.
erase(
AL.getLocReg());
2833 if (AddressRegisters.
empty()) {
2834 LLVM_DEBUG(
dbgs() <<
"false (no reg to hold function pointer)\n");
2853 <<
" (guaranteed tail-call CC)\n");
2854 return CalleeCC == CallerCC;
2859 bool isCalleeStructRet = Outs.
empty() ?
false : Outs[0].Flags.isSRet();
2861 if (isCalleeStructRet != isCallerStructRet) {
2874 const GlobalValue *GV =
G->getGlobal();
2877 (!
TT.isOSWindows() ||
TT.isOSBinFormatELF() ||
2878 TT.isOSBinFormatMachO())) {
2895 const ARMBaseRegisterInfo *
TRI = Subtarget->getRegisterInfo();
2896 const uint32_t *CallerPreserved =
TRI->getCallPreservedMask(MF, CallerCC);
2897 if (CalleeCC != CallerCC) {
2898 const uint32_t *CalleePreserved =
TRI->getCallPreservedMask(MF, CalleeCC);
2899 if (!
TRI->regmaskSubsetEqual(CallerPreserved, CalleePreserved)) {
2908 const ARMFunctionInfo *AFI_Caller = MF.
getInfo<ARMFunctionInfo>();
2918 LLVM_DEBUG(
dbgs() <<
"false (parameters in CSRs do not match)\n");
2937 CCState CCInfo(CallConv, isVarArg, MF, RVLocs,
Context);
2946 StringRef IntKind =
F.getFnAttribute(
"interrupt").getValueAsString();
2959 if (IntKind ==
"" || IntKind ==
"IRQ" || IntKind ==
"FIQ" ||
2962 else if (IntKind ==
"SWI" || IntKind ==
"UNDEF")
2966 "must be one of: IRQ, FIQ, SWI, ABORT or UNDEF");
2971 return DAG.
getNode(ARMISD::INTRET_GLUE,
DL, MVT::Other, RetOps);
2993 bool isLittleEndian = Subtarget->isLittle();
2996 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
3005 "secure entry function would return value through pointer",
3010 for (
unsigned i = 0, realRVLocIdx = 0;
3012 ++i, ++realRVLocIdx) {
3013 CCValAssign &VA = RVLocs[i];
3016 SDValue Arg = OutVals[realRVLocIdx];
3017 bool ReturnF16 =
false;
3019 if (Subtarget->hasFullFP16() && Subtarget->isTargetHardFloat()) {
3052 auto RetVT = Outs[realRVLocIdx].ArgVT;
3074 DAG.
getVTList(MVT::i32, MVT::i32), Half);
3078 HalfGPRs.
getValue(isLittleEndian ? 0 : 1), Glue);
3084 HalfGPRs.
getValue(isLittleEndian ? 1 : 0), Glue);
3096 DAG.
getVTList(MVT::i32, MVT::i32), Arg);
3098 fmrrd.
getValue(isLittleEndian ? 0 : 1), Glue);
3103 fmrrd.
getValue(isLittleEndian ? 1 : 0), Glue);
3113 const ARMBaseRegisterInfo *
TRI = Subtarget->getRegisterInfo();
3139 !Subtarget->isMClass()) {
3140 if (Subtarget->isThumb1Only())
3147 return DAG.
getNode(RetNode, dl, MVT::Other, RetOps);
3150bool ARMTargetLowering::isUsedByReturnOnly(
SDNode *
N,
SDValue &Chain)
const {
3151 if (
N->getNumValues() != 1)
3153 if (!
N->hasNUsesOfValue(1, 0))
3157 SDNode *
Copy = *
N->user_begin();
3161 if (
Copy->getOperand(
Copy->getNumOperands()-1).getValueType() == MVT::Glue)
3163 TCChain =
Copy->getOperand(0);
3164 }
else if (
Copy->getOpcode() == ARMISD::VMOVRRD) {
3165 SDNode *VMov =
Copy;
3167 SmallPtrSet<SDNode*, 2>
Copies;
3168 for (SDNode *U : VMov->
users()) {
3176 for (SDNode *U : VMov->
users()) {
3177 SDValue UseChain =
U->getOperand(0);
3185 if (
U->getOperand(
U->getNumOperands() - 1).getValueType() == MVT::Glue)
3193 if (!
Copy->hasOneUse())
3200 if (
Copy->getOperand(
Copy->getNumOperands()-1).getValueType() == MVT::Glue)
3202 TCChain =
Copy->getOperand(0);
3207 bool HasRet =
false;
3208 for (
const SDNode *U :
Copy->users()) {
3209 if (
U->getOpcode() != ARMISD::RET_GLUE &&
3210 U->getOpcode() != ARMISD::INTRET_GLUE)
3222bool ARMTargetLowering::mayBeEmittedAsTailCall(
const CallInst *CI)
const {
3223 if (!Subtarget->supportsTailCall())
3240 &&
"LowerWRITE_REGISTER called for non-i64 type argument.");
3256 EVT PtrVT =
Op.getValueType();
3266 if (Subtarget->genExecuteOnly()) {
3271 auto GV =
new GlobalVariable(
3277 return LowerGlobalAddress(GA, DAG);
3283 if (Subtarget->isThumb1Only())
3284 CPAlign = std::max(CPAlign,
Align(4));
3290 return DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, Res);
3297 if (Subtarget->genExecuteOnly() && !Subtarget->hasV8MBaselineOps())
3306 unsigned ARMPCLabelIndex = 0;
3312 if (!IsPositionIndependent) {
3315 unsigned PCAdj =
Subtarget->isThumb() ? 4 : 8;
3322 CPAddr = DAG.
getNode(ARMISD::Wrapper,
DL, PtrVT, CPAddr);
3326 if (!IsPositionIndependent)
3329 return DAG.
getNode(ARMISD::PIC_ADD,
DL, PtrVT, Result, PICLabel);
3357ARMTargetLowering::LowerGlobalTLSAddressDarwin(
SDValue Op,
3360 "This function expects a Darwin target");
3365 SDValue DescAddr = LowerGlobalAddressDarwin(
Op, DAG);
3371 MVT::i32,
DL, Chain, DescAddr,
3386 auto ARI =
static_cast<const ARMRegisterInfo *
>(
TRI);
3395 Chain, FuncTLVGet, DAG.
getRegister(ARM::R0, MVT::i32),
3401ARMTargetLowering::LowerGlobalTLSAddressWindows(
SDValue Op,
3404 "Windows specific TLS lowering");
3428 TLSArray = DAG.
getLoad(PtrVT,
DL, Chain, TLSArray, MachinePointerInfo());
3436 TLSIndex = DAG.
getNode(ARMISD::Wrapper,
DL, PtrVT, TLSIndex);
3437 TLSIndex = DAG.
getLoad(PtrVT,
DL, Chain, TLSIndex, MachinePointerInfo());
3443 MachinePointerInfo());
3450 DAG.
getNode(ARMISD::Wrapper,
DL, MVT::i32,
3463 unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8;
3465 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
3467 ARMConstantPoolValue *CPV =
3478 Argument = DAG.
getNode(ARMISD::PIC_ADD, dl, PtrVT, Argument, PICLabel);
3485 TargetLowering::CallLoweringInfo CLI(DAG);
3490 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
3491 return CallResult.first;
3500 const GlobalValue *GV = GA->
getGlobal();
3506 SDValue ThreadPointer = DAG.
getNode(ARMISD::THREAD_POINTER, dl, PtrVT);
3510 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
3513 unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8;
3514 ARMConstantPoolValue *CPV =
3521 PtrVT, dl, Chain,
Offset,
3529 PtrVT, dl, Chain,
Offset,
3534 ARMConstantPoolValue *CPV =
3539 PtrVT, dl, Chain,
Offset,
3555 if (
TT.isOSDarwin())
3556 return LowerGlobalTLSAddressDarwin(
Op, DAG);
3558 if (
TT.isOSWindows())
3559 return LowerGlobalTLSAddressWindows(
Op, DAG);
3562 assert(
TT.isOSBinFormatELF() &&
"Only ELF implemented here");
3568 return LowerToTLSGeneralDynamicModel(GA, DAG);
3571 return LowerToTLSExecModels(GA, DAG, model);
3580 while (!Worklist.
empty()) {
3588 if (!
I ||
I->getParent()->getParent() !=
F)
3617 if (!GVar || !GVar->hasInitializer() ||
3618 !GVar->isConstant() || !GVar->hasGlobalUnnamedAddr() ||
3619 !GVar->hasLocalLinkage())
3624 auto *
Init = GVar->getInitializer();
3625 if ((
TLI->isPositionIndependent() ||
TLI->getSubtarget()->isROPI()) &&
3626 Init->needsDynamicRelocation())
3638 unsigned RequiredPadding = 4 - (
Size % 4);
3639 bool PaddingPossible =
3640 RequiredPadding == 4 || (CDAInit && CDAInit->isString());
3645 unsigned PaddedSize =
Size + ((RequiredPadding == 4) ? 0 : RequiredPadding);
3669 if (RequiredPadding != 4) {
3674 while (RequiredPadding--)
3686 ++NumConstpoolPromoted;
3687 return DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
3692 if (!(GV = GA->getAliaseeObject()))
3695 return V->isConstant();
3701 switch (
Subtarget->getTargetTriple().getObjectFormat()) {
3704 return LowerGlobalAddressWindows(
Op, DAG);
3706 return LowerGlobalAddressELF(
Op, DAG);
3708 return LowerGlobalAddressDarwin(
Op, DAG);
3720 if (GV->
isDSOLocal() && !Subtarget->genExecuteOnly())
3733 }
else if (Subtarget->isROPI() && IsRO) {
3738 }
else if (Subtarget->isRWPI() && !IsRO) {
3741 if (Subtarget->useMovt()) {
3744 RelAddr = DAG.
getNode(ARMISD::Wrapper, dl, PtrVT,
G);
3746 ARMConstantPoolValue *CPV =
3749 CPAddr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
3763 if (Subtarget->useMovt() || Subtarget->genExecuteOnly()) {
3764 if (Subtarget->useMovt())
3768 return DAG.
getNode(ARMISD::Wrapper, dl, PtrVT,
3772 CPAddr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
3781 assert(!Subtarget->isROPI() && !Subtarget->isRWPI() &&
3782 "ROPI/RWPI not currently supported for Darwin");
3787 if (Subtarget->useMovt())
3798 if (Subtarget->isGVIndirectSymbol(GV))
3807 "non-Windows COFF is not supported");
3808 assert(Subtarget->useMovt() &&
3809 "Windows on ARM expects to use movw/movt");
3810 assert(!Subtarget->isROPI() && !Subtarget->isRWPI() &&
3811 "ROPI/RWPI not currently supported for Windows");
3818 else if (!TM.shouldAssumeDSOLocal(GV))
3841 return DAG.
getNode(ARMISD::EH_SJLJ_SETJMP, dl,
3842 DAG.
getVTList(MVT::i32, MVT::Other),
Op.getOperand(0),
3843 Op.getOperand(1), Val);
3849 return DAG.
getNode(ARMISD::EH_SJLJ_LONGJMP, dl, MVT::Other,
Op.getOperand(0),
3856 return DAG.
getNode(ARMISD::EH_SJLJ_SETUP_DISPATCH, dl, MVT::Other,
3860SDValue ARMTargetLowering::LowerINTRINSIC_VOID(
3863 Op.getConstantOperandVal(
Op.getOperand(0).getValueType() == MVT::Other);
3867 case Intrinsic::arm_gnu_eabi_mcount: {
3873 const ARMBaseRegisterInfo *ARI = Subtarget->getRegisterInfo();
3874 const uint32_t *
Mask =
3876 assert(Mask &&
"Missing call preserved mask for calling convention");
3881 constexpr EVT ResultTys[] = {MVT::Other, MVT::Glue};
3885 if (Subtarget->isThumb())
3888 ARM::tBL_PUSHLR, dl, ResultTys,
3889 {ReturnAddress, DAG.getTargetConstant(ARMCC::AL, dl, PtrVT),
3890 DAG.getRegister(0, PtrVT), Callee, RegisterMask, Chain}),
3894 {ReturnAddress, Callee, RegisterMask, Chain}),
3903 unsigned IntNo =
Op.getConstantOperandVal(0);
3907 case Intrinsic::localaddress: {
3909 const auto *RegInfo = Subtarget->getRegisterInfo();
3910 unsigned Reg = RegInfo->getLocalAddressRegister(MF);
3912 Op.getSimpleValueType());
3914 case Intrinsic::eh_recoverfp: {
3920 "llvm.eh.recoverfp must take a function as the first argument");
3921 const auto *RegInfo = Subtarget->getRegisterInfo();
3924 MachineBasicBlock &
MBB = *MF.
begin();
3930 case Intrinsic::thread_pointer: {
3932 return DAG.
getNode(ARMISD::THREAD_POINTER, dl, PtrVT);
3934 case Intrinsic::arm_cls: {
3938 const SDValue &Operand =
Op.getOperand(1);
3939 const EVT VTy =
Op.getValueType();
3942 case Intrinsic::arm_cls64: {
3948 case Intrinsic::arm_neon_vcls:
3949 case Intrinsic::arm_mve_vcls: {
3952 const EVT VTy =
Op.getValueType();
3955 case Intrinsic::eh_sjlj_lsda: {
3957 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
3962 unsigned PCAdj = IsPositionIndependent ? (Subtarget->isThumb() ? 4 : 8) : 0;
3963 ARMConstantPoolValue *CPV =
3967 CPAddr = DAG.
getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
3972 if (IsPositionIndependent) {
3974 Result = DAG.
getNode(ARMISD::PIC_ADD, dl, PtrVT, Result, PICLabel);
3978 case Intrinsic::arm_neon_vabs:
3981 case Intrinsic::arm_neon_vabds:
3982 if (
Op.getValueType().isInteger())
3984 Op.getOperand(1),
Op.getOperand(2));
3986 case Intrinsic::arm_neon_vabdu:
3988 Op.getOperand(1),
Op.getOperand(2));
3989 case Intrinsic::arm_neon_vmulls:
3990 case Intrinsic::arm_neon_vmullu: {
3991 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmulls)
3992 ? ARMISD::VMULLs : ARMISD::VMULLu;
3993 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
3994 Op.getOperand(1),
Op.getOperand(2));
3996 case Intrinsic::arm_neon_vminnm:
3997 case Intrinsic::arm_neon_vmaxnm: {
3998 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vminnm)
4000 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
4001 Op.getOperand(1),
Op.getOperand(2));
4003 case Intrinsic::arm_neon_vminu:
4004 case Intrinsic::arm_neon_vmaxu: {
4005 if (
Op.getValueType().isFloatingPoint())
4007 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vminu)
4009 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
4010 Op.getOperand(1),
Op.getOperand(2));
4012 case Intrinsic::arm_neon_vmins:
4013 case Intrinsic::arm_neon_vmaxs: {
4015 if (!
Op.getValueType().isFloatingPoint()) {
4016 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmins)
4018 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
4019 Op.getOperand(1),
Op.getOperand(2));
4021 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmins)
4023 return DAG.
getNode(NewOpc, SDLoc(
Op),
Op.getValueType(),
4024 Op.getOperand(1),
Op.getOperand(2));
4026 case Intrinsic::arm_neon_vtbl1:
4027 return DAG.
getNode(ARMISD::VTBL1, SDLoc(
Op),
Op.getValueType(),
4028 Op.getOperand(1),
Op.getOperand(2));
4029 case Intrinsic::arm_neon_vtbl2:
4030 return DAG.
getNode(ARMISD::VTBL2, SDLoc(
Op),
Op.getValueType(),
4031 Op.getOperand(1),
Op.getOperand(2),
Op.getOperand(3));
4032 case Intrinsic::arm_mve_pred_i2v:
4033 case Intrinsic::arm_mve_pred_v2i:
4034 return DAG.
getNode(ARMISD::PREDICATE_CAST, SDLoc(
Op),
Op.getValueType(),
4036 case Intrinsic::arm_mve_vreinterpretq:
4037 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, SDLoc(
Op),
Op.getValueType(),
4039 case Intrinsic::arm_mve_lsll:
4040 return DAG.
getNode(ARMISD::LSLL, SDLoc(
Op),
Op->getVTList(),
4041 Op.getOperand(1),
Op.getOperand(2),
Op.getOperand(3));
4042 case Intrinsic::arm_mve_asrl:
4043 return DAG.
getNode(ARMISD::ASRL, SDLoc(
Op),
Op->getVTList(),
4044 Op.getOperand(1),
Op.getOperand(2),
Op.getOperand(3));
4045 case Intrinsic::arm_mve_vsli:
4046 return DAG.
getNode(ARMISD::VSLIIMM, SDLoc(
Op),
Op->getVTList(),
4047 Op.getOperand(1),
Op.getOperand(2),
Op.getOperand(3));
4048 case Intrinsic::arm_mve_vsri:
4049 return DAG.
getNode(ARMISD::VSRIIMM, SDLoc(
Op),
Op->getVTList(),
4050 Op.getOperand(1),
Op.getOperand(2),
Op.getOperand(3));
4066 "Unexpected ISD::ATOMIC_FENCE encountered. Should be libcall!");
4067 return DAG.
getNode(ARMISD::MEMBARRIER_MCR, dl, MVT::Other,
Op.getOperand(0),
4077 }
else if (
Subtarget->preferISHSTBarriers() &&
4086 DAG.
getConstant(Intrinsic::arm_dmb, dl, MVT::i32),
4096 return Op.getOperand(0);
4099 unsigned isRead =
~Op.getConstantOperandVal(2) & 1;
4103 return Op.getOperand(0);
4105 unsigned isData =
Op.getConstantOperandVal(4);
4108 isRead = ~isRead & 1;
4109 isData = ~isData & 1;
4112 return DAG.
getNode(ARMISD::PRELOAD, dl, MVT::Other,
Op.getOperand(0),
4127 return DAG.
getStore(
Op.getOperand(0), dl, FR,
Op.getOperand(1),
4135 const SDLoc &dl)
const {
4137 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
4141 RC = &ARM::tGPRRegClass;
4143 RC = &ARM::GPRRegClass;
4157 MVT::i32, dl, Root, FIN,
4163 if (!Subtarget->isLittle())
4165 return DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64, ArgValue, ArgValue2);
4178 const Value *OrigArg,
4179 unsigned InRegsParamRecordIdx,
4180 int ArgOffset,
unsigned ArgSize)
const {
4194 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
4195 unsigned RBegin, REnd;
4200 RBegin = RBeginIdx == 4 ? (unsigned)ARM::R4 :
GPRArgRegs[RBeginIdx];
4205 ArgOffset = -4 * (ARM::R4 - RBegin);
4215 for (
unsigned Reg = RBegin, i = 0;
Reg < REnd; ++
Reg, ++i) {
4219 MachinePointerInfo(OrigArg, 4 * i));
4224 if (!MemOps.
empty())
4233 unsigned TotalArgRegsSaveSize,
4234 bool ForceMutable)
const {
4236 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
4245 CCInfo.
getStackSize(), std::max(4U, TotalArgRegsSaveSize));
4249bool ARMTargetLowering::splitValueIntoRegisterParts(
4251 unsigned NumParts,
MVT PartVT, std::optional<CallingConv::ID>
CC)
const {
4253 if ((ValueVT == MVT::f16 || ValueVT == MVT::bf16) && PartVT == MVT::f32) {
4265SDValue ARMTargetLowering::joinRegisterPartsIntoValue(
4267 MVT PartVT,
EVT ValueVT, std::optional<CallingConv::ID>
CC)
const {
4268 if ((ValueVT == MVT::f16 || ValueVT == MVT::bf16) && PartVT == MVT::f32) {
4281SDValue ARMTargetLowering::LowerFormalArguments(
4288 ARMFunctionInfo *AFI = MF.
getInfo<ARMFunctionInfo>();
4297 unsigned CurArgIdx = 0;
4309 unsigned ArgRegBegin = ARM::R4;
4310 for (
const CCValAssign &VA : ArgLocs) {
4316 if (!
Flags.isByVal())
4320 unsigned RBegin, REnd;
4322 ArgRegBegin = std::min(ArgRegBegin, RBegin);
4328 int lastInsIndex = -1;
4332 ArgRegBegin = std::min(ArgRegBegin, (
unsigned)
GPRArgRegs[RegIdx]);
4335 unsigned TotalArgRegsSaveSize = 4 * (ARM::R4 - ArgRegBegin);
4339 for (
unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
4340 CCValAssign &VA = ArgLocs[i];
4341 if (Ins[VA.
getValNo()].isOrigArg()) {
4342 std::advance(CurOrigArg,
4343 Ins[VA.
getValNo()].getOrigArgIndex() - CurArgIdx);
4344 CurArgIdx = Ins[VA.
getValNo()].getOrigArgIndex();
4355 GetF64FormalArgument(VA, ArgLocs[++i], Chain, DAG, dl);
4362 MVT::f64, dl, Chain, FIN,
4365 ArgValue2 = GetF64FormalArgument(VA, ArgLocs[++i], Chain, DAG, dl);
4373 ArgValue = GetF64FormalArgument(VA, ArgLocs[++i], Chain, DAG, dl);
4377 if (RegVT == MVT::f16 || RegVT == MVT::bf16)
4378 RC = &ARM::HPRRegClass;
4379 else if (RegVT == MVT::f32)
4380 RC = &ARM::SPRRegClass;
4381 else if (RegVT == MVT::f64 || RegVT == MVT::v4f16 ||
4382 RegVT == MVT::v4bf16)
4383 RC = &ARM::DPRRegClass;
4384 else if (RegVT == MVT::v2f64 || RegVT == MVT::v8f16 ||
4385 RegVT == MVT::v8bf16)
4386 RC = &ARM::QPRRegClass;
4387 else if (RegVT == MVT::i32)
4389 : &ARM::GPRRegClass;
4426 const ISD::InputArg &Arg = Ins[VA.
getValNo()];
4435 assert(VA.
getValVT() != MVT::i64 &&
"i64 should already be lowered");
4441 if (index != lastInsIndex)
4443 ISD::ArgFlagsTy
Flags = Ins[index].Flags;
4449 if (
Flags.isByVal()) {
4450 assert(Ins[index].isOrigArg() &&
4451 "Byval arguments cannot be implicit");
4455 CCInfo, DAG, dl, Chain, &*CurOrigArg, CurByValIndex,
4489 lastInsIndex = index;
4496 VarArgStyleRegisters(CCInfo, DAG, dl, Chain, CCInfo.
getStackSize(),
4497 TotalArgRegsSaveSize);
4501 "secure entry function must not be variadic", dl.
getDebugLoc()));
4522 SmallVectorImpl<ForwardedRegister> &Forwards =
4535 assert(StackAlign &&
"data layout string is missing stack alignment");
4536 StackArgSize =
alignTo(StackArgSize, *StackAlign);
4545 "secure entry function requires arguments on stack", dl.
getDebugLoc()));
4554 return CFP->getValueAPF().isPosZero();
4557 if (
Op.getOperand(1).getOpcode() == ARMISD::Wrapper) {
4558 SDValue WrapperOp =
Op.getOperand(1).getOperand(0);
4561 return CFP->getValueAPF().isPosZero();
4564 Op->getValueType(0) == MVT::f64) {
4568 if (BitcastOp->
getOpcode() == ARMISD::VMOVIMM &&
4577 if (
Op->getFlags().hasNoSignedWrap())
4593 (isIntEqualitySetCC(
CC) ||
4603 if (ST.isThumb1Only() || !
Op.hasOneUse())
4606 unsigned Opc =
Op.getOpcode();
4609 return ShiftAmt->getZExtValue() <= 31 ? 1 : 0;
4612 return ST.isThumb() ? 0 : 1;
4620 return ST.isThumb() ? 0 : 1;
4636 uint32_t MaskValue = Mask->getZExtValue();
4639 if (!
isMask_32(MaskValue) || MaskValue == 1 || MaskValue == 0xff ||
4640 MaskValue == 0xffff || MaskValue == ~0U)
4652 const SDLoc &dl)
const {
4659 for (
unsigned I = 0;
I != 2; ++
I) {
4669 unsigned C = RHSC->getZExtValue();
4727 if (Subtarget->isThumb1Only() &&
LHS->getOpcode() ==
ISD::AND &&
4731 unsigned Mask =
LHS.getConstantOperandVal(1);
4733 uint64_t RHSV = RHSC->getZExtValue();
4734 if (
isMask_32(Mask) && (RHSV & ~Mask) == 0 && Mask != 255 && Mask != 65535) {
4736 if (RHSV && (RHSV > 255 || (RHSV << ShiftBits) <= 255)) {
4750 if (Subtarget->isThumb1Only() &&
LHS->getOpcode() ==
ISD::SHL &&
4753 LHS.getConstantOperandVal(1) < 31) {
4754 unsigned ShiftAmt =
LHS.getConstantOperandVal(1) + 1;
4764 unsigned CompareType;
4767 CompareType = ARMISD::CMP;
4772 CompareType = ARMISD::CMPZ;
4781 if (CompareType != ARMISD::CMPZ &&
isCMN(
RHS,
CC, DAG)) {
4782 CompareType = ARMISD::CMN;
4784 }
else if (CompareType != ARMISD::CMPZ &&
isCMN(
LHS,
CC, DAG)) {
4785 CompareType = ARMISD::CMN;
4799 if (CompareType == ARMISD::CMP)
4827 bool Signaling)
const {
4828 assert(Subtarget->hasFP64() ||
RHS.getValueType() != MVT::f64);
4834 Flags = DAG.
getNode(Signaling ? ARMISD::CMPFPEw0 : ARMISD::CMPFPw0, dl,
4843std::pair<SDValue, SDValue>
4846 assert(
Op.getValueType() == MVT::i32 &&
"Unsupported value type");
4858 switch (
Op.getOpcode()) {
4910 return std::make_pair(
Value, OverflowCmp);
4923 return Cmp.getValue(1);
4951 return DAG.
getNode(ARMISD::CMOV,
DL, VT,
Zero, One, ARMcc, Flags);
4963 EVT VT =
Op.getValueType();
4964 SDVTList VTs = DAG.
getVTList(VT, MVT::i32);
4967 switch (
Op.getOpcode()) {
4981 std::tie(
Value, OverflowCmp) = getARMXALUOOp(
Op, DAG, ARMcc);
4987 DAG.
getNode(ARMISD::CMOV, dl, MVT::i32,
4990 ARMcc, OverflowCmp);
5000 EVT VT =
Op.getValueType();
5011 switch (
Op->getOpcode()) {
5013 NewOpcode = ARMISD::UQADD8b;
5016 NewOpcode = ARMISD::QADD8b;
5019 NewOpcode = ARMISD::UQSUB8b;
5022 NewOpcode = ARMISD::QSUB8b;
5027 switch (
Op->getOpcode()) {
5029 NewOpcode = ARMISD::UQADD16b;
5032 NewOpcode = ARMISD::QADD16b;
5035 NewOpcode = ARMISD::UQSUB16b;
5038 NewOpcode = ARMISD::QSUB16b;
5046 DAG.
getNode(NewOpcode, dl, MVT::i32,
5057 unsigned Opc =
Cond.getOpcode();
5059 if (
Cond.getResNo() == 1 &&
5067 std::tie(
Value, OverflowCmp) = getARMXALUOOp(
Cond, DAG, ARMcc);
5068 EVT VT =
Op.getValueType();
5070 return getCMOV(dl, VT, SelectTrue, SelectFalse, ARMcc, OverflowCmp, DAG);
5078 if (
Cond.getOpcode() == ARMISD::CMOV &&
Cond.hasOneUse()) {
5079 const ConstantSDNode *CMOVTrue =
5081 const ConstantSDNode *CMOVFalse =
5084 if (CMOVTrue && CMOVFalse) {
5090 if (CMOVTrueVal == 1 && CMOVFalseVal == 0) {
5092 False = SelectFalse;
5093 }
else if (CMOVTrueVal == 0 && CMOVFalseVal == 1) {
5099 return getCMOV(dl,
Op.getValueType(),
True,
False,
Cond.getOperand(2),
5100 Cond.getOperand(3), DAG);
5110 bool &swpCmpOps,
bool &swpVselOps) {
5138 swpCmpOps = !swpCmpOps;
5139 swpVselOps = !swpVselOps;
5162 if (!Subtarget->hasFP64() && VT == MVT::f64) {
5164 DAG.
getVTList(MVT::i32, MVT::i32), FalseVal);
5166 DAG.
getVTList(MVT::i32, MVT::i32), TrueVal);
5180 return DAG.
getNode(ARMISD::CMOV, dl, VT, FalseVal, TrueVal, ARMcc, Flags);
5201 ((
K ==
LHS &&
K == TrueVal) || (
K ==
RHS &&
K == FalseVal))) ||
5203 ((
K ==
RHS &&
K == TrueVal) || (
K ==
LHS &&
K == FalseVal)));
5224 EVT VT =
Op.getValueType();
5246 if (V1Tmp != TrueVal1 || V2Tmp != TrueVal2 || K1 != FalseVal1 ||
5259 int64_t PosVal = std::max(Val1, Val2);
5260 int64_t NegVal = std::min(Val1, Val2);
5272 return DAG.
getNode(ARMISD::SSAT, dl, VT, V2Tmp,
5275 return DAG.
getNode(ARMISD::USAT, dl, VT, V2Tmp,
5307 V = (KTmp == TrueVal) ? FalseVal : TrueVal;
5312 if (*
K != KTmp ||
V != VTmp)
5323bool ARMTargetLowering::isUnsupportedFloatingType(
EVT VT)
const {
5325 return !Subtarget->hasVFP2Base();
5327 return !Subtarget->hasFP64();
5329 return !Subtarget->hasFullFP16();
5337 if (!CFVal || !CTVal || !
Subtarget->hasV8_1MMainlineOps())
5345 if (TVal == ~FVal) {
5346 Opcode = ARMISD::CSINV;
5347 }
else if (TVal == ~FVal + 1) {
5348 Opcode = ARMISD::CSNEG;
5349 }
else if (TVal + 1 == FVal) {
5350 Opcode = ARMISD::CSINC;
5351 }
else if (TVal == FVal + 1) {
5352 Opcode = ARMISD::CSINC;
5355 InvertCond = !InvertCond;
5362 if (Opcode != ARMISD::CSINC &&
5366 InvertCond = !InvertCond;
5372 if (FVal == 0 && Opcode != ARMISD::CSINC) {
5375 InvertCond = !InvertCond;
5382 EVT VT =
Op.getValueType();
5386 if ((!Subtarget->isThumb() && Subtarget->hasV6Ops()) || Subtarget->isThumb2())
5398 if (VT == MVT::i32 &&
5417 if (
Op.getValueType().isInteger()) {
5425 LHS.getValueType() ==
RHS.getValueType()) {
5426 EVT VT =
LHS.getValueType();
5432 Shift = DAG.
getNOT(dl, Shift, VT);
5444 if (
LHS.getValueType() == MVT::i32) {
5448 matchCSET(Opcode, InvertCond, TrueVal, FalseVal, Subtarget)) {
5454 EVT VT =
Op.getValueType();
5455 return DAG.
getNode(Opcode, dl, VT,
Op,
Op, ARMcc, Cmp);
5459 if (isUnsupportedFloatingType(
LHS.getValueType())) {
5464 if (!
RHS.getNode()) {
5470 if (
LHS.getValueType() == MVT::i32) {
5481 if (Subtarget->hasFPARMv8Base() && (
TrueVal.getValueType() == MVT::f16 ||
5482 TrueVal.getValueType() == MVT::f32 ||
5483 TrueVal.getValueType() == MVT::f64)) {
5497 return getCMOV(dl, VT, FalseVal, TrueVal, ARMcc, Cmp, DAG);
5507 if (Subtarget->hasFPARMv8Base() &&
5509 (
TrueVal.getValueType() == MVT::f16 ||
5510 TrueVal.getValueType() == MVT::f32 ||
5511 TrueVal.getValueType() == MVT::f64)) {
5512 bool swpCmpOps =
false;
5513 bool swpVselOps =
false;
5527 SDValue Result = getCMOV(dl, VT, FalseVal, TrueVal, ARMcc, Cmp, DAG);
5530 Result = getCMOV(dl, VT, Result, TrueVal, ARMcc2, Cmp, DAG);
5540 if (!
N->hasOneUse())
5543 if (!
N->getNumValues())
5545 EVT VT =
Op.getValueType();
5546 if (VT != MVT::f32 && !
Subtarget->isFPBrccSlow())
5563 return DAG.
getLoad(MVT::i32,
SDLoc(
Op), Ld->getChain(), Ld->getBasePtr(),
5564 Ld->getPointerInfo(), Ld->getAlign(),
5565 Ld->getMemOperand()->getFlags());
5581 SDValue Ptr = Ld->getBasePtr();
5583 DAG.
getLoad(MVT::i32, dl, Ld->getChain(), Ptr, Ld->getPointerInfo(),
5584 Ld->getAlign(), Ld->getMemOperand()->
getFlags());
5589 RetVal2 = DAG.
getLoad(MVT::i32, dl, Ld->getChain(), NewPtr,
5590 Ld->getPointerInfo().getWithOffset(4),
5592 Ld->getMemOperand()->getFlags());
5610 bool LHSSeenZero =
false;
5612 bool RHSSeenZero =
false;
5614 if (LHSOk && RHSOk && (LHSSeenZero || RHSSeenZero)) {
5625 if (
LHS.getValueType() == MVT::f32) {
5631 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, Dest, ARMcc,
5643 SDValue Ops[] = { Chain, ARMcc, LHS1, LHS2, RHS1, RHS2, Dest };
5644 return DAG.
getNode(ARMISD::BCC_i64, dl, MVT::Other,
Ops);
5659 return DAG.
getNode(ARMISD::CMOV,
DL, MVT::i32,
Op.getOperand(0), Neg,
5678 unsigned Opc =
Cond.getOpcode();
5680 !Subtarget->isThumb1Only();
5681 if (
Cond.getResNo() == 1 &&
5691 std::tie(
Value, OverflowCmp) = getARMXALUOOp(
Cond, DAG, ARMcc);
5696 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, Dest, ARMcc,
5711 if (isUnsupportedFloatingType(
LHS.getValueType())) {
5716 if (!
RHS.getNode()) {
5724 unsigned Opc =
LHS.getOpcode();
5726 !Subtarget->isThumb1Only();
5738 std::tie(
Value, OverflowCmp) = getARMXALUOOp(
LHS.getValue(0), DAG, ARMcc);
5745 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, Dest, ARMcc,
5749 if (
LHS.getValueType() == MVT::i32) {
5752 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, Dest, ARMcc, Cmp);
5755 SDNodeFlags
Flags =
Op->getFlags();
5756 if (
Flags.hasNoNaNs() &&
5761 if (
SDValue Result = OptimizeVFPBrcond(
Op, DAG))
5775 Res = DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other,
Ops);
5789 Table = DAG.
getNode(ARMISD::WrapperJT, dl, MVT::i32, JTI);
5792 if (Subtarget->isThumb2() || (Subtarget->hasV8MBaselineOps() && Subtarget->isThumb())) {
5797 return DAG.
getNode(ARMISD::BR2_JT, dl, MVT::Other, Chain,
5798 Addr,
Op.getOperand(2), JTI);
5802 DAG.
getLoad((EVT)MVT::i32, dl, Chain, Addr,
5806 return DAG.
getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI);
5809 DAG.
getLoad(PTy, dl, Chain, Addr,
5812 return DAG.
getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI);
5817 EVT VT =
Op.getValueType();
5820 if (
Op.getValueType().getVectorElementType() == MVT::i32) {
5821 if (
Op.getOperand(0).getValueType().getVectorElementType() == MVT::f32)
5829 const EVT OpTy =
Op.getOperand(0).getValueType();
5830 if (
OpTy == MVT::v4f32)
5832 else if (
OpTy == MVT::v4f16 && HasFullFP16)
5834 else if (
OpTy == MVT::v8f16 && HasFullFP16)
5839 if (VT != MVT::v4i16 && VT != MVT::v8i16)
5842 Op = DAG.
getNode(
Op.getOpcode(), dl, NewTy,
Op.getOperand(0));
5847 EVT VT =
Op.getValueType();
5851 bool IsStrict =
Op->isStrictFPOpcode();
5852 SDValue SrcVal =
Op.getOperand(IsStrict ? 1 : 0);
5854 if (isUnsupportedFloatingType(SrcVal.
getValueType())) {
5867 std::tie(Result, Chain) =
makeLibCall(DAG, LC,
Op.getValueType(), SrcVal,
5868 CallOptions, Loc, Chain);
5877 EVT VT =
Op.getValueType();
5879 EVT FromVT =
Op.getOperand(0).getValueType();
5881 if (VT == MVT::i32 && ToVT == MVT::i32 && FromVT == MVT::f32)
5883 if (VT == MVT::i32 && ToVT == MVT::i32 && FromVT == MVT::f64 &&
5886 if (VT == MVT::i32 && ToVT == MVT::i32 && FromVT == MVT::f16 &&
5889 if (VT == MVT::v4i32 && ToVT == MVT::i32 && FromVT == MVT::v4f32 &&
5892 if (VT == MVT::v8i16 && ToVT == MVT::i16 && FromVT == MVT::v8f16 &&
5896 if (FromVT != MVT::v4f32 && FromVT != MVT::v8f16)
5913 EVT VT =
Op.getValueType();
5916 if (
Op.getOperand(0).getValueType().getVectorElementType() == MVT::i32) {
5922 assert((
Op.getOperand(0).getValueType() == MVT::v4i16 ||
5923 Op.getOperand(0).getValueType() == MVT::v8i16) &&
5924 "Invalid type for custom lowering!");
5929 if (VT == MVT::v4f32)
5930 DestVecType = MVT::v4i32;
5931 else if (VT == MVT::v4f16 && HasFullFP16)
5932 DestVecType = MVT::v4i16;
5933 else if (VT == MVT::v8f16 && HasFullFP16)
5934 DestVecType = MVT::v8i16;
5940 switch (
Op.getOpcode()) {
5952 Op = DAG.
getNode(CastOpc, dl, DestVecType,
Op.getOperand(0));
5957 EVT VT =
Op.getValueType();
5961 bool IsStrict =
Op->isStrictFPOpcode();
5962 SDValue SrcVal =
Op.getOperand(IsStrict ? 1 : 0);
5964 if (isUnsupportedFloatingType(VT)) {
5975 std::tie(Result, Chain) =
makeLibCall(DAG, LC,
Op.getValueType(), SrcVal,
5976 CallOptions, Loc, Chain);
5988 EVT VT =
Op.getValueType();
5992 bool UseNEON = !InGPR && Subtarget->hasNEON();
5999 EVT OpVT = (VT == MVT::f32) ? MVT::v2i32 : MVT::v1i64;
6006 if (SrcVT == MVT::f32) {
6009 Tmp1 = DAG.
getNode(ARMISD::VSHLIMM, dl, OpVT,
6012 }
else if (VT == MVT::f32)
6013 Tmp1 = DAG.
getNode(ARMISD::VSHRuIMM, dl, MVT::v1i64,
6028 if (VT == MVT::f32) {
6040 if (SrcVT == MVT::f64)
6049 if (VT == MVT::f32) {
6062 return DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64,
Lo,
Hi);
6070 EVT VT =
Op.getValueType();
6072 unsigned Depth =
Op.getConstantOperandVal(0);
6074 SDValue FrameAddr = LowerFRAMEADDR(
Op, DAG);
6078 MachinePointerInfo());
6087 const ARMBaseRegisterInfo &ARI =
6088 *
static_cast<const ARMBaseRegisterInfo*
>(RegInfo);
6093 EVT VT =
Op.getValueType();
6095 unsigned Depth =
Op.getConstantOperandVal(0);
6100 MachinePointerInfo());
6108 return StringSwitch<Register>(
RegName)
6109 .Case(
"sp", ARM::SP)
6120 assert(
N->getValueType(0) == MVT::i64
6121 &&
"ExpandREAD_REGISTER called for non-i64 type result.");
6124 DAG.
getVTList(MVT::i32, MVT::i32, MVT::Other),
6164 const APInt &APIntIndex = Index->getAPIntValue();
6166 NewIndex *= APIntIndex;
6195 EVT SrcVT =
Op.getValueType();
6196 EVT DstVT =
N->getValueType(0);
6198 if ((SrcVT == MVT::f16 || SrcVT == MVT::bf16) &&
6199 (DstVT == MVT::f16 || DstVT == MVT::bf16))
6202 if ((SrcVT == MVT::i16 || SrcVT == MVT::i32) &&
6203 (DstVT == MVT::f16 || DstVT == MVT::bf16)) {
6205 if (Subtarget->hasFullFP16())
6206 return DAG.
getNode(ARMISD::VMOVhr, dl, DstVT, Ext);
6207 return DAG.
getNode(ARMISD::VMOVsr, dl, DstVT, Ext);
6210 if ((DstVT == MVT::i16 || DstVT == MVT::i32) &&
6211 (SrcVT == MVT::f16 || SrcVT == MVT::bf16)) {
6212 if (Subtarget->hasFullFP16() && !Subtarget->hasBF16())
6219 if (!(SrcVT == MVT::i64 || DstVT == MVT::i64))
6231 DAG.
getNode(ARMISD::VMOVDRR, dl, MVT::f64,
Lo,
Hi));
6239 Cvt = DAG.
getNode(ARMISD::VMOVRRD, dl,
6241 DAG.
getNode(ARMISD::VREV64, dl, SrcVT,
Op));
6243 Cvt = DAG.
getNode(ARMISD::VMOVRRD, dl,
6263 SDValue Vmov = DAG.
getNode(ARMISD::VMOVIMM, dl, VmovVT, EncodedVal);
6272 EVT VT =
Op.getValueType();
6294 DAG.
getNode(ARMISD::CMOV, dl, VT, LoSmallShift, LoBigShift, ARMcc, CmpLo);
6304 DAG.
getNode(ARMISD::CMOV, dl, VT, HiSmallShift, HiBigShift, ARMcc, CmpHi);
6315 EVT VT =
Op.getValueType();
6336 DAG.
getNode(ARMISD::CMOV, dl, VT, HiSmallShift, HiBigShift, ARMcc, CmpHi);
6357 DAG.
getConstant(Intrinsic::arm_get_fpscr, dl, MVT::i32)};
6409 Chain, DAG.
getConstant(Intrinsic::arm_set_fpscr,
DL, MVT::i32), FPSCR};
6437 Chain, DAG.
getConstant(Intrinsic::arm_set_fpscr,
DL, MVT::i32), FPSCR};
6467 EVT VT =
N->getValueType(0);
6468 if (VT.
isVector() && ST->hasNEON()) {
6488 unsigned NumBits =
ElemTy.getSizeInBits();
6490 DAG.
getNode(ARMISD::VMOVIMM, dl, VT,
6500 if (
ElemTy == MVT::i64) {
6513 if (!ST->hasV6T2Ops())
6522 EVT VT =
N->getValueType(0);
6525 assert(ST->hasNEON() &&
"Custom ctpop lowering requires NEON.");
6526 assert((VT == MVT::v1i64 || VT == MVT::v2i64 || VT == MVT::v2i32 ||
6527 VT == MVT::v4i32 || VT == MVT::v4i16 || VT == MVT::v8i16) &&
6528 "Unexpected type for custom ctpop lowering");
6536 unsigned EltSize = 8;
6559 Op =
Op.getOperand(0);
6561 APInt SplatBits, SplatUndef;
6562 unsigned SplatBitSize;
6565 !BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs,
6567 SplatBitSize > ElementBits)
6578 assert(VT.
isVector() &&
"vector shift count is not a vector type");
6582 return (Cnt >= 0 && (isLong ? Cnt - 1 : Cnt) < ElementBits);
6593 assert(VT.
isVector() &&
"vector shift count is not a vector type");
6598 return (Cnt >= 1 && Cnt <= (isNarrow ? ElementBits / 2 : ElementBits));
6599 if (Cnt >= -(isNarrow ? ElementBits / 2 : ElementBits) && Cnt <= -1) {
6608 EVT VT =
N->getValueType(0);
6623 return DAG.
getNode(ARMISD::VSHLIMM, dl, VT,
N->getOperand(0),
6625 return DAG.
getNode(ARMISD::VSHLu, dl, VT,
N->getOperand(0),
6630 "unexpected vector shift opcode");
6632 if (
isVShiftRImm(
N->getOperand(1), VT,
false,
false, Cnt)) {
6633 unsigned VShiftOpc =
6634 (
N->getOpcode() ==
ISD::SRA ? ARMISD::VSHRsIMM : ARMISD::VSHRuIMM);
6635 return DAG.
getNode(VShiftOpc, dl, VT,
N->getOperand(0),
6641 EVT ShiftVT =
N->getOperand(1).getValueType();
6644 unsigned VShiftOpc =
6645 (
N->getOpcode() ==
ISD::SRA ? ARMISD::VSHLs : ARMISD::VSHLu);
6646 return DAG.
getNode(VShiftOpc, dl, VT,
N->getOperand(0), NegatedCount);
6651 EVT VT =
N->getValueType(0);
6660 "Unknown shift to lower!");
6662 unsigned ShOpc =
N->getOpcode();
6663 if (ST->hasMVEIntegerOps()) {
6665 unsigned ShPartsOpc = ARMISD::LSLL;
6686 ShPartsOpc = ARMISD::LSRL;
6688 ShPartsOpc = ARMISD::ASRL;
6693 DAG.
SplitScalar(
N->getOperand(0), dl, MVT::i32, MVT::i32);
6707 if (ST->isThumb1Only())
6712 std::tie(
Lo,
Hi) = DAG.
SplitScalar(
N->getOperand(0), dl, MVT::i32, MVT::i32);
6716 unsigned Opc =
N->getOpcode() ==
ISD::SRL ? ARMISD::LSRS1 : ARMISD::ASRS1;
6720 Lo = DAG.
getNode(ARMISD::RRX, dl, MVT::i32,
Lo,
Hi.getValue(1));
6728 bool Invert =
false;
6735 EVT VT =
Op.getValueType();
6743 assert(ST->hasMVEIntegerOps() &&
6744 "No hardware support for integer vector comparison!");
6746 if (
Op.getValueType().getVectorElementType() != MVT::i1)
6767 SDValue Reversed = DAG.
getNode(ARMISD::VREV64, dl, SplitVT, Cmp);
6771 Merged = DAG.
getNOT(dl, Merged, CmpVT);
6781 switch (SetCCOpcode) {
6785 if (ST->hasMVEFloatOps()) {
6788 Invert =
true; [[fallthrough]];
6813 Result = DAG.
getNOT(dl, Result, VT);
6816 case ISD::SETUO: Invert =
true; [[fallthrough]];
6825 Result = DAG.
getNOT(dl, Result, VT);
6831 switch (SetCCOpcode) {
6834 if (ST->hasMVEIntegerOps()) {
6837 Invert =
true; [[fallthrough]];
6859 if (AndOp.getNode() && AndOp.getOpcode() ==
ISD::BITCAST)
6862 if (AndOp.getNode() && AndOp.getOpcode() ==
ISD::AND) {
6867 Result = DAG.
getNOT(dl, Result, VT);
6892 Result = DAG.
getNode(ARMISD::VCMPZ, dl, CmpVT, Op0,
6895 Result = DAG.
getNode(ARMISD::VCMP, dl, CmpVT, Op0, Op1,
6901 Result = DAG.
getNOT(dl, Result, VT);
6910 assert(
LHS.getSimpleValueType().isInteger() &&
"SETCCCARRY is integer only.");
6927 return DAG.
getNode(ARMISD::CMOV,
DL,
Op.getValueType(), FVal, TVal, ARMcc,
6938 unsigned OpCmode,
Imm;
6949 switch (SplatBitSize) {
6954 assert((SplatBits & ~0xff) == 0 &&
"one byte splat value is too big");
6957 VT = is128Bits ? MVT::v16i8 : MVT::v8i8;
6962 VT = is128Bits ? MVT::v8i16 : MVT::v4i16;
6963 if ((SplatBits & ~0xff) == 0) {
6969 if ((SplatBits & ~0xff00) == 0) {
6972 Imm = SplatBits >> 8;
6982 VT = is128Bits ? MVT::v4i32 : MVT::v2i32;
6983 if ((SplatBits & ~0xff) == 0) {
6989 if ((SplatBits & ~0xff00) == 0) {
6992 Imm = SplatBits >> 8;
6995 if ((SplatBits & ~0xff0000) == 0) {
6998 Imm = SplatBits >> 16;
7001 if ((SplatBits & ~0xff000000) == 0) {
7004 Imm = SplatBits >> 24;
7011 if ((SplatBits & ~0xffff) == 0 &&
7012 ((SplatBits | SplatUndef) & 0xff) == 0xff) {
7015 Imm = SplatBits >> 8;
7023 if ((SplatBits & ~0xffffff) == 0 &&
7024 ((SplatBits | SplatUndef) & 0xffff) == 0xffff) {
7027 Imm = SplatBits >> 16;
7043 unsigned ImmMask = 1;
7045 for (
int ByteNum = 0; ByteNum < 8; ++ByteNum) {
7046 if (((SplatBits | SplatUndef) & BitMask) == BitMask) {
7048 }
else if ((SplatBits & BitMask) != 0) {
7057 VT = is128Bits ? MVT::v2i64 : MVT::v1i64;
7071 EVT VT =
Op.getValueType();
7072 bool IsDouble = (VT == MVT::f64);
7078 if (
ST->genExecuteOnly()) {
7080 assert((!
ST->isThumb1Only() ||
ST->hasV8MBaselineOps()) &&
7081 "Unexpected architecture");
7099 return DAG.
getNode(ARMISD::VMOVsr,
DL, VT,
7104 if (!
ST->hasVFP3Base())
7109 if (IsDouble && !Subtarget->hasFP64())
7116 if (IsDouble || !
ST->useNEONForSinglePrecisionFP()) {
7134 if (!
ST->hasNEON() || (!IsDouble && !
ST->useNEONForSinglePrecisionFP()))
7143 if (IsDouble && (iVal & 0xffffffff) != (iVal >> 32))
7197 unsigned ExpectedElt =
Imm;
7198 for (
unsigned i = 1; i < NumElts; ++i) {
7202 if (ExpectedElt == NumElts)
7205 if (M[i] < 0)
continue;
7206 if (ExpectedElt !=
static_cast<unsigned>(M[i]))
7214 bool &ReverseVEXT,
unsigned &
Imm) {
7216 ReverseVEXT =
false;
7227 unsigned ExpectedElt =
Imm;
7228 for (
unsigned i = 1; i < NumElts; ++i) {
7232 if (ExpectedElt == NumElts * 2) {
7237 if (M[i] < 0)
continue;
7238 if (ExpectedElt !=
static_cast<unsigned>(M[i]))
7253 return VT == MVT::v8i8 && M.size() == 8;
7259 unsigned &WhichResult,
7262 if (
isVTRNMask(ShuffleMask, VT, WhichResult))
7263 return ARMISD::VTRN;
7264 if (
isVUZPMask(ShuffleMask, VT, WhichResult))
7265 return ARMISD::VUZP;
7266 if (
isVZIPMask(ShuffleMask, VT, WhichResult))
7267 return ARMISD::VZIP;
7271 return ARMISD::VTRN;
7273 return ARMISD::VUZP;
7275 return ARMISD::VZIP;
7284 if (NumElts != M.size())
7288 for (
unsigned i = 0; i != NumElts; ++i)
7289 if (M[i] >= 0 && M[i] != (
int) (NumElts - 1 - i))
7298 if (NumElts != M.size() || (VT != MVT::v8i16 && VT != MVT::v16i8))
7306 int Ofs = Top ? 1 : 0;
7307 int Upper = SingleSource ? 0 : NumElts;
7308 for (
int i = 0, e = NumElts / 2; i != e; ++i) {
7309 if (M[i] >= 0 && M[i] != (i * 2) + Ofs)
7311 if (M[i + e] >= 0 && M[i + e] != (i * 2) + Ofs +
Upper)
7320 if (NumElts != M.size() || (VT != MVT::v8i16 && VT != MVT::v16i8))
7329 unsigned Offset = Top ? 0 : 1;
7330 unsigned N = SingleSource ? 0 : NumElts;
7331 for (
unsigned i = 0; i < NumElts; i += 2) {
7332 if (M[i] >= 0 && M[i] != (
int)i)
7334 if (M[i + 1] >= 0 && M[i + 1] != (
int)(
N + i +
Offset))
7343 if (NumElts != M.size())
7351 unsigned Off0 = rev ? NumElts / 2 : 0;
7352 unsigned Off1 = rev ? 0 : NumElts / 2;
7353 for (
unsigned i = 0; i < NumElts; i += 2) {
7354 if (M[i] >= 0 && M[i] != (
int)(Off0 + i / 2))
7356 if (M[i + 1] >= 0 && M[i + 1] != (
int)(Off1 + i / 2))
7372 if (!ST->hasMVEFloatOps())
7377 if (VT != MVT::v8f16)
7398 for (
unsigned i = 1; i < 4; i++) {
7402 Trunc.getOperand(0).getOperand(0) ==
Op &&
7403 Trunc.getOperand(0).getConstantOperandVal(1) == Idx;
7413 return DAG.
getNode(ARMISD::VCVTN, dl, VT, N1, Op1,
7425 if (!ST->hasMVEFloatOps())
7430 if (VT != MVT::v4f32)
7446 for (
unsigned i = 1; i < 4; i++) {
7450 Trunc.getOperand(0).getOperand(0) ==
Op &&
7451 Trunc.getOperand(0).getConstantOperandVal(1) == Idx;
7457 return DAG.
getNode(ARMISD::VCVTL, dl, VT, Op0,
7469 Val =
N->getAsZExtVal();
7471 if (ST->isThumb1Only()) {
7472 if (Val <= 255 || ~Val <= 255)
7484 EVT VT =
Op.getValueType();
7486 assert(ST->hasMVEIntegerOps() &&
"LowerBUILD_VECTOR_i1 called without MVE!");
7490 unsigned BitsPerBool;
7494 }
else if (NumElts == 4) {
7497 }
else if (NumElts == 8) {
7500 }
else if (NumElts == 16) {
7511 return U.get().isUndef() || U.get() == FirstOp;
7515 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl,
Op.getValueType(), Ext);
7519 unsigned Bits32 = 0;
7520 for (
unsigned i = 0; i < NumElts; ++i) {
7524 bool BitSet =
V.isUndef() ?
false :
V->getAsZExtVal();
7526 Bits32 |= BoolMask << (i * BitsPerBool);
7532 for (
unsigned i = 0; i < NumElts; ++i) {
7545 if (!ST->hasMVEIntegerOps())
7549 EVT VT =
Op.getValueType();
7559 if (
N != 1 &&
N != 2 &&
N != 4 &&
N != 8)
7563 for (
unsigned I = 2;
I < NumElts;
I++) {
7579 switch (
N->getOpcode()) {
7590 return N->getOperand(1).getNode() ==
Op;
7592 switch (
N->getConstantOperandVal(0)) {
7593 case Intrinsic::arm_mve_add_predicated:
7594 case Intrinsic::arm_mve_mul_predicated:
7595 case Intrinsic::arm_mve_qadd_predicated:
7596 case Intrinsic::arm_mve_vhadd:
7597 case Intrinsic::arm_mve_hadd_predicated:
7598 case Intrinsic::arm_mve_vqdmulh:
7599 case Intrinsic::arm_mve_qdmulh_predicated:
7600 case Intrinsic::arm_mve_vqrdmulh:
7601 case Intrinsic::arm_mve_qrdmulh_predicated:
7602 case Intrinsic::arm_mve_vqdmull:
7603 case Intrinsic::arm_mve_vqdmull_predicated:
7605 case Intrinsic::arm_mve_sub_predicated:
7606 case Intrinsic::arm_mve_qsub_predicated:
7607 case Intrinsic::arm_mve_vhsub:
7608 case Intrinsic::arm_mve_hsub_predicated:
7609 return N->getOperand(2).getNode() ==
Op;
7624 EVT VT =
Op.getValueType();
7632 APInt SplatBits, SplatUndef;
7633 unsigned SplatBitSize;
7635 if (BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
7642 (SplatBitSize == 8 || SplatBitSize == 16 || SplatBitSize == 32) &&
7644 [BVN](
const SDNode *U) { return IsQRMVEInstruction(U, BVN); })) {
7645 EVT DupVT = SplatBitSize == 32 ? MVT::v4i32
7646 : SplatBitSize == 16 ? MVT::v8i16
7650 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, VDup);
7653 if ((
ST->hasNEON() && SplatBitSize <= 64) ||
7654 (
ST->hasMVEIntegerOps() && SplatBitSize <= 64)) {
7659 SplatBitSize, DAG, dl, VmovVT, VT,
VMOVModImm);
7663 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Vmov);
7667 uint64_t NegatedImm = (~SplatBits).getZExtValue();
7669 NegatedImm, SplatUndef.
getZExtValue(), SplatBitSize, DAG, dl, VmovVT,
7673 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Vmov);
7677 if ((VT == MVT::v2f32 || VT == MVT::v4f32) && SplatBitSize == 32) {
7681 return DAG.
getNode(ARMISD::VMOVFPIMM, dl, VT, Val);
7687 if (
ST->hasMVEIntegerOps() &&
7688 (SplatBitSize == 8 || SplatBitSize == 16 || SplatBitSize == 32)) {
7689 EVT DupVT = SplatBitSize == 32 ? MVT::v4i32
7690 : SplatBitSize == 16 ? MVT::v8i16
7694 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, VDup);
7707 bool isOnlyLowElement =
true;
7708 bool usesOnlyOneValue =
true;
7709 bool hasDominantValue =
false;
7714 DenseMap<SDValue, unsigned> ValueCounts;
7716 for (
unsigned i = 0; i < NumElts; ++i) {
7721 isOnlyLowElement =
false;
7725 unsigned &
Count = ValueCounts[
V];
7728 if (++
Count > (NumElts / 2)) {
7729 hasDominantValue =
true;
7733 if (ValueCounts.
size() != 1)
7734 usesOnlyOneValue =
false;
7735 if (!
Value.getNode() && !ValueCounts.
empty())
7738 if (ValueCounts.
empty())
7744 (VT != MVT::v8f16 ||
ST->hasFullFP16()))
7751 if (hasDominantValue && EltSize <= 32) {
7760 ConstantSDNode *constIndex;
7767 if (VT !=
Value->getOperand(0).getValueType()) {
7770 N = DAG.
getNode(ARMISD::VDUPLANE, dl, VT,
7775 N = DAG.
getNode(ARMISD::VDUPLANE, dl, VT,
7780 if (!usesOnlyOneValue) {
7783 for (
unsigned I = 0;
I < NumElts; ++
I) {
7788 Ops.push_back(
Op.getOperand(
I));
7798 assert(FVT == MVT::f32 || FVT == MVT::f16);
7799 MVT IVT = (FVT == MVT::f32) ? MVT::i32 : MVT::i16;
7800 for (
unsigned i = 0; i < NumElts; ++i)
7805 Val = LowerBUILD_VECTOR(Val, DAG, ST);
7809 if (usesOnlyOneValue) {
7812 return DAG.
getNode(ARMISD::VDUP, dl, VT, Val);
7836 if (
ST->hasNEON() && VT.
is128BitVector() && VT != MVT::v2f64 && VT != MVT::v4f32) {
7856 if (EltSize >= 32) {
7862 for (
unsigned i = 0; i < NumElts; ++i)
7875 (VT == MVT::v8f16 && !
ST->hasFullFP16())) {
7877 for (
unsigned i = 0 ; i < NumElts; ++i) {
7896 EVT VT =
Op.getValueType();
7899 struct ShuffleSourceInfo {
7901 unsigned MinElt = std::numeric_limits<unsigned>::max();
7902 unsigned MaxElt = 0;
7912 int WindowScale = 1;
7914 ShuffleSourceInfo(
SDValue Vec) : Vec(Vec), ShuffleVec(Vec) {}
7922 for (
unsigned i = 0; i < NumElts; ++i) {
7937 SDValue SourceVec =
V.getOperand(0);
7939 if (Source == Sources.
end())
7943 unsigned EltNo =
V.getConstantOperandVal(1);
7950 if (Sources.
size() > 2)
7956 for (
auto &Source : Sources) {
7957 EVT SrcEltTy =
Source.Vec.getValueType().getVectorElementType();
7958 if (SrcEltTy.
bitsLT(SmallestEltTy))
7959 SmallestEltTy = SrcEltTy;
7961 unsigned ResMultiplier =
7969 for (
auto &Src : Sources) {
7970 EVT SrcVT = Src.ShuffleVec.getValueType();
7974 if (SrcVTSize == VTSize)
7983 if (SrcVTSize < VTSize) {
7984 if (2 * SrcVTSize != VTSize)
7990 DAG.
getUNDEF(Src.ShuffleVec.getValueType()));
7994 if (SrcVTSize != 2 * VTSize)
7997 if (Src.MaxElt - Src.MinElt >= NumSrcElts) {
8002 if (Src.MinElt >= NumSrcElts) {
8007 Src.WindowBase = -NumSrcElts;
8008 }
else if (Src.MaxElt < NumSrcElts) {
8022 Src.ShuffleVec = DAG.
getNode(ARMISD::VEXT, dl, DestVT, VEXTSrc1,
8025 Src.WindowBase = -Src.MinElt;
8032 for (
auto &Src : Sources) {
8033 EVT SrcEltTy = Src.ShuffleVec.getValueType().getVectorElementType();
8034 if (SrcEltTy == SmallestEltTy)
8037 Src.ShuffleVec = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, ShuffleVT, Src.ShuffleVec);
8039 Src.WindowBase *= Src.WindowScale;
8044 for (
auto Src : Sources)
8045 assert(Src.ShuffleVec.getValueType() == ShuffleVT);
8053 if (
Entry.isUndef())
8062 EVT OrigEltTy =
Entry.getOperand(0).getValueType().getVectorElementType();
8065 int LanesDefined = BitsDefined / BitsPerShuffleLane;
8069 int *LaneMask = &
Mask[i * ResMultiplier];
8071 int ExtractBase = EltNo * Src->WindowScale + Src->WindowBase;
8072 ExtractBase += NumElts * (Src - Sources.begin());
8073 for (
int j = 0;
j < LanesDefined; ++
j)
8074 LaneMask[j] = ExtractBase + j;
8080 assert(Sources.size() <= 2 &&
"Too many sources!");
8083 for (
unsigned i = 0; i < Sources.size(); ++i)
8090 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Shuffle);
8112 unsigned OpNum = (PFEntry >> 26) & 0x0F;
8132 unsigned PFIndexes[4];
8133 for (
unsigned i = 0; i != 4; ++i) {
8137 PFIndexes[i] = M[i];
8141 unsigned PFTableIndex =
8142 PFIndexes[0]*9*9*9+PFIndexes[1]*9*9+PFIndexes[2]*9+PFIndexes[3];
8144 unsigned Cost = (PFEntry >> 30);
8150 bool ReverseVEXT, isV_UNDEF;
8151 unsigned Imm, WhichResult;
8154 if (EltSize >= 32 ||
8161 else if (Subtarget->hasNEON() &&
8166 else if ((VT == MVT::v8i16 || VT == MVT::v8f16 || VT == MVT::v16i8) &&
8169 else if (Subtarget->hasMVEIntegerOps() &&
8173 else if (Subtarget->hasMVEIntegerOps() &&
8187 unsigned OpNum = (PFEntry >> 26) & 0x0F;
8188 unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
8189 unsigned RHSID = (PFEntry >> 0) & ((1 << 13)-1);
8192 if (LHSID == (1*9+2)*9+3)
return LHS;
8193 assert(LHSID == ((4*9+5)*9+6)*9+7 &&
"Illegal OP_COPY!");
8207 return DAG.
getNode(ARMISD::VREV64, dl, VT, OpLHS);
8210 return DAG.
getNode(ARMISD::VREV32, dl, VT, OpLHS);
8213 return DAG.
getNode(ARMISD::VREV16, dl, VT, OpLHS);
8218 return DAG.
getNode(ARMISD::VDUPLANE, dl, VT,
8223 return DAG.
getNode(ARMISD::VEXT, dl, VT,
8250 for (
int I : ShuffleMask)
8254 return DAG.
getNode(ARMISD::VTBL1,
DL, MVT::v8i8,
V1,
8257 return DAG.
getNode(ARMISD::VTBL2,
DL, MVT::v8i8,
V1, V2,
8263 EVT VT =
Op.getValueType();
8265 assert((VT == MVT::v8i16 || VT == MVT::v8f16 || VT == MVT::v16i8) &&
8266 "Expect an v8i16/v16i8 type");
8272 std::vector<int> NewMask;
8276 NewMask.push_back(i);
8306 AllZeroes = DAG.
getNode(ARMISD::VMOVIMM, dl, MVT::v16i8, AllZeroes);
8316 if (VT != MVT::v16i1)
8317 RecastV1 = DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::v16i1,
Pred);
8332 EVT VT =
Op.getValueType();
8336 assert(ST->hasMVEIntegerOps() &&
8337 "No support for vector shuffle of boolean predicates");
8347 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl, VT, srl);
8363 "Expected identical vector type in expanded i1 shuffle!");
8367 PredAsVector2, ShuffleMask);
8372 if (VT == MVT::v2i1) {
8373 SDValue BC = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Shuffled);
8376 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::v2i1, Cmp);
8378 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, Shuffled,
8389 EVT VT =
Op.getValueType();
8393 assert((VT == MVT::v8i16 || VT == MVT::v8f16 || VT == MVT::v16i8) &&
8394 "Unexpected vector type");
8396 int QuarterSize = NumElts / 4;
8405 for (
int i = 0; i <
Length; i++) {
8406 if (ShuffleMask[Start + i] >= 0) {
8407 if (ShuffleMask[Start + i] %
Length != i)
8409 MovIdx = ShuffleMask[Start + i] /
Length;
8417 for (
int i = 1; i <
Length; i++) {
8418 if (ShuffleMask[Start + i] >= 0 &&
8419 (ShuffleMask[Start + i] /
Length != MovIdx ||
8420 ShuffleMask[Start + i] %
Length != i))
8426 for (
int Part = 0; Part < 4; ++Part) {
8428 int Elt = getMovIdx(ShuffleMask, Part * QuarterSize, QuarterSize);
8442 if (!Parts[0] && !Parts[1] && !Parts[2] && !Parts[3])
8447 if (!Parts[0] || !Parts[1] || !Parts[2] || !Parts[3]) {
8449 for (
int Part = 0; Part < 4; ++Part)
8450 for (
int i = 0; i < QuarterSize; i++)
8452 Parts[Part] ? -1 : ShuffleMask[Part * QuarterSize + i]);
8454 VT, dl,
Op->getOperand(0),
Op->getOperand(1), NewShuffleMask);
8457 for (
int Part = 0; Part < 4; ++Part)
8473 EVT VT =
Op.getValueType();
8485 for (
int i = 0, NumMaskElts = Mask.size(); i < NumMaskElts; ++i) {
8489 if (Mask[i] != i + BaseOffset) {
8490 if (OffElement == -1)
8496 return NonUndef > 2 && OffElement != -1;
8500 if (isOneOffIdentityMask(ShuffleMask, VT, 0, OffElement))
8502 else if (isOneOffIdentityMask(ShuffleMask, VT, NumElts, OffElement))
8513 ShuffleMask[OffElement] < (
int)NumElts ?
V1 : V2,
8524 EVT VT =
Op.getValueType();
8528 if (ST->hasMVEIntegerOps() && EltSize == 1)
8539 if (EltSize <= 32) {
8543 if (Lane == -1) Lane = 0;
8547 return DAG.
getNode(ARMISD::VDUP, dl, VT,
V1.getOperand(0));
8554 bool IsScalarToVector =
true;
8555 for (
unsigned i = 1, e =
V1.getNumOperands(); i != e; ++i)
8556 if (!
V1.getOperand(i).isUndef()) {
8557 IsScalarToVector =
false;
8560 if (IsScalarToVector)
8561 return DAG.
getNode(ARMISD::VDUP, dl, VT,
V1.getOperand(0));
8563 return DAG.
getNode(ARMISD::VDUPLANE, dl, VT,
V1,
8567 bool ReverseVEXT =
false;
8569 if (ST->hasNEON() &&
isVEXTMask(ShuffleMask, VT, ReverseVEXT,
Imm)) {
8572 return DAG.
getNode(ARMISD::VEXT, dl, VT,
V1, V2,
8577 return DAG.
getNode(ARMISD::VREV64, dl, VT,
V1);
8579 return DAG.
getNode(ARMISD::VREV32, dl, VT,
V1);
8581 return DAG.
getNode(ARMISD::VREV16, dl, VT,
V1);
8593 unsigned WhichResult = 0;
8594 bool isV_UNDEF =
false;
8595 if (ST->hasNEON()) {
8597 ShuffleMask, VT, WhichResult, isV_UNDEF)) {
8604 if (ST->hasMVEIntegerOps()) {
8606 return DAG.
getNode(ARMISD::VMOVN, dl, VT, V2,
V1,
8609 return DAG.
getNode(ARMISD::VMOVN, dl, VT,
V1, V2,
8639 }) &&
"Unexpected shuffle index into UNDEF operand!");
8642 ShuffleMask, SubVT, WhichResult, isV_UNDEF)) {
8645 assert((WhichResult == 0) &&
8646 "In-place shuffle of concat can only have one result!");
8655 if (ST->hasMVEIntegerOps() && EltSize <= 32 &&
8656 (ST->hasFullFP16() || VT != MVT::v8f16)) {
8660 for (
bool Top : {
false,
true}) {
8661 for (
bool SingleSource : {
false,
true}) {
8662 if (
isTruncMask(ShuffleMask, VT, Top, SingleSource)) {
8667 SingleSource ?
V1 : V2);
8683 unsigned PFIndexes[4];
8684 for (
unsigned i = 0; i != 4; ++i) {
8685 if (ShuffleMask[i] < 0)
8688 PFIndexes[i] = ShuffleMask[i];
8692 unsigned PFTableIndex =
8693 PFIndexes[0]*9*9*9+PFIndexes[1]*9*9+PFIndexes[2]*9+PFIndexes[3];
8695 unsigned Cost = (PFEntry >> 30);
8701 unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
8702 unsigned RHSID = (PFEntry >> 0) & ((1 << 13)-1);
8712 if (EltSize >= 32) {
8720 for (
unsigned i = 0; i < NumElts; ++i) {
8721 if (ShuffleMask[i] < 0)
8725 ShuffleMask[i] < (
int)NumElts ?
V1 : V2,
8733 if ((VT == MVT::v8i16 || VT == MVT::v8f16 || VT == MVT::v16i8) &&
8737 if (ST->hasNEON() && VT == MVT::v8i8)
8741 if (ST->hasMVEIntegerOps())
8746 if (VT == MVT::v8f16 && !ST->hasFullFP16()) {
8748 DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v8i16,
Op.getOperand(0));
8750 DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v8i16,
Op.getOperand(1));
8752 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Shuf);
8760 EVT VecVT =
Op.getOperand(0).getValueType();
8763 assert(ST->hasMVEIntegerOps() &&
8764 "LowerINSERT_VECTOR_ELT_i1 called without MVE!");
8767 DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::i32,
Op->getOperand(0));
8768 unsigned Lane =
Op.getConstantOperandVal(2);
8769 unsigned LaneWidth =
8771 unsigned Mask = ((1 << LaneWidth) - 1) << Lane * LaneWidth;
8776 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl,
Op.getValueType(), BFI);
8789 if (Subtarget->hasMVEIntegerOps() &&
8790 Op.getValueType().getScalarSizeInBits() == 1)
8814 IVecIn, IElt, Lane);
8823 EVT VecVT =
Op.getOperand(0).getValueType();
8826 assert(ST->hasMVEIntegerOps() &&
8827 "LowerINSERT_VECTOR_ELT_i1 called without MVE!");
8830 DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::i32,
Op->getOperand(0));
8831 unsigned Lane =
Op.getConstantOperandVal(1);
8832 unsigned LaneWidth =
8854 return DAG.
getNode(ARMISD::VGETLANEu, dl, MVT::i32, Vec, Lane);
8863 assert(
Op.getValueType().getScalarSizeInBits() == 1 &&
8864 "Unexpected custom CONCAT_VECTORS lowering");
8866 "Unexpected custom CONCAT_VECTORS lowering");
8867 assert(ST->hasMVEIntegerOps() &&
8868 "CONCAT_VECTORS lowering only supported for MVE");
8871 EVT Op1VT =
V1.getValueType();
8872 EVT Op2VT = V2.getValueType();
8873 assert(Op1VT == Op2VT &&
"Operand types don't match!");
8874 assert((Op1VT == MVT::v2i1 || Op1VT == MVT::v4i1 || Op1VT == MVT::v8i1) &&
8875 "Unexpected i1 concat operations!");
8888 if (Op1VT == MVT::v4i1 || Op1VT == MVT::v8i1) {
8893 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, ConVec,
8902 auto ExtractInto = [&DAG, &dl](
SDValue NewV,
SDValue ConVec,
unsigned &j) {
8903 EVT NewVT = NewV.getValueType();
8904 EVT ConcatVT = ConVec.getValueType();
8905 unsigned ExtScale = 1;
8906 if (NewVT == MVT::v2f64) {
8907 NewV = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, NewV);
8920 ConVec = ExtractInto(NewV1, ConVec, j);
8921 ConVec = ExtractInto(NewV2, ConVec, j);
8925 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, ConVec,
8931 while (ConcatOps.
size() > 1) {
8932 for (
unsigned I = 0,
E = ConcatOps.
size();
I !=
E;
I += 2) {
8935 ConcatOps[
I / 2] = ConcatPair(
V1, V2);
8939 return ConcatOps[0];
8944 EVT VT =
Op->getValueType(0);
8950 assert(
Op.getValueType().is128BitVector() &&
Op.getNumOperands() == 2 &&
8951 "unexpected CONCAT_VECTORS");
8972 EVT VT =
Op.getValueType();
8973 EVT Op1VT =
V1.getValueType();
8978 "Unexpected custom EXTRACT_SUBVECTOR lowering");
8979 assert(ST->hasMVEIntegerOps() &&
8980 "EXTRACT_SUBVECTOR lowering only supported for MVE");
8990 EVT SubVT = MVT::v4i32;
8992 for (
unsigned i = Index, j = 0; i < (Index + NumElts); i++, j += 2) {
9002 return DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::v2i1, Cmp);
9007 for (
unsigned i = Index, j = 0; i < (Index + NumElts); i++, j++) {
9016 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, SubVec,
9023 assert(ST->hasMVEIntegerOps() &&
"Expected MVE!");
9024 EVT VT =
N->getValueType(0);
9025 assert((VT == MVT::v16i1 || VT == MVT::v8i1 || VT == MVT::v4i1) &&
9026 "Expected a vector i1 type!");
9028 EVT FromVT =
Op.getValueType();
9042 EVT ToVT =
N->getValueType(0);
9085 if (ToVT != MVT::v8i16 && ToVT != MVT::v16i8)
9087 EVT FromVT =
N->getOperand(0).getValueType();
9088 if (FromVT != MVT::v8i32 && FromVT != MVT::v16i16)
9104 EVT ToVT =
N->getValueType(0);
9105 if (ToVT != MVT::v16i32 && ToVT != MVT::v8i32 && ToVT != MVT::v16i16)
9108 EVT FromVT =
Op.getValueType();
9109 if (FromVT != MVT::v8i16 && FromVT != MVT::v16i8)
9123 Ext = DAG.
getNode(
N->getOpcode(),
DL, MVT::v8i32, Ext);
9124 Ext1 = DAG.
getNode(
N->getOpcode(),
DL, MVT::v8i32, Ext1);
9136 EVT VT =
N->getValueType(0);
9138 SDNode *BVN =
N->getOperand(0).getNode();
9143 unsigned HiElt = 1 - LoElt;
9148 if (!Lo0 || !Hi0 || !Lo1 || !Hi1)
9164 for (
unsigned i = 0, e =
N->getNumOperands(); i != e; ++i) {
9165 SDNode *Elt =
N->getOperand(i).getNode();
9168 unsigned HalfSize = EltSize / 2;
9170 if (!
isIntN(HalfSize,
C->getSExtValue()))
9173 if (!
isUIntN(HalfSize,
C->getZExtValue()))
9212 switch (OrigSimpleTy) {
9228 unsigned ExtOpcode) {
9251 if (ExtendedTy == LD->getMemoryVT())
9252 return DAG.
getLoad(LD->getMemoryVT(),
SDLoc(LD), LD->getChain(),
9253 LD->getBasePtr(), LD->getPointerInfo(), LD->getAlign(),
9254 LD->getMemOperand()->getFlags());
9260 LD->getChain(), LD->getBasePtr(), LD->getPointerInfo(),
9261 LD->getMemoryVT(), LD->getAlign(),
9262 LD->getMemOperand()->getFlags());
9275 N->getOperand(0)->getValueType(0),
9281 "Expected extending load");
9287 DAG.
getNode(Opcode,
SDLoc(newLoad), LD->getValueType(0), newLoad);
9296 SDNode *BVN =
N->getOperand(0).getNode();
9298 BVN->
getValueType(0) == MVT::v4i32 &&
"expected v4i32 BUILD_VECTOR");
9306 EVT VT =
N->getValueType(0);
9312 for (
unsigned i = 0; i != NumElts; ++i) {
9313 const APInt &CInt =
N->getConstantOperandAPInt(i);
9322 unsigned Opcode =
N->getOpcode();
9324 SDNode *N0 =
N->getOperand(0).getNode();
9325 SDNode *N1 =
N->getOperand(1).getNode();
9333 unsigned Opcode =
N->getOpcode();
9335 SDNode *N0 =
N->getOperand(0).getNode();
9336 SDNode *N1 =
N->getOperand(1).getNode();
9346 EVT VT =
Op.getValueType();
9348 "unexpected type for custom-lowering ISD::MUL");
9349 SDNode *N0 =
Op.getOperand(0).getNode();
9350 SDNode *N1 =
Op.getOperand(1).getNode();
9351 unsigned NewOpc = 0;
9355 if (isN0SExt && isN1SExt)
9356 NewOpc = ARMISD::VMULLs;
9360 if (isN0ZExt && isN1ZExt)
9361 NewOpc = ARMISD::VMULLu;
9362 else if (isN1SExt || isN1ZExt) {
9366 NewOpc = ARMISD::VMULLs;
9369 NewOpc = ARMISD::VMULLu;
9373 NewOpc = ARMISD::VMULLu;
9379 if (VT == MVT::v2i64)
9396 "unexpected types for extended operands to VMULL");
9397 return DAG.
getNode(NewOpc,
DL, VT, Op0, Op1);
9432 DAG.
getConstant(Intrinsic::arm_neon_vrecpe, dl, MVT::i32),
9466 DAG.
getConstant(Intrinsic::arm_neon_vrecpe, dl, MVT::i32),
9469 DAG.
getConstant(Intrinsic::arm_neon_vrecps, dl, MVT::i32),
9490 EVT VT =
Op.getValueType();
9491 assert((VT == MVT::v4i16 || VT == MVT::v8i8) &&
9492 "unexpected type for custom-lowering ISD::SDIV");
9499 if (VT == MVT::v8i8) {
9527 EVT VT =
Op.getValueType();
9528 assert((VT == MVT::v4i16 || VT == MVT::v8i8) &&
9529 "unexpected type for custom-lowering ISD::UDIV");
9536 if (VT == MVT::v8i8) {
9575 DAG.
getConstant(Intrinsic::arm_neon_vrecpe, dl, MVT::i32),
9578 DAG.
getConstant(Intrinsic::arm_neon_vrecps, dl, MVT::i32),
9582 DAG.
getConstant(Intrinsic::arm_neon_vrecps, dl, MVT::i32),
9602 unsigned Opcode,
bool IsSigned) {
9603 EVT VT0 =
Op.getValue(0).getValueType();
9604 EVT VT1 =
Op.getValue(1).getValueType();
9606 bool InvertCarry = Opcode == ARMISD::SUBE;
9626 EVT VT =
Op.getValueType();
9627 assert((VT == MVT::i32 || VT == MVT::i64) &&
9628 "unexpected type for custom lowering DIV");
9634 LC = VT == MVT::i32 ? RTLIB::SDIVREM_I32 : RTLIB::SDIVREM_I64;
9636 LC = VT == MVT::i32 ? RTLIB::UDIVREM_I32 : RTLIB::UDIVREM_I64;
9643 for (
auto AI : {1, 0}) {
9645 Args.emplace_back(Operand,
9662ARMTargetLowering::BuildSDIVPow2(
SDNode *
N,
const APInt &Divisor,
9670 const bool MinSize =
ST.hasMinSize();
9671 const bool HasDivide =
ST.isThumb() ?
ST.hasDivideInThumbMode()
9672 :
ST.hasDivideInARMMode();
9676 if (
N->getOperand(0).getValueType().isVector())
9681 if (!(MinSize && HasDivide))
9694 if (Divisor.
sgt(128))
9702 assert(
Op.getValueType() == MVT::i32 &&
9703 "unexpected type for custom lowering DIV");
9706 SDValue DBZCHK = DAG.
getNode(ARMISD::WIN__DBZCHK, dl, MVT::Other,
9709 return LowerWindowsDIVLibCall(
Op, DAG,
Signed, DBZCHK);
9715 if (
N->getValueType(0) == MVT::i32)
9716 return DAG.
getNode(ARMISD::WIN__DBZCHK,
DL, MVT::Other, InChain,
Op);
9719 return DAG.
getNode(ARMISD::WIN__DBZCHK,
DL, MVT::Other, InChain,
9723void ARMTargetLowering::ExpandDIV_Windows(
9728 assert(
Op.getValueType() == MVT::i64 &&
9729 "unexpected type for custom lowering DIV");
9744std::pair<SDValue, SDValue>
9745ARMTargetLowering::LowerAEABIUnalignedLoad(
SDValue Op,
9751 EVT MemVT =
LD->getMemoryVT();
9752 if (MemVT != MVT::i32 && MemVT != MVT::i64)
9756 unsigned AS =
LD->getAddressSpace();
9759 bool AllowsUnaligned = Subtarget->allowsUnalignedMem();
9761 (MemVT == MVT::i32) ? RTLIB::AEABI_UREAD4 : RTLIB::AEABI_UREAD8;
9769 Opts, dl,
LD->getChain());
9794 EVT MemVT =
ST->getMemoryVT();
9795 if (MemVT != MVT::i32 && MemVT != MVT::i64)
9799 unsigned AS =
ST->getAddressSpace();
9802 bool AllowsUnaligned = Subtarget->allowsUnalignedMem();
9804 (MemVT == MVT::i32) ? RTLIB::AEABI_UWRITE4 : RTLIB::AEABI_UWRITE8;
9813 if (
ST->isTruncatingStore())
9818 makeLibCall(DAG, LC, MVT::isVoid, {StoreVal,
ST->getBasePtr()}, Opts,
9819 dl,
ST->getChain());
9821 return CallResult.second;
9832 EVT MemVT = LD->getMemoryVT();
9833 assert((MemVT == MVT::v2i1 || MemVT == MVT::v4i1 || MemVT == MVT::v8i1 ||
9834 MemVT == MVT::v16i1) &&
9835 "Expected a predicate type!");
9836 assert(MemVT ==
Op.getValueType());
9838 "Expected a non-extending load");
9839 assert(LD->isUnindexed() &&
"Expected a unindexed load");
9853 ISD::EXTLOAD, dl, MVT::i32, LD->getChain(), LD->getBasePtr(),
9855 LD->getMemOperand());
9862 if (MemVT != MVT::v16i1)
9871 EVT MemVT =
LD->getMemoryVT();
9873 if (MemVT == MVT::i64 && Subtarget->hasV5TEOps() &&
9874 !Subtarget->isThumb1Only() &&
LD->isVolatile() &&
9875 LD->getAlign() >= Subtarget->getDualLoadStoreAlignment()) {
9876 assert(
LD->isUnindexed() &&
"Loads should be unindexed at this point.");
9879 ARMISD::LDRD, dl, DAG.
getVTList({MVT::i32, MVT::i32, MVT::Other}),
9880 {LD->getChain(), LD->getBasePtr()}, MemVT,
LD->getMemOperand());
9885 }
else if (MemVT == MVT::i32 || MemVT == MVT::i64) {
9886 auto Pair = LowerAEABIUnalignedLoad(
SDValue(
N, 0), DAG);
9888 Results.push_back(Pair.first);
9889 Results.push_back(Pair.second);
9896 EVT MemVT = ST->getMemoryVT();
9897 assert((MemVT == MVT::v2i1 || MemVT == MVT::v4i1 || MemVT == MVT::v8i1 ||
9898 MemVT == MVT::v16i1) &&
9899 "Expected a predicate type!");
9900 assert(MemVT == ST->getValue().getValueType());
9901 assert(!ST->isTruncatingStore() &&
"Expected a non-extending store");
9902 assert(ST->isUnindexed() &&
"Expected a unindexed store");
9907 SDValue Build = ST->getValue();
9908 if (MemVT != MVT::v16i1) {
9921 SDValue GRP = DAG.
getNode(ARMISD::PREDICATE_CAST, dl, MVT::i32, Build);
9927 ST->getChain(), dl, GRP, ST->getBasePtr(),
9929 ST->getMemOperand());
9935 EVT MemVT =
ST->getMemoryVT();
9937 if (MemVT == MVT::i64 && Subtarget->hasV5TEOps() &&
9938 !Subtarget->isThumb1Only() &&
ST->isVolatile() &&
9939 ST->getAlign() >= Subtarget->getDualLoadStoreAlignment()) {
9940 assert(
ST->isUnindexed() &&
"Stores should be unindexed at this point.");
9941 SDNode *
N =
Op.getNode();
9954 {ST->getChain(), Lo, Hi, ST->getBasePtr()},
9955 MemVT,
ST->getMemOperand());
9956 }
else if (Subtarget->hasMVEIntegerOps() &&
9957 ((MemVT == MVT::v2i1 || MemVT == MVT::v4i1 || MemVT == MVT::v8i1 ||
9958 MemVT == MVT::v16i1))) {
9960 }
else if (MemVT == MVT::i32 || MemVT == MVT::i64) {
9961 return LowerAEABIUnalignedStore(
Op, DAG);
9973 MVT VT =
Op.getSimpleValueType();
9975 SDValue PassThru =
N->getPassThru();
9986 VT, dl,
N->getChain(),
N->getBasePtr(),
N->getOffset(), Mask, ZeroVec,
9987 N->getMemoryVT(),
N->getMemOperand(),
N->getAddressingMode(),
9988 N->getExtensionType(),
N->isExpandingLoad());
9991 PassThru.
getOpcode() == ARMISD::VECTOR_REG_CAST) &&
9993 if (!PassThru.
isUndef() && !PassThruIsCastZero)
10000 if (!ST->hasMVEIntegerOps())
10004 unsigned BaseOpcode = 0;
10005 switch (
Op->getOpcode()) {
10021 unsigned NumActiveLanes = NumElts;
10023 assert((NumActiveLanes == 16 || NumActiveLanes == 8 || NumActiveLanes == 4 ||
10024 NumActiveLanes == 2) &&
10025 "Only expected a power 2 vector size");
10029 while (NumActiveLanes > 4) {
10030 unsigned RevOpcode = NumActiveLanes == 16 ? ARMISD::VREV16 : ARMISD::VREV32;
10032 Op0 = DAG.
getNode(BaseOpcode, dl, VT, Op0, Rev);
10033 NumActiveLanes /= 2;
10037 if (NumActiveLanes == 4) {
10047 SDValue Res0 = DAG.
getNode(BaseOpcode, dl, EltVT, Ext0, Ext1,
Op->getFlags());
10048 SDValue Res1 = DAG.
getNode(BaseOpcode, dl, EltVT, Ext2, Ext3,
Op->getFlags());
10049 Res = DAG.
getNode(BaseOpcode, dl, EltVT, Res0, Res1,
Op->getFlags());
10055 Res = DAG.
getNode(BaseOpcode, dl, EltVT, Ext0, Ext1,
Op->getFlags());
10059 if (EltVT !=
Op->getValueType(0))
10066 if (!ST->hasMVEFloatOps())
10073 if (!ST->hasNEON())
10081 unsigned PairwiseIntrinsic = 0;
10082 switch (
Op->getOpcode()) {
10086 PairwiseIntrinsic = Intrinsic::arm_neon_vpminu;
10089 PairwiseIntrinsic = Intrinsic::arm_neon_vpmaxu;
10092 PairwiseIntrinsic = Intrinsic::arm_neon_vpmins;
10095 PairwiseIntrinsic = Intrinsic::arm_neon_vpmaxs;
10101 unsigned NumActiveLanes = NumElts;
10103 assert((NumActiveLanes == 16 || NumActiveLanes == 8 || NumActiveLanes == 4 ||
10104 NumActiveLanes == 2) &&
10105 "Only expected a power 2 vector size");
10111 VT =
Lo.getValueType();
10113 NumActiveLanes /= 2;
10117 while (NumActiveLanes > 1) {
10119 NumActiveLanes /= 2;
10126 if (EltVT !=
Op.getValueType()) {
10127 unsigned Extend = 0;
10128 switch (
Op->getOpcode()) {
10140 Res = DAG.
getNode(Extend, dl,
Op.getValueType(), Res);
10170 SDLoc dl(V0.getNode());
10175 const SDValue Ops[] = {RegClass, V0, SubReg0,
V1, SubReg1};
10182 auto [VLo, VHi] = DAG.
SplitScalar(
V, dl, MVT::i32, MVT::i32);
10192 assert(
N->getValueType(0) == MVT::i64 &&
10193 "AtomicCmpSwap on types less than 64 should be legal");
10202 ARM::CMP_SWAP_64,
SDLoc(
N),
10203 DAG.
getVTList(MVT::Untyped, MVT::Untyped, MVT::Other),
Ops);
10222 EVT VT =
Op.getValueType();
10231 if (isUnsupportedFloatingType(
LHS.getValueType())) {
10233 Chain, IsSignaling);
10234 if (!
RHS.getNode()) {
10252 ARMcc = DAG.
getConstant(CondCode2, dl, MVT::i32);
10253 Result = getCMOV(dl, VT, Result,
True, ARMcc, Cmp, DAG);
10270 MVT SVT =
Op.getOperand(0).getSimpleValueType();
10273 makeLibCall(DAG, LC, MVT::f32,
Op.getOperand(0), CallOptions,
DL).first;
10286 if (!IsSigned && Subtarget->isThumb1Only()) {
10304 Sub1Result, Sub1Result, Flags1);
10319 if (
Op.getValueType() != MVT::i32)
10333 unsigned Opcode = ARMISD::SUBC;
10342 bool CanUseAdd =
false;
10358 Opcode = ARMISD::ADDC;
10382 SDValue Result1 = DAG.
getNode(ARMISD::CMOV, dl, MVT::i32, OpResult, One,
10383 GTCondValue, Flags);
10387 SDValue Result2 = DAG.
getNode(ARMISD::CMOV, dl, MVT::i32, Result1, MinusOne,
10388 LTCondValue, Flags);
10390 if (
Op.getValueType() != MVT::i32)
10398 switch (
Op.getOpcode()) {
10432 case ISD::BITCAST:
return ExpandBITCAST(
Op.getNode(), DAG, Subtarget);
10436 case ISD::SREM:
return LowerREM(
Op.getNode(), DAG);
10437 case ISD::UREM:
return LowerREM(
Op.getNode(), DAG);
10459 return LowerSET_FPMODE(
Op, DAG);
10461 return LowerRESET_FPMODE(
Op, DAG);
10465 !
Op.getValueType().isVector())
10466 return LowerDIV_Windows(
Op, DAG,
true);
10470 !
Op.getValueType().isVector())
10471 return LowerDIV_Windows(
Op, DAG,
false);
10487 return LowerALUO(
Op, DAG);
10495 EVT MemVT = LD->getMemoryVT();
10496 if (Subtarget->hasMVEIntegerOps() &&
10497 (MemVT == MVT::v2i1 || MemVT == MVT::v4i1 || MemVT == MVT::v8i1 ||
10498 MemVT == MVT::v16i1))
10501 auto Pair = LowerAEABIUnalignedLoad(
Op, DAG);
10507 return LowerSTORE(
Op, DAG, Subtarget);
10529 return LowerDYNAMIC_STACKALLOC(
Op, DAG);
10538 return LowerSPONENTRY(
Op, DAG);
10540 return LowerFP_TO_BF16(
Op, DAG);
10541 case ARMISD::WIN__DBZCHK:
return SDValue();
10544 return LowerCMP(
Op, DAG);
10546 return LowerABS(
Op, DAG);
10551 assert((
Op.getOperand(1).getValueType() == MVT::f16 ||
10552 Op.getOperand(1).getValueType() == MVT::bf16) &&
10553 "Expected custom lowering of rounding operations only for f16");
10556 {
Op.getOperand(0),
Op.getOperand(1)});
10557 return DAG.
getNode(
Op.getOpcode(),
DL, {Op.getValueType(), MVT::Other},
10558 {Ext.getValue(1), Ext.getValue(0)});
10565 unsigned IntNo =
N->getConstantOperandVal(0);
10567 if (IntNo == Intrinsic::arm_smlald)
10568 Opc = ARMISD::SMLALD;
10569 else if (IntNo == Intrinsic::arm_smlaldx)
10570 Opc = ARMISD::SMLALDX;
10571 else if (IntNo == Intrinsic::arm_smlsld)
10572 Opc = ARMISD::SMLSLD;
10573 else if (IntNo == Intrinsic::arm_smlsldx)
10574 Opc = ARMISD::SMLSLDX;
10580 std::tie(
Lo,
Hi) = DAG.
SplitScalar(
N->getOperand(3), dl, MVT::i32, MVT::i32);
10584 N->getOperand(1),
N->getOperand(2),
10596 switch (
N->getOpcode()) {
10603 Res = ExpandBITCAST(
N, DAG, Subtarget);
10612 Res = LowerREM(
N, DAG);
10616 Res = LowerDivRem(
SDValue(
N, 0), DAG);
10633 "can only expand DIV on Windows");
10645 Res = LowerAEABIUnalignedStore(
SDValue(
N, 0), DAG);
10674 "ROPI/RWPI not currently supported with SjLj");
10687 unsigned PCAdj = (
isThumb || isThumb2) ? 4 : 8;
10693 : &ARM::GPRRegClass;
10711 Register NewVReg1 =
MRI->createVirtualRegister(TRC);
10717 Register NewVReg2 =
MRI->createVirtualRegister(TRC);
10723 Register NewVReg3 =
MRI->createVirtualRegister(TRC);
10741 Register NewVReg1 =
MRI->createVirtualRegister(TRC);
10746 Register NewVReg2 =
MRI->createVirtualRegister(TRC);
10751 Register NewVReg3 =
MRI->createVirtualRegister(TRC);
10756 Register NewVReg4 =
MRI->createVirtualRegister(TRC);
10762 Register NewVReg5 =
MRI->createVirtualRegister(TRC);
10799 const TargetInstrInfo *
TII = Subtarget->getInstrInfo();
10807 : &ARM::GPRnopcRegClass;
10811 DenseMap<unsigned, SmallVector<MachineBasicBlock*, 2>> CallSiteNumToLPad;
10812 unsigned MaxCSNum = 0;
10813 for (MachineBasicBlock &BB : *MF) {
10819 for (MachineInstr &
II : BB) {
10820 if (!
II.isEHLabel())
10823 MCSymbol *Sym =
II.getOperand(0).getMCSymbol();
10824 if (!MF->hasCallSiteLandingPad(Sym))
continue;
10826 SmallVectorImpl<unsigned> &CallSiteIdxs = MF->getCallSiteLandingPad(Sym);
10827 for (
unsigned Idx : CallSiteIdxs) {
10828 CallSiteNumToLPad[
Idx].push_back(&BB);
10829 MaxCSNum = std::max(MaxCSNum, Idx);
10836 std::vector<MachineBasicBlock*> LPadList;
10837 SmallPtrSet<MachineBasicBlock*, 32> InvokeBBs;
10838 LPadList.reserve(CallSiteNumToLPad.
size());
10839 for (
unsigned I = 1;
I <= MaxCSNum; ++
I) {
10840 SmallVectorImpl<MachineBasicBlock*> &MBBList = CallSiteNumToLPad[
I];
10841 for (MachineBasicBlock *
MBB : MBBList) {
10842 LPadList.push_back(
MBB);
10847 assert(!LPadList.empty() &&
10848 "No landing pad destinations for the dispatch jump table!");
10851 MachineJumpTableInfo *JTI =
10858 MachineBasicBlock *DispatchBB = MF->CreateMachineBasicBlock();
10861 MachineBasicBlock *TrapBB = MF->CreateMachineBasicBlock();
10863 BuildMI(TrapBB, dl,
TII->get(Subtarget->isThumb() ? ARM::tTRAP : ARM::TRAP));
10866 MachineBasicBlock *DispContBB = MF->CreateMachineBasicBlock();
10870 MF->insert(MF->end(), DispatchBB);
10871 MF->insert(MF->end(), DispContBB);
10872 MF->insert(MF->end(), TrapBB);
10876 SetupEntryBlockForSjLj(
MI,
MBB, DispatchBB, FI);
10878 MachineMemOperand *FIMMOLd = MF->getMachineMemOperand(
10882 MachineInstrBuilder MIB;
10883 MIB =
BuildMI(DispatchBB, dl,
TII->get(ARM::Int_eh_sjlj_dispatchsetup));
10885 const ARMBaseInstrInfo *AII =
static_cast<const ARMBaseInstrInfo*
>(
TII);
10895 unsigned NumLPads = LPadList.size();
10896 if (Subtarget->isThumb2()) {
10898 BuildMI(DispatchBB, dl,
TII->get(ARM::t2LDRi12), NewVReg1)
10904 if (NumLPads < 256) {
10905 BuildMI(DispatchBB, dl,
TII->get(ARM::t2CMPri))
10907 .
addImm(LPadList.size())
10911 BuildMI(DispatchBB, dl,
TII->get(ARM::t2MOVi16), VReg1)
10912 .
addImm(NumLPads & 0xFFFF)
10915 unsigned VReg2 = VReg1;
10916 if ((NumLPads & 0xFFFF0000) != 0) {
10918 BuildMI(DispatchBB, dl,
TII->get(ARM::t2MOVTi16), VReg2)
10924 BuildMI(DispatchBB, dl,
TII->get(ARM::t2CMPrr))
10930 BuildMI(DispatchBB, dl,
TII->get(ARM::t2Bcc))
10936 BuildMI(DispContBB, dl,
TII->get(ARM::t2LEApcrelJT), NewVReg3)
10941 BuildMI(DispContBB, dl,
TII->get(ARM::t2ADDrs), NewVReg4)
10948 BuildMI(DispContBB, dl,
TII->get(ARM::t2BR_JT))
10952 }
else if (Subtarget->isThumb()) {
10954 BuildMI(DispatchBB, dl,
TII->get(ARM::tLDRspi), NewVReg1)
10960 if (NumLPads < 256) {
10961 BuildMI(DispatchBB, dl,
TII->get(ARM::tCMPi8))
10966 MachineConstantPool *
ConstantPool = MF->getConstantPool();
10968 const Constant *
C = ConstantInt::get(Int32Ty, NumLPads);
10971 Align Alignment = MF->getDataLayout().getPrefTypeAlign(Int32Ty);
10975 BuildMI(DispatchBB, dl,
TII->get(ARM::tLDRpci))
10979 BuildMI(DispatchBB, dl,
TII->get(ARM::tCMPr))
10985 BuildMI(DispatchBB, dl,
TII->get(ARM::tBcc))
10991 BuildMI(DispContBB, dl,
TII->get(ARM::tLSLri), NewVReg2)
10998 BuildMI(DispContBB, dl,
TII->get(ARM::tLEApcrelJT), NewVReg3)
11003 BuildMI(DispContBB, dl,
TII->get(ARM::tADDrr), NewVReg4)
11009 MachineMemOperand *JTMMOLd =
11014 BuildMI(DispContBB, dl,
TII->get(ARM::tLDRi), NewVReg5)
11020 unsigned NewVReg6 = NewVReg5;
11021 if (IsPositionIndependent) {
11023 BuildMI(DispContBB, dl,
TII->get(ARM::tADDrr), NewVReg6)
11030 BuildMI(DispContBB, dl,
TII->get(ARM::tBR_JTr))
11035 BuildMI(DispatchBB, dl,
TII->get(ARM::LDRi12), NewVReg1)
11041 if (NumLPads < 256) {
11042 BuildMI(DispatchBB, dl,
TII->get(ARM::CMPri))
11046 }
else if (Subtarget->hasV6T2Ops() &&
isUInt<16>(NumLPads)) {
11048 BuildMI(DispatchBB, dl,
TII->get(ARM::MOVi16), VReg1)
11049 .
addImm(NumLPads & 0xFFFF)
11052 unsigned VReg2 = VReg1;
11053 if ((NumLPads & 0xFFFF0000) != 0) {
11055 BuildMI(DispatchBB, dl,
TII->get(ARM::MOVTi16), VReg2)
11061 BuildMI(DispatchBB, dl,
TII->get(ARM::CMPrr))
11066 MachineConstantPool *
ConstantPool = MF->getConstantPool();
11068 const Constant *
C = ConstantInt::get(Int32Ty, NumLPads);
11071 Align Alignment = MF->getDataLayout().getPrefTypeAlign(Int32Ty);
11075 BuildMI(DispatchBB, dl,
TII->get(ARM::LDRcp))
11080 BuildMI(DispatchBB, dl,
TII->get(ARM::CMPrr))
11092 BuildMI(DispContBB, dl,
TII->get(ARM::MOVsi), NewVReg3)
11098 BuildMI(DispContBB, dl,
TII->get(ARM::LEApcrelJT), NewVReg4)
11102 MachineMemOperand *JTMMOLd =
11106 BuildMI(DispContBB, dl,
TII->get(ARM::LDRrs), NewVReg5)
11113 if (IsPositionIndependent) {
11114 BuildMI(DispContBB, dl,
TII->get(ARM::BR_JTadd))
11119 BuildMI(DispContBB, dl,
TII->get(ARM::BR_JTr))
11126 SmallPtrSet<MachineBasicBlock*, 8> SeenMBBs;
11127 for (MachineBasicBlock *CurMBB : LPadList) {
11128 if (SeenMBBs.
insert(CurMBB).second)
11135 for (MachineBasicBlock *BB : InvokeBBs) {
11139 SmallVector<MachineBasicBlock*, 4> Successors(BB->successors());
11140 while (!Successors.empty()) {
11141 MachineBasicBlock *SMBB = Successors.pop_back_val();
11143 BB->removeSuccessor(SMBB);
11149 BB->normalizeSuccProbs();
11156 II = BB->rbegin(), IE = BB->rend();
II != IE; ++
II) {
11157 if (!
II->isCall())
continue;
11159 DenseSet<unsigned> DefRegs;
11161 OI =
II->operands_begin(), OE =
II->operands_end();
11163 if (!OI->isReg())
continue;
11164 DefRegs.
insert(OI->getReg());
11167 MachineInstrBuilder MIB(*MF, &*
II);
11169 for (
unsigned i = 0; SavedRegs[i] != 0; ++i) {
11170 unsigned Reg = SavedRegs[i];
11171 if (Subtarget->isThumb2() &&
11172 !ARM::tGPRRegClass.contains(
Reg) &&
11173 !ARM::hGPRRegClass.contains(
Reg))
11175 if (Subtarget->isThumb1Only() && !ARM::tGPRRegClass.contains(
Reg))
11177 if (!Subtarget->isThumb() && !ARM::GPRRegClass.contains(
Reg))
11189 for (MachineBasicBlock *MBBLPad : MBBLPads)
11190 MBBLPad->setIsEHPad(
false);
11193 MI.eraseFromParent();
11206static unsigned getLdOpcode(
unsigned LdSize,
bool IsThumb1,
bool IsThumb2) {
11208 return LdSize == 16 ? ARM::VLD1q32wb_fixed
11209 : LdSize == 8 ? ARM::VLD1d32wb_fixed : 0;
11211 return LdSize == 4 ? ARM::tLDRi
11212 : LdSize == 2 ? ARM::tLDRHi
11213 : LdSize == 1 ? ARM::tLDRBi : 0;
11215 return LdSize == 4 ? ARM::t2LDR_POST
11216 : LdSize == 2 ? ARM::t2LDRH_POST
11217 : LdSize == 1 ? ARM::t2LDRB_POST : 0;
11218 return LdSize == 4 ? ARM::LDR_POST_IMM
11219 : LdSize == 2 ? ARM::LDRH_POST
11220 : LdSize == 1 ? ARM::LDRB_POST_IMM : 0;
11225static unsigned getStOpcode(
unsigned StSize,
bool IsThumb1,
bool IsThumb2) {
11227 return StSize == 16 ? ARM::VST1q32wb_fixed
11228 : StSize == 8 ? ARM::VST1d32wb_fixed : 0;
11230 return StSize == 4 ? ARM::tSTRi
11231 : StSize == 2 ? ARM::tSTRHi
11232 : StSize == 1 ? ARM::tSTRBi : 0;
11234 return StSize == 4 ? ARM::t2STR_POST
11235 : StSize == 2 ? ARM::t2STRH_POST
11236 : StSize == 1 ? ARM::t2STRB_POST : 0;
11237 return StSize == 4 ? ARM::STR_POST_IMM
11238 : StSize == 2 ? ARM::STRH_POST
11239 : StSize == 1 ? ARM::STRB_POST_IMM : 0;
11246 unsigned LdSize,
unsigned Data,
unsigned AddrIn,
11247 unsigned AddrOut,
bool IsThumb1,
bool IsThumb2) {
11248 unsigned LdOpc =
getLdOpcode(LdSize, IsThumb1, IsThumb2);
11249 assert(LdOpc != 0 &&
"Should have a load opcode");
11256 }
else if (IsThumb1) {
11262 BuildMI(*BB, Pos, dl,
TII->get(ARM::tADDi8), AddrOut)
11267 }
else if (IsThumb2) {
11287 unsigned StSize,
unsigned Data,
unsigned AddrIn,
11288 unsigned AddrOut,
bool IsThumb1,
bool IsThumb2) {
11289 unsigned StOpc =
getStOpcode(StSize, IsThumb1, IsThumb2);
11290 assert(StOpc != 0 &&
"Should have a store opcode");
11292 BuildMI(*BB, Pos, dl,
TII->get(StOpc), AddrOut)
11297 }
else if (IsThumb1) {
11304 BuildMI(*BB, Pos, dl,
TII->get(ARM::tADDi8), AddrOut)
11309 }
else if (IsThumb2) {
11310 BuildMI(*BB, Pos, dl,
TII->get(StOpc), AddrOut)
11316 BuildMI(*BB, Pos, dl,
TII->get(StOpc), AddrOut)
11331 const TargetInstrInfo *
TII = Subtarget->getInstrInfo();
11337 unsigned SizeVal =
MI.getOperand(2).getImm();
11343 unsigned UnitSize = 0;
11347 bool IsThumb1 = Subtarget->isThumb1Only();
11348 bool IsThumb2 = Subtarget->isThumb2();
11349 bool IsThumb = Subtarget->isThumb();
11351 if (Alignment & 1) {
11353 }
else if (Alignment & 2) {
11358 Subtarget->hasNEON()) {
11359 if ((Alignment % 16 == 0) && SizeVal >= 16)
11361 else if ((Alignment % 8 == 0) && SizeVal >= 8)
11370 bool IsNeon = UnitSize >= 8;
11371 TRC = IsThumb ? &ARM::tGPRRegClass : &ARM::GPRRegClass;
11373 VecTRC = UnitSize == 16 ? &ARM::DPairRegClass
11374 : UnitSize == 8 ? &ARM::DPRRegClass
11377 unsigned BytesLeft = SizeVal % UnitSize;
11378 unsigned LoopSize = SizeVal - BytesLeft;
11380 if (SizeVal <= Subtarget->getMaxInlineSizeThreshold()) {
11384 unsigned srcIn = src;
11385 unsigned destIn = dest;
11386 for (
unsigned i = 0; i < LoopSize; i+=UnitSize) {
11391 IsThumb1, IsThumb2);
11393 IsThumb1, IsThumb2);
11401 for (
unsigned i = 0; i < BytesLeft; i++) {
11406 IsThumb1, IsThumb2);
11408 IsThumb1, IsThumb2);
11412 MI.eraseFromParent();
11438 MF->
insert(It, loopMBB);
11439 MF->
insert(It, exitMBB);
11442 unsigned CallFrameSize =
TII->getCallFrameSizeAt(
MI);
11453 if (Subtarget->useMovt()) {
11454 BuildMI(BB, dl,
TII->get(IsThumb ? ARM::t2MOVi32imm : ARM::MOVi32imm),
11457 }
else if (Subtarget->genExecuteOnly()) {
11458 assert(IsThumb &&
"Non-thumb expected to have used movt");
11463 const Constant *
C = ConstantInt::get(Int32Ty, LoopSize);
11468 MachineMemOperand *CPMMO =
11492 MachineBasicBlock *entryBB = BB;
11507 BuildMI(BB, dl,
TII->get(ARM::PHI), destPhi)
11515 IsThumb1, IsThumb2);
11517 IsThumb1, IsThumb2);
11521 BuildMI(*BB, BB->
end(), dl,
TII->get(ARM::tSUBi8), varLoop)
11527 MachineInstrBuilder MIB =
11529 TII->get(IsThumb2 ? ARM::t2SUBri : ARM::SUBri), varLoop);
11538 TII->get(IsThumb1 ? ARM::tBcc : IsThumb2 ? ARM::t2Bcc : ARM::Bcc))
11547 auto StartOfExit = exitMBB->
begin();
11551 unsigned srcIn = srcLoop;
11552 unsigned destIn = destLoop;
11553 for (
unsigned i = 0; i < BytesLeft; i++) {
11557 emitPostLd(BB, StartOfExit,
TII, dl, 1, scratch, srcIn, srcOut,
11558 IsThumb1, IsThumb2);
11559 emitPostSt(BB, StartOfExit,
TII, dl, 1, scratch, destIn, destOut,
11560 IsThumb1, IsThumb2);
11565 MI.eraseFromParent();
11573 const TargetInstrInfo &
TII = *Subtarget->getInstrInfo();
11576 assert(TM.getTargetTriple().isOSWindows() &&
11577 "__chkstk is only supported on Windows");
11578 assert(Subtarget->isThumb2() &&
"Windows on ARM requires Thumb-2 mode");
11598 RTLIB::LibcallImpl ChkStkLibcall =
getLibcallImpl(RTLIB::STACK_PROBE);
11599 if (ChkStkLibcall == RTLIB::Unsupported)
11603 switch (TM.getCodeModel()) {
11647 MI.eraseFromParent();
11656 const TargetInstrInfo *
TII = Subtarget->getInstrInfo();
11671 .
addReg(
MI.getOperand(0).getReg())
11679 MI.eraseFromParent();
11703 if (miI == BB->
end()) {
11705 if (Succ->isLiveIn(ARM::CPSR))
11711 SelectItr->addRegisterKilled(ARM::CPSR,
TRI);
11723 Register AddDestReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11724 BuildMI(TpEntry, Dl,
TII->get(ARM::t2ADDri), AddDestReg)
11730 Register LsrDestReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11731 BuildMI(TpEntry, Dl,
TII->get(ARM::t2LSRri), LsrDestReg)
11737 Register TotalIterationsReg =
MRI.createVirtualRegister(&ARM::GPRlrRegClass);
11738 BuildMI(TpEntry, Dl,
TII->get(ARM::t2WhileLoopSetup), TotalIterationsReg)
11741 BuildMI(TpEntry, Dl,
TII->get(ARM::t2WhileLoopStart))
11742 .
addUse(TotalIterationsReg)
11749 return TotalIterationsReg;
11760 Register TotalIterationsReg,
bool IsMemcpy) {
11767 SrcPhiReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11768 CurrSrcReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11769 BuildMI(TpLoopBody, Dl,
TII->get(ARM::PHI), SrcPhiReg)
11777 Register DestPhiReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11778 Register CurrDestReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11779 BuildMI(TpLoopBody, Dl,
TII->get(ARM::PHI), DestPhiReg)
11786 Register LoopCounterPhiReg =
MRI.createVirtualRegister(&ARM::GPRlrRegClass);
11787 Register RemainingLoopIterationsReg =
11788 MRI.createVirtualRegister(&ARM::GPRlrRegClass);
11789 BuildMI(TpLoopBody, Dl,
TII->get(ARM::PHI), LoopCounterPhiReg)
11790 .
addUse(TotalIterationsReg)
11792 .
addUse(RemainingLoopIterationsReg)
11796 Register PredCounterPhiReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11797 Register RemainingElementsReg =
MRI.createVirtualRegister(&ARM::rGPRRegClass);
11798 BuildMI(TpLoopBody, Dl,
TII->get(ARM::PHI), PredCounterPhiReg)
11799 .
addUse(ElementCountReg)
11801 .
addUse(RemainingElementsReg)
11805 Register VccrReg =
MRI.createVirtualRegister(&ARM::VCCRRegClass);
11806 BuildMI(TpLoopBody, Dl,
TII->get(ARM::MVE_VCTP8), VccrReg)
11807 .
addUse(PredCounterPhiReg)
11812 BuildMI(TpLoopBody, Dl,
TII->get(ARM::t2SUBri), RemainingElementsReg)
11813 .
addUse(PredCounterPhiReg)
11821 SrcValueReg =
MRI.createVirtualRegister(&ARM::MQPRRegClass);
11822 BuildMI(TpLoopBody, Dl,
TII->get(ARM::MVE_VLDRBU8_post))
11831 SrcValueReg = OpSrcReg;
11833 BuildMI(TpLoopBody, Dl,
TII->get(ARM::MVE_VSTRBU8_post))
11844 BuildMI(TpLoopBody, Dl,
TII->get(ARM::t2LoopDec), RemainingLoopIterationsReg)
11845 .
addUse(LoopCounterPhiReg)
11848 BuildMI(TpLoopBody, Dl,
TII->get(ARM::t2LoopEnd))
11849 .
addUse(RemainingLoopIterationsReg)
11867 "Invalid call instruction for a KCFI check");
11870 switch (
MBBI->getOpcode()) {
11873 case ARM::BLX_pred:
11874 case ARM::BLX_noip:
11875 case ARM::BLX_pred_noip:
11877 TargetOp = &
MBBI->getOperand(0);
11879 case ARM::TCRETURNri:
11880 case ARM::TCRETURNrinotr12:
11881 case ARM::TAILJMPr:
11882 case ARM::TAILJMPr4:
11883 TargetOp = &
MBBI->getOperand(0);
11889 case ARM::tBLXr_noip:
11890 case ARM::tBX_CALL:
11891 TargetOp = &
MBBI->getOperand(2);
11894 case ARM::tTAILJMPr:
11895 TargetOp = &
MBBI->getOperand(0);
11901 assert(TargetOp && TargetOp->
isReg() &&
"Invalid target operand");
11905 unsigned KCFICheckOpcode;
11906 if (Subtarget->isThumb()) {
11907 if (Subtarget->isThumb2()) {
11908 KCFICheckOpcode = ARM::KCFI_CHECK_Thumb2;
11910 KCFICheckOpcode = ARM::KCFI_CHECK_Thumb1;
11913 KCFICheckOpcode = ARM::KCFI_CHECK_ARM;
11927 bool isThumb2 = Subtarget->isThumb2();
11928 switch (
MI.getOpcode()) {
11935 case ARM::tLDR_postidx: {
11939 .
add(
MI.getOperand(2))
11940 .
add(
MI.getOperand(3))
11941 .
add(
MI.getOperand(4))
11942 .
add(
MI.getOperand(0))
11944 MI.eraseFromParent();
11948 case ARM::MVE_MEMCPYLOOPINST:
11949 case ARM::MVE_MEMSETLOOPINST: {
11979 Register OpDestReg =
MI.getOperand(0).getReg();
11980 Register OpSrcReg =
MI.getOperand(1).getReg();
11981 Register OpSizeReg =
MI.getOperand(2).getReg();
12001 if (TpExit == BB) {
12003 "block containing memcpy/memset Pseudo");
12016 bool IsMemcpy =
MI.getOpcode() == ARM::MVE_MEMCPYLOOPINST;
12018 OpDestReg, OpSizeReg, TotalIterationsReg, IsMemcpy);
12021 Properties.resetNoPHIs();
12033 MI.eraseFromParent();
12043 case ARM::t2STR_preidx:
12044 MI.setDesc(
TII->get(ARM::t2STR_PRE));
12046 case ARM::t2STRB_preidx:
12047 MI.setDesc(
TII->get(ARM::t2STRB_PRE));
12049 case ARM::t2STRH_preidx:
12050 MI.setDesc(
TII->get(ARM::t2STRH_PRE));
12053 case ARM::STRi_preidx:
12054 case ARM::STRBi_preidx: {
12055 unsigned NewOpc =
MI.getOpcode() == ARM::STRi_preidx ? ARM::STR_PRE_IMM
12056 : ARM::STRB_PRE_IMM;
12058 unsigned Offset =
MI.getOperand(4).getImm();
12066 .
add(
MI.getOperand(0))
12067 .
add(
MI.getOperand(1))
12068 .
add(
MI.getOperand(2))
12070 .
add(
MI.getOperand(5))
12071 .
add(
MI.getOperand(6))
12073 MI.eraseFromParent();
12076 case ARM::STRr_preidx:
12077 case ARM::STRBr_preidx:
12078 case ARM::STRH_preidx: {
12080 switch (
MI.getOpcode()) {
12082 case ARM::STRr_preidx: NewOpc = ARM::STR_PRE_REG;
break;
12083 case ARM::STRBr_preidx: NewOpc = ARM::STRB_PRE_REG;
break;
12084 case ARM::STRH_preidx: NewOpc = ARM::STRH_PRE;
break;
12089 MI.eraseFromParent();
12093 case ARM::tMOVCCr_pseudo: {
12111 F->insert(It, copy0MBB);
12112 F->insert(It, sinkMBB);
12115 unsigned CallFrameSize =
TII->getCallFrameSizeAt(
MI);
12121 if (!
MI.killsRegister(ARM::CPSR,
nullptr) &&
12137 .
addImm(
MI.getOperand(3).getImm())
12138 .
addReg(
MI.getOperand(4).getReg());
12153 .
addReg(
MI.getOperand(1).getReg())
12155 .
addReg(
MI.getOperand(2).getReg())
12158 MI.eraseFromParent();
12163 case ARM::BCCZi64: {
12169 bool RHSisZero =
MI.getOpcode() == ARM::BCCZi64;
12174 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
12178 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
12184 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2CMPrr : ARM::CMPrr))
12188 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2CMPrr : ARM::CMPrr))
12198 BuildMI(BB, dl,
TII->get(isThumb2 ? ARM::t2Bcc : ARM::Bcc))
12207 MI.eraseFromParent();
12211 case ARM::Int_eh_sjlj_setjmp:
12212 case ARM::Int_eh_sjlj_setjmp_nofp:
12213 case ARM::tInt_eh_sjlj_setjmp:
12214 case ARM::t2Int_eh_sjlj_setjmp:
12215 case ARM::t2Int_eh_sjlj_setjmp_nofp:
12218 case ARM::Int_eh_sjlj_setup_dispatch:
12219 EmitSjLjDispatchBlock(
MI, BB);
12221 case ARM::COPY_STRUCT_BYVAL_I32:
12223 return EmitStructByval(
MI, BB);
12224 case ARM::WIN__CHKSTK:
12225 return EmitLowered__chkstk(
MI, BB);
12226 case ARM::WIN__DBZCHK:
12227 return EmitLowered__dbzchk(
MI, BB);
12236 bool isThumb1 =
Subtarget->isThumb1Only();
12243 if (!
Node->hasAnyUseOfValue(0)) {
12244 MI.getOperand(0).setIsDead(
true);
12246 if (!
Node->hasAnyUseOfValue(1)) {
12247 MI.getOperand(1).setIsDead(
true);
12251 for (
unsigned I = 0;
I !=
MI.getOperand(4).
getImm(); ++
I) {
12252 Register TmpReg =
MRI.createVirtualRegister(isThumb1 ? &ARM::tGPRRegClass
12253 : &ARM::GPRRegClass);
12260 if (
MI.getOpcode() == ARM::MEMCPY) {
12281 MI.getDesc().getNumOperands() + 5 -
MI.getDesc().getSize()
12282 &&
"converted opcode should be the same except for cc_out"
12283 " (and, on Thumb1, pred)");
12291 if (Subtarget->isThumb1Only()) {
12292 for (
unsigned c =
MCID->getNumOperands() - 4; c--;) {
12293 MI.addOperand(
MI.getOperand(1));
12294 MI.removeOperand(1);
12298 for (
unsigned i =
MI.getNumOperands(); i--;) {
12300 if (
op.isReg() &&
op.isUse()) {
12303 MI.tieOperands(DefIdx, i);
12311 ccOutIdx =
MCID->getNumOperands() - 1;
12313 ccOutIdx =
MCID->getNumOperands() - 1;
12317 if (!
MI.hasOptionalDef() || !
MCID->operands()[ccOutIdx].isOptionalDef()) {
12318 assert(!NewOpc &&
"Optional cc_out operand required");
12324 bool deadCPSR =
false;
12325 for (
unsigned i =
MCID->getNumOperands(), e =
MI.getNumOperands(); i != e;
12332 MI.removeOperand(i);
12337 assert(!NewOpc &&
"Optional cc_out operand required");
12340 assert(deadCPSR == !
Node->hasAnyUseOfValue(1) &&
"inconsistent dead flag");
12342 assert(!
MI.getOperand(ccOutIdx).getReg() &&
12343 "expect uninitialized optional cc_out operand");
12345 if (!Subtarget->isThumb1Only())
12382 switch (
N->getOpcode()) {
12383 default:
return false;
12385 CC =
N->getOperand(0);
12407 EVT VT =
N->getValueType(0);
12408 CC =
N->getOperand(0);
12409 if (
CC.getValueType() != MVT::i1 ||
CC.getOpcode() !=
ISD::SETCC)
12455 EVT VT =
N->getValueType(0);
12458 bool SwapSelectOps;
12460 NonConstantVal, DAG))
12466 OtherOp, NonConstantVal);
12472 CCOp, TrueVal, FalseVal);
12492 if (
N->getOpcode() == ARMISD::VUZP)
12496 if (
N->getOpcode() == ARMISD::VTRN &&
N->getValueType(0) == MVT::v2i32)
12511 if (!
N->getValueType(0).is64BitVector())
12519 EVT VT =
N->getValueType(0);
12558 EVT VT =
N->getValueType(0);
12564 Opcode = Intrinsic::arm_neon_vpaddls;
12566 Opcode = Intrinsic::arm_neon_vpaddlu;
12594 EVT VT =
N->getValueType(0);
12609 unsigned nextIndex = 0;
12631 if (!
C0 || !
C1 ||
C0->getZExtValue() != nextIndex
12632 ||
C1->getZExtValue() != nextIndex+1)
12660 Ops.push_back(Vec);
12677 return DAG.
getNode(ExtOp, dl, VT, tmp);
12708 if (SRA.getOpcode() !=
ISD::SRA) {
12715 if (Const->getZExtValue() != 31)
12720 if (SRA.getOperand(0) !=
Mul)
12724 SDLoc dl(AddcNode);
12725 unsigned Opcode = 0;
12730 Opcode = ARMISD::SMLALBB;
12731 Op0 =
Mul.getOperand(0);
12732 Op1 =
Mul.getOperand(1);
12734 Opcode = ARMISD::SMLALBT;
12735 Op0 =
Mul.getOperand(0);
12736 Op1 =
Mul.getOperand(1).getOperand(0);
12738 Opcode = ARMISD::SMLALTB;
12739 Op0 =
Mul.getOperand(0).getOperand(0);
12740 Op1 =
Mul.getOperand(1);
12742 Opcode = ARMISD::SMLALTT;
12743 Op0 =
Mul->getOperand(0).getOperand(0);
12744 Op1 =
Mul->getOperand(1).getOperand(0);
12788 AddeSubeNode->
getOpcode() == ARMISD::SUBE) &&
12789 "Expect an ADDE or SUBE");
12793 "ADDE node has the wrong inputs");
12800 if ((AddeSubeNode->
getOpcode() == ARMISD::ADDE &&
12801 AddcSubcNode->
getOpcode() != ARMISD::ADDC) ||
12802 (AddeSubeNode->
getOpcode() == ARMISD::SUBE &&
12803 AddcSubcNode->
getOpcode() != ARMISD::SUBC))
12815 "Expect ADDC with two result values. First: i32");
12819 if (AddeSubeNode->
getOpcode() == ARMISD::ADDE &&
12835 bool IsLeftOperandMUL =
false;
12840 IsLeftOperandMUL =
true;
12851 SDValue *LowAddSub =
nullptr;
12854 if ((AddeSubeOp0 != MULOp.
getValue(1)) && (AddeSubeOp1 != MULOp.
getValue(1)))
12857 if (IsLeftOperandMUL)
12858 HiAddSub = &AddeSubeOp1;
12860 HiAddSub = &AddeSubeOp0;
12865 if (AddcSubcOp0 == MULOp.
getValue(0)) {
12866 LoMul = &AddcSubcOp0;
12867 LowAddSub = &AddcSubcOp1;
12869 if (AddcSubcOp1 == MULOp.
getValue(0)) {
12870 LoMul = &AddcSubcOp1;
12871 LowAddSub = &AddcSubcOp0;
12879 if (AddcSubcNode == HiAddSub->getNode() ||
12896 FinalOpc == ARMISD::SMLAL &&
12900 Ops.push_back(*HiAddSub);
12901 if (AddcSubcNode->
getOpcode() == ARMISD::SUBC) {
12902 FinalOpc = ARMISD::SMMLSR;
12904 FinalOpc = ARMISD::SMMLAR;
12909 return SDValue(AddeSubeNode, 0);
12910 }
else if (AddcSubcNode->
getOpcode() == ARMISD::SUBC)
12916 Ops.push_back(*LowAddSub);
12917 Ops.push_back(*HiAddSub);
12930 return SDValue(AddeSubeNode, 0);
12950 if (AddcNode->
getOpcode() != ARMISD::ADDC)
12954 SDNode *UmlalNode =
nullptr;
12998 SDNode* AddcNode =
N->getOperand(2).getNode();
12999 SDNode* AddeNode =
N->getOperand(3).getNode();
13000 if ((AddcNode->
getOpcode() == ARMISD::ADDC) &&
13001 (AddeNode->
getOpcode() == ARMISD::ADDE) &&
13007 {N->getOperand(0), N->getOperand(1),
13008 AddcNode->getOperand(0), AddcNode->getOperand(1)});
13018 if (
N->getOpcode() == ARMISD::SUBC &&
N->hasAnyUseOfValue(1)) {
13022 if (
LHS->getOpcode() == ARMISD::ADDE &&
13032 int32_t imm =
C->getSExtValue();
13033 if (imm < 0 && imm > std::numeric_limits<int>::min()) {
13036 unsigned Opcode = (
N->getOpcode() == ARMISD::ADDC) ? ARMISD::SUBC
13038 return DAG.
getNode(Opcode,
DL,
N->getVTList(),
N->getOperand(0),
RHS);
13053 int64_t imm =
C->getSExtValue();
13062 unsigned Opcode = (
N->getOpcode() == ARMISD::ADDE) ? ARMISD::SUBE
13064 return DAG.
getNode(Opcode,
DL,
N->getVTList(),
13065 N->getOperand(0),
RHS,
N->getOperand(2));
13090 SetCC =
N->getOperand(0);
13094 TrueVal =
N->getOperand(1);
13095 FalseVal =
N->getOperand(2);
13097 LHS =
N->getOperand(0);
13098 RHS =
N->getOperand(1);
13099 CC =
N->getOperandCondCode(4);
13100 TrueVal =
N->getOperand(2);
13101 FalseVal =
N->getOperand(3);
13106 unsigned int Opcode = 0;
13110 Opcode = ARMISD::VMINVu;
13116 Opcode = ARMISD::VMINVs;
13122 Opcode = ARMISD::VMAXVu;
13128 Opcode = ARMISD::VMAXVs;
13135 switch (TrueVal->getOpcode()) {
13154 if (TrueVal !=
LHS || FalseVal !=
RHS)
13157 EVT LeftType =
LHS->getValueType(0);
13158 EVT RightType =
RHS->getValueType(0);
13161 if (LeftType != VectorScalarType || RightType != VectorScalarType)
13165 if (VectorScalarType != MVT::i32)
13173 if (VectorScalarType != MVT::i32)
13186 EVT VT =
N->getValueType(0);
13194 Shft =
N->getOperand(0);
13201 Cmp.getOperand(0) !=
N->getOperand(1) ||
13202 Cmp.getOperand(1) !=
N->getOperand(2))
13204 Shft =
N->getOperand(1);
13216 ScalarType = MVT::i8;
13219 case (1 << 15) - 1:
13220 ScalarType = MVT::i16;
13223 case (1ULL << 31) - 1:
13224 ScalarType = MVT::i32;
13255 unsigned LegalLanes = 128 / (ShftAmt + 1);
13267 Inp0 = DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, LegalVecVT, Inp0);
13268 Inp1 = DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, LegalVecVT, Inp1);
13269 SDValue VQDMULH = DAG.
getNode(ARMISD::VQDMULH,
DL, LegalVecVT, Inp0, Inp1);
13286 SDValue VQDMULH = DAG.
getNode(ARMISD::VQDMULH,
DL, LegalVecVT, Inp0, Inp1);
13301 if (
N->getOperand(0).getOpcode() == ARMISD::PREDICATE_CAST &&
13303 unsigned C =
N->getOperand(0).getConstantOperandVal(0);
13305 return N->getOperand(2);
13307 return N->getOperand(1);
13322 if (
N->getOperand(0).getOpcode() !=
ISD::XOR)
13332 if (!Const || !Const->isOne())
13350 EVT VT =
N->getValueType(0);
13381 Opc = Intrinsic::arm_mve_vctp32;
13384 Opc = Intrinsic::arm_mve_vctp16;
13387 Opc = Intrinsic::arm_mve_vctp8;
13441 EVT VT =
N->getValueType(0);
13447 switch (
Op.getOpcode()) {
13449 case ARMISD::VADDVs:
13450 case ARMISD::VADDVu:
13451 case ARMISD::VMLAVs:
13452 case ARMISD::VMLAVu:
13472 unsigned N0RedOp = 0;
13479 unsigned N1RedOp = 0;
13493 if (
SDValue R = DistrubuteAddAddVecReduce(N0, N1))
13495 if (
SDValue R = DistrubuteAddAddVecReduce(N1, N0))
13502 auto DistrubuteVecReduceLoad = [&](
SDValue N0,
SDValue N1,
bool IsForward) {
13526 if (!BaseLocDecomp0.getBase() ||
13527 BaseLocDecomp0.getBase() != BaseLocDecomp1.getBase() ||
13528 !BaseLocDecomp0.hasValidOffset() || !BaseLocDecomp1.hasValidOffset())
13530 if (BaseLocDecomp0.getOffset() < BaseLocDecomp1.getOffset())
13532 if (BaseLocDecomp0.getOffset() > BaseLocDecomp1.getOffset())
13542 if (IsBefore < 0) {
13545 }
else if (IsBefore > 0) {
13558 }
else if (IsForward && IsVecReduce(N0) && IsVecReduce(N1) &&
13568 if (!IsVecReduce(N0) || !IsVecReduce(N1))
13578 if (
SDValue R = DistrubuteVecReduceLoad(N0, N1,
true))
13580 if (
SDValue R = DistrubuteVecReduceLoad(N1, N0,
false))
13593 EVT VT =
N->getValueType(0);
13598 if (VT != MVT::i64)
13609 auto MakeVecReduce = [&](
unsigned Opcode,
unsigned OpcodeA,
SDValue NA,
13629 unsigned S = VecRed->
getOpcode() == OpcodeA ? 2 : 0;
13638 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVs, ARMISD::VADDLVAs, N0, N1))
13640 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVu, ARMISD::VADDLVAu, N0, N1))
13642 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVs, ARMISD::VADDLVAs, N1, N0))
13644 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVu, ARMISD::VADDLVAu, N1, N0))
13646 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVps, ARMISD::VADDLVAps, N0, N1))
13648 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVpu, ARMISD::VADDLVApu, N0, N1))
13650 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVps, ARMISD::VADDLVAps, N1, N0))
13652 if (
SDValue M = MakeVecReduce(ARMISD::VADDLVpu, ARMISD::VADDLVApu, N1, N0))
13654 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVs, ARMISD::VMLALVAs, N0, N1))
13656 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVu, ARMISD::VMLALVAu, N0, N1))
13658 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVs, ARMISD::VMLALVAs, N1, N0))
13660 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVu, ARMISD::VMLALVAu, N1, N0))
13662 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVps, ARMISD::VMLALVAps, N0, N1))
13664 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVpu, ARMISD::VMLALVApu, N0, N1))
13666 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVps, ARMISD::VMLALVAps, N1, N0))
13668 if (
SDValue M = MakeVecReduce(ARMISD::VMLALVpu, ARMISD::VMLALVApu, N1, N0))
13678 "Expected shift op");
13680 SDValue ShiftLHS =
N->getOperand(0);
13694 if (Subtarget->isThumb1Only()) {
13705 if (Const->getAPIntValue().ult(256))
13708 Const->getAPIntValue().sgt(-256))
13724 (
N->getOperand(0).getOpcode() ==
ISD::SHL ||
13725 N->getOperand(0).getOpcode() ==
ISD::SRL) &&
13726 "Expected XOR(SHIFT) pattern");
13731 if (XorC && ShiftC) {
13732 unsigned MaskIdx, MaskLen;
13733 if (XorC->getAPIntValue().isShiftedMask(MaskIdx, MaskLen)) {
13734 unsigned ShiftAmt = ShiftC->getZExtValue();
13735 unsigned BitWidth =
N->getValueType(0).getScalarSizeInBits();
13736 if (
N->getOperand(0).getOpcode() ==
ISD::SHL)
13737 return MaskIdx == ShiftAmt && MaskLen == (
BitWidth - ShiftAmt);
13738 return MaskIdx == 0 && MaskLen == (
BitWidth - ShiftAmt);
13748 N->getOperand(0).getOpcode() ==
ISD::SRL) ||
13750 N->getOperand(0).getOpcode() ==
ISD::SHL)) &&
13751 "Expected shift-shift mask");
13753 if (!Subtarget->isThumb1Only())
13756 EVT VT =
N->getValueType(0);
13764 unsigned BinOpcode,
EVT VT,
unsigned SelectOpcode,
SDValue X,
13766 return Subtarget->hasMVEIntegerOps() &&
isTypeLegal(VT) &&
13771 if (!Subtarget->hasNEON() && !Subtarget->hasMVEIntegerOps()) {
13772 if (Subtarget->isThumb1Only())
13786 return Subtarget->hasVFP2Base();
13788 return Subtarget->hasVFP2Base();
13790 return Subtarget->hasFP64();
13793 return Subtarget->hasMVEFloatOps();
13822 if (ST->isThumb1Only())
13826 for (
auto *U :
N->users()) {
13827 switch(U->getOpcode()) {
13845 if (U->getOperand(0).getOpcode() ==
ISD::SHL ||
13846 U->getOperand(1).getOpcode() ==
ISD::SHL)
13856 if (
N->getOperand(0).getOpcode() !=
ISD::SHL)
13863 if (!C1ShlC2 || !C2)
13866 APInt C2Int = C2->getAPIntValue();
13867 APInt C1Int = C1ShlC2->getAPIntValue();
13869 if (C2Int.
uge(C2Width))
13875 if ((C1Int & Mask) != C1Int)
13882 auto LargeImm = [](
const APInt &
Imm) {
13883 unsigned Zeros =
Imm.countl_zero() +
Imm.countr_zero();
13884 return Imm.getBitWidth() - Zeros > 8;
13887 if (LargeImm(C1Int) || LargeImm(C2Int))
13899 SHL.dump();
N->dump());
13960 if (
Op.hasOneUse() && ShiftAmt &&
13961 ShiftAmt->
getZExtValue() ==
Op.getValueType().getScalarSizeInBits() - 1)
14019 if (!
Subtarget->hasMVEIntegerOps() || !
N->getValueType(0).isVector())
14040 return DCI.
DAG.
getNode(ARMISD::VDUP, dl,
N->getValueType(0), Negate);
14080 EVT VT =
N->getValueType(0);
14091 EVT VT =
N->getValueType(0);
14092 if (VT != MVT::v2i64)
14103 return Op->getOperand(0);
14117 And =
And->getOperand(0);
14122 Mask = Mask->getOperand(0);
14125 Mask.getValueType() != MVT::v4i32)
14131 return And->getOperand(0);
14136 if (
SDValue Op0 = IsSignExt(N0)) {
14137 if (
SDValue Op1 = IsSignExt(N1)) {
14138 SDValue New0a = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Op0);
14139 SDValue New1a = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Op1);
14140 return DAG.
getNode(ARMISD::VMULLs, dl, VT, New0a, New1a);
14143 if (
SDValue Op0 = IsZeroExt(N0)) {
14144 if (
SDValue Op1 = IsZeroExt(N1)) {
14145 SDValue New0a = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Op0);
14146 SDValue New1a = DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v4i32, Op1);
14147 return DAG.
getNode(ARMISD::VMULLu, dl, VT, New0a, New1a);
14159 EVT VT =
N->getValueType(0);
14160 if (
Subtarget->hasMVEIntegerOps() && VT == MVT::v2i64)
14171 if (VT != MVT::i32)
14178 int64_t MulAmt =
C->getSExtValue();
14181 ShiftAmt = ShiftAmt & (32 - 1);
14186 MulAmt >>= ShiftAmt;
14247 if (
N->getValueType(0) != MVT::i32)
14256 if (
C1 == 255 ||
C1 == 65535)
14259 SDNode *N0 =
N->getOperand(0).getNode();
14273 if (!C2 || C2 >= 32)
14317 if (Trailing == C2 && C2 + C3 < 32) {
14330 if (Leading == C2 && C2 + C3 < 32) {
14358 EVT VT =
N->getValueType(0);
14362 VT == MVT::v4i1 || VT == MVT::v8i1 || VT == MVT::v16i1)
14365 APInt SplatBits, SplatUndef;
14366 unsigned SplatBitSize;
14369 BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
14370 if (SplatBitSize == 8 || SplatBitSize == 16 || SplatBitSize == 32 ||
14371 SplatBitSize == 64) {
14378 DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VbicVT,
N->getOperand(0));
14380 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Vbic);
14410 SDValue SRL = OR->getOperand(0);
14411 SDValue SHL = OR->getOperand(1);
14414 SRL = OR->getOperand(1);
14415 SHL = OR->getOperand(0);
14422 if ((SRL.getOperand(0).getNode() != SHL.getOperand(0).getNode()) ||
14426 SDNode *SMULLOHI = SRL.getOperand(0).getNode();
14427 if (SRL.getOperand(0) !=
SDValue(SMULLOHI, 0) ||
14428 SHL.getOperand(0) !=
SDValue(SMULLOHI, 1))
14447 unsigned Opcode = 0;
14448 if (
isS16(OpS16, DAG))
14449 Opcode = ARMISD::SMULWB;
14451 Opcode = ARMISD::SMULWT;
14469 EVT VT =
N->getValueType(0);
14484 if (VT != MVT::i32)
14497 if (Mask == 0xffff)
14504 if ((Val & ~Mask) != Val)
14510 Res = DAG.
getNode(ARMISD::BFI,
DL, VT, N00,
14529 (Mask == ~Mask2)) {
14533 (Mask == 0xffff || Mask == 0xffff0000))
14539 Res = DAG.
getNode(ARMISD::BFI,
DL, VT, N00, Res,
14546 (~Mask == Mask2)) {
14550 (Mask2 == 0xffff || Mask2 == 0xffff0000))
14606 if (
N->getOpcode() == ARMISD::VCMP)
14608 else if (
N->getOpcode() == ARMISD::VCMPZ)
14623 EVT VT =
N->getValueType(0);
14628 auto IsFreelyInvertable = [&](
SDValue V) {
14629 if (
V->getOpcode() == ARMISD::VCMP ||
V->getOpcode() == ARMISD::VCMPZ)
14635 if (!(IsFreelyInvertable(N0) || IsFreelyInvertable(N1)))
14653 if (AndOp.getOpcode() !=
ISD::AND)
14657 SDValue Mask = AndOp.getOperand(1);
14667 bool IsShiftRight =
false;
14670 if (ShiftOp.
getOpcode() == ARMISD::VSHRuIMM) {
14671 IsShiftRight =
true;
14674 }
else if (ShiftOp.
getOpcode() == ARMISD::VSHLIMM) {
14682 APInt RequiredMask = IsShiftRight
14685 if (MaskBits != RequiredMask)
14688 unsigned Opc = IsShiftRight ? ARMISD::VSRIIMM : ARMISD::VSLIIMM;
14698 EVT VT =
N->getValueType(0);
14704 if (
Subtarget->hasMVEIntegerOps() && (VT == MVT::v2i1 || VT == MVT::v4i1 ||
14705 VT == MVT::v8i1 || VT == MVT::v16i1))
14708 APInt SplatBits, SplatUndef;
14709 unsigned SplatBitSize;
14712 BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
14713 if (SplatBitSize == 8 || SplatBitSize == 16 || SplatBitSize == 32 ||
14714 SplatBitSize == 64) {
14721 DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VorrVT,
N->getOperand(0));
14723 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Vorr);
14744 (VT == MVT::v16i8 || VT == MVT::v8i16 || VT == MVT::v4i32)))) {
14747 return ShiftInsert;
14751 return ShiftInsert;
14765 unsigned SplatBitSize;
14768 APInt SplatBits0, SplatBits1;
14772 if (BVN0 && BVN0->
isConstantSplat(SplatBits0, SplatUndef, SplatBitSize,
14773 HasAnyUndefs) && !HasAnyUndefs) {
14774 if (BVN1 && BVN1->
isConstantSplat(SplatBits1, SplatUndef, SplatBitSize,
14775 HasAnyUndefs) && !HasAnyUndefs) {
14780 SplatBits0 == ~SplatBits1) {
14791 DAG.
getNode(ARMISD::VBSP, dl, CanonicalVT, Mask,
LHS,
RHS);
14792 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT, Result);
14812 if (CSINC.
getOpcode() != ARMISD::CSINC)
14814 if (CSINC.
getOpcode() == ARMISD::CSINC &&
14827 EVT VT =
N->getValueType(0);
14847 if (
TLI->isConstTrueVal(N1) &&
14870 assert(
N->getOpcode() == ARMISD::BFI);
14873 ToMask =
~N->getConstantOperandAPInt(2);
14893 unsigned LastActiveBitInA =
A.countr_zero();
14894 unsigned FirstActiveBitInB =
B.getBitWidth() -
B.countl_zero() - 1;
14895 return LastActiveBitInA - 1 == FirstActiveBitInB;
14900 APInt ToMask, FromMask;
14905 if (
V.getOpcode() != ARMISD::BFI)
14908 APInt NewToMask, NewFromMask;
14910 if (NewFrom != From)
14914 if ((NewToMask & ToMask).getBoolValue())
14939 unsigned InvMask =
N->getConstantOperandVal(2);
14943 static_cast<unsigned>(std::numeric_limits<unsigned>::digits) &&
14944 "undefined behavior");
14945 unsigned Mask = (1u << Width) - 1;
14947 if ((Mask & (~Mask2)) == 0)
14949 N->getOperand(0), N1.
getOperand(0),
N->getOperand(2));
14956 APInt ToMask1, FromMask1;
14959 APInt ToMask2, FromMask2;
14965 APInt NewFromMask = FromMask1 | FromMask2;
14966 APInt NewToMask = ToMask1 | ToMask2;
14968 EVT VT =
N->getValueType(0);
14971 if (NewFromMask[0] == 0)
14974 return DAG.
getNode(ARMISD::BFI, dl, VT, CombineBFI.getOperand(0), From1,
14982 if (
N->getOperand(0).getOpcode() == ARMISD::BFI) {
14983 APInt ToMask1 =
~N->getConstantOperandAPInt(2);
14984 APInt ToMask2 = ~N0.getConstantOperandAPInt(2);
14986 if (!N0.
hasOneUse() || (ToMask1 & ToMask2) != 0 ||
14990 EVT VT =
N->getValueType(0);
14993 N->getOperand(1),
N->getOperand(2));
15005 if (Cmp->getOpcode() != ARMISD::CMPZ || !
isNullConstant(Cmp->getOperand(1)))
15007 SDValue CSInc = Cmp->getOperand(0);
15017 if (CSInc.
getOpcode() == ARMISD::CSINC &&
15057 if (
N->getConstantOperandVal(2) ==
ARMCC::EQ)
15058 return DAG.
getNode(
N->getOpcode(),
SDLoc(
N), MVT::i32,
N->getOperand(0),
15061 if (
N->getConstantOperandVal(2) ==
ARMCC::NE)
15063 N->getOpcode(),
SDLoc(
N), MVT::i32,
N->getOperand(0),
15076 SDValue InDouble =
N->getOperand(0);
15091 SDValue BasePtr = LD->getBasePtr();
15093 DAG.
getLoad(MVT::i32,
DL, LD->getChain(), BasePtr, LD->getPointerInfo(),
15094 LD->getAlign(), LD->getMemOperand()->getFlags());
15100 LD->getPointerInfo().getWithOffset(4),
15102 LD->getMemOperand()->getFlags());
15121 BV.
getOpcode() == ARMISD::VECTOR_REG_CAST) &&
15172 if (Op0.
getOpcode() == ARMISD::VMOVRRD &&
15185 if (Op0->
getOpcode() == ARMISD::VMOVrh)
15198 if (Copy.getValueType() == MVT::f32 &&
15200 bool HasGlue = Copy->getNumOperands() == 3;
15201 SDValue Ops[] = {Copy->getOperand(0), Copy->getOperand(1),
15202 HasGlue ? Copy->getOperand(2) :
SDValue()};
15203 EVT OutTys[] = {
N->getValueType(0), MVT::Other, MVT::Glue};
15222 if (LN0->hasOneUse() && LN0->isUnindexed() &&
15223 LN0->getMemoryVT() == MVT::i16) {
15226 LN0->getBasePtr(), LN0->getMemOperand());
15236 if (
TLI.SimplifyDemandedBits(Op0, DemandedMask, DCI))
15244 EVT VT =
N->getValueType(0);
15275 if (Op0->
getOpcode() == ARMISD::VMOVsr)
15285 unsigned NumElts =
N->getValueType(0).getVectorNumElements();
15286 for (
unsigned i = 0; i < NumElts; ++i) {
15287 SDNode *Elt =
N->getOperand(i).getNode();
15304 if (
N->getNumOperands() == 2)
15310 EVT VT =
N->getValueType(0);
15316 for (
unsigned i = 0; i < NumElts; ++i) {
15335 unsigned NumParts =
N->getNumOperands();
15348 unsigned EltBits =
SubVecTy.getScalarSizeInBits();
15349 if (EltBits != 8 && EltBits != 16 && EltBits != 32)
15353 for (
const SDValue &Operand :
N->op_values()) {
15363 unsigned Bytes =
SubVecTy.getStoreSize().getFixedValue();
15383 static constexpr Intrinsic::ID NEONLoads[] = {Intrinsic::arm_neon_vld2,
15384 Intrinsic::arm_neon_vld3,
15385 Intrinsic::arm_neon_vld4};
15389 IID =
NumParts == 2 ? Intrinsic::arm_mve_vld2q : Intrinsic::arm_mve_vld4q;
15425 unsigned NumParts =
N->getNumOperands();
15439 unsigned EltBits =
SubVecTy.getScalarSizeInBits();
15440 if (EltBits != 8 && EltBits != 16 && EltBits != 32)
15445 unsigned MinNumElements =
SubVecTy.getVectorMinNumElements();
15466 if (
Subtarget->hasMVEIntegerOps() &&
Load->getAlign() < EltBits / 8)
15469 static constexpr Intrinsic::ID NEONLoads[] = {Intrinsic::arm_neon_vld2,
15470 Intrinsic::arm_neon_vld3,
15471 Intrinsic::arm_neon_vld4};
15478 IID =
NumParts == 2 ? Intrinsic::arm_mve_vld2q : Intrinsic::arm_mve_vld4q;
15486 Load->getMemoryVT(),
Load->getMemOperand());
15489 for (
unsigned Idx = 0; Idx <
NumParts; Idx++)
15501 EVT VT =
N->getValueType(0);
15507 auto IsExtractFromBuildVec = [](
SDValue V,
SDValue &BV, int64_t &Lane) {
15511 BV = BV.getOperand(0);
15513 BV.getNumOperands() == 4 &&
15514 BV.getValueType().getScalarSizeInBits() == 32;
15517 int64_t Lane1, Lane2;
15518 if (IsExtractFromBuildVec(
N->getOperand(0), BV1, Lane1) &&
15519 IsExtractFromBuildVec(
N->getOperand(1), BV2, Lane2))
15548 assert(EltVT == MVT::f32 &&
"Unexpected type!");
15553 Use->getValueType(0).isFloatingPoint())
15561 unsigned NumOfBitCastedElts = 0;
15563 unsigned NumOfRelevantElts = NumElts;
15564 for (
unsigned Idx = 0; Idx < NumElts; ++Idx) {
15569 ++NumOfBitCastedElts;
15573 --NumOfRelevantElts;
15577 if (NumOfBitCastedElts <= NumOfRelevantElts / 2)
15584 if (!
TLI.isTypeLegal(VecVT))
15594 for (
unsigned Idx = 0 ; Idx < NumElts; ++Idx) {
15599 V->getOperand(0).getValueType() == MVT::i32)
15601 V =
V.getOperand(0);
15618 EVT VT =
N->getValueType(0);
15623 if (
Op->getOpcode() == ARMISD::PREDICATE_CAST) {
15625 if (
Op->getOperand(0).getValueType() == VT)
15626 return Op->getOperand(0);
15627 return DCI.
DAG.
getNode(ARMISD::PREDICATE_CAST, dl, VT,
Op->getOperand(0));
15634 DCI.
DAG.
getNode(ARMISD::PREDICATE_CAST, dl, VT,
Op->getOperand(0));
15641 if (
Op.getValueType() == MVT::i32) {
15644 if (
TLI.SimplifyDemandedBits(
Op, DemandedMask, DCI))
15652 EVT VT =
N->getValueType(0);
15657 if (ST->isLittle())
15661 if (
Op.getValueType() == VT)
15668 if (
Op->getOpcode() == ARMISD::VECTOR_REG_CAST) {
15670 if (
Op->getOperand(0).getValueType() == VT)
15671 return Op->getOperand(0);
15672 return DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, VT,
Op->getOperand(0));
15683 EVT VT =
N->getValueType(0);
15691 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, Op0,
N->getOperand(2));
15697 return DAG.
getNode(ARMISD::VCMPZ, dl, VT, Op1,
15701 return DAG.
getNode(ARMISD::VCMP, dl, VT, Op1, Op0,
15714 EVT VT =
N->getValueType(0);
15715 SDNode *Elt =
N->getOperand(1).getNode();
15730 Vec,
V,
N->getOperand(2));
15740 EVT VT =
N->getValueType(0);
15768 return V->getOpcode() == ISD::EXTRACT_VECTOR_ELT &&
15769 isa<ConstantSDNode>(V->getOperand(1)) &&
15770 V->getConstantOperandVal(1) == Lane + 1 &&
15771 V->getOperand(0).getResNo() == ResNo;
15773 if (OtherIt == Op0->
users().
end())
15778 SDValue OtherExt(*OtherIt, 0);
15790 DCI.
DAG.
getNode(ARMISD::VECTOR_REG_CAST, dl, MVT::v2f64, Op0),
15793 DCI.
DAG.
getNode(ARMISD::VMOVRRD, dl, {MVT::i32, MVT::i32},
F64);
15803 EVT VT =
N->getValueType(0);
15807 if (Op0->
getOpcode() == ARMISD::VDUP) {
15809 if (VT == MVT::f16 &&
X.getValueType() == MVT::i32)
15810 return DCI.
DAG.
getNode(ARMISD::VMOVhr, dl, VT,
X);
15811 if (VT == MVT::i32 &&
X.getValueType() == MVT::f16)
15812 return DCI.
DAG.
getNode(ARMISD::VMOVrh, dl, VT,
X);
15813 if (VT == MVT::f32 &&
X.getValueType() == MVT::i32)
15816 while (
X.getValueType() != VT &&
X->getOpcode() ==
ISD::BITCAST)
15817 X =
X->getOperand(0);
15818 if (
X.getValueType() == VT)
15826 return Op0.
getOperand(
N->getConstantOperandVal(1));
15836 unsigned Offset =
N->getConstantOperandVal(1);
15838 if (MOV.
getOpcode() == ARMISD::VMOVDRR)
15848 unsigned Idx =
N->getConstantOperandVal(1);
15863 unsigned Lane =
N->getConstantOperandVal(1);
15891 EVT VT =
N->getValueType(0);
15894 if (
Op.getOpcode() == ARMISD::VGETLANEu &&
15896 Op.getOperand(0).getValueType().getScalarType())
15897 return DAG.
getNode(ARMISD::VGETLANEs,
SDLoc(
N), VT,
Op.getOperand(0),
15906 SDValue SubVec =
N->getOperand(1);
15907 uint64_t IdxVal =
N->getConstantOperandVal(2);
15918 if (IdxVal == 0 && Vec.
isUndef())
15924 (IdxVal != 0 && IdxVal != NumSubElts))
15955 ARMISD::VMOVN,
DL, VT,
15956 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT,
Trunc.getOperand(0)),
15957 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT,
Trunc.getOperand(1)),
15961 ARMISD::VMOVN,
DL, VT,
15962 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT,
Trunc.getOperand(1)),
15963 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT,
Trunc.getOperand(0)),
15997 EVT VT =
N->getValueType(0);
15998 if (!
TLI.isTypeLegal(VT) ||
16008 unsigned HalfElts = NumElts/2;
16010 for (
unsigned n = 0; n < NumElts; ++n) {
16013 if (MaskElt < (
int)HalfElts)
16015 else if (MaskElt >= (
int)NumElts && MaskElt < (
int)(NumElts + HalfElts))
16016 NewElt = HalfElts + MaskElt - NumElts;
16050 const unsigned MaxSteps = 1024;
16059 bool SimpleConstIncOnly,
16067 bool isLoadOp =
true;
16068 bool isLaneOp =
false;
16071 bool hasAlignment =
true;
16072 unsigned NewOpc = 0;
16073 unsigned NumVecs = 0;
16074 if (
Target.isIntrinsic) {
16075 unsigned IntNo =
N->getConstantOperandVal(1);
16079 case Intrinsic::arm_neon_vld1:
16083 case Intrinsic::arm_neon_vld2:
16087 case Intrinsic::arm_neon_vld3:
16091 case Intrinsic::arm_neon_vld4:
16095 case Intrinsic::arm_neon_vld1x2:
16098 hasAlignment =
false;
16100 case Intrinsic::arm_neon_vld1x3:
16103 hasAlignment =
false;
16105 case Intrinsic::arm_neon_vld1x4:
16108 hasAlignment =
false;
16110 case Intrinsic::arm_neon_vld2dup:
16114 case Intrinsic::arm_neon_vld3dup:
16118 case Intrinsic::arm_neon_vld4dup:
16122 case Intrinsic::arm_neon_vld2lane:
16127 case Intrinsic::arm_neon_vld3lane:
16132 case Intrinsic::arm_neon_vld4lane:
16137 case Intrinsic::arm_neon_vst1:
16142 case Intrinsic::arm_neon_vst2:
16143 NewOpc = ARMISD::VST2_UPD;
16147 case Intrinsic::arm_neon_vst3:
16152 case Intrinsic::arm_neon_vst4:
16153 NewOpc = ARMISD::VST4_UPD;
16157 case Intrinsic::arm_neon_vst2lane:
16163 case Intrinsic::arm_neon_vst3lane:
16169 case Intrinsic::arm_neon_vst4lane:
16175 case Intrinsic::arm_neon_vst1x2:
16179 hasAlignment =
false;
16181 case Intrinsic::arm_neon_vst1x3:
16185 hasAlignment =
false;
16187 case Intrinsic::arm_neon_vst1x4:
16191 hasAlignment =
false;
16196 switch (
N->getOpcode()) {
16232 VecTy =
N->getValueType(0);
16233 }
else if (
Target.isIntrinsic) {
16234 VecTy =
N->getOperand(
Target.AddrOpIdx + 1).getValueType();
16237 "Node has to be a load, a store, or an intrinsic!");
16238 VecTy =
N->getOperand(1).getValueType();
16246 if (isLaneOp || isVLDDUPOp)
16249 if (NumBytes >= 3 * 16 &&
User.ConstInc != NumBytes) {
16255 if (SimpleConstIncOnly &&
User.ConstInc != NumBytes)
16264 EVT AlignedVecTy = VecTy;
16284 assert(NumVecs == 1 &&
"Unexpected multi-element generic load/store.");
16285 assert(!isLaneOp &&
"Unexpected generic load/store lane.");
16296 Alignment =
Align(1);
16302 unsigned NumResultVecs = (isLoadOp ? NumVecs : 0);
16304 for (n = 0; n < NumResultVecs; ++n)
16305 Tys[n] = AlignedVecTy;
16306 Tys[n++] = MVT::i32;
16307 Tys[n] = MVT::Other;
16312 Ops.push_back(
N->getOperand(0));
16313 Ops.push_back(
N->getOperand(
Target.AddrOpIdx));
16318 Ops.push_back(StN->getValue());
16322 unsigned LastOperand =
16323 hasAlignment ?
N->getNumOperands() - 1 :
N->getNumOperands();
16324 for (
unsigned i =
Target.AddrOpIdx + 1; i < LastOperand; ++i)
16325 Ops.push_back(
N->getOperand(i));
16329 Ops.push_back(DAG.
getConstant(Alignment.value(), dl, MVT::i32));
16333 if (AlignedVecTy != VecTy &&
N->getOpcode() ==
ISD::STORE) {
16340 MemN->getMemOperand());
16344 for (
unsigned i = 0; i < NumResultVecs; ++i)
16349 if (AlignedVecTy != VecTy &&
N->getOpcode() ==
ISD::LOAD) {
16350 SDValue &LdVal = NewResults[0];
16386 switch (
N->getOpcode()) {
16390 *Ptr =
N->getOperand(0);
16391 *CInc =
N->getOperand(1);
16398 *Ptr =
N->getOperand(1);
16399 *CInc =
N->getOperand(2);
16426 SDValue Addr =
N->getOperand(AddrOpIdx);
16437 unsigned ConstInc =
16442 if (BaseUpdates.
size() >= MaxBaseUpdates)
16463 unsigned UserOffset =
16466 if (!UserOffset || UserOffset <=
Offset)
16469 unsigned NewConstInc = UserOffset -
Offset;
16472 if (BaseUpdates.
size() >= MaxBaseUpdates)
16480 unsigned NumValidUpd = BaseUpdates.
size();
16481 for (
unsigned I = 0;
I < NumValidUpd;
I++) {
16492 return LHS.ConstInc <
RHS.ConstInc;
16521 unsigned IntNo =
N->getConstantOperandVal(1);
16522 if (IntNo == Intrinsic::arm_mve_vst2q &&
N->getConstantOperandVal(5) != 1)
16524 if (IntNo == Intrinsic::arm_mve_vst4q &&
N->getConstantOperandVal(7) != 3)
16541 const unsigned MaxSteps = 1024;
16547 bool isLoadOp =
true;
16548 unsigned NewOpc = 0;
16549 unsigned NumVecs = 0;
16553 case Intrinsic::arm_mve_vld2q:
16557 case Intrinsic::arm_mve_vld4q:
16561 case Intrinsic::arm_mve_vst2q:
16562 NewOpc = ARMISD::VST2_UPD;
16566 case Intrinsic::arm_mve_vst4q:
16567 NewOpc = ARMISD::VST4_UPD;
16576 VecTy =
N->getValueType(0);
16578 VecTy =
N->getOperand(3).getValueType();
16592 unsigned NumResultVecs = (isLoadOp ? NumVecs : 0);
16594 for (n = 0; n < NumResultVecs; ++n)
16596 Tys[n++] = MVT::i32;
16597 Tys[n] = MVT::Other;
16602 Ops.push_back(
N->getOperand(0));
16603 Ops.push_back(
N->getOperand(2));
16604 Ops.push_back(Inc);
16606 for (
unsigned i = 3; i <
N->getNumOperands(); ++i)
16607 Ops.push_back(
N->getOperand(i));
16610 MemN->getMemOperand());
16614 for (
unsigned i = 0; i < NumResultVecs; ++i)
16633 EVT VT =
N->getValueType(0);
16639 SDNode *VLD =
N->getOperand(0).getNode();
16642 unsigned NumVecs = 0;
16643 unsigned NewOpc = 0;
16645 if (IntNo == Intrinsic::arm_neon_vld2lane) {
16648 }
else if (IntNo == Intrinsic::arm_neon_vld3lane) {
16651 }
else if (IntNo == Intrinsic::arm_neon_vld4lane) {
16663 if (
Use.getResNo() == NumVecs)
16666 if (
User->getOpcode() != ARMISD::VDUPLANE ||
16667 VLDLaneNo !=
User->getConstantOperandVal(1))
16674 for (n = 0; n < NumVecs; ++n)
16676 Tys[n] = MVT::Other;
16686 unsigned ResNo =
Use.getResNo();
16688 if (ResNo == NumVecs)
16695 std::vector<SDValue> VLDDupResults;
16696 for (
unsigned n = 0; n < NumVecs; ++n)
16710 EVT VT =
N->getValueType(0);
16717 ExtractVT = MVT::i32;
16719 N->getOperand(0),
N->getOperand(1));
16731 Op =
Op.getOperand(0);
16732 if (
Op.getOpcode() != ARMISD::VMOVIMM &&
Op.getOpcode() != ARMISD::VMVNIMM)
16736 unsigned EltSize =
Op.getScalarValueSizeInBits();
16738 unsigned Imm =
Op.getConstantOperandVal(0);
16757 if (
Op.getValueType() == MVT::f32)
16758 return DAG.
getNode(ARMISD::VDUP, dl,
N->getValueType(0),
16760 else if (
Op.getValueType() == MVT::f16)
16761 return DAG.
getNode(ARMISD::VDUP, dl,
N->getValueType(0),
16762 DAG.
getNode(ARMISD::VMOVrh, dl, MVT::i32,
Op));
16772 if (LD &&
Op.hasOneUse() && LD->isUnindexed() &&
16773 LD->getMemoryVT() ==
N->getValueType(0).getVectorElementType()) {
16774 SDValue Ops[] = {LD->getOperand(0), LD->getOperand(1),
16779 LD->getMemoryVT(), LD->getMemOperand());
16790 EVT VT =
N->getValueType(0);
16809 SDValue StVal = St->getValue();
16811 if (!St->isTruncatingStore() || !VT.
isVector())
16814 EVT StVT = St->getMemoryVT();
16816 assert(StVT != VT &&
"Cannot truncate to the same type");
16826 if (0 != (NumElems * FromEltSz) % ToEltSz)
16829 unsigned SizeRatio = FromEltSz / ToEltSz;
16834 NumElems * SizeRatio);
16840 for (
unsigned i = 0; i < NumElems; ++i)
16845 if (!
TLI.isTypeLegal(WideVecVT))
16854 MVT StoreType = MVT::i8;
16856 if (
TLI.isTypeLegal(Tp) && Tp.getSizeInBits() <= NumElems * ToEltSz)
16860 if (!
TLI.isTypeLegal(StoreType))
16872 SDValue BasePtr = St->getBasePtr();
16876 for (
unsigned I = 0;
I <
E;
I++) {
16880 DAG.
getStore(St->getChain(),
DL, SubVec, BasePtr, St->getPointerInfo(),
16881 St->getAlign(), St->getMemOperand()->getFlags());
16894 if (!St->isSimple() || St->isTruncatingStore() || !St->isUnindexed())
16899 EVT FromVT =
Trunc->getOperand(0).getValueType();
16907 if (FromEltVT != MVT::f32 || ToEltVT != MVT::f16)
16910 unsigned NumElements = 4;
16927 unsigned Off0 = Rev ? NumElts : 0;
16928 unsigned Off1 = Rev ? 0 : NumElts;
16930 for (
unsigned I = 0;
I < NumElts;
I += 2) {
16931 if (M[
I] >= 0 && M[
I] != (
int)(Off0 +
I / 2))
16933 if (M[
I + 1] >= 0 && M[
I + 1] != (
int)(Off1 +
I / 2))
16941 if (isVMOVNShuffle(Shuffle,
false) || isVMOVNShuffle(Shuffle,
true))
16948 SDValue BasePtr = St->getBasePtr();
16949 Align Alignment = St->getBaseAlign();
16961 unsigned NewOffset = i * NumElements * ToEltVT.
getSizeInBits() / 8;
16972 Extract = DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, MVT::v4i32, FPTrunc);
16975 Ch,
DL, Extract, NewPtr, St->getPointerInfo().getWithOffset(NewOffset),
16976 NewToVT, Alignment, MMOFlags, AAInfo);
16987 if (!St->isSimple() || St->isTruncatingStore() || !St->isUnindexed())
16992 EVT FromVT =
Trunc->getOperand(0).getValueType();
16999 SDValue BasePtr = St->getBasePtr();
17000 Align Alignment = St->getBaseAlign();
17008 for (
unsigned i = 0; i <
Trunc.getNumOperands(); i++) {
17009 unsigned NewOffset =
17016 Ch,
DL, Extract, NewPtr, St->getPointerInfo().getWithOffset(NewOffset),
17017 NewToVT, Alignment, MMOFlags, AAInfo);
17028 if (!St->isSimple() || St->isTruncatingStore() || !St->isUnindexed())
17030 SDValue Extract = St->getValue();
17039 {Extract.getOperand(0), Extract.getOperand(1)});
17047 SDValue BasePtr = St->getBasePtr();
17048 Align Alignment = St->getBaseAlign();
17053 St->getPointerInfo(), NewToVT, Alignment,
17072 SDValue StoredValue = ST->getValue();
17090 unsigned EltBits =
SubVecTy.getScalarSizeInBits();
17091 if (EltBits != 8 && EltBits != 16 && EltBits != 32)
17096 unsigned ResNo =
Use.getResNo();
17098 if (Stores[ResNo] || !
Store)
17100 Stores[ResNo] =
Store;
17109 unsigned Bytes =
SubVecTy.getStoreSize().getFixedValue();
17115 static constexpr Intrinsic::ID NEONStores[] = {Intrinsic::arm_neon_vst2,
17116 Intrinsic::arm_neon_vst3,
17117 Intrinsic::arm_neon_vst4};
17126 IID =
NumParts == 2 ? Intrinsic::arm_mve_vst2q : Intrinsic::arm_mve_vst4q;
17146 for (
unsigned Stage = 0; Stage <
NumParts; Stage++) {
17150 Ops.front() = NewStore;
17166 unsigned NumParts =
N->getNumOperands();
17170 SDNode *InterleaveOp =
N->getOperand(0).getNode();
17172 InterleaveOp->getNumOperands() !=
NumParts)
17176 if (
N->getOperand(
I) !=
SDValue(InterleaveOp,
I))
17179 Ops.append(InterleaveOp->op_begin(), InterleaveOp->op_end());
17198 SDValue WideValue = ST->getValue();
17201 ValueInterleaveOps))
17214 EVT SubVecTy = ValueInterleaveOps[0].getValueType();
17220 unsigned EltBits =
SubVecTy.getScalarSizeInBits();
17221 if (EltBits != 8 && EltBits != 16 && EltBits != 32)
17223 if (
Subtarget->hasMVEIntegerOps() && ST->getAlign() < EltBits / 8)
17225 static constexpr Intrinsic::ID NEONStores[] = {Intrinsic::arm_neon_vst2,
17226 Intrinsic::arm_neon_vst3,
17227 Intrinsic::arm_neon_vst4};
17230 Ops.push_back(ST->getChain());
17235 IID =
NumParts == 2 ? Intrinsic::arm_mve_vst2q : Intrinsic::arm_mve_vst4q;
17239 Ops.push_back(ST->getBasePtr());
17240 Ops.append(ValueInterleaveOps);
17246 ST->getMemoryVT(), ST->getMemOperand());
17249 for (
unsigned Stage = 0; Stage <
NumParts; Stage++) {
17253 ST->getMemoryVT(), ST->getMemOperand());
17254 Ops.front() = NewStore;
17261 SDValue Val = St->getValue();
17277 if (!ImmSet.
insert(
C->getZExtValue()).second)
17284 if (ImmSet.
size() == 1)
17294 SDValue Chain = St->getChain();
17302 St->getPointerInfo().getWithOffset(
Offset),
17304 St->getMemOperand()->getFlags(), St->getAAInfo());
17316 if (St->isVolatile())
17318 SDValue StVal = St->getValue();
17349 SDValue BasePtr = St->getBasePtr();
17352 BasePtr, St->getPointerInfo(), St->getBaseAlign(),
17353 St->getMemOperand()->getFlags());
17359 St->getPointerInfo().getWithOffset(4),
17360 St->getBaseAlign(), St->getMemOperand()->
getFlags());
17382 return DAG.
getStore(St->getChain(), dl,
V, St->getBasePtr(),
17383 St->getPointerInfo(), St->getAlign(),
17384 St->getMemOperand()->getFlags(), St->getAAInfo());
17413 if (!
Op.getValueType().isVector() || !
Op.getValueType().isSimple() ||
17421 MVT FloatTy =
Op.getSimpleValueType().getVectorElementType();
17423 MVT IntTy =
N->getSimpleValueType(0).getVectorElementType();
17424 uint32_t IntBits = IntTy.getSizeInBits();
17425 unsigned NumLanes =
Op.getValueType().getVectorNumElements();
17426 if (FloatBits != 32 || IntBits > 32 || (NumLanes != 4 && NumLanes != 2)) {
17437 if (
C == -1 ||
C == 0 ||
C > 32)
17442 unsigned IntrinsicOpcode =
isSigned ? Intrinsic::arm_neon_vcvtfp2fxs :
17443 Intrinsic::arm_neon_vcvtfp2fxu;
17446 DAG.
getConstant(IntrinsicOpcode, dl, MVT::i32),
Op->getOperand(0),
17449 if (IntBits < FloatBits)
17465 EVT VT =
N->getValueType(0);
17470 auto isIdentitySplat = [&](
SDValue Op,
bool NSZ) {
17472 Op.getOperand(0).getOpcode() != ARMISD::VMOVIMM)
17474 uint64_t ImmVal =
Op.getOperand(0).getConstantOperandVal(0);
17475 if (VT == MVT::v4f32 && (ImmVal == 1664 || (ImmVal == 0 && NSZ)))
17477 if (VT == MVT::v8f16 && (ImmVal == 2688 || (ImmVal == 0 && NSZ)))
17490 if (!isIdentitySplat(Op1.
getOperand(2), NSZ))
17501 EVT VT =
N->getValueType(0);
17504 if (!
N->getFlags().hasAllowReassociation())
17511 unsigned Opc =
A.getConstantOperandVal(0);
17512 if (
Opc != Intrinsic::arm_mve_vcmlaq)
17517 A.getOperand(3),
A.getOperand(4));
17553 unsigned OpOpcode =
Op.getNode()->getOpcode();
17554 if (!
N->getValueType(0).isVector() || !
N->getValueType(0).isSimple() ||
17558 SDValue ConstVec =
N->getOperand(1);
17562 MVT FloatTy =
N->getSimpleValueType(0).getVectorElementType();
17564 MVT IntTy =
Op.getOperand(0).getSimpleValueType().getVectorElementType();
17565 uint32_t IntBits = IntTy.getSizeInBits();
17566 unsigned NumLanes =
Op.getValueType().getVectorNumElements();
17567 if (FloatBits != 32 || IntBits > 32 || (NumLanes != 4 && NumLanes != 2)) {
17587 int32_t
C = IntVal.exactLogBase2();
17588 if (
C == -1 ||
C == 0 ||
C > 32)
17594 if (IntBits < FloatBits)
17596 NumLanes == 2 ? MVT::v2i32 : MVT::v4i32, ConvInput);
17598 unsigned IntrinsicOpcode =
isSigned ? Intrinsic::arm_neon_vcvtfxs2fp
17599 : Intrinsic::arm_neon_vcvtfxu2fp;
17607 if (!ST->hasMVEIntegerOps())
17611 EVT ResVT =
N->getValueType(0);
17639 EVT AVT =
A.getValueType();
17645 auto ExtendIfNeeded = [&](
SDValue A,
unsigned ExtendCode) {
17646 EVT AVT =
A.getValueType();
17656 auto IsVADDV = [&](
MVT RetTy,
unsigned ExtendCode,
ArrayRef<MVT> ExtTypes) {
17657 if (ResVT != RetTy || N0->
getOpcode() != ExtendCode)
17660 if (ExtTypeMatches(
A, ExtTypes))
17661 return ExtendIfNeeded(
A, ExtendCode);
17664 auto IsPredVADDV = [&](
MVT RetTy,
unsigned ExtendCode,
ArrayRef<MVT> ExtTypes,
17674 if (ExtTypeMatches(
A, ExtTypes))
17675 return ExtendIfNeeded(
A, ExtendCode);
17678 auto IsVMLAV = [&](
MVT RetTy,
unsigned ExtendCode,
ArrayRef<MVT> ExtTypes,
17688 if (ResVT != RetTy)
17691 if (
Mul->getOpcode() == ExtendCode &&
17692 Mul->getOperand(0).getScalarValueSizeInBits() * 2 >=
17694 Mul =
Mul->getOperand(0);
17703 if (ExtTypeMatches(
A, ExtTypes) && ExtTypeMatches(
B, ExtTypes)) {
17704 A = ExtendIfNeeded(
A, ExtendCode);
17705 B = ExtendIfNeeded(
B, ExtendCode);
17710 auto IsPredVMLAV = [&](
MVT RetTy,
unsigned ExtendCode,
ArrayRef<MVT> ExtTypes,
17723 if (
Mul->getOpcode() == ExtendCode &&
17724 Mul->getOperand(0).getScalarValueSizeInBits() * 2 >=
17726 Mul =
Mul->getOperand(0);
17735 if (ExtTypeMatches(
A, ExtTypes) && ExtTypeMatches(
B, ExtTypes)) {
17736 A = ExtendIfNeeded(
A, ExtendCode);
17737 B = ExtendIfNeeded(
B, ExtendCode);
17748 EVT VT =
Ops[0].getValueType();
17749 if (VT == MVT::v16i8) {
17750 assert((Opcode == ARMISD::VMLALVs || Opcode == ARMISD::VMLALVu) &&
17751 "Unexpected illegal long reduction opcode");
17752 bool IsUnsigned = Opcode == ARMISD::VMLALVu;
17764 DAG.
getNode(IsUnsigned ? ARMISD::VMLALVAu : ARMISD::VMLALVAs, dl,
17777 return DAG.
getNode(ARMISD::VMLAVs, dl, ResVT,
A,
B);
17779 return DAG.
getNode(ARMISD::VMLAVu, dl, ResVT,
A,
B);
17780 if (IsVMLAV(MVT::i64,
ISD::SIGN_EXTEND, {MVT::v16i8, MVT::v8i16, MVT::v4i32},
17782 return Create64bitNode(ARMISD::VMLALVs, {
A,
B});
17783 if (IsVMLAV(MVT::i64,
ISD::ZERO_EXTEND, {MVT::v16i8, MVT::v8i16, MVT::v4i32},
17785 return Create64bitNode(ARMISD::VMLALVu, {
A,
B});
17788 DAG.
getNode(ARMISD::VMLAVs, dl, MVT::i32,
A,
B));
17791 DAG.
getNode(ARMISD::VMLAVu, dl, MVT::i32,
A,
B));
17795 return DAG.
getNode(ARMISD::VMLAVps, dl, ResVT,
A,
B, Mask);
17798 return DAG.
getNode(ARMISD::VMLAVpu, dl, ResVT,
A,
B, Mask);
17801 return Create64bitNode(ARMISD::VMLALVps, {
A,
B, Mask});
17804 return Create64bitNode(ARMISD::VMLALVpu, {
A,
B, Mask});
17807 DAG.
getNode(ARMISD::VMLAVps, dl, MVT::i32,
A,
B, Mask));
17810 DAG.
getNode(ARMISD::VMLAVpu, dl, MVT::i32,
A,
B, Mask));
17813 return DAG.
getNode(ARMISD::VADDVs, dl, ResVT,
A);
17815 return DAG.
getNode(ARMISD::VADDVu, dl, ResVT,
A);
17817 return Create64bitNode(ARMISD::VADDLVs, {
A});
17819 return Create64bitNode(ARMISD::VADDLVu, {
A});
17822 DAG.
getNode(ARMISD::VADDVs, dl, MVT::i32,
A));
17825 DAG.
getNode(ARMISD::VADDVu, dl, MVT::i32,
A));
17828 return DAG.
getNode(ARMISD::VADDVps, dl, ResVT,
A, Mask);
17830 return DAG.
getNode(ARMISD::VADDVpu, dl, ResVT,
A, Mask);
17832 return Create64bitNode(ARMISD::VADDLVps, {
A, Mask});
17834 return Create64bitNode(ARMISD::VADDLVpu, {
A, Mask});
17837 DAG.
getNode(ARMISD::VADDVps, dl, MVT::i32,
A, Mask));
17840 DAG.
getNode(ARMISD::VADDVpu, dl, MVT::i32,
A, Mask));
17847 Op =
Op->getOperand(1);
17849 Op->getOperand(0)->getOpcode() ==
ISD::MUL) {
17851 if (
Mul->getOperand(0) ==
Mul->getOperand(1) &&
17868 unsigned VecOp =
N->getOperand(0).getValueType().isVector() ? 0 : 2;
17870 if (!Shuf || !Shuf->getOperand(1).isUndef())
17875 APInt SetElts(Mask.size(), 0);
17876 for (
int E : Mask) {
17884 if (
N->getNumOperands() != VecOp + 1) {
17886 if (!Shuf2 || !Shuf2->getOperand(1).isUndef() || Shuf2->getMask() != Mask)
17892 if (
Op.getValueType().isVector())
17893 Ops.push_back(
Op.getOperand(0));
17904 unsigned IsTop =
N->getConstantOperandVal(2);
17911 if (Op0->
isUndef() && !IsTop)
17916 if ((Op1->
getOpcode() == ARMISD::VQMOVNs ||
17917 Op1->
getOpcode() == ARMISD::VQMOVNu) &&
17925 unsigned NumElts =
N->getValueType(0).getVectorNumElements();
17927 APInt Op0DemandedElts =
17928 IsTop ? Op1DemandedElts
17932 if (
TLI.SimplifyDemandedVectorElts(Op0, Op0DemandedElts, DCI))
17934 if (
TLI.SimplifyDemandedVectorElts(Op1, Op1DemandedElts, DCI))
17943 unsigned IsTop =
N->getConstantOperandVal(2);
17945 unsigned NumElts =
N->getValueType(0).getVectorNumElements();
17946 APInt Op0DemandedElts =
17951 if (
TLI.SimplifyDemandedVectorElts(Op0, Op0DemandedElts, DCI))
17958 EVT VT =
N->getValueType(0);
17965 if (Shuf0 && Shuf1 && Shuf0->getMask().equals(Shuf1->getMask()) &&
17966 LHS.getOperand(1).isUndef() &&
RHS.getOperand(1).isUndef() &&
17970 LHS.getOperand(0),
RHS.getOperand(0));
17985 int ShiftAmt =
C->getSExtValue();
17986 if (ShiftAmt == 0) {
17992 if (ShiftAmt >= -32 && ShiftAmt < 0) {
17993 unsigned NewOpcode =
17994 N->getOpcode() == ARMISD::LSLL ? ARMISD::LSRL : ARMISD::LSLL;
18009 unsigned IntNo =
N->getConstantOperandVal(0);
18020 case Intrinsic::arm_neon_vshifts:
18021 case Intrinsic::arm_neon_vshiftu:
18022 case Intrinsic::arm_neon_vrshifts:
18023 case Intrinsic::arm_neon_vrshiftu:
18024 case Intrinsic::arm_neon_vrshiftn:
18025 case Intrinsic::arm_neon_vqshifts:
18026 case Intrinsic::arm_neon_vqshiftu:
18027 case Intrinsic::arm_neon_vqshiftsu:
18028 case Intrinsic::arm_neon_vqshiftns:
18029 case Intrinsic::arm_neon_vqshiftnu:
18030 case Intrinsic::arm_neon_vqshiftnsu:
18031 case Intrinsic::arm_neon_vqrshiftns:
18032 case Intrinsic::arm_neon_vqrshiftnu:
18033 case Intrinsic::arm_neon_vqrshiftnsu: {
18034 EVT VT =
N->getOperand(1).getValueType();
18036 unsigned VShiftOpc = 0;
18039 case Intrinsic::arm_neon_vshifts:
18040 case Intrinsic::arm_neon_vshiftu:
18042 VShiftOpc = ARMISD::VSHLIMM;
18045 if (
isVShiftRImm(
N->getOperand(2), VT,
false,
true, Cnt)) {
18046 VShiftOpc = (IntNo == Intrinsic::arm_neon_vshifts ? ARMISD::VSHRsIMM
18047 : ARMISD::VSHRuIMM);
18052 case Intrinsic::arm_neon_vrshifts:
18053 case Intrinsic::arm_neon_vrshiftu:
18058 case Intrinsic::arm_neon_vqshifts:
18059 case Intrinsic::arm_neon_vqshiftu:
18064 case Intrinsic::arm_neon_vqshiftsu:
18069 case Intrinsic::arm_neon_vrshiftn:
18070 case Intrinsic::arm_neon_vqshiftns:
18071 case Intrinsic::arm_neon_vqshiftnu:
18072 case Intrinsic::arm_neon_vqshiftnsu:
18073 case Intrinsic::arm_neon_vqrshiftns:
18074 case Intrinsic::arm_neon_vqrshiftnu:
18075 case Intrinsic::arm_neon_vqrshiftnsu:
18087 case Intrinsic::arm_neon_vshifts:
18088 case Intrinsic::arm_neon_vshiftu:
18091 case Intrinsic::arm_neon_vrshifts:
18092 VShiftOpc = ARMISD::VRSHRsIMM;
18094 case Intrinsic::arm_neon_vrshiftu:
18095 VShiftOpc = ARMISD::VRSHRuIMM;
18097 case Intrinsic::arm_neon_vrshiftn:
18098 VShiftOpc = ARMISD::VRSHRNIMM;
18100 case Intrinsic::arm_neon_vqshifts:
18101 VShiftOpc = ARMISD::VQSHLsIMM;
18103 case Intrinsic::arm_neon_vqshiftu:
18104 VShiftOpc = ARMISD::VQSHLuIMM;
18106 case Intrinsic::arm_neon_vqshiftsu:
18107 VShiftOpc = ARMISD::VQSHLsuIMM;
18109 case Intrinsic::arm_neon_vqshiftns:
18110 VShiftOpc = ARMISD::VQSHRNsIMM;
18112 case Intrinsic::arm_neon_vqshiftnu:
18113 VShiftOpc = ARMISD::VQSHRNuIMM;
18115 case Intrinsic::arm_neon_vqshiftnsu:
18116 VShiftOpc = ARMISD::VQSHRNsuIMM;
18118 case Intrinsic::arm_neon_vqrshiftns:
18119 VShiftOpc = ARMISD::VQRSHRNsIMM;
18121 case Intrinsic::arm_neon_vqrshiftnu:
18122 VShiftOpc = ARMISD::VQRSHRNuIMM;
18124 case Intrinsic::arm_neon_vqrshiftnsu:
18125 VShiftOpc = ARMISD::VQRSHRNsuIMM;
18130 return DAG.
getNode(VShiftOpc, dl,
N->getValueType(0),
18131 N->getOperand(1), DAG.
getConstant(Cnt, dl, MVT::i32));
18134 case Intrinsic::arm_neon_vshiftins: {
18135 EVT VT =
N->getOperand(1).getValueType();
18137 unsigned VShiftOpc = 0;
18140 VShiftOpc = ARMISD::VSLIIMM;
18141 else if (
isVShiftRImm(
N->getOperand(3), VT,
false,
true, Cnt))
18142 VShiftOpc = ARMISD::VSRIIMM;
18148 return DAG.
getNode(VShiftOpc, dl,
N->getValueType(0),
18149 N->getOperand(1),
N->getOperand(2),
18153 case Intrinsic::arm_neon_vqrshifts:
18154 case Intrinsic::arm_neon_vqrshiftu:
18158 case Intrinsic::arm_neon_vbsl: {
18160 return DAG.
getNode(ARMISD::VBSP, dl,
N->getValueType(0),
N->getOperand(1),
18161 N->getOperand(2),
N->getOperand(3));
18163 case Intrinsic::arm_mve_vqdmlah:
18164 case Intrinsic::arm_mve_vqdmlash:
18165 case Intrinsic::arm_mve_vqrdmlah:
18166 case Intrinsic::arm_mve_vqrdmlash:
18167 case Intrinsic::arm_mve_vmla_n_predicated:
18168 case Intrinsic::arm_mve_vmlas_n_predicated:
18169 case Intrinsic::arm_mve_vqdmlah_predicated:
18170 case Intrinsic::arm_mve_vqdmlash_predicated:
18171 case Intrinsic::arm_mve_vqrdmlah_predicated:
18172 case Intrinsic::arm_mve_vqrdmlash_predicated: {
18177 unsigned BitWidth =
N->getValueType(0).getScalarSizeInBits();
18184 case Intrinsic::arm_mve_minv:
18185 case Intrinsic::arm_mve_maxv:
18186 case Intrinsic::arm_mve_minav:
18187 case Intrinsic::arm_mve_maxav:
18188 case Intrinsic::arm_mve_minv_predicated:
18189 case Intrinsic::arm_mve_maxv_predicated:
18190 case Intrinsic::arm_mve_minav_predicated:
18191 case Intrinsic::arm_mve_maxav_predicated: {
18194 unsigned BitWidth =
N->getOperand(2)->getValueType(0).getScalarSizeInBits();
18201 case Intrinsic::arm_mve_addv: {
18204 bool Unsigned =
N->getConstantOperandVal(2);
18205 unsigned Opc =
Unsigned ? ARMISD::VADDVu : ARMISD::VADDVs;
18209 case Intrinsic::arm_mve_addlv:
18210 case Intrinsic::arm_mve_addlv_predicated: {
18213 bool Unsigned =
N->getConstantOperandVal(2);
18214 unsigned Opc = IntNo == Intrinsic::arm_mve_addlv ?
18215 (
Unsigned ? ARMISD::VADDLVu : ARMISD::VADDLVs) :
18216 (
Unsigned ? ARMISD::VADDLVpu : ARMISD::VADDLVps);
18219 for (
unsigned i = 1, e =
N->getNumOperands(); i < e; i++)
18221 Ops.push_back(
N->getOperand(i));
18234 EVT VT =
Y.getValueType();
18237 if (Subtarget->hasMVEIntegerOps())
18239 if (Subtarget->hasNEON())
18253 EVT VT =
N->getValueType(0);
18255 if (ST->isThumb1Only() &&
N->getOpcode() ==
ISD::SHL && VT == MVT::i32 &&
18256 N->getOperand(0)->getOpcode() ==
ISD::AND &&
18257 N->getOperand(0)->hasOneUse()) {
18274 if (AndMask == 255 || AndMask == 65535)
18278 if (MaskedBits > ShiftAmt) {
18293 if (ST->hasMVEIntegerOps())
18298 switch (
N->getOpcode()) {
18304 return DAG.
getNode(ARMISD::VSHLIMM, dl, VT,
N->getOperand(0),
18311 if (
isVShiftRImm(
N->getOperand(1), VT,
false,
false, Cnt)) {
18312 unsigned VShiftOpc =
18313 (
N->getOpcode() ==
ISD::SRA ? ARMISD::VSHRsIMM : ARMISD::VSHRuIMM);
18315 return DAG.
getNode(VShiftOpc, dl, VT,
N->getOperand(0),
18331 if (!LD->isSimple() || !N0.
hasOneUse() || LD->isIndexed() ||
18334 EVT FromVT = LD->getValueType(0);
18335 EVT ToVT =
N->getValueType(0);
18342 unsigned NumElements = 0;
18343 if (ToEltVT == MVT::i32 && FromEltVT == MVT::i8)
18345 if (ToEltVT == MVT::f32 && FromEltVT == MVT::f16)
18347 if (NumElements == 0 ||
18357 SDValue BasePtr = LD->getBasePtr();
18358 Align Alignment = LD->getBaseAlign();
18379 LD->getPointerInfo().getWithOffset(NewOffset), NewFromVT,
18380 Alignment, MMOFlags, AAInfo);
18386 if (FromEltVT == MVT::f16) {
18389 for (
unsigned i = 0; i < Loads.
size(); i++) {
18391 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, MVT::v8f16, Loads[i]);
18410 EVT VT =
N->getValueType(0);
18417 if ((ST->hasNEON() || ST->hasMVEIntegerOps()) &&
18424 if (VT == MVT::i32 &&
18425 (EltVT == MVT::i8 || EltVT == MVT::i16) &&
18430 switch (
N->getOpcode()) {
18433 Opc = ARMISD::VGETLANEs;
18437 Opc = ARMISD::VGETLANEu;
18444 if (ST->hasMVEIntegerOps())
18462 Ops.push_back(Ext);
18472 if (ST->hasMVEFloatOps())
18487 EVT VT =
Op.getValueType();
18490 if (VT != MVT::i32 ||
18506 APInt MaxC = Max.getConstantOperandAPInt(1);
18507 if (MaxC.
sgt(MinC))
18514 if ((MinC + 1).isPowerOf2()) {
18536 APInt Width = MinC - MaxC + 1;
18539 unsigned SatBit = Width.
logBase2() - 1;
18557 EVT VT =
N->getValueType(0);
18560 if (VT == MVT::i32)
18563 if (!ST->hasMVEIntegerOps())
18569 if (VT != MVT::v4i32 && VT != MVT::v8i16)
18572 auto IsSignedSaturate = [&](
SDNode *Min,
SDNode *Max) {
18580 if (VT == MVT::v4i32)
18581 SaturateC =
APInt(32, (1 << 15) - 1,
true);
18583 SaturateC =
APInt(16, (1 << 7) - 1,
true);
18590 MaxC != ~SaturateC)
18595 if (IsSignedSaturate(
N, N0.
getNode())) {
18598 if (VT == MVT::v4i32) {
18599 HalfVT = MVT::v8i16;
18600 ExtVT = MVT::v4i16;
18602 HalfVT = MVT::v16i8;
18617 auto IsUnsignedSaturate = [&](
SDNode *Min) {
18623 if (VT == MVT::v4i32)
18624 SaturateC =
APInt(32, (1 << 16) - 1,
true);
18626 SaturateC =
APInt(16, (1 << 8) - 1,
true);
18635 if (IsUnsignedSaturate(
N)) {
18639 if (VT == MVT::v4i32) {
18640 HalfVT = MVT::v8i16;
18641 ExtConst = 0x0000FFFF;
18643 HalfVT = MVT::v16i8;
18665 const APInt *CV = &
C->getAPIntValue();
18722 unsigned Heuristic = Subtarget->isThumb() ? 3 : 2;
18729 if ((OrCI &
Known.Zero) != OrCI)
18735 EVT VT =
X.getValueType();
18736 unsigned BitInX = AndC->
logBase2();
18744 for (
unsigned BitInY = 0, NumActiveBits = OrCI.
getActiveBits();
18745 BitInY < NumActiveBits; ++BitInY) {
18746 if (OrCI[BitInY] == 0)
18749 Mask.setBit(BitInY);
18750 V = DAG.
getNode(ARMISD::BFI, dl, VT, V,
X,
18766 switch (
N->getOpcode()) {
18781 if (Const->isZero())
18783 else if (Const->isOne())
18787 CC =
N.getOperandCondCode(2);
18791 unsigned IntOp =
N.getConstantOperandVal(1);
18792 if (IntOp != Intrinsic::test_start_loop_iterations &&
18793 IntOp != Intrinsic::loop_decrement_reg)
18819 bool Negate =
false;
18825 Cond =
N->getOperand(1);
18826 Dest =
N->getOperand(2);
18829 CC =
N->getOperandCondCode(1);
18830 Cond =
N->getOperand(2);
18831 Dest =
N->getOperand(4);
18833 if (!Const->isOne() && !Const->isZero())
18835 Imm = Const->getZExtValue();
18864 "unsupported condition");
18869 unsigned IntOp =
Int->getConstantOperandVal(1);
18870 assert((
N->hasOneUse() &&
N->user_begin()->getOpcode() ==
ISD::BR) &&
18871 "expected single br user");
18872 SDNode *Br = *
N->user_begin();
18882 if (IntOp == Intrinsic::test_start_loop_iterations) {
18884 SDValue Setup = DAG.
getNode(ARMISD::WLSSETUP, dl, MVT::i32, Elements);
18886 if (IsTrueIfZero(
CC,
Imm)) {
18888 Res = DAG.
getNode(ARMISD::WLS, dl, MVT::Other,
Ops);
18892 UpdateUncondBr(Br, Dest, DAG);
18894 SDValue Ops[] = {Chain, Setup, OtherTarget};
18895 Res = DAG.
getNode(ARMISD::WLS, dl, MVT::Other,
Ops);
18907 DAG.
getVTList(MVT::i32, MVT::Other), Args);
18915 if (
Target == OtherTarget)
18916 UpdateUncondBr(Br, Dest, DAG);
18922 return DAG.
getNode(ARMISD::LE, dl, MVT::Other, EndArgs);
18931 if (Cmp.getOpcode() != ARMISD::CMPZ)
18936 SDValue LHS = Cmp.getOperand(0);
18937 SDValue RHS = Cmp.getOperand(1);
18946 LHS->getOperand(0)->getOpcode() == ARMISD::CMOV &&
18947 LHS->getOperand(0)->hasOneUse() &&
18951 return DAG.
getNode(ARMISD::BRCOND, dl, MVT::Other, Chain, BB,
18963 EVT VT =
N->getValueType(0);
18964 SDValue FalseVal =
N->getOperand(0);
18965 SDValue TrueVal =
N->getOperand(1);
18973 matchCSET(Opcode, InvertCond, TrueVal, FalseVal, Subtarget)) {
18980 return DAG.
getNode(Opcode, dl, VT, CSetOp, CSetOp, ARMcc, Cmp);
18983 if (Cmp.getOpcode() != ARMISD::CMPZ)
18987 SDValue LHS = Cmp.getOperand(0);
18988 SDValue RHS = Cmp.getOperand(1);
18992 if (!Subtarget->isThumb1Only() && Subtarget->hasV6T2Ops()) {
19016 if (
CC ==
ARMCC::NE && FalseVal == RHS && FalseVal != LHS) {
19017 Res = DAG.
getNode(ARMISD::CMOV, dl, VT, LHS, TrueVal, ARMcc, Cmp);
19021 Res = DAG.
getNode(ARMISD::CMOV, dl, VT, LHS, FalseVal, ARMcc, NewCmp);
19026 if (
CC ==
ARMCC::NE && LHS.getOpcode() == ARMISD::CMOV && LHS->hasOneUse() &&
19029 return DAG.
getNode(ARMISD::CMOV, dl, VT, FalseVal, TrueVal,
19030 LHS->getOperand(2), LHS->getOperand(3));
19040 if (
N->getConstantOperandVal(2) ==
ARMCC::EQ ||
19044 if (
N->getConstantOperandVal(2) ==
ARMCC::NE)
19046 return DAG.
getNode(
N->getOpcode(),
SDLoc(
N), MVT::i32,
N->getOperand(0),
19055 if (!Subtarget->isThumb1Only() && Subtarget->hasV5TOps()) {
19060 if (VT == MVT::i32 && Subtarget->isThumb2() &&
isNullConstant(RHS) &&
19094 Res = DAG.
getNode(ARMISD::CMOV, dl, VT,
Sub, TrueVal, ARMcc,
19106 Res = DAG.
getNode(ARMISD::CMOV, dl, VT,
Sub, FalseVal,
19126 const APInt *TrueConst;
19127 if (Subtarget->isThumb1Only() &&
CC ==
ARMCC::NE &&
19128 ((FalseVal.getOpcode() == ARMISD::SUBC && FalseVal.getOperand(0) == LHS &&
19129 FalseVal.getOperand(1) == RHS) ||
19133 unsigned ShiftAmount = TrueConst->
logBase2();
19148 if (
Known.Zero == 0xfffffffe)
19151 else if (
Known.Zero == 0xffffff00)
19154 else if (
Known.Zero == 0xffff0000)
19167 EVT DstVT =
N->getValueType(0);
19170 if (ST->hasMVEIntegerOps() && Src.getOpcode() == ARMISD::VDUP) {
19171 EVT SrcVT = Src.getValueType();
19173 return DAG.
getNode(ARMISD::VDUP,
SDLoc(
N), DstVT, Src.getOperand(0));
19178 if (Src.getOpcode() == ARMISD::VECTOR_REG_CAST &&
19179 Src.getOperand(0).getValueType().getScalarSizeInBits() <=
19180 Src.getValueType().getScalarSizeInBits())
19181 Src = Src.getOperand(0);
19185 EVT SrcVT = Src.getValueType();
19186 if ((Src.getOpcode() == ARMISD::VMOVIMM ||
19187 Src.getOpcode() == ARMISD::VMVNIMM ||
19188 Src.getOpcode() == ARMISD::VMOVFPIMM) &&
19191 return DAG.
getNode(ARMISD::VECTOR_REG_CAST,
SDLoc(
N), DstVT, Src);
19205 EVT VT =
N->getValueType(0);
19213 if (
N->getNumOperands() == 2 &&
19217 N->getOperand(0).getOperand(1),
19218 N->getOperand(1).getOperand(0),
19219 N->getOperand(1).getOperand(1));
19222 if (
N->getNumOperands() == 2 &&
19228 if (S0->getOperand(0) ==
S1->getOperand(0) &&
19229 S0->getOperand(1) ==
S1->getOperand(1)) {
19232 Mask.append(
S1->getMask().begin(),
S1->getMask().end());
19236 ARMISD::VMOVN,
DL, VT,
19237 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT, S0->getOperand(0)),
19238 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT, S0->getOperand(1)),
19242 ARMISD::VMOVN,
DL, VT,
19243 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT, S0->getOperand(1)),
19244 DAG.
getNode(ARMISD::VECTOR_REG_CAST,
DL, VT, S0->getOperand(0)),
19252 return Op.getOpcode() == ISD::BUILD_VECTOR ||
19253 Op.getOpcode() == ISD::VECTOR_SHUFFLE ||
19254 (Op.getOpcode() == ISD::BITCAST &&
19255 Op.getOperand(0).getOpcode() == ISD::BUILD_VECTOR);
19258 for (
unsigned Op = 0;
Op <
N->getNumOperands();
Op++) {
19260 for (
unsigned i = 0; i < O.getValueType().getVectorNumElements(); i++) {
19278 int NumIns =
N->getNumOperands();
19279 assert((NumIns == 2 || NumIns == 4) &&
19280 "Expected 2 or 4 inputs to an MVETrunc");
19282 if (
N->getNumOperands() == 4)
19286 for (
int I = 0;
I < NumIns;
I++) {
19288 ISD::ADD,
DL, StackPtr.getValueType(), StackPtr,
19293 Ptr, MPI, StoreVT,
Align(4));
19308 if (!LD || !LD->isSimple() || !N0.
hasOneUse() || LD->isIndexed())
19311 EVT FromVT = LD->getMemoryVT();
19312 EVT ToVT =
N->getValueType(0);
19319 unsigned NumElements = 0;
19320 if (ToEltVT == MVT::i32 && (FromEltVT == MVT::i16 || FromEltVT == MVT::i8))
19322 if (ToEltVT == MVT::i16 && FromEltVT == MVT::i8)
19324 assert(NumElements != 0);
19330 LD->getExtensionType() != NewExtType)
19337 SDValue BasePtr = LD->getBasePtr();
19338 Align Alignment = LD->getBaseAlign();
19357 LD->getPointerInfo().getWithOffset(NewOffset), NewFromVT,
19358 Alignment, MMOFlags, AAInfo);
19374 EVT VT =
N->getValueType(0);
19376 assert(
N->getNumValues() == 2 &&
"Expected MVEEXT with 2 elements");
19377 assert((VT == MVT::v4i32 || VT == MVT::v8i16) &&
"Unexpected MVEEXT type");
19379 EVT ExtVT =
N->getOperand(0).getValueType().getHalfNumVectorElementsVT(
19381 auto Extend = [&](
SDValue V) {
19390 if (
N->getOperand(0).getOpcode() == ARMISD::VDUP) {
19391 SDValue Ext = Extend(
N->getOperand(0));
19399 assert(Mask.size() == SVN->getValueType(0).getVectorNumElements());
19400 unsigned Rev = VT == MVT::v4i32 ? ARMISD::VREV32 : ARMISD::VREV16;
19404 auto CheckInregMask = [&](
int Start,
int Offset) {
19406 if (Mask[Start + Idx] >= 0 && Mask[Start + Idx] != Idx * 2 +
Offset)
19412 if (CheckInregMask(0, 0))
19414 else if (CheckInregMask(0, 1))
19415 V0 = Extend(DAG.
getNode(Rev,
DL, SVN->getValueType(0), Op0));
19416 else if (CheckInregMask(0, Mask.size()))
19418 else if (CheckInregMask(0, Mask.size() + 1))
19419 V0 = Extend(DAG.
getNode(Rev,
DL, SVN->getValueType(0), Op1));
19424 V1 = Extend(DAG.
getNode(Rev,
DL, SVN->getValueType(0), Op1));
19428 V1 = Extend(DAG.
getNode(Rev,
DL, SVN->getValueType(0), Op0));
19430 if (V0.getNode() !=
N ||
V1.getNode() !=
N)
19435 if (
N->getOperand(0)->getOpcode() ==
ISD::LOAD)
19446 int NumOuts =
N->getNumValues();
19447 assert((NumOuts == 2 || NumOuts == 4) &&
19448 "Expected 2 or 4 outputs to an MVEEXT");
19449 EVT LoadVT =
N->getOperand(0).getValueType().getHalfNumVectorElementsVT(
19451 if (
N->getNumOperands() == 4)
19457 StackPtr, MPI,
Align(4));
19460 for (
int I = 0;
I < NumOuts;
I++) {
19462 ISD::ADD,
DL, StackPtr.getValueType(), StackPtr,
19463 DAG.
getConstant(
I * 16 / NumOuts,
DL, StackPtr.getValueType()));
19468 VT, Chain, Ptr, MPI, LoadVT,
Align(4));
19477 switch (
N->getOpcode()) {
19501 case ARMISD::VMOVrs:
19539 case ARMISD::BRCOND:
19543 case ARMISD::CSINC:
19544 case ARMISD::CSINV:
19545 case ARMISD::CSNEG:
19560 case ARMISD::PREDICATE_CAST:
19562 case ARMISD::VECTOR_REG_CAST:
19573 case ARMISD::VADDVs:
19574 case ARMISD::VADDVu:
19575 case ARMISD::VADDLVs:
19576 case ARMISD::VADDLVu:
19577 case ARMISD::VADDLVAs:
19578 case ARMISD::VADDLVAu:
19579 case ARMISD::VMLAVs:
19580 case ARMISD::VMLAVu:
19581 case ARMISD::VMLALVs:
19582 case ARMISD::VMLALVu:
19583 case ARMISD::VMLALVAs:
19584 case ARMISD::VMLALVAu:
19586 case ARMISD::VMOVN:
19588 case ARMISD::VQMOVNs:
19589 case ARMISD::VQMOVNu:
19591 case ARMISD::VQDMULH:
19597 case ARMISD::SMULWB: {
19598 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
19604 case ARMISD::SMULWT: {
19605 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
19611 case ARMISD::SMLALBB:
19612 case ARMISD::QADD16b:
19613 case ARMISD::QSUB16b:
19614 case ARMISD::UQADD16b:
19615 case ARMISD::UQSUB16b: {
19616 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
19623 case ARMISD::SMLALBT: {
19624 unsigned LowWidth =
N->getOperand(0).getValueType().getSizeInBits();
19626 unsigned HighWidth =
N->getOperand(1).getValueType().getSizeInBits();
19633 case ARMISD::SMLALTB: {
19634 unsigned HighWidth =
N->getOperand(0).getValueType().getSizeInBits();
19636 unsigned LowWidth =
N->getOperand(1).getValueType().getSizeInBits();
19643 case ARMISD::SMLALTT: {
19644 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
19651 case ARMISD::QADD8b:
19652 case ARMISD::QSUB8b:
19653 case ARMISD::UQADD8b:
19654 case ARMISD::UQSUB8b: {
19655 unsigned BitWidth =
N->getValueType(0).getSizeInBits();
19663 if (
N->getOperand(1) ==
N->getOperand(2))
19664 return N->getOperand(1);
19668 switch (
N->getConstantOperandVal(1)) {
19669 case Intrinsic::arm_neon_vld1:
19670 case Intrinsic::arm_neon_vld1x2:
19671 case Intrinsic::arm_neon_vld1x3:
19672 case Intrinsic::arm_neon_vld1x4:
19673 case Intrinsic::arm_neon_vld2:
19674 case Intrinsic::arm_neon_vld3:
19675 case Intrinsic::arm_neon_vld4:
19676 case Intrinsic::arm_neon_vld2lane:
19677 case Intrinsic::arm_neon_vld3lane:
19678 case Intrinsic::arm_neon_vld4lane:
19679 case Intrinsic::arm_neon_vld2dup:
19680 case Intrinsic::arm_neon_vld3dup:
19681 case Intrinsic::arm_neon_vld4dup:
19682 case Intrinsic::arm_neon_vst1:
19683 case Intrinsic::arm_neon_vst1x2:
19684 case Intrinsic::arm_neon_vst1x3:
19685 case Intrinsic::arm_neon_vst1x4:
19686 case Intrinsic::arm_neon_vst2:
19687 case Intrinsic::arm_neon_vst3:
19688 case Intrinsic::arm_neon_vst4:
19689 case Intrinsic::arm_neon_vst2lane:
19690 case Intrinsic::arm_neon_vst3lane:
19691 case Intrinsic::arm_neon_vst4lane:
19693 case Intrinsic::arm_mve_vld2q:
19694 case Intrinsic::arm_mve_vld4q:
19695 case Intrinsic::arm_mve_vst2q:
19696 case Intrinsic::arm_mve_vst4q:
19713 unsigned *
Fast)
const {
19719 bool AllowsUnaligned = Subtarget->allowsUnalignedMem();
19722 if (Ty == MVT::i8 || Ty == MVT::i16 || Ty == MVT::i32) {
19724 if (AllowsUnaligned) {
19726 *
Fast = Subtarget->hasV7Ops();
19731 if (Ty == MVT::f64 || Ty == MVT::v2f64) {
19735 if (Subtarget->hasNEON() && (AllowsUnaligned || Subtarget->isLittle())) {
19742 if (!Subtarget->hasMVEIntegerOps())
19746 if ((Ty == MVT::v16i1 || Ty == MVT::v8i1 || Ty == MVT::v4i1 ||
19747 Ty == MVT::v2i1)) {
19755 if ((Ty == MVT::v4i8 || Ty == MVT::v8i8 || Ty == MVT::v4i16) &&
19771 if (Ty == MVT::v16i8 || Ty == MVT::v8i16 || Ty == MVT::v8f16 ||
19772 Ty == MVT::v4i32 || Ty == MVT::v4f32 || Ty == MVT::v2i64 ||
19773 Ty == MVT::v2f64) {
19786 if ((
Op.isMemcpyOrMemmove() ||
Op.isZeroMemset()) && Subtarget->hasNEON() &&
19787 !FuncAttributes.hasFnAttr(Attribute::NoImplicitFloat)) {
19789 if (
Op.size() >= 16 &&
19795 }
else if (
Op.size() >= 8 &&
19812 if (!SrcTy->isIntegerTy() || !DstTy->
isIntegerTy())
19814 unsigned SrcBits = SrcTy->getPrimitiveSizeInBits();
19816 return (SrcBits == 64 && DestBits == 32);
19825 return (SrcBits == 64 && DestBits == 32);
19861 return Subtarget->hasFullFP16();
19868 if (!Subtarget->hasMVEIntegerOps())
19887 if (Ld->isExpandingLoad())
19891 if (Subtarget->hasMVEIntegerOps())
19904 U->getOpcode() ==
ISD::SHL || U->getOpcode() == ARMISD::VSHLIMM))
19936bool ARMTargetLowering::isFMAFasterThanFMulAndFAdd(
const MachineFunction &MF,
19965 unsigned Scale = 1;
19982 if ((
V & (Scale - 1)) != 0)
19997 bool IsNeg =
false;
20003 unsigned NumBytes = std::max((
unsigned)VT.
getSizeInBits() / 8, 1U);
20028 if (NumBytes == 1 || NumBytes == 2 || NumBytes == 4) {
20058 default:
return false;
20077 int Scale = AM.
Scale;
20082 default:
return false;
20090 Scale = Scale & ~1;
20091 return Scale == 2 || Scale == 4 || Scale == 8;
20108 if (Scale & 1)
return false;
20115 const int Scale = AM.
Scale;
20125 return (Scale == 1) || (!AM.
HasBaseReg && Scale == 2);
20141 switch (AM.
Scale) {
20152 if (Subtarget->isThumb1Only())
20155 if (Subtarget->isThumb2())
20158 int Scale = AM.
Scale;
20160 default:
return false;
20164 if (Scale < 0) Scale = -Scale;
20172 if (Scale == 1 || (AM.
HasBaseReg && Scale == -1))
20185 if (Scale & 1)
return false;
20198 if (!Subtarget->isThumb())
20201 if (Subtarget->isThumb2())
20205 return Imm >= 0 &&
Imm <= 255;
20215 if (!Subtarget->isThumb())
20217 if (Subtarget->isThumb2())
20220 return AbsImm <= 255;
20255 if (VT == MVT::i16 || ((VT == MVT::i8 || VT == MVT::i1) && isSEXTLoad)) {
20259 int RHSC = (int)
RHS->getZExtValue();
20260 if (RHSC < 0 && RHSC > -256) {
20270 }
else if (VT == MVT::i32 || VT == MVT::i8 || VT == MVT::i1) {
20273 int RHSC = (int)
RHS->getZExtValue();
20274 if (RHSC < 0 && RHSC > -0x1000) {
20316 int RHSC = (int)
RHS->getZExtValue();
20317 if (RHSC < 0 && RHSC > -0x100) {
20322 }
else if (RHSC > 0 && RHSC < 0x100) {
20333 bool isSEXTLoad,
bool IsMasked,
bool isLE,
20344 bool CanChangeType = isLE && !IsMasked;
20347 int RHSC = (int)
RHS->getZExtValue();
20349 auto IsInRange = [&](
int RHSC,
int Limit,
int Scale) {
20350 if (RHSC < 0 && RHSC > -Limit * Scale && RHSC % Scale == 0) {
20355 }
else if (RHSC > 0 && RHSC < Limit * Scale && RHSC % Scale == 0) {
20366 if (VT == MVT::v4i16) {
20367 if (Alignment >= 2 && IsInRange(RHSC, 0x80, 2))
20369 }
else if (VT == MVT::v4i8 || VT == MVT::v8i8) {
20370 if (IsInRange(RHSC, 0x80, 1))
20372 }
else if (Alignment >= 4 &&
20373 (CanChangeType || VT == MVT::v4i32 || VT == MVT::v4f32) &&
20374 IsInRange(RHSC, 0x80, 4))
20376 else if (Alignment >= 2 &&
20377 (CanChangeType || VT == MVT::v8i16 || VT == MVT::v8f16) &&
20378 IsInRange(RHSC, 0x80, 2))
20380 else if ((CanChangeType || VT == MVT::v16i8) && IsInRange(RHSC, 0x80, 1))
20393 if (Subtarget->isThumb1Only())
20400 bool isSEXTLoad =
false;
20401 bool IsMasked =
false;
20403 Ptr = LD->getBasePtr();
20404 VT = LD->getMemoryVT();
20405 Alignment = LD->getAlign();
20406 AS = LD->getAddressSpace();
20409 Ptr = ST->getBasePtr();
20410 VT = ST->getMemoryVT();
20411 Alignment = ST->getAlign();
20412 AS = ST->getAddressSpace();
20414 Ptr = LD->getBasePtr();
20415 VT = LD->getMemoryVT();
20416 Alignment = LD->getAlign();
20417 AS = LD->getAddressSpace();
20421 Ptr = ST->getBasePtr();
20422 VT = ST->getMemoryVT();
20423 Alignment = ST->getAlign();
20424 AS = ST->getAddressSpace();
20439 bool isLegal =
false;
20441 isLegal = Subtarget->hasMVEIntegerOps() &&
20443 Ptr.
getNode(), VT, Alignment, isSEXTLoad, IsMasked,
20444 Subtarget->isLittle(),
Base,
Offset, isInc, DAG);
20446 if (Subtarget->isThumb2())
20471 bool isSEXTLoad =
false, isNonExt;
20472 bool IsMasked =
false;
20474 VT = LD->getMemoryVT();
20475 Ptr = LD->getBasePtr();
20476 Alignment = LD->getAlign();
20480 VT = ST->getMemoryVT();
20481 Ptr = ST->getBasePtr();
20482 Alignment = ST->getAlign();
20483 isNonExt = !ST->isTruncatingStore();
20485 VT = LD->getMemoryVT();
20486 Ptr = LD->getBasePtr();
20487 Alignment = LD->getAlign();
20492 VT = ST->getMemoryVT();
20493 Ptr = ST->getBasePtr();
20494 Alignment = ST->getAlign();
20495 isNonExt = !ST->isTruncatingStore();
20500 if (Subtarget->isThumb1Only()) {
20503 assert(
Op->getValueType(0) == MVT::i32 &&
"Non-i32 post-inc op?!");
20504 if (
Op->getOpcode() !=
ISD::ADD || !isNonExt)
20507 if (!RHS || RHS->getZExtValue() != 4)
20509 if (Alignment <
Align(4))
20513 Base =
Op->getOperand(0);
20519 bool isLegal =
false;
20521 isLegal = Subtarget->hasMVEIntegerOps() &&
20526 if (Subtarget->isThumb2())
20540 !Subtarget->isThumb2())
20554 const APInt &DemandedElts,
20556 unsigned Depth)
const {
20559 switch (
Op.getOpcode()) {
20566 if (
Op.getResNo() == 0) {
20577 case ARMISD::CMOV: {
20580 if (
Known.isUnknown())
20592 case Intrinsic::arm_ldaex:
20593 case Intrinsic::arm_ldrex: {
20601 case ARMISD::BFI: {
20608 const APInt &Mask =
Op.getConstantOperandAPInt(2);
20609 Known.Zero &= Mask;
20613 case ARMISD::VGETLANEs:
20614 case ARMISD::VGETLANEu: {
20615 const SDValue &SrcSV =
Op.getOperand(0);
20621 "VGETLANE index out of bounds");
20626 EVT VT =
Op.getValueType();
20632 if (
Op.getOpcode() == ARMISD::VGETLANEs)
20640 case ARMISD::VMOVrh: {
20646 case ARMISD::CSINC:
20647 case ARMISD::CSINV:
20648 case ARMISD::CSNEG: {
20656 if (
Op.getOpcode() == ARMISD::CSINC)
20659 else if (
Op.getOpcode() == ARMISD::CSINV)
20661 else if (
Op.getOpcode() == ARMISD::CSNEG)
20668 case ARMISD::VORRIMM:
20669 case ARMISD::VBICIMM: {
20670 unsigned Encoded =
Op.getConstantOperandVal(1);
20671 unsigned DecEltBits = 0;
20674 unsigned EltBits =
Op.getScalarValueSizeInBits();
20675 if (EltBits != DecEltBits) {
20684 bool IsVORR =
Op.getOpcode() == ARMISD::VORRIMM;
20685 APInt Imm(DecEltBits, DecodedVal);
20713 if (
Imm == 0 ||
Imm == ~0U)
20716 unsigned Opc =
Op.getOpcode();
20718 EVT VT =
Op.getValueType();
20720 unsigned ShrunkImm =
Imm & Demanded;
20721 unsigned ExpandedImm =
Imm | ~Demanded;
20723 auto IsLegalImm = [ShrunkImm, ExpandedImm](
unsigned CandidateImm) ->
bool {
20724 return (ShrunkImm & CandidateImm) == ShrunkImm &&
20725 (~ExpandedImm & CandidateImm) == 0;
20727 auto UseImm = [
Imm,
Opc,
Op, VT, &TLO](
unsigned NewImm) ->
bool {
20739 if (ShrunkImm == 0) {
20740 ++NumOptimizedImms;
20741 return UseImm(ShrunkImm);
20747 if (ExpandedImm == ~0U) {
20748 ++NumOptimizedImms;
20749 return UseImm(ExpandedImm);
20757 if (IsLegalImm(0xFF)) {
20758 ++NumOptimizedImms;
20759 return UseImm(0xFF);
20762 if (IsLegalImm(0xFFFF)) {
20763 ++NumOptimizedImms;
20764 return UseImm(0xFFFF);
20778 ++NumOptimizedImms;
20779 return UseImm(ShrunkImm);
20787 if ((~ExpandedImm) < 256) {
20788 ++NumOptimizedImms;
20789 return UseImm(ExpandedImm);
20796 ++NumOptimizedImms;
20797 return UseImm(ExpandedImm);
20816 EVT VT =
Op.getValueType();
20831 switch (
Op.getOpcode()) {
20842 unsigned Imm =
C->getZExtValue();
20849 unsigned Depth)
const {
20850 unsigned Opc =
Op.getOpcode();
20854 case ARMISD::LSRL: {
20858 if (
Op.getResNo() == 0 && !
Op->hasAnyUseOfValue(1) &&
20860 unsigned ShAmt =
Op->getConstantOperandVal(2);
20870 case ARMISD::VBICIMM: {
20872 unsigned ModImm =
Op.getConstantOperandVal(1);
20873 unsigned EltBits = 0;
20875 if ((OriginalDemandedBits & Mask) == 0)
20881 Op, OriginalDemandedBits, OriginalDemandedElts,
Known, TLO,
Depth);
20896 if (!Subtarget->hasVFP2Base())
20900 if (ConstraintVT.
isVector() && Subtarget->hasNEON() &&
20912 unsigned S = Constraint.
size();
20914 switch (Constraint[0]) {
20926 }
else if (S == 2) {
20927 switch (Constraint[0]) {
20944 Value *CallOperandVal =
info.CallOperandVal;
20947 if (!CallOperandVal)
20951 switch (*constraint) {
20957 if (Subtarget->isThumb())
20972 if (PR == 0 || VT == MVT::Other)
20974 if (ARM::SPRRegClass.
contains(PR))
20975 return VT != MVT::f32 && VT != MVT::f16 && VT != MVT::i32;
20976 if (ARM::DPRRegClass.
contains(PR))
20981using RCPair = std::pair<unsigned, const TargetRegisterClass *>;
20985 switch (Constraint.
size()) {
20988 switch (Constraint[0]) {
20990 if (Subtarget->isThumb())
20991 return RCPair(0U, &ARM::tGPRRegClass);
20992 return RCPair(0U, &ARM::GPRRegClass);
20994 if (Subtarget->isThumb())
20995 return RCPair(0U, &ARM::hGPRRegClass);
20998 if (Subtarget->isThumb1Only())
20999 return RCPair(0U, &ARM::tGPRRegClass);
21000 return RCPair(0U, &ARM::GPRRegClass);
21002 if (VT == MVT::Other)
21004 if (VT == MVT::f32 || VT == MVT::f16 || VT == MVT::bf16)
21005 return RCPair(0U, &ARM::SPRRegClass);
21007 return RCPair(0U, &ARM::DPRRegClass);
21009 return RCPair(0U, &ARM::QPRRegClass);
21012 if (VT == MVT::Other)
21014 if (VT == MVT::f32 || VT == MVT::f16 || VT == MVT::bf16)
21015 return RCPair(0U, &ARM::SPR_8RegClass);
21017 return RCPair(0U, &ARM::DPR_8RegClass);
21019 return RCPair(0U, &ARM::QPR_8RegClass);
21022 if (VT == MVT::Other)
21024 if (VT == MVT::f32 || VT == MVT::i32 || VT == MVT::f16 || VT == MVT::bf16)
21025 return RCPair(0U, &ARM::SPRRegClass);
21027 return RCPair(0U, &ARM::DPR_VFP2RegClass);
21029 return RCPair(0U, &ARM::QPR_VFP2RegClass);
21035 if (Constraint[0] ==
'T') {
21036 switch (Constraint[1]) {
21040 return RCPair(0U, &ARM::tGPREvenRegClass);
21042 return RCPair(0U, &ARM::tGPROddRegClass);
21051 if (
StringRef(
"{cc}").equals_insensitive(Constraint))
21052 return std::make_pair(
unsigned(ARM::CPSR), &ARM::CCRRegClass);
21055 if (
StringRef(
"{r14}").equals_insensitive(Constraint))
21056 Constraint =
"{lr}";
21060 return {0,
nullptr};
21068 std::vector<SDValue> &
Ops,
21073 if (Constraint.
size() != 1)
21076 char ConstraintLetter = Constraint[0];
21077 switch (ConstraintLetter) {
21080 case 'I':
case 'J':
case 'K':
case 'L':
21081 case 'M':
case 'N':
case 'O':
21086 int64_t CVal64 =
C->getSExtValue();
21087 int CVal = (int) CVal64;
21090 if (CVal != CVal64)
21093 switch (ConstraintLetter) {
21097 if (Subtarget->hasV6T2Ops() || (Subtarget->hasV8MBaselineOps()))
21098 if (CVal >= 0 && CVal <= 65535)
21102 if (Subtarget->isThumb1Only()) {
21105 if (CVal >= 0 && CVal <= 255)
21107 }
else if (Subtarget->isThumb2()) {
21121 if (Subtarget->isThumb1Only()) {
21126 if (CVal >= -255 && CVal <= -1)
21132 if (CVal >= -4095 && CVal <= 4095)
21138 if (Subtarget->isThumb1Only()) {
21145 }
else if (Subtarget->isThumb2()) {
21165 if (Subtarget->isThumb1Only()) {
21168 if (CVal >= -7 && CVal < 7)
21170 }
else if (Subtarget->isThumb2()) {
21190 if (Subtarget->isThumb1Only()) {
21193 if ((CVal >= 0 && CVal <= 1020) && ((CVal & 3) == 0))
21199 if ((CVal >= 0 && CVal <= 32) || ((CVal & (CVal - 1)) == 0))
21205 if (Subtarget->isThumb1Only()) {
21207 if (CVal >= 0 && CVal <= 31)
21213 if (Subtarget->isThumb1Only()) {
21216 if ((CVal >= -508 && CVal <= 508) && ((CVal & 3) == 0))
21225 if (Result.getNode()) {
21226 Ops.push_back(Result);
21236 "Unhandled Opcode in getDivRemLibcall");
21242 case MVT::i8: LC =
isSigned ? RTLIB::SDIVREM_I8 : RTLIB::UDIVREM_I8;
break;
21243 case MVT::i16: LC =
isSigned ? RTLIB::SDIVREM_I16 : RTLIB::UDIVREM_I16;
break;
21244 case MVT::i32: LC =
isSigned ? RTLIB::SDIVREM_I32 : RTLIB::UDIVREM_I32;
break;
21245 case MVT::i64: LC =
isSigned ? RTLIB::SDIVREM_I64 : RTLIB::UDIVREM_I64;
break;
21252 const AttributeList &FuncAttrs, RTLIB::LibcallImpl LCImpl) {
21255 "Unhandled Opcode in getDivRemArgList");
21256 SDValue Ops[2] = {
N->getOperand(0),
N->getOperand(1)};
21260 case RTLIB::impl___rt_sdiv:
21261 case RTLIB::impl___rt_udiv:
21262 case RTLIB::impl___rt_sdiv64:
21263 case RTLIB::impl___rt_udiv64:
21274 assert((Subtarget->isTargetAEABI() || Subtarget->isTargetAndroid() ||
21275 Subtarget->isTargetGNUAEABI() || Subtarget->isTargetMuslAEABI() ||
21276 Subtarget->isTargetFuchsia() || Subtarget->isTargetWindows()) &&
21277 "Register-based DivRem lowering only");
21278 unsigned Opcode =
Op->getOpcode();
21280 "Invalid opcode for Div/Rem lowering");
21282 EVT VT =
Op->getValueType(0);
21302 bool hasDivide = Subtarget->isThumb() ? Subtarget->hasDivideInThumbMode()
21303 : Subtarget->hasDivideInARMMode();
21304 if (hasDivide &&
Op->getValueType(0).isSimple() &&
21305 Op->getSimpleValueType(0) == MVT::i32) {
21307 const SDValue Dividend =
Op->getOperand(0);
21308 const SDValue Divisor =
Op->getOperand(1);
21320 if (LCImpl == RTLIB::Unsupported)
21323 auto [FuncTy, FuncAttrs] =
21327 Type *RetTy = FuncTy->getReturnType();
21337 if (
getTM().getTargetTriple().isOSWindows())
21340 TargetLowering::CallLoweringInfo CLI(DAG);
21344 Callee, std::move(Args))
21349 std::pair<SDValue, SDValue> CallInfo =
LowerCallTo(CLI);
21350 return CallInfo.first;
21356 EVT VT =
N->getValueType(0);
21362 Result[0], Result[1]);
21368 if (LCImpl == RTLIB::Unsupported)
21371 auto [FuncTy, FuncAttrs] =
21375 Type *RetTy = FuncTy->getReturnType();
21385 if (
getTM().getTargetTriple().isOSWindows())
21392 Callee, std::move(Args))
21396 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
21399 SDNode *ResNode = CallResult.first.getNode();
21406 assert(
getTM().getTargetTriple().isOSWindows() &&
21407 "unsupported target platform");
21415 "no-stack-arg-probe")) {
21419 Chain =
SP.getValue(1);
21436 SDVTList NodeTys = DAG.
getVTList(MVT::Other, MVT::Glue);
21437 Chain = DAG.
getNode(ARMISD::WIN__CHKSTK,
DL, NodeTys, Chain, Glue);
21447 bool IsStrict =
Op->isStrictFPOpcode();
21448 SDValue SrcVal =
Op.getOperand(IsStrict ? 1 : 0);
21449 EVT DstTy =
Op.getValueType();
21453 assert(DstSz > SrcSz && DstSz <= 64 && SrcSz >= 16 &&
21454 "Unexpected type for custom-lowering FP_EXTEND");
21457 if (DstTy == MVT::f32 && SrcTy == MVT::f16 && Subtarget->hasFP16())
21460 if (DstTy == MVT::f64 && SrcTy == MVT::f16 && Subtarget->hasFP16() &&
21461 Subtarget->hasFP64() && Subtarget->hasFPARMv8Base())
21465 if (SrcTy == MVT::bf16) {
21471 if (DstTy == MVT::f32)
21474 assert(DstTy == MVT::f64 &&
"Unexpected BF16 convert");
21477 {
Op.getOperand(0), Res});
21482 if (SrcTy == MVT::f32 && DstTy == MVT::f64 && Subtarget->hasFP64()) {
21501 for (
unsigned Sz = SrcSz; Sz <= 32 && Sz < DstSz; Sz *= 2) {
21502 bool Supported = (Sz == 16 ? Subtarget->hasFP16() : Subtarget->hasFP64());
21503 MVT SrcVT = (Sz == 16 ? MVT::f16 : MVT::f32);
21504 MVT DstVT = (Sz == 16 ? MVT::f32 : MVT::f64);
21508 {DstVT, MVT::Other}, {Chain, SrcVal});
21515 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
21516 "Unexpected type for custom-lowering FP_EXTEND");
21517 std::tie(SrcVal, Chain) =
makeLibCall(DAG, LC, DstVT, SrcVal, CallOptions,
21522 return IsStrict ? DAG.
getMergeValues({SrcVal, Chain}, Loc) : SrcVal;
21526 bool IsStrict =
Op->isStrictFPOpcode();
21528 SDValue SrcVal =
Op.getOperand(IsStrict ? 1 : 0);
21530 EVT DstVT =
Op.getValueType();
21532 if (DstVT == MVT::bf16) {
21533 if (Subtarget->hasBF16() && SrcVT == MVT::f32)
21538 const unsigned DstSz =
Op.getValueType().getSizeInBits();
21541 assert(DstSz < SrcSz && SrcSz <= 64 && DstSz >= 16 &&
21542 "Unexpected type for custom-lowering FP_ROUND");
21544 assert((!Subtarget->hasFP64() || !Subtarget->hasFPARMv8Base()) &&
21545 "With both FP DP and 16, any FP conversion is legal!");
21550 if (SrcSz == 32 && Subtarget->hasFP16())
21555 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
21556 "Unexpected type for custom-lowering FP_ROUND");
21560 std::tie(Result, Chain) =
makeLibCall(DAG, LC, DstVT, SrcVal, CallOptions,
21572 if (v == 0xffffffff)
21583 bool ForCodeSize)
const {
21584 if (!Subtarget->hasVFP3Base())
21586 if (VT == MVT::f16 && Subtarget->hasFullFP16())
21589 if (VT == MVT::f32 && Subtarget->hasFullFP16() &&
21592 if (VT == MVT::f32)
21595 if (VT == MVT::f64 && Subtarget->hasFP64())
21603 bool ForCodeSize)
const {
21604 if (Subtarget->useSoftFloat() || !Subtarget->hasVFP2Base())
21617 case Intrinsic::arm_neon_vld1:
21618 case Intrinsic::arm_neon_vld2:
21619 case Intrinsic::arm_neon_vld3:
21620 case Intrinsic::arm_neon_vld4:
21621 case Intrinsic::arm_neon_vld2lane:
21622 case Intrinsic::arm_neon_vld3lane:
21623 case Intrinsic::arm_neon_vld4lane:
21624 case Intrinsic::arm_neon_vld2dup:
21625 case Intrinsic::arm_neon_vld3dup:
21626 case Intrinsic::arm_neon_vld4dup: {
21629 auto &
DL =
I.getDataLayout();
21630 uint64_t NumElts =
DL.getTypeSizeInBits(
I.getType()) / 64;
21632 Info.ptrVal =
I.getArgOperand(0);
21634 Value *AlignArg =
I.getArgOperand(
I.arg_size() - 1);
21641 case Intrinsic::arm_neon_vld1x2:
21642 case Intrinsic::arm_neon_vld1x3:
21643 case Intrinsic::arm_neon_vld1x4: {
21646 auto &
DL =
I.getDataLayout();
21647 uint64_t NumElts =
DL.getTypeSizeInBits(
I.getType()) / 64;
21649 Info.ptrVal =
I.getArgOperand(
I.arg_size() - 1);
21651 Info.align =
I.getParamAlign(
I.arg_size() - 1).valueOrOne();
21657 case Intrinsic::arm_neon_vst1:
21658 case Intrinsic::arm_neon_vst2:
21659 case Intrinsic::arm_neon_vst3:
21660 case Intrinsic::arm_neon_vst4:
21661 case Intrinsic::arm_neon_vst2lane:
21662 case Intrinsic::arm_neon_vst3lane:
21663 case Intrinsic::arm_neon_vst4lane: {
21666 auto &
DL =
I.getDataLayout();
21667 unsigned NumElts = 0;
21668 for (
unsigned ArgI = 1, ArgE =
I.arg_size(); ArgI < ArgE; ++ArgI) {
21669 Type *ArgTy =
I.getArgOperand(ArgI)->getType();
21672 NumElts +=
DL.getTypeSizeInBits(ArgTy) / 64;
21675 Info.ptrVal =
I.getArgOperand(0);
21677 Value *AlignArg =
I.getArgOperand(
I.arg_size() - 1);
21684 case Intrinsic::arm_neon_vst1x2:
21685 case Intrinsic::arm_neon_vst1x3:
21686 case Intrinsic::arm_neon_vst1x4: {
21689 auto &
DL =
I.getDataLayout();
21690 unsigned NumElts = 0;
21691 for (
unsigned ArgI = 1, ArgE =
I.arg_size(); ArgI < ArgE; ++ArgI) {
21692 Type *ArgTy =
I.getArgOperand(ArgI)->getType();
21695 NumElts +=
DL.getTypeSizeInBits(ArgTy) / 64;
21698 Info.ptrVal =
I.getArgOperand(0);
21700 Info.align =
I.getParamAlign(0).valueOrOne();
21706 case Intrinsic::arm_mve_vld2q:
21707 case Intrinsic::arm_mve_vld4q: {
21711 unsigned Factor =
Intrinsic == Intrinsic::arm_mve_vld2q ? 2 : 4;
21713 Info.ptrVal =
I.getArgOperand(0);
21721 case Intrinsic::arm_mve_vst2q:
21722 case Intrinsic::arm_mve_vst4q: {
21725 Type *VecTy =
I.getArgOperand(1)->getType();
21726 unsigned Factor =
Intrinsic == Intrinsic::arm_mve_vst2q ? 2 : 4;
21728 Info.ptrVal =
I.getArgOperand(0);
21736 case Intrinsic::arm_mve_vldr_gather_base:
21737 case Intrinsic::arm_mve_vldr_gather_base_predicated: {
21739 Info.ptrVal =
nullptr;
21741 Info.align =
Align(1);
21746 case Intrinsic::arm_mve_vldr_gather_base_wb:
21747 case Intrinsic::arm_mve_vldr_gather_base_wb_predicated: {
21749 Info.ptrVal =
nullptr;
21750 Info.memVT =
MVT::getVT(
I.getType()->getContainedType(0));
21751 Info.align =
Align(1);
21756 case Intrinsic::arm_mve_vldr_gather_offset:
21757 case Intrinsic::arm_mve_vldr_gather_offset_predicated: {
21759 Info.ptrVal =
nullptr;
21764 Info.align =
Align(1);
21769 case Intrinsic::arm_mve_vstr_scatter_base:
21770 case Intrinsic::arm_mve_vstr_scatter_base_predicated: {
21772 Info.ptrVal =
nullptr;
21773 Info.memVT =
MVT::getVT(
I.getArgOperand(2)->getType());
21774 Info.align =
Align(1);
21779 case Intrinsic::arm_mve_vstr_scatter_base_wb:
21780 case Intrinsic::arm_mve_vstr_scatter_base_wb_predicated: {
21782 Info.ptrVal =
nullptr;
21783 Info.memVT =
MVT::getVT(
I.getArgOperand(2)->getType());
21784 Info.align =
Align(1);
21789 case Intrinsic::arm_mve_vstr_scatter_offset:
21790 case Intrinsic::arm_mve_vstr_scatter_offset_predicated: {
21792 Info.ptrVal =
nullptr;
21797 Info.align =
Align(1);
21802 case Intrinsic::arm_ldaex:
21803 case Intrinsic::arm_ldrex: {
21804 auto &
DL =
I.getDataLayout();
21805 Type *ValTy =
I.getParamElementType(0);
21808 Info.ptrVal =
I.getArgOperand(0);
21810 Info.align =
DL.getABITypeAlign(ValTy);
21815 case Intrinsic::arm_stlex:
21816 case Intrinsic::arm_strex: {
21817 auto &
DL =
I.getDataLayout();
21818 Type *ValTy =
I.getParamElementType(1);
21821 Info.ptrVal =
I.getArgOperand(1);
21823 Info.align =
DL.getABITypeAlign(ValTy);
21828 case Intrinsic::arm_stlexd:
21829 case Intrinsic::arm_strexd:
21831 Info.memVT = MVT::i64;
21832 Info.ptrVal =
I.getArgOperand(2);
21834 Info.align =
Align(8);
21839 case Intrinsic::arm_ldaexd:
21840 case Intrinsic::arm_ldrexd:
21842 Info.memVT = MVT::i64;
21843 Info.ptrVal =
I.getArgOperand(0);
21845 Info.align =
Align(8);
21859 assert(Ty->isIntegerTy());
21861 unsigned Bits = Ty->getPrimitiveSizeInBits();
21862 if (Bits == 0 || Bits > 32)
21869 unsigned Index)
const {
21881 if (!Subtarget->hasDataBarrier()) {
21885 if (Subtarget->hasV6Ops() && !Subtarget->isThumb()) {
21886 Value*
args[6] = {Builder.getInt32(15), Builder.getInt32(0),
21887 Builder.getInt32(0), Builder.getInt32(7),
21888 Builder.getInt32(10), Builder.getInt32(5)};
21889 return Builder.CreateIntrinsicWithoutFolding(Intrinsic::arm_mcr,
args);
21898 return Builder.CreateIntrinsicWithoutFolding(Intrinsic::arm_dmb, CDomain);
21919 if (Subtarget->preferISHSTBarriers())
21953 if (Subtarget->isMClass())
21954 has64BitLLSC =
false;
21955 else if (Subtarget->isThumb())
21956 has64BitLLSC = Subtarget->hasV7Ops();
21958 has64BitLLSC = Subtarget->hasV6Ops();
21960 unsigned Size =
SI->getValueOperand()->getType()->getPrimitiveSizeInBits();
21961 if (
Size == 64 && has64BitLLSC)
21981 if (Subtarget->isMClass())
21982 has64BitLLSC =
false;
21983 else if (Subtarget->isThumb())
21984 has64BitLLSC = Subtarget->hasV7Ops();
21986 has64BitLLSC = Subtarget->hasV6Ops();
21989 if (
Size == 64 && has64BitLLSC)
22008 if (Subtarget->isMClass())
22009 hasAtomicRMW = Subtarget->hasV8MBaselineOps();
22010 else if (Subtarget->isThumb())
22011 hasAtomicRMW = Subtarget->hasV7Ops();
22013 hasAtomicRMW = Subtarget->hasV6Ops();
22014 if (
Size <= (Subtarget->isMClass() ? 32U : 64U) && hasAtomicRMW) {
22038 bool HasAtomicCmpXchg;
22039 if (Subtarget->isMClass())
22040 HasAtomicCmpXchg = Subtarget->hasV8MBaselineOps();
22041 else if (Subtarget->isThumb())
22042 HasAtomicCmpXchg = Subtarget->hasV7Ops();
22044 HasAtomicCmpXchg = Subtarget->hasV6Ops();
22046 HasAtomicCmpXchg &&
Size <= (Subtarget->isMClass() ? 32U : 64U))
22053 return InsertFencesForAtomic;
22057 if (Subtarget->isTargetFuchsia())
22060 return !Subtarget->isROPI() && !Subtarget->isRWPI();
22068 if (Subtarget->isTargetFuchsia()) {
22071 M, Intrinsic::thread_pointer, IRB.
getPtrTy());
22082 RTLIB::LibcallImpl SecurityCheckCookieLibcall =
22083 Libcalls.getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
22085 RTLIB::LibcallImpl SecurityCookieVar =
22086 Libcalls.getLibcallImpl(RTLIB::STACK_CHECK_GUARD);
22087 if (SecurityCheckCookieLibcall != RTLIB::Unsupported &&
22088 SecurityCookieVar != RTLIB::Unsupported) {
22097 F->addParamAttr(0, Attribute::AttrKind::InReg);
22104 unsigned &
Cost)
const {
22106 if (!Subtarget->hasNEON())
22135 unsigned Opcode =
Op.getOpcode();
22137 case ARMISD::VORRIMM:
22138 case ARMISD::VBICIMM:
22142 Op, DemandedElts, DAG, Kind, ConsiderFlags,
Depth);
22146 return Subtarget->hasV5TOps() && !Subtarget->isThumb1Only();
22150 return Subtarget->hasV5TOps() && !Subtarget->isThumb1Only();
22155 if (!Subtarget->hasV7Ops())
22161 if (!Mask || Mask->getValue().getBitWidth() > 32u)
22163 auto MaskVal =
unsigned(Mask->getValue().getZExtValue());
22171 if (Subtarget->hasMinSize() && !
getTM().getTargetTriple().isOSWindows())
22180 Module *M = Builder.getModule();
22186 if (ValueTy->getPrimitiveSizeInBits() == 64) {
22188 IsAcquire ? Intrinsic::arm_ldaexd : Intrinsic::arm_ldrexd;
22191 Builder.CreateIntrinsic(
Int, Addr,
nullptr,
"lohi");
22193 Value *
Lo = Builder.CreateExtractValue(LoHi, 0,
"lo");
22194 Value *
Hi = Builder.CreateExtractValue(LoHi, 1,
"hi");
22195 if (!Subtarget->isLittle())
22197 Lo = Builder.CreateZExt(
Lo, ValueTy,
"lo64");
22198 Hi = Builder.CreateZExt(
Hi, ValueTy,
"hi64");
22199 return Builder.CreateOr(
22200 Lo, Builder.CreateShl(
Hi, ConstantInt::get(ValueTy, 32)),
"val64");
22204 Intrinsic::ID Int = IsAcquire ? Intrinsic::arm_ldaex : Intrinsic::arm_ldrex;
22205 CallInst *CI = Builder.CreateIntrinsicWithoutFolding(
Int, Tys, Addr);
22208 0,
Attribute::get(M->getContext(), Attribute::ElementType, ValueTy));
22209 return Builder.CreateTruncOrBitCast(CI, ValueTy);
22214 if (!(Subtarget->isThumb() ? Subtarget->hasV7Clrex()
22215 : Subtarget->hasV6KOps()))
22217 Builder.CreateIntrinsic(Intrinsic::arm_clrex, {});
22223 Module *M = Builder.getModule();
22231 IsRelease ? Intrinsic::arm_stlexd : Intrinsic::arm_strexd;
22234 Value *
Lo = Builder.CreateTrunc(Val, Int32Ty,
"lo");
22235 Value *
Hi = Builder.CreateTrunc(Builder.CreateLShr(Val, 32), Int32Ty,
"hi");
22236 if (!Subtarget->isLittle())
22238 return Builder.CreateIntrinsic(
Int, {
Lo,
Hi, Addr});
22241 Intrinsic::ID Int = IsRelease ? Intrinsic::arm_stlex : Intrinsic::arm_strex;
22245 CallInst *CI = Builder.CreateCall(
22246 Strex, {Builder.CreateZExtOrBitCast(
22256 return Subtarget->isMClass();
22264 return (
DL.getTypeSizeInBits(VecTy) + 127) / 128;
22271 unsigned VecSize =
DL.getTypeSizeInBits(VecTy);
22274 if (!Subtarget->hasNEON() && !Subtarget->hasMVEIntegerOps())
22282 if (Subtarget->hasMVEIntegerOps() && Factor == 3)
22290 if (ElSize != 8 && ElSize != 16 && ElSize != 32)
22293 if (Subtarget->hasMVEIntegerOps() && Alignment < ElSize / 8)
22298 if (Subtarget->hasNEON() && VecSize == 64)
22300 return VecSize % 128 == 0;
22304 if (Subtarget->hasNEON())
22306 if (Subtarget->hasMVEIntegerOps())
22326 "Invalid interleave factor");
22327 assert(!Shuffles.
empty() &&
"Empty shufflevector input");
22329 "Unmatched number of shufflevectors and indices");
22334 assert(!Mask && GapMask.
popcount() == Factor &&
"Unexpected mask on a load");
22337 Type *EltTy = VecTy->getElementType();
22340 Align Alignment = LI->getAlign();
22356 Builder.disableGEPCanonicalization();
22359 Value *BaseAddr = LI->getPointerOperand();
22361 if (NumLoads > 1) {
22365 VecTy->getNumElements() / NumLoads);
22371 if (Subtarget->hasNEON()) {
22372 Type *PtrTy = Builder.getPtrTy(LI->getPointerAddressSpace());
22373 Type *Tys[] = {VecTy, PtrTy};
22374 static const Intrinsic::ID LoadInts[3] = {Intrinsic::arm_neon_vld2,
22375 Intrinsic::arm_neon_vld3,
22376 Intrinsic::arm_neon_vld4};
22379 Ops.push_back(BaseAddr);
22380 Ops.push_back(Builder.getInt32(LI->getAlign().value()));
22382 return Builder.CreateIntrinsic(LoadInts[Factor - 2], Tys,
Ops,
22385 assert((Factor == 2 || Factor == 4) &&
22386 "expected interleave factor of 2 or 4 for MVE");
22388 Factor == 2 ? Intrinsic::arm_mve_vld2q : Intrinsic::arm_mve_vld4q;
22389 Type *PtrTy = Builder.getPtrTy(LI->getPointerAddressSpace());
22390 Type *Tys[] = {VecTy, PtrTy};
22393 Ops.push_back(BaseAddr);
22394 return Builder.CreateIntrinsic(LoadInts, Tys,
Ops,
nullptr,
22404 for (
unsigned LoadCount = 0; LoadCount < NumLoads; ++LoadCount) {
22408 BaseAddr = Builder.CreateConstGEP1_32(VecTy->getElementType(), BaseAddr,
22409 VecTy->getNumElements() * Factor);
22415 for (
unsigned i = 0; i < Shuffles.
size(); i++) {
22417 unsigned Index = Indices[i];
22419 Value *SubVec = Builder.CreateExtractValue(VldN, Index);
22423 SubVec = Builder.CreateIntToPtr(
22427 SubVecs[SV].push_back(SubVec);
22436 auto &SubVec = SubVecs[SVI];
22439 SVI->replaceAllUsesWith(WideVec);
22475 const APInt &GapMask)
const {
22477 "Invalid interleave factor");
22482 "Unexpected mask on store");
22485 assert(VecTy->getNumElements() % Factor == 0 &&
"Invalid interleaved store");
22487 unsigned LaneLen = VecTy->getNumElements() / Factor;
22488 Type *EltTy = VecTy->getElementType();
22492 Align Alignment =
SI->getAlign();
22505 Builder.disableGEPCanonicalization();
22510 Type *IntTy =
DL.getIntPtrType(EltTy);
22515 Op0 = Builder.CreatePtrToInt(Op0, IntVecTy);
22516 Op1 = Builder.CreatePtrToInt(Op1, IntVecTy);
22522 Value *BaseAddr =
SI->getPointerOperand();
22524 if (NumStores > 1) {
22527 LaneLen /= NumStores;
22537 if (Subtarget->hasNEON()) {
22538 static const Intrinsic::ID StoreInts[3] = {Intrinsic::arm_neon_vst2,
22539 Intrinsic::arm_neon_vst3,
22540 Intrinsic::arm_neon_vst4};
22541 Type *PtrTy = Builder.getPtrTy(
SI->getPointerAddressSpace());
22545 Ops.push_back(BaseAddr);
22547 Ops.push_back(Builder.getInt32(
SI->getAlign().value()));
22548 Builder.CreateIntrinsic(StoreInts[Factor - 2], Tys,
Ops);
22550 assert((Factor == 2 || Factor == 4) &&
22551 "expected interleave factor of 2 or 4 for MVE");
22553 Factor == 2 ? Intrinsic::arm_mve_vst2q : Intrinsic::arm_mve_vst4q;
22554 Type *PtrTy = Builder.getPtrTy(
SI->getPointerAddressSpace());
22558 Ops.push_back(BaseAddr);
22560 for (
unsigned F = 0;
F < Factor;
F++) {
22561 Ops.push_back(Builder.getInt32(
F));
22562 Builder.CreateIntrinsic(StoreInts, Tys,
Ops);
22568 for (
unsigned StoreCount = 0; StoreCount < NumStores; ++StoreCount) {
22571 if (StoreCount > 0)
22572 BaseAddr = Builder.CreateConstGEP1_32(
SubVecTy->getElementType(),
22573 BaseAddr, LaneLen * Factor);
22578 for (
unsigned i = 0; i < Factor; i++) {
22579 unsigned IdxI = StoreCount * LaneLen * Factor + i;
22580 if (Mask[IdxI] >= 0) {
22581 Shuffles.
push_back(Builder.CreateShuffleVector(
22584 unsigned StartMask = 0;
22585 for (
unsigned j = 1; j < LaneLen; j++) {
22586 unsigned IdxJ = StoreCount * LaneLen * Factor + j;
22587 if (Mask[IdxJ * Factor + IdxI] >= 0) {
22588 StartMask = Mask[IdxJ * Factor + IdxI] - IdxJ;
22598 Shuffles.
push_back(Builder.CreateShuffleVector(
22619 for (
unsigned i = 0; i < ST->getNumElements(); ++i) {
22623 Members += SubMembers;
22629 Members += SubMembers * AT->getNumElements();
22630 }
else if (Ty->isFloatTy()) {
22635 }
else if (Ty->isDoubleTy()) {
22647 return VT->getPrimitiveSizeInBits().getFixedValue() == 64;
22649 return VT->getPrimitiveSizeInBits().getFixedValue() == 128;
22651 switch (VT->getPrimitiveSizeInBits().getFixedValue()) {
22664 return (Members > 0 && Members <= 4);
22670 const Align ABITypeAlign =
DL.getABITypeAlign(ArgTy);
22672 return ABITypeAlign;
22677 assert(StackAlign &&
"data layout string is missing stack alignment");
22678 return std::min(ABITypeAlign, *StackAlign);
22692 uint64_t Members = 0;
22696 bool IsIntArray = Ty->isArrayTy() && Ty->getArrayElementType()->isIntegerTy();
22697 return IsHA || IsIntArray;
22720void ARMTargetLowering::insertCopiesSplitCSR(
22724 const MCPhysReg *IStart =
TRI->getCalleeSavedRegsViaCopy(Entry->getParent());
22734 RC = &ARM::GPRRegClass;
22735 else if (ARM::DPRRegClass.
contains(*
I))
22736 RC = &ARM::DPRRegClass;
22746 assert(Entry->getParent()->getFunction().hasFnAttribute(
22747 Attribute::NoUnwind) &&
22748 "Function should be nounwind in insertCopiesSplitCSR!");
22749 Entry->addLiveIn(*
I);
22754 for (
auto *Exit : Exits)
22756 TII->get(TargetOpcode::COPY), *
I)
22767 return Subtarget->hasMVEIntegerOps();
22777 unsigned NumElements = VTy->getNumElements();
22784 if (ScalarTy->isHalfTy() || ScalarTy->isFloatTy())
22785 return Subtarget->hasMVEFloatOps();
22790 return Subtarget->hasMVEIntegerOps() &&
22791 (ScalarTy->isIntegerTy(8) || ScalarTy->isIntegerTy(16) ||
22792 ScalarTy->isIntegerTy(32));
22796 static const MCPhysReg RCRegs[] = {ARM::FPSCR_RM};
22807 unsigned TyWidth = Ty->getScalarSizeInBits() * Ty->getNumElements();
22809 assert(TyWidth >= 128 &&
"Width of vector type must be at least 128 bits");
22811 if (TyWidth > 128) {
22812 int Stride = Ty->getNumElements() / 2;
22816 ArrayRef<int> UpperSplitMask(&SplitSeqVec[Stride], Stride);
22818 auto *LowerSplitA =
B.CreateShuffleVector(InputA, LowerSplitMask);
22819 auto *LowerSplitB =
B.CreateShuffleVector(InputB, LowerSplitMask);
22820 auto *UpperSplitA =
B.CreateShuffleVector(InputA, UpperSplitMask);
22821 auto *UpperSplitB =
B.CreateShuffleVector(InputB, UpperSplitMask);
22822 Value *LowerSplitAcc =
nullptr;
22823 Value *UpperSplitAcc =
nullptr;
22826 LowerSplitAcc =
B.CreateShuffleVector(
Accumulator, LowerSplitMask);
22827 UpperSplitAcc =
B.CreateShuffleVector(
Accumulator, UpperSplitMask);
22831 B, OperationType, Rotation, LowerSplitA, LowerSplitB, LowerSplitAcc);
22833 B, OperationType, Rotation, UpperSplitA, UpperSplitB, UpperSplitAcc);
22835 ArrayRef<int> JoinMask(&SplitSeqVec[0], Ty->getNumElements());
22836 return B.CreateShuffleVector(LowerSplitInt, UpperSplitInt, JoinMask);
22843 ConstRotation = ConstantInt::get(IntTy, (
int)Rotation);
22846 return B.CreateIntrinsic(Intrinsic::arm_mve_vcmlaq, Ty,
22848 return B.CreateIntrinsic(Intrinsic::arm_mve_vcmulq, Ty,
22849 {ConstRotation, InputB, InputA});
22854 auto *ConstHalving = ConstantInt::get(IntTy, 1);
22857 ConstRotation = ConstantInt::get(IntTy, 0);
22859 ConstRotation = ConstantInt::get(IntTy, 1);
22861 if (!ConstRotation)
22864 return B.CreateIntrinsic(Intrinsic::arm_mve_vcaddq, Ty,
22865 {ConstHalving, ConstRotation, InputA, InputB});
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 SDValue carryFlagToValue(SDValue Glue, EVT VT, SelectionDAG &DAG, bool Invert)
static SDValue overflowFlagToValue(SDValue Glue, EVT VT, SelectionDAG &DAG)
static bool isZeroExtended(SDValue N, SelectionDAG &DAG)
static bool isCMN(SDValue Op, ISD::CondCode CC, SelectionDAG &DAG)
static const MCPhysReg GPRArgRegs[]
static SDValue valueToCarryFlag(SDValue Value, SelectionDAG &DAG, bool Invert)
constexpr MVT FlagsVT
Value type used for NZCV flags.
static unsigned getCmpOperandFoldingProfit(SDValue Op, bool AllowExtend)
Returns how profitable it is to fold a comparison's operand's shift and/or extension operations.
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 bool optimizeLogicalImm(SDValue Op, unsigned Size, uint64_t Imm, const APInt &Demanded, TargetLowering::TargetLoweringOpt &TLO, unsigned NewOpc)
static bool isSafeSignedCMN(SDValue Op, SelectionDAG &DAG)
static SDValue LowerPREFETCH(SDValue Op, SelectionDAG &DAG)
static bool isSignExtended(SDValue N, SelectionDAG &DAG)
const AArch64Subtarget & Subtarget
const TargetLowering & TLI
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 PerformExtractEltToVMOVRRD(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static bool isIncompatibleReg(const MCPhysReg &PR, MVT VT)
static SDValue PerformVQDMULHCombine(SDNode *N, SelectionDAG &DAG)
static SDValue PerformVECTOR_DEINTERLEAVECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
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 performSplitConstantStore(StoreSDNode *St, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
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 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 SDValue PerformLegalizedVECTOR_DEINTERLEAVECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
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 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 SDValue PerformVMOVrsCombine(SDNode *N, 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 TargetLowering::ArgListTy getDivRemArgList(const SDNode *N, FunctionType *FuncTy, const AttributeList &FuncAttrs, RTLIB::LibcallImpl LCImpl)
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 PerformInterleavedStoreCombine(StoreSDNode *ST, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
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 SDValue matchCSET(unsigned &Opcode, bool &InvertCond, SDValue TrueVal, SDValue FalseVal, const ARMSubtarget *Subtarget)
static bool isSequentialConcatOfVectorInterleave(SDNode *N, SmallVectorImpl< SDValue > &Ops)
static SDValue PerformORCombineToSMULWBT(SDNode *OR, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
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 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 getInvertedARMCondCode(SDValue ARMcc, SelectionDAG &DAG)
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 hasNativeAtomics(const ARMSubtarget &ST)
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 SDValue LowerADDSUBO_CARRY(SDValue Op, SelectionDAG &DAG, unsigned Opcode, bool IsSigned)
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 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 int getNegationCost(SDValue Op)
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 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 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 bool isLegalLogicalImmediate(unsigned Imm, const ARMSubtarget *Subtarget)
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 GeneratePerfectShuffle(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...
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 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 SDValue PerformLegalizedInterleavedStoreCombine(StoreSDNode *ST, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
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 LowerTruncate(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue PerformHWLoopCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *ST)
static SDValue PerformORCombineToShiftInsert(SelectionDAG &DAG, SDValue AndOp, SDValue ShiftOp, EVT VT, SDLoc dl)
static SDValue PerformSplittingMVETruncToNarrowingStores(StoreSDNode *St, SelectionDAG &DAG)
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 getShiftedLowMaskZeroTest(SDValue Value, SelectionDAG &DAG, const SDLoc &DL)
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.
arm ldst static false bool definesCPSR(const MachineInstr &MI)
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< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
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.
static bool isSigned(unsigned Opcode)
const HexagonInstrInfo * TII
hexagon merge activate weight
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 ...
Register const TargetRegisterInfo * TRI
Promote Memory to Register
uint64_t IntrinsicInst * II
SmallVector< MachineOperand, 4 > Cond
MachineRegisterInfo & MRI
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")))
Contains matchers for matching SelectionDAG nodes and values.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
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 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.
bool isOne() const
Determine if this is a value of 1.
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, ARMCP::ARMCPModifier Modifier=ARMCP::no_modifier, bool AddCurrentAddress=false)
ARMConstantPoolValue - ARM specific constantpool value.
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
int getVarArgsFrameIndex() const
SmallVectorImpl< ForwardedRegister > & getForwardedMustTailRegParms()
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
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,...
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...
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...
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 getTgtMemIntrinsic(SmallVectorImpl< IntrinsicInfo > &Infos, const CallBase &I, MachineFunction &MF, unsigned Intrinsic) const override
getTgtMemIntrinsic - Represent NEON load and store intrinsics as MemIntrinsicNodes.
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
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...
FPImmAction getFPImmAction(const APFloat &Imm, EVT VT, bool ForCodeSize=false) const override
Returns how to materialize the specified FP immediate.
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.
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.
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicRMWInIR(const AtomicRMWInst *AI) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all.
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
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering) const override
createFastISel - This method returns a target specific FastISel object, or null if the target does no...
void insertSSPDeclarations(Module &M, const LibcallLoweringInfo &Libcalls) const override
Inserts necessary declarations for SSP (stack protection) purpose.
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
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag.
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...
Register getExceptionPointerRegister(ExceptionHandling EH, const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicCmpXchgInIR(const AtomicCmpXchgInst *AI) const override
Returns how the given atomic cmpxchg should be expanded by the IR-level AtomicExpand pass.
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.
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
bool hasAndNot(SDValue Y) const override
Return true if the target has a bitwise and-not operation: X = ~A & B This can be used to simplify se...
Register getExceptionSelectorRegister(ExceptionHandling EH, const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
ExtractSubvectorCost getExtractSubvectorCost(EVT ResVT, EVT SrcVT, unsigned Index) const override
Return the cost of EXTRACT_SUBVECTOR for this result type with this index.
CallingConv::ID getEffectiveCallingConv(CallingConv::ID CC, bool isVarArg) const
getEffectiveCallingConv - Get the effective calling convention, taking into account presence of float...
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.
Value * getIRStackGuard(IRBuilderBase &IRB, const LibcallLoweringInfo &Libcalls) const override
If the target has a standard location for the stack protector guard, returns the address of that loca...
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...
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.
bool hasAndNotCompare(SDValue V) const override
Return true if the target should transform: (X & Y) == Y ---> (~X & Y) == 0 (X & Y) !...
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.
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.
bool canCreateUndefOrPoisonForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, UndefPoisonKind Kind, bool ConsiderFlags, unsigned Depth) const override
Return true if Op can create undef or poison from non-undef & non-poison operands.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
bool empty() const
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, and fixed/scalable offsets.
LLVM Basic Block Representation.
The address of a basic block.
static constexpr 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,...
LLVM_ABI void analyzeMustTailForwardedRegisters(SmallVectorImpl< ForwardedRegister > &Forwards, ArrayRef< MVT > RegParmTypes, CCAssignFn Fn)
Compute the set of registers that need to be preserved and forwarded to any musttail calls.
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.
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...
MachineConstantPoolValue * getMachineCPVal() const
bool isMachineConstantPoolEntry() const
const Constant * getConstVal() const
LLVM_ABI Type * getType() const
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...
StringRef getInternalSymbolPrefix() const
LLVM_ABI Align getPreferredAlign(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global.
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.
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
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.
Value * CreateConstGEP1_32(Type *Ty, Value *Ptr, unsigned Idx0, const Twine &Name="")
Module * getModule() const
Get the module.
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args={}, const Twine &Name="", MDNode *FPMathTag=nullptr)
PointerType * getPtrTy(unsigned AddrSpace=0)
Fetch the type representing a pointer.
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
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 isIndexed() const
Return true if this is a pre/post inc/dec load/store.
Tracks which library functions to use for a particular subtarget or function.
const RTLIB::RuntimeLibcallsInfo & getRuntimeLibcallsInfo() const
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
RTLIB::LibcallImpl getLibcallImpl(RTLIB::Libcall Call) const
Return the lowering's selection of implementation call for Call.
An instruction for reading from memory.
AtomicOrdering getOrdering() const
Returns the ordering constraint of this load instruction.
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)
LLVM_ABI bool isLiveIn(MCRegister Reg, LaneBitmask LaneMask=LaneBitmask::getAll()) const
Return true if the specified register is in the live in set.
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...
LLVM_ABI 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)
bool hasMustTailInVarArgFunc() const
Returns true if the function is variadic and contains a musttail call.
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.
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...
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, LLT MemTy, Align BaseAlignment, const MMOMetadata &Metadata=MMOMetadata(), SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
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 & setOperandDead(unsigned OpIdx) const
const MachineInstrBuilder & addUse(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
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 & addJumpTableIndex(unsigned Idx, unsigned TargetFlags=0) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & addDef(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register definition operand.
const MachineInstrBuilder & cloneMemRefs(const MachineInstr &OtherMI) const
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.
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.
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.
void setIsDead(bool Val=true)
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,...
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
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.
bool isSimple() const
Returns true if the memory operation is neither atomic or volatile.
MachineMemOperand * getMemOperand() const
Return the unique MachineMemOperand object describing the memory reference performed by operation.
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.
const Triple & getTargetTriple() const
Get the target triple which is a string describing the target host.
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.
ISD::CondCode getOperandCondCode(unsigned Num) const
Helper method returns the CondCode of a CondCodeSDNode.
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.
op_iterator op_end() const
op_iterator op_begin() const
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, in exactly one operand.
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
const SDValue & getOperand(unsigned i) const
ISD::CondCode getOperandCondCode(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...
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.
LLVM_ABI SDValue makeEquivalentMemoryOrdering(SDValue OldChain, SDValue NewMemOpChain)
If an existing load has uses of its chain, create a token factor node with that chain and the new mem...
LLVM_ABI bool areNonVolatileConsecutiveLoads(LoadSDNode *LD, LoadSDNode *Base, TypeSize Bytes, int Dist) const
Return true if loads are next to each other and can be merged.
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 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 getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
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)
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 getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
Helper function to build ISD::STORE nodes.
LLVM_ABI bool areNonVolatileConsecutiveStores(StoreSDNode *ST, StoreSDNode *Base, TypeSize Bytes, int Dist) const
Return true if stores are next to each other and can be merged.
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 void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
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 MMOMetadata &Metadata=MMOMetadata())
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 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.
LLVM_ABI SDValue getBasicBlock(MachineBasicBlock *MBB)
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 SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
Loads are not normal binary operators: their result type is not determined by their operands,...
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
const LibcallLoweringInfo & getLibcalls() 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.
LLVM_ABI OverflowKind computeOverflowForSignedAdd(SDValue N0, SDValue N1) const
Determine if the result of the signed addition of 2 nodes can overflow.
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
SDValue getPOISON(EVT VT)
Return a POISON node. POISON does not have a useful SDLoc.
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.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
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)
LLVM_NO_SANITIZE_CFI_UNRELATED_CAST iterator begin()
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
Represent a constant reference to a string, i.e.
const unsigned char * bytes_end() const
constexpr size_t size() const
Get the string size.
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
const unsigned char * bytes_begin() const
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.
virtual Value * getIRStackGuard(IRBuilderBase &IRB, const LibcallLoweringInfo &Libcalls) const
If the target has a standard location for the stack protector guard, returns the address of that loca...
const TargetMachine & getTargetMachine() const
virtual void insertSSPDeclarations(Module &M, const LibcallLoweringInfo &Libcalls) const
Inserts necessary declarations for SSP (stack protection) purpose.
bool isFPImmLegal(const APFloat &Imm, EVT VT, bool ForCodeSize=false) const
Returns true if the specified FP immediate can be materialized without a load from the constant pool.
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...
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 ...
ExtractSubvectorCost
Enum that specifies how expensive lowering an EXTRACT_SUBVECTOR is.
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.
FPImmAction
How the legalizer should materialize a floating-point immediate.
@ ConstantPool
Load the immediate from the constant pool.
@ Legal
The target can instruction select the immediate natively.
@ Bitcast
Build the immediate as a bitcast of an integer constant with the same bits.
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...
virtual bool allowsMemoryAccess(LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace=0, Align Alignment=Align(1), MachineMemOperand::Flags Flags=MachineMemOperand::MONone, unsigned *Fast=nullptr) const
Return true if the target supports a memory access of this type for the given address space and align...
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.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
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.
SDValue expandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG) const
Expands an unaligned store to 2 half-size stores for integer values, and possibly more for vectors.
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...
std::pair< SDValue, SDValue > expandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG) const
Expands an unaligned load to 2 half-size loads for an integer, and possibly more for vectors.
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 an n/2-bit algorithm.
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.
static ArgListTy getArgListForFunctionType(FunctionType *FuncTy, const AttributeList &FuncAttrs, ArrayRef< SDValue > Ops)
Build a call argument list for FuncTy, taking the argument node values from Ops and the parameter typ...
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
virtual ArrayRef< MCPhysReg > getRoundingControlRegisters() const
Returns a 0 terminated array of rounding control registers that can be attached into strict FP call.
virtual bool canCreateUndefOrPoisonForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, UndefPoisonKind Kind, bool ConsiderFlags, unsigned Depth) const
Return true if Op can create undef or poison from non-undef & non-poison operands.
virtual bool useLoadStackGuardNode(const Module &M) const
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
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).
void setTypeIdForCallsiteInfo(const CallBase *CB, MachineFunction &MF, MachineFunction::CallSiteInfo &CSInfo) const
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.
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.
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.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
The instances of the Type class are immutable: once they are created, they are never changed.
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.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
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.
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)
static ARMCC::CondCodes getSwappedCondition(ARMCC::CondCodes CC)
getSwappedCondition - assume the flags are set by MI(a,b), return the condition code if we modify the...
@ SECREL
Thread Pointer Offset.
@ GOT_PREL
Thread Local Storage (General Dynamic Mode)
@ 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
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering)
const unsigned FPReservedBits
const unsigned RoundingBitsPos
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.
LLVM_ABI bool isConstantSplatVector(SDValue V, APInt &SplatValue)
Node predicates.
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.
@ POISON
POISON - A poison node.
@ 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.
@ 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.
@ VECTOR_INTERLEAVE
VECTOR_INTERLEAVE(VEC1, VEC2, ...) - Returns N vectors from N input vectors, where N is the factor to...
@ 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.
@ CTLS
Count leading redundant sign bits.
@ 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 - Same semantics as the llvm.minnum/maxnum intrinsics.
@ 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.
@ STRICT_SINT_TO_FP
STRICT_[US]INT_TO_FP - Convert a signed or unsigned integer to a floating point value.
@ 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 - Same semantics as the llvm.minimum/maximum intrinsics.
@ 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,...
@ CTTZ_ZERO_POISON
Bit counting operators with a poisoned result for zero inputs.
@ 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)...
@ VECTOR_DEINTERLEAVE
VECTOR_DEINTERLEAVE(VEC1, VEC2, ...) - Returns N vectors from N input vectors, where N is the factor ...
@ ABDS
ABDS/ABDU - Absolute difference - Return the absolute difference between two numbers interpreted as s...
@ SADDO_CARRY
Carry-using overflow-aware nodes for multiple precision addition and subtraction.
@ 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).
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 isBuildVectorAllZeros(SDValue V)
Return true if the specified value is a BUILD_VECTOR where all of the elements are 0 or undef.
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.
bool isIntEqualitySetCC(CondCode Code)
Return true if this is a setcc instruction that performs an equality comparison when used with intege...
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 * > OverloadTys={})
Look up the Function declaration of the intrinsic id in the Module M.
TwoOps_match< Val_t, Idx_t, Instruction::ExtractElement > m_ExtractElt(const Val_t &Val, const Idx_t &Idx)
Matches ExtractElementInst.
auto m_Value()
Match an arbitrary value and ignore it.
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.
bool sd_match(SDValue N, Pattern &&P)
ConstantInt_match m_ConstInt()
Match any integer constants or splat of an integer constant.
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
initializer< Ty > init(const Ty &Val)
BaseReg
Stack frame base register. Bit 0 of FREInfo.Info.
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.
void stable_sort(R &&Range)
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,...
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.
bool isVZIPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
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.
RelativeUniformCounterPtr Values
@ Known
Known to have no common set bits.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Kill
The last use of a register.
@ Define
Register definition.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
int countr_one(T Value)
Count the number of ones from the least significant bit to the first zero bit.
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...
auto successors(const MachineBasicBlock *BB)
@ Load
The value being inserted comes from a load (InsertElement only).
@ Store
The extracted value is stored (ExtractElement only).
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.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
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)
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
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 isVUZPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
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...
bool isVTRNMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
const unsigned PerfectShuffleTable[6561+1]
AtomicOrdering
Atomic ordering for LLVM's memory model.
ComplexDeinterleavingRotation
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...
@ Fast
Assign the register banks as fast as possible (default).
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
DWARFExpression::Operation Op
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,...
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
@ SjLj
setjmp/longjmp based exceptions
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.
constexpr auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
LLVM_ABI bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
UndefPoisonKind
Enumeration to track whether we are interested in Undef, Poison, or both.
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
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...
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.
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,...
MCRegisterClass TargetRegisterClass
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 Align fromLog2(unsigned Log2Value)
Returns an alignment of 1 << Log2Value bytes.
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.
uint64_t getScalarStoreSize() const
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.
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.
static KnownBits add(const KnownBits &LHS, const KnownBits &RHS, bool NSW=false, bool NUW=false, bool SelfAdd=false)
Compute knownbits resulting from addition of LHS and RHS.
KnownBits intersectWith(const KnownBits &RHS) const
Returns KnownBits information that is known to be true for both this 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.
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.
A simple container for information about the supported runtime calls.
LLVM_ABI FunctionCallee getOrInsertLibcallDecl(Module &M, RTLIB::LibcallImpl LibcallImpl) const
LLVM_ABI GlobalValue * getOrInsertImplGlobal(Module &M, RTLIB::LibcallImpl LibcallImpl) const
LLVM_ABI std::pair< FunctionType *, AttributeList > getFunctionTy(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const
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
CombineLevel getDAGCombineLevel()
LLVM_ABI void AddToWorklist(SDNode *N)
bool isCalledByLegalizer() const
LLVM_ABI bool recursivelyDeleteUnusedNodes(SDNode *N)
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)