15 #define DEBUG_TYPE "x86-isel"
56 STATISTIC(NumTailCalls,
"Number of tail calls");
64 unsigned vectorWidth) {
65 assert((vectorWidth == 128 || vectorWidth == 256) &&
66 "Unsupported vector width");
82 unsigned NormalizedIdxVal = (((IdxVal * ElVT.
getSizeInBits()) / vectorWidth)
88 Vec->
op_begin()+NormalizedIdxVal, ElemsPerChunk);
119 SDLoc dl,
unsigned vectorWidth) {
120 assert((vectorWidth == 128 || vectorWidth == 256) &&
121 "Unsupported vector width");
134 unsigned NormalizedIdxVal = (((IdxVal * ElVT.
getSizeInBits())/vectorWidth)
181 bool is64Bit = Subtarget->
is64Bit();
201 X86ScalarSSEf64 = Subtarget->
hasSSE2();
202 X86ScalarSSEf32 = Subtarget->
hasSSE1();
210 static bool FirstTimeThrough =
true;
214 if (!FirstTimeThrough && TO == TM.
Options)
return;
216 if (!FirstTimeThrough) {
219 FirstTimeThrough =
false;
336 if (X86ScalarSSEf32) {
359 if (X86ScalarSSEf32) {
397 if (!X86ScalarSSEf64) {
460 if (Subtarget->
hasBMI()) {
677 addLegalFPImmediate(
APFloat(+0.0));
678 addLegalFPImmediate(
APFloat(+0.0f));
703 addLegalFPImmediate(
APFloat(+0.0f));
704 addLegalFPImmediate(
APFloat(+0.0));
705 addLegalFPImmediate(
APFloat(+1.0));
706 addLegalFPImmediate(
APFloat(-0.0));
707 addLegalFPImmediate(
APFloat(-1.0));
733 addLegalFPImmediate(
APFloat(+0.0));
734 addLegalFPImmediate(
APFloat(+1.0));
735 addLegalFPImmediate(
APFloat(-0.0));
736 addLegalFPImmediate(
APFloat(-1.0));
737 addLegalFPImmediate(
APFloat(+0.0f));
738 addLegalFPImmediate(
APFloat(+1.0f));
739 addLegalFPImmediate(
APFloat(-0.0f));
740 addLegalFPImmediate(
APFloat(-1.0f));
754 addLegalFPImmediate(TmpFlt);
756 addLegalFPImmediate(TmpFlt);
762 addLegalFPImmediate(TmpFlt2);
764 addLegalFPImmediate(TmpFlt2);
1427 if ( EltSize >= 32) {
1468 for (
unsigned i = 0, e = 3+Subtarget->
is64Bit(); i != e; ++i) {
1568 if (
VectorType *VTy = dyn_cast<VectorType>(Ty)) {
1569 if (VTy->getBitWidth() == 128)
1571 }
else if (
ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
1572 unsigned EltAlign = 0;
1574 if (EltAlign > MaxAlign)
1575 MaxAlign = EltAlign;
1576 }
else if (
StructType *STy = dyn_cast<StructType>(Ty)) {
1577 for (
unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
1578 unsigned EltAlign = 0;
1580 if (EltAlign > MaxAlign)
1581 MaxAlign = EltAlign;
1620 unsigned DstAlign,
unsigned SrcAlign,
1621 bool IsMemset,
bool ZeroMemset,
1625 if ((!IsMemset || ZeroMemset) &&
1630 ((DstAlign == 0 || DstAlign >= 16) &&
1631 (SrcAlign == 0 || SrcAlign >= 16)))) {
1642 }
else if (!MemcpyStrSrc && Size >= 8 &&
1650 if (Subtarget->
is64Bit() && Size >= 8)
1657 return X86ScalarSSEf32;
1659 return X86ScalarSSEf64;
1722 std::pair<const TargetRegisterClass*, uint8_t>
1735 RRC = &X86::VR64RegClass;
1742 RRC = &X86::VR128RegClass;
1745 return std::make_pair(RRC, Cost);
1749 unsigned &Offset)
const {
1769 unsigned DestAS)
const {
1770 assert(SrcAS != DestAS &&
"Expected different address spaces!");
1772 return SrcAS < 256 && DestAS < 256;
1779 #include "X86GenCallingConv.inc"
1789 return CCInfo.CheckReturn(Outs, RetCC_X86);
1792 const uint16_t *X86TargetLowering::getScratchRegisters(
CallingConv::ID)
const {
1793 static const uint16_t ScratchRegs[] = { X86::R11, 0 };
1798 X86TargetLowering::LowerReturn(
SDValue Chain,
1819 for (
unsigned i = 0; i != RVLocs.size(); ++i) {
1821 assert(VA.
isRegLoc() &&
"Can only return in registers!");
1822 SDValue ValToCopy = OutVals[i];
1823 EVT ValVT = ValToCopy.getValueType();
1894 "SRetReturnReg should have been set in LowerFormalArguments().");
1900 Chain = DAG.
getCopyToReg(Chain, dl, RetValReg, Val, Flag);
1917 bool X86TargetLowering::isUsedByReturnOnly(
SDNode *
N,
SDValue &Chain)
const {
1934 bool HasRet =
false;
1950 X86TargetLowering::getTypeForExtArgOrReturn(
MVT VT,
1960 return VT.
bitsLT(MinVT) ? MinVT : VT;
1967 X86TargetLowering::LowerCallResult(
SDValue Chain,
SDValue InFlag,
1975 bool Is64Bit = Subtarget->
is64Bit();
1981 for (
unsigned i = 0, e = RVLocs.
size(); i != e; ++i) {
1987 ((Is64Bit || Ins[i].
Flags.isInReg()) && !Subtarget->
hasSSE1())) {
2002 SDValue Ops[] = { Chain, InFlag };
2015 CopyVT, InFlag).getValue(1);
2098 bool X86TargetLowering::mayBeEmittedAsTailCall(
CallInst *CI)
const {
2113 bool GuaranteedTailCallOpt) {
2118 X86TargetLowering::LowerMemArgument(
SDValue Chain,
2129 bool isImmutable = !AlwaysUseMutable && !Flags.
isByVal();
2145 if (Bytes == 0) Bytes = 1;
2152 return DAG.
getLoad(ValVT, dl, Chain, FIN,
2154 false,
false,
false, 0);
2159 X86TargetLowering::LowerFormalArguments(
SDValue Chain,
2171 if (Fn->hasExternalLinkage() &&
2173 Fn->getName() ==
"main")
2177 bool Is64Bit = Subtarget->
is64Bit();
2182 "Var args not supported with calling convention fastcc, ghc or hipe");
2193 CCInfo.AnalyzeFormalArguments(Ins, CC_X86);
2195 unsigned LastVal = ~0U;
2197 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
2202 "Don't support value assigned to multiple locs yet");
2210 RC = &X86::GR32RegClass;
2211 else if (Is64Bit && RegVT ==
MVT::i64)
2212 RC = &X86::GR64RegClass;
2214 RC = &X86::FR32RegClass;
2216 RC = &X86::FR64RegClass;
2218 RC = &X86::VR512RegClass;
2220 RC = &X86::VR256RegClass;
2222 RC = &X86::VR128RegClass;
2224 RC = &X86::VR64RegClass;
2226 RC = &X86::VK8RegClass;
2228 RC = &X86::VK16RegClass;
2256 ArgValue = LowerMemArgument(Chain, CallConv, Ins, dl, DAG, VA, MFI, i);
2285 unsigned StackSize = CCInfo.getNextStackOffset();
2289 StackSize = GetAlignedArgumentStackSize(StackSize, DAG);
2299 unsigned TotalNumIntRegs = 0, TotalNumXMMRegs = 0;
2302 static const uint16_t GPR64ArgRegsWin64[] = {
2303 X86::RCX, X86::RDX, X86::R8, X86::R9
2305 static const uint16_t GPR64ArgRegs64Bit[] = {
2306 X86::RDI, X86::RSI, X86::RDX, X86::RCX, X86::R8, X86::R9
2308 static const uint16_t XMMArgRegs64Bit[] = {
2309 X86::XMM0, X86::XMM1, X86::XMM2, X86::XMM3,
2310 X86::XMM4, X86::XMM5, X86::XMM6, X86::XMM7
2312 const uint16_t *GPR64ArgRegs;
2313 unsigned NumXMMRegs = 0;
2319 TotalNumIntRegs = 4;
2320 GPR64ArgRegs = GPR64ArgRegsWin64;
2322 TotalNumIntRegs = 6; TotalNumXMMRegs = 8;
2323 GPR64ArgRegs = GPR64ArgRegs64Bit;
2325 NumXMMRegs = CCInfo.getFirstUnallocated(XMMArgRegs64Bit,
2328 unsigned NumIntRegs = CCInfo.getFirstUnallocated(GPR64ArgRegs,
2331 bool NoImplicitFloatOps = Fn->getAttributes().
2333 assert(!(NumXMMRegs && !Subtarget->
hasSSE1()) &&
2334 "SSE register cannot be used when SSE is disabled!");
2336 NoImplicitFloatOps) &&
2337 "SSE register cannot be used when SSE is disabled!");
2342 TotalNumXMMRegs = 0;
2370 for (; NumIntRegs != TotalNumIntRegs; ++NumIntRegs) {
2373 unsigned VReg = MF.
addLiveIn(GPR64ArgRegs[NumIntRegs],
2374 &X86::GR64RegClass);
2385 if (TotalNumXMMRegs != 0 && NumXMMRegs != TotalNumXMMRegs) {
2399 for (; NumXMMRegs != TotalNumXMMRegs; ++NumXMMRegs) {
2400 unsigned VReg = MF.
addLiveIn(XMMArgRegs64Bit[NumXMMRegs],
2401 &X86::VR128RegClass);
2407 &SaveXMMOps[0], SaveXMMOps.
size()));
2410 if (!MemOps.
empty())
2412 &MemOps[0], MemOps.
size());
2443 X86TargetLowering::LowerMemOpCallTo(
SDValue Chain,
2454 return DAG.
getStore(Chain, dl, Arg, PtrOff,
2462 X86TargetLowering::EmitTailCallLoadRetAddr(
SelectionDAG &DAG,
2464 bool IsTailCall,
bool Is64Bit,
2465 int FPDiff,
SDLoc dl)
const {
2472 false,
false,
false, 0);
2481 unsigned SlotSize,
int FPDiff,
SDLoc dl) {
2483 if (!FPDiff)
return Chain;
2485 int NewReturnAddrFI =
2489 Chain = DAG.
getStore(Chain, dl, RetAddrFrIdx, NewRetAddrFrIdx,
2510 bool Is64Bit = Subtarget->
is64Bit();
2514 bool IsSibcall =
false;
2521 isTailCall = IsEligibleForTailCallOptimization(Callee, CallConv,
2524 Outs, OutVals,
Ins, DAG);
2536 "Var args not supported with calling convention fastcc, ghc or hipe");
2547 CCInfo.AnalyzeCallOperands(Outs, CC_X86);
2550 unsigned NumBytes = CCInfo.getNextStackOffset();
2557 NumBytes = GetAlignedArgumentStackSize(NumBytes, DAG);
2560 if (isTailCall && !IsSibcall) {
2565 FPDiff = NumBytesCallerPushed - NumBytes;
2569 if (FPDiff < X86Info->getTCReturnAddrDelta())
2579 if (isTailCall && FPDiff)
2580 Chain = EmitTailCallLoadRetAddr(DAG, RetAddrFrIdx, Chain, isTailCall,
2581 Is64Bit, FPDiff, dl);
2591 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
2596 bool isByVal = Flags.
isByVal();
2623 int FI = cast<FrameIndexSDNode>(SpillSlot)->getIndex();
2624 Chain = DAG.
getStore(Chain, dl, Arg, SpillSlot,
2634 if (isVarArg && IsWin64) {
2637 unsigned ShadowReg = 0;
2639 case X86::XMM0: ShadowReg = X86::RCX;
break;
2640 case X86::XMM1: ShadowReg = X86::RDX;
break;
2641 case X86::XMM2: ShadowReg = X86::R8;
break;
2642 case X86::XMM3: ShadowReg = X86::R9;
break;
2645 RegsToPass.
push_back(std::make_pair(ShadowReg, Arg));
2647 }
else if (!IsSibcall && (!isTailCall || isByVal)) {
2652 MemOpChains.
push_back(LowerMemOpCallTo(Chain, StackPtr, Arg,
2653 dl, DAG, VA, Flags));
2657 if (!MemOpChains.
empty())
2659 &MemOpChains[0], MemOpChains.
size());
2680 Callee = LowerGlobalAddress(Callee, DAG);
2681 else if (isa<ExternalSymbolSDNode>(Callee))
2682 Callee = LowerExternalSymbol(Callee, DAG);
2686 if (Is64Bit && isVarArg && !IsWin64) {
2696 static const uint16_t XMMArgRegs[] = {
2697 X86::XMM0, X86::XMM1, X86::XMM2, X86::XMM3,
2698 X86::XMM4, X86::XMM5, X86::XMM6, X86::XMM7
2700 unsigned NumXMMRegs = CCInfo.getFirstUnallocated(XMMArgRegs, 8);
2701 assert((Subtarget->
hasSSE1() || !NumXMMRegs)
2702 &&
"SSE registers cannot be used when SSE is disabled");
2722 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
2750 DAG.
getStore(ArgChain, dl, Arg, FIN,
2757 if (!MemOpChains2.
empty())
2759 &MemOpChains2[0], MemOpChains2.
size());
2770 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i) {
2771 Chain = DAG.
getCopyToReg(Chain, dl, RegsToPass[i].first,
2772 RegsToPass[i].second, InFlag);
2777 assert(Is64Bit &&
"Large code model is only legal in 64-bit mode.");
2791 unsigned char OpFlags = 0;
2792 bool ExtraLoad =
false;
2812 isa<Function>(GV) &&
2813 cast<Function>(GV)->getAttributes().
2814 hasAttribute(AttributeSet::FunctionIndex,
2834 false,
false,
false, 0);
2837 unsigned char OpFlags = 0;
2861 if (!IsSibcall && isTailCall) {
2875 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i)
2877 RegsToPass[i].second.getValueType()));
2882 assert(Mask &&
"Missing call preserved mask for calling convention");
2902 unsigned NumBytesForCalleeToPush;
2905 NumBytesForCalleeToPush = NumBytes;
2912 NumBytesForCalleeToPush = 4;
2914 NumBytesForCalleeToPush = 0;
2928 return LowerCallResult(Chain, InFlag, CallConv, isVarArg,
2929 Ins, dl, DAG, InVals);
2966 X86TargetLowering::GetAlignedArgumentStackSize(
unsigned StackSize,
2974 uint64_t AlignMask = StackAlignment - 1;
2975 int64_t Offset = StackSize;
2977 if ( (Offset & AlignMask) <= (StackAlignment - SlotSize) ) {
2979 Offset += ((StackAlignment - SlotSize) - (Offset & AlignMask));
2982 Offset = ((~AlignMask) & Offset) + StackAlignment +
2983 (StackAlignment-SlotSize);
3009 if ((Opcode == X86::LEA32r || Opcode == X86::LEA64r) &&
3016 }
else if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(Arg)) {
3024 SDValue Ptr = Ld->getBasePtr();
3036 assert(FI != INT_MAX);
3046 X86TargetLowering::IsEligibleForTailCallOptimization(
SDValue Callee,
3049 bool isCalleeStructRet,
3050 bool isCallerStructRet,
3070 bool CCMatch = CallerCC == CalleeCC;
3092 if (isCalleeStructRet || isCallerStructRet)
3102 if (isVarArg && !Outs.
empty()) {
3106 if (IsCalleeWin64 || IsCallerWin64)
3114 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i)
3115 if (!ArgLocs[i].isRegLoc())
3122 bool Unused =
false;
3123 for (
unsigned i = 0, e = Ins.
size(); i != e; ++i) {
3134 for (
unsigned i = 0, e = RVLocs.
size(); i != e; ++i) {
3154 if (RVLocs1.
size() != RVLocs2.
size())
3156 for (
unsigned i = 0, e = RVLocs1.
size(); i != e; ++i) {
3157 if (RVLocs1[i].isRegLoc() != RVLocs2[i].isRegLoc())
3159 if (RVLocs1[i].getLocInfo() != RVLocs2[i].getLocInfo())
3161 if (RVLocs1[i].isRegLoc()) {
3162 if (RVLocs1[i].getLocReg() != RVLocs2[i].getLocReg())
3165 if (RVLocs1[i].getLocMemOffset() != RVLocs2[i].getLocMemOffset())
3173 if (!Outs.
empty()) {
3184 CCInfo.AnalyzeCallOperands(Outs, CC_X86);
3185 if (CCInfo.getNextStackOffset()) {
3196 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
3216 ((!isa<GlobalAddressSDNode>(Callee) &&
3217 !isa<ExternalSymbolSDNode>(Callee)) ||
3219 unsigned NumInRegs = 0;
3222 unsigned MaxInRegs =
3225 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
3233 if (++NumInRegs == MaxInRegs)
3264 default:
return false;
3296 return DAG.
getNode(Opc, dl, VT, V1);
3301 SDValue V1,
unsigned TargetMask,
3322 return DAG.
getNode(Opc, dl, VT, V1, V2,
3340 return DAG.
getNode(Opc, dl, VT, V1, V2);
3349 int ReturnAddrIndex = FuncInfo->
getRAIndex();
3351 if (ReturnAddrIndex == 0) {
3364 bool hasSymbolicDisplacement) {
3371 if (!hasSymbolicDisplacement)
3396 bool is64Bit,
bool IsVarArg,
bool TailCallOpt) {
3400 switch (CallingConv) {
3425 if (SetCCOpcode ==
ISD::SETGT && RHSC->isAllOnesValue()) {
3430 if (SetCCOpcode ==
ISD::SETLT && RHSC->isNullValue()) {
3434 if (SetCCOpcode ==
ISD::SETLT && RHSC->getZExtValue() == 1) {
3441 switch (SetCCOpcode) {
3465 switch (SetCCOpcode) {
3481 switch (SetCCOpcode) {
3529 for (
unsigned i = 0, e = LegalFPImmediates.size(); i != e; ++i) {
3539 return (Val < 0) || (Val >= Low && Val <
Hi);
3545 return (Val < 0 || Val == CmpVal);
3552 unsigned Pos,
unsigned Size,
int Low) {
3553 for (
unsigned i = Pos, e = Pos+Size; i != e; ++i, ++Low)
3564 return (Mask[0] < 4 && Mask[1] < 4 && Mask[2] < 4 && Mask[3] < 4);
3566 return (Mask[0] < 2 && Mask[1] < 2);
3581 for (
unsigned i = 4; i != 8; ++i)
3591 for (
unsigned i = 12; i != 16; ++i)
3610 for (
unsigned i = 0; i != 4; ++i)
3620 for (
unsigned i = 8; i != 12; ++i)
3638 unsigned NumLaneElts = NumElts/NumLanes;
3641 if (NumLaneElts == 2)
3644 for (
unsigned l = 0; l != NumElts; l+=NumLaneElts) {
3646 for (i = 0; i != NumLaneElts; ++i) {
3652 if (i == NumLaneElts)
3655 int Start = Mask[i+l];
3667 if (Start >= (
int)NumElts)
3668 Start -= NumElts - NumLaneElts;
3671 if (Start <= (
int)(i+l))
3677 for (++i; i != NumLaneElts; ++i) {
3678 int Idx = Mask[i+l];
3689 if (Idx >= (
int)NumElts)
3690 Idx -= NumElts - NumLaneElts;
3704 unsigned NumElems) {
3705 for (
unsigned i = 0; i != NumElems; ++i) {
3709 else if (idx < (
int)NumElems)
3710 Mask[i] = idx + NumElems;
3712 Mask[i] = idx - NumElems;
3724 unsigned NumLaneElems = NumElems/NumLanes;
3726 if (NumLaneElems != 2 && NumLaneElems != 4)
3730 bool symetricMaskRequired =
3753 unsigned HalfLaneElems = NumLaneElems/2;
3754 for (
unsigned l = 0; l != NumElems; l += NumLaneElems) {
3755 for (
unsigned i = 0; i != NumLaneElems; ++i) {
3756 int Idx = Mask[i+l];
3757 unsigned RngStart = l + ((Commuted == (i<HalfLaneElems)) ? NumElems : 0);
3763 if (!symetricMaskRequired || Idx < 0)
3765 if (MaskVal[i] < 0) {
3766 MaskVal[i] = Idx - l;
3769 if ((
signed)(Idx - l) != MaskVal[i])
3821 if (NumElems != 2 && NumElems != 4)
3824 for (
unsigned i = 0, e = NumElems/2; i != e; ++i)
3828 for (
unsigned i = NumElems/2, e = NumElems; i != e; ++i)
3843 if (NumElems != 2 && NumElems != 4)
3846 for (
unsigned i = 0, e = NumElems/2; i != e; ++i)
3850 for (
unsigned i = 0, e = NumElems/2; i != e; ++i)
3872 static const int MaskToOptimizeEven[] = {0, 8, 2, 10, 4, 12, 6, 14};
3873 static const int MaskToOptimizeOdd[] = {1, 9, 3, 11, 5, 13, 7, 15};
3874 bool MatchEvenMask =
true;
3875 bool MatchOddMask =
true;
3876 for (
int i=0; i<8; ++i) {
3878 MatchEvenMask =
false;
3880 MatchOddMask =
false;
3883 if (!MatchEvenMask && !MatchOddMask)
3891 if (MatchEvenMask) {
3893 static const int ShiftRightMask[] = {-1, 0, -1, 2, -1, 4, -1, 6 };
3897 static const int ShiftLeftMask[] = {1, -1, 3, -1, 5, -1, 7, -1 };
3900 static const int BlendMask[] = {0, 9, 2, 11, 4, 13, 6, 15};
3907 bool HasInt256,
bool V2IsSplat =
false) {
3910 "Unsupported vector type for unpckl");
3914 unsigned NumOf256BitLanes;
3917 if (NumElts != 4 && NumElts != 8 &&
3918 (!HasInt256 || (NumElts != 16 && NumElts != 32)))
3921 NumOf256BitLanes = 1;
3924 "Unsupported vector type for unpckh");
3926 NumOf256BitLanes = 2;
3929 NumOf256BitLanes = 1;
3932 unsigned NumEltsInStride = NumElts/NumOf256BitLanes;
3933 unsigned NumLaneElts = NumEltsInStride/NumLanes;
3935 for (
unsigned l256 = 0; l256 < NumOf256BitLanes; l256 += 1) {
3936 for (
unsigned l = 0; l != NumEltsInStride; l += NumLaneElts) {
3937 for (
unsigned i = 0, j = l; i != NumLaneElts; i += 2, ++j) {
3938 int BitI = Mask[l256*NumEltsInStride+l+i];
3939 int BitI1 = Mask[l256*NumEltsInStride+l+i+1];
3955 bool HasInt256,
bool V2IsSplat =
false) {
3957 "Unsupported vector type for unpckh");
3961 unsigned NumOf256BitLanes;
3964 if (NumElts != 4 && NumElts != 8 &&
3965 (!HasInt256 || (NumElts != 16 && NumElts != 32)))
3968 NumOf256BitLanes = 1;
3971 "Unsupported vector type for unpckh");
3973 NumOf256BitLanes = 2;
3976 NumOf256BitLanes = 1;
3979 unsigned NumEltsInStride = NumElts/NumOf256BitLanes;
3980 unsigned NumLaneElts = NumEltsInStride/NumLanes;
3982 for (
unsigned l256 = 0; l256 < NumOf256BitLanes; l256 += 1) {
3983 for (
unsigned l = 0; l != NumEltsInStride; l += NumLaneElts) {
3984 for (
unsigned i = 0, j = l+NumLaneElts/2; i != NumLaneElts; i += 2, ++j) {
3985 int BitI = Mask[l256*NumEltsInStride+l+i];
3986 int BitI1 = Mask[l256*NumEltsInStride+l+i+1];
4009 "Unsupported vector type for unpckh");
4011 if (Is256BitVec && NumElts != 4 && NumElts != 8 &&
4012 (!HasInt256 || (NumElts != 16 && NumElts != 32)))
4019 if (NumElts == 4 && Is256BitVec)
4025 unsigned NumLaneElts = NumElts/NumLanes;
4027 for (
unsigned l = 0; l != NumElts; l += NumLaneElts) {
4028 for (
unsigned i = 0, j = l; i != NumLaneElts; i += 2, ++j) {
4029 int BitI = Mask[l+i];
4030 int BitI1 = Mask[l+i+1];
4052 "Unsupported vector type for unpckh");
4055 (!HasInt256 || (NumElts != 16 && NumElts != 32)))
4061 unsigned NumLaneElts = NumElts/NumLanes;
4063 for (
unsigned l = 0; l != NumElts; l += NumLaneElts) {
4064 for (
unsigned i = 0, j = l+NumLaneElts/2; i != NumLaneElts; i += 2, ++j) {
4065 int BitI = Mask[l+i];
4066 int BitI1 = Mask[l+i+1];
4090 for (
unsigned i = 1; i != NumElts; ++i)
4111 bool MatchA =
false, MatchB =
false;
4114 for (
unsigned Half = 0; Half != 4; ++Half) {
4122 for (
unsigned Half = 0; Half != 4; ++Half) {
4129 return MatchA && MatchB;
4139 unsigned FstHalf = 0, SndHalf = 0;
4140 for (
unsigned i = 0; i < HalfSize; ++i) {
4146 for (
unsigned i = HalfSize; i < HalfSize*2; ++i) {
4153 return (FstHalf | (SndHalf << 4));
4165 for (
unsigned i = 0; i != NumElts; ++i) {
4168 Imm8 |= Mask[i] << (i*2);
4173 unsigned LaneSize = 4;
4176 for (
unsigned l = 0; l != NumElts; l += LaneSize) {
4177 for (
unsigned i = 0; i != LaneSize; ++i) {
4182 if (MaskVal[i] < 0) {
4183 MaskVal[i] = Mask[i+l] - l;
4184 Imm8 |= MaskVal[i] << (i*2);
4187 if (Mask[i+l] != (
signed)(MaskVal[i]+l))
4205 bool symetricMaskRequired = (EltSize == 32);
4209 unsigned LaneSize = NumElts/NumLanes;
4213 for (
unsigned l = 0; l != NumElts; l += LaneSize) {
4214 for (
unsigned i = 0; i != LaneSize; ++i) {
4217 if (symetricMaskRequired) {
4218 if (ExpectedMaskVal[i] < 0 && Mask[i+l] >= 0) {
4219 ExpectedMaskVal[i] = Mask[i+l] - l;
4234 bool V2IsSplat =
false,
bool V2IsUndef =
false) {
4239 if (NumOps != 2 && NumOps != 4 && NumOps != 8 && NumOps != 16)
4245 for (
unsigned i = 1; i != NumOps; ++i)
4270 for (
unsigned i = 0; i != NumElems; i += 2)
4294 for (
unsigned i = 0; i != NumElems; i += 2)
4313 for (
unsigned i = 0; i != NumElts/2; ++i)
4316 for (
unsigned i = NumElts/2; i != NumElts; ++i)
4330 for (
unsigned i = 0; i != e; ++i)
4333 for (
unsigned i = 0; i != e; ++i)
4343 assert((vecWidth == 128 || vecWidth == 256) &&
"Unexpected vector width");
4353 bool Result = (Index * ElSize) % vecWidth == 0;
4362 assert((vecWidth == 128 || vecWidth == 256) &&
"Unexpected vector width");
4371 bool Result = (Index * ElSize) % vecWidth == 0;
4399 "Unsupported vector type for PSHUF/SHUFP");
4405 unsigned NumLaneElts = NumElts/NumLanes;
4407 assert((NumLaneElts == 2 || NumLaneElts == 4 || NumLaneElts == 8) &&
4408 "Only supports 2, 4 or 8 elements per lane");
4410 unsigned Shift = (NumLaneElts >= 4) ? 1 : 0;
4412 for (
unsigned i = 0; i != NumElts; ++i) {
4414 if (Elt < 0)
continue;
4415 Elt &= NumLaneElts - 1;
4416 unsigned ShAmt = (i << Shift) % 8;
4417 Mask |= Elt << ShAmt;
4429 "Unsupported vector type for PSHUFHW");
4434 for (
unsigned l = 0; l != NumElts; l += 8) {
4436 for (
unsigned i = 0; i < 4; ++i) {
4438 if (Elt < 0)
continue;
4440 Mask |= Elt << (i * 2);
4453 "Unsupported vector type for PSHUFHW");
4458 for (
unsigned l = 0; l != NumElts; l += 8) {
4460 for (
unsigned i = 0; i < 4; ++i) {
4462 if (Elt < 0)
continue;
4464 Mask |= Elt << (i * 2);
4480 unsigned NumLaneElts = NumElts/NumLanes;
4484 for (i = 0; i != NumElts; ++i) {
4489 if (Val >= (
int)NumElts)
4490 Val -= NumElts - NumLaneElts;
4492 assert(Val - i > 0 &&
"PALIGNR imm should be positive");
4493 return (Val - i) * EltSize;
4497 assert((vecWidth == 128 || vecWidth == 256) &&
"Unsupported vector width");
4507 unsigned NumElemsPerChunk = vecWidth / ElVT.
getSizeInBits();
4508 return Index / NumElemsPerChunk;
4512 assert((vecWidth == 128 || vecWidth == 256) &&
"Unsupported vector width");
4522 unsigned NumElemsPerChunk = vecWidth / ElVT.
getSizeInBits();
4523 return Index / NumElemsPerChunk;
4558 return CN->isNullValue();
4560 return CFP->getValueAPF().isPosZero();
4572 for (
unsigned i = 0; i != NumElems; ++i) {
4575 if (Idx < (
int)NumElems)
4595 for (
unsigned i = 0, e = 2; i != e; ++i)
4598 for (
unsigned i = 2; i != 4; ++i)
4614 *
LD = cast<LoadSDNode>(
N);
4660 if (NumElems != 2 && NumElems != 4)
4662 for (
unsigned i = 0, e = NumElems/2; i != e; ++i)
4665 for (
unsigned i = NumElems/2, e = NumElems; i != e; ++i)
4691 for (
unsigned i = 0; i != NumElems; ++i) {
4693 if (Idx >= (
int)NumElems) {
4700 }
else if (Idx >= 0) {
4716 assert(VT.
isVector() &&
"Expected a vector type");
4732 SDValue Ops[] = { Cst, Cst, Cst, Cst, Cst, Cst, Cst, Cst };
4739 SDValue Ops[] = { Cst, Cst, Cst, Cst, Cst, Cst, Cst, Cst };
4745 SDValue Ops[] = { Cst, Cst, Cst, Cst, Cst, Cst, Cst, Cst,
4746 Cst, Cst, Cst, Cst, Cst, Cst, Cst, Cst };
4760 assert(VT.
isVector() &&
"Expected a vector type");
4766 SDValue Ops[] = { Cst, Cst, Cst, Cst, Cst, Cst, Cst, Cst };
4784 for (
unsigned i = 0; i != NumElems; ++i) {
4785 if (Mask[i] > (
int)NumElems) {
4798 for (
unsigned i = 1; i != NumElems; ++i)
4808 for (
unsigned i = 0, e = NumElems/2; i != e; ++i) {
4820 for (
unsigned i = 0, Half = NumElems/2; i != Half; ++i) {
4836 while (NumElems > 4) {
4837 if (EltNo < NumElems/2) {
4841 EltNo -= NumElems/2;
4855 int SplatMask[4] = { EltNo, EltNo, EltNo, EltNo };
4862 int SplatMask[8] = { EltNo, EltNo, EltNo, EltNo,
4863 EltNo+4, EltNo+4, EltNo+4, EltNo+4 };
4884 assert(((SrcVT.
is128BitVector() && NumElems > 4) || Is256BitVec) &&
4885 "Unknown how to promote splat for type");
4891 if (EltNo >= NumElems/2)
4892 EltNo -= NumElems/2;
4926 for (
unsigned i = 0; i != NumElems; ++i)
4928 MaskVec.
push_back(i == Idx ? NumElems : i);
4944 DecodeSHUFPMask(VT, cast<ConstantSDNode>(ImmN)->getZExtValue(), Mask);
4965 DecodePSHUFMask(VT, cast<ConstantSDNode>(ImmN)->getZExtValue(), Mask);
4989 for (
unsigned i = 1; i != NumElems; ++i) {
4997 if (Mask.
empty())
return false;
5026 int Elt = SV->getMaskElt(Index);
5047 int Elt = ShuffleMask[Index];
5082 unsigned NumElems,
bool ZerosFromLeft,
5084 unsigned PreferredNum = -1U) {
5085 unsigned NumZeros = 0;
5086 for (
unsigned i = 0; i != NumElems; ++i) {
5087 unsigned Index = ZerosFromLeft ? i : NumElems - i - 1;
5095 NumZeros = std::min(NumZeros + 1, PreferredNum);
5108 unsigned MaskI,
unsigned MaskE,
unsigned OpIdx,
5109 unsigned NumElems,
unsigned &OpNum) {
5110 bool SeenV1 =
false;
5111 bool SeenV2 =
false;
5113 for (
unsigned i = MaskI; i != MaskE; ++i, ++OpIdx) {
5119 if (Idx < (
int)NumElems)
5125 if ((Idx % NumElems != OpIdx) || (SeenV1 && SeenV2))
5129 OpNum = SeenV1 ? 0 : 1;
5136 bool &isLeft,
SDValue &ShVal,
unsigned &ShAmt) {
5140 SVOp, NumElems,
false , DAG,
5171 bool &isLeft,
SDValue &ShVal,
unsigned &ShAmt) {
5175 SVOp, NumElems,
true , DAG,
5176 NumElems - SVOp->
getMaskElt(NumElems - 1) - 1);
5206 bool &isLeft,
SDValue &ShVal,
unsigned &ShAmt) {
5222 unsigned NumNonZero,
unsigned NumZero,
5232 for (
unsigned i = 0; i < 16; ++i) {
5233 bool ThisIsNonZero = (NonZeros & (1 << i)) != 0;
5234 if (ThisIsNonZero && First) {
5243 SDValue ThisElt(0, 0), LastElt(0, 0);
5244 bool LastIsNonZero = (NonZeros & (1 << (i-1))) != 0;
5245 if (LastIsNonZero) {
5249 if (ThisIsNonZero) {
5258 if (ThisElt.getNode())
5270 unsigned NumNonZero,
unsigned NumZero,
5280 for (
unsigned i = 0; i < 8; ++i) {
5281 bool isNonZero = (NonZeros & (1 << i)) != 0;
5309 DAG.
getNode(Opc, dl, ShVT, SrcOp,
5324 EVT PVT =
LD->getValueType(0);
5331 FI = FINode->getIndex();
5335 FI = cast<FrameIndexSDNode>(Ptr.
getOperand(0))->getIndex();
5363 if ((Offset % RequiredAlign) & 3)
5365 int64_t StartOffset = Offset & ~(RequiredAlign-1);
5370 int EltNo = (Offset - StartOffset) >> 2;
5375 LD->getPointerInfo().getWithOffset(StartOffset),
5376 false,
false,
false, 0);
5379 for (
unsigned i = 0; i != NumElems; ++i)
5400 unsigned NumElems = Elts.
size();
5403 unsigned LastLoadedElt = -1U;
5408 for (
unsigned i = 0; i < NumElems; ++i) {
5417 LDBase = cast<LoadSDNode>(Elt.
getNode());
5433 if (LastLoadedElt == NumElems - 1) {
5456 if (NumElems == 4 && LastLoadedElt == 1 &&
5500 "Unsupported vector type for broadcast.");
5571 if (ConstSplatVal && Subtarget->
hasInt256()) {
5573 assert(!CVT.
isVector() &&
"Must not broadcast a vector type");
5576 if (ScalarSize == 32 || (IsGE256 && ScalarSize == 64)) {
5579 C = CI->getConstantIntValue();
5581 C = CF->getConstantFPValue();
5583 assert(C &&
"Invalid constant type");
5587 unsigned Alignment = cast<ConstantPoolSDNode>(CP)->getAlignment();
5590 false,
false,
false, Alignment);
5600 if (!IsLoad && Subtarget->
hasInt256() &&
5601 (ScalarSize == 32 || (IsGE256 && ScalarSize == 64)))
5608 if (ScalarSize == 32 || (IsGE256 && ScalarSize == 64))
5614 if (ScalarSize == 8 || ScalarSize == 16 || ScalarSize == 64)
5638 for (
unsigned i = 0; i != NumElems; ++i) {
5646 if (InsertIndices.
size() > 1)
5661 if (!isa<ConstantSDNode>(ExtIdx))
5665 VecIn1 = ExtractedFromVec;
5666 else if (VecIn1 != ExtractedFromVec) {
5668 VecIn2 = ExtractedFromVec;
5669 else if (VecIn2 != ExtractedFromVec)
5674 unsigned Idx = cast<ConstantSDNode>(ExtIdx)->getZExtValue();
5676 if (ExtractedFromVec == VecIn1)
5678 else if (ExtractedFromVec == VecIn2)
5679 Mask[i] = Idx + NumElems;
5687 for (
unsigned i = 0, e = InsertIndices.
size(); i != e; ++i) {
5688 unsigned Idx = InsertIndices[i];
5702 "Unexpected type in LowerBUILD_VECTORvXi1!");
5707 SDValue Ops[] = { Cst, Cst, Cst, Cst, Cst, Cst, Cst, Cst,
5708 Cst, Cst, Cst, Cst, Cst, Cst, Cst, Cst };
5715 SDValue Ops[] = { Cst, Cst, Cst, Cst, Cst, Cst, Cst, Cst,
5716 Cst, Cst, Cst, Cst, Cst, Cst, Cst, Cst };
5721 bool AllContants =
true;
5722 uint64_t Immediate = 0;
5723 for (
unsigned idx = 0, e = Op.
getNumOperands(); idx < e; ++idx) {
5727 if (!isa<ConstantSDNode>(In)) {
5728 AllContants =
false;
5731 if (cast<ConstantSDNode>(In)->getZExtValue())
5732 Immediate |= (1ULL << idx);
5760 EFLAGS = EmitCmp(Op0, Op1, X86CCVal, DAG);
5761 EFLAGS = ConvertCmpIfNecessary(EFLAGS, DAG);
5786 Cst0, Cst1, X86CC, EFLAGS);
5794 Cst0, Cst1, X86CC, EFLAGS);
5811 return LowerBUILD_VECTORvXi1(Op, DAG);
5840 unsigned NumZero = 0;
5841 unsigned NumNonZero = 0;
5842 unsigned NonZeros = 0;
5843 bool IsAllConstants =
true;
5845 for (
unsigned i = 0; i < NumElems; ++i) {
5852 IsAllConstants =
false;
5856 NonZeros |= (1 << i);
5862 if (NumNonZero == 0)
5866 if (NumNonZero == 1) {
5876 (!IsAllConstants || Idx == 0)) {
5879 assert(VT ==
MVT::v2i64 &&
"Expected an SSE value type!");
5881 unsigned VecElts = 4;
5894 for (
unsigned i = 1; i != VecElts; ++i)
5939 if (NumElems == 2 && Idx == 1 &&
5946 NumBits/2, DAG, *
this, dl);
5957 if (EVTBits == 32) {
5963 for (
unsigned i = 0; i != NumElems; ++i)
5970 if (Values.
size() == 1) {
5971 if (EVTBits == 32) {
5993 for (
unsigned i = 0; i != NumElems; ++i)
6008 if (EVTBits == 64) {
6009 if (NumNonZero == 1) {
6020 if (EVTBits == 8 && NumElems == 16) {
6026 if (EVTBits == 16 && NumElems == 8) {
6034 if (NumElems == 4 && NumZero > 0) {
6035 for (
unsigned i = 0; i < 4; ++i) {
6036 bool isZero = !(NonZeros & (1 << i));
6043 for (
unsigned i = 0; i < 2; ++i) {
6044 switch ((NonZeros & (0x3 << i*2)) >> (i*2)) {
6050 V[i] =
getMOVL(DAG, dl, VT, V[i*2+1], V[i*2]);
6053 V[i] =
getMOVL(DAG, dl, VT, V[i*2], V[i*2+1]);
6056 V[i] =
getUnpackl(DAG, dl, VT, V[i*2], V[i*2+1]);
6061 bool Reverse1 = (NonZeros & 0x3) == 2;
6062 bool Reverse2 = ((NonZeros & (0x3 << 2)) >> 2) == 2;
6066 static_cast<int>(Reverse2 ? NumElems+1 : NumElems),
6067 static_cast<int>(Reverse2 ? NumElems : NumElems+1)
6074 for (
unsigned i = 0; i < NumElems; ++i)
6095 for (
unsigned i = 1; i < NumElems; ++i) {
6106 for (
unsigned i = 0; i < NumElems; ++i) {
6117 unsigned EltStride = NumElems >> 1;
6118 while (EltStride != 0) {
6119 for (
unsigned i = 0; i < EltStride; ++i) {
6125 if (V[i+EltStride].getOpcode() ==
ISD::UNDEF &&
6126 EltStride == NumElems/2)
6129 V[i] =
getUnpackl(DAG, dl, VT, V[i], V[i + EltStride]);
6145 ResVT.
is512BitVector()) &&
"Value type must be 256-/512-bit wide");
6185 unsigned MaskValue = 0;
6187 unsigned NumLanes = (NumElems-1)/8 + 1;
6188 unsigned NumElemsInLane = NumElems / NumLanes;
6191 for (
unsigned i = 0; i < NumElemsInLane; ++i) {
6193 int SndLaneEltIdx = (NumLanes == 2) ?
6197 if ((EltIdx < 0 || EltIdx == (
int)i) &&
6198 (SndLaneEltIdx < 0 || SndLaneEltIdx == (
int)(i + NumElemsInLane)))
6201 if (((
unsigned)EltIdx == (i + NumElems)) &&
6202 (SndLaneEltIdx < 0 ||
6203 (
unsigned)SndLaneEltIdx == i + NumElems + NumElemsInLane))
6204 MaskValue |= (1<<i);
6241 unsigned LoQuad[] = { 0, 0, 0, 0 };
6242 unsigned HiQuad[] = { 0, 0, 0, 0 };
6243 std::bitset<4> InputQuads;
6244 for (
unsigned i = 0; i < 8; ++i) {
6245 unsigned *Quad = i < 4 ? LoQuad : HiQuad;
6256 InputQuads.set(EltIdx / 4);
6259 int BestLoQuad = -1;
6260 unsigned MaxQuad = 1;
6261 for (
unsigned i = 0; i < 4; ++i) {
6262 if (LoQuad[i] > MaxQuad) {
6264 MaxQuad = LoQuad[i];
6268 int BestHiQuad = -1;
6270 for (
unsigned i = 0; i < 4; ++i) {
6271 if (HiQuad[i] > MaxQuad) {
6273 MaxQuad = HiQuad[i];
6281 bool V1Used = InputQuads[0] || InputQuads[1];
6282 bool V2Used = InputQuads[2] || InputQuads[3];
6284 if (InputQuads.count() == 2 && V1Used && V2Used) {
6285 BestLoQuad = InputQuads[0] ? 0 : 1;
6286 BestHiQuad = InputQuads[2] ? 2 : 3;
6288 if (InputQuads.count() > 2) {
6298 if (BestLoQuad >= 0 || BestHiQuad >= 0) {
6300 BestLoQuad < 0 ? 0 : BestLoQuad,
6301 BestHiQuad < 0 ? 1 : BestHiQuad
6310 bool AllWordsInNewV =
true;
6311 bool InOrder[2] = {
true,
true };
6312 for (
unsigned i = 0; i != 8; ++i) {
6313 int idx = MaskVals[i];
6315 InOrder[i/4] =
false;
6316 if (idx < 0 || (idx/4) == BestLoQuad || (idx/4) == BestHiQuad)
6318 AllWordsInNewV =
false;
6322 bool pshuflw = AllWordsInNewV, pshufhw = AllWordsInNewV;
6323 if (AllWordsInNewV) {
6324 for (
int i = 0; i != 8; ++i) {
6325 int idx = MaskVals[i];
6328 idx = MaskVals[i] = (idx / 4) == BestLoQuad ? (idx & 3) : (idx & 3) + 4;
6329 if ((idx != i) && idx < 4)
6331 if ((idx != i) && idx > 3)
6342 if ((pshufhw && InOrder[0]) || (pshuflw && InOrder[1])) {
6344 unsigned TargetMask = 0;
6370 bool TwoInputs = V1Used && V2Used;
6371 for (
unsigned i = 0; i != 8; ++i) {
6372 int EltIdx = MaskVals[i] * 2;
6373 int Idx0 = (TwoInputs && (EltIdx >= 16)) ? 0x80 : EltIdx;
6374 int Idx1 = (TwoInputs && (EltIdx >= 16)) ? 0x80 : EltIdx+1;
6388 for (
unsigned i = 0; i != 8; ++i) {
6389 int EltIdx = MaskVals[i] * 2;
6390 int Idx0 = (EltIdx < 16) ? 0x80 : EltIdx - 16;
6391 int Idx1 = (EltIdx < 16) ? 0x80 : EltIdx - 15;
6405 std::bitset<8> InOrder;
6406 if (BestLoQuad >= 0) {
6407 int MaskV[] = { -1, -1, -1, -1, 4, 5, 6, 7 };
6408 for (
int i = 0; i != 4; ++i) {
6409 int idx = MaskVals[i];
6412 }
else if ((idx / 4) == BestLoQuad) {
6430 if (BestHiQuad >= 0) {
6431 int MaskV[] = { 0, 1, 2, 3, -1, -1, -1, -1 };
6432 for (
unsigned i = 4; i != 8; ++i) {
6433 int idx = MaskVals[i];
6436 }
else if ((idx / 4) == BestHiQuad) {
6437 MaskV[i] = (idx & 3) + 4;
6455 if (BestLoQuad == -1 && BestHiQuad == -1) {
6457 for (
int i = 0; i != 8; ++i)
6458 if (MaskVals[i] < 0 || MaskVals[i] == i)
6463 for (
unsigned i = 0; i != 8; ++i) {
6466 int EltIdx = MaskVals[i];
6469 SDValue ExtOp = (EltIdx < 8) ?
6512 for (
unsigned i = 0; i != 16; ++i) {
6513 int EltIdx = MaskVals[i];
6514 if (EltIdx < 0 || EltIdx >= 16)
6531 for (
unsigned i = 0; i != 16; ++i) {
6532 int EltIdx = MaskVals[i];
6533 EltIdx = (EltIdx < 16) ? 0x80 : EltIdx - 16;
6548 for (
int i = 0; i != 8; ++i) {
6549 int Elt0 = MaskVals[i*2];
6550 int Elt1 = MaskVals[i*2+1];
6553 if (Elt0 < 0 && Elt1 < 0)
6557 if ((Elt0 == i*2) && (Elt1 == i*2+1))
6566 if ((Elt0 >= 0) && ((Elt0 + 1) == Elt1) && ((Elt0 & 1) == 0)) {
6580 if ((Elt1 & 1) == 0)
6595 if ((Elt0 & 1) != 0)
6631 (!V2IsUndef && !V2IsAllZero && !V1IsAllZero))
6634 if (V1IsAllZero && !V2IsAllZero) {
6639 for (
unsigned i = 0; i != 32; i++) {
6640 int EltIdx = MaskVals[i];
6641 if (EltIdx < 0 || EltIdx >= 32)
6644 if ((EltIdx >= 16 && i < 16) || (EltIdx < 16 && i >= 16))
6680 for (
unsigned i = 0; i != NumElems; i += Scale) {
6682 for (
unsigned j = 0; j != Scale; ++j) {
6687 StartIdx = (EltIdx / Scale);
6688 if (EltIdx != (
int)(StartIdx*Scale + j))
6746 unsigned NumLaneElems = NumElems / 2;
6754 for (
unsigned l = 0; l < 2; ++l) {
6759 bool UseBuildVector =
false;
6760 int InputUsed[2] = { -1, -1 };
6761 unsigned LaneStart = l * NumLaneElems;
6762 for (
unsigned i = 0; i != NumLaneElems; ++i) {
6772 int Input = Idx / NumLaneElems;
6775 Idx -= Input * NumLaneElems;
6780 if (InputUsed[OpNo] == Input)
6783 if (InputUsed[OpNo] < 0) {
6785 InputUsed[OpNo] = Input;
6793 UseBuildVector =
true;
6798 Mask.
push_back(Idx + OpNo * NumLaneElems);
6801 if (UseBuildVector) {
6803 for (
unsigned i = 0; i != NumLaneElems; ++i) {
6812 int Input = Idx / NumElems;
6815 Idx -= Input * NumElems;
6826 }
else if (InputUsed[0] < 0) {
6831 (InputUsed[0] % 2) * NumLaneElems,
6836 (InputUsed[1] % 2) * NumLaneElems, DAG, dl);
6859 std::pair<int, int> Locs[4];
6860 int Mask1[] = { -1, -1, -1, -1 };
6865 for (
unsigned i = 0; i != 4; ++i) {
6866 int Idx = PermMask[i];
6868 Locs[i] = std::make_pair(-1, -1);
6870 assert(Idx < 8 &&
"Invalid VECTOR_SHUFFLE index!");
6872 Locs[i] = std::make_pair(0, NumLo);
6876 Locs[i] = std::make_pair(1, NumHi);
6878 Mask1[2+NumHi] = Idx;
6884 if (NumLo <= 2 && NumHi <= 2) {
6891 int Mask2[] = { -1, -1, -1, -1 };
6893 for (
unsigned i = 0; i != 4; ++i)
6894 if (Locs[i].first != -1) {
6895 unsigned Idx = (i < 2) ? 0 : 4;
6896 Idx += Locs[i].first * 2 + Locs[i].second;
6903 if (NumLo == 3 || NumHi == 3) {
6919 for (HiIndex = 0; HiIndex < 3; ++HiIndex) {
6920 int Val = PermMask[HiIndex];
6927 Mask1[0] = PermMask[HiIndex];
6929 Mask1[2] = PermMask[HiIndex^1];
6934 Mask1[0] = PermMask[0];
6935 Mask1[1] = PermMask[1];
6936 Mask1[2] = HiIndex & 1 ? 6 : 4;
6937 Mask1[3] = HiIndex & 1 ? 4 : 6;
6941 Mask1[0] = HiIndex & 1 ? 2 : 0;
6942 Mask1[1] = HiIndex & 1 ? 0 : 2;
6943 Mask1[2] = PermMask[2];
6944 Mask1[3] = PermMask[3];
6953 int LoMask[] = { -1, -1, -1, -1 };
6954 int HiMask[] = { -1, -1, -1, -1 };
6956 int *MaskPtr = LoMask;
6957 unsigned MaskIdx = 0;
6960 for (
unsigned i = 0; i != 4; ++i) {
6967 int Idx = PermMask[i];
6969 Locs[i] = std::make_pair(-1, -1);
6970 }
else if (Idx < 4) {
6971 Locs[i] = std::make_pair(MaskIdx, LoIdx);
6972 MaskPtr[LoIdx] = Idx;
6975 Locs[i] = std::make_pair(MaskIdx, HiIdx);
6976 MaskPtr[HiIdx] = Idx;
6983 int MaskOps[] = { -1, -1, -1, -1 };
6984 for (
unsigned i = 0; i != 4; ++i)
6985 if (Locs[i].first != -1)
6986 MaskOps[i] = Locs[i].first * 4 + Locs[i].second;
7022 assert(VT !=
MVT::v2i64 &&
"unsupported shuffle type");
7041 "unsupported shuffle type");
7061 bool CanFoldLoad =
false;
7077 if (HasSSE2 && NumElems == 2)
7100 assert(VT !=
MVT::v4i32 &&
"unsupported shuffle type");
7134 while ((1U << Shift) < NumElems) {
7144 unsigned Mask = (1U << Shift) - 1;
7145 for (
unsigned i = 0; i != NumElems; ++i) {
7147 if ((i & Mask) != 0 && EltIdx != -1)
7149 if ((i & Mask) == 0 && (
unsigned)EltIdx != (i >> Shift))
7236 NewVT,
true,
false))
7238 DAG, Subtarget, dl);
7244 if (
isMOVLMask(cast<ShuffleVectorSDNode>(NewOp)->getMask(), NewVT))
7246 DAG, Subtarget, dl);
7261 bool V1IsUndef = V1.getOpcode() ==
ISD::UNDEF;
7263 bool V1IsSplat =
false;
7264 bool V2IsSplat =
false;
7265 bool HasSSE2 = Subtarget->
hasSSE2();
7266 bool HasFp256 = Subtarget->
hasFp256();
7267 bool HasInt256 = Subtarget->
hasInt256();
7272 assert(VT.
getSizeInBits() != 64 &&
"Can't lower MMX shuffles");
7274 if (V1IsUndef && V2IsUndef)
7277 assert(!V1IsUndef &&
"Op 1 of shuffle should not be undef");
7317 if (HasSSE2 &&
isUNPCKHMask(M, VT, HasInt256) && V2IsUndef &&
7347 bool isLeft =
false;
7356 return getVShift(isLeft, VT, ShVal, ShAmt, DAG, *
this, dl);
7385 return getMOVLP(Op, dl, DAG, HasSSE2);
7395 return getVShift(isLeft, VT, ShVal, ShAmt, DAG, *
this, dl);
7398 bool Commuted =
false;
7405 if (!V2IsUndef && V1IsSplat && !V2IsSplat) {
7419 return getMOVL(DAG, dl, VT, V2, V1);
7519 if ((V2IsUndef && HasInt256 && VT.is256BitVector() && NumElems == 8) ||
7520 VT.is512BitVector()) {
7524 for (
unsigned i = 0; i != NumElems; ++i) {
7529 &permclMask[0], NumElems);
7565 if (NumElems == 4 && VT.is128BitVector())
7569 if (VT.is256BitVector())
7591 unsigned Idx = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
7618 cast<ConstantSDNode>(Op.
getOperand(1))->isNullValue())) &&
7638 X86TargetLowering::LowerEXTRACT_VECTOR_ELT(
SDValue Op,
7644 if (!isa<ConstantSDNode>(Idx)) {
7669 unsigned IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
7678 IdxVal -= (IdxVal/ElemsPerChunk)*ElemsPerChunk;
7695 unsigned Idx = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
7712 unsigned Idx = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
7717 int Mask[4] = {
static_cast<int>(Idx), -1, -1, -1 };
7729 unsigned Idx = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
7736 int Mask[2] = { 1, -1 };
7760 isa<ConstantSDNode>(N2)) {
7775 return DAG.
getNode(Opc, dl, VT, N0, N1, N2);
7778 if (EltVT ==
MVT::f32 && isa<ConstantSDNode>(N2)) {
7813 if (!isa<ConstantSDNode>(N2))
7817 unsigned IdxVal = cast<ConstantSDNode>(N2)->getZExtValue();
7822 unsigned IdxIn128 = IdxVal - (IdxVal/NumEltsIn128) * NumEltsIn128;
7837 if (EltVT.
getSizeInBits() == 16 && isa<ConstantSDNode>(N2)) {
7885 unsigned IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
7892 isa<ConstantSDNode>(Idx)) {
7896 isa<ConstantSDNode>(Idx)) {
7917 isa<ConstantSDNode>(Idx)) {
7918 unsigned IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
7924 isa<ConstantSDNode>(Idx)) {
7925 unsigned IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
7944 unsigned char OpFlag = 0;
7977 unsigned char OpFlag = 0;
8006 const char *Sym = cast<ExternalSymbolSDNode>(Op)->getSymbol();
8010 unsigned char OpFlag = 0;
8053 unsigned char OpFlags =
8056 const BlockAddress *BA = cast<BlockAddressSDNode>(Op)->getBlockAddress();
8057 int64_t Offset = cast<BlockAddressSDNode>(Op)->getOffset();
8083 unsigned char OpFlags =
8126 const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
8127 int64_t Offset = cast<GlobalAddressSDNode>(Op)->getOffset();
8128 return LowerGlobalAddress(GV,
SDLoc(Op), Offset, DAG);
8133 SDValue *InFlag,
const EVT PtrVT,
unsigned ReturnReg,
8147 SDValue Ops[] = { Chain, TGA, *InFlag };
8150 SDValue Ops[] = { Chain, TGA };
8169 SDLoc(), PtrVT), InFlag);
8225 bool is64Bit,
bool isPIC) {
8230 is64Bit ? 257 : 256));
8262 if (isPIC && !is64Bit) {
8305 unsigned char OpFlag = 0;
8334 SDValue Args[] = { Chain, Offset };
8362 if (
const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
8363 GV = GA->resolveAliasedGlobal(
false);
8382 false,
false,
false, 0);
8392 false,
false,
false, 0);
8400 false,
false,
false, 0);
8447 SDValue Ops0[4] = { Tmp2, Tmp3, CC, Cond };
8448 SDValue Ops1[4] = { Tmp3, Tmp1, CC, Cond };
8470 "Unknown SINT_TO_FP to lower!");
8490 return BuildFILD(Op, SrcVT, Chain, StackSlot, DAG);
8516 MMO = cast<LoadSDNode>(StackSlot)->getMemOperand();
8550 false,
false,
false, 0);
8576 static const uint32_t CV0[] = { 0x43300000, 0x45300000, 0, 0 };
8583 APInt(64, 0x4330000000000000ULL))));
8586 APInt(64, 0x4530000000000000ULL))));
8595 false,
false,
false, 16);
8602 false,
false,
false, 16);
8678 "Custom UINT_TO_FP is not supported!");
8692 return lowerUINT_TO_FP_vec(Op, DAG);
8703 return LowerUINT_TO_FP_i64(Op, DAG);
8704 if (SrcVT ==
MVT::i32 && X86ScalarSSEf64)
8705 return LowerUINT_TO_FP_i32(Op, DAG);
8725 assert(SrcVT ==
MVT::i64 &&
"Unexpected type in UINT_TO_FP");
8734 int SSFI = cast<FrameIndexSDNode>(StackSlot)->getIndex();
8745 APInt FF(32, 0x5F800000ULL);
8775 std::pair<SDValue,SDValue>
8777 bool IsSigned,
bool IsReplace)
const {
8783 assert(DstTy ==
MVT::i32 &&
"Unexpected FP_TO_UINT");
8789 "Unknown FP_TO_INT to lower!");
8824 assert(DstTy ==
MVT::i64 &&
"Invalid FP_TO_SINT to lower!");
8825 Chain = DAG.
getStore(Chain, DL, Value, StackSlot,
8849 SDValue Ops[] = { Chain, Value, StackSlot };
8853 return std::make_pair(FIST, StackSlot);
8866 return std::make_pair(pair,
SDValue());
8920 if (NumElts != 8 && NumElts != 16)
8933 unsigned Alignment = cast<ConstantPoolSDNode>(CP)->getAlignment();
8936 false,
false,
false, Alignment);
8982 "Invalid TRUNCATE operation");
8990 assert ((NumElts == 8 || NumElts == 16) &&
"Unexpected vector type");
8999 unsigned Alignment = cast<ConstantPoolSDNode>(CP)->getAlignment();
9002 false,
false,
false, Alignment);
9011 static const int ShufMask[] = {0, 2, 4, 6, -1, -1, -1, -1};
9029 static const int ShufMask1[] = {0, 2, 0, 0};
9035 static const int ShufMask2[] = {0, 1, 4, 5};
9045 for (
unsigned i = 0; i < 2; ++i) {
9054 for (
unsigned j = 0; j < 8; ++j)
9058 &pshufbMask[0], 32);
9062 static const int ShufMask[] = {0, 2, -1, -1};
9080 static const int ShufMask1[] = {0, 1, 4, 5, 8, 9, 12, 13,
9081 -1, -1, -1, -1, -1, -1, -1, -1};
9091 static const int ShufMask2[] = {0, 1, 4, 5};
9100 assert(Subtarget->
hasFp256() &&
"256-bit vector without AVX!");
9108 for (
unsigned i = 0; i != NumElems; ++i)
9128 std::pair<SDValue,SDValue> Vals = FP_TO_INTHelper(Op, DAG,
9130 SDValue FIST = Vals.first, StackSlot = Vals.second;
9132 if (FIST.
getNode() == 0)
return Op;
9138 false,
false,
false, 0);
9146 std::pair<SDValue,SDValue> Vals = FP_TO_INTHelper(Op, DAG,
9148 SDValue FIST = Vals.first, StackSlot = Vals.second;
9149 assert(FIST.
getNode() &&
"Unexpected failure");
9155 false,
false,
false, 0);
9167 assert(SVT ==
MVT::v2f32 &&
"Only customize MVT::v2f32 type legalization!");
9179 unsigned NumElts = VT ==
MVT::f64 ? 2 : 4;
9187 APInt(64, ~(1ULL << 63))));
9190 APInt(32, ~(1U << 31))));
9193 unsigned Alignment = cast<ConstantPoolSDNode>(CPIdx)->getAlignment();
9196 false,
false,
false, Alignment);
9213 unsigned NumElts = VT ==
MVT::f64 ? 2 : 4;
9221 APInt(64, 1ULL << 63)));
9224 APInt(32, 1U << 31)));
9227 unsigned Alignment = cast<ConstantPoolSDNode>(CPIdx)->getAlignment();
9230 false,
false,
false, Alignment);
9282 false,
false,
false, 16);
9301 APInt(64, ~(1ULL << 63)))));
9306 APInt(32, ~(1U << 31)))));
9315 false,
false,
false, 16);
9357 for (
unsigned Slot = 0, e = Opnds.
size(); Slot < e; ++Slot) {
9360 if (I->getOpcode() ==
ISD::OR) {
9373 SDValue Idx = I->getOperand(1);
9374 if (!isa<ConstantSDNode>(Idx))
9377 SDValue ExtractedFromVec = I->getOperand(0);
9379 if (M == VecInMap.
end()) {
9385 if (VecInMap.
begin() != VecInMap.
end() &&
9386 VT != VecInMap.
begin()->first.getValueType())
9388 M = VecInMap.
insert(std::make_pair(ExtractedFromVec, 0)).first;
9390 M->second |= 1U << cast<ConstantSDNode>(Idx)->getZExtValue();
9394 "Not extracted from 128-/256-bit vector.");
9400 I = VecInMap.
begin(), E = VecInMap.
end();
I != E; ++
I) {
9402 if (
I->second != FullMask)
9410 for (
unsigned i = 0, e = VecIns.
size(); i < e; ++i)
9414 for (
unsigned Slot = 0, e = VecIns.
size(); e - Slot > 1; Slot += 2, e += 1) {
9418 SDValue RHS = VecIns[Slot + 1];
9434 bool NeedCF =
false;
9435 bool NeedOF =
false;
9452 if (Op.
getResNo() != 0 || NeedOF || NeedCF)
9457 unsigned Opcode = 0;
9458 unsigned NumOperands = 0;
9463 bool NeedTruncation =
false;
9476 NeedTruncation =
true;
9507 if (C->getAPIntValue() == 1) {
9528 bool NonFlagUse =
false;
9532 unsigned UOpNo = UI.getOperandNo();
9595 if (NeedTruncation) {
9599 unsigned ConvertedOp = 0;
9617 Op = DAG.
getNode(ConvertedOp, dl, VT, V0, V1);
9629 for (
unsigned i = 0; i != NumOperands; ++i)
9632 SDValue New = DAG.
getNode(Opcode, dl, VTs, &Ops[0], NumOperands);
9642 if (C->getAPIntValue() == 0)
9643 return EmitTest(Op0, X86CC, DAG);
9702 if (And00C->getZExtValue() == 1) {
9707 if (BitWidth > AndBitWidth) {
9773 switch (SetCCOpcode) {
9808 "Unsupported value type for operation");
9840 "Cannot set masked compare for this operation");
9842 ISD::CondCode SetCCOpcode = cast<CondCodeSDNode>(CC)->
get();
9847 switch (SetCCOpcode) {
9861 return DAG.
getNode(Opc, dl, VT, Op0, Op1,
9872 ISD::CondCode SetCCOpcode = cast<CondCodeSDNode>(CC)->
get();
9891 unsigned CombineOpc;
9893 CC0 = 3; CC1 = 0; CombineOpc =
ISD::OR;
9896 CC0 = 7; CC1 = 4; CombineOpc =
ISD::AND;
9903 return DAG.
getNode(CombineOpc, dl, VT, Cmp0, Cmp1);
9906 return DAG.
getNode(Opc, dl, VT, Op0, Op1,
9936 bool Swap =
false, Invert =
false, FlipSigns =
false, MinMax =
false;
9938 switch (SetCCOpcode) {
9946 Invert =
true;
break;
9949 FlipSigns =
true;
break;
9952 FlipSigns =
true; Invert =
true;
break;
9962 switch (SetCCOpcode) {
9968 if (MinMax) { Swap =
false; Invert =
false; FlipSigns =
false; }
9978 assert(Subtarget->
hasSSE2() &&
"Don't know how to lower!");
9994 Sign, Zero, Sign, Zero);
10004 static const int MaskHi[] = { 1, 1, 3, 3 };
10005 static const int MaskLo[] = { 0, 0, 2, 2 };
10022 assert(Subtarget->
hasSSE2() && !FlipSigns &&
"Don't know how to lower!");
10032 static const int Mask[] = { 1, 0, 3, 2 };
10056 Result = DAG.
getNOT(dl, Result, VT);
10070 assert(VT ==
MVT::i8 &&
"SetCC type must be 8-bit integer");
10082 cast<ConstantSDNode>(Op1)->isNullValue() &&
10084 SDValue NewSetCC = LowerToBT(Op0, CC, dl, DAG);
10092 (cast<ConstantSDNode>(Op1)->getZExtValue() == 1 ||
10093 cast<ConstantSDNode>(Op1)->isNullValue()) &&
10101 cast<ConstantSDNode>(Op1)->isNullValue();
10102 if (!Invert)
return Op0;
10115 SDValue EFLAGS = EmitCmp(Op0, Op1, X86CC, DAG);
10116 EFLAGS = ConvertCmpIfNecessary(EFLAGS, DAG);
10163 bool addTest =
true;
10180 cast<CondCodeSDNode>(Cond.
getOperand(2))->
get(), CondOp0, CondOp1);
10193 SDValue NewCond = LowerSETCC(Cond, DAG);
10218 if (YC->isNullValue() &&
10232 Cmp = ConvertCmpIfNecessary(Cmp, DAG);
10258 unsigned CondOpcode = Cond.
getOpcode();
10267 bool IllegalFPCMov =
false;
10270 IllegalFPCMov = !
hasFPCMov(cast<ConstantSDNode>(CC)->getSExtValue());
10283 unsigned X86Opcode;
10286 switch (CondOpcode) {
10339 Cond = ConvertCmpIfNecessary(Cond, DAG);
10340 unsigned CondCode = cast<ConstantSDNode>(CC)->getZExtValue();
10370 SDValue Ops[] = { Op2, Op1, CC, Cond };
10381 if (NumElts != 8 && NumElts != 16)
10395 unsigned Alignment = cast<ConstantPoolSDNode>(CP)->getAlignment();
10398 false,
false,
false, Alignment);
10436 for (
unsigned i = 0; i != NumElems/2; ++i)
10442 for (
unsigned i = 0; i != NumElems/2; ++i)
10443 ShufMask2[i] = i + NumElems/2;
10483 bool addTest =
true;
10489 bool Inverted =
false;
10495 cast<ConstantSDNode>(Cond.
getOperand(1))->isNullValue() &&
10506 SDValue NewCond = LowerSETCC(Cond, DAG);
10530 unsigned CondOpcode = Cond.
getOpcode();
10542 switch (cast<ConstantSDNode>(CC)->getZExtValue()) {
10561 unsigned X86Opcode;
10564 switch (CondOpcode) {
10602 Chain, Dest, CC, Cmp);
10628 assert(NewBR == User);
10633 Chain, Dest, CC, Cmp);
10669 assert(NewBR == User);
10675 Cmp = ConvertCmpIfNecessary(Cmp, DAG);
10678 Chain, Dest, CC, Cmp);
10700 assert(NewBR == User);
10705 Cmp = ConvertCmpIfNecessary(Cmp, DAG);
10708 Chain, Dest, CC, Cmp);
10739 Cond = ConvertCmpIfNecessary(Cond, DAG);
10741 Chain, Dest, CC, Cond);
10750 X86TargetLowering::LowerDYNAMIC_STACKALLOC(
SDValue Op,
10754 "This should be used only on Windows targets or when segmented stacks "
10762 unsigned Align = cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue();
10765 bool Is64Bit = Subtarget->
is64Bit();
10779 if (
I->hasNestAttr())
10781 "have nested arguments.");
10790 SDValue Ops1[2] = { Value, Chain };
10814 SDValue Ops1[2] = { SP, Chain };
10823 const Value *SV = cast<SrcValueSDNode>(Op.
getOperand(2))->getValue();
10877 &MemOps[0], MemOps.
size());
10881 assert(Subtarget->
is64Bit() &&
10882 "LowerVAARG only handles 64-bit va_arg!");
10885 "Unhandled target in LowerVAARG");
10889 const Value *SV = cast<SrcValueSDNode>(Op.
getOperand(2))->getValue();
10905 }
else if (ArgVT.
isInteger() && ArgSize <= 32 ) {
10911 if (ArgMode == 2) {
10931 VTs, &InstOps[0], InstOps.
size(),
10941 return DAG.
getLoad(ArgVT, dl,
10945 false,
false,
false, 0);
10951 assert(Subtarget->
is64Bit() &&
"This code only handles 64-bit va_copy!");
10955 const Value *DstSV = cast<SrcValueSDNode>(Op.
getOperand(3))->getValue();
10956 const Value *SrcSV = cast<SrcValueSDNode>(Op.
getOperand(4))->getValue();
10959 return DAG.
getMemcpy(Chain, DL, DstPtr, SrcPtr,
10968 SDValue SrcOp, uint64_t ShiftAmt,
10980 &&
"Unknown target vector shift-by-constant node");
10995 CShAmt->getZExtValue(), DAG);
11019 return DAG.
getNode(Opc, dl, VT, SrcOp, ShAmt);
11024 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
11403 bool IsTestPacked =
false;
11411 IsTestPacked =
true;
11421 IsTestPacked =
true;
11431 IsTestPacked =
true;
11626 return DAG.
getNode(Opcode, dl, VTs, NewOps.
data(), NewOps.size());
11729 assert(C &&
"Invalid scale type");
11734 SDValue MaskInReg = DAG.getConstant(~0, MaskVT);
11738 SDValue Ops[] = {Src, MaskInReg, Base, Scale, Index, Disp, Segment, Chain};
11739 SDNode *Res = DAG.getMachineNode(Opc, dl, VTs, Ops);
11750 assert(C &&
"Invalid scale type");
11760 SDValue Ops[] = {Src, MaskInReg, Base, Scale, Index, Disp, Segment, Chain};
11761 SDNode *Res = DAG.getMachineNode(Opc, dl, VTs, Ops);
11771 assert(C &&
"Invalid scale type");
11779 SDValue Ops[] = {Base, Scale, Index, Disp, Segment, MaskInReg, Src, Chain};
11789 assert(C &&
"Invalid scale type");
11797 SDValue Ops[] = {Base, Scale, Index, Disp, Segment, MaskInReg, Src, Chain};
11805 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
11863 return getGatherNode(Opc, Op, DAG, Base, Index, Scale, Chain, Subtarget);
11878 Opc = X86::VGATHERQPSZrm;
break;
11880 Opc = X86::VGATHERQPDZrm;
break;
11882 Opc = X86::VGATHERDPDZrm;
break;
11884 Opc = X86::VGATHERDPSZrm;
break;
11886 Opc = X86::VPGATHERQDZrm;
break;
11888 Opc = X86::VPGATHERQQZrm;
break;
11890 Opc = X86::VPGATHERDDZrm;
break;
11892 Opc = X86::VPGATHERDQZrm;
break;
11900 return getMGatherNode(Opc, Op, DAG, Src, Mask, Base, Index, Scale, Chain,
11916 Opc = X86::VSCATTERQPDZmr;
break;
11918 Opc = X86::VSCATTERQPSZmr;
break;
11920 Opc = X86::VSCATTERDPDZmr;
break;
11922 Opc = X86::VSCATTERDPSZmr;
break;
11924 Opc = X86::VPSCATTERQDZmr;
break;
11926 Opc = X86::VPSCATTERQQZmr;
break;
11928 Opc = X86::VPSCATTERDQZmr;
break;
11930 Opc = X86::VPSCATTERDDZmr;
break;
11937 return getScatterNode(Opc, Op, DAG, Src, Base, Index, Scale, Chain);
11952 Opc = X86::VSCATTERQPDZmr;
break;
11954 Opc = X86::VSCATTERQPSZmr;
break;
11956 Opc = X86::VSCATTERDPDZmr;
break;
11958 Opc = X86::VSCATTERDPSZmr;
break;
11960 Opc = X86::VPSCATTERQDZmr;
break;
11962 Opc = X86::VPSCATTERQQZmr;
break;
11964 Opc = X86::VPSCATTERDQZmr;
break;
11966 Opc = X86::VPSCATTERDDZmr;
break;
11974 return getMScatterNode(Opc, Op, DAG, Src, Mask, Base, Index, Scale, Chain);
11995 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
12000 SDValue FrameAddr = LowerFRAMEADDR(Op, DAG);
12006 FrameAddr, Offset),
12022 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
12026 assert(((FrameReg == X86::RBP && VT ==
MVT::i64) ||
12028 "Invalid Frame Register!");
12033 false,
false,
false, 0);
12037 SDValue X86TargetLowering::LowerFRAME_TO_ARGS_OFFSET(
SDValue Op,
12054 assert(((FrameReg == X86::RBP && PtrVT ==
MVT::i64) ||
12056 "Invalid Frame Register!");
12065 Chain = DAG.
getCopyToReg(Chain, dl, StoreAddrReg, StoreAddr);
12098 const Value *TrmpAddr = cast<SrcValueSDNode>(Op.
getOperand(4))->getValue();
12105 const unsigned char JMP64r = 0xFF;
12106 const unsigned char MOV64ri = 0xB8;
12111 const unsigned char REX_WB = 0x40 | 0x08 | 0x01;
12114 unsigned OpCode = ((MOV64ri | N86R11) << 8) | REX_WB;
12122 OutChains[1] = DAG.
getStore(Root, dl, FPtr, Addr,
12128 OpCode = ((MOV64ri | N86R10) << 8) | REX_WB;
12137 OutChains[3] = DAG.
getStore(Root, dl, Nest, Addr,
12142 OpCode = (JMP64r << 8) | REX_WB;
12149 unsigned char ModRM = N86R11 | (4 << 3) | (3 << 6);
12159 cast<Function>(cast<SrcValueSDNode>(Op.
getOperand(5))->getValue());
12177 unsigned InRegCount = 0;
12186 if (InRegCount > 2) {
12210 const unsigned char MOV32ri = 0xB8;
12212 OutChains[0] = DAG.
getStore(Root, dl,
12219 OutChains[1] = DAG.
getStore(Root, dl, Nest, Addr,
12223 const unsigned char JMP = 0xE9;
12232 OutChains[3] = DAG.
getStore(Root, dl, Disp, Addr,
12394 "Unsupported value type for operation");
12420 "Only handle AVX 256-bit vector integer operation");
12427 "Only handle AVX 256-bit vector integer operation");
12446 "Should not custom lower when pmuldq is available!");
12449 static const int UnpackMask[] = { 1, -1, 3, -1 };
12463 static const int ShufMask[] = { 0, 4, 2, 6 };
12468 "Only know how to lower V2I64/V4I64/V8I64 multiply");
12515 APInt SplatValue, SplatUndef;
12516 unsigned SplatBitSize;
12523 if ((SplatValue != 0) &&
12524 (SplatValue.
isPowerOf2() || (-SplatValue).isPowerOf2())) {
12615 if (ShiftAmt == 7) {
12661 if (ShiftAmt == 7) {
12690 uint64_t ShiftAmt = 0;
12691 for (
unsigned i = 0; i != Ratio; ++i) {
12696 ShiftAmt |= C->
getZExtValue() << (i * (1 << (6 - RatioInLog2)));
12699 for (
unsigned i = Ratio; i != Amt.
getNumOperands(); i += Ratio) {
12700 uint64_t ShAmt = 0;
12701 for (
unsigned j = 0; j != Ratio; ++j) {
12707 ShAmt |= C->
getZExtValue() << (j * (1 << (6 - RatioInLog2)));
12709 if (ShAmt != ShiftAmt)
12749 for (i = 0; i != NumElts; ++i) {
12754 for (j = i; j != NumElts; ++j) {
12760 if (i != NumElts && j == NumElts)
12766 cast<ShuffleVectorSDNode>(Amt)->isSplat()) {
12771 for (; i != NumElts; ++i) {
12779 dyn_cast<ConstantSDNode>(InVec.
getOperand(2))) {
12780 unsigned SplatIdx =
12781 cast<ShuffleVectorSDNode>(Amt)->getSplatIndex();
12786 if (BaseShAmt.
getNode() == 0)
12851 std::vector<SDValue> Vals(Ratio);
12852 for (
unsigned i = 0; i != Ratio; ++i)
12854 for (
unsigned i = Ratio; i != Amt.
getNumOperands(); i += Ratio) {
12855 for (
unsigned j = 0; j != Ratio; ++j)
12920 assert(Subtarget->
hasSSE2() &&
"Need SSE2 for pslli/pcmpeq.");
12978 for (
unsigned i = 0; i != NumElems/2; ++i)
12980 for (
unsigned i = NumElems/2; i != NumElems; ++i)
12984 &Amt1Csts[0], NumElems/2);
12986 &Amt2Csts[0], NumElems/2);
13012 unsigned BaseOp = 0;
13134 "This optimization is invalid without a VZEXT.");
13151 cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue());
13153 cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue());
13192 case MVT::i16: Reg = X86::AX; size = 2;
break;
13195 assert(Subtarget->
is64Bit() &&
"Node not type legal!");
13196 Reg = X86::RAX; size = 8;
13217 assert(Subtarget->
is64Bit() &&
"Result not type legalized?");
13239 Subtarget->
hasMMX() &&
"Unexpected custom BITCAST");
13242 "Unexpected custom BITCAST");
13262 cast<AtomicSDNode>(Node)->getMemoryVT(),
13265 cast<AtomicSDNode>(Node)->getSrcValue(),
13266 cast<AtomicSDNode>(Node)->getAlignment(),
13267 cast<AtomicSDNode>(Node)->getOrdering(),
13268 cast<AtomicSDNode>(Node)->getSynchScope());
13274 EVT VT = cast<AtomicSDNode>(Node)->getMemoryVT();
13284 cast<AtomicSDNode>(Node)->getMemoryVT(),
13287 cast<AtomicSDNode>(Node)->getMemOperand(),
13288 cast<AtomicSDNode>(Node)->getOrdering(),
13289 cast<AtomicSDNode>(Node)->getSynchScope());
13306 bool ExtraOp =
false;
13341 Args.push_back(Entry);
13347 const char *LibcallName = isF64 ?
"__sincos_stret" :
"__sincosf_stret";
13351 Type *RetTy = isF64
13356 false,
false,
false,
false, 0,
13359 Callee, Args, DAG, dl);
13360 std::pair<SDValue, SDValue> CallResult = TLI.
LowerCallTo(CLI);
13364 return CallResult.first;
13368 CallResult.first, DAG.getIntPtrConstant(0));
13370 CallResult.first, DAG.getIntPtrConstant(1));
13371 SDVTList Tys = DAG.getVTList(ArgVT, ArgVT);
13410 case ISD::FABS:
return LowerFABS(Op, DAG);
13411 case ISD::FNEG:
return LowerFNEG(Op, DAG);
13414 case ISD::SETCC:
return LowerSETCC(Op, DAG);
13419 case ISD::VAARG:
return LowerVAARG(Op, DAG);
13427 return LowerFRAME_TO_ARGS_OFFSET(Op, DAG);
13465 EVT VT = cast<AtomicSDNode>(Node)->getMemoryVT();
13475 cast<AtomicSDNode>(Node)->getMemOperand(),
13476 cast<AtomicSDNode>(Node)->getOrdering(),
13477 cast<AtomicSDNode>(Node)->getSynchScope());
13487 "Only know how to expand i64 atomics");
13495 SDValue Ops[] = { Chain, In1, In2L, In2H };
13499 cast<MemSDNode>(Node)->getMemOperand());
13514 llvm_unreachable(
"Do not know how to custom type legalize this operation!");
13529 std::pair<SDValue,SDValue> Vals =
13530 FP_TO_INTHelper(
SDValue(N, 0), DAG, IsSigned,
true);
13531 SDValue FIST = Vals.first, StackSlot = Vals.second;
13535 if (StackSlot.
getNode() != 0)
13538 false,
false,
false, 0));
13545 assert(Subtarget->
hasSSE2() &&
"Requires at least SSE2!");
13577 SDValue Ops[] = { eax, edx };
13688 default:
return NULL;
13698 case X86ISD::FILD:
return "X86ISD::FILD";
13889 switch (AM.
Scale) {
13917 return NumBits1 > NumBits2;
13948 return NumBits1 > NumBits2;
14102 BuildMI(thisMBB, DL, TII->
get(X86::XBEGIN_4)).addMBB(sinkMBB);
14125 case MVT::i8:
return X86::LCMPXCHG8;
14126 case MVT::i16:
return X86::LCMPXCHG16;
14127 case MVT::i32:
return X86::LCMPXCHG32;
14128 case MVT::i64:
return X86::LCMPXCHG64;
14138 case MVT::i8:
return X86::MOV8rm;
14139 case MVT::i16:
return X86::MOV16rm;
14140 case MVT::i32:
return X86::MOV32rm;
14141 case MVT::i64:
return X86::MOV64rm;
14151 case X86::ATOMAND8:
return X86::AND8rr;
14152 case X86::ATOMAND16:
return X86::AND16rr;
14153 case X86::ATOMAND32:
return X86::AND32rr;
14154 case X86::ATOMAND64:
return X86::AND64rr;
14155 case X86::ATOMOR8:
return X86::OR8rr;
14156 case X86::ATOMOR16:
return X86::OR16rr;
14157 case X86::ATOMOR32:
return X86::OR32rr;
14158 case X86::ATOMOR64:
return X86::OR64rr;
14159 case X86::ATOMXOR8:
return X86::XOR8rr;
14160 case X86::ATOMXOR16:
return X86::XOR16rr;
14161 case X86::ATOMXOR32:
return X86::XOR32rr;
14162 case X86::ATOMXOR64:
return X86::XOR64rr;
14170 unsigned &ExtraOpc) {
14172 case X86::ATOMNAND8: ExtraOpc = X86::NOT8r;
return X86::AND8rr;
14173 case X86::ATOMNAND16: ExtraOpc = X86::NOT16r;
return X86::AND16rr;
14174 case X86::ATOMNAND32: ExtraOpc = X86::NOT32r;
return X86::AND32rr;
14175 case X86::ATOMNAND64: ExtraOpc = X86::NOT64r;
return X86::AND64rr;
14176 case X86::ATOMMAX8: ExtraOpc = X86::CMP8rr;
return X86::CMOVL32rr;
14177 case X86::ATOMMAX16: ExtraOpc = X86::CMP16rr;
return X86::CMOVL16rr;
14178 case X86::ATOMMAX32: ExtraOpc = X86::CMP32rr;
return X86::CMOVL32rr;
14179 case X86::ATOMMAX64: ExtraOpc = X86::CMP64rr;
return X86::CMOVL64rr;
14180 case X86::ATOMMIN8: ExtraOpc = X86::CMP8rr;
return X86::CMOVG32rr;
14181 case X86::ATOMMIN16: ExtraOpc = X86::CMP16rr;
return X86::CMOVG16rr;
14182 case X86::ATOMMIN32: ExtraOpc = X86::CMP32rr;
return X86::CMOVG32rr;
14183 case X86::ATOMMIN64: ExtraOpc = X86::CMP64rr;
return X86::CMOVG64rr;
14184 case X86::ATOMUMAX8: ExtraOpc = X86::CMP8rr;
return X86::CMOVB32rr;
14185 case X86::ATOMUMAX16: ExtraOpc = X86::CMP16rr;
return X86::CMOVB16rr;
14186 case X86::ATOMUMAX32: ExtraOpc = X86::CMP32rr;
return X86::CMOVB32rr;
14187 case X86::ATOMUMAX64: ExtraOpc = X86::CMP64rr;
return X86::CMOVB64rr;
14188 case X86::ATOMUMIN8: ExtraOpc = X86::CMP8rr;
return X86::CMOVA32rr;
14189 case X86::ATOMUMIN16: ExtraOpc = X86::CMP16rr;
return X86::CMOVA16rr;
14190 case X86::ATOMUMIN32: ExtraOpc = X86::CMP32rr;
return X86::CMOVA32rr;
14191 case X86::ATOMUMIN64: ExtraOpc = X86::CMP64rr;
return X86::CMOVA64rr;
14200 case X86::ATOMAND6432: HiOpc = X86::AND32rr;
return X86::AND32rr;
14201 case X86::ATOMOR6432: HiOpc = X86::OR32rr;
return X86::OR32rr;
14202 case X86::ATOMXOR6432: HiOpc = X86::XOR32rr;
return X86::XOR32rr;
14203 case X86::ATOMADD6432: HiOpc = X86::ADC32rr;
return X86::ADD32rr;
14204 case X86::ATOMSUB6432: HiOpc = X86::SBB32rr;
return X86::SUB32rr;
14205 case X86::ATOMSWAP6432: HiOpc = X86::MOV32rr;
return X86::MOV32rr;
14206 case X86::ATOMMAX6432: HiOpc = X86::SETLr;
return X86::SETLr;
14207 case X86::ATOMMIN6432: HiOpc = X86::SETGr;
return X86::SETGr;
14208 case X86::ATOMUMAX6432: HiOpc = X86::SETBr;
return X86::SETBr;
14209 case X86::ATOMUMIN6432: HiOpc = X86::SETAr;
return X86::SETAr;
14218 unsigned &ExtraOpc) {
14220 case X86::ATOMNAND6432:
14221 ExtraOpc = X86::NOT32r;
14222 HiOpc = X86::AND32rr;
14223 return X86::AND32rr;
14231 case MVT::i8:
return X86::CMOV_GR8;
14232 case MVT::i16:
return X86::CMOV_GR16;
14233 case MVT::i32:
return X86::CMOV_GR32;
14275 "Unexpected number of operands");
14278 "Expected atomic-load-op to have one memoperand");
14284 unsigned DstReg, SrcReg;
14285 unsigned MemOpndSlot;
14287 unsigned CurOp = 0;
14290 MemOpndSlot = CurOp;
14333 MIB =
BuildMI(thisMBB, DL, TII->
get(LOADOpc), t1);
14341 unsigned flags = (*MMOI)->
getFlags();
14345 (*MMOI)->getSize(),
14346 (*MMOI)->getBaseAlignment(),
14347 (*MMOI)->getTBAAInfo(),
14348 (*MMOI)->getRanges());
14365 case X86::ATOMAND8:
14366 case X86::ATOMAND16:
14367 case X86::ATOMAND32:
14368 case X86::ATOMAND64:
14370 case X86::ATOMOR16:
14371 case X86::ATOMOR32:
14372 case X86::ATOMOR64:
14373 case X86::ATOMXOR8:
14374 case X86::ATOMXOR16:
14375 case X86::ATOMXOR32:
14376 case X86::ATOMXOR64: {
14378 BuildMI(mainMBB, DL, TII->
get(ARITHOpc), t2).addReg(SrcReg)
14382 case X86::ATOMNAND8:
14383 case X86::ATOMNAND16:
14384 case X86::ATOMNAND32:
14385 case X86::ATOMNAND64: {
14389 BuildMI(mainMBB, DL, TII->
get(ANDOpc), Tmp).addReg(SrcReg)
14391 BuildMI(mainMBB, DL, TII->
get(NOTOpc), t2).addReg(Tmp);
14394 case X86::ATOMMAX8:
14395 case X86::ATOMMAX16:
14396 case X86::ATOMMAX32:
14397 case X86::ATOMMAX64:
14398 case X86::ATOMMIN8:
14399 case X86::ATOMMIN16:
14400 case X86::ATOMMIN32:
14401 case X86::ATOMMIN64:
14402 case X86::ATOMUMAX8:
14403 case X86::ATOMUMAX16:
14404 case X86::ATOMUMAX32:
14405 case X86::ATOMUMAX64:
14406 case X86::ATOMUMIN8:
14407 case X86::ATOMUMIN16:
14408 case X86::ATOMUMIN32:
14409 case X86::ATOMUMIN64: {
14444 BuildMI(mainMBB, DL, TII->
get(CMOVOpc), Tmp)
14449 .addReg(Tmp, 0, X86::sub_8bit);
14454 "Invalid atomic-load-op transformation!");
14458 MIB =
BuildMI(mainMBB, DL, TII->
get(SelOpc), t2)
14459 .addReg(SrcReg).
addReg(t4)
14461 mainMBB = EmitLoweredSelect(MIB, mainMBB);
14476 MIB =
BuildMI(mainMBB, DL, TII->
get(LCMPXCHGOpc));
14490 BuildMI(mainMBB, DL, TII->
get(X86::JNE_4)).addMBB(origMainMBB);
14535 X86TargetLowering::EmitAtomicLoadArith6432(
MachineInstr *MI,
14548 "Unexpected number of operands");
14551 "Expected atomic-load-op32 to have one memoperand");
14557 unsigned DstLoReg, DstHiReg;
14558 unsigned SrcLoReg, SrcHiReg;
14559 unsigned MemOpndSlot;
14561 unsigned CurOp = 0;
14565 MemOpndSlot = CurOp;
14582 unsigned LCMPXCHGOpc = X86::LCMPXCHG8B;
14583 unsigned LOADOpc = X86::MOV32rm;
14620 MIB =
BuildMI(thisMBB, DL, TII->
get(LOADOpc), t1L);
14628 unsigned flags = (*MMOI)->getFlags();
14632 (*MMOI)->getSize(),
14633 (*MMOI)->getBaseAlignment(),
14634 (*MMOI)->getTBAAInfo(),
14635 (*MMOI)->getRanges());
14641 MIB =
BuildMI(thisMBB, DL, TII->
get(LOADOpc), t1H);
14669 case X86::ATOMAND6432:
14670 case X86::ATOMOR6432:
14671 case X86::ATOMXOR6432:
14672 case X86::ATOMADD6432:
14673 case X86::ATOMSUB6432: {
14676 BuildMI(mainMBB, DL, TII->
get(LoOpc), t2L).addReg(t4L)
14678 BuildMI(mainMBB, DL, TII->
get(HiOpc), t2H).addReg(t4H)
14682 case X86::ATOMNAND6432: {
14683 unsigned HiOpc, NOTOpc;
14687 BuildMI(mainMBB, DL, TII->
get(LoOpc), TmpL).addReg(SrcLoReg)
14689 BuildMI(mainMBB, DL, TII->
get(HiOpc), TmpH).addReg(SrcHiReg)
14691 BuildMI(mainMBB, DL, TII->
get(NOTOpc), t2L).addReg(TmpL);
14692 BuildMI(mainMBB, DL, TII->
get(NOTOpc), t2H).addReg(TmpH);
14695 case X86::ATOMMAX6432:
14696 case X86::ATOMMIN6432:
14697 case X86::ATOMUMAX6432:
14698 case X86::ATOMUMIN6432: {
14707 BuildMI(mainMBB, DL, TII->
get(X86::CMP32rr))
14708 .addReg(SrcLoReg).
addReg(t4L);
14710 BuildMI(mainMBB, DL, TII->
get(X86::MOVZX32rr8), cL32).addReg(cL);
14712 BuildMI(mainMBB, DL, TII->
get(X86::CMP32rr))
14713 .addReg(SrcHiReg).
addReg(t4H);
14715 BuildMI(mainMBB, DL, TII->
get(X86::MOVZX32rr8), cH32).addReg(cH);
14718 BuildMI(mainMBB, DL, TII->
get(X86::CMOVE32rr), cc)
14719 .addReg(cH32).
addReg(cL32);
14721 MIB =
BuildMI(mainMBB, DL, TII->
get(X86::CMOV_GR32), cc)
14722 .addReg(cH32).
addReg(cL32)
14724 mainMBB = EmitLoweredSelect(MIB, mainMBB);
14728 BuildMI(mainMBB, DL, TII->
get(X86::CMOVNE32rr), t2L)
14729 .addReg(SrcLoReg).
addReg(t4L);
14730 BuildMI(mainMBB, DL, TII->
get(X86::CMOVNE32rr), t2H)
14731 .addReg(SrcHiReg).
addReg(t4H);
14733 MIB =
BuildMI(mainMBB, DL, TII->
get(X86::CMOV_GR32), t2L)
14734 .addReg(SrcLoReg).
addReg(t4L)
14736 mainMBB = EmitLoweredSelect(MIB, mainMBB);
14740 MIB =
BuildMI(mainMBB, DL, TII->
get(X86::CMOV_GR32), t2H)
14741 .addReg(SrcHiReg).
addReg(t4H)
14743 mainMBB = EmitLoweredSelect(MIB, mainMBB);
14755 case X86::ATOMSWAP6432: {
14758 BuildMI(mainMBB, DL, TII->
get(LoOpc), t2L).addReg(SrcLoReg);
14759 BuildMI(mainMBB, DL, TII->
get(HiOpc), t2H).addReg(SrcHiReg);
14771 MIB =
BuildMI(mainMBB, DL, TII->
get(LCMPXCHGOpc));
14784 BuildMI(mainMBB, DL, TII->
get(X86::JNE_4)).addMBB(origMainMBB);
14809 case X86::PCMPISTRM128REG: Opc = X86::PCMPISTRM128rr;
break;
14810 case X86::VPCMPISTRM128REG: Opc = X86::VPCMPISTRM128rr;
break;
14811 case X86::PCMPISTRM128MEM: Opc = X86::PCMPISTRM128rm;
break;
14812 case X86::VPCMPISTRM128MEM: Opc = X86::VPCMPISTRM128rm;
break;
14813 case X86::PCMPESTRM128REG: Opc = X86::PCMPESTRM128rr;
break;
14814 case X86::VPCMPESTRM128REG: Opc = X86::VPCMPESTRM128rr;
break;
14815 case X86::PCMPESTRM128MEM: Opc = X86::PCMPESTRM128rm;
break;
14816 case X86::VPCMPESTRM128MEM: Opc = X86::VPCMPESTRM128rm;
break;
14823 for (
unsigned i = 1; i < NumArgs; ++i) {
14833 .addReg(X86::XMM0);
14846 case X86::PCMPISTRIREG: Opc = X86::PCMPISTRIrr;
break;
14847 case X86::VPCMPISTRIREG: Opc = X86::VPCMPISTRIrr;
break;
14848 case X86::PCMPISTRIMEM: Opc = X86::PCMPISTRIrm;
break;
14849 case X86::VPCMPISTRIMEM: Opc = X86::VPCMPISTRIrm;
break;
14850 case X86::PCMPESTRIREG: Opc = X86::PCMPESTRIrr;
break;
14851 case X86::VPCMPESTRIREG: Opc = X86::VPCMPESTRIrr;
break;
14852 case X86::PCMPESTRIMEM: Opc = X86::PCMPESTRIrm;
break;
14853 case X86::VPCMPESTRIMEM: Opc = X86::VPCMPESTRIrm;
break;
14860 for (
unsigned i = 1; i < NumArgs; ++i) {
14882 unsigned MemOpc = Subtarget->
is64Bit() ? X86::LEA64r : X86::LEA32r;
14895 BuildMI(*BB, MI, dl, TII->
get(X86::MONITORrrr));
14902 X86TargetLowering::EmitVAARG64WithCustomInserter(
14915 assert(MI->
getNumOperands() == 10 &&
"VAARG_64 should have 10 operands!");
14916 assert(X86::AddrNumOperands == 5 &&
"VAARG_64 assumes 5 address operands");
14929 assert(MI->
hasOneMemOperand() &&
"Expected VAARG_64 to have one memoperand");
14949 unsigned TotalNumIntRegs = 6;
14950 unsigned TotalNumXMMRegs = 8;
14951 bool UseGPOffset = (ArgMode == 1);
14952 bool UseFPOffset = (ArgMode == 2);
14953 unsigned MaxOffset = TotalNumIntRegs * 8 +
14954 (UseFPOffset ? TotalNumXMMRegs * 16 : 0);
14957 unsigned ArgSizeA8 = (ArgSize + 7) & ~7;
14958 bool NeedsAlign = (Align > 8);
14965 unsigned OffsetDestReg = 0;
14966 unsigned OverflowDestReg = 0;
14967 unsigned OffsetReg = 0;
14969 if (!UseGPOffset && !UseFPOffset) {
14973 OverflowDestReg = DestReg;
14976 overflowMBB = thisMBB;
15005 MF->
insert(MBBIter, offsetMBB);
15006 MF->
insert(MBBIter, overflowMBB);
15007 MF->
insert(MBBIter, endMBB);
15025 BuildMI(thisMBB, DL, TII->
get(X86::MOV32rm), OffsetReg)
15029 .
addDisp(Disp, UseFPOffset ? 4 : 0)
15034 BuildMI(thisMBB, DL, TII->
get(X86::CMP32ri))
15036 .
addImm(MaxOffset + 8 - ArgSizeA8);
15041 .addMBB(overflowMBB);
15046 assert(OffsetReg != 0);
15050 BuildMI(offsetMBB, DL, TII->
get(X86::MOV64rm), RegSaveReg)
15063 .
addImm(X86::sub_32bit);
15066 BuildMI(offsetMBB, DL, TII->
get(X86::ADD64rr), OffsetDestReg)
15067 .addReg(OffsetReg64)
15072 BuildMI(offsetMBB, DL, TII->
get(X86::ADD32ri), NextOffsetReg)
15074 .
addImm(UseFPOffset ? 16 : 8);
15077 BuildMI(offsetMBB, DL, TII->
get(X86::MOV32mr))
15081 .
addDisp(Disp, UseFPOffset ? 4 : 0)
15087 BuildMI(offsetMBB, DL, TII->
get(X86::JMP_4))
15097 BuildMI(overflowMBB, DL, TII->
get(X86::MOV64rm), OverflowAddrReg)
15109 assert((Align & (Align-1)) == 0 &&
"Alignment must be a power of 2");
15113 BuildMI(overflowMBB, DL, TII->
get(X86::ADD64ri32), TmpReg)
15114 .addReg(OverflowAddrReg)
15117 BuildMI(overflowMBB, DL, TII->
get(X86::AND64ri32), OverflowDestReg)
15119 .
addImm(~(uint64_t)(Align-1));
15122 .addReg(OverflowAddrReg);
15128 BuildMI(overflowMBB, DL, TII->
get(X86::ADD64ri32), NextAddrReg)
15129 .addReg(OverflowDestReg)
15133 BuildMI(overflowMBB, DL, TII->
get(X86::MOV64mr))
15146 .addReg(OffsetDestReg).
addMBB(offsetMBB)
15157 X86TargetLowering::EmitVAStartSaveXMMRegsWithCustomInserter(
15177 F->
insert(MBBIter, XMMSaveMBB);
15178 F->
insert(MBBIter, EndMBB);
15201 BuildMI(MBB, DL, TII->
get(X86::TEST8rr)).addReg(CountReg).
addReg(CountReg);
15202 BuildMI(MBB, DL, TII->
get(X86::JE_4)).addMBB(EndMBB);
15206 unsigned MOVOpc = Subtarget->
hasFp256() ? X86::VMOVAPSmr : X86::MOVAPSmr;
15209 int64_t Offset = (i - 3) * 16 + VarArgsFPOffset;
15216 .addFrameIndex(RegSaveFrameIndex)
15222 .addMemOperand(MMO);
15250 if (miI == BB->
end()) {
15253 sItr != sEnd; ++sItr) {
15262 SelectItr->addRegisterKilled(X86::EFLAGS, TRI);
15267 X86TargetLowering::EmitLoweredSelect(
MachineInstr *MI,
15290 F->
insert(It, copy0MBB);
15315 BuildMI(BB, DL, TII->
get(Opc)).addMBB(sinkMBB);
15336 bool Is64Bit)
const {
15345 unsigned TlsOffset = Is64Bit ? 0x70 : 0x30;
15376 physSPReg = Is64Bit ? X86::RSP :
X86::ESP;
15381 MF->
insert(MBBIter, bumpMBB);
15382 MF->
insert(MBBIter, mallocMBB);
15383 MF->
insert(MBBIter, continueMBB);
15392 BuildMI(BB, DL, TII->
get(Is64Bit ? X86::SUB64rr:X86::SUB32rr), SPLimitVReg)
15393 .addReg(tmpSPVReg).
addReg(sizeVReg);
15394 BuildMI(BB, DL, TII->
get(Is64Bit ? X86::CMP64mr:X86::CMP32mr))
15397 BuildMI(BB, DL, TII->
get(X86::JG_4)).addMBB(mallocMBB);
15402 .addReg(SPLimitVReg);
15404 .addReg(SPLimitVReg);
15405 BuildMI(bumpMBB, DL, TII->
get(X86::JMP_4)).addMBB(continueMBB);
15408 const uint32_t *RegMask =
15411 BuildMI(mallocMBB, DL, TII->
get(X86::MOV64rr), X86::RDI)
15413 BuildMI(mallocMBB, DL, TII->
get(X86::CALL64pcrel32))
15414 .addExternalSymbol(
"__morestack_allocate_stack_space")
15419 BuildMI(mallocMBB, DL, TII->
get(X86::SUB32ri), physSPReg).addReg(physSPReg)
15421 BuildMI(mallocMBB, DL, TII->
get(X86::PUSH32r)).addReg(sizeVReg);
15422 BuildMI(mallocMBB, DL, TII->
get(X86::CALLpcrel32))
15423 .addExternalSymbol(
"__morestack_allocate_stack_space")
15429 BuildMI(mallocMBB, DL, TII->
get(X86::ADD32ri), physSPReg).addReg(physSPReg)
15433 .addReg(Is64Bit ? X86::RAX :
X86::EAX);
15434 BuildMI(mallocMBB, DL, TII->
get(X86::JMP_4)).addMBB(continueMBB);
15445 .addReg(mallocPtrVReg).
addMBB(mallocMBB)
15452 return continueMBB;
15456 X86TargetLowering::EmitLoweredWinAlloca(
MachineInstr *MI,
15471 BuildMI(*BB, MI, DL, TII->
get(X86::W64ALLOCA))
15472 .addExternalSymbol(
"___chkstk")
15481 BuildMI(*BB, MI, DL, TII->
get(X86::W64ALLOCA))
15482 .addExternalSymbol(
"__chkstk")
15486 BuildMI(*BB, MI, DL, TII->
get(X86::SUB64rr), X86::RSP)
15491 const char *StackProbeSymbol =
15494 BuildMI(*BB, MI, DL, TII->
get(X86::CALLpcrel32))
15495 .addExternalSymbol(StackProbeSymbol)
15508 X86TargetLowering::EmitLoweredTLSCall(
MachineInstr *MI,
15519 assert(Subtarget->
isTargetDarwin() &&
"Darwin only instr emitted?");
15525 const uint32_t *RegMask =
15529 TII->get(X86::MOV64rm), X86::RDI)
15535 MIB =
BuildMI(*BB, MI, DL, TII->get(X86::CALL64m));
15546 MIB =
BuildMI(*BB, MI, DL, TII->get(X86::CALL32m));
15557 MIB =
BuildMI(*BB, MI, DL, TII->get(X86::CALL32m));
15584 unsigned MemOpndSlot = 0;
15586 unsigned CurOp = 0;
15594 MemOpndSlot = CurOp;
15598 "Invalid Pointer Size!");
15631 unsigned PtrStoreOpc = 0;
15632 unsigned LabelReg = 0;
15639 if (!UseImmLabel) {
15640 PtrStoreOpc = (PVT ==
MVT::i64) ? X86::MOV64mr : X86::MOV32mr;
15644 MIB =
BuildMI(*thisMBB, MI, DL, TII->
get(X86::LEA64r), LabelReg)
15652 MIB =
BuildMI(*thisMBB, MI, DL, TII->
get(X86::LEA32r), LabelReg)
15660 PtrStoreOpc = (PVT ==
MVT::i64) ? X86::MOV64mi32 : X86::MOV32mi;
15662 MIB =
BuildMI(*thisMBB, MI, DL, TII->
get(PtrStoreOpc));
15675 MIB =
BuildMI(*thisMBB, MI, DL, TII->
get(X86::EH_SjLj_Setup))
15676 .addMBB(restoreMBB);
15686 BuildMI(mainMBB, DL, TII->
get(X86::MOV32r0), mainDstReg);
15692 .addReg(mainDstReg).
addMBB(mainMBB)
15696 BuildMI(restoreMBB, DL, TII->
get(X86::MOV32ri), restoreDstReg).addImm(1);
15697 BuildMI(restoreMBB, DL, TII->
get(X86::JMP_4)).addMBB(sinkMBB);
15705 X86TargetLowering::emitEHSjLjLongJmp(
MachineInstr *MI,
15719 "Invalid Pointer Size!");
15722 (PVT ==
MVT::i64) ? &X86::GR64RegClass : &X86::GR32RegClass;
15735 unsigned PtrLoadOpc = (PVT ==
MVT::i64) ? X86::MOV64rm : X86::MOV32rm;
15736 unsigned IJmpOpc = (PVT ==
MVT::i64) ? X86::JMP64r : X86::JMP32r;
15739 MIB =
BuildMI(*MBB, MI, DL, TII->
get(PtrLoadOpc), FP);
15744 MIB =
BuildMI(*MBB, MI, DL, TII->
get(PtrLoadOpc), Tmp);
15753 MIB =
BuildMI(*MBB, MI, DL, TII->
get(PtrLoadOpc), SP);
15762 BuildMI(*MBB, MI, DL, TII->
get(IJmpOpc)).addReg(Tmp);
15773 case X86::TAILJMPd64:
15774 case X86::TAILJMPr64:
15775 case X86::TAILJMPm64:
15777 case X86::TCRETURNdi64:
15778 case X86::TCRETURNri64:
15779 case X86::TCRETURNmi64:
15782 return EmitLoweredWinAlloca(MI, BB);
15783 case X86::SEG_ALLOCA_32:
15784 return EmitLoweredSegAlloca(MI, BB,
false);
15785 case X86::SEG_ALLOCA_64:
15786 return EmitLoweredSegAlloca(MI, BB,
true);
15787 case X86::TLSCall_32:
15788 case X86::TLSCall_64:
15789 return EmitLoweredTLSCall(MI, BB);
15790 case X86::CMOV_GR8:
15791 case X86::CMOV_FR32:
15792 case X86::CMOV_FR64:
15793 case X86::CMOV_V4F32:
15794 case X86::CMOV_V2F64:
15795 case X86::CMOV_V2I64:
15796 case X86::CMOV_V8F32:
15797 case X86::CMOV_V4F64:
15798 case X86::CMOV_V4I64:
15799 case X86::CMOV_V16F32:
15800 case X86::CMOV_V8F64:
15801 case X86::CMOV_V8I64:
15802 case X86::CMOV_GR16:
15803 case X86::CMOV_GR32:
15804 case X86::CMOV_RFP32:
15805 case X86::CMOV_RFP64:
15806 case X86::CMOV_RFP80:
15807 return EmitLoweredSelect(MI, BB);
15809 case X86::FP32_TO_INT16_IN_MEM:
15810 case X86::FP32_TO_INT32_IN_MEM:
15811 case X86::FP32_TO_INT64_IN_MEM:
15812 case X86::FP64_TO_INT16_IN_MEM:
15813 case X86::FP64_TO_INT32_IN_MEM:
15814 case X86::FP64_TO_INT64_IN_MEM:
15815 case X86::FP80_TO_INT16_IN_MEM:
15816 case X86::FP80_TO_INT32_IN_MEM:
15817 case X86::FP80_TO_INT64_IN_MEM: {
15840 TII->
get(X86::FLDCW16m)), CWFrameIdx);
15850 case X86::FP32_TO_INT16_IN_MEM: Opc = X86::IST_Fp16m32;
break;
15851 case X86::FP32_TO_INT32_IN_MEM: Opc = X86::IST_Fp32m32;
break;
15852 case X86::FP32_TO_INT64_IN_MEM: Opc = X86::IST_Fp64m32;
break;
15853 case X86::FP64_TO_INT16_IN_MEM: Opc = X86::IST_Fp16m64;
break;
15854 case X86::FP64_TO_INT32_IN_MEM: Opc = X86::IST_Fp32m64;
break;
15855 case X86::FP64_TO_INT64_IN_MEM: Opc = X86::IST_Fp64m64;
break;
15856 case X86::FP80_TO_INT16_IN_MEM: Opc = X86::IST_Fp16m80;
break;
15857 case X86::FP80_TO_INT32_IN_MEM: Opc = X86::IST_Fp32m80;
break;
15858 case X86::FP80_TO_INT64_IN_MEM: Opc = X86::IST_Fp64m80;
break;
15887 TII->
get(X86::FLDCW16m)), CWFrameIdx);
15893 case X86::PCMPISTRM128REG:
15894 case X86::VPCMPISTRM128REG:
15895 case X86::PCMPISTRM128MEM:
15896 case X86::VPCMPISTRM128MEM:
15897 case X86::PCMPESTRM128REG:
15898 case X86::VPCMPESTRM128REG:
15899 case X86::PCMPESTRM128MEM:
15900 case X86::VPCMPESTRM128MEM:
15902 "Target must have SSE4.2 or AVX features enabled");
15906 case X86::PCMPISTRIREG:
15907 case X86::VPCMPISTRIREG:
15908 case X86::PCMPISTRIMEM:
15909 case X86::VPCMPISTRIMEM:
15910 case X86::PCMPESTRIREG:
15911 case X86::VPCMPESTRIREG:
15912 case X86::PCMPESTRIMEM:
15913 case X86::VPCMPESTRIMEM:
15915 "Target must have SSE4.2 or AVX features enabled");
15927 case X86::ATOMAND8:
15928 case X86::ATOMAND16:
15929 case X86::ATOMAND32:
15930 case X86::ATOMAND64:
15933 case X86::ATOMOR16:
15934 case X86::ATOMOR32:
15935 case X86::ATOMOR64:
15937 case X86::ATOMXOR16:
15938 case X86::ATOMXOR8:
15939 case X86::ATOMXOR32:
15940 case X86::ATOMXOR64:
15942 case X86::ATOMNAND8:
15943 case X86::ATOMNAND16:
15944 case X86::ATOMNAND32:
15945 case X86::ATOMNAND64:
15947 case X86::ATOMMAX8:
15948 case X86::ATOMMAX16:
15949 case X86::ATOMMAX32:
15950 case X86::ATOMMAX64:
15952 case X86::ATOMMIN8:
15953 case X86::ATOMMIN16:
15954 case X86::ATOMMIN32:
15955 case X86::ATOMMIN64:
15957 case X86::ATOMUMAX8:
15958 case X86::ATOMUMAX16:
15959 case X86::ATOMUMAX32:
15960 case X86::ATOMUMAX64:
15962 case X86::ATOMUMIN8:
15963 case X86::ATOMUMIN16:
15964 case X86::ATOMUMIN32:
15965 case X86::ATOMUMIN64:
15966 return EmitAtomicLoadArith(MI, BB);
15969 case X86::ATOMAND6432:
15970 case X86::ATOMOR6432:
15971 case X86::ATOMXOR6432:
15972 case X86::ATOMNAND6432:
15973 case X86::ATOMADD6432:
15974 case X86::ATOMSUB6432:
15975 case X86::ATOMMAX6432:
15976 case X86::ATOMMIN6432:
15977 case X86::ATOMUMAX6432:
15978 case X86::ATOMUMIN6432:
15979 case X86::ATOMSWAP6432:
15980 return EmitAtomicLoadArith6432(MI, BB);
15983 return EmitVAStartSaveXMMRegsWithCustomInserter(MI, BB);
15986 return EmitVAARG64WithCustomInserter(MI, BB);
15988 case X86::EH_SjLj_SetJmp32:
15989 case X86::EH_SjLj_SetJmp64:
15990 return emitEHSjLjSetJmp(MI, BB);
15992 case X86::EH_SjLj_LongJmp32:
15993 case X86::EH_SjLj_LongJmp64:
15994 return emitEHSjLjLongJmp(MI, BB);
16006 unsigned Depth)
const {
16013 "Should use MaskedValueIsZero if you don't know whether Op"
16014 " is a target node!");
16016 KnownZero = KnownOne =
APInt(BitWidth, 0);
16038 unsigned IntId = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
16039 unsigned NumLoBits = 0;
16070 unsigned Depth)
const {
16083 int64_t &Offset)
const {
16085 if (isa<GlobalAddressSDNode>(N->
getOperand(0))) {
16086 GA = cast<GlobalAddressSDNode>(N->
getOperand(0))->getGlobal();
16087 Offset = cast<GlobalAddressSDNode>(N->
getOperand(0))->getOffset();
16102 for (
unsigned i = 0, j = NumElems/2; i != NumElems/2; ++i, ++j)
16118 for (
unsigned i = NumElems/2, j = 0; i != NumElems; ++i, ++j)
16160 for (
unsigned i = 0; i != NumElems/2; ++i)
16166 if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(V1.getOperand(0))) {
16169 SDValue Ops[] = { Ld->getChain(), Ld->getBasePtr() };
16174 Ld->getPointerInfo(),
16175 Ld->getAlignment(),
16274 if (!isa<ConstantSDNode>(EltNo))
16279 bool HasShuffleIntoBitcast =
false;
16288 HasShuffleIntoBitcast =
true;
16306 int Elt = cast<ConstantSDNode>(EltNo)->getZExtValue();
16307 int Idx = (Elt > (int)NumElems) ? -1 : ShuffleMask[Elt];
16331 if (HasShuffleIntoBitcast) {
16367 "Unexpected operands in ExtractBitFromMaskVector");
16370 if (!isa<ConstantSDNode>(Idx)) {
16378 unsigned IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
16428 unsigned ExtractedElements = 0;
16431 if (UI.getUse().getResNo() != InputVector.
getResNo())
16445 if (!isa<ConstantSDNode>(Extract->
getOperand(1)))
16449 ExtractedElements |=
16450 1 << cast<ConstantSDNode>(Extract->
getOperand(1))->getZExtValue();
16456 if (ExtractedElements != 15)
16460 SDLoc dl(InputVector);
16469 UE = Uses.
end(); UI != UE; ++UI) {
16476 uint64_t Offset = EltSize * cast<ConstantSDNode>(Idx)->getZExtValue();
16481 StackPtr, OffsetVal);
16486 false,
false,
false, 0);
16497 static std::pair<unsigned, bool>
16501 return std::make_pair(0,
false);
16503 bool NeedSplit =
false;
16505 default:
return std::make_pair(0,
false);
16511 if (!Subtarget->
hasAVX())
16512 return std::make_pair(0,
false);
16518 return std::make_pair(0,
false);
16522 bool hasUnsigned = Subtarget->
hasSSE41() ||
16524 bool hasSigned = Subtarget->
hasSSE41() ||
16568 return std::make_pair(Opc, NeedSplit);
16594 unsigned Opcode = 0;
16752 bool NeedsCondInvert =
false;
16754 if (TrueC->getAPIntValue().ult(FalseC->getAPIntValue()) &&
16758 isa<ConstantSDNode>(Cond.
getOperand(1))))) {
16759 NeedsCondInvert =
true;
16764 if (FalseC->getAPIntValue() == 0 &&
16765 TrueC->getAPIntValue().isPowerOf2()) {
16766 if (NeedsCondInvert)
16773 unsigned ShAmt = TrueC->getAPIntValue().logBase2();
16779 if (FalseC->getAPIntValue()+1 == TrueC->getAPIntValue()) {
16780 if (NeedsCondInvert)
16786 FalseC->getValueType(0), Cond);
16794 uint64_t Diff = TrueC->getZExtValue()-FalseC->getZExtValue();
16797 bool isFastMultiplier =
false;
16799 switch ((
unsigned char)Diff) {
16808 isFastMultiplier =
true;
16813 if (isFastMultiplier) {
16814 APInt Diff = TrueC->getAPIntValue()-FalseC->getAPIntValue();
16815 if (NeedsCondInvert)
16828 if (FalseC->getAPIntValue() != 0)
16905 APInt A = cast<ConstantSDNode>(OpRHS.getOperand(0))->getAPIntValue();
16919 APInt A = cast<ConstantSDNode>(OpRHS.getOperand(0))->getAPIntValue();
16928 std::pair<unsigned, bool> ret =
matchIntegerMINMAX(Cond, VT, LHS, RHS, DAG, Subtarget);
16929 unsigned Opc = ret.first;
16930 bool NeedSplit = ret.second;
16932 if (Opc && NeedSplit) {
16949 return DAG.
getNode(Opc, DL, VT, LHS, RHS);
16958 "vector select expects a vector selector!");
16964 if (!TValIsAllOnes && !FValIsAllZeros) {
16970 if (TValIsAllZeros || FValIsAllOnes) {
16975 Cond = DAG.
getSetCC(DL, IntVT, Cond.getOperand(0), Cond.getOperand(1), NewCC);
16977 TValIsAllOnes = FValIsAllOnes;
16978 FValIsAllZeros = TValIsAllZeros;
16982 if (TValIsAllOnes || FValIsAllZeros) {
16985 if (TValIsAllOnes && FValIsAllZeros)
16987 else if (TValIsAllOnes)
16990 else if (FValIsAllZeros)
17019 assert(BitWidth >= 8 && BitWidth <= 64 &&
"Invalid mask size");
17022 APInt KnownZero, KnownOne;
17025 if (TLO.ShrinkDemandedConstant(Cond, DemandedMask) ||
17066 bool checkAgainstTrue =
false;
17068 if ((C = dyn_cast<ConstantSDNode>(Op1)))
17070 else if ((C = dyn_cast<ConstantSDNode>(Op2)))
17076 needOppositeCond = !needOppositeCond;
17077 checkAgainstTrue =
true;
17082 bool truncatedToBoolWithAnd =
false;
17090 if ((CS = dyn_cast<ConstantSDNode>(SetCC.
getOperand(0))) &&
17093 if ((CS = dyn_cast<ConstantSDNode>(SetCC.
getOperand(1))) &&
17099 truncatedToBoolWithAnd =
true;
17110 if (checkAgainstTrue && !truncatedToBoolWithAnd)
17113 "Invalid use of SETCC_CARRY!");
17118 if (needOppositeCond)
17142 bool FValIsFalse =
true;
17147 needOppositeCond = !needOppositeCond;
17148 FValIsFalse =
false;
17151 if (FValIsFalse && TVal->getZExtValue() != 1)
17153 if (!FValIsFalse && TVal->getZExtValue() != 0)
17156 if (needOppositeCond)
17197 SDValue Ops[] = { FalseOp, TrueOp,
17207 if (
ConstantSDNode *FalseC = dyn_cast<ConstantSDNode>(FalseOp)) {
17210 if (TrueC->getAPIntValue().ult(FalseC->getAPIntValue())) {
17219 if (FalseC->getAPIntValue() == 0 && TrueC->getAPIntValue().isPowerOf2()) {
17226 unsigned ShAmt = TrueC->getAPIntValue().logBase2();
17236 if (FalseC->getAPIntValue()+1 == TrueC->getAPIntValue()) {
17242 FalseC->getValueType(0), Cond);
17254 uint64_t Diff = TrueC->getZExtValue()-FalseC->getZExtValue();
17257 bool isFastMultiplier =
false;
17259 switch ((
unsigned char)Diff) {
17268 isFastMultiplier =
true;
17273 if (isFastMultiplier) {
17274 APInt Diff = TrueC->getAPIntValue()-FalseC->getAPIntValue();
17286 if (FalseC->getAPIntValue() != 0)
17317 (CmpAgainst = dyn_cast<ConstantSDNode>(Cond.
getOperand(1))) &&
17321 CmpAgainst == dyn_cast<ConstantSDNode>(FalseOp)) {
17327 CmpAgainst == dyn_cast<ConstantSDNode>(TrueOp)) {
17355 if (
isPowerOf2_64(MulAmt) || MulAmt == 3 || MulAmt == 5 || MulAmt == 9)
17358 uint64_t MulAmt1 = 0;
17359 uint64_t MulAmt2 = 0;
17360 if ((MulAmt % 9) == 0) {
17362 MulAmt2 = MulAmt / 9;
17363 }
else if ((MulAmt % 5) == 0) {
17365 MulAmt2 = MulAmt / 5;
17366 }
else if ((MulAmt % 3) == 0) {
17368 MulAmt2 = MulAmt / 3;
17371 (
isPowerOf2_64(MulAmt2) || MulAmt2 == 3 || MulAmt2 == 5 || MulAmt2 == 9)){
17410 if (VT.isInteger() && !VT.isVector() &&
17418 APInt Mask = cast<ConstantSDNode>(N0.
getOperand(1))->getAPIntValue();
17420 Mask = Mask.
shl(ShAmt);
17437 if (N1C && (1 == N1C->getZExtValue())) {
17469 if (ShiftAmt.
trunc(8).
uge(MaxAmount))
17521 bool ExpectingFlags =
false;
17524 !ExpectingFlags && UI != UE; ++UI)
17525 switch (UI->getOpcode()) {
17530 ExpectingFlags =
true;
17539 if (!ExpectingFlags) {
17564 return OneBitOfTruth;
17644 if (!RHSTrunc && !RHSConst)
17659 }
else if (RHSTrunc) {
17705 if (Subtarget->
hasBMI()) {
17735 if (C && C->getZExtValue() == 1)
17747 if (C && C->getZExtValue() == 1)
17758 if (MaskNode && ShiftNode) {
17760 uint64_t Shift = ShiftNode->getZExtValue();
17851 unsigned SraAmt = ~0;
17861 SraAmt = cast<ConstantSDNode>(SraC)->getZExtValue();
17863 if ((SraAmt + 1) != EltBits)
17874 assert((EltBits == 8 || EltBits == 16 || EltBits == 32) &&
17875 "Unsupported VT for PSIGN");
17932 if (SumC->getSExtValue() == Bits && ShAmt1Op1 == ShAmt0)
17933 return DAG.
getNode(Opc, DL, VT,
17938 }
else if (
ConstantSDNode *ShAmt1C = dyn_cast<ConstantSDNode>(ShAmt1)) {
17942 return DAG.
getNode(Opc, DL, VT,
18001 if (!Subtarget->
hasBMI())
18007 assert(Subtarget->
hasBMI() &&
"Creating BLSMSK requires BMI instructions");
18014 if (N0.getOpcode() ==
ISD::ADD && N0.getOperand(0) == N1 &&
18034 unsigned RegSz = RegVT.getSizeInBits();
18039 bool IsAligned = Alignment == 0 || Alignment >= MemVT.
getSizeInBits()/8;
18040 if (RegVT.is256BitVector() && !Subtarget->
hasInt256() &&
18042 unsigned NumElems = RegVT.getVectorNumElements();
18059 std::min(16U, Alignment));
18067 return DCI.
CombineTo(N, NewVec, TF,
true);
18077 if (RegVT.isVector() && RegVT.isInteger() && Subtarget->
hasSSE2() &&
18079 assert(MemVT != RegVT &&
"Cannot extend to the same type");
18080 assert(MemVT.
isVector() &&
"Must load a vector from memory");
18082 unsigned NumElems = RegVT.getVectorNumElements();
18084 assert(RegSz > MemSz &&
"Register size must be greater than the mem size");
18115 unsigned loadRegZize = RegSz;
18130 assert(WideVecVT.getSizeInBits() == LoadUnitVecVT.
getSizeInBits() &&
18131 "Invalid vector type");
18143 for (
unsigned i = 0; i < NumLoads; ++i) {
18167 unsigned SizeRatio = RegSz/MemSz;
18173 return DCI.
CombineTo(N, Sext, TF,
true);
18184 for (
unsigned i = 0; i != NumElems; ++i)
18185 ShuffleVec[i*SizeRatio + SizeRatio-1] = i;
18194 unsigned Amt = RegVT.getVectorElementType().getSizeInBits() -
18199 return DCI.
CombineTo(N, Shuff, TF,
true);
18204 for (
unsigned i = 0; i != NumElems; ++i)
18205 ShuffleVec[i*SizeRatio] = i;
18215 return DCI.
CombineTo(N, Shuff, TF,
true);
18236 bool IsAligned = Alignment == 0 || Alignment >= VT.getSizeInBits()/8;
18237 if (VT.is256BitVector() && !Subtarget->
hasInt256() &&
18238 StVT == VT && !IsAligned) {
18239 unsigned NumElems = VT.getVectorNumElements();
18256 std::min(16U, Alignment));
18265 unsigned NumElems = VT.getVectorNumElements();
18266 assert(StVT != VT &&
"Cannot truncate to the same type");
18267 unsigned FromSz = VT.getVectorElementType().getSizeInBits();
18274 if (0 != (NumElems * FromSz) % ToSz)
return SDValue();
18276 unsigned SizeRatio = FromSz / ToSz;
18278 assert(SizeRatio * NumElems * ToSz == VT.getSizeInBits());
18284 assert(WideVecVT.getSizeInBits() == VT.getSizeInBits());
18288 for (
unsigned i = 0; i != NumElems; ++i)
18289 ShuffleVec[i] = i * SizeRatio;
18312 (64 <= NumElems * ToSz))
18326 for (
unsigned i=0, e=(ToSz*NumElems)/StoreType.
getSizeInBits(); i!=e; ++i) {
18328 StoreType, ShuffWide,
18347 if (VT.getSizeInBits() != 64)
18355 if ((VT.isVector() ||
18357 isa<LoadSDNode>(St->
getValue()) &&
18358 !cast<LoadSDNode>(St->
getValue())->isVolatile() &&
18362 int TokenFactorIndex = -1;
18368 if (ChainVal == LdVal)
18369 Ld = cast<LoadSDNode>(St->
getChain());
18372 for (
unsigned i = 0, e = ChainVal->
getNumOperands(); i != e; ++i) {
18374 TokenFactorIndex = i;
18375 Ld = cast<LoadSDNode>(St->
getValue());
18395 if (Subtarget->
is64Bit() || F64IsLegal) {
18402 if (TokenFactorIndex != -1) {
18429 if (TokenFactorIndex != -1) {
18487 "Unsupported vector type for horizontal add/sub");
18493 unsigned NumLaneElts = NumElts / NumLanes;
18494 assert((NumLaneElts % 2 == 0) &&
18495 "Vector type should have an even number of elements in each lane");
18496 unsigned HalfLaneElts = NumLaneElts/2;
18516 for (
unsigned i = 0; i != NumElts; ++i)
18534 for (
unsigned i = 0; i != NumElts; ++i)
18539 if (!(A == C && B == D) && !(A == D && B ==
C))
18543 if (!A.
getNode() && !B.getNode())
18555 for (
unsigned l = 0; l != NumElts; l += NumLaneElts) {
18556 for (
unsigned i = 0; i != NumLaneElts; ++i) {
18557 int LIdx = LMask[i+l], RIdx = RMask[i+l];
18560 if (LIdx < 0 || RIdx < 0 ||
18561 (!A.
getNode() && (LIdx < (int)NumElts || RIdx < (
int)NumElts)) ||
18562 (!B.getNode() && (LIdx >= (int)NumElts || RIdx >= (
int)NumElts)))
18567 unsigned Src = (i/HalfLaneElts);
18568 int Index = 2*(i%HalfLaneElts) + NumElts*Src + l;
18569 if (!(LIdx == Index && RIdx == Index + 1) &&
18570 !(IsCommutative && LIdx == Index + 1 && RIdx == Index))
18617 if (C->getValueAPF().isPosZero())
18620 if (C->getValueAPF().isPosZero())
18636 unsigned NewOp = 0;
18652 if (C->getValueAPF().isPosZero())
18655 if (C->getValueAPF().isPosZero())
18665 if (C->getValueAPF().isPosZero())
18668 if (C->getValueAPF().isPosZero())
18681 APInt KnownZero, KnownOne;
18685 if (TLO.ShrinkDemandedConstant(Op1, DemandedMask) ||
18686 TLI.SimplifyDemandedBits(Op1, DemandedMask, KnownZero, KnownOne, TLO))
18699 OpVT.getVectorElementType().getSizeInBits()) {
18713 EVT ExtraVT = cast<VTSDNode>(N1)->getVT();
18782 bool NegMul = (NegA != NegB);
18796 return DAG.
getNode(Opcode, dl, VT, A, B, C);
18885 if (EFLAGS.getOpcode() ==
X86ISD::SUB && EFLAGS.hasOneUse() &&
18886 EFLAGS.getValueType().isInteger() &&
18887 !isa<ConstantSDNode>(EFLAGS.getOperand(1))) {
18889 EFLAGS.getNode()->getVTList(),
18890 EFLAGS.getOperand(1), EFLAGS.getOperand(0));
18927 if (Flags.getNode()) {
18969 X86TargetLowering::DAGCombinerInfo &DCI) {
18986 return DCI.CombineTo(N, Res1, CarryOut);
19061 APInt XorC = cast<ConstantSDNode>(Op1.
getOperand(1))->getAPIntValue();
19166 if (VT != MVT::i16)
19193 if (VT != MVT::i16)
19197 bool Commute =
false;
19265 for (
unsigned i = 0, e = args.
size(); i != e; ++i) {
19270 s = s.
substr(piece.size());
19285 if (AsmPieces.
size() == 3 || AsmPieces.
size() == 4) {
19286 if (std::count(AsmPieces.
begin(), AsmPieces.
end(),
"~{cc}") &&
19287 std::count(AsmPieces.
begin(), AsmPieces.
end(),
"~{flags}") &&
19288 std::count(AsmPieces.
begin(), AsmPieces.
end(),
"~{fpsr}")) {
19290 if (AsmPieces.
size() == 3)
19292 else if (std::count(AsmPieces.
begin(), AsmPieces.
end(),
"~{dirflag}"))
19312 switch (AsmPieces.
size()) {
19313 default:
return false;
19320 if (matchAsm(AsmPieces[0],
"bswap",
"$0") ||
19321 matchAsm(AsmPieces[0],
"bswapl",
"$0") ||
19322 matchAsm(AsmPieces[0],
"bswapq",
"$0") ||
19323 matchAsm(AsmPieces[0],
"bswap",
"${0:q}") ||
19324 matchAsm(AsmPieces[0],
"bswapl",
"${0:q}") ||
19325 matchAsm(AsmPieces[0],
"bswapq",
"${0:q}")) {
19334 (matchAsm(AsmPieces[0],
"rorw",
"$$8,",
"${0:w}") ||
19335 matchAsm(AsmPieces[0],
"rolw",
"$$8,",
"${0:w}"))) {
19347 matchAsm(AsmPieces[0],
"rorw",
"$$8,",
"${0:w}") &&
19348 matchAsm(AsmPieces[1],
"rorl",
"$$16,",
"$0") &&
19349 matchAsm(AsmPieces[2],
"rorw",
"$$8,",
"${0:w}")) {
19360 if (Constraints.size() >= 2 &&
19361 Constraints[0].Codes.size() == 1 && Constraints[0].Codes[0] ==
"A" &&
19362 Constraints[1].Codes.size() == 1 && Constraints[1].Codes[0] ==
"0") {
19364 if (matchAsm(AsmPieces[0],
"bswap",
"%eax") &&
19365 matchAsm(AsmPieces[1],
"bswap",
"%edx") &&
19366 matchAsm(AsmPieces[2],
"xchgl",
"%eax,",
"%edx"))
19379 if (Constraint.size() == 1) {
19380 switch (Constraint[0]) {
19428 if (CallOperandVal == NULL)
19432 switch (*constraint) {
19471 if (
ConstantInt *C = dyn_cast<ConstantInt>(CallOperandVal)) {
19477 if (
ConstantInt *C = dyn_cast<ConstantInt>(CallOperandVal)) {
19483 if (
ConstantInt *C = dyn_cast<ConstantInt>(CallOperandVal)) {
19489 if (
ConstantInt *C = dyn_cast<ConstantInt>(CallOperandVal)) {
19495 if (
ConstantInt *C = dyn_cast<ConstantInt>(CallOperandVal)) {
19502 if (dyn_cast<ConstantFP>(CallOperandVal)) {
19507 if (
ConstantInt *C = dyn_cast<ConstantInt>(CallOperandVal)) {
19514 if (
ConstantInt *C = dyn_cast<ConstantInt>(CallOperandVal)) {
19543 std::string &Constraint,
19544 std::vector<SDValue>&Ops,
19549 if (Constraint.length() > 1)
return;
19551 char ConstraintLetter = Constraint[0];
19552 switch (ConstraintLetter) {
19630 int64_t Offset = 0;
19634 if ((GA = dyn_cast<GlobalAddressSDNode>(Op))) {
19669 Ops.push_back(Result);
19675 std::pair<unsigned, const TargetRegisterClass*>
19680 if (Constraint.size() == 1) {
19682 switch (Constraint[0]) {
19690 return std::make_pair(0U, &X86::GR32RegClass);
19691 if (VT == MVT::i16)
19692 return std::make_pair(0U, &X86::GR16RegClass);
19694 return std::make_pair(0U, &X86::GR8RegClass);
19696 return std::make_pair(0U, &X86::GR64RegClass);
19702 return std::make_pair(0U, &X86::GR32_ABCDRegClass);
19703 if (VT == MVT::i16)
19704 return std::make_pair(0U, &X86::GR16_ABCDRegClass);
19706 return std::make_pair(0U, &X86::GR8_ABCD_LRegClass);
19708 return std::make_pair(0U, &X86::GR64_ABCDRegClass);
19713 return std::make_pair(0U, &X86::GR8RegClass);
19714 if (VT == MVT::i16)
19715 return std::make_pair(0U, &X86::GR16RegClass);
19717 return std::make_pair(0U, &X86::GR32RegClass);
19718 return std::make_pair(0U, &X86::GR64RegClass);
19721 return std::make_pair(0U, &X86::GR8_NOREXRegClass);
19722 if (VT == MVT::i16)
19723 return std::make_pair(0U, &X86::GR16_NOREXRegClass);
19725 return std::make_pair(0U, &X86::GR32_NOREXRegClass);
19726 return std::make_pair(0U, &X86::GR64_NOREXRegClass);
19731 return std::make_pair(0U, &X86::RFP32RegClass);
19733 return std::make_pair(0U, &X86::RFP64RegClass);
19734 return std::make_pair(0U, &X86::RFP80RegClass);
19736 if (!Subtarget->
hasMMX())
break;
19737 return std::make_pair(0U, &X86::VR64RegClass);
19739 if (!Subtarget->
hasSSE2())
break;
19742 if (!Subtarget->
hasSSE1())
break;
19749 return std::make_pair(0U, &X86::FR32RegClass);
19752 return std::make_pair(0U, &X86::FR64RegClass);
19760 return std::make_pair(0U, &X86::VR128RegClass);
19768 return std::make_pair(0U, &X86::VR256RegClass);
19773 return std::make_pair(0U, &X86::VR512RegClass);
19781 std::pair<unsigned, const TargetRegisterClass*> Res;
19785 if (Res.second == 0) {
19787 if (Constraint.size() == 7 && Constraint[0] ==
'{' &&
19788 tolower(Constraint[1]) ==
's' &&
19789 tolower(Constraint[2]) ==
't' &&
19790 Constraint[3] ==
'(' &&
19791 (Constraint[4] >=
'0' && Constraint[4] <=
'7') &&
19792 Constraint[5] ==
')' &&
19793 Constraint[6] ==
'}') {
19795 Res.first = X86::ST0+Constraint[4]-
'0';
19796 Res.second = &X86::RFP80RegClass;
19802 Res.first = X86::ST0;
19803 Res.second = &X86::RFP80RegClass;
19809 Res.first = X86::EFLAGS;
19810 Res.second = &X86::CCRRegClass;
19815 if (Constraint ==
"A") {
19817 Res.second = &X86::GR32_ADRegClass;
19826 if (Res.second->hasType(VT))
19833 if (Res.second == &X86::GR16RegClass) {
19835 unsigned DestReg = 0;
19836 switch (Res.first) {
19838 case X86::AX: DestReg =
X86::AL;
break;
19839 case X86::DX: DestReg = X86::DL;
break;
19840 case X86::CX: DestReg = X86::CL;
break;
19841 case X86::BX: DestReg =
X86::BL;
break;
19844 Res.first = DestReg;
19845 Res.second = &X86::GR8RegClass;
19848 unsigned DestReg = 0;
19849 switch (Res.first) {
19851 case X86::AX: DestReg =
X86::EAX;
break;
19852 case X86::DX: DestReg =
X86::EDX;
break;
19853 case X86::CX: DestReg =
X86::ECX;
break;
19854 case X86::BX: DestReg =
X86::EBX;
break;
19855 case X86::SI: DestReg =
X86::ESI;
break;
19856 case X86::DI: DestReg =
X86::EDI;
break;
19857 case X86::BP: DestReg =
X86::EBP;
break;
19858 case X86::SP: DestReg =
X86::ESP;
break;
19861 Res.first = DestReg;
19862 Res.second = &X86::GR32RegClass;
19865 unsigned DestReg = 0;
19866 switch (Res.first) {
19868 case X86::AX: DestReg = X86::RAX;
break;
19869 case X86::DX: DestReg = X86::RDX;
break;
19870 case X86::CX: DestReg = X86::RCX;
break;
19871 case X86::BX: DestReg = X86::RBX;
break;
19872 case X86::SI: DestReg = X86::RSI;
break;
19873 case X86::DI: DestReg = X86::RDI;
break;
19874 case X86::BP: DestReg = X86::RBP;
break;
19875 case X86::SP: DestReg = X86::RSP;
break;
19878 Res.first = DestReg;
19879 Res.second = &X86::GR64RegClass;
19882 }
else if (Res.second == &X86::FR32RegClass ||
19883 Res.second == &X86::FR64RegClass ||
19884 Res.second == &X86::VR128RegClass ||
19885 Res.second == &X86::VR256RegClass ||
19886 Res.second == &X86::FR32XRegClass ||
19887 Res.second == &X86::FR64XRegClass ||
19888 Res.second == &X86::VR128XRegClass ||
19889 Res.second == &X86::VR256XRegClass ||
19890 Res.second == &X86::VR512RegClass) {
19897 Res.second = &X86::FR32RegClass;
19899 Res.second = &X86::FR64RegClass;
19900 else if (X86::VR128RegClass.hasType(VT))
19901 Res.second = &X86::VR128RegClass;
19902 else if (X86::VR256RegClass.hasType(VT))
19903 Res.second = &X86::VR256RegClass;
19904 else if (X86::VR512RegClass.hasType(VT))
19905 Res.second = &X86::VR512RegClass;
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
bool isInt< 32 >(int64_t x)
static bool isSequentialOrUndefInRange(ArrayRef< int > Mask, unsigned Pos, unsigned Size, int Low)
static SDValue LowerBuildVectorv8i16(SDValue Op, unsigned NonZeros, unsigned NumNonZero, unsigned NumZero, SelectionDAG &DAG, const X86Subtarget *Subtarget, const TargetLowering &TLI)
static SDValue LowerINSERT_SUBVECTOR(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
static SDValue LowerADJUST_TRAMPOLINE(SDValue Op, SelectionDAG &DAG)
bool isVINSERT128Index(SDNode *N)
static bool isValueValidForType(Type *Ty, uint64_t V)
Determine if the value is in range for the given type.
void setFrameAddressIsTaken(bool T)
unsigned getStackAlignment() const
unsigned GetCondBranchFromCond(CondCode CC)
static bool isPSHUFDMask(ArrayRef< int > Mask, MVT VT)
static unsigned getShuffleVPERM2X128Immediate(ShuffleVectorSDNode *SVOp)
const Value * getCalledValue() const
static bool FuncIsMadeTailCallSafe(CallingConv::ID CC, bool GuaranteedTailCallOpt)
static MVT getIntegerVT(unsigned BitWidth)
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
PSIGN - Copy integer sign.
void push_back(const T &Elt)
virtual bool isTruncateFree(Type *Ty1, Type *Ty2) const
unsigned Log2_32_Ceil(uint32_t Value)
const MachineFunction * getParent() const
The memory access reads data.
void setVarArgsFPOffset(unsigned Offset)
SDValue getConstant(uint64_t Val, EVT VT, bool isTarget=false)
static SDValue getOnesVector(MVT VT, bool HasInt256, SelectionDAG &DAG, SDLoc dl)
SDValue getValue(unsigned R) const
The C convention as specified in the x86-64 supplement to the System V ABI, used on most non-Windows ...
static APInt getSignBit(unsigned BitWidth)
Get the SignBit for a specific bit width.
static SDValue LowerVECTOR_SHUFFLE_128v4(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG)
The memory access writes data.
PSHUFB - Shuffle 16 8-bit values within a vector.
static SDValue PromoteSplati8i16(SDValue V, SelectionDAG &DAG, int &EltNo)
static SDValue getMOVLowToHigh(SDValue &Op, SDLoc &dl, SelectionDAG &DAG, bool HasSSE2)
const GlobalValue * getGlobal() const
static SDValue getMGatherNode(unsigned Opc, SDValue Op, SelectionDAG &DAG, SDValue Src, SDValue Mask, SDValue Base, SDValue Index, SDValue ScaleOp, SDValue Chain, const X86Subtarget *Subtarget)
static MachineBasicBlock * EmitPCMPSTRI(MachineInstr *MI, MachineBasicBlock *BB, const TargetInstrInfo *TII)
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
LLVMContext * getContext() const
virtual void resetOperationActions()
Reset the operation actions based on target options.
SDValue getCopyToReg(SDValue Chain, SDLoc dl, unsigned Reg, SDValue N)
static bool isPSHUFHWMask(ArrayRef< int > Mask, MVT VT, bool HasInt256)
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, SDLoc DL)
static SDValue LowerScalarImmediateShift(SDValue Op, SelectionDAG &DAG, const X86Subtarget *Subtarget)
virtual bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const
bool isKnownNeverNaN(SDValue Op) const
isKnownNeverNan - Test whether the given SDValue is known to never be NaN.
Reloc::Model getRelocationModel() const
static void CommuteVectorShuffleMask(SmallVectorImpl< int > &Mask, unsigned NumElems)
LocInfo getLocInfo() const
static MVT getVectorVT(MVT VT, unsigned NumElements)
static SDValue MaterializeSETB(SDLoc DL, SDValue EFLAGS, SelectionDAG &DAG)
static const fltSemantics IEEEdouble
static int translateX86FSETCC(ISD::CondCode SetCCOpcode, SDValue &Op0, SDValue &Op1)
Turns an ISD::CondCode into a value suitable for SSE floating point mask CMPs.
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
static SDValue LowerADD(SDValue Op, SelectionDAG &DAG)
bool isVEXTRACT128Index(SDNode *N)
Force argument to be passed in register.
bool isTargetCygMing() const
const TargetMachine & getTargetMachine() const
SDVTList getVTList() const
Y = RRC X, rotate right via carry.
static bool isMOVHLPSMask(ArrayRef< int > Mask, MVT VT)
unsigned createVirtualRegister(const TargetRegisterClass *RegClass)
static SDValue getVShift(bool isLeft, EVT VT, SDValue SrcOp, unsigned NumBits, SelectionDAG &DAG, const TargetLowering &TLI, SDLoc dl)
static SDValue performShiftToAllZeros(SDNode *N, SelectionDAG &DAG, const X86Subtarget *Subtarget)
Returns a vector of 0s if the node in input is a vector logical shift by a constant amount which is k...
bool isCalledByLegalizer() const
unsigned getPointerSize(unsigned AS=0) const
static SDValue PerformEXTRACT_VECTOR_ELTCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI)
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
CondCode getCondFromCMovOpc(unsigned Opc)
getCondFromCmovOpc - return condition code of a CMov opcode.
int getSplatIndex() const
static MachineBasicBlock * EmitXBegin(MachineInstr *MI, MachineBasicBlock *MBB, const TargetInstrInfo *TII)
Utility function to emit xbegin specifying the start of an RTM region.
const TargetMachine & getTarget() const
virtual const uint32_t * getCallPreservedMask(CallingConv::ID) const
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, unsigned f, uint64_t s, unsigned base_alignment, const MDNode *TBAAInfo=0, const MDNode *Ranges=0)
static SDValue getShuffleScalarElt(SDNode *N, unsigned Index, SelectionDAG &DAG, unsigned Depth)
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
Type::subtype_iterator param_iterator
virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const
virtual ConstraintType getConstraintType(const std::string &Constraint) const
Given a constraint, return the type of constraint it is for this target.
static SDValue getZeroVector(EVT VT, const X86Subtarget *Subtarget, SelectionDAG &DAG, SDLoc dl)
bool isNonNegative() const
Determine if this APInt Value is non-negative (>= 0)
virtual unsigned ComputeNumSignBitsForTargetNode(SDValue Op, unsigned Depth) const
void DecodePALIGNRMask(MVT VT, unsigned Imm, SmallVectorImpl< int > &ShuffleMask)
static bool isVirtualRegister(unsigned Reg)
static SDValue getMOVL(SelectionDAG &DAG, SDLoc dl, EVT VT, SDValue V1, SDValue V2)
bool is512BitVector() const
is512BitVector - Return true if this is a 512-bit vector type.
unsigned InferPtrAlignment(SDValue Ptr) const
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
static PointerType * getInt32PtrTy(LLVMContext &C, unsigned AS=0)
const GlobalValue * getGlobal() const
unsigned char ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const
BLENDV - Blend where the selector is a register.
const std::string & getAsmString() const
static bool isUndefOrEqual(int Val, int CmpVal)
static MVT getFloatingPointVT(unsigned BitWidth)
static bool isMOVDDUPYMask(ArrayRef< int > Mask, MVT VT, bool HasFp256)
virtual std::pair< const TargetRegisterClass *, uint8_t > findRepresentativeClass(MVT VT) const
unsigned getOpcode() const
virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const
void addLiveIn(unsigned Reg)
StringRef substr(size_t Start, size_t N=npos) const
static void ReplaceATOMIC_BINARY_64(SDNode *Node, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG, unsigned NewOp)
Type * getTypeForEVT(LLVMContext &Context) const
unsigned getSizeInBits() const
unsigned getByValSize() const
static MachineBasicBlock * EmitMonitor(MachineInstr *MI, MachineBasicBlock *BB, const TargetInstrInfo *TII, const X86Subtarget *Subtarget)
void DecodeUNPCKLMask(MVT VT, SmallVectorImpl< int > &ShuffleMask)
static SDValue LowerSUB(SDValue Op, SelectionDAG &DAG)
static bool isZero(SDValue V)
static bool isAllOnes(SDValue V)
unsigned getNumOperands() const
static SDValue PerformFORCombine(SDNode *N, SelectionDAG &DAG)
Type * getReturnType() const
void setBooleanVectorContents(BooleanContent Ty)
unsigned getInsertVINSERT128Immediate(SDNode *N)
static SDValue PerformSIGN_EXTEND_INREGCombine(SDNode *N, SelectionDAG &DAG, const X86Subtarget *Subtarget)
const std::string & getConstraintString() const
STATISTIC(NumTailCalls,"Number of tail calls")
unsigned getNumOperands() const
unsigned getValueSizeInBits() const
virtual const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const
FHSUB - Floating point horizontal sub.
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *fromMBB)
const X86Subtarget * getSubtarget() const
const SDValue & getOperand(unsigned Num) const
const Function * getFunction() const
static SDValue PerformFANDNCombine(SDNode *N, SelectionDAG &DAG)
PerformFANDNCombine - Do target-specific dag combines on X86ISD::FANDN nodes.
static unsigned TranslateX86CC(ISD::CondCode SetCCOpcode, bool isFP, SDValue &LHS, SDValue &RHS, SelectionDAG &DAG)
static TargetLoweringObjectFile * createTLOF(X86TargetMachine &TM)
static bool ShouldXformToMOVHLPS(ArrayRef< int > Mask, MVT VT)
static APFloat getZero(const fltSemantics &Sem, bool Negative=false)
static MachinePointerInfo getConstantPool()
bool bitsLT(MVT VT) const
Return true if this has less bits than VT.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
void ComputeMaskedBits(SDValue Op, APInt &KnownZero, APInt &KnownOne, unsigned Depth=0) const
static bool isSplatVector(SDNode *N)
static MachineBasicBlock * EmitPCMPSTRM(MachineInstr *MI, MachineBasicBlock *BB, const TargetInstrInfo *TII)
unsigned getFrameRegister(const MachineFunction &MF) const
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
unsigned getValNo() const
static SDValue LowerZERO_EXTEND(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
const SDValue & getBasePtr() const
static bool isMOVHLPS_v_undef_Mask(ArrayRef< int > Mask, MVT VT)
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offs=0, bool isT=false, unsigned char TargetFlags=0)
static bool MayFoldVectorLoad(SDValue V)
virtual MVT getScalarShiftAmountTy(EVT LHSTy) const
HSUB - Integer horizontal sub.
static SDValue PerformSINT_TO_FPCombine(SDNode *N, SelectionDAG &DAG, const X86TargetLowering *XTLI)
bool hasCmpxchg16b() const
static bool MayFoldLoad(SDValue Op)
static SDValue LowerToTLSGeneralDynamicModel64(GlobalAddressSDNode *GA, SelectionDAG &DAG, const EVT PtrVT)
static SDValue PerformFANDCombine(SDNode *N, SelectionDAG &DAG)
PerformFANDCombine - Do target-specific dag combines on X86ISD::FAND nodes.
bool bitwiseIsEqual(const APFloat &) const
Bitwise comparison for equality (QNaNs compare equal, 0!=-0).
unsigned getResNo() const
get the index which selects a specific result in the SDNode
bool bitsLT(EVT VT) const
bitsLT - Return true if this has less bits than VT.
virtual bool isZExtFree(Type *Ty1, Type *Ty2) const
bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedMask, APInt &KnownZero, APInt &KnownOne, TargetLoweringOpt &TLO, unsigned Depth=0) const
static SDValue Extract256BitVector(SDValue Vec, unsigned IdxVal, SelectionDAG &DAG, SDLoc dl)
Generate a DAG to grab 256-bits from a 512-bit vector.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
bool isAllOnesValue() const
SDValue getExternalSymbol(const char *Sym, EVT VT)
void setRegSaveFrameIndex(int Idx)
static SDValue getMOVDDup(SDValue &Op, SDLoc &dl, SDValue V1, SelectionDAG &DAG)
CallingConv::ID getCallingConv() const
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
EVT getValueType(Type *Ty, bool AllowUnknown=false) const
static MachinePointerInfo getFixedStack(int FI, int64_t offset=0)
virtual bool IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const
X86 bit-test instructions.
static Constant * getNullValue(Type *Ty)
static SDValue LowerADDC_ADDE_SUBC_SUBE(SDValue Op, SelectionDAG &DAG)
static bool isUndefOrInRange(int Val, int Low, int Hi)
static unsigned getShuffleSHUFImmediate(ShuffleVectorSDNode *N)
std::pair< const TargetRegisterClass *, uint8_t > findRepresentativeClass(MVT VT) const
bool isKnownNeverZero(SDValue Op) const
static SDValue LowerToTLSLocalDynamicModel(GlobalAddressSDNode *GA, SelectionDAG &DAG, const EVT PtrVT, bool is64Bit)
SDValue getLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, bool isVolatile, bool isNonTemporal, bool isInvariant, unsigned Alignment, const MDNode *TBAAInfo=0, const MDNode *Ranges=0)
bool isVector() const
isVector - Return true if this is a vector value type.
virtual const char * LowerXConstraint(EVT ConstraintVT) const
EVT getShiftAmountTy(EVT LHSTy) const
static SDValue getTargetShuffleNode(unsigned Opc, SDLoc dl, EVT VT, SDValue V1, SelectionDAG &DAG)
static SDValue OptimizeConditionalInDecrement(SDNode *N, SelectionDAG &DAG)
static const fltSemantics x87DoubleExtended
static StructReturnType argsAreStructReturn(const SmallVectorImpl< ISD::InputArg > &Ins)
static SDValue Insert128BitVector(SDValue Result, SDValue Vec, unsigned IdxVal, SelectionDAG &DAG, SDLoc dl)
static bool isX86LogicalCmp(SDValue Op)
SDValue getStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, bool isVolatile, bool isNonTemporal, unsigned Alignment, const MDNode *TBAAInfo=0)
static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
unsigned getVarArgsGPOffset() const
int64_t getOffset() const
static bool isPermImmMask(ArrayRef< int > Mask, MVT VT, unsigned &Imm8)
static bool MayFoldIntoStore(SDValue Op)
const HexagonInstrInfo * TII
bool hasDefaultVisibility() const
static bool isVPERMILPMask(ArrayRef< int > Mask, MVT VT)
bool isTargetDarwin() const
bool isNormalStore(const SDNode *N)
static bool isUNPCKL_v_undef_Mask(ArrayRef< int > Mask, MVT VT, bool HasInt256)
static SDValue EmitTailCallStoreRetAddr(SelectionDAG &DAG, MachineFunction &MF, SDValue Chain, SDValue RetAddrFrIdx, EVT PtrVT, unsigned SlotSize, int FPDiff, SDLoc dl)
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
unsigned isLoadFromStackSlot(const MachineInstr *MI, int &FrameIndex) const
#define llvm_unreachable(msg)
bool isBuildVectorAllZeros(const SDNode *N)
EVT getValueType(unsigned ResNo) const
static SDValue LowerAsSplatVectorLoad(SDValue SrcOp, MVT VT, SDLoc dl, SelectionDAG &DAG)
bool isVINSERT256Index(SDNode *N)
param_iterator param_end() const
const MachineInstrBuilder & addDisp(const MachineOperand &Disp, int64_t off, unsigned char TargetFlags=0) const
MachineFunction & getMachineFunction() const
bool isConsecutiveLoad(LoadSDNode *LD, LoadSDNode *Base, unsigned Bytes, int Dist) const
static unsigned getShufflePSHUFHWImmediate(ShuffleVectorSDNode *N)
virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
static bool isGlobalStubReference(unsigned char TargetFlag)
bool isInt< 8 >(int64_t x)
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const
SDValue getTargetGlobalAddress(const GlobalValue *GV, SDLoc DL, EVT VT, int64_t offset=0, unsigned char TargetFlags=0)
static Constant * get(ArrayRef< Constant * > V)
const TargetRegisterClass * getRegClass(unsigned Reg) const
std::vector< MachineBasicBlock * >::iterator succ_iterator
static SDValue LowerIntVSETCC_AVX512(SDValue Op, SelectionDAG &DAG)
void setCondCodeAction(ISD::CondCode CC, MVT VT, LegalizeAction Action)
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
MachinePointerInfo getWithOffset(int64_t O) const
void addBypassSlowDiv(unsigned int SlowBitWidth, unsigned int FastBitWidth)
Tells the code generator which bitwidths to bypass.
MVT getScalarType() const
static SDValue PerformSETCCCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
const Triple & getTargetTriple() const
EVT getScalarType() const
Abstract Stack Frame Information.
static SDValue LowerEXTRACT_VECTOR_ELT_SSE4(SDValue Op, SelectionDAG &DAG)
bool isFixedObjectIndex(int ObjectIdx) const
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
int getMaskElt(unsigned Idx) const
virtual bool isShuffleMaskLegal(const SmallVectorImpl< int > &Mask, EVT VT) const
unsigned getExtractVEXTRACT128Immediate(SDNode *N)
static SDValue LowerREADCYCLECOUNTER(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
SDVTList getVTList(EVT VT)
unsigned getStoreSize() const
bool needsStackRealignment(const MachineFunction &MF) const
virtual MVT getPointerTy(uint32_t=0) const
static SDValue Lower256IntArith(SDValue Op, SelectionDAG &DAG)
ID
LLVM Calling Convention Representation.
static bool isShift(MachineInstr *MI, int Opcode, int64_t Imm)
HADD - Integer horizontal add.
unsigned getVarArgsFPOffset() const
static SDValue Compact8x32ShuffleNode(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG)
const MachineInstrBuilder & addImm(int64_t Val) const
bool isInteger() const
isInteger - Return true if this is an integer, or a vector integer type.
X86TargetLowering(X86TargetMachine &TM)
unsigned getNumOperands() const
static SDValue LowerVECTOR_SHUFFLEtoBlend(ShuffleVectorSDNode *SVOp, const X86Subtarget *Subtarget, SelectionDAG &DAG)
SDValue getConstantFP(double Val, EVT VT, bool isTarget=false)
SmallVector< ISD::InputArg, 32 > Ins
X86 compare and logical compare instructions.
EVT getVectorElementType() const
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
SDValue getAtomic(unsigned Opcode, SDLoc dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, MachinePointerInfo PtrInfo, unsigned Alignment, AtomicOrdering Ordering, SynchronizationScope SynchScope)
virtual bool isVectorClearMaskLegal(const SmallVectorImpl< int > &Mask, EVT VT) const
virtual bool isSafeMemOpType(MVT VT) const
static bool isGlobalRelativeToPICBase(unsigned char TargetFlag)
SDValue getCALLSEQ_START(SDValue Chain, SDValue Op, SDLoc DL)
ConstraintType getConstraintType(const std::string &Constraint) const
unsigned isMacOSXVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
static SDValue PerformShuffleCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
PerformShuffleCombine - Performs several different shuffle combines.
unsigned getLocReg() const
static bool isVINSERTIndex(SDNode *N, unsigned vecWidth)
static unsigned getNumOfConsecutiveZeros(ShuffleVectorSDNode *SVOp, unsigned NumElems, bool ZerosFromLeft, SelectionDAG &DAG, unsigned PreferredNum=-1U)
static SDValue CommuteVectorShuffle(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG)
bool definesRegister(unsigned Reg, const TargetRegisterInfo *TRI=NULL) const
virtual const MCExpr * LowerCustomJumpTableEntry(const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB, unsigned uid, MCContext &Ctx) const
static unsigned getLoadOpcode(EVT VT)
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
size_t array_lengthof(T(&)[N])
Find the length of an array.
bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI=NULL) const
unsigned getNumValues() const
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
SDValue getRegisterMask(const uint32_t *RegMask)
FMAXC, FMINC - Commutative FMIN and FMAX.
bool hasStructRetAttr() const
Determine if the function returns a structure through first pointer argument.
SMAX, SMIN - Signed integer max and min.
enable_if_c< std::numeric_limits< T >::is_integer &&!std::numeric_limits< T >::is_signed, std::size_t >::type 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...
union llvm::X86AddressMode::@223 Base
SDValue CombineTo(SDNode *N, const std::vector< SDValue > &To, bool AddTo=true)
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
This contains information for each constraint that we are lowering.
Simple integer binary arithmetic operators.
SDValue getVectorShuffle(EVT VT, SDLoc dl, SDValue N1, SDValue N2, const int *MaskElts)
bool isMask_64(uint64_t Value)
bool isPICStyleRIPRel() const
static SDValue RewriteAsNarrowerShuffle(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG)
SmallVector< ISD::OutputArg, 32 > Outs
static void NormalizeMask(SmallVectorImpl< int > &Mask, unsigned NumElems)
static SDValue ExtractSubVector(SDValue Vec, unsigned IdxVal, SelectionDAG &DAG, SDLoc dl, unsigned vectorWidth)
static SDValue LowerToTLSExecModel(GlobalAddressSDNode *GA, SelectionDAG &DAG, const EVT PtrVT, TLSModel::Model model, bool is64Bit, bool isPIC)
static SDValue PerformISDSETCCCombine(SDNode *N, SelectionDAG &DAG)
virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const
bool isIntegerTypeFTOL(EVT VT) const
bool isFloatingPointTy() const
const SDValue & getBasePtr() const
virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const
getSetCCResultType - Return the value type to use for ISD::SETCC.
static SDValue LowerATOMIC_FENCE(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
bool isPICStyleStubAny() const
SDValue getUNDEF(EVT VT)
getUNDEF - Return an UNDEF node. UNDEF does not have a useful SDLoc.
static SDValue getScatterNode(unsigned Opc, SDValue Op, SelectionDAG &DAG, SDValue Src, SDValue Base, SDValue Index, SDValue ScaleOp, SDValue Chain)
static bool isMOVLMask(ArrayRef< int > Mask, EVT VT)
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const
static SDValue GetTLSADDR(SelectionDAG &DAG, SDValue Chain, GlobalAddressSDNode *GA, SDValue *InFlag, const EVT PtrVT, unsigned ReturnReg, unsigned char OperandFlags, bool LocalDynamic=false)
const APInt & getAPIntValue() const
APInt LLVM_ATTRIBUTE_UNUSED_RESULT shl(unsigned shiftAmt) const
Left-shift function.
void setVarArgsFrameIndex(int Idx)
EVT getMemoryVT() const
getMemoryVT - Return the type of the in-memory value.
static bool isTruncWithZeroHighBitsInput(SDValue V, SelectionDAG &DAG)
static unsigned getShufflePSHUFLWImmediate(ShuffleVectorSDNode *N)
CodeGenOpt::Level getOptLevel() const
bool isOperationLegalOrPromote(unsigned Op, EVT VT) const
static SDValue LowerCTLZ(SDValue Op, SelectionDAG &DAG)
static SDValue getUnpackh(SelectionDAG &DAG, SDLoc dl, MVT VT, SDValue V1, SDValue V2)
getUnpackh - Returns a vector_shuffle node for an unpackh operation.
virtual const char * LowerXConstraint(EVT ConstraintVT) const
static SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
size_t size() const
size - Get the array size.
void incNumLocalDynamicTLSAccesses()
int getRegSaveFrameIndex() const
const BasicBlock * getBasicBlock() const
static bool IsTailCallConvention(CallingConv::ID CC)
UNDEF - An undefined node.
void setVarArgsGPOffset(unsigned Offset)
static SDValue getLegalSplat(SelectionDAG &DAG, SDValue V, int EltNo)
getLegalSplat - Generate a legal splat with supported x86 shuffles
static SDValue LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG)
static SDValue Insert256BitVector(SDValue Result, SDValue Vec, unsigned IdxVal, SelectionDAG &DAG, SDLoc dl)
static SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG)
unsigned getX86SubSuperRegister(unsigned Reg, MVT::SimpleValueType VT, bool High)
static bool isSHUFPMask(ArrayRef< int > Mask, MVT VT, bool Commuted=false)
static bool isVEXTRACTIndex(SDNode *N, unsigned vecWidth)
static const MCSymbolRefExpr * Create(const MCSymbol *Symbol, MCContext &Ctx)
static bool isWeakForLinker(LinkageTypes Linkage)
bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef, unsigned &SplatBitSize, bool &HasAnyUndefs, unsigned MinSplatBits=0, bool isBigEndian=false)
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
static bool isTargetShuffle(unsigned Opcode)
mmo_iterator memoperands_end() const
virtual bool ExpandInlineAsm(CallInst *CI) const
unsigned char ClassifyBlockAddressReference() const
static SDValue LowerCTLZ_ZERO_UNDEF(SDValue Op, SelectionDAG &DAG)
static SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG)
SDNode * getNode() const
get the SDNode which holds the desired result
CondCode GetOppositeBranchCondition(X86::CondCode CC)
void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl< int > &ShuffleMask)
bundle_iterator< MachineInstr, instr_iterator > iterator
void setBytesToPopOnReturn(unsigned bytes)
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
static SDValue PerformMulCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI)
bool isX86_MMXTy() const
isX86_MMXTy - Return true if this is X86 MMX.
bool isTypeLegal(EVT VT) const
static SDValue LowerINSERT_VECTOR_ELT_SSE4(SDValue Op, SelectionDAG &DAG)
unsigned getTargetFlags() const
bool isNormalLoad(const SDNode *N)
virtual unsigned getJumpTableEncoding() const
void array_pod_sort(IteratorTy Start, IteratorTy End)
const MachineInstrBuilder & setMemRefs(MachineInstr::mmo_iterator b, MachineInstr::mmo_iterator e) const
static SDValue PerformADCCombine(SDNode *N, SelectionDAG &DAG, X86TargetLowering::DAGCombinerInfo &DCI)
bool isInteger() const
isInteger - Return true if this is an integer, or a vector integer type.
Control flow instructions. These all have token chains.
bool is256BitVector() const
is256BitVector - Return true if this is a 256-bit vector type.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=0)
* if(!EatIfPresent(lltok::kw_thread_local)) return false
bool isCallingConvWin64(CallingConv::ID CC) const
virtual bool isLegalICmpImmediate(int64_t Imm) const
unsigned getVectorNumElements() const
APInt LLVM_ATTRIBUTE_UNUSED_RESULT trunc(unsigned width) const
Truncate to new width.
static SDValue getMOVLP(SDValue &Op, SDLoc &dl, SelectionDAG &DAG, bool HasSSE2)
CodeModel::Model getCodeModel() const
LLVM Basic Block Representation.
static SDValue LowerBITCAST(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
const SDValue & getOperand(unsigned i) const
static SDValue getTargetVShiftByConstNode(unsigned Opc, SDLoc dl, EVT VT, SDValue SrcOp, uint64_t ShiftAmt, SelectionDAG &DAG)
bool isTargetCOFF() const
static SDValue PerformSubCombine(SDNode *N, SelectionDAG &DAG, const X86Subtarget *Subtarget)
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Simple binary floating point operators.
void setTargetDAGCombine(ISD::NodeType NT)
bool isNonTemporal() const
static bool isAndOrOfSetCCs(SDValue Op, unsigned &Opc)
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const
bool isPICStyleStubPIC() const
static SDValue PerformShiftCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
PerformShiftCombine - Combine shifts.
bool isOperationLegalOrCustom(unsigned Op, EVT VT) const
unsigned getOperandNo() const
LLVM Constant Representation.
static bool isZeroShuffle(ShuffleVectorSDNode *N)
static SDValue PromoteSplat(ShuffleVectorSDNode *SV, SelectionDAG &DAG)
PromoteSplat - Splat is promoted to target supported vector shuffles.
bool isVector() const
isVector - Return true if this is a vector value type.
REP_STOS - Repeat fill, corresponds to X86::REP_STOSx.
static SDValue getVZextMovL(MVT VT, MVT OpVT, SDValue SrcOp, SelectionDAG &DAG, const X86Subtarget *Subtarget, SDLoc dl)
virtual bool isTypeDesirableForOp(unsigned Opc, EVT VT) const
bool hasHiddenVisibility() const
const Constant * getConstVal() const
bool isFloatingPoint() const
isFloatingPoint - Return true if this is a FP, or a vector FP type.
const MachineOperand & getOperand(unsigned i) const
static SDValue buildFromShuffleMostly(SDValue Op, SelectionDAG &DAG)
param_iterator param_begin() const
bool isBeforeLegalizeOps() const
void DecodeSHUFPMask(MVT VT, unsigned Imm, SmallVectorImpl< int > &ShuffleMask)
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
virtual bool getStackCookieLocation(unsigned &AddressSpace, unsigned &Offset) const
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
void DecodePSHUFLWMask(MVT VT, unsigned Imm, SmallVectorImpl< int > &ShuffleMask)
void setBooleanContents(BooleanContent Ty)
static unsigned getCmpXChgOpcode(EVT VT)
static unsigned getNonAtomicOpcode(unsigned Opc)
void AddToWorklist(SDNode *N)
static SDValue PerformXorCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
ItTy next(ItTy it, Dist n)
SDValue getCopyFromReg(SDValue Chain, SDLoc dl, unsigned Reg, EVT VT)
static SDValue getUnpackl(SelectionDAG &DAG, SDLoc dl, MVT VT, SDValue V1, SDValue V2)
getUnpackl - Returns a vector_shuffle node for an unpackl operation.
const DataLayout * getDataLayout() const
bool isBeforeLegalize() const
unsigned getBitWidth() const
Return the number of bits in the APInt.
opStatus convert(const fltSemantics &, roundingMode, bool *)
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
bool hasOneMemOperand() const
static SDValue LowerBuildVectorv16i8(SDValue Op, unsigned NonZeros, unsigned NumNonZero, unsigned NumZero, SelectionDAG &DAG, const X86Subtarget *Subtarget, const TargetLowering &TLI)
unsigned getOpcode() const
TRAP - Trapping instruction.
REP_MOVS - Repeat move, corresponds to X86::REP_MOVSx.
unsigned GuaranteedTailCallOpt
static SDValue CMPEQCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
bool isPICStyleStubNoDynamic() const
void setPrefFunctionAlignment(unsigned Align)
DEBUGTRAP - Trap intended to get the attention of a debugger.
static bool isMOVSLDUPMask(ArrayRef< int > Mask, MVT VT, const X86Subtarget *Subtarget)
static SDValue EltsFromConsecutiveLoads(EVT VT, SmallVectorImpl< SDValue > &Elts, SDLoc &DL, SelectionDAG &DAG)
static SDValue LowerVectorBroadcast(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
static SDValue PerformZExtCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
Integer representation type.
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
CondCode getSetCCSwappedOperands(CondCode Operation)
AddrNumOperands - Total number of operands in a memory reference.
static SDValue getMOVHighToLow(SDValue &Op, SDLoc &dl, SelectionDAG &DAG)
BLENDI - Blend where the selector is an immediate.
static SDValue PerformTruncateCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
use_iterator use_begin() const
const SDValue & getValue() const
void AddPromotedToType(unsigned Opc, MVT OrigVT, MVT DestVT)
SDValue BuildFILD(SDValue Op, EVT SrcVT, SDValue Chain, SDValue StackSlot, SelectionDAG &DAG) const
virtual const char * getTargetNodeName(unsigned Opcode) const
unsigned MaxStoresPerMemmove
Specify maximum bytes of store instructions per memmove call.
Bit counting operators with an undefined result for zero inputs.
static SDValue LowerCTTZ(SDValue Op, SelectionDAG &DAG)
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
virtual bool isGAPlusOffset(SDNode *N, const GlobalValue *&GA, int64_t &Offset) const
bool isPICStyleGOT() const
succ_iterator succ_begin()
unsigned CountPopulation_64(uint64_t Value)
virtual const TargetFrameLowering * getFrameLowering() const
void setRAIndex(int Index)
static SDValue LowerVectorAllZeroTest(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
std::vector< ArgListEntry > ArgListTy
size_t find_first_not_of(char C, size_t From=0) const
bool isEqualTo(SDValue A, SDValue B) const
int getVarArgsFrameIndex() const
MCSymbol * getSymbol() const
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
virtual EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, MachineFunction &MF) const
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements)
static SDValue checkBoolTestSetCCCombine(SDValue Cmp, X86::CondCode &CC)
static SDValue getGatherNode(unsigned Opc, SDValue Op, SelectionDAG &DAG, SDValue Base, SDValue Index, SDValue ScaleOp, SDValue Chain, const X86Subtarget *Subtarget)
static SDValue NormalizeVectorShuffle(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
uint64_t getConstantOperandVal(unsigned Num) const
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
void setUseUnderscoreLongJmp(bool Val)
void setLibcallCallingConv(RTLIB::Libcall Call, CallingConv::ID CC)
Set the CallingConv that should be used for the specified libcall.
const MCInstrDesc & get(unsigned Opcode) const
SDValue CreateStackTemporary(EVT VT, unsigned minAlign=1)
static SDValue LowerVECTOR_SHUFFLEv32i8(ShuffleVectorSDNode *SVOp, const X86Subtarget *Subtarget, SelectionDAG &DAG)
unsigned getStackRegister() const
const MachinePointerInfo & getPointerInfo() const
void setIsKill(bool Val=true)
int64_t getObjectOffset(int ObjectIdx) const
static const MachineInstrBuilder & addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset=0, bool mem=true)
SDValue getMemcpy(SDValue Chain, SDLoc dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
bool isTargetWindows() const
virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const LLVM_OVERRIDE
Returns true if a cast between SrcAS and DestAS is a noop.
static SDValue LowerZERO_EXTEND_AVX512(SDValue Op, SelectionDAG &DAG)
bool isVEXTRACT256Index(SDNode *N)
unsigned getByValAlign() const
virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const
void SplitString(StringRef Source, SmallVectorImpl< StringRef > &OutFragments, StringRef Delimiters=" \t\n\v\f\r")
bool bitsGT(EVT VT) const
bitsGT - Return true if this has more bits than VT.
static StructReturnType callIsStructReturn(const SmallVectorImpl< ISD::OutputArg > &Outs)
void setLoadExtAction(unsigned ExtType, MVT VT, LegalizeAction Action)
static SDValue PerformFMACombine(SDNode *N, SelectionDAG &DAG, const X86Subtarget *Subtarget)
static SDValue LowerATOMIC_STORE(SDValue Op, SelectionDAG &DAG)
ArrayRef< int > getMask() const
virtual bool isLegalAddImmediate(int64_t Imm) const
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offset=0, unsigned char TargetFlags=0)
void initActions()
Initialize all of the actions to default values.
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags=0)
virtual const TargetInstrInfo * getInstrInfo() const
unsigned getABITypeAlignment(Type *Ty) const
bool isBuildVectorAllOnes(const SDNode *N)
Node predicates.
static Constant * getSplat(unsigned NumElts, Constant *Elt)
SDValue getTargetConstantFP(double Val, EVT VT)
static bool WillBeConstantPoolLoad(SDNode *N)
virtual bool isNarrowingProfitable(EVT VT1, EVT VT2) const
static bool isXor1OfSetCC(SDValue Op)
static SDValue performVZEXTCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
performVZEXTCombine - Performs build vector combines
SDValue getNOT(SDLoc DL, SDValue Val, EVT VT)
getNOT - Create a bitwise NOT operation as (XOR Val, -1).
static SDValue XFormVExtractWithShuffleIntoLoad(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI)
bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
virtual unsigned getJumpTableEncoding() const
static SDValue LowerVECTOR_SHUFFLEv16i8(ShuffleVectorSDNode *SVOp, const X86Subtarget *Subtarget, SelectionDAG &DAG)
Class for constant integers.
MCSymbol * getPICBaseSymbol() const
const STC & getSubtarget() const
static SDValue LowerCMP_SWAP(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
bool isBaseWithConstantOffset(SDValue Op) const
static unsigned getNonAtomicOpcodeWithExtraOpc(unsigned Opc, unsigned &ExtraOpc)
unsigned DisableTailCalls
void DecodePSHUFMask(MVT VT, unsigned Imm, SmallVectorImpl< int > &ShuffleMask)
uint64_t getTypeAllocSize(Type *Ty) const
void setExceptionPointerRegister(unsigned R)
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
static SDValue LowerSIGN_EXTEND(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
static SDValue Extract128BitVector(SDValue Vec, unsigned IdxVal, SelectionDAG &DAG, SDLoc dl)
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
bool isTarget64BitILP32() const
Is this x86_64 with the ILP32 programming model (x32 ABI)?
bool isTargetMingw() const
SDValue getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, bool isVolatile, bool isNonTemporal, unsigned Alignment, const MDNode *TBAAInfo=0)
int getOffsetOfLocalArea() const
static bool ShouldXformToMOVLP(SDNode *V1, SDNode *V2, ArrayRef< int > Mask, MVT VT)
CCValAssign - Represent assignment of one arg/retval to a location.
static bool CanFoldXORWithAllOnes(const SDNode *N)
static SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG)
bool hasSlowDivide() const
static SDValue PerformAddCombine(SDNode *N, SelectionDAG &DAG, const X86Subtarget *Subtarget)
PerformADDCombine - Do target-specific dag combines on integer adds.
static bool isVectorShiftRight(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG, bool &isLeft, SDValue &ShVal, unsigned &ShAmt)
static bool MatchingStackOffset(SDValue Arg, unsigned Offset, ISD::ArgFlagsTy Flags, MachineFrameInfo *MFI, const MachineRegisterInfo *MRI, const X86InstrInfo *TII)
SDValue getIntPtrConstant(uint64_t Val, bool isTarget=false)
const SDValue & getChain() const
bool isTargetLinux() const
static SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
Optimize X86ISD::CMOV [LHS, RHS, CONDCODE (e.g. X86::COND_NE), CONDVAL].
static SDValue LowerVectorIntExtend(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
Byte Swap and Counting operators.
static SDValue PerformBrCondCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
static SDValue ExtractBitFromMaskVector(SDNode *N, SelectionDAG &DAG)
unsigned getGlobalBaseReg(MachineFunction *MF) const
bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI=NULL) const
virtual const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const
unsigned getExtractVEXTRACT256Immediate(SDNode *N)
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
virtual bool isGAPlusOffset(SDNode *N, const GlobalValue *&GA, int64_t &Offset) const
static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, bool IsCommutative)
MachineFrameInfo * getFrameInfo()
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
static Constant * get(Type *Ty, double V)
void setAdjustsStack(bool V)
static MachinePointerInfo getStack(int64_t Offset)
getStack - stack pointer relative access.
void setForceFramePointer(bool forceFP)
static bool isUNPCKLMask(ArrayRef< int > Mask, MVT VT, bool HasInt256, bool V2IsSplat=false)
static SDValue LowerANY_EXTEND(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
double BitsToDouble(uint64_t Bits)
unsigned Log2_64_Ceil(uint64_t Value)
bool isAllOnesValue() const
static SDValue LowerLOAD_SUB(SDValue Op, SelectionDAG &DAG)
unsigned Log2_32(uint32_t Value)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
AttributeSet getAttributes() const
Return the attribute list for this Function.
static SDValue PerformSExtCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
bool is128BitVector() const
is128BitVector - Return true if this is a 128-bit vector type.
ISD::LoadExtType getExtensionType() const
static bool isShuffleLow128VectorInsertHigh(ShuffleVectorSDNode *SVOp)
Class for arbitrary precision integers.
SDValue getMemIntrinsicNode(unsigned Opcode, SDLoc dl, const EVT *VTs, unsigned NumVTs, const SDValue *Ops, unsigned NumOps, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, bool Vol=false, bool ReadMem=true, bool WriteMem=true)
bool isUInt< 32 >(uint64_t x)
void computeRegisterProperties()
void setExceptionSelectorRegister(unsigned R)
static unsigned getExtractVEXTRACTImmediate(SDNode *N, unsigned vecWidth)
static SDValue WidenMaskArithmetic(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
int64_t getSExtValue() const
op_iterator op_begin() const
void setTCReturnAddrDelta(int delta)
static unsigned getShufflePALIGNRImmediate(ShuffleVectorSDNode *SVOp)
virtual const TargetRegisterClass * getRegClassFor(MVT VT) const
static use_iterator use_end()
const uint32_t * getNoPreservedMask() const
void setPrefLoopAlignment(unsigned Align)
ZERO_EXTEND - Used for integer types, zeroing the new bits.
bool isPowerOf2_64(uint64_t Value)
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
static bool isUNPCKH_v_undef_Mask(ArrayRef< int > Mask, MVT VT, bool HasInt256)
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT)
ANY_EXTEND - Used for integer types. The high bits are undefined.
bool isUnalignedMemAccessFast() const
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(DefaultAlign), cl::values(clEnumValN(DefaultAlign,"arm-default-align","Generate unaligned accesses only on hardware/OS ""combinations that are known to support them"), clEnumValN(StrictAlign,"arm-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"arm-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
void DecodeUNPCKHMask(MVT VT, SmallVectorImpl< int > &ShuffleMask)
static SDValue PerformFADDCombine(SDNode *N, SelectionDAG &DAG, const X86Subtarget *Subtarget)
PerformFADDCombine - Do target-specific dag combines on floating point adds.
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit)
Get a value with a block of bits set.
const MachineInstrBuilder & addGlobalAddress(const GlobalValue *GV, int64_t Offset=0, unsigned char TargetFlags=0) const
UMAX, UMIN - Unsigned integer max and min.
static std::pair< unsigned, bool > matchIntegerMINMAX(SDValue Cond, EVT VT, SDValue LHS, SDValue RHS, SelectionDAG &DAG, const X86Subtarget *Subtarget)
Matches a VSELECT onto min/max or return 0 if the node doesn't match.
static SDValue LowerToTLSGeneralDynamicModel32(GlobalAddressSDNode *GA, SelectionDAG &DAG, const EVT PtrVT)
static bool isVPERM2X128Mask(ArrayRef< int > Mask, MVT VT, bool HasFp256)
void DecodeVPERM2X128Mask(MVT VT, unsigned Imm, SmallVectorImpl< int > &ShuffleMask)
static SDValue getTargetVShiftNode(unsigned Opc, SDLoc dl, EVT VT, SDValue SrcOp, SDValue ShAmt, SelectionDAG &DAG)
static MachinePointerInfo getGOT()
static SDValue LowerFGETSIGN(SDValue Op, SelectionDAG &DAG)
static unsigned getNonAtomic6432OpcodeWithExtraOpc(unsigned Opc, unsigned &HiOpc, unsigned &ExtraOpc)
void setArgumentStackSize(unsigned size)
static bool isMOVDDUPMask(ArrayRef< int > Mask, MVT VT)
uint64_t MinAlign(uint64_t A, uint64_t B)
static bool isMOVLHPSMask(ArrayRef< int > Mask, MVT VT)
unsigned countLeadingOnes() const
Count the number of leading one bits.
int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS, bool MayNeedSP=false, const AllocaInst *Alloca=0)
SDValue getStackArgumentTokenFactor(SDValue Chain)
static const MachineInstrBuilder & addDirectMem(const MachineInstrBuilder &MIB, unsigned Reg)
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned char TargetFlags=0)
uint64_t getConstantOperandVal(unsigned i) const
SmallVector< SDValue, 32 > OutVals
static const fltSemantics IEEEsingle
static bool LowerToByteSwap(CallInst *CI)
bool isX86_FP80Ty() const
isX86_FP80Ty - Return true if this is x86 long double.
static bool isScalarLoadToVector(SDNode *N, LoadSDNode **LD=NULL)
Bitwise operators - logical and, logical or, logical xor.
bool hasAnyUseOfValue(unsigned Value) const
pointer data()
data - Return a pointer to the vector's buffer, even if empty().
static SDValue PerformFMinFMaxCombine(SDNode *N, SelectionDAG &DAG)
bool is256BitVector() const
is256BitVector - Return true if this is a 256-bit vector type.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
bool isLiveIn(unsigned Reg) const
unsigned getSRetReturnReg() const
MachineRegisterInfo & getRegInfo()
static IntegerType * getInt32Ty(LLVMContext &C)
SDValue getReturnAddressFrameIndex(SelectionDAG &DAG) const
virtual void computeMaskedBitsForTargetNode(const SDValue Op, APInt &KnownZero, APInt &KnownOne, const SelectionDAG &DAG, unsigned Depth=0) const
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
bool isDeclaration() const
bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
unsigned getBytesToPopOnReturn() const
virtual bool isFMAFasterThanFMulAndFAdd(EVT VT) const
static bool isVectorShift(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG, bool &isLeft, SDValue &ShVal, unsigned &ShAmt)
static SDValue PerformShuffleCombine256(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
PerformShuffleCombine256 - Performs shuffle combines for 256-bit vectors.
static SDValue PerformFSUBCombine(SDNode *N, SelectionDAG &DAG, const X86Subtarget *Subtarget)
PerformFSUBCombine - Do target-specific dag combines on floating point subs.
void DecodePSHUFHWMask(MVT VT, unsigned Imm, SmallVectorImpl< int > &ShuffleMask)
IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
static SDValue LowerShift(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
static SDValue Concat128BitVectors(SDValue V1, SDValue V2, EVT VT, unsigned NumElems, SelectionDAG &DAG, SDLoc dl)
unsigned getSizeInBits() const
getSizeInBits - Return the size of the specified value type in bits.
void ReplaceAllUsesWith(SDValue From, SDValue Op)
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
static SDValue getShuffleVectorZeroOrUndef(SDValue V2, unsigned Idx, bool IsZero, const X86Subtarget *Subtarget, SelectionDAG &DAG)
static bool isShuffleHigh128VectorInsertLow(ShuffleVectorSDNode *SVOp)
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
ANDNP - Bitwise Logical AND NOT of Packed FP values.
FunctionType * getFunctionType() const
static SDValue getMScatterNode(unsigned Opc, SDValue Op, SelectionDAG &DAG, SDValue Src, SDValue Mask, SDValue Base, SDValue Index, SDValue ScaleOp, SDValue Chain)
unsigned MaxStoresPerMemmoveOptSize
unsigned MaxStoresPerMemcpyOptSize
void setStackPointerRegisterToSaveRestore(unsigned R)
static bool IsCCallConvention(CallingConv::ID CC)
Return true if the calling convention is a C calling convention.
static bool checkAndUpdateEFLAGSKill(MachineBasicBlock::iterator SelectItr, MachineBasicBlock *BB, const TargetRegisterInfo *TRI)
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
bool hasProtectedVisibility() const
bool isSignBit() const
Check if the APInt's value is returned by getSignBit.
op_iterator op_end() const
uint8_t getFlags() const
getFlags - Return the MI flags bitvector.
const TargetMachine & getTarget() const
void setLibcallName(RTLIB::Libcall Call, const char *Name)
Rename the default libcall routine name for the specified libcall.
static SDValue PerformLOADCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
PerformLOADCombine - Do target-specific dag combines on LOAD nodes.
unsigned getSlotSize() const
MachineSDNode * getMachineNode(unsigned Opcode, SDLoc dl, EVT VT)
virtual const TargetRegisterInfo * getRegisterInfo() const
bool isNON_EXTLoad(const SDNode *N)
unsigned getPrimitiveSizeInBits() const
enum llvm::X86AddressMode::@222 BaseType
FSINCOS - Compute both fsin and fcos as a single operation.
static SDValue LowerXALUO(SDValue Op, SelectionDAG &DAG)
bool hasType(EVT vt) const
static SDValue performIntegerAbsCombine(SDNode *N, SelectionDAG &DAG)
unsigned MaxStoresPerMemcpy
Specify maximum bytes of store instructions per memcpy call.
static SDValue LowerVECTOR_SHUFFLEv8i16(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
static SDValue LowerVECTOR_SHUFFLE_256(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG)
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
virtual bool allowsUnalignedMemoryAccesses(EVT VT, bool *Fast) const
unsigned getInsertVINSERT256Immediate(SDNode *N)
static SDValue LowerVACOPY(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
MachineInstr * getVRegDef(unsigned Reg) const
static SDValue LowerScalarVariableShift(SDValue Op, SelectionDAG &DAG, const X86Subtarget *Subtarget)
bool hasLocalLinkage() const
static SDValue LowerSDIV(SDValue Op, SelectionDAG &DAG)
static bool isMOVLPMask(ArrayRef< int > Mask, MVT VT)
bool is128BitVector() const
is128BitVector - Return true if this is a 128-bit vector type.
bool isCalleePop(CallingConv::ID CallingConv, bool is64Bit, bool IsVarArg, bool TailCallOpt)
TLSModel::Model getTLSModel(const GlobalValue *GV) const
unsigned EnableSegmentedStacks
unsigned getReg() const
getReg - Returns the register number.
bool isFloatingPoint() const
isFloatingPoint - Return true if this is a FP, or a vector FP type.
The C convention as implemented on Windows/x86-64. This convention differs from the more common X86_6...
static bool isUNPCKHMask(ArrayRef< int > Mask, MVT VT, bool HasInt256, bool V2IsSplat=false)
static SDValue PerformBTCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI)
static SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
static unsigned getNonAtomic6432Opcode(unsigned Opc, unsigned &HiOpc)
virtual FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo) const
void insert(iterator MBBI, MachineBasicBlock *MBB)
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
void setReturnAddressIsTaken(bool s)
bool isTargetWin64() const
unsigned getAlignment() const
virtual const TargetRegisterClass * getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
static SDValue PerformSTORECombine(SDNode *N, SelectionDAG &DAG, const X86Subtarget *Subtarget)
PerformSTORECombine - Do target-specific dag combines on STORE nodes.
SDValue getZExtOrTrunc(SDValue Op, SDLoc DL, EVT VT)
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
static bool hasFPCMov(unsigned X86CC)
LLVM Value Representation.
virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue getRegister(unsigned Reg, EVT VT)
bool bitsGT(MVT VT) const
Return true if this has more bits than VT.
void setUseUnderscoreSetJmp(bool Val)
FHADD - Floating point horizontal add.
void setSRetReturnReg(unsigned Reg)
static SDValue InsertSubVector(SDValue Result, SDValue Vec, unsigned IdxVal, SelectionDAG &DAG, SDLoc dl, unsigned vectorWidth)
static unsigned getPseudoCMOVOpc(EVT VT)
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
void DecodeVPERMMask(unsigned Imm, SmallVectorImpl< int > &ShuffleMask)
static VectorType * get(Type *ElementType, unsigned NumElements)
bool isTruncatingStore() const
void push_back(MachineBasicBlock *MBB)
static SDValue LowerSIGN_EXTEND_AVX512(SDValue Op, SelectionDAG &DAG)
SDValue getValueType(EVT)
Disable implicit floating point insts.
bool hasDLLImportLinkage() const
const MachineInstrBuilder & addOperand(const MachineOperand &MO) const
uint64_t getTypeSizeInBits(Type *Ty) const
BasicBlockListType::iterator iterator
const TargetLowering & getTargetLoweringInfo() const
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
static bool isShuffleMaskConsecutive(ShuffleVectorSDNode *SVOp, unsigned MaskI, unsigned MaskE, unsigned OpIdx, unsigned NumElems, unsigned &OpNum)
static bool getTargetShuffleMask(SDNode *N, MVT VT, SmallVectorImpl< int > &Mask, bool &IsUnary)
static void getMaxByValAlign(Type *Ty, unsigned &MaxAlign)
bool isPowerOf2_32(uint32_t Value)
bool isZeroNode(SDValue Elt)
vt_iterator vt_begin() const
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zext(unsigned width) const
Zero extend to a new width.
SDValue getMergeValues(const SDValue *Ops, unsigned NumOps, SDLoc dl)
getMergeValues - Create a MERGE_VALUES node from the given operands.
void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl< int > &ShuffleMask)
unsigned MaxStoresPerMemset
Specify maximum number of store instructions per memset call.
unsigned MaxStoresPerMemsetOptSize
const MCRegisterInfo & MRI
static unsigned getInsertVINSERTImmediate(SDNode *N, unsigned vecWidth)
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
SDValue getTargetConstant(uint64_t Val, EVT VT)
bool isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M, bool hasSymbolicDisplacement=true)
SDValue getSetCC(SDLoc DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
unsigned getLocMemOffset() const
MVT getVectorElementType() const
static SDValue Lower256IntVSETCC(SDValue Op, SelectionDAG &DAG)
static bool isPALIGNRMask(ArrayRef< int > Mask, MVT VT, const X86Subtarget *Subtarget)
static SDValue PerformSHLCombine(SDNode *N, SelectionDAG &DAG)
SDValue getEntryNode() const
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool Immutable)
bool SignBitIsZero(SDValue Op, unsigned Depth=0) const
static Constant * get(LLVMContext &Context, ArrayRef< uint8_t > Elts)
TRUNCATE - Completely drop the high bits.
unsigned getAlignment() const
virtual SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
iterator find(const KeyT &Val)
bool isTargetFTOL() const
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
static bool isPSHUFLWMask(ArrayRef< int > Mask, MVT VT, bool HasInt256)
MVT getSimpleValueType(unsigned ResNo) const
bool is512BitVector() const
is512BitVector - Return true if this is a 512-bit vector type.
void setObjectAlignment(int ObjectIdx, unsigned Align)
setObjectAlignment - Change the alignment of the specified stack object.
virtual unsigned getByValTypeAlignment(Type *Ty) const
std::vector< ConstraintInfo > ConstraintInfoVector
static SDValue LowerAVXExtend(SDValue Op, SelectionDAG &DAG, const X86Subtarget *Subtarget)
bool isScalarFPTypeInSSEReg(EVT VT) const
static SDValue PerformOrCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
static SDValue LowerAVXCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG)
unsigned AllocateStack(unsigned Size, unsigned Align)
void addSuccessor(MachineBasicBlock *succ, uint32_t weight=0)
static bool clobbersFlagRegisters(const SmallVector< StringRef, 4 > &AsmPieces)
bool isEmpty() const
Return true if there are no attributes.
void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd)
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
unsigned Log2_64(uint64_t Value)
int64_t getObjectSize(int ObjectIdx) const
static const MachineInstrBuilder & addFullAddress(const MachineInstrBuilder &MIB, const X86AddressMode &AM)
static bool isSplatMask(const int *Mask, EVT VT)
bool isOnlyUserOf(SDNode *N) const
EVT changeVectorElementTypeToInteger() const
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
static SDValue LowerMUL(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
static bool isCommutedMOVLMask(ArrayRef< int > Mask, MVT VT, bool V2IsSplat=false, bool V2IsUndef=false)
bool PredictableSelectIsExpensive
bool isTargetEnvMacho() const
static SDValue LowerFSINCOS(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
DebugLoc getDebugLoc() const
static SDValue Concat256BitVectors(SDValue V1, SDValue V2, EVT VT, unsigned NumElems, SelectionDAG &DAG, SDLoc dl)
static SDValue PerformVZEXT_MOVLCombine(SDNode *N, SelectionDAG &DAG)
static SDValue LowerVSETCC(SDValue Op, const X86Subtarget *Subtarget, SelectionDAG &DAG)
static ConstraintInfoVector ParseConstraints(StringRef ConstraintString)
static void ReplaceATOMIC_LOAD(SDNode *Node, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
void CommitTargetLoweringOpt(const TargetLoweringOpt &TLO)
static bool isMOVSHDUPMask(ArrayRef< int > Mask, MVT VT, const X86Subtarget *Subtarget)
static SDValue PerformAndCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget *Subtarget)
static bool isVectorShiftLeft(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG, bool &isLeft, SDValue &ShVal, unsigned &ShAmt)
bool empty() const
empty - Check if the string is empty.
static SDValue CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain, ISD::ArgFlagsTy Flags, SelectionDAG &DAG, SDLoc dl)
uint64_t getZExtValue() const
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
unsigned getVectorNumElements() const