31 #define DEBUG_TYPE "systemz-lower" 37 : Op0(Op0In), Op1(Op1In), Opcode(0), ICmpType(0), CCValid(0), CCMask(0) {}
610 LongDisplacement(LongDispl), IndexReg(IdxReg) {}
633 switch (II->getIntrinsicID()) {
635 case Intrinsic::memset:
636 case Intrinsic::memmove:
637 case Intrinsic::memcpy:
642 if (isa<LoadInst>(I) && I->
hasOneUse()) {
644 if (SingleUser->getParent() == I->
getParent()) {
645 if (isa<ICmpInst>(SingleUser)) {
646 if (
auto *
C = dyn_cast<ConstantInt>(SingleUser->getOperand(1)))
647 if (
C->getBitWidth() <= 64 &&
651 }
else if (isa<StoreInst>(SingleUser))
655 }
else if (
auto *StoreI = dyn_cast<StoreInst>(I)) {
656 if (
auto *LoadI = dyn_cast<LoadInst>(StoreI->getValueOperand()))
657 if (LoadI->hasOneUse() && LoadI->getParent() == I->
getParent())
662 if (HasVector && (isa<LoadInst>(I) || isa<StoreInst>(I))) {
673 bool IsVectorAccess = MemAccessTy->
isVectorTy();
677 if (!IsVectorAccess && isa<StoreInst>(I)) {
679 if (isa<ExtractElementInst>(DataOp))
680 IsVectorAccess =
true;
685 if (!IsVectorAccess && isa<LoadInst>(I) && I->
hasOneUse()) {
687 if (isa<InsertElementInst>(LoadUser))
688 IsVectorAccess =
true;
691 if (IsFPAccess || IsVectorAccess)
718 return AM.
Scale == 0;
729 return FromBits > ToBits;
737 return FromBits > ToBits;
746 if (Constraint.
size() == 1) {
747 switch (Constraint[0]) {
779 const char *constraint)
const {
788 switch (*constraint) {
808 Subtarget.hasVector())
813 if (
auto *
C = dyn_cast<ConstantInt>(CallOperandVal))
819 if (
auto *
C = dyn_cast<ConstantInt>(CallOperandVal))
820 if (isUInt<12>(
C->getZExtValue()))
825 if (
auto *
C = dyn_cast<ConstantInt>(CallOperandVal))
831 if (
auto *
C = dyn_cast<ConstantInt>(CallOperandVal))
832 if (isInt<20>(
C->getSExtValue()))
837 if (
auto *
C = dyn_cast<ConstantInt>(CallOperandVal))
838 if (
C->getZExtValue() == 0x7fffffff)
848 static std::pair<unsigned, const TargetRegisterClass *>
850 const unsigned *Map,
unsigned Size) {
851 assert(*(Constraint.
end()-1) ==
'}' &&
"Missing '}'");
852 if (isdigit(Constraint[2])) {
855 Constraint.
slice(2, Constraint.
size() - 1).getAsInteger(10, Index);
856 if (!Failed && Index < Size && Map[Index])
857 return std::make_pair(Map[Index], RC);
859 return std::make_pair(0U,
nullptr);
862 std::pair<unsigned, const TargetRegisterClass *>
865 if (Constraint.
size() == 1) {
867 switch (Constraint[0]) {
872 return std::make_pair(0U, &SystemZ::GR64BitRegClass);
874 return std::make_pair(0U, &SystemZ::GR128BitRegClass);
875 return std::make_pair(0U, &SystemZ::GR32BitRegClass);
879 return std::make_pair(0U, &SystemZ::ADDR64BitRegClass);
881 return std::make_pair(0U, &SystemZ::ADDR128BitRegClass);
882 return std::make_pair(0U, &SystemZ::ADDR32BitRegClass);
885 return std::make_pair(0U, &SystemZ::GRH32BitRegClass);
889 return std::make_pair(0U, &SystemZ::FP64BitRegClass);
891 return std::make_pair(0U, &SystemZ::FP128BitRegClass);
892 return std::make_pair(0U, &SystemZ::FP32BitRegClass);
895 if (Subtarget.hasVector()) {
897 return std::make_pair(0U, &SystemZ::VR32BitRegClass);
899 return std::make_pair(0U, &SystemZ::VR64BitRegClass);
900 return std::make_pair(0U, &SystemZ::VR128BitRegClass);
905 if (Constraint.
size() > 0 && Constraint[0] ==
'{') {
910 if (Constraint[1] ==
'r') {
920 if (Constraint[1] ==
'f') {
930 if (Constraint[1] ==
'v') {
946 std::vector<SDValue> &Ops,
949 if (Constraint.length() == 1) {
950 switch (Constraint[0]) {
952 if (
auto *
C = dyn_cast<ConstantSDNode>(Op))
959 if (
auto *
C = dyn_cast<ConstantSDNode>(Op))
960 if (isUInt<12>(
C->getZExtValue()))
966 if (
auto *
C = dyn_cast<ConstantSDNode>(Op))
973 if (
auto *
C = dyn_cast<ConstantSDNode>(Op))
974 if (isInt<20>(
C->getSExtValue()))
980 if (
auto *
C = dyn_cast<ConstantSDNode>(Op))
981 if (
C->getZExtValue() == 0x7fffffff)
994 #include "SystemZGenCallingConv.inc" 998 static const MCPhysReg ScratchRegs[] = { SystemZ::R0D, SystemZ::R1D,
1004 Type *ToType)
const {
1021 for (
unsigned i = 0; i < Ins.
size(); ++i)
1026 for (
unsigned i = 0; i < Outs.
size(); ++i)
1100 if (Subtarget.hasVector())
1108 unsigned NumFixedGPRs = 0;
1109 unsigned NumFixedFPRs = 0;
1110 for (
unsigned I = 0,
E = ArgLocs.
size();
I !=
E; ++
I) {
1123 RC = &SystemZ::GR32BitRegClass;
1127 RC = &SystemZ::GR64BitRegClass;
1131 RC = &SystemZ::FP32BitRegClass;
1135 RC = &SystemZ::FP64BitRegClass;
1143 RC = &SystemZ::VR128BitRegClass;
1164 ArgValue = DAG.
getLoad(LocVT, DL, Chain, FIN,
1175 unsigned ArgIndex = Ins[
I].OrigArgIndex;
1176 assert (Ins[
I].PartOffset == 0);
1177 while (
I + 1 !=
E && Ins[
I + 1].OrigArgIndex == ArgIndex) {
1179 unsigned PartOffset = Ins[
I + 1].PartOffset;
1197 int64_t StackSize = CCInfo.getNextStackOffset();
1202 int64_t RegSaveOffset = TFL->getOffsetOfLocalArea();
1215 &SystemZ::FP64BitRegClass);
1223 SystemZ::NumArgFPRs-NumFixedFPRs));
1236 for (
unsigned I = 0,
E = ArgLocs.
size();
I !=
E; ++
I) {
1243 if (Reg == SystemZ::R6H || Reg == SystemZ::R6L || Reg == SystemZ::R6D)
1245 if (Outs[
I].Flags.isSwiftSelf() || Outs[
I].Flags.isSwiftError())
1268 if (Subtarget.hasVector()) {
1284 unsigned NumBytes = ArgCCInfo.getNextStackOffset();
1294 for (
unsigned I = 0,
E = ArgLocs.
size();
I !=
E; ++
I) {
1301 int FI = cast<FrameIndexSDNode>(SpillSlot)->getIndex();
1303 DAG.
getStore(Chain, DL, ArgValue, SpillSlot,
1307 unsigned ArgIndex = Outs[
I].OrigArgIndex;
1308 assert (Outs[
I].PartOffset == 0);
1309 while (
I + 1 !=
E && Outs[
I + 1].OrigArgIndex == ArgIndex) {
1310 SDValue PartValue = OutVals[
I + 1];
1311 unsigned PartOffset = Outs[
I + 1].PartOffset;
1315 DAG.
getStore(Chain, DL, PartValue, Address,
1319 ArgValue = SpillSlot;
1346 if (!MemOpChains.
empty())
1353 if (
auto *
G = dyn_cast<GlobalAddressSDNode>(Callee)) {
1356 }
else if (
auto *
E = dyn_cast<ExternalSymbolSDNode>(Callee)) {
1359 }
else if (IsTailCall) {
1360 Chain = DAG.
getCopyToReg(Chain, DL, SystemZ::R1D, Callee, Glue);
1366 for (
unsigned I = 0,
E = RegsToPass.
size();
I !=
E; ++
I) {
1379 for (
unsigned I = 0,
E = RegsToPass.
size();
I !=
E; ++
I)
1381 RegsToPass[I].second.getValueType()));
1386 assert(Mask &&
"Missing call preserved mask for calling convention");
1413 for (
unsigned I = 0,
E = RetLocs.
size(); I !=
E; ++
I) {
1436 if (Subtarget.hasVector())
1441 for (
auto &Out : Outs)
1446 CCState RetCCInfo(CallConv, isVarArg, MF, RetLocs, Context);
1447 return RetCCInfo.
CheckReturn(Outs, RetCC_SystemZ);
1459 if (Subtarget.hasVector())
1468 if (RetLocs.
empty())
1475 for (
unsigned I = 0,
E = RetLocs.
size();
I !=
E; ++
I) {
1487 Chain = DAG.
getCopyToReg(Chain, DL, Reg, RetValue, Glue);
1504 unsigned &CCValid) {
1505 unsigned Id = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
1507 case Intrinsic::s390_tbegin:
1512 case Intrinsic::s390_tbegin_nofloat:
1517 case Intrinsic::s390_tend:
1531 unsigned Id = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
1533 case Intrinsic::s390_vpkshs:
1534 case Intrinsic::s390_vpksfs:
1535 case Intrinsic::s390_vpksgs:
1540 case Intrinsic::s390_vpklshs:
1541 case Intrinsic::s390_vpklsfs:
1542 case Intrinsic::s390_vpklsgs:
1547 case Intrinsic::s390_vceqbs:
1548 case Intrinsic::s390_vceqhs:
1549 case Intrinsic::s390_vceqfs:
1550 case Intrinsic::s390_vceqgs:
1555 case Intrinsic::s390_vchbs:
1556 case Intrinsic::s390_vchhs:
1557 case Intrinsic::s390_vchfs:
1558 case Intrinsic::s390_vchgs:
1563 case Intrinsic::s390_vchlbs:
1564 case Intrinsic::s390_vchlhs:
1565 case Intrinsic::s390_vchlfs:
1566 case Intrinsic::s390_vchlgs:
1571 case Intrinsic::s390_vtm:
1576 case Intrinsic::s390_vfaebs:
1577 case Intrinsic::s390_vfaehs:
1578 case Intrinsic::s390_vfaefs:
1583 case Intrinsic::s390_vfaezbs:
1584 case Intrinsic::s390_vfaezhs:
1585 case Intrinsic::s390_vfaezfs:
1590 case Intrinsic::s390_vfeebs:
1591 case Intrinsic::s390_vfeehs:
1592 case Intrinsic::s390_vfeefs:
1597 case Intrinsic::s390_vfeezbs:
1598 case Intrinsic::s390_vfeezhs:
1599 case Intrinsic::s390_vfeezfs:
1604 case Intrinsic::s390_vfenebs:
1605 case Intrinsic::s390_vfenehs:
1606 case Intrinsic::s390_vfenefs:
1611 case Intrinsic::s390_vfenezbs:
1612 case Intrinsic::s390_vfenezhs:
1613 case Intrinsic::s390_vfenezfs:
1618 case Intrinsic::s390_vistrbs:
1619 case Intrinsic::s390_vistrhs:
1620 case Intrinsic::s390_vistrfs:
1625 case Intrinsic::s390_vstrcbs:
1626 case Intrinsic::s390_vstrchs:
1627 case Intrinsic::s390_vstrcfs:
1632 case Intrinsic::s390_vstrczbs:
1633 case Intrinsic::s390_vstrczhs:
1634 case Intrinsic::s390_vstrczfs:
1639 case Intrinsic::s390_vfcedbs:
1640 case Intrinsic::s390_vfcesbs:
1645 case Intrinsic::s390_vfchdbs:
1646 case Intrinsic::s390_vfchsbs:
1651 case Intrinsic::s390_vfchedbs:
1652 case Intrinsic::s390_vfchesbs:
1657 case Intrinsic::s390_vftcidb:
1658 case Intrinsic::s390_vftcisb:
1663 case Intrinsic::s390_tdc:
1681 for (
unsigned I = 2;
I < NumOps; ++
I)
1700 for (
unsigned I = 1;
I < NumOps; ++
I)
1714 case ISD::SET##X: return SystemZ::CCMASK_CMP_##X; \ 1715 case ISD::SETO##X: return SystemZ::CCMASK_CMP_##X; \ 1716 case ISD::SETU##X: return SystemZ::CCMASK_CMP_UO | SystemZ::CCMASK_CMP_##X 1745 int64_t
Value = ConstOp1->getSExtValue();
1751 C.Op1 = DAG.
getConstant(0, DL, C.Op1.getValueType());
1761 if (!C.Op0.hasOneUse() ||
1767 auto *
Load = cast<LoadSDNode>(C.Op0);
1768 unsigned NumBits =
Load->getMemoryVT().getStoreSizeInBits();
1769 if (NumBits != 8 && NumBits != 16)
1774 auto *ConstOp1 = cast<ConstantSDNode>(C.Op1);
1775 uint64_t
Value = ConstOp1->getZExtValue();
1776 uint64_t
Mask = (1 << NumBits) - 1;
1779 int64_t SignedValue = ConstOp1->getSExtValue();
1780 if (uint64_t(SignedValue) + (uint64_t(1) << (NumBits - 1)) > Mask)
1786 }
else if (NumBits == 8) {
1812 if (C.Op0.getValueType() !=
MVT::i32 ||
1815 Load->getBasePtr(),
Load->getPointerInfo(),
1816 Load->getMemoryVT(),
Load->getAlignment(),
1817 Load->getMemOperand()->getFlags());
1823 if (C.Op1.getValueType() !=
MVT::i32 ||
1824 Value != ConstOp1->getZExtValue())
1837 switch (
Load->getExtensionType()) {
1860 if (isa<ConstantFPSDNode>(C.Op1))
1866 if (ConstOp1 && ConstOp1->getZExtValue() == 0)
1895 unsigned Opcode0 = C.Op0.getOpcode();
1903 cast<ConstantSDNode>(C.Op0.getOperand(1))->getZExtValue() == 0xffffffff)
1925 for (
auto I = C.Op0->use_begin(),
E = C.Op0->use_end();
I !=
E; ++
I) {
1944 if (C1 && C1->isZero()) {
1945 for (
auto I = C.Op0->use_begin(),
E = C.Op0->use_end();
I !=
E; ++
I) {
1964 if (C.Op0.getOpcode() ==
ISD::SHL &&
1965 C.Op0.getValueType() ==
MVT::i64 &&
1967 cast<ConstantSDNode>(C.Op1)->getZExtValue() == 0) {
1969 if (C1 && C1->getZExtValue() == 32) {
1970 SDValue ShlOp0 = C.Op0.getOperand(0);
1990 C.Op0.getOperand(0).getOpcode() ==
ISD::LOAD &&
1992 cast<ConstantSDNode>(C.Op1)->getZExtValue() == 0) {
1993 auto *L = cast<LoadSDNode>(C.Op0.getOperand(0));
1994 if (L->getMemoryVT().getStoreSizeInBits() <= C.Op0.getValueSizeInBits()) {
1995 unsigned Type = L->getExtensionType();
1998 C.Op0 = C.Op0.getOperand(0);
1999 C.Op1 = DAG.
getConstant(0, DL, C.Op0.getValueType());
2027 uint64_t
Mask, uint64_t CmpVal,
2028 unsigned ICmpType) {
2029 assert(Mask != 0 &&
"ANDs with zero should have been removed by now");
2038 uint64_t
High = uint64_t(1) << HighShift;
2052 if (EffectivelyUnsigned && CmpVal > 0 && CmpVal <= Low) {
2058 if (EffectivelyUnsigned && CmpVal < Low) {
2066 if (CmpVal == Mask) {
2072 if (EffectivelyUnsigned && CmpVal >= Mask - Low && CmpVal < Mask) {
2078 if (EffectivelyUnsigned && CmpVal > Mask - Low && CmpVal <= Mask) {
2086 if (EffectivelyUnsigned && CmpVal >= Mask - High && CmpVal < High) {
2092 if (EffectivelyUnsigned && CmpVal > Mask - High && CmpVal <= High) {
2101 if (Mask == Low + High) {
2130 if (C.Op0.getOpcode() ==
ISD::AND) {
2131 NewC.Op0 = C.Op0.getOperand(0);
2132 NewC.Op1 = C.Op0.getOperand(1);
2141 if (NewC.Op0.getValueType() !=
MVT::i64 ||
2149 if (CmpVal == uint64_t(-1))
2156 MaskVal = -(CmpVal & -CmpVal);
2164 unsigned BitSize = NewC.Op0.getValueSizeInBits();
2165 unsigned NewCCMask, ShiftVal;
2167 NewC.Op0.getOpcode() ==
ISD::SHL &&
2169 (MaskVal >> ShiftVal != 0) &&
2170 ((CmpVal >> ShiftVal) << ShiftVal) == CmpVal &&
2172 MaskVal >> ShiftVal,
2175 NewC.Op0 = NewC.Op0.getOperand(0);
2176 MaskVal >>= ShiftVal;
2178 NewC.Op0.getOpcode() ==
ISD::SRL &&
2180 (MaskVal << ShiftVal != 0) &&
2181 ((CmpVal << ShiftVal) >> ShiftVal) == CmpVal &&
2183 MaskVal << ShiftVal,
2186 NewC.Op0 = NewC.Op0.getOperand(0);
2187 MaskVal <<= ShiftVal;
2201 C.Op1 = DAG.
getConstant(MaskVal, DL, C.Op0.getValueType());
2203 C.CCMask = NewCCMask;
2218 if ((~Known.
Zero).getZExtValue() & ~
Mask->getZExtValue())
2221 C.Op0 = C.Op0.getOperand(0);
2229 SDValue Call,
unsigned CCValid, uint64_t CC,
2233 C.CCValid = CCValid;
2236 C.CCMask = CC < 4 ? 1 << (3 - CC) : 0;
2239 C.CCMask = CC < 4 ? ~(1 << (3 - CC)) : -1;
2243 C.CCMask = CC < 4 ? ~0U << (4 - CC) : -1;
2246 C.CCMask = CC < 4 ? ~(~0U << (4 - CC)) : 0;
2250 C.CCMask = CC < 4 ? ~0U << (3 - CC) : -1;
2253 C.CCMask = CC < 4 ? ~(~0U << (3 - CC)) : 0;
2256 C.CCMask &= CCValid;
2264 uint64_t
Constant = cast<ConstantSDNode>(CmpOp1)->getZExtValue();
2265 unsigned Opcode, CCValid;
2275 Comparison
C(CmpOp0, CmpOp1);
2277 if (C.Op0.getValueType().isFloatingPoint()) {
2317 if (!C.Op1.getNode()) {
2319 switch (C.Op0.getOpcode()) {
2374 unsigned CCValid,
unsigned CCMask) {
2431 int Mask[] = { Start, -1, Start + 1, -1 };
2446 !Subtarget.hasVectorEnhancements1()) {
2455 return DAG.
getNode(Opcode, DL, VT, CmpOp0, CmpOp1);
2466 bool Invert =
false;
2474 assert(IsFP &&
"Unexpected integer comparison");
2486 assert(IsFP &&
"Unexpected integer comparison");
2498 Cmp = getVectorCmp(DAG, Opcode, DL, VT, CmpOp0, CmpOp1);
2502 Cmp = getVectorCmp(DAG, Opcode, DL, VT, CmpOp1, CmpOp0);
2525 return lowerVectorSETCC(DAG, DL, VT, CC, CmpOp0, CmpOp1);
2527 Comparison
C(
getCmp(DAG, CmpOp0, CmpOp1, CC, DL));
2529 return emitSETCC(DAG, DL, CCReg, C.CCValid, C.CCMask);
2539 Comparison
C(
getCmp(DAG, CmpOp0, CmpOp1, CC, DL));
2551 cast<ConstantSDNode>(Neg.
getOperand(0))->getZExtValue() == 0 &&
2555 Pos.getOperand(0) == CmpOp)));
2577 Comparison
C(
getCmp(DAG, CmpOp0, CmpOp1, CC, DL));
2586 cast<ConstantSDNode>(C.Op1)->getZExtValue() == 0) {
2609 if (Subtarget.isPC32DBLSymbol(GV, CM)) {
2611 uint64_t Anchor = Offset & ~uint64_t(0xfff);
2617 if (Offset != 0 && (Offset & 1) == 0) {
2649 Chain = DAG.
getCopyToReg(Chain, DL, SystemZ::R12D, GOT, Glue);
2651 Chain = DAG.
getCopyToReg(Chain, DL, SystemZ::R2D, GOTOffset, Glue);
2670 assert(Mask &&
"Missing call preserved mask for calling convention");
2678 Chain = DAG.
getNode(Opcode, DL, NodeTys, Ops);
2685 SDValue SystemZTargetLowering::lowerThreadPointer(
const SDLoc &DL,
2713 SDValue TP = lowerThreadPointer(DL, DAG);
2839 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
2845 if (!BackChainIdx) {
2848 FI->setFramePointerSaveIndex(BackChainIdx);
2870 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
2879 unsigned LinkReg = MF.
addLiveIn(SystemZ::R14D, &SystemZ::GR64BitRegClass);
2893 if (
auto *LoadN = dyn_cast<LoadSDNode>(In))
2896 LoadN->getBasePtr(), LoadN->getMemOperand());
2904 if (Subtarget.hasHighWord()) {
2923 if (Subtarget.hasHighWord())
2946 const unsigned NumFields = 4;
2957 for (
unsigned I = 0;
I < NumFields; ++
I) {
2962 MemOps[
I] = DAG.
getStore(Chain, DL, Fields[
I], FieldAddr,
2974 const Value *DstSV = cast<SrcValueSDNode>(Op.
getOperand(3))->getValue();
2975 const Value *SrcSV = cast<SrcValueSDNode>(Op.
getOperand(4))->getValue();
2984 SDValue SystemZTargetLowering::
2998 uint64_t AlignVal = (RealignOpt ?
3002 uint64_t RequiredAlign =
std::max(AlignVal, StackAlign);
3003 uint64_t ExtraAlignSpace = RequiredAlign - StackAlign;
3017 if (ExtraAlignSpace)
3034 if (RequiredAlign > StackAlign) {
3046 SDValue Ops[2] = { Result, Chain };
3050 SDValue SystemZTargetLowering::lowerGET_DYNAMIC_AREA_OFFSET(
3067 else if (Subtarget.hasMiscellaneousExtensions2())
3096 LL, RL, Ops[1], Ops[0]);
3173 if ((Masks[0] >> 32) == 0xffffffff &&
uint32_t(Masks[1]) == 0xffffffff)
3175 else if ((Masks[1] >> 32) == 0xffffffff &&
uint32_t(Masks[0]) == 0xffffffff)
3190 int64_t
Value = int32_t(cast<ConstantSDNode>(LowOp)->getZExtValue());
3200 uint64_t
Mask = cast<ConstantSDNode>(HighOp.
getOperand(1))->getZExtValue();
3222 unsigned BaseOp = 0;
3223 unsigned CCValid = 0;
3224 unsigned CCMask = 0;
3275 unsigned BaseOp = 0;
3276 unsigned CCValid = 0;
3277 unsigned CCMask = 0;
3351 unsigned NumSignificantBits = (~Known.
Zero).getActiveBits();
3352 if (NumSignificantBits == 0)
3357 int64_t BitSize = (int64_t)1 <<
Log2_32_Ceil(NumSignificantBits);
3358 BitSize = std::min(BitSize, OrigBitSize);
3367 for (int64_t
I = BitSize / 2;
I >= 8;
I =
I / 2) {
3369 if (BitSize != OrigBitSize)
3371 DAG.
getConstant(((uint64_t)1 << BitSize) - 1, DL, VT));
3387 cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue());
3389 cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue());
3407 auto *Node = cast<AtomicSDNode>(Op.
getNode());
3409 Node->getChain(), Node->getBasePtr(),
3410 Node->getMemoryVT(), Node->getMemOperand());
3416 auto *Node = cast<AtomicSDNode>(Op.
getNode());
3418 Node->getBasePtr(), Node->getMemoryVT(),
3419 Node->getMemOperand());
3432 unsigned Opcode)
const {
3433 auto *Node = cast<AtomicSDNode>(Op.
getNode());
3436 EVT NarrowVT = Node->getMemoryVT();
3438 if (NarrowVT == WideVT)
3441 int64_t BitSize = NarrowVT.getSizeInBits();
3442 SDValue ChainIn = Node->getChain();
3443 SDValue Addr = Node->getBasePtr();
3444 SDValue Src2 = Node->getVal();
3451 if (
auto *Const = dyn_cast<ConstantSDNode>(Src2)) {
3486 SDValue Ops[] = { ChainIn, AlignedAddr, Src2, BitShift, NegBitShift,
3506 auto *Node = cast<AtomicSDNode>(Op.
getNode());
3507 EVT MemVT = Node->getMemoryVT();
3511 SDValue Src2 = Node->getVal();
3515 if (
auto *Op2 = dyn_cast<ConstantSDNode>(Src2)) {
3518 int64_t
Value = (-Op2->getAPIntValue()).getSExtValue();
3519 if (
isInt<32>(Value) || Subtarget.hasInterlockedAccess1())
3521 }
else if (Subtarget.hasInterlockedAccess1())
3528 Node->getChain(), Node->getBasePtr(), NegSrc2,
3529 Node->getMemOperand());
3541 auto *Node = cast<AtomicSDNode>(Op.
getNode());
3551 EVT NarrowVT = Node->getMemoryVT();
3553 if (NarrowVT == WideVT) {
3555 SDValue Ops[] = { ChainIn, Addr, CmpVal, SwapVal };
3557 DL, Tys, Ops, NarrowVT, MMO);
3589 SDValue Ops[] = { ChainIn, AlignedAddr, CmpVal, SwapVal, BitShift,
3590 NegBitShift, DAG.
getConstant(BitSize, DL, WideVT) };
3592 VTList, Ops, NarrowVT, MMO);
3621 if (StoreBackchain) {
3626 Chain = DAG.
getCopyToReg(Chain, DL, SystemZ::R15D, NewSP);
3636 bool IsData = cast<ConstantSDNode>(Op.
getOperand(4))->getZExtValue();
3642 bool IsWrite = cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue();
3644 auto *Node = cast<MemIntrinsicSDNode>(Op.
getNode());
3652 Node->getMemoryVT(), Node->getMemOperand());
3664 SystemZTargetLowering::lowerINTRINSIC_W_CHAIN(
SDValue Op,
3666 unsigned Opcode, CCValid;
3679 SystemZTargetLowering::lowerINTRINSIC_WO_CHAIN(
SDValue Op,
3681 unsigned Opcode, CCValid;
3691 unsigned Id = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
3693 case Intrinsic::thread_pointer:
3694 return lowerThreadPointer(
SDLoc(Op), DAG);
3696 case Intrinsic::s390_vpdi:
3700 case Intrinsic::s390_vperm:
3704 case Intrinsic::s390_vuphb:
3705 case Intrinsic::s390_vuphh:
3706 case Intrinsic::s390_vuphf:
3710 case Intrinsic::s390_vuplhb:
3711 case Intrinsic::s390_vuplhh:
3712 case Intrinsic::s390_vuplhf:
3716 case Intrinsic::s390_vuplb:
3717 case Intrinsic::s390_vuplhw:
3718 case Intrinsic::s390_vuplf:
3722 case Intrinsic::s390_vupllb:
3723 case Intrinsic::s390_vupllh:
3724 case Intrinsic::s390_vupllf:
3728 case Intrinsic::s390_vsumb:
3729 case Intrinsic::s390_vsumh:
3730 case Intrinsic::s390_vsumgh:
3731 case Intrinsic::s390_vsumgf:
3732 case Intrinsic::s390_vsumqf:
3733 case Intrinsic::s390_vsumqg:
3756 { 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23 } },
3759 { 0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23 } },
3762 { 0, 1, 16, 17, 2, 3, 18, 19, 4, 5, 20, 21, 6, 7, 22, 23 } },
3765 { 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23 } },
3768 { 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31 } },
3771 { 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 } },
3774 { 8, 9, 24, 25, 10, 11, 26, 27, 12, 13, 28, 29, 14, 15, 30, 31 } },
3777 { 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31 } },
3780 { 4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31 } },
3783 { 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 } },
3786 { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 } },
3789 { 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 } },
3792 { 0, 1, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31 } }
3806 OpNo0 = OpNo1 = OpNos[1];
3807 }
else if (OpNos[1] < 0) {
3808 OpNo0 = OpNo1 = OpNos[0];
3826 unsigned &OpNo0,
unsigned &OpNo1) {
3827 int OpNos[] = { -1, -1 };
3834 if ((Elt ^ P.Bytes[
I]) & (SystemZ::VectorBytes - 1))
3840 if (OpNos[ModelOpNo] == 1 - RealOpNo)
3842 OpNos[ModelOpNo] = RealOpNo;
3850 unsigned &OpNo0,
unsigned &OpNo1) {
3851 for (
auto &
P : PermuteForms)
3867 int Elt = Bytes[From];
3870 Transform[From] = -1;
3872 while (P.Bytes[To] != Elt) {
3874 if (To == SystemZ::VectorBytes)
3877 Transform[From] = To;
3886 for (
auto &
P : PermuteForms)
3900 if (
auto *VSN = dyn_cast<ShuffleVectorSDNode>(ShuffleOp)) {
3901 Bytes.
resize(NumElements * BytesPerElement, -1);
3902 for (
unsigned I = 0;
I < NumElements; ++
I) {
3903 int Index = VSN->getMaskElt(
I);
3905 for (
unsigned J = 0; J < BytesPerElement; ++J)
3906 Bytes[
I * BytesPerElement + J] = Index * BytesPerElement + J;
3911 isa<ConstantSDNode>(ShuffleOp.
getOperand(1))) {
3913 Bytes.
resize(NumElements * BytesPerElement, -1);
3914 for (
unsigned I = 0;
I < NumElements; ++
I)
3915 for (
unsigned J = 0; J < BytesPerElement; ++J)
3916 Bytes[
I * BytesPerElement + J] = Index * BytesPerElement + J;
3927 unsigned BytesPerElement,
int &
Base) {
3929 for (
unsigned I = 0;
I < BytesPerElement; ++
I) {
3930 if (Bytes[Start +
I] >= 0) {
3931 unsigned Elem = Bytes[Start +
I];
3935 if (
unsigned(Base) % Bytes.
size() + BytesPerElement > Bytes.
size())
3937 }
else if (
unsigned(Base) != Elem -
I)
3950 unsigned &StartIndex,
unsigned &OpNo0,
3952 int OpNos[] = { -1, -1 };
3954 for (
unsigned I = 0;
I < 16; ++
I) {
3961 Shift = ExpectedShift;
3962 else if (Shift != ExpectedShift)
3966 if (OpNos[ModelOpNo] == 1 - RealOpNo)
3968 OpNos[ModelOpNo] = RealOpNo;
3998 Op = DAG.
getNode(P.Opcode, DL, InVT, Op0, Op1);
4009 for (
unsigned I = 0;
I < 2; ++
I)
4013 unsigned StartIndex, OpNo0, OpNo1;
4031 struct GeneralShuffle {
4032 GeneralShuffle(
EVT vt) : VT(vt) {}
4051 void GeneralShuffle::addUndef() {
4053 for (
unsigned I = 0;
I < BytesPerElement; ++
I)
4054 Bytes.push_back(-1);
4074 if (FromBytesPerElement < BytesPerElement)
4078 (FromBytesPerElement - BytesPerElement));
4108 for (; OpNo < Ops.size(); ++OpNo)
4109 if (Ops[OpNo] == Op)
4111 if (OpNo == Ops.size())
4116 for (
unsigned I = 0;
I < BytesPerElement; ++
I)
4117 Bytes.push_back(Base +
I);
4126 if (Ops.size() == 0)
4130 if (Ops.size() == 1)
4142 unsigned Stride = 1;
4143 for (; Stride * 2 < Ops.size(); Stride *= 2) {
4144 for (
unsigned I = 0;
I < Ops.size() - Stride;
I += Stride * 2) {
4145 SDValue SubOps[] = { Ops[
I], Ops[
I + Stride] };
4154 else if (OpNo ==
I + Stride)
4155 NewBytes[J] = SystemZ::VectorBytes + Byte;
4165 if (NewBytes[J] >= 0) {
4166 assert(
unsigned(NewBytesMap[J]) < SystemZ::VectorBytes &&
4167 "Invalid double permute");
4168 Bytes[J] =
I * SystemZ::VectorBytes + NewBytesMap[J];
4170 assert(NewBytesMap[J] < 0 &&
"Invalid double permute");
4176 if (NewBytes[J] >= 0)
4177 Bytes[J] =
I * SystemZ::VectorBytes + J;
4184 Ops[1] = Ops[Stride];
4186 if (Bytes[
I] >=
int(SystemZ::VectorBytes))
4187 Bytes[
I] -= (Stride - 1) * SystemZ::VectorBytes;
4192 unsigned OpNo0, OpNo1;
4271 Value = cast<ConstantSDNode>(Op)->getZExtValue();
4273 Value = (cast<ConstantFPSDNode>(Op)->getValueAPF().bitcastToAPInt()
4277 for (
unsigned J = 0; J < BytesPerElement; ++J) {
4278 uint64_t Byte = (Value >> (J * 8)) & 0xff;
4280 Mask |= 1ULL << ((
E -
I - 1) * BytesPerElement + J);
4297 unsigned BitsPerElement) {
4301 int64_t SignedValue =
SignExtend64(Value, BitsPerElement);
4313 unsigned Start, End;
4314 if (TII->
isRxSBGMask(Value, BitsPerElement, Start, End)) {
4319 Start -= 64 - BitsPerElement;
4320 End -= 64 - BitsPerElement;
4345 GeneralShuffle GS(VT);
4347 bool FoundOne =
false;
4348 for (
unsigned I = 0;
I < NumElements; ++
I) {
4354 unsigned Elem = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
4372 if (!ResidueOps.
empty()) {
4373 while (ResidueOps.
size() < NumElements)
4375 for (
auto &Op : GS.Ops) {
4382 return GS.getNode(DAG,
SDLoc(BVN));
4390 unsigned int NumElements = Elems.
size();
4391 unsigned int Count = 0;
4392 for (
auto Elem : Elems) {
4393 if (!Elem.isUndef()) {
4396 else if (Elem != Single) {
4420 bool AllLoads =
true;
4421 for (
auto Elem : Elems)
4422 if (Elem.getOpcode() !=
ISD::LOAD || cast<LoadSDNode>(Elem)->isIndexed()) {
4429 return joinDwords(DAG, DL, Elems[0], Elems[1]);
4464 unsigned NumConstants = 0;
4465 for (
unsigned I = 0;
I < NumElements; ++
I) {
4470 Constants[
I] = Elem;
4478 if (NumConstants > 0) {
4479 for (
unsigned I = 0;
I < NumElements; ++
I)
4480 if (!Constants[
I].getNode())
4481 Constants[
I] = DAG.
getUNDEF(Elems[
I].getValueType());
4489 unsigned LoadElIdx = UINT_MAX;
4490 for (
unsigned I = 0;
I < NumElements; ++
I)
4492 cast<LoadSDNode>(Elems[
I])->isUnindexed()) {
4496 if (LoadElIdx != UINT_MAX) {
4498 Done[LoadElIdx] =
true;
4501 unsigned I1 = NumElements / 2 - 1;
4502 unsigned I2 = NumElements - 1;
4503 bool Def1 = !Elems[I1].isUndef();
4504 bool Def2 = !Elems[I2].isUndef();
4506 SDValue Elem1 = Elems[Def1 ? I1 : I2];
4507 SDValue Elem2 = Elems[Def2 ? I2 : I1];
4518 for (
unsigned I = 0;
I < NumElements; ++
I)
4529 auto *BVN = cast<BuildVectorSDNode>(Op.
getNode());
4533 if (BVN->isConstant()) {
4546 APInt SplatBits, SplatUndef;
4547 unsigned SplatBitSize;
4549 if (BVN->isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs,
4551 SplatBitSize <= 64) {
4558 uint64_t
Lower = (SplatUndefZ
4560 uint64_t
Upper = (SplatUndefZ
4561 & ~((uint64_t(1) <<
findLastSet(SplatBitsZ)) - 1));
4571 uint64_t Middle = SplatUndefZ & ~Upper & ~Lower;
4572 Value = SplatBitsZ | Middle;
4593 for (
unsigned I = 0;
I < NumElements; ++
I)
4600 auto *VSN = cast<ShuffleVectorSDNode>(Op.
getNode());
4605 if (VSN->isSplat()) {
4607 unsigned Index = VSN->getSplatIndex();
4609 "Splat index should be defined and in first operand");
4619 GeneralShuffle GS(VT);
4620 for (
unsigned I = 0;
I < NumElements; ++
I) {
4621 int Elt = VSN->getMaskElt(
I);
4624 else if (!GS.add(Op.
getOperand(
unsigned(Elt) / NumElements),
4628 return GS.getNode(DAG,
SDLoc(VSN));
4640 SDValue SystemZTargetLowering::lowerINSERT_VECTOR_ELT(
SDValue Op,
4656 uint64_t
Index = cast<ConstantSDNode>(Op2)->getZExtValue();
4672 SystemZTargetLowering::lowerEXTRACT_VECTOR_ELT(
SDValue Op,
4682 if (
auto *CIndexN = dyn_cast<ConstantSDNode>(Op1)) {
4683 uint64_t
Index = CIndexN->getZExtValue();
4699 unsigned UnpackHigh)
const {
4709 PackedOp = DAG.
getNode(UnpackHigh,
SDLoc(PackedOp), OutVT, PackedOp);
4710 }
while (FromBits != ToBits);
4715 unsigned ByScalar)
const {
4724 if (
auto *BVN = dyn_cast<BuildVectorSDNode>(Op1)) {
4725 APInt SplatBits, SplatUndef;
4726 unsigned SplatBitSize;
4730 if (BVN->isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs,
4731 ElemBitSize,
true) &&
4732 SplatBitSize == ElemBitSize) {
4735 return DAG.
getNode(ByScalar, DL, VT, Op0, Shift);
4739 SDValue Splat = BVN->getSplatValue(&UndefElements);
4744 return DAG.
getNode(ByScalar, DL, VT, Op0, Shift);
4750 if (
auto *VSN = dyn_cast<ShuffleVectorSDNode>(Op1)) {
4751 if (VSN->isSplat()) {
4753 unsigned Index = VSN->getSplatIndex();
4755 "Splat index should be defined and in first operand");
4762 return DAG.
getNode(ByScalar, DL, VT, Op0, Shift);
4775 return lowerFRAMEADDR(Op, DAG);
4777 return lowerRETURNADDR(Op, DAG);
4779 return lowerBR_CC(Op, DAG);
4781 return lowerSELECT_CC(Op, DAG);
4783 return lowerSETCC(Op, DAG);
4785 return lowerGlobalAddress(cast<GlobalAddressSDNode>(Op), DAG);
4787 return lowerGlobalTLSAddress(cast<GlobalAddressSDNode>(Op), DAG);
4789 return lowerBlockAddress(cast<BlockAddressSDNode>(Op), DAG);
4791 return lowerJumpTable(cast<JumpTableSDNode>(Op), DAG);
4793 return lowerConstantPool(cast<ConstantPoolSDNode>(Op), DAG);
4795 return lowerBITCAST(Op, DAG);
4797 return lowerVASTART(Op, DAG);
4799 return lowerVACOPY(Op, DAG);
4801 return lowerDYNAMIC_STACKALLOC(Op, DAG);
4803 return lowerGET_DYNAMIC_AREA_OFFSET(Op, DAG);
4805 return lowerSMUL_LOHI(Op, DAG);
4807 return lowerUMUL_LOHI(Op, DAG);
4809 return lowerSDIVREM(Op, DAG);
4811 return lowerUDIVREM(Op, DAG);
4816 return lowerXALUO(Op, DAG);
4819 return lowerADDSUBCARRY(Op, DAG);
4821 return lowerOR(Op, DAG);
4823 return lowerCTPOP(Op, DAG);
4825 return lowerATOMIC_FENCE(Op, DAG);
4829 return lowerATOMIC_STORE(Op, DAG);
4831 return lowerATOMIC_LOAD(Op, DAG);
4835 return lowerATOMIC_LOAD_SUB(Op, DAG);
4853 return lowerATOMIC_CMP_SWAP(Op, DAG);
4855 return lowerSTACKSAVE(Op, DAG);
4857 return lowerSTACKRESTORE(Op, DAG);
4859 return lowerPREFETCH(Op, DAG);
4861 return lowerINTRINSIC_W_CHAIN(Op, DAG);
4863 return lowerINTRINSIC_WO_CHAIN(Op, DAG);
4865 return lowerBUILD_VECTOR(Op, DAG);
4867 return lowerVECTOR_SHUFFLE(Op, DAG);
4869 return lowerSCALAR_TO_VECTOR(Op, DAG);
4871 return lowerINSERT_VECTOR_ELT(Op, DAG);
4873 return lowerEXTRACT_VECTOR_ELT(Op, DAG);
4939 if (cast<AtomicSDNode>(N)->getOrdering() ==
4976 #define OPCODE(NAME) case SystemZISD::NAME: return "SystemZISD::" #NAME 5096 bool SystemZTargetLowering::canTreatAsByteVector(
EVT VT)
const {
5097 if (!Subtarget.hasVector())
5108 SDValue SystemZTargetLowering::combineExtract(
const SDLoc &DL,
EVT ResVT,
5133 BytesPerElement, First))
5140 if (Byte % BytesPerElement != 0)
5143 Index = Byte / BytesPerElement;
5152 if (OpBytesPerElement < BytesPerElement)
5156 unsigned End = (Index + 1) * BytesPerElement;
5157 if (End % OpBytesPerElement != 0)
5160 Op = Op.
getOperand(End / OpBytesPerElement - 1);
5183 unsigned Byte = Index * BytesPerElement;
5184 unsigned SubByte = Byte % ExtBytesPerElement;
5185 unsigned MinSubByte = ExtBytesPerElement - OpBytesPerElement;
5186 if (SubByte < MinSubByte ||
5187 SubByte + BytesPerElement > ExtBytesPerElement)
5190 Byte = Byte / ExtBytesPerElement * OpBytesPerElement;
5192 Byte += SubByte - MinSubByte;
5193 if (Byte % BytesPerElement != 0)
5196 Index = Byte / BytesPerElement;
5214 SDValue SystemZTargetLowering::combineTruncateExtract(
5223 if (canTreatAsByteVector(VecVT)) {
5224 if (
auto *IndexN = dyn_cast<ConstantSDNode>(Op.
getOperand(1))) {
5227 if (BytesPerElement % TruncBytes == 0) {
5233 unsigned Scale = BytesPerElement / TruncBytes;
5234 unsigned NewIndex = (IndexN->getZExtValue() + 1) * Scale - 1;
5240 EVT ResVT = (TruncBytes < 4 ?
MVT::i32 : TruncVT);
5241 return combineExtract(DL, ResVT, VecVT, Vec, NewIndex, DCI,
true);
5249 SDValue SystemZTargetLowering::combineZERO_EXTEND(
5258 if (TrueOp && FalseOp) {
5276 SDValue SystemZTargetLowering::combineSIGN_EXTEND_INREG(
5297 SDValue SystemZTargetLowering::combineSIGN_EXTEND(
5308 if (SraAmt && Inner.hasOneUse() && Inner.getOpcode() ==
ISD::SHL) {
5309 if (
auto *ShlAmt = dyn_cast<ConstantSDNode>(Inner.getOperand(1))) {
5311 unsigned NewShlAmt = ShlAmt->getZExtValue() + Extra;
5312 unsigned NewSraAmt = SraAmt->getZExtValue() + Extra;
5315 Inner.getOperand(0));
5327 SDValue SystemZTargetLowering::combineMERGE(
5336 cast<ConstantSDNode>(Op0.
getOperand(0))->getZExtValue() == 0) {
5344 if (ElemBytes <= 4) {
5362 SDValue SystemZTargetLowering::combineSTORE(
5365 auto *SN = cast<StoreSDNode>(
N);
5367 EVT MemVT = SN->getMemoryVT();
5372 if (MemVT.
isInteger() && SN->isTruncatingStore()) {
5374 combineTruncateExtract(
SDLoc(N), MemVT, SN->getValue(), DCI)) {
5379 SN->getBasePtr(), SN->getMemoryVT(),
5380 SN->getMemOperand());
5384 if (!SN->isTruncatingStore() &&
5386 Op1.getNode()->hasOneUse() &&
5403 Ops, MemVT, SN->getMemOperand());
5408 SDValue SystemZTargetLowering::combineEXTRACT_VECTOR_ELT(
5411 if (!Subtarget.hasVector())
5415 if (
auto *IndexN = dyn_cast<ConstantSDNode>(N->
getOperand(1))) {
5419 IndexN->getZExtValue(), DCI,
false);
5424 SDValue SystemZTargetLowering::combineJOIN_DWORDS(
5434 SDValue SystemZTargetLowering::combineFP_ROUND(
5449 cast<ConstantSDNode>(Op0.
getOperand(1))->getZExtValue() == 0) {
5451 for (
auto *U : Vec->
uses()) {
5455 U->getOperand(0) == Vec &&
5457 cast<ConstantSDNode>(U->getOperand(1))->getZExtValue() == 1) {
5481 SDValue SystemZTargetLowering::combineBSWAP(
5529 bool Invert =
false;
5557 if (CompareVal->getZExtValue() == FalseVal->getZExtValue())
5559 else if (CompareVal->getZExtValue() != TrueVal->getZExtValue())
5565 if (!NewCCValid || !NewCCMask)
5568 CCMask = NewCCMask->getZExtValue();
5577 SDValue SystemZTargetLowering::combineBR_CCMASK(
5578 SDNode *N, DAGCombinerInfo &DCI)
const {
5584 if (!CCValid || !CCMask)
5587 int CCValidVal = CCValid->getZExtValue();
5588 int CCMaskVal = CCMask->getZExtValue();
5601 SDValue SystemZTargetLowering::combineSELECT_CCMASK(
5602 SDNode *N, DAGCombinerInfo &DCI)
const {
5608 if (!CCValid || !CCMask)
5611 int CCValidVal = CCValid->getZExtValue();
5612 int CCMaskVal = CCMask->getZExtValue();
5626 SDValue SystemZTargetLowering::combineGET_CCMASK(
5627 SDNode *N, DAGCombinerInfo &DCI)
const {
5632 if (!CCValid || !CCMask)
5634 int CCValidVal = CCValid->getZExtValue();
5635 int CCMaskVal = CCMask->getZExtValue();
5643 if (!SelectCCValid || !SelectCCMask)
5645 int SelectCCValidVal = SelectCCValid->getZExtValue();
5646 int SelectCCMaskVal = SelectCCMask->getZExtValue();
5650 if (!TrueVal || !FalseVal)
5652 if (TrueVal->getZExtValue() != 0 && FalseVal->getZExtValue() == 0)
5654 else if (TrueVal->getZExtValue() == 0 && FalseVal->getZExtValue() != 0)
5655 SelectCCMaskVal ^= SelectCCValidVal;
5659 if (SelectCCValidVal & ~CCValidVal)
5661 if (SelectCCMaskVal != (CCMaskVal & SelectCCValidVal))
5676 case ISD::STORE:
return combineSTORE(N, DCI);
5680 case ISD::BSWAP:
return combineBSWAP(N, DCI);
5698 unsigned Id = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
5700 case Intrinsic::s390_vpksh:
5701 case Intrinsic::s390_vpksf:
5702 case Intrinsic::s390_vpksg:
5703 case Intrinsic::s390_vpkshs:
5704 case Intrinsic::s390_vpksfs:
5705 case Intrinsic::s390_vpksgs:
5706 case Intrinsic::s390_vpklsh:
5707 case Intrinsic::s390_vpklsf:
5708 case Intrinsic::s390_vpklsg:
5709 case Intrinsic::s390_vpklshs:
5710 case Intrinsic::s390_vpklsfs:
5711 case Intrinsic::s390_vpklsgs:
5713 SrcDemE = DemandedElts;
5716 SrcDemE = SrcDemE.
trunc(NumElts / 2);
5719 case Intrinsic::s390_vuphb:
5720 case Intrinsic::s390_vuphh:
5721 case Intrinsic::s390_vuphf:
5722 case Intrinsic::s390_vuplhb:
5723 case Intrinsic::s390_vuplhh:
5724 case Intrinsic::s390_vuplhf:
5725 SrcDemE =
APInt(NumElts * 2, 0);
5728 case Intrinsic::s390_vuplb:
5729 case Intrinsic::s390_vuplhw:
5730 case Intrinsic::s390_vuplf:
5731 case Intrinsic::s390_vupllb:
5732 case Intrinsic::s390_vupllh:
5733 case Intrinsic::s390_vupllf:
5734 SrcDemE =
APInt(NumElts * 2, 0);
5737 case Intrinsic::s390_vpdi: {
5739 SrcDemE =
APInt(NumElts, 0);
5740 if (!DemandedElts[OpNo - 1])
5742 unsigned Mask = cast<ConstantSDNode>(Op.
getOperand(3))->getZExtValue();
5743 unsigned MaskBit = ((OpNo - 1) ? 1 : 4);
5745 SrcDemE.
setBit((Mask & MaskBit)? 1 : 0);
5748 case Intrinsic::s390_vsldb: {
5751 unsigned FirstIdx = cast<ConstantSDNode>(Op.
getOperand(3))->getZExtValue();
5752 assert (FirstIdx > 0 && FirstIdx < 16 &&
"Unused operand.");
5753 unsigned NumSrc0Els = 16 - FirstIdx;
5754 SrcDemE =
APInt(NumElts, 0);
5756 APInt DemEls = DemandedElts.
trunc(NumSrc0Els);
5759 APInt DemEls = DemandedElts.
lshr(NumSrc0Els);
5764 case Intrinsic::s390_vperm:
5765 SrcDemE =
APInt(NumElts, 1);
5775 SrcDemE =
APInt(1, 1);
5778 SrcDemE = DemandedElts;
5789 const APInt &DemandedElts,
5795 KnownBits LHSKnown(SrcBitWidth), RHSKnown(SrcBitWidth);
5798 Known.
Zero = LHSKnown.Zero & RHSKnown.
Zero;
5799 Known.
One = LHSKnown.One & RHSKnown.
One;
5805 const APInt &DemandedElts,
5807 unsigned Depth)
const {
5811 unsigned tmp0, tmp1;
5820 "KnownBits does not match VT in bitwidth");
5823 "DemandedElts does not match VT number of elements");
5828 unsigned Id = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
5830 case Intrinsic::s390_vpksh:
5831 case Intrinsic::s390_vpksf:
5832 case Intrinsic::s390_vpksg:
5833 case Intrinsic::s390_vpkshs:
5834 case Intrinsic::s390_vpksfs:
5835 case Intrinsic::s390_vpksgs:
5836 case Intrinsic::s390_vpklsh:
5837 case Intrinsic::s390_vpklsf:
5838 case Intrinsic::s390_vpklsg:
5839 case Intrinsic::s390_vpklshs:
5840 case Intrinsic::s390_vpklsfs:
5841 case Intrinsic::s390_vpklsgs:
5842 case Intrinsic::s390_vpdi:
5843 case Intrinsic::s390_vsldb:
5844 case Intrinsic::s390_vperm:
5847 case Intrinsic::s390_vuplhb:
5848 case Intrinsic::s390_vuplhh:
5849 case Intrinsic::s390_vuplhf:
5850 case Intrinsic::s390_vupllb:
5851 case Intrinsic::s390_vupllh:
5852 case Intrinsic::s390_vupllf:
5855 case Intrinsic::s390_vuphb:
5856 case Intrinsic::s390_vuphh:
5857 case Intrinsic::s390_vuphf:
5858 case Intrinsic::s390_vuplb:
5859 case Intrinsic::s390_vuplhw:
5860 case Intrinsic::s390_vuplf: {
5867 Known = Known.
zext(BitWidth);
5870 Known = Known.
sext(BitWidth);
5885 if (Known.
getBitWidth() < BitWidth && isa<ConstantSDNode>(SrcOp))
5886 Known = Known.
sext(BitWidth);
5905 if (LHS == 1)
return 1;
5908 if (RHS == 1)
return 1;
5909 unsigned Common = std::min(LHS, RHS);
5913 if (SrcBitWidth > VTBits) {
5914 unsigned SrcExtraBits = SrcBitWidth - VTBits;
5915 if (Common > SrcExtraBits)
5916 return (Common - SrcExtraBits);
5919 assert (SrcBitWidth == VTBits &&
"Expected operands of same bitwidth.");
5926 unsigned Depth)
const {
5931 unsigned Id = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
5933 case Intrinsic::s390_vpksh:
5934 case Intrinsic::s390_vpksf:
5935 case Intrinsic::s390_vpksg:
5936 case Intrinsic::s390_vpkshs:
5937 case Intrinsic::s390_vpksfs:
5938 case Intrinsic::s390_vpksgs:
5939 case Intrinsic::s390_vpklsh:
5940 case Intrinsic::s390_vpklsf:
5941 case Intrinsic::s390_vpklsg:
5942 case Intrinsic::s390_vpklshs:
5943 case Intrinsic::s390_vpklsfs:
5944 case Intrinsic::s390_vpklsgs:
5945 case Intrinsic::s390_vpdi:
5946 case Intrinsic::s390_vsldb:
5947 case Intrinsic::s390_vperm:
5949 case Intrinsic::s390_vuphb:
5950 case Intrinsic::s390_vuphh:
5951 case Intrinsic::s390_vuphf:
5952 case Intrinsic::s390_vuplb:
5953 case Intrinsic::s390_vuplhw:
5954 case Intrinsic::s390_vuplf: {
6044 if (miI == MBB->
end()) {
6046 if ((*SI)->isLiveIn(SystemZ::CC))
6058 case SystemZ::Select32:
6059 case SystemZ::Select64:
6060 case SystemZ::SelectF32:
6061 case SystemZ::SelectF64:
6062 case SystemZ::SelectF128:
6063 case SystemZ::SelectVR32:
6064 case SystemZ::SelectVR64:
6065 case SystemZ::SelectVR128:
6085 unsigned CCValid = MIItBegin->getOperand(3).getImm();
6086 unsigned CCMask = MIItBegin->getOperand(4).getImm();
6087 DebugLoc DL = MIItBegin->getDebugLoc();
6100 unsigned DestReg = MIIt->getOperand(0).getReg();
6101 unsigned TrueReg = MIIt->getOperand(1).getReg();
6102 unsigned FalseReg = MIIt->getOperand(2).getReg();
6107 if (MIIt->getOperand(4).getImm() == (CCValid ^ CCMask))
6110 if (RegRewriteTable.
find(TrueReg) != RegRewriteTable.
end())
6111 TrueReg = RegRewriteTable[TrueReg].
first;
6113 if (RegRewriteTable.
find(FalseReg) != RegRewriteTable.
end())
6114 FalseReg = RegRewriteTable[FalseReg].
second;
6116 BuildMI(*SinkMBB, SinkInsertionPoint, DL, TII->
get(SystemZ::PHI), DestReg)
6117 .addReg(TrueReg).
addMBB(TrueMBB)
6121 RegRewriteTable[DestReg] = std::make_pair(TrueReg, FalseReg);
6145 NextMIIt->getOperand(3).getImm() == CCValid &&
6146 (NextMIIt->getOperand(4).getImm() == CCMask ||
6147 NextMIIt->getOperand(4).getImm() == (CCValid ^ CCMask))) {
6148 LastMI = &*NextMIIt;
6167 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6186 StartMBB->
erase(MIItBegin, MIItEnd);
6196 unsigned StoreOpcode,
6197 unsigned STOCOpcode,
6198 bool Invert)
const {
6215 if (STOCOpcode && !IndexReg && Subtarget.hasLoadStoreOnCond()) {
6228 BuildMI(*MBB, MI, DL, TII->get(STOCOpcode))
6259 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6268 BuildMI(MBB, DL, TII->get(StoreOpcode))
6288 unsigned BitSize,
bool Invert)
const {
6293 bool IsSubWord = (BitSize < 32);
6309 &SystemZ::GR32BitRegClass :
6310 &SystemZ::GR64BitRegClass);
6311 unsigned LOpcode = BitSize <= 32 ? SystemZ::L : SystemZ::LG;
6312 unsigned CSOpcode = BitSize <= 32 ? SystemZ::CS : SystemZ::CSG;
6317 assert(LOpcode && CSOpcode &&
"Displacement out of range");
6322 unsigned NewVal = (BinOpcode || IsSubWord ?
6337 BuildMI(MBB, DL, TII->get(LOpcode), OrigVal).
add(Base).addImm(Disp).addReg(0);
6349 BuildMI(MBB, DL, TII->get(SystemZ::PHI), OldVal)
6350 .addReg(OrigVal).
addMBB(StartMBB)
6353 BuildMI(MBB, DL, TII->get(SystemZ::RLL), RotatedOldVal)
6358 BuildMI(MBB, DL, TII->get(BinOpcode), Tmp).addReg(RotatedOldVal).
add(Src2);
6361 BuildMI(MBB, DL, TII->get(SystemZ::XILF), RotatedNewVal)
6362 .addReg(Tmp).
addImm(-1U << (32 - BitSize));
6367 BuildMI(MBB, DL, TII->get(SystemZ::LCGR), Tmp2).addReg(Tmp);
6368 BuildMI(MBB, DL, TII->get(SystemZ::AGHI), RotatedNewVal)
6369 .addReg(Tmp2).
addImm(-1);
6371 }
else if (BinOpcode)
6373 BuildMI(MBB, DL, TII->get(BinOpcode), RotatedNewVal)
6374 .addReg(RotatedOldVal)
6379 BuildMI(MBB, DL, TII->get(SystemZ::RISBG32), RotatedNewVal)
6383 BuildMI(MBB, DL, TII->get(SystemZ::RLL), NewVal)
6385 BuildMI(MBB, DL, TII->get(CSOpcode), Dest)
6390 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6407 unsigned KeepOldMask,
unsigned BitSize)
const {
6412 bool IsSubWord = (BitSize < 32);
6427 &SystemZ::GR32BitRegClass :
6428 &SystemZ::GR64BitRegClass);
6429 unsigned LOpcode = BitSize <= 32 ? SystemZ::L : SystemZ::LG;
6430 unsigned CSOpcode = BitSize <= 32 ? SystemZ::CS : SystemZ::CSG;
6435 assert(LOpcode && CSOpcode &&
"Displacement out of range");
6457 BuildMI(MBB, DL, TII->get(LOpcode), OrigVal).
add(Base).addImm(Disp).addReg(0);
6466 BuildMI(MBB, DL, TII->get(SystemZ::PHI), OldVal)
6467 .addReg(OrigVal).
addMBB(StartMBB)
6470 BuildMI(MBB, DL, TII->get(SystemZ::RLL), RotatedOldVal)
6472 BuildMI(MBB, DL, TII->get(CompareOpcode))
6473 .addReg(RotatedOldVal).
addReg(Src2);
6474 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6484 BuildMI(MBB, DL, TII->get(SystemZ::RISBG32), RotatedAltVal)
6485 .addReg(RotatedOldVal).
addReg(Src2)
6497 BuildMI(MBB, DL, TII->get(SystemZ::PHI), RotatedNewVal)
6498 .addReg(RotatedOldVal).
addMBB(LoopMBB)
6501 BuildMI(MBB, DL, TII->get(SystemZ::RLL), NewVal)
6503 BuildMI(MBB, DL, TII->get(CSOpcode), Dest)
6508 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6520 SystemZTargetLowering::emitAtomicCmpSwapW(
MachineInstr &MI,
6544 assert(LOpcode && CSOpcode &&
"Displacement out of range");
6567 BuildMI(MBB, DL, TII->get(LOpcode), OrigOldVal)
6588 BuildMI(MBB, DL, TII->get(SystemZ::PHI), OldVal)
6589 .addReg(OrigOldVal).
addMBB(StartMBB)
6591 BuildMI(MBB, DL, TII->get(SystemZ::PHI), CmpVal)
6592 .addReg(OrigCmpVal).
addMBB(StartMBB)
6594 BuildMI(MBB, DL, TII->get(SystemZ::PHI), SwapVal)
6595 .addReg(OrigSwapVal).
addMBB(StartMBB)
6597 BuildMI(MBB, DL, TII->get(SystemZ::RLL), Dest)
6599 BuildMI(MBB, DL, TII->get(SystemZ::RISBG32), RetryCmpVal)
6601 BuildMI(MBB, DL, TII->get(SystemZ::CR))
6602 .addReg(Dest).
addReg(RetryCmpVal);
6603 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6619 BuildMI(MBB, DL, TII->get(SystemZ::RISBG32), RetrySwapVal)
6621 BuildMI(MBB, DL, TII->get(SystemZ::RLL), StoreVal)
6622 .addReg(RetrySwapVal).
addReg(NegBitShift).
addImm(-BitSize);
6623 BuildMI(MBB, DL, TII->get(CSOpcode), RetryOldVal)
6628 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6659 BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::IMPLICIT_DEF), Tmp1);
6660 BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::INSERT_SUBREG), Tmp2)
6662 BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::INSERT_SUBREG), Dest)
6674 bool ClearEven)
const {
6685 BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::IMPLICIT_DEF), In128);
6690 BuildMI(*MBB, MI, DL, TII->get(SystemZ::LLILL), Zero64)
6692 BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::INSERT_SUBREG), NewIn128)
6693 .addReg(In128).
addReg(Zero64).
addImm(SystemZ::subreg_h64);
6696 BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::INSERT_SUBREG), Dest)
6697 .addReg(In128).
addReg(Src).
addImm(SystemZ::subreg_l64);
6727 uint64_t StartSrcReg =
forceReg(MI, SrcBase, TII);
6728 uint64_t StartDestReg = (HaveSingleBase ? StartSrcReg :
6733 uint64_t ThisDestReg = (HaveSingleBase ? ThisSrcReg :
6736 uint64_t NextDestReg = (HaveSingleBase ? NextSrcReg :
6739 RC = &SystemZ::GR64BitRegClass;
6766 BuildMI(MBB, DL, TII->get(SystemZ::PHI), ThisDestReg)
6767 .addReg(StartDestReg).
addMBB(StartMBB)
6769 if (!HaveSingleBase)
6770 BuildMI(MBB, DL, TII->get(SystemZ::PHI), ThisSrcReg)
6771 .addReg(StartSrcReg).
addMBB(StartMBB)
6773 BuildMI(MBB, DL, TII->get(SystemZ::PHI), ThisCountReg)
6774 .addReg(StartCountReg).
addMBB(StartMBB)
6777 BuildMI(MBB, DL, TII->get(SystemZ::PFD))
6780 BuildMI(MBB, DL, TII->get(Opcode))
6784 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6802 BuildMI(MBB, DL, TII->get(SystemZ::LA), NextDestReg)
6804 if (!HaveSingleBase)
6805 BuildMI(MBB, DL, TII->get(SystemZ::LA), NextSrcReg)
6807 BuildMI(MBB, DL, TII->get(SystemZ::AGHI), NextCountReg)
6808 .addReg(ThisCountReg).
addImm(-1);
6809 BuildMI(MBB, DL, TII->get(SystemZ::CGHI))
6810 .addReg(NextCountReg).
addImm(0);
6811 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6820 if (EndMBB && !Length)
6827 while (Length > 0) {
6828 uint64_t ThisLength = std::min(Length, uint64_t(256));
6831 if (!isUInt<12>(DestDisp)) {
6840 if (!isUInt<12>(SrcDisp)) {
6849 BuildMI(*MBB, MI, DL, TII->get(Opcode))
6856 DestDisp += ThisLength;
6857 SrcDisp += ThisLength;
6858 Length -= ThisLength;
6861 if (EndMBB && Length > 0) {
6863 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6920 BuildMI(MBB, DL, TII->get(SystemZ::PHI), This1Reg)
6921 .addReg(Start1Reg).
addMBB(StartMBB)
6923 BuildMI(MBB, DL, TII->get(SystemZ::PHI), This2Reg)
6924 .addReg(Start2Reg).
addMBB(StartMBB)
6926 BuildMI(MBB, DL, TII->get(TargetOpcode::COPY), SystemZ::R0L).addReg(CharReg);
6927 BuildMI(MBB, DL, TII->get(Opcode))
6930 BuildMI(MBB, DL, TII->get(SystemZ::BRC))
6944 bool NoFloat)
const {
6955 static const unsigned GPRControlBit[16] = {
6956 0x8000, 0x8000, 0x4000, 0x4000, 0x2000, 0x2000, 0x1000, 0x1000,
6957 0x0800, 0x0800, 0x0400, 0x0400, 0x0200, 0x0200, 0x0100, 0x0100
6959 Control |= GPRControlBit[15];
6961 Control |= GPRControlBit[11];
6965 for (
int I = 0;
I < 16;
I++) {
6966 if ((Control & GPRControlBit[
I]) == 0) {
6973 if (!NoFloat && (Control & 4) != 0) {
6974 if (Subtarget.hasVector()) {
6975 for (
int I = 0;
I < 32;
I++) {
6980 for (
int I = 0;
I < 16;
I++) {
7006 BuildMI(*MBB, MI, DL, TII->get(Opcode), DstReg)
7016 case SystemZ::Select32:
7017 case SystemZ::Select64:
7018 case SystemZ::SelectF32:
7019 case SystemZ::SelectF64:
7020 case SystemZ::SelectF128:
7021 case SystemZ::SelectVR32:
7022 case SystemZ::SelectVR64:
7023 case SystemZ::SelectVR128:
7024 return emitSelect(MI, MBB);
7026 case SystemZ::CondStore8Mux:
7027 return emitCondStore(MI, MBB, SystemZ::STCMux, 0,
false);
7028 case SystemZ::CondStore8MuxInv:
7029 return emitCondStore(MI, MBB, SystemZ::STCMux, 0,
true);
7030 case SystemZ::CondStore16Mux:
7031 return emitCondStore(MI, MBB, SystemZ::STHMux, 0,
false);
7032 case SystemZ::CondStore16MuxInv:
7033 return emitCondStore(MI, MBB, SystemZ::STHMux, 0,
true);
7034 case SystemZ::CondStore32Mux:
7035 return emitCondStore(MI, MBB, SystemZ::STMux, SystemZ::STOCMux,
false);
7036 case SystemZ::CondStore32MuxInv:
7037 return emitCondStore(MI, MBB, SystemZ::STMux, SystemZ::STOCMux,
true);
7038 case SystemZ::CondStore8:
7039 return emitCondStore(MI, MBB, SystemZ::STC, 0,
false);
7040 case SystemZ::CondStore8Inv:
7041 return emitCondStore(MI, MBB, SystemZ::STC, 0,
true);
7042 case SystemZ::CondStore16:
7043 return emitCondStore(MI, MBB, SystemZ::STH, 0,
false);
7044 case SystemZ::CondStore16Inv:
7045 return emitCondStore(MI, MBB, SystemZ::STH, 0,
true);
7046 case SystemZ::CondStore32:
7047 return emitCondStore(MI, MBB,
SystemZ::ST, SystemZ::STOC,
false);
7048 case SystemZ::CondStore32Inv:
7049 return emitCondStore(MI, MBB,
SystemZ::ST, SystemZ::STOC,
true);
7050 case SystemZ::CondStore64:
7051 return emitCondStore(MI, MBB, SystemZ::STG, SystemZ::STOCG,
false);
7052 case SystemZ::CondStore64Inv:
7053 return emitCondStore(MI, MBB, SystemZ::STG, SystemZ::STOCG,
true);
7054 case SystemZ::CondStoreF32:
7055 return emitCondStore(MI, MBB, SystemZ::STE, 0,
false);
7056 case SystemZ::CondStoreF32Inv:
7057 return emitCondStore(MI, MBB, SystemZ::STE, 0,
true);
7058 case SystemZ::CondStoreF64:
7059 return emitCondStore(MI, MBB, SystemZ::STD, 0,
false);
7060 case SystemZ::CondStoreF64Inv:
7061 return emitCondStore(MI, MBB, SystemZ::STD, 0,
true);
7063 case SystemZ::PAIR128:
7064 return emitPair128(MI, MBB);
7065 case SystemZ::AEXT128:
7066 return emitExt128(MI, MBB,
false);
7067 case SystemZ::ZEXT128:
7068 return emitExt128(MI, MBB,
true);
7071 return emitAtomicLoadBinary(MI, MBB, 0, 0);
7072 case SystemZ::ATOMIC_SWAP_32:
7073 return emitAtomicLoadBinary(MI, MBB, 0, 32);
7074 case SystemZ::ATOMIC_SWAP_64:
7075 return emitAtomicLoadBinary(MI, MBB, 0, 64);
7077 case SystemZ::ATOMIC_LOADW_AR:
7078 return emitAtomicLoadBinary(MI, MBB, SystemZ::AR, 0);
7079 case SystemZ::ATOMIC_LOADW_AFI:
7080 return emitAtomicLoadBinary(MI, MBB, SystemZ::AFI, 0);
7081 case SystemZ::ATOMIC_LOAD_AR:
7082 return emitAtomicLoadBinary(MI, MBB, SystemZ::AR, 32);
7083 case SystemZ::ATOMIC_LOAD_AHI:
7084 return emitAtomicLoadBinary(MI, MBB, SystemZ::AHI, 32);
7085 case SystemZ::ATOMIC_LOAD_AFI:
7086 return emitAtomicLoadBinary(MI, MBB, SystemZ::AFI, 32);
7087 case SystemZ::ATOMIC_LOAD_AGR:
7088 return emitAtomicLoadBinary(MI, MBB, SystemZ::AGR, 64);
7089 case SystemZ::ATOMIC_LOAD_AGHI:
7090 return emitAtomicLoadBinary(MI, MBB, SystemZ::AGHI, 64);
7091 case SystemZ::ATOMIC_LOAD_AGFI:
7092 return emitAtomicLoadBinary(MI, MBB, SystemZ::AGFI, 64);
7094 case SystemZ::ATOMIC_LOADW_SR:
7095 return emitAtomicLoadBinary(MI, MBB, SystemZ::SR, 0);
7096 case SystemZ::ATOMIC_LOAD_SR:
7097 return emitAtomicLoadBinary(MI, MBB, SystemZ::SR, 32);
7098 case SystemZ::ATOMIC_LOAD_SGR:
7099 return emitAtomicLoadBinary(MI, MBB, SystemZ::SGR, 64);
7101 case SystemZ::ATOMIC_LOADW_NR:
7102 return emitAtomicLoadBinary(MI, MBB, SystemZ::NR, 0);
7103 case SystemZ::ATOMIC_LOADW_NILH:
7104 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 0);
7105 case SystemZ::ATOMIC_LOAD_NR:
7106 return emitAtomicLoadBinary(MI, MBB, SystemZ::NR, 32);
7107 case SystemZ::ATOMIC_LOAD_NILL:
7108 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL, 32);
7109 case SystemZ::ATOMIC_LOAD_NILH:
7110 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 32);
7111 case SystemZ::ATOMIC_LOAD_NILF:
7112 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF, 32);
7113 case SystemZ::ATOMIC_LOAD_NGR:
7114 return emitAtomicLoadBinary(MI, MBB, SystemZ::NGR, 64);
7115 case SystemZ::ATOMIC_LOAD_NILL64:
7116 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL64, 64);
7117 case SystemZ::ATOMIC_LOAD_NILH64:
7118 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH64, 64);
7119 case SystemZ::ATOMIC_LOAD_NIHL64:
7120 return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHL64, 64);
7121 case SystemZ::ATOMIC_LOAD_NIHH64:
7122 return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHH64, 64);
7123 case SystemZ::ATOMIC_LOAD_NILF64:
7124 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF64, 64);
7125 case SystemZ::ATOMIC_LOAD_NIHF64:
7126 return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHF64, 64);
7129 return emitAtomicLoadBinary(MI, MBB,
SystemZ::OR, 0);
7130 case SystemZ::ATOMIC_LOADW_OILH:
7131 return emitAtomicLoadBinary(MI, MBB, SystemZ::OILH, 0);
7133 return emitAtomicLoadBinary(MI, MBB,
SystemZ::OR, 32);
7134 case SystemZ::ATOMIC_LOAD_OILL:
7135 return emitAtomicLoadBinary(MI, MBB, SystemZ::OILL, 32);
7136 case SystemZ::ATOMIC_LOAD_OILH:
7137 return emitAtomicLoadBinary(MI, MBB, SystemZ::OILH, 32);
7138 case SystemZ::ATOMIC_LOAD_OILF:
7139 return emitAtomicLoadBinary(MI, MBB, SystemZ::OILF, 32);
7140 case SystemZ::ATOMIC_LOAD_OGR:
7141 return emitAtomicLoadBinary(MI, MBB, SystemZ::OGR, 64);
7142 case SystemZ::ATOMIC_LOAD_OILL64:
7143 return emitAtomicLoadBinary(MI, MBB, SystemZ::OILL64, 64);
7144 case SystemZ::ATOMIC_LOAD_OILH64:
7145 return emitAtomicLoadBinary(MI, MBB, SystemZ::OILH64, 64);
7146 case SystemZ::ATOMIC_LOAD_OIHL64:
7147 return emitAtomicLoadBinary(MI, MBB, SystemZ::OIHL64, 64);
7148 case SystemZ::ATOMIC_LOAD_OIHH64:
7149 return emitAtomicLoadBinary(MI, MBB, SystemZ::OIHH64, 64);
7150 case SystemZ::ATOMIC_LOAD_OILF64:
7151 return emitAtomicLoadBinary(MI, MBB, SystemZ::OILF64, 64);
7152 case SystemZ::ATOMIC_LOAD_OIHF64:
7153 return emitAtomicLoadBinary(MI, MBB, SystemZ::OIHF64, 64);
7155 case SystemZ::ATOMIC_LOADW_XR:
7156 return emitAtomicLoadBinary(MI, MBB, SystemZ::XR, 0);
7157 case SystemZ::ATOMIC_LOADW_XILF:
7158 return emitAtomicLoadBinary(MI, MBB, SystemZ::XILF, 0);
7159 case SystemZ::ATOMIC_LOAD_XR:
7160 return emitAtomicLoadBinary(MI, MBB, SystemZ::XR, 32);
7161 case SystemZ::ATOMIC_LOAD_XILF:
7162 return emitAtomicLoadBinary(MI, MBB, SystemZ::XILF, 32);
7163 case SystemZ::ATOMIC_LOAD_XGR:
7164 return emitAtomicLoadBinary(MI, MBB, SystemZ::XGR, 64);
7165 case SystemZ::ATOMIC_LOAD_XILF64:
7166 return emitAtomicLoadBinary(MI, MBB, SystemZ::XILF64, 64);
7167 case SystemZ::ATOMIC_LOAD_XIHF64:
7168 return emitAtomicLoadBinary(MI, MBB, SystemZ::XIHF64, 64);
7170 case SystemZ::ATOMIC_LOADW_NRi:
7171 return emitAtomicLoadBinary(MI, MBB, SystemZ::NR, 0,
true);
7172 case SystemZ::ATOMIC_LOADW_NILHi:
7173 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 0,
true);
7174 case SystemZ::ATOMIC_LOAD_NRi:
7175 return emitAtomicLoadBinary(MI, MBB, SystemZ::NR, 32,
true);
7176 case SystemZ::ATOMIC_LOAD_NILLi:
7177 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL, 32,
true);
7178 case SystemZ::ATOMIC_LOAD_NILHi:
7179 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 32,
true);
7180 case SystemZ::ATOMIC_LOAD_NILFi:
7181 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF, 32,
true);
7182 case SystemZ::ATOMIC_LOAD_NGRi:
7183 return emitAtomicLoadBinary(MI, MBB, SystemZ::NGR, 64,
true);
7184 case SystemZ::ATOMIC_LOAD_NILL64i:
7185 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL64, 64,
true);
7186 case SystemZ::ATOMIC_LOAD_NILH64i:
7187 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH64, 64,
true);
7188 case SystemZ::ATOMIC_LOAD_NIHL64i:
7189 return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHL64, 64,
true);
7190 case SystemZ::ATOMIC_LOAD_NIHH64i:
7191 return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHH64, 64,
true);
7192 case SystemZ::ATOMIC_LOAD_NILF64i:
7193 return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF64, 64,
true);
7194 case SystemZ::ATOMIC_LOAD_NIHF64i:
7195 return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHF64, 64,
true);
7198 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CR,
7200 case SystemZ::ATOMIC_LOAD_MIN_32:
7201 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CR,
7203 case SystemZ::ATOMIC_LOAD_MIN_64:
7204 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CGR,
7208 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CR,
7210 case SystemZ::ATOMIC_LOAD_MAX_32:
7211 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CR,
7213 case SystemZ::ATOMIC_LOAD_MAX_64:
7214 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CGR,
7218 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CLR,
7220 case SystemZ::ATOMIC_LOAD_UMIN_32:
7221 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CLR,
7223 case SystemZ::ATOMIC_LOAD_UMIN_64:
7224 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CLGR,
7228 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CLR,
7230 case SystemZ::ATOMIC_LOAD_UMAX_32:
7231 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CLR,
7233 case SystemZ::ATOMIC_LOAD_UMAX_64:
7234 return emitAtomicLoadMinMax(MI, MBB, SystemZ::CLGR,
7238 return emitAtomicCmpSwapW(MI, MBB);
7239 case SystemZ::MVCSequence:
7240 case SystemZ::MVCLoop:
7242 case SystemZ::NCSequence:
7243 case SystemZ::NCLoop:
7245 case SystemZ::OCSequence:
7246 case SystemZ::OCLoop:
7248 case SystemZ::XCSequence:
7249 case SystemZ::XCLoop:
7251 case SystemZ::CLCSequence:
7252 case SystemZ::CLCLoop:
7254 case SystemZ::CLSTLoop:
7255 return emitStringWrapper(MI, MBB, SystemZ::CLST);
7256 case SystemZ::MVSTLoop:
7257 return emitStringWrapper(MI, MBB, SystemZ::MVST);
7258 case SystemZ::SRSTLoop:
7259 return emitStringWrapper(MI, MBB, SystemZ::SRST);
7262 case SystemZ::TBEGIN_nofloat:
7264 case SystemZ::TBEGINC:
7265 return emitTransactionBegin(MI, MBB, SystemZ::TBEGINC,
true);
7266 case SystemZ::LTEBRCompare_VecPseudo:
7267 return emitLoadAndTestCmp0(MI, MBB, SystemZ::LTEBR);
7268 case SystemZ::LTDBRCompare_VecPseudo:
7269 return emitLoadAndTestCmp0(MI, MBB, SystemZ::LTDBR);
7270 case SystemZ::LTXBRCompare_VecPseudo:
7271 return emitLoadAndTestCmp0(MI, MBB, SystemZ::LTXBR);
7273 case TargetOpcode::STACKMAP:
7274 case TargetOpcode::PATCHPOINT:
7285 SystemZTargetLowering::getRepRegClassFor(
MVT VT)
const {
7287 return &SystemZ::ADDR128BitRegClass;
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
static SDValue getPermuteNode(SelectionDAG &DAG, const SDLoc &DL, const Permute &P, SDValue Op0, SDValue Op1)
bool isMachineConstantPoolEntry() const
static unsigned computeNumSignBitsBinOp(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth, unsigned OpNo)
static unsigned CCMaskForCondCode(ISD::CondCode CC)
void setFrameAddressIsTaken(bool T)
const unsigned CCMASK_CMP_GT
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
constexpr bool isUInt< 32 >(uint64_t x)
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
static MVT getIntegerVT(unsigned BitWidth)
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
void push_back(const T &Elt)
const MachineInstrBuilder & add(const MachineOperand &MO) const
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
BUILTIN_OP_END - This must be the last enum value in this list.
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
EVT getValueType() const
Return the ValueType of the referenced return value.
static bool getShuffleInput(const SmallVectorImpl< int > &Bytes, unsigned Start, unsigned BytesPerElement, int &Base)
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
static void VerifyVectorTypes(const SmallVectorImpl< ISD::InputArg > &Ins)
void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified load with extension does not work with the specified type and indicate wh...
const unsigned CCMASK_ARITH
T findLastSet(T Val, ZeroBehavior ZB=ZB_Max)
Get the index of the last set bit starting from the least significant bit.
const GlobalValue * getGlobal() const
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
uint64_t getZExtValue() const
Get zero extended value.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
const unsigned GR32Regs[16]
static bool isIntrinsicWithCCAndChain(SDValue Op, unsigned &Opcode, unsigned &CCValid)
const int64_t CallFrameSize
SDValue CombineTo(SDNode *N, ArrayRef< SDValue > To, bool AddTo=true)
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, const SDLoc &DL)
Return a new CALLSEQ_END node, which always must have a glue result (to ensure it's not CSE'd)...
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &, EVT) const override
Return the ValueType of the result of SETCC operations.
C - The default llvm calling convention, compatible with C.
static SDValue getAbsolute(SelectionDAG &DAG, const SDLoc &DL, SDValue Op, bool IsNegative)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
BR_CC - Conditional branch.
Compute iterated dominance frontiers using a linear time algorithm.
static SDValue buildScalarToVector(SelectionDAG &DAG, const SDLoc &DL, EVT VT, SDValue Value)
static const Permute PermuteForms[]
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
const MCPhysReg ArgFPRs[NumArgFPRs]
static MVT getVectorVT(MVT VT, unsigned NumElements)
const unsigned CCMASK_FCMP
const unsigned FP128Regs[16]
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
unsigned odd128(bool Is32bit)
virtual const TargetRegisterClass * getRepRegClassFor(MVT VT) const
Return the 'representative' register class for the specified value type.
static bool checkCCKill(MachineInstr &MI, MachineBasicBlock *MBB)
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SDLoc &DL, SelectionDAG &DAG) const override
This hook must be implemented to lower outgoing return values, described by the Outs array...
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I=nullptr) const override
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
static void adjustForRedundantAnd(SelectionDAG &DAG, const SDLoc &DL, Comparison &C)
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
bool isVector() const
Return true if this is a vector value type.
void addLiveIn(unsigned Reg, unsigned vreg=0)
addLiveIn - Add the specified register as a live-in.
const SDValue & getBasePtr() const
static bool isImmHH(uint64_t Val)
static SDValue tryBuildVectorShuffle(SelectionDAG &DAG, BuildVectorSDNode *BVN)
unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const override
Determine the number of bits in the operation that are sign bits.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
unsigned getReg() const
getReg - Returns the register number.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
SDVTList getVTList() const
This class represents a function call, abstracting a target machine's calling convention.
unsigned getRegSaveFrameIndex() const
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
static void adjustZeroCmp(SelectionDAG &DAG, const SDLoc &DL, Comparison &C)
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
const SDValue & getChain() const
static SDValue tryBuildVectorReplicate(SelectionDAG &DAG, const SystemZInstrInfo *TII, const SDLoc &DL, EVT VT, uint64_t Value, unsigned BitsPerElement)
Function Alias Analysis Results
static Comparison getIntrinsicCmp(SelectionDAG &DAG, unsigned Opcode, SDValue Call, unsigned CCValid, uint64_t CC, ISD::CondCode Cond)
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
static std::pair< unsigned, const TargetRegisterClass * > parseRegisterNumber(StringRef Constraint, const TargetRegisterClass *RC, const unsigned *Map, unsigned Size)
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
static bool canUseSiblingCall(const CCState &ArgCCInfo, SmallVectorImpl< CCValAssign > &ArgLocs, SmallVectorImpl< ISD::OutputArg > &Outs)
void setBooleanVectorContents(BooleanContent Ty)
Specify how the target extends the result of a vector boolean value from a vector of i1 to a wider ty...
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
APInt trunc(unsigned width) const
Truncate to new width.
constexpr bool isInt< 16 >(int64_t x)
bool isLegalAddImmediate(int64_t Imm) const override
Return true if the specified immediate is legal add immediate, that is the target has add instruction...
unsigned const TargetRegisterInfo * TRI
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
bool isInteger() const
Return true if this is an integer or a vector integer type.
static SDValue joinDwords(SelectionDAG &DAG, const SDLoc &DL, SDValue Op0, SDValue Op1)
const unsigned FP32Regs[16]
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
SDNode * getNode() const
get the SDNode which holds the desired result
void setBitsFrom(unsigned loBit)
Set the top bits starting from loBit.
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
iterator_range< mmo_iterator > memoperands()
static void createPHIsForSelects(MachineBasicBlock::iterator MIItBegin, MachineBasicBlock::iterator MIItEnd, MachineBasicBlock *TrueMBB, MachineBasicBlock *FalseMBB, MachineBasicBlock *SinkMBB)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool isVectorTy() const
True if this is an instance of VectorType.
void reserve(size_type N)
Value * CallOperandVal
If this is the result output operand or a clobber, this is null, otherwise it is the incoming operand...
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
static bool chooseShuffleOpNos(int *OpNos, unsigned &OpNo0, unsigned &OpNo1)
const unsigned CCMASK_CS_EQ
const unsigned CCMASK_LOGICAL_CARRY
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offs=0, bool isT=false, unsigned char TargetFlags=0)
unsigned getBitWidth() const
Get the bit width of this value.
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
std::size_t countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
static bool shouldSwapCmpOperands(const Comparison &C)
const unsigned CCMASK_ICMP
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
TargetLowering::ConstraintType getConstraintType(StringRef Constraint) const override
Given a constraint, return the type of constraint it is for this target.
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, LLVMContext &Context) const override
This hook should be implemented to check whether the return values described by the Outs array can fi...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
static unsigned getVectorComparison(ISD::CondCode CC, bool IsFP)
int getFramePointerSaveIndex() const
unsigned getBitWidth() const
Return the number of bits in the APInt.
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
Lower the specified operand into the Ops vector.
const unsigned VR64Regs[32]
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
The address of a basic block.
bool hasOneUse() const
Return true if there is exactly one use of this node.
A description of a memory reference used in the backend.
static bool matchDoublePermute(const SmallVectorImpl< int > &Bytes, const Permute &P, SmallVectorImpl< int > &Transform)
void setBit(unsigned BitPosition)
Set a given bit to 1.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
static MachineBasicBlock * splitBlockAfter(MachineBasicBlock::iterator MI, MachineBasicBlock *MBB)
const HexagonInstrInfo * TII
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
Shift and rotation operations.
static bool isShlDoublePermute(const SmallVectorImpl< int > &Bytes, unsigned &StartIndex, unsigned &OpNo0, unsigned &OpNo1)
virtual bool hasFP(const MachineFunction &MF) const =0
hasFP - Return true if the specified function should have a dedicated frame pointer register...
const unsigned CCMASK_TM_MSB_0
void setVarArgsFirstGPR(unsigned GPR)
SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s), MachineInstr opcode, and operands.
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
bool isIntegerTy() const
True if this is an instance of IntegerType.
unsigned getScalarValueSizeInBits() const
uint64_t getConstantOperandVal(unsigned i) const
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) For double-word atomic operations: ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) These correspond to the atomicrmw instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
Indicate that the specified operation does not work with the specified type and indicate what to do a...
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
static void lowerMUL_LOHI32(SelectionDAG &DAG, const SDLoc &DL, unsigned Extend, SDValue Op0, SDValue Op1, SDValue &Hi, SDValue &Lo)
const BlockAddress * getBlockAddress() const
LocInfo getLocInfo() const
void lshrInPlace(unsigned ShiftAmt)
Logical right-shift this APInt by ShiftAmt in place.
KnownBits zext(unsigned BitWidth)
Zero extends the underlying known Zero and One bits.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
SmallVector< ISD::InputArg, 32 > Ins
AtomicOrdering
Atomic ordering for LLVM's memory model.
STACKSAVE - STACKSAVE has one operand, an input chain.
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
static bool isScalarToVector(SDValue Op)
unsigned getScalarSizeInBits() const
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
Type * getType() const
All values are typed, get the type of this value.
MachineFunction & getMachineFunction() const
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose...
SDValue getRegisterMask(const uint32_t *RegMask)
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
const TargetMachine & getTarget() const
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
static SDNode * emitIntrinsicWithCC(SelectionDAG &DAG, SDValue Op, unsigned Opcode)
bool isLegalICmpImmediate(int64_t Imm) const override
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
This contains information for each constraint that we are lowering.
Simple integer binary arithmetic operators.
const unsigned CCMASK_TBEGIN
SmallVector< ISD::OutputArg, 32 > Outs
static AddressingMode getLoadStoreAddrMode(bool HasVector, Type *Ty)
const unsigned NumArgFPRs
static bool matchPermute(const SmallVectorImpl< int > &Bytes, const Permute &P, unsigned &OpNo0, unsigned &OpNo1)
void incNumLocalDynamicTLSAccesses()
KnownBits zextOrTrunc(unsigned BitWidth)
Zero extends or truncates the underlying known Zero and One bits.
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
static mvt_range integer_vector_valuetypes()
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
const unsigned CCMASK_ANY
virtual const TargetInstrInfo * getInstrInfo() const
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
const unsigned VectorBits
bool isTruncateFree(Type *, Type *) const override
Return true if it's free to truncate a value of type FromTy to type ToTy.
const unsigned CCMASK_CS_NE
const unsigned CCMASK_TM_SOME_0
amdgpu Simplify well known AMD library false Value * Callee
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
Value * getOperand(unsigned i) const
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
const unsigned CCMASK_TM_ALL_1
SDValue LowerCall(CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower calls into the specified DAG.
UNDEF - An undefined node.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
TargetInstrInfo - Interface to description of machine instruction set.
iterator find(const_arg_type_t< KeyT > Val)
bool isIdenticalTo(const MachineOperand &Other) const
Returns true if this operand is identical to the specified operand except for liveness related flags ...
unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits...
SystemZTargetLowering(const TargetMachine &TM, const SystemZSubtarget &STI)
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
const unsigned CCMASK_LOGICAL
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
const unsigned CCMASK_LOGICAL_BORROW
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void insertBits(const APInt &SubBits, unsigned bitPosition)
Insert the bits from a smaller APInt starting at bitPosition.
static void adjustForLTGFR(Comparison &C)
virtual const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const
Return a mask of call-preserved registers for the given calling convention on the current function...
MachineInstrBundleIterator< MachineInstr > iterator
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
int64_t getOffset() const
void addLiveIn(MCPhysReg PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
constexpr bool isUInt< 8 >(uint64_t x)
unsigned const MachineRegisterInfo * MRI
std::size_t countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
bool SignBitIsZero(SDValue Op, unsigned Depth=0) const
Return true if the sign bit of Op is known to be zero.
MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
const unsigned CCMASK_VCMP
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type...
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
Simple binary floating point operators.
void setTargetDAGCombine(ISD::NodeType NT)
Targets should invoke this method for each target independent node that they want to provide a custom...
bool registerDefIsDead(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Returns true if the register is dead in this machine instruction.
const MCPhysReg * getScratchRegisters(CallingConv::ID CC) const override
Returns a 0 terminated array of registers that can be safely used as scratch registers.
static bool isNaturalMemoryOperand(SDValue Op, unsigned ICmpType)
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
void resetAll()
Resets the known state of all bits.
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
unsigned getOpcodeForOffset(unsigned Opcode, int64_t Offset) const
const SDValue & getOperand(unsigned Num) const
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
static SDValue lowerGR128ToI128(SelectionDAG &DAG, SDValue In)
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
This callback is invoked for operations that are unsupported by the target, which are registered to u...
const unsigned CCMASK_CMP_LE
static SDValue buildVector(SelectionDAG &DAG, const SDLoc &DL, EVT VT, SmallVectorImpl< SDValue > &Elems)
static ManagedStatic< OptionRegistry > OR
static void adjustICmpTruncate(SelectionDAG &DAG, const SDLoc &DL, Comparison &C)
SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize, const SDLoc &DL)
Return a new CALLSEQ_START node, that starts new call frame, in which InSize bytes are set up inside ...
static bool getVPermMask(SDValue ShuffleOp, SmallVectorImpl< int > &Bytes)
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
bool mayBeEmittedAsTailCall(const CallInst *CI) const override
Return true if the target may be able emit the call instruction as a tail call.
void AddToWorklist(SDNode *N)
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
static mvt_range fp_valuetypes()
static SDValue expandV4F32ToV2F64(SelectionDAG &DAG, int Start, const SDLoc &DL, SDValue Op)
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
void setRegSaveFrameIndex(unsigned FI)
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void setImm(int64_t immVal)
const unsigned CCMASK_TM_MSB_1
TRAP - Trapping instruction.
bool definesRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr fully defines the specified register.
const unsigned CCMASK_CMP_LT
static SDValue buildMergeScalars(SelectionDAG &DAG, const SDLoc &DL, EVT VT, SDValue Op0, SDValue Op1)
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
void setPrefFunctionAlignment(unsigned Align)
Set the target's preferred function alignment.
static mvt_range vector_valuetypes()
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, unsigned Size=0)
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
CondCode getSetCCSwappedOperands(CondCode Operation)
Return the operation corresponding to (Y op X) when given the operation for (X op Y)...
const unsigned CCMASK_TDC
static Comparison getCmp(SelectionDAG &DAG, SDValue CmpOp0, SDValue CmpOp1, ISD::CondCode Cond, const SDLoc &DL)
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
static unsigned forceReg(MachineInstr &MI, MachineOperand &Base, const SystemZInstrInfo *TII)
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
succ_iterator succ_begin()
unsigned getAlignment() const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
static SDValue convertLocVTToValVT(SelectionDAG &DAG, const SDLoc &DL, CCValAssign &VA, SDValue Chain, SDValue Value)
This structure contains all information that is necessary for lowering calls.
static bool combineCCMask(SDValue &CCReg, int &CCValid, int &CCMask)
static bool isImmLH(uint64_t Val)
T findFirstSet(T Val, ZeroBehavior ZB=ZB_Max)
Get the index of the first set bit starting from the least significant bit.
SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &DL, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower the incoming (formal) arguments, described by the Ins array...
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, unsigned Align, bool *Fast) const override
Determine if the target supports unaligned memory accesses.
This class contains a discriminated union of information about pointers in memory operands...
unsigned getNumOperands() const
Return the number of values used by this operation.
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
Fast - This calling convention attempts to make calls as fast as possible (e.g.
bool hasVectorEnhancements1() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
AddressingMode(bool LongDispl, bool IdxReg)
unsigned getNumExplicitOperands() const
Returns the number of non-implicit operands.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands...
SDValue CreateStackTemporary(EVT VT, unsigned minAlign=1)
Create a stack temporary, suitable for holding the specified value type.
const unsigned CCMASK_TM_MIXED_MSB_0
bool allowTruncateForTailCall(Type *, Type *) const override
Return true if a truncation from FromTy to ToTy is permitted when deciding whether a call is in tail ...
void setIsKill(bool Val=true)
unsigned getPointerSize(unsigned AS) const
Get the pointer size for this target.
SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offset=0, unsigned char TargetFlags=0)
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags=0)
static bool isUndef(ArrayRef< int > Mask)
TokenFactor - This node takes multiple tokens as input and produces a single token result...
const TargetLowering & getTargetLoweringInfo() const
Iterator for intrusive lists based on ilist_node.
static APInt getDemandedSrcElements(SDValue Op, const APInt &DemandedElts, unsigned OpNo)
CCState - This class holds information needed while lowering arguments and return values...
TargetLowering::ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const override
Examine constraint string and operand type and determine a weight value.
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
constexpr bool isInt< 32 >(int64_t x)
void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
unsigned getVarArgsFrameIndex() const
void setVarArgsFrameIndex(unsigned FI)
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
This callback is invoked when a node result type is illegal for the target, and the operation was reg...
unsigned getVarArgsFirstGPR() const
EVT getVectorElementType() const
Given a vector type, return the type of each element.
testing::Matcher< const detail::ErrorHolder & > Failed()
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
static SDNode * emitIntrinsicWithCCAndChain(SelectionDAG &DAG, SDValue Op, unsigned Opcode)
SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
const unsigned CCMASK_CMP_EQ
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
CCValAssign - Represent assignment of one arg/retval to a location.
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool AlwaysInline, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
const unsigned FP64Regs[16]
static bool isSimpleShift(SDValue N, unsigned &ShiftVal)
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
BRCOND - Conditional branch.
Information about stack frame layout on the target.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
static bool tryBuildVectorByteMask(BuildVectorSDNode *BVN, uint64_t &Mask)
static SDValue convertValVTToLocVT(SelectionDAG &DAG, const SDLoc &DL, CCValAssign &VA, SDValue Value)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
Byte Swap and Counting operators.
const unsigned CCMASK_CMP_O
const unsigned GR128Regs[16]
LegalizeAction getOperationAction(unsigned Op, EVT VT) const
Return how this operation should be treated: either it is legal, needs to be promoted to a larger siz...
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
const Constant * getConstVal() const
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
const unsigned CCMASK_CMP_NE
Represents one node in the SelectionDAG.
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
static SDValue lowerI128ToGR128(SelectionDAG &DAG, SDValue In)
const unsigned GR64Regs[16]
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
static mvt_range integer_valuetypes()
const unsigned CCMASK_TM_MIXED_MSB_1
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
EVT getMemoryVT() const
Return the type of the in-memory value.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
Class for arbitrary precision integers.
CodeModel::Model getCodeModel() const
Returns the code model.
void LowerOperationWrapper(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
This callback is invoked by the type legalizer to legalize nodes with an illegal operand type but leg...
const unsigned VectorBytes
iterator_range< use_iterator > uses()
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
void setMinFunctionAlignment(unsigned Align)
Set the target's minimum function alignment (in log2(bytes))
bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr reads the specified register.
void setVarArgsFirstFPR(unsigned FPR)
static use_iterator use_end()
ZERO_EXTEND - Used for integer types, zeroing the new bits.
static void VerifyVectorType(MVT VT, EVT ArgVT)
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *BB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
ANY_EXTEND - Used for integer types. The high bits are undefined.
const unsigned CCMASK_CMP_GE
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
static MachineOperand earlyUseOperand(MachineOperand Op)
FMINNAN/FMAXNAN - Behave identically to FMINNUM/FMAXNUM, except that when a single input is NaN...
static void adjustForTestUnderMask(SelectionDAG &DAG, const SDLoc &DL, Comparison &C)
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
static SDValue emitSETCC(SelectionDAG &DAG, const SDLoc &DL, SDValue CCReg, unsigned CCValid, unsigned CCMask)
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
static SDValue getGeneralPermuteNode(SelectionDAG &DAG, const SDLoc &DL, SDValue *Ops, const SmallVectorImpl< int > &Bytes)
GET_DYNAMIC_AREA_OFFSET - get offset from native SP to the address of the most recent dynamic alloca...
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
BR_JT - Jumptable branch.
Representation of each machine instruction.
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the source.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr kills the specified register.
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned char TargetFlags=0)
SmallVector< SDValue, 32 > OutVals
static bool isAbsolute(SDValue CmpOp, SDValue Pos, SDValue Neg)
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
bool isVector() const
Return true if this is a vector value type.
static MachineBasicBlock * emitBlockAfter(MachineBasicBlock *MBB)
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Bitwise operators - logical and, logical or, logical xor.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
unsigned getLocMemOffset() const
static void adjustForSubtraction(SelectionDAG &DAG, const SDLoc &DL, Comparison &C)
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
LLVM_NODISCARD bool empty() const
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
static bool is32Bit(EVT VT)
void computeKnownBits(SDValue Op, KnownBits &Known, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
int64_t getOffset() const
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
unsigned MaxStoresPerMemcpyOptSize
Maximum number of store operations that may be substituted for a call to memcpy, used for functions w...
void setStackPointerRegisterToSaveRestore(unsigned R)
If set to a physical register, this specifies the register that llvm.savestack/llvm.restorestack should save and restore.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
const unsigned VR32Regs[32]
static bool isSelectPseudo(MachineInstr &MI)
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
static MachineBasicBlock * splitBlockBefore(MachineBasicBlock::iterator MI, MachineBasicBlock *MBB)
unsigned getOpcode() const
FSINCOS - Compute both fsin and fcos as a single operation.
SDValue getValue(unsigned R) const
unsigned MaxStoresPerMemcpy
Specify maximum bytes of store instructions per memcpy call.
constexpr bool isUInt< 16 >(uint64_t x)
static MachinePointerInfo getConstantPool(MachineFunction &MF)
Return a MachinePointerInfo record that refers to the constant pool.
static unsigned reverseCCMask(unsigned CCMask)
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
static unsigned getTestUnderMaskCond(unsigned BitSize, unsigned CCMask, uint64_t Mask, uint64_t CmpVal, unsigned ICmpType)
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value *PtrVal, unsigned Alignment, AtomicOrdering Ordering, SyncScope::ID SSID)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands...
SDValue getGLOBAL_OFFSET_TABLE(EVT VT)
Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
MachineConstantPoolValue * getMachineCPVal() const
Synchronized with respect to all concurrently executing threads.
static SDValue emitCmp(SelectionDAG &DAG, const SDLoc &DL, Comparison &C)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
user_iterator user_begin()
void insert(iterator MBBI, MachineBasicBlock *MBB)
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
bool hasFPExtension() const
void setReturnAddressIsTaken(bool s)
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
static MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
LLVM Value Representation.
FMA - Perform a * b + c with no intermediate rounding step.
SDValue getRegister(unsigned Reg, EVT VT)
unsigned getResNo() const
get the index which selects a specific result in the SDNode
unsigned even128(bool Is32bit)
bool isFPImmLegal(const APFloat &Imm, EVT VT) const override
Returns true if the target can instruction select the specified FP immediate natively.
static void lowerGR128Binary(SelectionDAG &DAG, const SDLoc &DL, EVT VT, unsigned Opcode, SDValue Op0, SDValue Op1, SDValue &Even, SDValue &Odd)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
unsigned getStackPointerRegisterToSaveRestore() const
If a physical register, this specifies the register that llvm.savestack/llvm.restorestack should save...
SDValue getValueType(EVT)
KnownBits sext(unsigned BitWidth)
Sign extends the underlying known Zero and One bits.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
static void adjustSubwordCmp(SelectionDAG &DAG, const SDLoc &DL, Comparison &C)
PREFETCH - This corresponds to a prefetch intrinsic.
static bool isIntrinsicWithCC(SDValue Op, unsigned &Opcode, unsigned &CCValid)
static SDValue getCCResult(SelectionDAG &DAG, SDValue CCReg)
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone...
const unsigned CCMASK_ARITH_OVERFLOW
static bool isImmLL(uint64_t Val)
Primary interface to the complete machine description for the target machine.
A SystemZ-specific constant pool value.
bool isRxSBGMask(uint64_t Mask, unsigned BitSize, unsigned &Start, unsigned &End) const
unsigned getVarArgsFirstFPR() const
bool hasOneUse() const
Return true if there is exactly one user of this value.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
StringRef - Represent a constant reference to a string, i.e.
SetCC operator - This evaluates to a true value iff the condition is true.
unsigned MaxStoresPerMemset
Specify maximum number of store instructions per memset call.
unsigned MaxStoresPerMemsetOptSize
Maximum number of stores operations that may be substituted for the call to memset, used for functions with OptSize attribute.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
unsigned getNumOperands() const
const SDValue & getOperand(unsigned i) const
bool verifyReturnAddressArgumentIsConstant(SDValue Op, SelectionDAG &DAG) const
static void adjustForFNeg(Comparison &C)
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
static void computeKnownBitsBinOp(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth, unsigned OpNo)
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
unsigned getLocReg() const
const unsigned CCMASK_TM_ALL_0
uint64_t getZExtValue() const
SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand, SDValue Subreg)
A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
TRUNCATE - Completely drop the high bits.
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
const unsigned CCMASK_TEND
const MachineOperand & getOperand(unsigned i) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
static AddressingMode supportedAddressingMode(Instruction *I, bool HasVector)
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
bool hasPopulationCount() const
const unsigned VR128Regs[32]
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
bool isFMAFasterThanFMulAndFAdd(EVT VT) const override
Return true if an FMA operation is faster than a pair of fmul and fadd instructions.
static unsigned getVectorComparisonOrInvert(ISD::CondCode CC, bool IsFP, bool &Invert)
const SystemZRegisterInfo * getRegisterInfo() const override
LLVMContext * getContext() const
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
const unsigned CCMASK_TM_SOME_1
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
Carry-using nodes for multiple precision addition and subtraction.
A wrapper class for inspecting calls to intrinsic functions.
mmo_iterator memoperands_end() const
const BasicBlock * getParent() const
static SystemZConstantPoolValue * Create(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier)
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned char TargetFlags=0)
const unsigned CCMASK_CMP_UO
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
MachineBasicBlock * emitPatchPoint(MachineInstr &MI, MachineBasicBlock *MBB) const
Replace/modify any TargetFrameIndex operands with a targte-dependent sequence of memory operands that...
This class is used to represent ISD::LOAD nodes.
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...
static bool isImmHL(uint64_t Val)