91 #define DEBUG_TYPE "aarch64-lower" 93 STATISTIC(NumTailCalls,
"Number of tail calls");
94 STATISTIC(NumShiftInserts,
"Number of vector shift inserts");
95 STATISTIC(NumOptimizedImms,
"Number of times immediates were optimized");
99 cl::desc(
"Allow AArch64 SLI/SRI formation"),
107 cl::desc(
"Allow AArch64 Local Dynamic TLS code generation"),
112 cl::desc(
"Enable AArch64 logical imm instruction " 752 void AArch64TargetLowering::addTypeForNEON(
MVT VT,
MVT PromotedBitwiseVT) {
832 void AArch64TargetLowering::addDRTypeForNEON(
MVT VT) {
837 void AArch64TargetLowering::addQRTypeForNEON(
MVT VT) {
850 const APInt &Demanded,
853 uint64_t OldImm = Imm, NewImm, Enc;
854 uint64_t
Mask = ((uint64_t)(-1LL) >> (64 -
Size)), OrigMask =
Mask;
858 if (Imm == 0 || Imm == Mask ||
862 unsigned EltSize =
Size;
876 uint64_t NonDemandedBits = ~DemandedBits;
877 uint64_t InvertedImm = ~Imm & DemandedBits;
878 uint64_t RotatedImm =
879 ((InvertedImm << 1) | (InvertedImm >> (EltSize - 1) & 1)) &
881 uint64_t Sum = RotatedImm + NonDemandedBits;
882 bool Carry = NonDemandedBits & ~Sum & (1ULL << (EltSize - 1));
883 uint64_t Ones = (Sum + Carry) & NonDemandedBits;
884 NewImm = (Imm | Ones) & Mask;
898 uint64_t
Hi = Imm >> EltSize, DemandedBitsHi = DemandedBits >> EltSize;
901 if (((Imm ^ Hi) & (DemandedBits & DemandedBitsHi) & Mask) != 0)
906 DemandedBits |= DemandedBitsHi;
912 while (EltSize < Size) {
913 NewImm |= NewImm << EltSize;
919 "demanded bits should never be altered");
920 assert(OldImm != NewImm &&
"the new imm shouldn't be equal to the old imm");
929 if (NewImm == 0 || NewImm == OrigMask) {
958 assert((Size == 32 || Size == 64) &&
959 "i32 or i64 is expected after legalization.");
970 NewOpc = Size == 32 ? AArch64::ANDWri : AArch64::ANDXri;
973 NewOpc = Size == 32 ? AArch64::ORRWri : AArch64::ORRXri;
976 NewOpc = Size == 32 ? AArch64::EORWri : AArch64::EORXri;
1007 case Intrinsic::aarch64_ldaxr:
1008 case Intrinsic::aarch64_ldxr: {
1010 EVT VT = cast<MemIntrinsicSDNode>(
Op)->getMemoryVT();
1020 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
1024 case Intrinsic::aarch64_neon_umaxv:
1025 case Intrinsic::aarch64_neon_uminv: {
1033 assert(BitWidth >= 8 &&
"Unexpected width!");
1037 assert(BitWidth >= 16 &&
"Unexpected width!");
1284 case AArch64::F128CSEL:
1287 case TargetOpcode::STACKMAP:
1288 case TargetOpcode::PATCHPOINT:
1456 bool IsLegal = (C >> 12 == 0) || ((C & 0xFFFULL) == 0 && C >> 24 == 0);
1458 <<
" legal: " << (IsLegal ?
"yes\n" :
"no\n"));
1465 const bool FullFP16 =
1559 unsigned Opcode = 0;
1560 const bool FullFP16 =
1585 return DAG.
getNode(Opcode, DL, MVT_CC, LHS, RHS, NZCVOp, Condition, CCOp);
1595 unsigned Depth = 0) {
1621 if (!CanNegateL && !CanNegateR)
1625 CanNegate = CanNegateL && CanNegateR;
1632 if (NeedsNegOutL && NeedsNegOutR)
1682 Predicate = ExtraCC;
1694 "Valid conjunction/disjunction tree");
1702 bool NegateOpsAndResult = Opcode ==
ISD::OR;
1706 if (NegateOpsAndResult) {
1710 assert(isValidL &&
"Valid conjunction/disjunction tree");
1716 assert(isValidR &&
"Valid conjunction/disjunction tree");
1717 assert((CanNegateL || CanNegateR) &&
"Valid conjunction/disjunction tree");
1724 bool NeedsNegOutL = LHS->getOpcode() ==
ISD::OR;
1726 "Valid conjunction/disjunction tree");
1739 if (NegateOpsAndResult && !Negate)
1743 NegateOpsAndResult, CmpR,
1747 if (NegateOpsAndResult && !Negate)
1772 uint64_t
C = RHSC->getZExtValue();
1780 if ((VT ==
MVT::i32 && C != 0x80000000 &&
1782 (VT ==
MVT::i64 && C != 0x80000000ULL &&
1801 if ((VT ==
MVT::i32 && C != INT32_MAX &&
1812 if ((VT ==
MVT::i32 && C != UINT32_MAX &&
1845 if ((RHSC->
getZExtValue() >> 16 == 0) && isa<LoadSDNode>(LHS) &&
1846 cast<LoadSDNode>(LHS)->getExtensionType() ==
ISD::ZEXTLOAD &&
1847 cast<LoadSDNode>(LHS)->getMemoryVT() ==
MVT::i16 &&
1849 int16_t ValueofRHS = cast<ConstantSDNode>(RHS)->getZExtValue();
1873 AArch64cc = DAG.
getConstant(AArch64CC, dl, MVT_CC);
1877 static std::pair<SDValue, SDValue>
1880 "Unsupported value type");
1954 UpperBits).getValue(1);
1976 UpperBits).getValue(1);
1986 Value = DAG.
getNode(Opc, DL, VTs, LHS, RHS);
1989 return std::make_pair(Value, Overflow);
2060 if (!CFVal || !CTVal)
2065 if (CTVal->isAllOnesValue() && CFVal->
isNullValue()) {
2097 bool ExtraOp =
false;
2156 unsigned IsWrite = cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue();
2157 unsigned Locality = cast<ConstantSDNode>(Op.
getOperand(3))->getZExtValue();
2158 unsigned IsData = cast<ConstantSDNode>(Op.
getOperand(4))->getZExtValue();
2160 bool IsStream = !Locality;
2164 assert(Locality <= 3 &&
"Prefetch locality out-of-range");
2168 Locality = 3 - Locality;
2172 unsigned PrfOp = (IsWrite << 4) |
2187 return LowerF128Call(Op, DAG, LC);
2296 In = DAG.
getNode(CastOpc, dl, CastVT, In);
2333 return LowerF128Call(Op, DAG, LC);
2350 Entry.IsSExt =
false;
2351 Entry.IsZExt =
false;
2352 Args.push_back(Entry);
2355 : RTLIB::SINCOS_STRET_F32;
2366 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
2367 return CallResult.first;
2392 switch (OrigSimpleTy) {
2405 unsigned ExtOpcode) {
2429 unsigned HalfSize = EltSize / 2;
2431 if (!
isIntN(HalfSize,
C->getSExtValue()))
2434 if (!
isUIntN(HalfSize,
C->getZExtValue()))
2455 unsigned EltSize = VT.getScalarSizeInBits() / 2;
2456 unsigned NumElts = VT.getVectorNumElements();
2459 for (
unsigned i = 0; i != NumElts; ++i) {
2526 "unexpected type for custom-lowering ISD::MUL");
2529 unsigned NewOpc = 0;
2533 if (isN0SExt && isN1SExt)
2538 if (isN0ZExt && isN1ZExt)
2540 else if (isN1SExt || isN1ZExt) {
2574 "unexpected types for extended operands to VMULL");
2575 return DAG.
getNode(NewOpc, DL, VT, Op0, Op1);
2583 return DAG.
getNode(N0->getOpcode(), DL, VT,
2597 "unexpected type for custom-lowering ISD::MULH{U,S}");
2641 SDValue Mull = DAG.
getNode(MullOpc, DL, MullVT, VMullV0, VMullV1);
2642 SDValue Mull2 = DAG.
getNode(MullOpc, DL, MullVT, VMull2V0, VMull2V1);
2650 SDValue AArch64TargetLowering::LowerINTRINSIC_WO_CHAIN(
SDValue Op,
2652 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
2656 case Intrinsic::thread_pointer: {
2660 case Intrinsic::aarch64_neon_abs:
2663 case Intrinsic::aarch64_neon_smax:
2666 case Intrinsic::aarch64_neon_umax:
2669 case Intrinsic::aarch64_neon_smin:
2672 case Intrinsic::aarch64_neon_umin:
2717 assert (StoreNode &&
"Can only custom lower store nodes");
2724 assert (VT.
isVector() &&
"Can only custom lower vector store types");
2752 return LowerGlobalAddress(Op, DAG);
2754 return LowerGlobalTLSAddress(Op, DAG);
2756 return LowerSETCC(Op, DAG);
2758 return LowerBR_CC(Op, DAG);
2760 return LowerSELECT(Op, DAG);
2762 return LowerSELECT_CC(Op, DAG);
2764 return LowerJumpTable(Op, DAG);
2766 return LowerConstantPool(Op, DAG);
2768 return LowerBlockAddress(Op, DAG);
2770 return LowerVASTART(Op, DAG);
2772 return LowerVACOPY(Op, DAG);
2774 return LowerVAARG(Op, DAG);
2788 return LowerF128Call(Op, DAG, RTLIB::ADD_F128);
2790 return LowerF128Call(Op, DAG, RTLIB::SUB_F128);
2792 return LowerF128Call(Op, DAG, RTLIB::MUL_F128);
2794 return LowerF128Call(Op, DAG, RTLIB::DIV_F128);
2796 return LowerFP_ROUND(Op, DAG);
2798 return LowerFP_EXTEND(Op, DAG);
2800 return LowerFRAMEADDR(Op, DAG);
2802 return LowerRETURNADDR(Op, DAG);
2804 return LowerINSERT_VECTOR_ELT(Op, DAG);
2806 return LowerEXTRACT_VECTOR_ELT(Op, DAG);
2808 return LowerBUILD_VECTOR(Op, DAG);
2810 return LowerVECTOR_SHUFFLE(Op, DAG);
2812 return LowerEXTRACT_SUBVECTOR(Op, DAG);
2816 return LowerVectorSRA_SRL_SHL(Op, DAG);
2818 return LowerShiftLeftParts(Op, DAG);
2821 return LowerShiftRightParts(Op, DAG);
2823 return LowerCTPOP(Op, DAG);
2825 return LowerFCOPYSIGN(Op, DAG);
2827 return LowerVectorAND(Op, DAG);
2829 return LowerVectorOR(Op, DAG);
2836 return LowerINT_TO_FP(Op, DAG);
2839 return LowerFP_TO_INT(Op, DAG);
2841 return LowerFSINCOS(Op, DAG);
2843 return LowerFLT_ROUNDS_(Op, DAG);
2850 return LowerINTRINSIC_WO_CHAIN(Op, DAG);
2852 return LowerSTORE(Op, DAG);
2860 return LowerVECREDUCE(Op, DAG);
2862 return LowerATOMIC_LOAD_SUB(Op, DAG);
2864 return LowerATOMIC_LOAD_AND(Op, DAG);
2866 return LowerDYNAMIC_STACKALLOC(Op, DAG);
2874 #include "AArch64GenCallingConv.inc" 2878 bool IsVarArg)
const {
2883 return CC_AArch64_WebKit_JS;
2885 return CC_AArch64_GHC;
2892 return CC_AArch64_Win64_VarArg;
2894 return CC_AArch64_AAPCS;
2895 return IsVarArg ? CC_AArch64_DarwinPCS_VarArg : CC_AArch64_DarwinPCS;
2897 return IsVarArg ? CC_AArch64_Win64_VarArg : CC_AArch64_AAPCS;
2904 : RetCC_AArch64_AAPCS;
2907 SDValue AArch64TargetLowering::LowerFormalArguments(
2926 unsigned NumArgs = Ins.
size();
2928 unsigned CurArgIdx = 0;
2929 for (
unsigned i = 0; i != NumArgs; ++i) {
2930 MVT ValVT = Ins[i].VT;
2931 if (Ins[i].isOrigArg()) {
2932 std::advance(CurOrigArg, Ins[i].getOrigArgIndex() - CurArgIdx);
2933 CurArgIdx = Ins[i].getOrigArgIndex();
2948 assert(!Res &&
"Call operand has unhandled type");
2953 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
2956 if (Ins[i].Flags.isByVal()) {
2960 int Size = Ins[i].Flags.getByValSize();
2961 unsigned NumRegs = (Size + 7) / 8;
2981 RC = &AArch64::GPR32RegClass;
2983 RC = &AArch64::GPR64RegClass;
2985 RC = &AArch64::FPR16RegClass;
2987 RC = &AArch64::FPR32RegClass;
2989 RC = &AArch64::FPR64RegClass;
2991 RC = &AArch64::FPR128RegClass;
3015 assert(RegVT == Ins[i].VT &&
"incorrect register location selected");
3028 !Ins[i].Flags.isInConsecutiveRegs())
3029 BEAlign = 8 - ArgSize;
3059 ExtType, DL, VA.
getLocVT(), Chain, FIN,
3076 saveVarArgRegisters(CCInfo, DAG, DL, Chain);
3080 unsigned StackOffset = CCInfo.getNextStackOffset();
3082 StackOffset = ((StackOffset + 7) & ~7);
3086 unsigned StackArgSize = CCInfo.getNextStackOffset();
3088 if (DoesCalleeRestoreStack(CallConv, TailCallOpt)) {
3092 StackArgSize =
alignTo(StackArgSize, 16);
3109 void AArch64TargetLowering::saveVarArgRegisters(
CCState &CCInfo,
3122 AArch64::X3, AArch64::X4, AArch64::X5,
3123 AArch64::X6, AArch64::X7 };
3124 static const unsigned NumGPRArgRegs =
array_lengthof(GPRArgRegs);
3127 unsigned GPRSaveSize = 8 * (NumGPRArgRegs - FirstVariadicGPR);
3129 if (GPRSaveSize != 0) {
3132 if (GPRSaveSize & 15)
3140 for (
unsigned i = FirstVariadicGPR; i < NumGPRArgRegs; ++i) {
3141 unsigned VReg = MF.
addLiveIn(GPRArgRegs[i], &AArch64::GPR64RegClass);
3148 (i - FirstVariadicGPR) * 8)
3160 AArch64::Q0, AArch64::Q1, AArch64::Q2, AArch64::Q3,
3161 AArch64::Q4, AArch64::Q5, AArch64::Q6, AArch64::Q7};
3162 static const unsigned NumFPRArgRegs =
array_lengthof(FPRArgRegs);
3165 unsigned FPRSaveSize = 16 * (NumFPRArgRegs - FirstVariadicFPR);
3167 if (FPRSaveSize != 0) {
3172 for (
unsigned i = FirstVariadicFPR; i < NumFPRArgRegs; ++i) {
3173 unsigned VReg = MF.
addLiveIn(FPRArgRegs[i], &AArch64::FPR128RegClass);
3188 if (!MemOps.
empty()) {
3195 SDValue AArch64TargetLowering::LowerCallResult(
3201 ? RetCC_AArch64_WebKit_JS
3202 : RetCC_AArch64_AAPCS;
3210 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
3215 if (i == 0 && isThisReturn) {
3217 "unexpected return calling convention register assignment");
3260 bool AArch64TargetLowering::isEligibleForTailCallOptimization(
3271 bool CCMatch = CallerCC == CalleeCC;
3279 if (i->hasByValAttr())
3307 "Unexpected variadic calling convention");
3310 if (isVarArg && !Outs.
empty()) {
3318 CCState CCInfo(CalleeCC, isVarArg, MF, ArgLocs, C);
3322 if (!ArgLoc.isRegLoc())
3336 if (!TRI->regmaskSubsetEqual(CallerPreserved, CalleePreserved))
3345 CCState CCInfo(CalleeCC, isVarArg, MF, ArgLocs, C);
3363 SDValue AArch64TargetLowering::addTokenForArgument(
SDValue Chain,
3366 int ClobberedFI)
const {
3369 int64_t LastByte = FirstByte + MFI.
getObjectSize(ClobberedFI) - 1;
3380 if (
LoadSDNode *L = dyn_cast<LoadSDNode>(*U))
3382 if (FI->getIndex() < 0) {
3384 int64_t InLastByte = InFirstByte;
3387 if ((InFirstByte <= FirstByte && FirstByte <= InLastByte) ||
3388 (FirstByte <= InFirstByte && InFirstByte <= LastByte))
3396 bool AArch64TargetLowering::DoesCalleeRestoreStack(
CallingConv::ID CallCC,
3397 bool TailCallOpt)
const {
3404 AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
3413 bool &IsTailCall = CLI.IsTailCall;
3415 bool IsVarArg = CLI.IsVarArg;
3418 bool IsThisReturn =
false;
3422 bool IsSibCall =
false;
3426 IsTailCall = isEligibleForTailCallOptimization(
3427 Callee, CallConv, IsVarArg, Outs, OutVals, Ins, DAG);
3428 if (!IsTailCall && CLI.CS && CLI.CS.isMustTailCall())
3430 "site marked musttail");
3434 if (!TailCallOpt && IsTailCall)
3449 unsigned NumArgs = Outs.
size();
3451 for (
unsigned i = 0; i != NumArgs; ++i) {
3452 MVT ArgVT = Outs[i].VT;
3457 assert(!Res &&
"Call operand has unhandled type");
3467 unsigned NumArgs = Outs.
size();
3468 for (
unsigned i = 0; i != NumArgs; ++i) {
3469 MVT ValVT = Outs[i].VT;
3472 CLI.getArgs()[Outs[i].OrigArgIndex].Ty,
3484 assert(!Res &&
"Call operand has unhandled type");
3505 if (IsTailCall && !IsSibCall) {
3510 NumBytes =
alignTo(NumBytes, 16);
3515 FPDiff = NumReusableBytes - NumBytes;
3522 assert(FPDiff % 16 == 0 &&
"unaligned stack on tail call");
3538 for (
unsigned i = 0, realArgIdx = 0, e = ArgLocs.
size(); i != e;
3539 ++i, ++realArgIdx) {
3557 if (Outs[realArgIdx].ArgVT ==
MVT::i1) {
3576 "unexpected calling convention register assignment");
3578 "unexpected use of 'returned'");
3579 IsThisReturn =
true;
3593 OpSize = (OpSize + 7) / 8;
3597 BEAlign = 8 - OpSize;
3600 int32_t
Offset = LocMemOffset + BEAlign;
3605 Offset = Offset + FPDiff;
3615 Chain = addTokenForArgument(Chain, DAG, MF.
getFrameInfo(), FI);
3624 if (Outs[i].Flags.
isByVal()) {
3628 Chain, DL, DstAddr, Arg, SizeNode, Outs[i].Flags.
getByValAlign(),
3648 if (!MemOpChains.
empty())
3654 for (
auto &RegToPass : RegsToPass) {
3656 RegToPass.second, InFlag);
3663 if (
auto *
G = dyn_cast<GlobalAddressSDNode>(Callee)) {
3664 auto GV =
G->getGlobal();
3669 }
else if (Subtarget->
isTargetCOFF() && GV->hasDLLImportStorageClass()) {
3671 "Windows is the only supported COFF target");
3677 }
else if (
auto *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
3680 const char *Sym = S->getSymbol();
3684 const char *Sym = S->getSymbol();
3693 if (IsTailCall && !IsSibCall) {
3699 std::vector<SDValue> Ops;
3700 Ops.push_back(Chain);
3701 Ops.push_back(Callee);
3712 for (
auto &RegToPass : RegsToPass)
3714 RegToPass.second.getValueType()));
3723 IsThisReturn =
false;
3729 assert(Mask &&
"Missing call preserved mask for calling convention");
3733 Ops.push_back(InFlag);
3748 uint64_t CalleePopBytes =
3749 DoesCalleeRestoreStack(CallConv, TailCallOpt) ?
alignTo(NumBytes, 16) : 0;
3759 return LowerCallResult(Chain, InFlag, CallConv, IsVarArg, Ins, DL, DAG,
3760 InVals, IsThisReturn,
3761 IsThisReturn ? OutVals[0] :
SDValue());
3764 bool AArch64TargetLowering::CanLowerReturn(
3768 ? RetCC_AArch64_WebKit_JS
3769 : RetCC_AArch64_AAPCS;
3771 CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
3782 ? RetCC_AArch64_WebKit_JS
3783 : RetCC_AArch64_AAPCS;
3792 for (
unsigned i = 0, realRVLocIdx = 0; i != RVLocs.
size();
3793 ++i, ++realRVLocIdx) {
3802 if (Outs[i].ArgVT ==
MVT::i1) {
3824 if (AArch64::GPR64RegClass.
contains(*I))
3826 else if (AArch64::FPR64RegClass.
contains(*I))
3848 unsigned Flag)
const {
3855 unsigned Flag)
const {
3861 unsigned Flag)
const {
3868 unsigned Flag)
const {
3873 template <
class NodeTy>
3875 unsigned Flags)
const {
3886 template <
class NodeTy>
3888 unsigned Flags)
const {
3902 template <
class NodeTy>
3904 unsigned Flags)
const {
3922 unsigned char OpFlags =
3927 "unexpected offset in global node");
3931 return getGOT(GN, DAG, TargetFlags);
3936 Result = getAddrLarge(GN, DAG, TargetFlags);
3938 Result = getAddr(GN, DAG, TargetFlags);
3942 if (GV->hasDLLImportStorageClass())
3977 AArch64TargetLowering::LowerDarwinGlobalTLSAddress(
SDValue Op,
3980 "This function expects a Darwin target");
3984 const GlobalValue *GV = cast<GlobalAddressSDNode>(
Op)->getGlobal();
4039 SDValue AArch64TargetLowering::LowerELFTLSDescCallSeq(
SDValue SymAddr,
4055 AArch64TargetLowering::LowerELFGlobalTLSAddress(
SDValue Op,
4059 "ELF TLS only supported in small memory model");
4121 TPOff = LowerELFTLSDescCallSeq(SymAddr, DL, DAG);
4145 TPOff = LowerELFTLSDescCallSeq(SymAddr, DL, DAG);
4153 AArch64TargetLowering::LowerWindowsGlobalTLSAddress(
SDValue Op,
4218 return LowerDarwinGlobalTLSAddress(Op, DAG);
4220 return LowerELFGlobalTLSAddress(Op, DAG);
4222 return LowerWindowsGlobalTLSAddress(Op, DAG);
4366 else if (SrcVT.
bitsGT(VT))
4373 auto setVecVal = [&] (
int Idx) {
4387 EltMask = 0x80000000ULL;
4388 setVecVal(AArch64::ssub);
4397 setVecVal(AArch64::dsub);
4400 EltMask = 0x8000ULL;
4401 setVecVal(AArch64::hsub);
4431 Attribute::NoImplicitFloat))
4466 return LowerVSETCC(Op, DAG);
4486 "Unexpected setcc expansion!");
4595 }
else if (CTVal && CFVal) {
4596 const int64_t TrueVal = CTVal->getSExtValue();
4603 if (TrueVal == ~FalseVal) {
4605 }
else if (TrueVal == -FalseVal) {
4613 const uint32_t TrueVal32 = CTVal->getZExtValue();
4616 if ((TrueVal32 == FalseVal32 + 1) || (TrueVal32 + 1 == FalseVal32)) {
4619 if (TrueVal32 > FalseVal32) {
4624 }
else if ((TrueVal == FalseVal + 1) || (TrueVal + 1 == FalseVal)) {
4627 if (TrueVal > FalseVal) {
4659 else if (CFVal && CFVal == RHSVal && AArch64CC ==
AArch64CC::NE)
4662 assert (CTVal && CFVal &&
"Expected constant operands for CSNEG.");
4676 return DAG.
getNode(Opcode, dl, VT, TVal, FVal, CCVal, Cmp);
4695 if (RHSVal && RHSVal->
isZero()) {
4703 CFVal && CFVal->
isZero() &&
4732 return LowerSELECT_CC(CC, LHS, RHS, TVal, FVal, DL, DAG);
4764 CC = cast<CondCodeSDNode>(CCVal->
getOperand(2))->
get();
4770 return LowerSELECT_CC(CC, LHS, RHS, TVal, FVal, DL, DAG);
4781 return getAddrLarge(JT, DAG);
4783 return getAddr(JT, DAG);
4793 return getGOT(CP, DAG);
4795 return getAddrLarge(CP, DAG);
4797 return getAddr(CP, DAG);
4806 return getAddrLarge(BA, DAG);
4808 return getAddr(BA, DAG);
4914 return LowerWin64_VASTART(Op, DAG);
4916 return LowerDarwin_VASTART(Op, DAG);
4918 return LowerAAPCS_VASTART(Op, DAG);
4926 unsigned VaListSize =
4928 const Value *DestSV = cast<SrcValueSDNode>(Op.
getOperand(3))->getValue();
4929 const Value *SrcSV = cast<SrcValueSDNode>(Op.
getOperand(4))->getValue();
4940 "automatic va_arg instruction only works on Darwin");
4954 assert(((Align & (Align - 1)) == 0) &&
"Expected Align to be a power of 2");
4970 bool NeedFPTrunc =
false;
5006 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
5017 unsigned AArch64TargetLowering::getRegisterByName(
const char* RegName,
EVT VT,
5020 .Case(
"sp", AArch64::SP)
5021 .
Case(
"x18", AArch64::X18)
5022 .
Case(
"w18", AArch64::W18)
5023 .
Case(
"x20", AArch64::X20)
5024 .
Case(
"w20", AArch64::W20)
5026 if (((Reg == AArch64::X18 || Reg == AArch64::W18) &&
5028 ((Reg == AArch64::X20 || Reg == AArch64::W20) &&
5045 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
5047 SDValue FrameAddr = LowerFRAMEADDR(Op, DAG);
5055 unsigned Reg = MF.
addLiveIn(AArch64::LR, &AArch64::GPR64RegClass);
5085 HiBitsForLo, CCVal, Cmp);
5097 SDValue LoForBigShift = DAG.
getNode(Opc, dl, VT, ShOpHi, ExtraShAmt);
5099 LoForNormalShift, CCVal, Cmp);
5103 SDValue HiForNormalShift = DAG.
getNode(Opc, dl, VT, ShOpHi, ShAmt);
5106 ? DAG.
getNode(Opc, dl, VT, ShOpHi,
5110 HiForNormalShift, CCVal, Cmp);
5140 LoBitsForHi, CCVal, Cmp);
5154 HiForNormalShift, CCVal, Cmp);
5161 LoForNormalShift, CCVal, Cmp);
5180 dbgs() <<
"Legal fp imm: materialize 0 using the zero register\n");
5185 bool IsLegal =
false;
5201 LLVM_DEBUG(
dbgs() <<
"Legal " << FPType <<
" imm value: " << ImmStrVal
5206 if (!FPType.
empty())
5207 LLVM_DEBUG(
dbgs() <<
"Illegal " << FPType <<
" imm value: " << ImmStrVal
5211 <<
": unsupported fp type\n");
5228 if (ExtraSteps == TargetLoweringBase::ReciprocalEstimate::Unspecified)
5236 return DAG.
getNode(Opcode,
SDLoc(Operand), VT, Operand);
5246 bool Reciprocal)
const {
5248 (Enabled == ReciprocalEstimate::Unspecified && Subtarget->
useRSqrt()))
5259 for (
int i = ExtraSteps; i > 0; --i) {
5274 VT, Eq, Operand, Estimate);
5286 int &ExtraSteps)
const {
5298 for (
int i = ExtraSteps; i > 0; --i) {
5338 const char *AArch64TargetLowering::LowerXConstraint(
EVT ConstraintVT)
const {
5363 AArch64TargetLowering::getConstraintType(
StringRef Constraint)
const {
5364 if (Constraint.
size() == 1) {
5365 switch (Constraint[0]) {
5388 AArch64TargetLowering::getSingleConstraintMatchWeight(
5389 AsmOperandInfo &
info,
const char *constraint)
const {
5391 Value *CallOperandVal = info.CallOperandVal;
5394 if (!CallOperandVal)
5398 switch (*constraint) {
5414 std::pair<unsigned, const TargetRegisterClass *>
5415 AArch64TargetLowering::getRegForInlineAsmConstraint(
5417 if (Constraint.
size() == 1) {
5418 switch (Constraint[0]) {
5421 return std::make_pair(0U, &AArch64::GPR64commonRegClass);
5422 return std::make_pair(0U, &AArch64::GPR32commonRegClass);
5425 return std::make_pair(0U, &AArch64::FPR16RegClass);
5427 return std::make_pair(0U, &AArch64::FPR32RegClass);
5429 return std::make_pair(0U, &AArch64::FPR64RegClass);
5431 return std::make_pair(0U, &AArch64::FPR128RegClass);
5437 return std::make_pair(0U, &AArch64::FPR128_loRegClass);
5442 return std::make_pair(
unsigned(AArch64::NZCV), &AArch64::CCRRegClass);
5446 std::pair<unsigned, const TargetRegisterClass *> Res;
5452 if ((Size == 4 || Size == 5) && Constraint[0] ==
'{' &&
5453 tolower(Constraint[1]) ==
'v' && Constraint[Size - 1] ==
'}') {
5456 if (!Failed && RegNo >= 0 && RegNo <= 31) {
5461 Res.first = AArch64::FPR64RegClass.getRegister(RegNo);
5462 Res.second = &AArch64::FPR64RegClass;
5464 Res.first = AArch64::FPR128RegClass.getRegister(RegNo);
5465 Res.second = &AArch64::FPR128RegClass;
5476 void AArch64TargetLowering::LowerAsmOperandForConstraint(
5477 SDValue Op, std::string &Constraint, std::vector<SDValue> &Ops,
5482 if (Constraint.length() != 1)
5485 char ConstraintLetter = Constraint[0];
5486 switch (ConstraintLetter) {
5507 GA->getValueType(0));
5509 dyn_cast<BlockAddressSDNode>(Op)) {
5513 dyn_cast<ExternalSymbolSDNode>(Op)) {
5533 switch (ConstraintLetter) {
5541 if (isUInt<12>(CVal) || isShiftedUInt<12, 12>(CVal))
5546 if (isUInt<12>(NVal) || isShiftedUInt<12, 12>(NVal)) {
5578 if ((CVal & 0xFFFF) == CVal)
5580 if ((CVal & 0xFFFF0000ULL) == CVal)
5583 if ((NCVal & 0xFFFFULL) == NCVal)
5585 if ((NCVal & 0xFFFF0000ULL) == NCVal)
5592 if ((CVal & 0xFFFFULL) == CVal)
5594 if ((CVal & 0xFFFF0000ULL) == CVal)
5596 if ((CVal & 0xFFFF00000000ULL) == CVal)
5598 if ((CVal & 0xFFFF000000000000ULL) == CVal)
5600 uint64_t NCVal = ~CVal;
5601 if ((NCVal & 0xFFFFULL) == NCVal)
5603 if ((NCVal & 0xFFFF0000ULL) == NCVal)
5605 if ((NCVal & 0xFFFF00000000ULL) == NCVal)
5607 if ((NCVal & 0xFFFF000000000000ULL) == NCVal)
5621 Ops.push_back(Result);
5669 LLVM_DEBUG(
dbgs() <<
"AArch64TargetLowering::ReconstructShuffle\n");
5674 struct ShuffleSourceInfo {
5689 ShuffleSourceInfo(
SDValue Vec)
5691 ShuffleVec(Vec), WindowBase(0), WindowScale(1) {}
5699 for (
unsigned i = 0; i < NumElts; ++i) {
5706 dbgs() <<
"Reshuffle failed: " 5707 "a shuffle can only come from building a vector from " 5708 "various elements of other vectors, provided their " 5709 "indices are constant\n");
5720 unsigned EltNo = cast<ConstantSDNode>(V.
getOperand(1))->getZExtValue();
5725 if (Sources.
size() > 2) {
5727 dbgs() <<
"Reshuffle failed: currently only do something sane when at " 5728 "most two source vectors are involved\n");
5735 for (
auto &
Source : Sources) {
5736 EVT SrcEltTy =
Source.Vec.getValueType().getVectorElementType();
5737 if (SrcEltTy.
bitsLT(SmallestEltTy)) {
5738 SmallestEltTy = SrcEltTy;
5741 unsigned ResMultiplier =
5749 for (
auto &Src : Sources) {
5750 EVT SrcVT = Src.ShuffleVec.getValueType();
5767 DAG.
getUNDEF(Src.ShuffleVec.getValueType()));
5773 if (Src.MaxElt - Src.MinElt >= NumSrcElts) {
5775 dbgs() <<
"Reshuffle failed: span too large for a VEXT to cope\n");
5779 if (Src.MinElt >= NumSrcElts) {
5784 Src.WindowBase = -NumSrcElts;
5785 }
else if (Src.MaxElt < NumSrcElts) {
5803 Src.WindowBase = -Src.MinElt;
5810 for (
auto &Src : Sources) {
5812 if (SrcEltTy == SmallestEltTy)
5817 Src.WindowBase *= Src.WindowScale;
5823 assert(Src.ShuffleVec.getValueType() == ShuffleVT););
5834 int EltNo = cast<ConstantSDNode>(Entry.
getOperand(1))->getSExtValue();
5842 int LanesDefined = BitsDefined / BitsPerShuffleLane;
5846 int *LaneMask = &
Mask[i * ResMultiplier];
5848 int ExtractBase = EltNo * Src->WindowScale + Src->WindowBase;
5849 ExtractBase += NumElts * (Src - Sources.begin());
5850 for (
int j = 0; j < LanesDefined; ++j)
5851 LaneMask[j] = ExtractBase + j;
5856 LLVM_DEBUG(
dbgs() <<
"Reshuffle failed: illegal shuffle mask\n");
5861 for (
unsigned i = 0; i < Sources.size(); ++i)
5862 ShuffleOps[i] = Sources[i].ShuffleVec;
5865 ShuffleOps[1],
Mask);
5869 dbgs() <<
"Reshuffle, creating node: "; V.
dump(););
5888 unsigned ExpectedElt = Imm;
5889 for (
unsigned i = 1; i < NumElts; ++i) {
5893 if (ExpectedElt == NumElts)
5898 if (ExpectedElt != static_cast<unsigned>(M[i]))
5910 const int *FirstRealElt =
find_if(M, [](
int Elt) {
return Elt >= 0; });
5915 APInt ExpectedElt =
APInt(MaskBits, *FirstRealElt + 1);
5919 [&](
int Elt) {
return Elt != ExpectedElt++ && Elt != -1;});
5920 if (FirstWrongElt != M.
end())
5949 assert((BlockSize == 16 || BlockSize == 32 || BlockSize == 64) &&
5950 "Only possible block sizes for REV are: 16, 32, 64");
5957 unsigned BlockElts = M[0] + 1;
5960 BlockElts = BlockSize / EltSz;
5962 if (BlockSize <= EltSz || BlockSize != BlockElts * EltSz)
5965 for (
unsigned i = 0; i < NumElts; ++i) {
5968 if ((
unsigned)M[i] != (i - i % BlockElts) + (BlockElts - 1 - i % BlockElts))
5977 WhichResult = (M[0] == 0 ? 0 : 1);
5978 unsigned Idx = WhichResult * NumElts / 2;
5979 for (
unsigned i = 0; i != NumElts; i += 2) {
5980 if ((M[i] >= 0 && (
unsigned)M[i] != Idx) ||
5981 (M[i + 1] >= 0 && (
unsigned)M[i + 1] != Idx + NumElts))
5991 WhichResult = (M[0] == 0 ? 0 : 1);
5992 for (
unsigned i = 0; i != NumElts; ++i) {
5995 if ((
unsigned)M[i] != 2 * i + WhichResult)
6004 WhichResult = (M[0] == 0 ? 0 : 1);
6005 for (
unsigned i = 0; i < NumElts; i += 2) {
6006 if ((M[i] >= 0 && (
unsigned)M[i] != i + WhichResult) ||
6007 (M[i + 1] >= 0 && (
unsigned)M[i + 1] != i + NumElts + WhichResult))
6018 WhichResult = (M[0] == 0 ? 0 : 1);
6019 unsigned Idx = WhichResult * NumElts / 2;
6020 for (
unsigned i = 0; i != NumElts; i += 2) {
6021 if ((M[i] >= 0 && (
unsigned)M[i] != Idx) ||
6022 (M[i + 1] >= 0 && (
unsigned)M[i + 1] != Idx))
6035 WhichResult = (M[0] == 0 ? 0 : 1);
6036 for (
unsigned j = 0; j != 2; ++j) {
6037 unsigned Idx = WhichResult;
6038 for (
unsigned i = 0; i != Half; ++i) {
6039 int MIdx = M[i + j * Half];
6040 if (MIdx >= 0 && (
unsigned)MIdx != Idx)
6054 WhichResult = (M[0] == 0 ? 0 : 1);
6055 for (
unsigned i = 0; i < NumElts; i += 2) {
6056 if ((M[i] >= 0 && (
unsigned)M[i] != i + WhichResult) ||
6057 (M[i + 1] >= 0 && (
unsigned)M[i + 1] != i + WhichResult))
6064 bool &DstIsLeft,
int &Anomaly) {
6065 if (M.
size() !=
static_cast<size_t>(NumInputElements))
6068 int NumLHSMatch = 0, NumRHSMatch = 0;
6069 int LastLHSMismatch = -1, LastRHSMismatch = -1;
6071 for (
int i = 0; i < NumInputElements; ++i) {
6081 LastLHSMismatch = i;
6083 if (M[i] == i + NumInputElements)
6086 LastRHSMismatch = i;
6089 if (NumLHSMatch == NumInputElements - 1) {
6091 Anomaly = LastLHSMismatch;
6093 }
else if (NumRHSMatch == NumInputElements - 1) {
6095 Anomaly = LastRHSMismatch;
6108 for (
int I = 0,
E = NumElts / 2;
I !=
E;
I++) {
6113 int Offset = NumElts / 2;
6114 for (
int I = NumElts / 2,
E = NumElts;
I !=
E;
I++) {
6115 if (Mask[
I] !=
I + SplitLHS * Offset)
6156 unsigned OpNum = (PFEntry >> 26) & 0x0F;
6157 unsigned LHSID = (PFEntry >> 13) & ((1 << 13) - 1);
6158 unsigned RHSID = (PFEntry >> 0) & ((1 << 13) - 1);
6178 if (OpNum == OP_COPY) {
6179 if (LHSID == (1 * 9 + 2) * 9 + 3)
6181 assert(LHSID == ((4 * 9 + 5) * 9 + 6) * 9 + 7 &&
"Illegal OP_COPY!");
6225 return DAG.
getNode(Opcode, dl, VT, OpLHS, Lane);
6230 unsigned Imm = (OpNum - OP_VEXT1 + 1) *
getExtFactor(OpLHS);
6266 for (
int Val : ShuffleMask) {
6267 for (
unsigned Byte = 0; Byte < BytesPerElt; ++Byte) {
6268 unsigned Offset = Byte + Val * BytesPerElt;
6274 unsigned IndexLen = 8;
6293 if (IndexLen == 8) {
6368 Lane += cast<ConstantSDNode>(V1.
getOperand(1))->getZExtValue();
6387 bool ReverseEXT =
false;
6389 if (
isEXTMask(ShuffleMask, VT, ReverseEXT, Imm)) {
6401 unsigned WhichResult;
6402 if (
isZIPMask(ShuffleMask, VT, WhichResult)) {
6406 if (
isUZPMask(ShuffleMask, VT, WhichResult)) {
6410 if (
isTRNMask(ShuffleMask, VT, WhichResult)) {
6434 if (
isINSMask(ShuffleMask, NumInputElements, DstIsLeft, Anomaly)) {
6439 int SrcLane = ShuffleMask[Anomaly];
6440 if (SrcLane >= NumInputElements) {
6461 unsigned PFIndexes[4];
6462 for (
unsigned i = 0; i != 4; ++i) {
6463 if (ShuffleMask[i] < 0)
6466 PFIndexes[i] = ShuffleMask[i];
6470 unsigned PFTableIndex = PFIndexes[0] * 9 * 9 * 9 + PFIndexes[1] * 9 * 9 +
6471 PFIndexes[2] * 9 + PFIndexes[3];
6473 unsigned Cost = (PFEntry >> 30);
6485 APInt SplatBits, SplatUndef;
6486 unsigned SplatBitSize;
6488 if (BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
6491 for (
unsigned i = 0; i < NumSplats; ++i) {
6492 CnstBits <<= SplatBitSize;
6493 UndefBits <<= SplatBitSize;
6495 UndefBits |= (SplatBits ^ SplatUndef).zextOrTrunc(VT.
getSizeInBits());
6528 const SDValue *LHS =
nullptr) {
6533 bool isAdvSIMDModImm =
false;
6553 if (isAdvSIMDModImm) {
6558 Mov = DAG.
getNode(NewOp, dl, MovTy, *LHS,
6562 Mov = DAG.
getNode(NewOp, dl, MovTy,
6576 const SDValue *LHS =
nullptr) {
6581 bool isAdvSIMDModImm =
false;
6593 if (isAdvSIMDModImm) {
6598 Mov = DAG.
getNode(NewOp, dl, MovTy, *LHS,
6602 Mov = DAG.
getNode(NewOp, dl, MovTy,
6620 bool isAdvSIMDModImm =
false;
6632 if (isAdvSIMDModImm) {
6673 bool isAdvSIMDModImm =
false;
6685 if (isAdvSIMDModImm) {
6724 UndefBits = ~UndefBits;
6726 UndefBits, &LHS)) ||
6740 uint64_t &ConstVal) {
6749 for (
unsigned i = 1; i < NumElts; ++i)
6750 if (dyn_cast<ConstantSDNode>(Bvec->
getOperand(i)) != FirstElt)
6762 unsigned IID = cast<ConstantSDNode>(N->
getOperand(0))->getZExtValue();
6810 if (C2 > ElemSizeInBits)
6812 unsigned ElemMask = (1 << ElemSizeInBits) - 1;
6813 if ((C1 & ElemMask) != (~C2 & ElemMask))
6820 IsShiftRight ? Intrinsic::aarch64_neon_vsri : Intrinsic::aarch64_neon_vsli;
6868 UndefBits, &LHS)) ||
6892 if (
auto *CstLane = dyn_cast<ConstantSDNode>(Lane)) {
6894 CstLane->getZExtValue());
6924 DefBits = UndefBits;
6933 DefBits = ~UndefBits;
6959 Const->getAPIntValue().zextOrTrunc(BitSize).getZExtValue());
6960 if (Val.isNullValue() || Val.isAllOnesValue())
6982 bool isOnlyLowElement =
true;
6983 bool usesOnlyOneValue =
true;
6984 bool usesOnlyOneConstantValue =
true;
6986 bool AllLanesExtractElt =
true;
6987 unsigned NumConstantLanes = 0;
6990 for (
unsigned i = 0; i < NumElts; ++i) {
6993 AllLanesExtractElt =
false;
6997 isOnlyLowElement =
false;
6998 if (!isa<ConstantFPSDNode>(V) && !isa<ConstantSDNode>(V))
7001 if (isa<ConstantSDNode>(V) || isa<ConstantFPSDNode>(V)) {
7005 else if (ConstantValue != V)
7006 usesOnlyOneConstantValue =
false;
7011 else if (V != Value)
7012 usesOnlyOneValue =
false;
7017 dbgs() <<
"LowerBUILD_VECTOR: value undefined, creating undef node\n");
7021 if (isOnlyLowElement) {
7022 LLVM_DEBUG(
dbgs() <<
"LowerBUILD_VECTOR: only low element used, creating 1 " 7023 "SCALAR_TO_VECTOR node\n");
7027 if (AllLanesExtractElt) {
7028 SDNode *Vector =
nullptr;
7033 for (
unsigned i = 0; i < NumElts; ++i) {
7048 }
else if (Vector != N0.
getNode()) {
7061 if (Val - 1 == 2 * i) {
7090 if (usesOnlyOneValue) {
7095 dbgs() <<
"LowerBUILD_VECTOR: use DUP for non-constant splats\n");
7105 dbgs() <<
"LowerBUILD_VECTOR: DUPLANE works on 128-bit vectors, " 7111 return DAG.
getNode(Opcode, dl, VT, Value, Lane);
7118 "Unsupported floating-point vector type");
7120 dbgs() <<
"LowerBUILD_VECTOR: float constant splats, creating int " 7121 "BITCASTS, and try again\n");
7123 for (
unsigned i = 0; i < NumElts; ++i)
7127 LLVM_DEBUG(
dbgs() <<
"LowerBUILD_VECTOR: trying to lower new vector: ";
7129 Val = LowerBUILD_VECTOR(Val, DAG);
7139 if (NumConstantLanes > 0 && usesOnlyOneConstantValue) {
7150 for (
unsigned i = 0; i < NumElts; ++i) {
7153 if (!isa<ConstantSDNode>(V) && !isa<ConstantFPSDNode>(V))
7164 dbgs() <<
"LowerBUILD_VECTOR: all elements are constant, use default " 7181 if (!isConstant && !usesOnlyOneValue) {
7183 dbgs() <<
"LowerBUILD_VECTOR: alternatives failed, creating sequence " 7184 "of INSERT_VECTOR_ELT\n");
7201 LLVM_DEBUG(
dbgs() <<
"Creating node for op0, it is not undefined:\n");
7206 <<
"Creating nodes for the other vector elements:\n";);
7207 for (; i < NumElts; ++i) {
7218 dbgs() <<
"LowerBUILD_VECTOR: use default expansion, failed to find " 7219 "better alternative\n");
7223 SDValue AArch64TargetLowering::LowerINSERT_VECTOR_ELT(
SDValue Op,
7230 if (!CI || CI->
getZExtValue() >= VT.getVectorNumElements())
7257 AArch64TargetLowering::LowerEXTRACT_VECTOR_ELT(
SDValue Op,
7264 if (!CI || CI->
getZExtValue() >= VT.getVectorNumElements())
7293 SDValue AArch64TargetLowering::LowerEXTRACT_SUBVECTOR(
SDValue Op,
7323 unsigned PFIndexes[4];
7324 for (
unsigned i = 0; i != 4; ++i) {
7328 PFIndexes[i] = M[i];
7332 unsigned PFTableIndex = PFIndexes[0] * 9 * 9 * 9 + PFIndexes[1] * 9 * 9 +
7333 PFIndexes[2] * 9 + PFIndexes[3];
7335 unsigned Cost = (PFEntry >> 30);
7343 unsigned DummyUnsigned;
7347 isEXTMask(M, VT, DummyBool, DummyUnsigned) ||
7366 APInt SplatBits, SplatUndef;
7367 unsigned SplatBitSize;
7369 if (!BVN || !BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize,
7370 HasAnyUndefs, ElementBits) ||
7371 SplatBitSize > ElementBits)
7382 assert(VT.
isVector() &&
"vector shift count is not a vector type");
7386 return (Cnt >= 0 && (isLong ? Cnt - 1 : Cnt) < ElementBits);
7393 assert(VT.
isVector() &&
"vector shift count is not a vector type");
7397 return (Cnt >= 1 && Cnt <= (isNarrow ? ElementBits / 2 : ElementBits));
7400 SDValue AArch64TargetLowering::LowerVectorSRA_SRL_SHL(
SDValue Op,
7436 : Intrinsic::aarch64_neon_ushl;
7443 return NegShiftLeft;
7454 "function only supposed to emit natural comparisons");
7460 bool IsZero = IsCnst && (CnstBits == 0);
7560 const bool FullFP16 =
7652 if (!Subtarget.hasLSE())
7669 if (!Subtarget.hasLSE())
7683 SDValue AArch64TargetLowering::LowerWindowsDYNAMIC_STACKALLOC(
7690 Subtarget->getRegisterInfo()->getWindowsStackProbePreservedMask();
7710 AArch64TargetLowering::LowerDYNAMIC_STACKALLOC(
SDValue Op,
7712 assert(Subtarget->isTargetWindows() &&
7713 "Only Windows alloca probing supported");
7719 unsigned Align = cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue();
7723 "no-stack-arg-probe")) {
7737 Chain = LowerWindowsDYNAMIC_STACKALLOC(Op, Chain, Size, DAG);
7760 unsigned Intrinsic)
const {
7762 switch (Intrinsic) {
7763 case Intrinsic::aarch64_neon_ld2:
7764 case Intrinsic::aarch64_neon_ld3:
7765 case Intrinsic::aarch64_neon_ld4:
7766 case Intrinsic::aarch64_neon_ld1x2:
7767 case Intrinsic::aarch64_neon_ld1x3:
7768 case Intrinsic::aarch64_neon_ld1x4:
7769 case Intrinsic::aarch64_neon_ld2lane:
7770 case Intrinsic::aarch64_neon_ld3lane:
7771 case Intrinsic::aarch64_neon_ld4lane:
7772 case Intrinsic::aarch64_neon_ld2r:
7773 case Intrinsic::aarch64_neon_ld3r:
7774 case Intrinsic::aarch64_neon_ld4r: {
7777 uint64_t NumElts = DL.getTypeSizeInBits(I.
getType()) / 64;
7786 case Intrinsic::aarch64_neon_st2:
7787 case Intrinsic::aarch64_neon_st3:
7788 case Intrinsic::aarch64_neon_st4:
7789 case Intrinsic::aarch64_neon_st1x2:
7790 case Intrinsic::aarch64_neon_st1x3:
7791 case Intrinsic::aarch64_neon_st1x4:
7792 case Intrinsic::aarch64_neon_st2lane:
7793 case Intrinsic::aarch64_neon_st3lane:
7794 case Intrinsic::aarch64_neon_st4lane: {
7797 unsigned NumElts = 0;
7802 NumElts += DL.getTypeSizeInBits(ArgTy) / 64;
7812 case Intrinsic::aarch64_ldaxr:
7813 case Intrinsic::aarch64_ldxr: {
7823 case Intrinsic::aarch64_stlxr:
7824 case Intrinsic::aarch64_stxr: {
7834 case Intrinsic::aarch64_ldaxp:
7835 case Intrinsic::aarch64_ldxp:
7843 case Intrinsic::aarch64_stlxp:
7844 case Intrinsic::aarch64_stxp:
7879 if (ShiftAmount ==
Log2_32(LoadBytes))
7892 return NumBits1 > NumBits2;
7899 return NumBits1 > NumBits2;
7906 if (I->
getOpcode() != Instruction::FMul)
7915 !(User->
getOpcode() == Instruction::FSub ||
7916 User->
getOpcode() == Instruction::FAdd))
7936 return NumBits1 == 32 && NumBits2 == 64;
7943 return NumBits1 == 32 && NumBits2 == 64;
7961 bool AArch64TargetLowering::isExtFreeImpl(
const Instruction *
Ext)
const {
7962 if (isa<FPExtInst>(Ext))
7969 for (
const Use &U : Ext->
uses()) {
7974 const Instruction *Instr = cast<Instruction>(U.getUser());
7978 case Instruction::Shl:
7982 case Instruction::GetElementPtr: {
7985 std::advance(GTI, U.getOperandNo()-1);
7995 if (ShiftAmt == 0 || ShiftAmt > 4)
7999 case Instruction::Trunc:
8016 unsigned &RequiredAligment)
const {
8021 RequiredAligment = 0;
8023 return NumBits == 32 || NumBits == 64;
8053 if (ElSize != 8 && ElSize != 16 && ElSize != 32 && ElSize != 64)
8058 return VecSize == 64 || VecSize % 128 == 0;
8076 "Invalid interleave factor");
8077 assert(!Shuffles.
empty() &&
"Empty shufflevector input");
8079 "Unmatched number of shufflevectors and indices");
8120 Type *Tys[2] = {VecTy, PtrTy};
8121 static const Intrinsic::ID LoadInts[3] = {Intrinsic::aarch64_neon_ld2,
8122 Intrinsic::aarch64_neon_ld3,
8123 Intrinsic::aarch64_neon_ld4};
8132 for (
unsigned LoadCount = 0; LoadCount < NumLoads; ++LoadCount) {
8144 for (
unsigned i = 0; i < Shuffles.
size(); i++) {
8146 unsigned Index = Indices[i];
8155 SubVecs[SVI].push_back(SubVec);
8164 auto &SubVec = SubVecs[SVI];
8167 SVI->replaceAllUsesWith(WideVec);
8201 unsigned Factor)
const {
8203 "Invalid interleave factor");
8207 "Invalid interleaved store");
8244 if (NumStores > 1) {
8247 LaneLen /= NumStores;
8261 Type *Tys[2] = {SubVecTy, PtrTy};
8262 static const Intrinsic::ID StoreInts[3] = {Intrinsic::aarch64_neon_st2,
8263 Intrinsic::aarch64_neon_st3,
8264 Intrinsic::aarch64_neon_st4};
8268 for (
unsigned StoreCount = 0; StoreCount < NumStores; ++StoreCount) {
8273 for (
unsigned i = 0; i < Factor; i++) {
8274 unsigned IdxI = StoreCount * LaneLen * Factor + i;
8275 if (
Mask[IdxI] >= 0) {
8279 unsigned StartMask = 0;
8280 for (
unsigned j = 1; j < LaneLen; j++) {
8281 unsigned IdxJ = StoreCount * LaneLen * Factor + j;
8282 if (
Mask[IdxJ * Factor + IdxI] >= 0) {
8283 StartMask =
Mask[IdxJ * Factor + IdxI] - IdxJ;
8309 unsigned AlignCheck) {
8310 return ((SrcAlign == 0 || SrcAlign % AlignCheck == 0) &&
8311 (DstAlign == 0 || DstAlign % AlignCheck == 0));
8315 unsigned SrcAlign,
bool IsMemset,
8324 if (Subtarget->hasFPARMv8() && !IsMemset && Size >= 16 &&
8345 if (Immed == std::numeric_limits<int64_t>::min()) {
8347 <<
": avoid UB for INT64_MIN\n");
8352 bool IsLegal = ((Immed >> 12) == 0 ||
8353 ((Immed & 0xfff) == 0 && Immed >> 24 == 0));
8355 <<
" legal add imm: " << (IsLegal ?
"yes" :
"no") <<
"\n");
8387 uint64_t NumBytes = 0;
8390 NumBytes = NumBits / 8;
8399 if (isInt<9>(Offset))
8403 unsigned shift =
Log2_64(NumBytes);
8404 if (NumBytes && Offset > 0 && (Offset / NumBytes) <= (1LL << 12) - 1 &&
8406 (Offset >> shift) << shift == Offset)
8413 return AM.
Scale == 1 || (AM.
Scale > 0 && (uint64_t)AM.
Scale == NumBytes);
8423 unsigned AS)
const {
8460 static const MCPhysReg ScratchRegs[] = {
8461 AArch64::X16, AArch64::X17, AArch64::LR, 0
8494 if ((int64_t)Val < 0)
8497 Val &= (1LL << 32) - 1;
8500 unsigned Shift = (63 - LZ) / 16;
8506 unsigned Index)
const {
8534 if (!ShiftAmt || ShiftAmt->getZExtValue() != ShiftEltTy.getSizeInBits() - 1)
8581 AArch64TargetLowering::BuildSDIVPow2(
SDNode *N,
const APInt &Divisor,
8591 !(Divisor.
isPowerOf2() || (-Divisor).isPowerOf2()))
8649 unsigned TrailingZeroes = ConstValue.countTrailingZeros();
8650 if (TrailingZeroes) {
8664 APInt ShiftedConstValue = ConstValue.
ashr(TrailingZeroes);
8666 unsigned ShiftAmt, AddSubOpc;
8668 bool ShiftValUseIsN0 =
true;
8670 bool NegateResult =
false;
8672 if (ConstValue.isNonNegative()) {
8676 APInt SCVMinus1 = ShiftedConstValue - 1;
8677 APInt CVPlus1 = ConstValue + 1;
8689 APInt CVNegPlus1 = -ConstValue + 1;
8690 APInt CVNegMinus1 = -ConstValue - 1;
8694 ShiftValUseIsN0 =
false;
8698 NegateResult =
true;
8708 SDValue AddSubN0 = ShiftValUseIsN0 ? ShiftedVal : N0;
8709 SDValue AddSubN1 = ShiftValUseIsN0 ? N0 : ShiftedVal;
8710 SDValue Res = DAG.
getNode(AddSubOpc, DL, VT, AddSubN0, AddSubN1);
8711 assert(!(NegateResult && TrailingZeroes) &&
8712 "NegateResult and TrailingZeroes cannot both be true for now.");
8749 if (!BV->isConstant())
8754 EVT IntVT = BV->getValueType(0);
8822 if (!isa<BuildVectorSDNode>(ConstVec))
8827 if (FloatBits != 32 && FloatBits != 64)
8832 if (IntBits != 16 && IntBits != 32 && IntBits != 64)
8836 if (IntBits > FloatBits)
8841 int32_t
Bits = IntBits == 64 ? 64 : 32;
8843 if (C == -1 || C == 0 || C > Bits)
8863 "Illegal vector type after legalization");
8867 unsigned IntrinsicOpcode = IsSigned ? Intrinsic::aarch64_neon_vcvtfp2fxs
8868 : Intrinsic::aarch64_neon_vcvtfp2fxu;
8874 if (IntBits < FloatBits)
8896 if (!isa<BuildVectorSDNode>(ConstVec))
8901 if (IntBits != 16 && IntBits != 32 && IntBits != 64)
8906 if (FloatBits != 32 && FloatBits != 64)
8910 if (IntBits > FloatBits)
8916 if (C == -1 || C == 0 || C > FloatBits)
8938 if (IntBits < FloatBits)
8942 unsigned IntrinsicOpcode = IsSigned ? Intrinsic::aarch64_neon_vcvtfxs2fp
8943 : Intrinsic::aarch64_neon_vcvtfxu2fp;
8986 bool LHSFromHi =
false;
8992 bool RHSFromHi =
false;
8998 if (LHSFromHi == RHSFromHi)
9033 uint64_t BitMask = Bits == 64 ? -1ULL : ((1ULL <<
Bits) - 1);
9034 for (
int i = 1; i >= 0; --i)
9035 for (
int j = 1; j >= 0; --j) {
9041 bool FoundMatch =
true;
9046 CN0->
getZExtValue() != (BitMask & ~CN1->getZExtValue())) {
9094 uint64_t ShiftAmt =
C->getZExtValue();
9095 if (VT ==
MVT::i32 && ShiftAmt == 16 &&
9098 if (VT ==
MVT::i64 && ShiftAmt == 32 &&
9135 uint64_t idx = cast<ConstantSDNode>(Op0->
getOperand(1))->getZExtValue();
9140 if (idx != AArch64::dsub)
9157 dbgs() <<
"aarch64-lower: bitcast extract_subvector simplification\n");
9204 for (
size_t i = 0; i <
Mask.size(); ++i)
9246 dbgs() <<
"aarch64-lower: concat_vectors bitcast simplification\n");
9288 "unexpected vector size on extract_vector_elt!");
9414 cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue());
9423 if (!TValue || !FValue)
9427 if (!TValue->
isOne()) {
9433 return TValue->
isOne() && FValue->isNullValue();
9559 "unexpected shape for long operation");
9582 int64_t ShiftAmount;
9584 APInt SplatValue, SplatUndef;
9585 unsigned SplatBitSize;
9587 if (!BVN->isConstantSplat(SplatValue, SplatUndef, SplatBitSize,
9588 HasAnyUndefs, ElemBits) ||
9589 SplatBitSize != ElemBits)
9594 ShiftAmount = CVN->getSExtValue();
9603 case Intrinsic::aarch64_neon_sqshl:
9605 IsRightShift =
false;
9607 case Intrinsic::aarch64_neon_uqshl:
9609 IsRightShift =
false;
9611 case Intrinsic::aarch64_neon_srshl:
9613 IsRightShift =
true;
9615 case Intrinsic::aarch64_neon_urshl:
9617 IsRightShift =
true;
9619 case Intrinsic::aarch64_neon_sqshlu:
9621 IsRightShift =
false;
9625 if (IsRightShift && ShiftAmount <= -1 && ShiftAmount >= -(
int)ElemBits) {
9629 }
else if (!IsRightShift && ShiftAmount >= 0 && ShiftAmount < ElemBits) {
9672 case Intrinsic::aarch64_neon_vcvtfxs2fp:
9673 case Intrinsic::aarch64_neon_vcvtfxu2fp:
9675 case Intrinsic::aarch64_neon_saddv:
9677 case Intrinsic::aarch64_neon_uaddv:
9679 case Intrinsic::aarch64_neon_sminv:
9681 case Intrinsic::aarch64_neon_uminv:
9683 case Intrinsic::aarch64_neon_smaxv:
9685 case Intrinsic::aarch64_neon_umaxv:
9687 case Intrinsic::aarch64_neon_fmax:
9690 case Intrinsic::aarch64_neon_fmin:
9693 case Intrinsic::aarch64_neon_fmaxnm:
9696 case Intrinsic::aarch64_neon_fminnm:
9699 case Intrinsic::aarch64_neon_smull:
9700 case Intrinsic::aarch64_neon_umull:
9701 case Intrinsic::aarch64_neon_pmull:
9702 case Intrinsic::aarch64_neon_sqdmull:
9704 case Intrinsic::aarch64_neon_sqshl:
9705 case Intrinsic::aarch64_neon_uqshl:
9706 case Intrinsic::aarch64_neon_sqshlu:
9707 case Intrinsic::aarch64_neon_srshl:
9708 case Intrinsic::aarch64_neon_urshl:
9710 case Intrinsic::aarch64_crc32b:
9711 case Intrinsic::aarch64_crc32cb:
9713 case Intrinsic::aarch64_crc32h:
9714 case Intrinsic::aarch64_crc32ch:
9731 if (IID == Intrinsic::aarch64_neon_sabd ||
9732 IID == Intrinsic::aarch64_neon_uabd) {
9800 assert(!(NumElements & 1) &&
"Splitting vector, but not in half!");
9819 SDValue SplatVal,
unsigned NumVecElts) {
9829 uint64_t BaseOffset = 0;
9837 if (BasePtr->getOpcode() ==
ISD::ADD &&
9838 isa<ConstantSDNode>(BasePtr->getOperand(1))) {
9839 BaseOffset = cast<ConstantSDNode>(BasePtr->getOperand(1))->getSExtValue();
9840 BasePtr = BasePtr->getOperand(0);
9843 unsigned Offset = EltOffset;
9844 while (--NumVecElts) {
9845 unsigned Alignment =
MinAlign(OrigAlignment, Offset);
9850 PtrInfo.getWithOffset(Offset), Alignment,
9852 Offset += EltOffset;
9879 if (!(((NumVecElts == 2 || NumVecElts == 3) &&
9881 ((NumVecElts == 2 || NumVecElts == 3 || NumVecElts == 4) &&
9898 if (Offset < -512 || Offset > 504)
9902 for (
int I = 0;
I < NumVecElts; ++
I) {
9914 ZeroReg = AArch64::WZR;
9917 ZeroReg = AArch64::XZR;
9941 if (NumVecElts != 4 && NumVecElts != 2)
9947 std::bitset<4> IndexNotInserted((1 << NumVecElts) - 1);
9949 for (
unsigned I = 0;
I < NumVecElts; ++
I) {
9965 if (IndexVal >= NumVecElts)
9967 IndexNotInserted.reset(IndexVal);
9972 if (IndexNotInserted.any())
9995 return ReplacedZeroSplat;
10026 return ReplacedSplat;
10059 unsigned LoadIdx = IsLaneOp ? 1 : 0;
10084 if (UI.getUse().getResNo() == 1)
10097 || UI.getUse().getResNo() != Addr.
getResNo())
10112 uint32_t IncVal = CInc->getZExtValue();
10114 if (IncVal != NumBytes)
10166 if (TLI.SimplifyDemandedBits(Addr, DemandedMask, Known, TLO)) {
10204 UI.getUse().getResNo() != Addr.
getResNo())
10213 bool IsStore =
false;
10214 bool IsLaneOp =
false;
10215 bool IsDupOp =
false;
10216 unsigned NewOpc = 0;
10217 unsigned NumVecs = 0;
10218 unsigned IntNo = cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue();
10222 NumVecs = 2;
break;
10224 NumVecs = 3;
break;
10226 NumVecs = 4;
break;
10228 NumVecs = 2; IsStore =
true;
break;
10230 NumVecs = 3; IsStore =
true;
break;
10232 NumVecs = 4; IsStore =
true;
break;
10234 NumVecs = 2;
break;
10236 NumVecs = 3;
break;
10238 NumVecs = 4;
break;
10240 NumVecs = 2; IsStore =
true;
break;
10242 NumVecs = 3; IsStore =
true;
break;
10244 NumVecs = 4; IsStore =
true;
break;
10246 NumVecs = 2; IsDupOp =
true;
break;
10248 NumVecs = 3; IsDupOp =
true;
break;
10250 NumVecs = 4; IsDupOp =
true;
break;
10252 NumVecs = 2; IsLaneOp =
true;
break;
10254 NumVecs = 3; IsLaneOp =
true;
break;
10256 NumVecs = 4; IsLaneOp =
true;
break;
10258 NumVecs = 2; IsStore =
true; IsLaneOp =
true;
break;
10260 NumVecs = 3; IsStore =
true; IsLaneOp =
true;
break;
10262 NumVecs = 4; IsStore =
true; IsLaneOp =
true;
break;
10274 uint32_t IncVal = CInc->getZExtValue();
10276 if (IsLaneOp || IsDupOp)
10278 if (IncVal != NumBytes)
10285 if (IsLaneOp || IsStore)
10286 for (
unsigned i = 2; i < AddrOpIdx; ++i)
10293 unsigned NumResultVecs = (IsStore ? 0 : NumVecs);
10295 for (n = 0; n < NumResultVecs; ++n)
10307 std::vector<SDValue> NewResults;
10308 for (
unsigned i = 0; i < NumResultVecs; ++i) {
10309 NewResults.push_back(
SDValue(UpdN.getNode(), i));
10311 NewResults.push_back(
SDValue(UpdN.getNode(), NumResultVecs + 1));
10358 1LL << (width - 1);
10428 int CompConstant) {
10432 int MaxUInt = (1 << width);
10440 AddConstant -= (1 << (width-1));
10445 if ((AddConstant == 0) ||
10446 (CompConstant == MaxUInt - 1 && AddConstant < 0) ||
10447 (AddConstant >= 0 && CompConstant < 0) ||
10448 (AddConstant <= 0 && CompConstant <= 0 && CompConstant < AddConstant))
10453 if ((AddConstant == 0) ||
10454 (AddConstant >= 0 && CompConstant <= 0) ||
10455 (AddConstant <= 0 && CompConstant <= 0 && CompConstant <= AddConstant))
10460 if ((AddConstant >= 0 && CompConstant < 0) ||
10461 (AddConstant <= 0 && CompConstant >= -1 &&
10462 CompConstant < AddConstant + MaxUInt))
10467 if ((AddConstant == 0) ||
10468 (AddConstant > 0 && CompConstant <= 0) ||
10469 (AddConstant < 0 && CompConstant <= AddConstant))
10474 if ((AddConstant >= 0 && CompConstant <= 0) ||
10475 (AddConstant <= 0 && CompConstant >= 0 &&
10476 CompConstant <= AddConstant + MaxUInt))
10481 if ((AddConstant > 0 && CompConstant < 0) ||
10482 (AddConstant < 0 && CompConstant >= 0 &&
10483 CompConstant < AddConstant + MaxUInt) ||
10484 (AddConstant >= 0 && CompConstant >= 0 &&
10485 CompConstant >= AddConstant) ||
10486 (AddConstant <= 0 && CompConstant < 0 && CompConstant < AddConstant))
10505 unsigned CmpIndex) {
10506 unsigned CC = cast<ConstantSDNode>(N->
getOperand(CCIndex))->getSExtValue();
10508 unsigned CondOpcode = SubsNode->
getOpcode();
10517 unsigned MaskBits = 0;
10523 uint32_t CNV = CN->getZExtValue();
10526 else if (CNV == 65535)
10547 if (!isa<ConstantSDNode>(AddInputValue2.
getNode()) ||
10548 !isa<ConstantSDNode>(SubsInputValue.
getNode()))
10559 cast<ConstantSDNode>(AddInputValue2.
getNode())->getSExtValue(),
10560 cast<ConstantSDNode>(SubsInputValue.
getNode())->getSExtValue()))
10586 assert(isa<ConstantSDNode>(CCVal) &&
"Expected a ConstantSDNode here!");
10587 unsigned CC = cast<ConstantSDNode>(CCVal)->getZExtValue();
10604 "Expected the value type to be the same for both operands!");
10665 if ((
C->getZExtValue() >>
Bit) & 1)
10671 if (
C->getZExtValue() <= Bit &&
10672 (Bit -
C->getZExtValue()) < Op->getValueType(0).getSizeInBits()) {
10673 Bit = Bit -
C->getZExtValue();
10680 Bit = Bit +
C->getZExtValue();
10681 if (Bit >= Op->getValueType(0).getSizeInBits())
10682 Bit = Op->getValueType(0).getSizeInBits() - 1;
10687 if ((Bit +
C->getZExtValue()) < Op->getValueType(0).getSizeInBits()) {
10688 Bit = Bit +
C->getZExtValue();
10695 if ((
C->getZExtValue() >>
Bit) & 1)
10705 unsigned Bit = cast<ConstantSDNode>(N->
getOperand(2))->getZExtValue();
10706 bool Invert =
false;
10710 if (TestSrc == NewTestSrc)
10753 cast<CondCodeSDNode>(N0.
getOperand(2))->
get());
10775 "Scalar-SETCC feeding SELECT has unexpected result type!");
10788 if (!ResVT.
isVector() || NumMaskElts == 0)
10841 uint64_t MinOffset = -1ull;
10850 MinOffset = std::min(MinOffset,
C->getZExtValue());
10852 uint64_t
Offset = MinOffset + GN->getOffset();
10857 if (Offset <= uint64_t(GN->getOffset()))
10868 if (Offset >= (1 << 21))
10944 switch (cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue()) {
10945 case Intrinsic::aarch64_neon_ld2:
10946 case Intrinsic::aarch64_neon_ld3:
10947 case Intrinsic::aarch64_neon_ld4:
10948 case Intrinsic::aarch64_neon_ld1x2:
10949 case Intrinsic::aarch64_neon_ld1x3:
10950 case Intrinsic::aarch64_neon_ld1x4:
10951 case Intrinsic::aarch64_neon_ld2lane:
10952 case Intrinsic::aarch64_neon_ld3lane:
10953 case Intrinsic::aarch64_neon_ld4lane:
10954 case Intrinsic::aarch64_neon_ld2r:
10955 case Intrinsic::aarch64_neon_ld3r:
10956 case Intrinsic::aarch64_neon_ld4r:
10957 case Intrinsic::aarch64_neon_st2:
10958 case Intrinsic::aarch64_neon_st3:
10959 case Intrinsic::aarch64_neon_st4:
10960 case Intrinsic::aarch64_neon_st1x2:
10961 case Intrinsic::aarch64_neon_st1x3:
10962 case Intrinsic::aarch64_neon_st1x4:
10963 case Intrinsic::aarch64_neon_st2lane:
10964 case Intrinsic::aarch64_neon_st3lane:
10965 case Intrinsic::aarch64_neon_st4lane:
10980 bool AArch64TargetLowering::isUsedByReturnOnly(
SDNode *N,
10999 bool HasRet =
false;
11017 bool AArch64TargetLowering::mayBeEmittedAsTailCall(
const CallInst *CI)
const {
11033 int64_t RHSC = RHS->getSExtValue();
11035 RHSC = -(uint64_t)RHSC;
11036 if (!isInt<9>(RHSC))
11045 bool AArch64TargetLowering::getPreIndexedAddressParts(
SDNode *N,
SDValue &Base,
11052 VT =
LD->getMemoryVT();
11053 Ptr =
LD->getBasePtr();
11055 VT =
ST->getMemoryVT();
11056 Ptr =
ST->getBasePtr();
11061 if (!getIndexedAddressParts(Ptr.
getNode(), Base,
Offset, AM, IsInc, DAG))
11067 bool AArch64TargetLowering::getPostIndexedAddressParts(
11073 VT =
LD->getMemoryVT();
11074 Ptr =
LD->getBasePtr();
11076 VT =
ST->getMemoryVT();
11077 Ptr =
ST->getBasePtr();
11082 if (!getIndexedAddressParts(Op, Base, Offset, AM, IsInc, DAG))
11112 unsigned AcrossOp) {
11129 return std::make_pair(Lo, Hi);
11145 const SDValue Ops[] = { RegClass, VLo, SubReg0, VHi, SubReg1 };
11155 "AtomicCmpSwap on types less than 128 should be legal");
11157 if (Subtarget->
hasLSE()) {
11169 MemOp[0] = cast<MemSDNode>(
N)->getMemOperand();
11172 switch (MemOp[0]->getOrdering()) {
11174 Opcode = AArch64::CASPX;
11177 Opcode = AArch64::CASPAX;
11180 Opcode = AArch64::CASPLX;
11184 Opcode = AArch64::CASPALX;
11194 unsigned SubReg1 = AArch64::sube64, SubReg2 = AArch64::subo64;
11210 AArch64::CMP_SWAP_128,
SDLoc(N),
11215 MemOp[0] = cast<MemSDNode>(
N)->getMemOperand();
11216 cast<MachineSDNode>(CmpSwap)->setMemRefs(MemOp, MemOp + 1);
11223 void AArch64TargetLowering::ReplaceNodeResults(
11269 if (Subtarget->isTargetAndroid() || Subtarget->isTargetFuchsia())
11274 unsigned AArch64TargetLowering::combineRepeatedFPDivisors()
const {
11297 return Size == 128;
11323 if (Subtarget->hasLSE())
return false;
11335 Type *ValTy = cast<PointerType>(Addr->
getType())->getElementType();
11343 IsAcquire ? Intrinsic::aarch64_ldaxp : Intrinsic::aarch64_ldxp;
11359 IsAcquire ? Intrinsic::aarch64_ldaxr : Intrinsic::aarch64_ldxr;
11364 cast<PointerType>(Addr->
getType())->getElementType());
11384 IsRelease ? Intrinsic::aarch64_stlxp : Intrinsic::aarch64_stxp;
11395 IsRelease ? Intrinsic::aarch64_stlxr : Intrinsic::aarch64_stxr;
11410 bool AArch64TargetLowering::shouldNormalizeToSelectSequence(
LLVMContext &,
11428 if (Subtarget->isTargetAndroid())
11433 if (Subtarget->isTargetFuchsia())
11443 if (Subtarget->isTargetAndroid())
11448 if (Subtarget->isTargetFuchsia())
11486 if (AArch64::GPR64RegClass.
contains(*
I))
11487 RC = &AArch64::GPR64RegClass;
11488 else if (AArch64::FPR64RegClass.
contains(*
I))
11489 RC = &AArch64::FPR64RegClass;
11500 Attribute::NoUnwind) &&
11501 "Function should be nounwind in insertCopiesSplitCSR!");
11507 for (
auto *Exit : Exits)
11509 TII->
get(TargetOpcode::COPY), *
I)
11533 if (Subtarget->isTargetDarwin() || Subtarget->isTargetWindows())
11539 void AArch64TargetLowering::finalizeLowering(
MachineFunction &MF)
const {
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
std::pair< Value *, Value * > ShuffleOps
We are building a shuffle to create V, which is a sequence of insertelement, extractelement pairs...
static bool isAdvSIMDModImmType6(uint64_t Imm)
Type * getVectorElementType() const
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...
void setFrameAddressIsTaken(bool T)
void setAllowReassociation(bool b)
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
constexpr bool isUInt< 32 >(uint64_t x)
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, bool isTargetGA=false, unsigned char TargetFlags=0)
Value * getValueOperand()
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set, or Regs.size() if they are all allocated.
Helper structure to keep track of SetCC information.
static MVT getIntegerVT(unsigned BitWidth)
static bool isUZP_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isUZP_v_undef_Mask - Special case of isUZPMask for canonical form of "vector_shuffle v...
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I, MachineFunction &MF, unsigned Intrinsic) const override
getTgtMemIntrinsic - Represent NEON load and store intrinsics as MemIntrinsicNodes.
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
static SDValue performBitcastCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
EVT getValueType() const
Return the ValueType of the referenced return value.
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
MO_G3 - A symbol operand with this flag (granule 3) represents the high 16-bits of a 64-bit address...
Value * CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name="")
static SDValue LowerADDC_ADDE_SUBC_SUBE(SDValue Op, SelectionDAG &DAG)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
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...
iterator_range< use_iterator > uses()
static bool isConstant(const MachineInstr &MI)
This SDNode is used for target intrinsics that touch memory and need an associated MachineMemOperand...
bool isLittleEndian() const
const MCPhysReg * getScratchRegisters(CallingConv::ID CC) const override
Returns a 0 terminated array of registers that can be safely used as scratch registers.
const GlobalValue * getGlobal() const
uint64_t getZExtValue() const
Get zero extended value.
AArch64FunctionInfo - This class is derived from MachineFunctionInfo and contains private AArch64-spe...
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
static uint8_t encodeAdvSIMDModImmType3(uint64_t Imm)
This class represents an incoming formal argument to a Function.
LLVMContext & getContext() const
bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT, unsigned Index) const override
Return true if EXTRACT_SUBVECTOR is cheap for this result type with this index.
DiagnosticInfoOptimizationBase::Argument NV
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
void setVarArgsGPRSize(unsigned Size)
bool isMisaligned128StoreSlow() const
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
SDValue CombineTo(SDNode *N, ArrayRef< SDValue > To, bool AddTo=true)
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, const SDLoc &DL)
Return a new CALLSEQ_END node, which always must have a glue result (to ensure it's not CSE'd)...
static SDValue performVSelectCombine(SDNode *N, SelectionDAG &DAG)
C - The default llvm calling convention, compatible with C.
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...
static SDValue performNEONPostLDSTCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
Target-specific DAG combine function for NEON load/store intrinsics to merge base address updates...
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
BR_CC - Conditional branch.
Compute iterated dominance frontiers using a linear time algorithm.
static bool isUZPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
MO_PAGE - A symbol operand with this flag represents the pc-relative offset of the 4K page containing...
static bool isTRN_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isTRN_v_undef_Mask - Special case of isTRNMask for canonical form of "vector_shuffle v...
Type * getParamType(unsigned i) const
Parameter type accessors.
static MVT getVectorVT(MVT VT, unsigned NumElements)
void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd)
Assign this MachineSDNodes's memory reference descriptor list.
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
static int getFP16Imm(const APInt &Imm)
getFP16Imm - Return an 8-bit floating-point version of the 16-bit floating-point value.
LLVM_NODISCARD bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
A Module instance is used to store all the information related to an LLVM module. ...
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
SDValue scalarizeVectorStore(StoreSDNode *ST, SelectionDAG &DAG) const
static SDValue tryCombineToEXTR(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
EXTR instruction extracts a contiguous chunk of bits from two existing registers viewed as a high/low...
static bool isAdvSIMDModImmType12(uint64_t Imm)
int getVarArgsStackIndex() const
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
int getSplatIndex() const
static bool isAdvSIMDModImmType4(uint64_t Imm)
bool isVector() const
Return true if this is a vector value type.
static SDValue performXorCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const AArch64Subtarget *Subtarget)
static uint8_t encodeAdvSIMDModImmType1(uint64_t Imm)
static bool isConjunctionDisjunctionTree(const SDValue Val, bool &CanNegate, unsigned Depth=0)
Returns true if Val is a tree of AND/OR/SETCC operations.
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace=0, unsigned Align=1, bool *Fast=nullptr) const override
Returns true if the target allows unaligned memory accesses of the specified type.
const SDValue & getBasePtr() const
bool predictableSelectIsExpensive() const
Carry-setting nodes for multiple precision addition and subtraction.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
static bool isINSMask(ArrayRef< int > M, int NumInputElements, bool &DstIsLeft, int &Anomaly)
static bool isAddSubZExt(SDNode *N, SelectionDAG &DAG)
TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(EVT VT) const override
Return the preferred vector type legalization action.
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
static CondCode getInvertedCondCode(CondCode Code)
unsigned getReg() const
getReg - Returns the register number.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void setVarArgsStackIndex(int Index)
EVT getHalfNumVectorElementsVT(LLVMContext &Context) const
bool isIntDivCheap(EVT VT, AttributeList Attr) const override
Return true if integer divide is usually cheaper than a sequence of several shifts, adds, and multiplies for this target.
MachineMemOperand::Flags flags
const SDValue & getValue() const
static bool isZIP_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isZIP_v_undef_Mask - Special case of isZIPMask for canonical form of "vector_shuffle v...
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
TOF
Target Operand Flag enum.
This class represents a function call, abstracting a target machine's calling convention.
unsigned char ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const
ClassifyGlobalReference - Find the target operand flags that describe how a global value should be re...
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
static SDValue ConstantBuildVector(SDValue Op, SelectionDAG &DAG)
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
static SDValue splitStores(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG, const AArch64Subtarget *Subtarget)
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change...
static MVT getFloatingPointVT(unsigned BitWidth)
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
int getScalingFactorCost(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS) const override
Return the cost of the scaling factor used in the addressing mode represented by AM for this target...
unsigned getVectorNumElements() const
const SDValue & getChain() const
Function Alias Analysis Results
This instruction constructs a fixed permutation of two input vectors.
static SDValue performSelectCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
A vector select: "(select vL, vR, (setcc LHS, RHS))" is best performed with the compare-mask instruct...
void setVarArgsFPRIndex(int Index)
static SDValue performVectorCompareAndMaskUnaryOpCombine(SDNode *N, SelectionDAG &DAG)
unsigned getAlignment() const
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
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...
static SDValue LowerPREFETCH(SDValue Op, SelectionDAG &DAG)
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
bool isInteger() const
Return true if this is an integer or a vector integer type.
MO_G0 - A symbol operand with this flag (granule 0) represents the bits 0-15 of a 64-bit address...
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, SDValue RHS)
Helper function to make it easier to build Select's if you just have operands and don't want to check...
static SDValue performExtendCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
static SDValue NormalizeBuildVector(SDValue Op, SelectionDAG &DAG)
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
An instruction for reading from memory.
static SDValue emitComparison(SDValue LHS, SDValue RHS, ISD::CondCode CC, const SDLoc &dl, SelectionDAG &DAG)
static unsigned getDUPLANEOp(EVT EltType)
static IntegerType * getInt64Ty(LLVMContext &C)
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, const SDLoc &DL) const
Soften the operands of a comparison.
bool hasExternalWeakLinkage() const
static bool isAdvSIMDModImmType3(uint64_t Imm)
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
const SDNodeFlags getFlags() const
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool isVectorTy() const
True if this is an instance of VectorType.
static SDValue LowerVectorINT_TO_FP(SDValue Op, SelectionDAG &DAG)
static SDValue performSetccAddFolding(SDNode *Op, SelectionDAG &DAG)
This defines the Use class.
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
static SDValue EmitVectorComparison(SDValue LHS, SDValue RHS, AArch64CC::CondCode CC, bool NoNans, EVT VT, const SDLoc &dl, SelectionDAG &DAG)
bool shouldConsiderGEPOffsetSplit() const override
bool isOperationLegalOrCustom(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
static SDValue tryCombineFixedPointConvert(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1 at the ...
unsigned getBitWidth() const
Get the bit width of this value.
std::size_t countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
void setVarArgsFPRSize(unsigned Size)
static bool isZeroExtended(SDNode *N, SelectionDAG &DAG)
static std::pair< SDValue, SDValue > getAArch64XALUOOp(AArch64CC::CondCode &CC, SDValue Op, SelectionDAG &DAG)
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
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...
int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSpillSlot, const AllocaInst *Alloca=nullptr, uint8_t ID=0)
Create a new statically sized stack object, returning a nonnegative identifier to represent it...
bool isCallingConvWin64(CallingConv::ID CC) const
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
Libcall getFPROUND(EVT OpVT, EVT RetVT)
getFPROUND - Return the FPROUND_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
bool isUnsignedIntSetCC(CondCode Code)
Return true if this is a setcc instruction that performs an unsigned comparison when used with intege...
static SDValue performIntegerAbsCombine(SDNode *N, SelectionDAG &DAG)
bool isTargetCOFF() const
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
return AArch64::GPR64RegClass contains(Reg)
SDValue getExternalSymbol(const char *Sym, EVT VT)
bool isAllOnesValue() const
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
bool isTruncatingStore() const
Return true if the op does a truncation before store.
unsigned getAddressSpace() const
Return the address space for the associated pointer.
A convenience struct that encapsulates a DAG, and two SDValues for returning information from TargetL...
Libcall getUINTTOFP(EVT OpVT, EVT RetVT)
getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
MO_G2 - A symbol operand with this flag (granule 2) represents the bits 32-47 of a 64-bit address...
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
static bool isAdvSIMDModImmType7(uint64_t Imm)
static SDValue tryFormConcatFromShuffle(SDValue Op, SelectionDAG &DAG)
static bool isTRNMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
bool hasOneUse() const
Return true if there is exactly one use of this node.
bool isBeforeLegalize() const
cl::opt< bool > EnableAArch64ELFLocalDynamicTLSGeneration("aarch64-elf-ldtls-generation", cl::Hidden, cl::desc("Allow AArch64 Local Dynamic TLS code generation"), cl::init(false))
int getVarArgsGPRIndex() const
A description of a memory reference used in the backend.
APInt getLoBits(unsigned numBits) const
Compute an APInt containing numBits lowbits from this APInt.
static SDValue performTBZCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
static SDValue performCONDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG, unsigned CCIndex, unsigned CmpIndex)
bool isTargetDarwin() const
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static void ReplaceCMP_SWAP_128Results(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG, const AArch64Subtarget *Subtarget)
const HexagonInstrInfo * TII
bool isNonNegative() const
Determine if this APInt Value is non-negative (>= 0)
static SDValue tryCombineCRC32(unsigned Mask, SDNode *N, SelectionDAG &DAG)
static Value * UseTlsOffset(IRBuilder<> &IRB, unsigned Offset)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
Shift and rotation operations.
static SDValue performAddSubLongCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
Class to represent struct types.
LLVMContext & getContext() const
Get the global data context.
ABS - Determine the unsigned absolute value of a signed integer value of the same bitwidth...
A Use represents the edge between a Value definition and its users.
static SDValue performFpToIntCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const AArch64Subtarget *Subtarget)
Fold a floating-point multiply by power of two into floating-point to fixed-point conversion...
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s), MachineInstr opcode, and operands.
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
BinOp getOperation() const
static uint8_t encodeAdvSIMDModImmType6(uint64_t Imm)
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
CopyToReg - This node has three operands: a chain, a register number to set to this value...
bool isIntegerTy() const
True if this is an instance of IntegerType.
op_iterator op_end() const
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
uint64_t getConstantOperandVal(unsigned i) const
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
static SDValue tryAdvSIMDModImm32(unsigned NewOp, SDValue Op, SelectionDAG &DAG, const APInt &Bits, const SDValue *LHS=nullptr)
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
Return the ISD::SETCC ValueType.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
Helper structure to keep track of a SET_CC lowered into AArch64 code.
FLT_ROUNDS_ - Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest 2 Round to ...
virtual bool useLoadStackGuardNode() const
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
This file contains the simple types necessary to represent the attributes associated with functions a...
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
bool isInConsecutiveRegs() const
The memory access is dereferenceable (i.e., doesn't trap).
static SDValue LowerMUL(SDValue Op, SelectionDAG &DAG)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
static bool isLogicalImmediate(uint64_t imm, unsigned regSize)
isLogicalImmediate - Return true if the immediate is valid for a logical immediate instruction of the...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
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...
bool isTargetMachO() const
static SDValue combineAcrossLanesIntrinsic(unsigned Opc, SDNode *N, SelectionDAG &DAG)
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
This class is used to represent EVT's, which are used to parameterize some operations.
bool isLegalInterleavedAccessType(VectorType *VecTy, const DataLayout &DL) const
Returns true if VecTy is a legal interleaved access type.
APInt getHiBits(unsigned numBits) const
Compute an APInt containing numBits highbits from this APInt.
static SDValue foldVectorXorShiftIntoCmp(SDNode *N, SelectionDAG &DAG, const AArch64Subtarget *Subtarget)
Turn vector tests of the signbit in the form of: xor (sra X, elt_size(X)-1), -1 into: cmge X...
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
const BlockAddress * getBlockAddress() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(T Value)
This is an SDNode representing atomic operations.
uint64_t getNumElements() const
LocInfo getLocInfo() const
static bool isAdvSIMDModImmType5(uint64_t Imm)
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
static StructType * get(LLVMContext &Context, ArrayRef< Type *> Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
This file implements a class to represent arbitrary precision integral constant values and operations...
bool is64BitVector() const
Return true if this is a 64-bit vector type.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
AtomicOrdering
Atomic ordering for LLVM's memory model.
STACKSAVE - STACKSAVE has one operand, an input chain.
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
unsigned getSizeInBits() const
Value * getSafeStackPointerLocation(IRBuilder<> &IRB) const override
If the target has a standard location for the unsafe stack pointer, returns the address of that locat...
static const unsigned PerfectShuffleTable[6561+1]
bool isX18Reserved() const
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
int64_t getSExtValue() const
SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign-extending or trunca...
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
unsigned getScalarSizeInBits() const
void setArgumentStackToRestore(unsigned bytes)
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
unsigned getNextStackOffset() const
getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment r...
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
int64_t getSExtValue() const
Get sign extended value.
Constant * createSequentialMask(IRBuilder<> &Builder, unsigned Start, unsigned NumInts, unsigned NumUndefs)
Create a sequential shuffle mask.
unsigned NoNaNsFPMath
NoNaNsFPMath - This flag is enabled when the -enable-no-nans-fp-math flag is specified on the command...
static SDValue performConcatVectorsCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
Type * getType() const
All values are typed, get the type of this value.
MachineFunction & getMachineFunction() const
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose...
static bool isEXTMask(ArrayRef< int > M, EVT VT, bool &ReverseEXT, unsigned &Imm)
void emitAtomicCmpXchgNoStoreLLBalance(IRBuilder<> &Builder) const override
static bool checkValueWidth(SDValue V, unsigned width, ISD::LoadExtType &ExtType)
void toString(SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3, bool TruncateZero=true) const
MO_GOT - This flag indicates that a symbol operand represents the address of the GOT entry for the sy...
SDValue getRegisterMask(const uint32_t *RegMask)
constexpr bool isMask_64(uint64_t Value)
Return true if the argument is a non-empty sequence of ones starting at the least significant bit wit...
const AArch64RegisterInfo * getRegisterInfo() const override
static SDValue tryAdvSIMDModImm8(unsigned NewOp, SDValue Op, SelectionDAG &DAG, const APInt &Bits)
virtual TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(EVT VT) const
Return the preferred vector type legalization action.
const TargetMachine & getTarget() const
BasicBlock * GetInsertBlock() const
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
Simple integer binary arithmetic operators.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
static bool isOverflowIntrOpRes(SDValue Op)
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const APInt & getValue() const
Return the constant as an APInt value reference.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
bool enableAggressiveFMAFusion(EVT VT) const override
Enable aggressive FMA fusion on targets that want it.
static bool isAdvSIMDModImmType2(uint64_t Imm)
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
AttributeList getAttributes() const
Return the attribute list for this Function.
An instruction for storing to memory.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
op_iterator op_begin() const
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
bool isFPImmLegal(const APFloat &Imm, EVT VT) const override
Returns true if the target can instruction select the specified FP immediate natively.
SDValue getSplatBuildVector(EVT VT, const SDLoc &DL, SDValue Op)
Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all elements. ...
ArrayRef< SDUse > ops() const
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicLoadInIR(LoadInst *LI) const override
Returns how the given (atomic) load should be expanded by the IR-level AtomicExpand pass...
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...
static SDValue getReductionSDNode(unsigned Op, SDLoc DL, SDValue ScalarOp, SelectionDAG &DAG)
static SDValue LowerVectorFP_TO_INT(SDValue Op, SelectionDAG &DAG)
static const MCPhysReg GPRArgRegs[]
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
Value * CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
amdgpu Simplify well known AMD library false Value * Callee
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
void initializeSplitCSR(MachineBasicBlock *Entry) const override
Perform necessary initialization to handle a subset of CSRs explicitly via copies.
bool functionArgumentNeedsConsecutiveRegisters(Type *Ty, CallingConv::ID CallConv, bool isVarArg) const override
For some targets, an LLVM struct type must be broken down into multiple simple types, but the calling convention specifies that the entire struct must be passed in a block of consecutive registers.
bool supportsAddressTopByteIgnored() const
CPU has TBI (top byte of addresses is ignored during HW address translation) and OS enables it...
static SDValue WidenVector(SDValue V64Reg, SelectionDAG &DAG)
WidenVector - Given a value in the V64 register class, produce the equivalent value in the V128 regis...
MVT getVectorElementType() const
Value * getOperand(unsigned i) const
std::pair< EVT, EVT > GetSplitDestVTs(const EVT &VT) const
Compute the VTs needed for the low/hi parts of a type which is split (or expanded) into two not neces...
static bool isREVMask(ArrayRef< int > M, EVT VT, unsigned BlockSize)
isREVMask - Check if a vector shuffle corresponds to a REV instruction with the specified blocksize...
static SDValue tryExtendDUPToExtractHigh(SDValue N, SelectionDAG &DAG)
Class to represent pointers.
unsigned getByValSize() const
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
static bool isEssentiallyExtractSubvector(SDValue N)
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
static SDValue performBRCONDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
bool isX20Reserved() const
Flag
These should be considered private to the implementation of the MCInstrDesc class.
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
Value * CreateOr(Value *LHS, Value *RHS, const Twine &Name="")
TargetInstrInfo - Interface to description of machine instruction set.
bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
bool isTargetWindows() const
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
bool isLegalICmpImmediate(int64_t) const override
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
static bool isAdvSIMDModImmType9(uint64_t Imm)
bool isShuffleMaskLegal(ArrayRef< int > M, EVT VT) const override
Return true if the given shuffle mask can be codegen'd directly, or if it should be stack expanded...
bool isZero() const
Return true if the value is positive or negative zero.
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
bool isOSWindows() const
Tests whether the OS is Windows.
bool isTruncateFree(Type *Ty1, Type *Ty2) const override
Return true if it's free to truncate a value of type FromTy to type ToTy.
The memory access is volatile.
virtual Value * getIRStackGuard(IRBuilder<> &IRB) const
If the target has a standard location for the stack protector guard, returns the address of that loca...
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
static SDValue tryCombineToBSL(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
const SDValue & getBasePtr() const
A switch()-like statement whose cases are string literals.
initializer< Ty > init(const Ty &Val)
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
int64_t getOffset() const
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
void addLiveIn(MCPhysReg PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
bool shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override
Returns true if the given atomic cmpxchg should be expanded by the IR-level AtomicExpand pass into a ...
FPOpFusion::FPOpFusionMode AllowFPOpFusion
AllowFPOpFusion - This flag is set by the -fuse-fp-ops=xxx option.
Control flow instructions. These all have token chains.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
MO_G1 - A symbol operand with this flag (granule 1) represents the bits 16-31 of a 64-bit address...
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
bool requiresStrictAlign() const
unsigned const MachineRegisterInfo * MRI
std::size_t countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
static int getFP32Imm(const APInt &Imm)
getFP32Imm - Return an 8-bit floating-point version of the 32-bit floating-point value.
unsigned countPopulation() const
Count the number of bits set.
bool isZExtFree(Type *Ty1, Type *Ty2) const override
Return true if any actual instruction that defines a value of type FromTy implicitly zero-extends the...
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
Value * concatenateVectors(IRBuilder<> &Builder, ArrayRef< Value *> Vecs)
Concatenate a list of vectors.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type...
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
Simple binary floating point operators.
void setTargetDAGCombine(ISD::NodeType NT)
Targets should invoke this method for each target independent node that they want to provide a custom...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void incNumLocalDynamicTLSAccesses()
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
iterator_range< value_op_iterator > op_values() const
const SDValue & getOperand(unsigned Num) const
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
unsigned getVarArgsGPRSize() const
bool isPointerTy() const
True if this is an instance of PointerType.
static const MVT MVT_CC
Value type used for condition codes.
Carry-using nodes for multiple precision addition and subtraction.
static SDValue tryCombineLongOpWithDup(unsigned IID, SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
unsigned getVarArgsFPRSize() const
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 ...
unsigned getPrefFunctionAlignment() const
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
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 isAcquireOrStronger(AtomicOrdering ao)
std::pair< SDValue, SDValue > SplitVectorOperand(const SDNode *N, unsigned OpNo)
Split the node's operand with EXTRACT_SUBVECTOR and return the low/high part.
CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC) const
Selects the correct CCAssignFn for a given CallingConvention value.
Libcall getFPTOSINT(EVT OpVT, EVT RetVT)
getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
static bool isSetCCOrZExtSetCC(const SDValue &Op, SetCCInfoAndKind &Info)
static EVT getExtensionTo64Bits(const EVT &OrigVT)
static std::pair< SDValue, SDValue > splitInt128(SDValue N, SelectionDAG &DAG)
static bool isAdvSIMDModImmType1(uint64_t Imm)
static mvt_range fp_valuetypes()
static void ReplaceReductionResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG, unsigned InterOp, unsigned AcrossOp)
bool isDesirableToCommuteWithShift(const SDNode *N) const override
Returns false if N is a bit extraction pattern of (X >> C) & Mask.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This class provides iterator support for SDUse operands that use a specific SDNode.
bool useSmallAddressing() const
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...
static SDValue emitConjunctionDisjunctionTree(SelectionDAG &DAG, SDValue Val, AArch64CC::CondCode &OutCC)
Emit conjunction or disjunction tree with the CMP/FCMP followed by a chain of CCMP/CFCMP ops...
bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side...
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
static bool mayTailCallThisCC(CallingConv::ID CC)
Return true if we might ever do TCO for calls with this calling convention.
void setOperationPromotedToType(unsigned Opc, MVT OrigVT, MVT DestVT)
Convenience method to set an operation to Promote and specify the type in a single call...
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
bool CombineTo(SDValue O, SDValue N)
void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
void computeMaxCallFrameSize(const MachineFunction &MF)
Computes the maximum size of a callframe and the AdjustsStack property.
const uint32_t * getThisReturnPreservedMask(const MachineFunction &MF, CallingConv::ID) const
getThisReturnPreservedMask - Returns a call preserved mask specific to the case that 'returned' is on...
TRAP - Trapping instruction.
const APInt & getAPIntValue() const
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline...
const Triple & getTargetTriple() const
Value * getPointerOperand()
static bool isAdvSIMDModImmType8(uint64_t Imm)
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
void setPrefFunctionAlignment(unsigned Align)
Set the target's preferred function alignment.
static bool resultsCompatible(CallingConv::ID CalleeCC, CallingConv::ID CallerCC, MachineFunction &MF, LLVMContext &C, const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn CalleeFn, CCAssignFn CallerFn)
Returns true if the results of the two calling conventions are compatible.
static mvt_range vector_valuetypes()
self_iterator getIterator()
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, unsigned Size=0)
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
The memory access is non-temporal.
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
static MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
void setVarArgsGPRIndex(int Index)
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
static void changeFPCCToAArch64CC(ISD::CondCode CC, AArch64CC::CondCode &CondCode, AArch64CC::CondCode &CondCode2)
changeFPCCToAArch64CC - Convert a DAG fp condition code to an AArch64 CC.
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all...
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/...
unsigned MaxStoresPerMemmove
Specify maximum bytes of store instructions per memmove call.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Helper structure to be able to read SetCC information.
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
static SDValue addRequiredExtensionForVectorMULL(SDValue N, SelectionDAG &DAG, const EVT &OrigTy, const EVT &ExtTy, unsigned ExtOpcode)
static SDValue emitConjunctionDisjunctionTreeRec(SelectionDAG &DAG, SDValue Val, AArch64CC::CondCode &OutCC, bool Negate, SDValue CCOp, AArch64CC::CondCode Predicate)
Emit conjunction or disjunction tree with the CMP/FCMP followed by a chain of CCMP/CFCMP ops...
Type * getIndexedType() const
std::vector< ArgListEntry > ArgListTy
MO_HI12 - This flag indicates that a symbol operand represents the bits 13-24 of a 64-bit address...
virtual Value * getSafeStackPointerLocation(IRBuilder<> &IRB) const
Returns the target-specific address of the unsafe stack pointer.
unsigned getAlignment() const
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
static SDValue performIntToFpCombine(SDNode *N, SelectionDAG &DAG, const AArch64Subtarget *Subtarget)
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
static bool isSingletonEXTMask(ArrayRef< int > M, EVT VT, unsigned &Imm)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
This structure contains all information that is necessary for lowering calls.
auto find(R &&Range, const T &Val) -> decltype(adl_begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
bool isBeforeLegalizeOps() const
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
static SDValue GenerateTBL(SDValue Op, ArrayRef< int > ShuffleMask, SelectionDAG &DAG)
static SDValue LowerTruncateVectorStore(SDLoc DL, StoreSDNode *ST, EVT VT, EVT MemVT, SelectionDAG &DAG)
const TargetMachine & getTargetMachine() const
This class contains a discriminated union of information about pointers in memory operands...
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
MO_TLS - Indicates that the operand being accessed is some kind of thread-local symbol.
unsigned getNumOperands() const
Return the number of values used by this operation.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
static SDValue LowerXOR(SDValue Op, SelectionDAG &DAG)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static uint8_t encodeAdvSIMDModImmType12(uint64_t Imm)
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
static SDValue performSTORECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG, const AArch64Subtarget *Subtarget)
static SDValue NarrowVector(SDValue V128Reg, SelectionDAG &DAG)
NarrowVector - Given a value in the V128 register class, produce the equivalent value in the V64 regi...
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands...
Triple - Helper class for working with autoconf configuration names.
static bool findEXTRHalf(SDValue N, SDValue &Src, uint32_t &ShiftAmount, bool &FromHi)
An EXTR instruction is made up of two shifts, ORed together.
The memory access writes data.
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
static const int BlockSize
static SDValue performORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const AArch64Subtarget *Subtarget)
void setHasExtractBitsInsn(bool hasExtractInsn=true)
Tells the code generator that the target has BitExtract instructions.
static cl::opt< bool > EnableAArch64SlrGeneration("aarch64-shift-insert-generation", cl::Hidden, cl::desc("Allow AArch64 SLI/SRI formation"), cl::init(false))
bool isReleaseOrStronger(AtomicOrdering ao)
static uint8_t encodeAdvSIMDModImmType2(uint64_t Imm)
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
Libcall getFPEXT(EVT OpVT, EVT RetVT)
getFPEXT - Return the FPEXT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
static uint64_t encodeLogicalImmediate(uint64_t imm, unsigned regSize)
encodeLogicalImmediate - Return the encoded immediate value for a logical immediate instruction of th...
SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offset=0, unsigned char TargetFlags=0)
APInt ashr(unsigned ShiftAmt) const
Arithmetic right-shift function.
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags=0)
TokenFactor - This node takes multiple tokens as input and produces a single token result...
static int getFP64Imm(const APInt &Imm)
getFP64Imm - Return an 8-bit floating-point version of the 64-bit floating-point value.
bool isBuildVectorAllOnes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are ~0 or undef...
void dump() const
Dump this node, for debugging.
static SDValue LowerBITCAST(SDValue Op, SelectionDAG &DAG)
const TargetLowering & getTargetLoweringInfo() const
bool lowerInterleavedLoad(LoadInst *LI, ArrayRef< ShuffleVectorInst *> Shuffles, ArrayRef< unsigned > Indices, unsigned Factor) const override
Lower an interleaved load into a ldN intrinsic.
Iterator for intrusive lists based on ilist_node.
bool shouldReduceLoadWidth(SDNode *Load, ISD::LoadExtType ExtTy, EVT NewVT) const override
CCState - This class holds information needed while lowering arguments and return values...
unsigned getBytesInStackArgArea() const
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
static unsigned getIntrinsicID(const SDNode *N)
This is the shared class of boolean and integer constants.
static SDValue createGPRPairNode(SelectionDAG &DAG, SDValue V)
static SDValue splitStoreSplat(SelectionDAG &DAG, StoreSDNode &St, SDValue SplatVal, unsigned NumVecElts)
EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, MachineFunction &MF) const override
Returns the target specific optimal type for load and store operations as a result of memset...
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
EVT getVectorElementType() const
Given a vector type, return the type of each element.
testing::Matcher< const detail::ErrorHolder & > Failed()
static SDValue tryAdvSIMDModImm321s(unsigned NewOp, SDValue Op, SelectionDAG &DAG, const APInt &Bits)
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
MVT getScalarShiftAmountTy(const DataLayout &DL, EVT) const override
EVT is not used in-tree, but is used by out-of-tree target.
AArch64TargetLowering(const TargetMachine &TM, const AArch64Subtarget &STI)
unsigned getMaximumJumpTableSize() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
Instruction * user_back()
Specialize the methods defined in Value, as we know that an instruction can only be used by other ins...
static void getShuffleMask(const Constant *Mask, SmallVectorImpl< int > &Result)
Convert the input shuffle mask operand to a vector of integers.
unsigned getMaximumJumpTableSize() const
Return upper limit for number of entries in a jump table.
static bool memOpAlign(unsigned DstAlign, unsigned SrcAlign, unsigned AlignCheck)
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
Provides information about what library functions are available for the current target.
static bool isLegalArithImmed(uint64_t C)
CCValAssign - Represent assignment of one arg/retval to a location.
static unsigned getExtFactor(SDValue &V)
getExtFactor - Determine the adjustment factor for the position when generating an "extract from vect...
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool AlwaysInline, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
BRCOND - Conditional branch.
An SDNode that represents everything that will be needed to construct a MachineInstr.
static bool isAllConstantBuildVector(const SDValue &PotentialBVec, uint64_t &ConstVal)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
Byte Swap and Counting operators.
This is an abstract virtual class for memory operations.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
const Constant * getConstVal() const
bool isCalledByLegalizer() const
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static SDValue tryCombineShiftImm(unsigned IID, SDNode *N, SelectionDAG &DAG)
EVT widenIntegerVectorElementType(LLVMContext &Context) const
Return a VT for an integer vector type with the size of the elements doubled.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Helper structure to keep track of ISD::SET_CC operands.
Represents one node in the SelectionDAG.
bool isProfitableToHoist(Instruction *I) const override
Check if it is profitable to hoist instruction in then/else to if.
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
static SDValue tryAdvSIMDModImmFP(unsigned NewOp, SDValue Op, SelectionDAG &DAG, const APInt &Bits)
void setAdjustsStack(bool V)
static bool isSignExtended(SDNode *N, SelectionDAG &DAG)
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
bool targetShrinkDemandedConstant(SDValue Op, const APInt &Demanded, TargetLoweringOpt &TLO) const override
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
bool lowerInterleavedStore(StoreInst *SI, ShuffleVectorInst *SVI, unsigned Factor) const override
Lower an interleaved store into a stN intrinsic.
static void changeFPCCToANDAArch64CC(ISD::CondCode CC, AArch64CC::CondCode &CondCode, AArch64CC::CondCode &CondCode2)
Convert a DAG fp condition code to an AArch64 CC.
unsigned logBase2() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static mvt_range integer_valuetypes()
static SDValue performFDivCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const AArch64Subtarget *Subtarget)
Fold a floating-point divide by power of two into fixed-point to floating-point conversion.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static bool isZIPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
unsigned getVectorNumElements() const
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Class to represent vector types.
bool shouldExpandAtomicStoreInIR(StoreInst *SI) const override
Returns true if the given (atomic) store should be expanded by the IR-level AtomicExpand pass into an...
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT...
void setIndexedLoadAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
Indicate that the specified indexed load does or does not work with the specified type and indicate w...
EVT getMemoryVT() const
Return the type of the in-memory value.
static unsigned getNZCVToSatisfyCondCode(CondCode Code)
Given a condition code, return NZCV flags that would satisfy that condition.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
static bool performTBISimplification(SDValue Addr, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
Simplify Addr given that the top byte of it is ignored by HW during address translation.
Class for arbitrary precision integers.
unsigned getByValAlign() const
CodeModel::Model getCodeModel() const
Returns the code model.
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
Value * getIRStackGuard(IRBuilder<> &IRB) const override
If the target has a standard location for the stack protector cookie, returns the address of that loc...
iterator_range< use_iterator > uses()
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
void setMinFunctionAlignment(unsigned Align)
Set the target's minimum function alignment (in log2(bytes))
static void changeVectorFPCCToAArch64CC(ISD::CondCode CC, AArch64CC::CondCode &CondCode, AArch64CC::CondCode &CondCode2, bool &Invert)
changeVectorFPCCToAArch64CC - Convert a DAG fp condition code to an AArch64 CC usable with the vector...
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
static uint8_t encodeAdvSIMDModImmType10(uint64_t Imm)
static use_iterator use_end()
bool isNullFPConstant(SDValue V)
Returns true if V is an FP constant with a value of positive zero.
void setPrefLoopAlignment(unsigned Align)
Set the target's preferred loop alignment.
void setMaximumJumpTableSize(unsigned)
Indicate the maximum number of entries in jump tables.
ZERO_EXTEND - Used for integer types, zeroing the new bits.
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
ANY_EXTEND - Used for integer types. The high bits are undefined.
static SDValue performNVCASTCombine(SDNode *N)
Get rid of unnecessary NVCASTs (that don't change the type).
static SDValue performMulCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const AArch64Subtarget *Subtarget)
static SDValue tryAdvSIMDModImm64(unsigned NewOp, SDValue Op, SelectionDAG &DAG, const APInt &Bits)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(StringLiteral S, T Value)
iterator insert(iterator I, T &&Elt)
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
FMINNAN/FMAXNAN - Behave identically to FMINNUM/FMAXNUM, except that when a single input is NaN...
Value * CreatePointerCast(Value *V, Type *DestTy, const Twine &Name="")
static SDValue skipExtensionForVectorMULL(SDNode *N, SelectionDAG &DAG)
static SDValue performPostLD1Combine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, bool IsLaneOp)
Target-specific DAG combine function for post-increment LD1 (lane) and post-increment LD1R...
Flags
Flags values. These may be or'd together.
amdgpu Simplify well known AMD library false Value Value * Arg
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
The memory access reads data.
static uint8_t encodeAdvSIMDModImmType5(uint64_t Imm)
uint64_t getTypeSizeInBits(Type *Ty) const
Size examples:
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
static bool isEquivalentMaskless(unsigned CC, unsigned width, ISD::LoadExtType ExtType, int AddConstant, int CompConstant)
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg) const
Selects the correct CCAssignFn for a given CallingConvention value.
Value * CreateTruncOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
BR_JT - Jumptable branch.
static mvt_range all_valuetypes()
SimpleValueType Iteration.
Representation of each machine instruction.
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the source.
static bool isAdvSIMDModImmType10(uint64_t Imm)
#define FALKOR_STRIDED_ACCESS_MD
static uint8_t encodeAdvSIMDModImmType8(uint64_t Imm)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
These are IR-level optimization flags that may be propagated to SDNodes.
Libcall getFPTOUINT(EVT OpVT, EVT RetVT)
getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned char TargetFlags=0)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
bool is64BitVector() const
Return true if this is a 64-bit vector type.
constexpr bool isShiftedMask_64(uint64_t Value)
Return true if the argument contains a non-empty sequence of ones with the remainder zero (64 bit ver...
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
bool isVector() const
Return true if this is a vector value type.
MachineBasicBlock * EmitF128CSEL(MachineInstr &MI, MachineBasicBlock *BB) const
static SDValue LowerXALUO(SDValue Op, SelectionDAG &DAG)
Bitwise operators - logical and, logical or, logical xor.
pointer data()
Return a pointer to the vector's buffer, even if empty().
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, return the log base 2 integer value.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, ArrayRef< SDValue > Ops, bool isSigned, const SDLoc &dl, bool doesNotReturn=false, bool isReturnValueUsed=true) const
Returns a pair of (return value, chain).
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
unsigned getNumInterleavedAccesses(VectorType *VecTy, const DataLayout &DL) const
Returns the number of interleaved accesses that will be generated when lowering accesses of the given...
unsigned getLocMemOffset() const
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I=nullptr) const override
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo) const override
This method returns a target specific FastISel object, or null if the target does not support "fast" ...
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
static uint8_t encodeAdvSIMDModImmType4(uint64_t Imm)
LLVM_NODISCARD bool empty() const
unsigned getNumArgOperands() const
Return the number of call arguments.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
void computeKnownBits(SDValue Op, KnownBits &Known, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
static uint8_t encodeAdvSIMDModImmType11(uint64_t Imm)
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
PointerUnion< const Value *, const PseudoSourceValue * > ptrVal
bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override
Return if the target supports combining a chain like:
static bool isSigned(Value *V)
Can the given value generate sign bits.
const Function * getParent() const
Return the enclosing method, or null if none.
static bool isAddSubSExt(SDNode *N, SelectionDAG &DAG)
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
const TargetSubtargetInfo & getSubtarget() const
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Flags getFlags() const
Return the raw flags of the source value,.
unsigned MaxGluedStoresPerMemcpy
Specify max number of store instructions to glue in inlined memcpy.
APFloat abs(APFloat X)
Returns the absolute value of the argument.
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
MO_PAGEOFF - A symbol operand with this flag represents the offset of that symbol within a 4K page...
The memory access always returns the same value (or traps).
unsigned MaxStoresPerMemmoveOptSize
Maximum number of store instructions that may be substituted for a call to memmove, used for functions with OptSize attribute.
unsigned MaxStoresPerMemcpyOptSize
Maximum number of store operations that may be substituted for a call to memcpy, used for functions w...
Value * emitLoadLinked(IRBuilder<> &Builder, Value *Addr, AtomicOrdering Ord) const override
Perform a load-linked operation on Addr, returning a "Value *" with the corresponding pointee type...
void setStackPointerRegisterToSaveRestore(unsigned R)
If set to a physical register, this specifies the register that llvm.savestack/llvm.restorestack should save and restore.
static SDValue getTestBitOperand(SDValue Op, unsigned &Bit, bool &Invert, 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...
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
static bool optimizeLogicalImm(SDValue Op, unsigned Size, uint64_t Imm, const APInt &Demanded, TargetLowering::TargetLoweringOpt &TLO, unsigned NewOpc)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Type * getValueType() const
static SDValue performIntrinsicCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const AArch64Subtarget *Subtarget)
static SDValue replaceSplatVectorStore(SelectionDAG &DAG, StoreSDNode &St)
Replace a splat of a scalar to a vector store by scalar stores of the scalar value.
static const int LAST_INDEXED_MODE
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
unsigned getOpcode() const
FSINCOS - Compute both fsin and fcos as a single operation.
SDValue getValue(unsigned R) const
bool useLoadStackGuardNode() const override
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
const uint32_t * getTLSCallPreservedMask() const
unsigned MaxStoresPerMemcpy
Specify maximum bytes of store instructions per memcpy call.
Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
void setBytesInStackArgArea(unsigned bytes)
Libcall getSINTTOFP(EVT OpVT, EVT RetVT)
getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value *PtrVal, unsigned Alignment, AtomicOrdering Ordering, SyncScope::ID SSID)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands...
static SDValue replaceZeroVectorStore(SelectionDAG &DAG, StoreSDNode &St)
Replace a splat of zeros to a vector store by scalar stores of WZR/XZR.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
const MachinePointerInfo & getPointerInfo() const
bool isLegalAddImmediate(int64_t) const override
Return true if the specified immediate is legal add immediate, that is the target has add instruction...
ConstantSDNode * getConstantSplatNode(BitVector *UndefElements=nullptr) const
Returns the splatted constant or null if this is not a constant splat.
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
bool EnableExtLdPromotion
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void insert(iterator MBBI, MachineBasicBlock *MBB)
bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
LegalizeTypeAction
This enum indicates whether a types are legal for a target, and if not, what action should be used to...
static AArch64CC::CondCode changeIntCCToAArch64CC(ISD::CondCode CC)
changeIntCCToAArch64CC - Convert a DAG integer condition code to an AArch64 CC
MachineMemOperand::Flags getMMOFlags(const Instruction &I) const override
This callback is used to inspect load/store instructions and add target-specific MachineMemOperand fl...
static bool isSetCC(SDValue Op, SetCCInfoAndKind &SetCCInfo)
Check whether or not Op is a SET_CC operation, either a generic or an AArch64 lowered one...
void setReturnAddressIsTaken(bool s)
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
unsigned getVaListSizeInBits(const DataLayout &DL) const override
Returns the size of the platform's va_list object.
bool isPredecessorOf(const SDNode *N) const
Return true if this node is a predecessor of N.
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
static MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
ArrayRef< int > getMask() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
FMA - Perform a * b + c with no intermediate rounding step.
SDValue getRegister(unsigned Reg, EVT VT)
unsigned getResNo() const
get the index which selects a specific result in the SDNode
SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either any-extending or truncat...
FMIN/FMAX nodes can have flags, for NaN/NoNaN variants.
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
virtual void finalizeLowering(MachineFunction &MF) const
Execute target specific actions to finalize target lowering.
const AArch64InstrInfo * getInstrInfo() const override
static void ReplaceBITCASTResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
SDValue getValueType(EVT)
Value * emitStoreConditional(IRBuilder<> &Builder, Value *Val, Value *Addr, AtomicOrdering Ord) const override
Perform a store-conditional operation to Addr.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
static 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...
PREFETCH - This corresponds to a prefetch intrinsic.
static bool isExtendedBUILD_VECTOR(SDNode *N, SelectionDAG &DAG, bool isSigned)
bool isUndef() const
Return true if the type of the node type undefined.
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
unsigned getMaxSupportedInterleaveFactor() const override
Get the maximum supported factor for interleaved memory accesses.
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone...
Primary interface to the complete machine description for the target machine.
Type * getElementType() const
int getVarArgsFPRIndex() const
bool hasOneUse() const
Return true if there is exactly one user of this value.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)
Stack pointer relative access.
StringRef - Represent a constant reference to a string, i.e.
MO_NC - Indicates whether the linker is expected to check the symbol reference for overflow...
SetCC operator - This evaluates to a true value iff the condition is true.
SDValue ReconstructShuffle(SDValue Op, SelectionDAG &DAG) const
static SDValue LowerMULH(SDValue Op, SelectionDAG &DAG)
unsigned MaxStoresPerMemset
Specify maximum number of store instructions per memset call.
static uint8_t encodeAdvSIMDModImmType9(uint64_t Imm)
unsigned MaxStoresPerMemsetOptSize
Maximum number of stores operations that may be substituted for the call to memset, used for functions with OptSize attribute.
static bool isConcatMask(ArrayRef< int > Mask, EVT VT, bool SplitLHS)
static bool isAdvSIMDModImmType11(uint64_t Imm)
bool hasPairedLoad(EVT LoadedType, unsigned &RequiredAligment) const override
Return true if the target supplies and combines to a paired load two loaded values of type LoadedType...
bool operator==(uint64_t V1, const APInt &V2)
unsigned getNumOperands() const
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
static bool isVolatile(Instruction *Inst)
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
Provide custom lowering hooks for some operations.
unsigned char classifyGlobalFunctionReference(const GlobalValue *GV, const TargetMachine &TM) const
const SDValue & getOperand(unsigned i) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
unsigned getLocReg() const
static SDValue performGlobalAddressCombine(SDNode *N, SelectionDAG &DAG, const AArch64Subtarget *Subtarget, const TargetMachine &TM)
uint64_t getZExtValue() const
SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand, SDValue Subreg)
A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
TRUNCATE - Completely drop the high bits.
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
static void Split(std::vector< std::string > &V, StringRef S)
Splits a string of comma separated items in to a vector of strings.
static SDValue emitConditionalComparison(SDValue LHS, SDValue RHS, ISD::CondCode CC, SDValue CCOp, AArch64CC::CondCode Predicate, AArch64CC::CondCode OutCC, const SDLoc &DL, SelectionDAG &DAG)
Create a conditional comparison; Use CCMP, CCMN or FCCMP as appropriate.
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
const MachineOperand & getOperand(unsigned i) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
static uint8_t encodeAdvSIMDModImmType7(uint64_t Imm)
VectorType * getType() const
Overload to return most specific vector type.
The C convention as implemented on Windows/x86-64 and AArch64.
Value * getPointerOperand()
static SDValue getEstimate(const AArch64Subtarget *ST, unsigned Opcode, SDValue Operand, SelectionDAG &DAG, int &ExtraSteps)
MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num)
allocateMemRefsArray - Allocate an array to hold MachineMemOperand pointers.
static SDValue performSRLCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static cl::opt< bool > EnableOptimizeLogicalImm("aarch64-enable-logical-imm", cl::Hidden, cl::desc("Enable AArch64 logical imm instruction " "optimization"), cl::init(true))
const SDValue & getBasePtr() const
unsigned Log2_64(uint64_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
static const MachineMemOperand::Flags MOStridedAccess
LLVMContext * getContext() const
static SDValue tryAdvSIMDModImm16(unsigned NewOp, SDValue Op, SelectionDAG &DAG, const APInt &Bits, const SDValue *LHS=nullptr)
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
static bool isSplatMask(const int *Mask, EVT VT)
static bool resolveBuildVector(BuildVectorSDNode *BVN, APInt &CnstBits, APInt &UndefBits)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Type * getElementType() const
bool PredictableSelectIsExpensive
Tells the code generator that select is more expensive than a branch if the branch is usually predict...
unsigned getPrefLoopAlignment() const
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
bool empty() const
empty - Check if the array is empty.
static bool canGuaranteeTCO(CallingConv::ID CC)
Return true if the calling convention is one that we can guarantee TCO for.
bool isArrayTy() const
True if this is an instance of ArrayType.
void CommitTargetLoweringOpt(const TargetLoweringOpt &TLO)
void insertCopiesSplitCSR(MachineBasicBlock *Entry, const SmallVectorImpl< MachineBasicBlock *> &Exits) const override
Insert explicit copies in entry and exit blocks.
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned char TargetFlags=0)
bool isFMAFasterThanFMulAndFAdd(EVT VT) const override
Return true if an FMA operation is faster than a pair of fmul and fadd instructions.
static SDValue tryLowerToSLI(SDNode *N, SelectionDAG &DAG)
void setIndexedStoreAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
Indicate that the specified indexed store does or does not work with the specified type and indicate ...
gep_type_iterator gep_type_begin(const User *GEP)
CallInst * CreateCall(Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
MachineBasicBlock * emitPatchPoint(MachineInstr &MI, MachineBasicBlock *MBB) const
Replace/modify any TargetFrameIndex operands with a targte-dependent sequence of memory operands that...
This class is used to represent ISD::LOAD nodes.
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...
void setIsSplitCSR(bool s)
static SDValue getAArch64Cmp(SDValue LHS, SDValue RHS, ISD::CondCode CC, SDValue &AArch64cc, SelectionDAG &DAG, const SDLoc &dl)