39 #define DEBUG_TYPE "arm-isel"
43 cl::desc(
"Disable isel of shifter-op"),
73 StringRef getPassName()
const override {
return "ARM Instruction Selection"; }
75 void PreprocessISelDAG()
override;
79 inline SDValue getI32Imm(
unsigned Imm,
const SDLoc &dl) {
80 return CurDAG->getTargetConstant(Imm, dl,
MVT::i32);
85 bool hasNoVMLxHazardUse(
SDNode *
N)
const;
86 bool isShifterOpProfitable(
const SDValue &Shift,
90 bool CheckProfitability =
true);
92 SDValue &
B,
bool CheckProfitability =
true);
96 return SelectRegShifterOperand(N, A, B, C,
false);
101 return SelectImmShifterOperand(N, A, B,
false);
111 return SelectAddrMode2Worker(N, Base, Offset, Opc) == AM2_BASE;
116 return SelectAddrMode2Worker(N, Base, Offset, Opc) == AM2_SHOP;
121 SelectAddrMode2Worker(N, Base, Offset, Opc);
130 Reg = CurDAG->getRegister(ARM::CPSR,
MVT::i32);
174 inline bool is_so_imm(
unsigned Imm)
const {
178 inline bool is_so_imm_not(
unsigned Imm)
const {
182 inline bool is_t2_so_imm(
unsigned Imm)
const {
186 inline bool is_t2_so_imm_not(
unsigned Imm)
const {
191 #include "ARMGenDAGISel.inc"
197 bool tryARMIndexedLoad(
SDNode *N);
198 bool tryT1IndexedLoad(
SDNode *N);
199 bool tryT2IndexedLoad(
SDNode *N);
205 void SelectVLD(
SDNode *N,
bool isUpdating,
unsigned NumVecs,
206 const uint16_t *DOpcodes,
const uint16_t *QOpcodes0,
207 const uint16_t *QOpcodes1);
213 void SelectVST(
SDNode *N,
bool isUpdating,
unsigned NumVecs,
214 const uint16_t *DOpcodes,
const uint16_t *QOpcodes0,
215 const uint16_t *QOpcodes1);
220 void SelectVLDSTLane(
SDNode *N,
bool IsLoad,
bool isUpdating,
221 unsigned NumVecs,
const uint16_t *DOpcodes,
222 const uint16_t *QOpcodes);
227 void SelectVLDDup(
SDNode *N,
bool isUpdating,
unsigned NumVecs,
228 const uint16_t *DOpcodes,
229 const uint16_t *QOpcodes =
nullptr);
232 bool tryV6T2BitfieldExtractOp(
SDNode *N,
bool isSigned);
237 bool tryReadRegister(
SDNode *N);
238 bool tryWriteRegister(
SDNode *N);
240 bool tryInlineAsm(
SDNode *N);
242 void SelectCMPZ(
SDNode *N,
bool &SwitchEQNEToPLMI);
244 void SelectCMP_SWAP(
SDNode *N);
248 bool SelectInlineAsmMemoryOperand(
const SDValue &
Op,
unsigned ConstraintID,
249 std::vector<SDValue> &OutOps)
override;
268 unsigned ConstantMaterializationCost(
unsigned Val)
const;
275 bool canExtractShiftFromMul(
const SDValue &N,
unsigned MaxShift,
276 unsigned &PowerOfTwo,
SDValue &NewMulConst)
const;
288 Imm = cast<ConstantSDNode>(
N)->getZExtValue();
313 int RangeMin,
int RangeMax,
314 int &ScaledConstant) {
315 assert(Scale > 0 &&
"Invalid scale!");
323 if ((ScaledConstant % Scale) != 0)
326 ScaledConstant /= Scale;
327 return ScaledConstant >= RangeMin && ScaledConstant < RangeMax;
330 void ARMDAGToDAGISel::PreprocessISelDAG() {
331 if (!Subtarget->hasV6T2Ops())
334 bool isThumb2 = Subtarget->isThumb();
336 E = CurDAG->allnodes_end();
I !=
E; ) {
353 unsigned And_imm = 0;
363 if (TZ != 1 && TZ != 2)
375 if (And_imm & (And_imm + 1))
380 unsigned Srl_imm = 0;
391 if (SelectImmShifterOperand(N0, CPTmp0, CPTmp1))
394 if (SelectImmShifterOperand(N0, CPTmp0, CPTmp1) ||
395 SelectRegShifterOperand(N0, CPTmp0, CPTmp1, CPTmp2))
402 CurDAG->getConstant(Srl_imm + TZ,
SDLoc(Srl),
409 CurDAG->UpdateNodeOperands(N, N0, N1);
416 bool ARMDAGToDAGISel::hasNoVMLxHazardUse(
SDNode *N)
const {
420 if (!Subtarget->hasVMLxHazards())
431 CurDAG->getSubtarget().getInstrInfo());
458 bool ARMDAGToDAGISel::isShifterOpProfitable(
const SDValue &Shift,
461 if (!Subtarget->isLikeA9() && !Subtarget->isSwift())
467 (ShAmt == 2 || (Subtarget->isSwift() && ShAmt == 1));
470 unsigned ARMDAGToDAGISel::ConstantMaterializationCost(
unsigned Val)
const {
471 if (Subtarget->isThumb()) {
472 if (Val <= 255)
return 1;
473 if (Subtarget->hasV6T2Ops() &&
476 if (Val <= 510)
return 2;
477 if (~Val <= 255)
return 2;
482 if (Subtarget->hasV6T2Ops() && Val <= 0xffff)
return 1;
485 if (Subtarget->useMovt(*MF))
return 2;
489 bool ARMDAGToDAGISel::canExtractShiftFromMul(
const SDValue &N,
491 unsigned &PowerOfTwo,
501 if (!MulConst)
return false;
504 if (!MulConst->
hasOneUse())
return false;
506 if (MulConstVal == 0)
return false;
509 PowerOfTwo = MaxShift;
510 while ((MulConstVal % (1 << PowerOfTwo)) != 0) {
512 if (PowerOfTwo == 0)
return false;
516 unsigned NewMulConstVal = MulConstVal / (1 << PowerOfTwo);
517 NewMulConst = CurDAG->getConstant(NewMulConstVal,
SDLoc(N),
MVT::i32);
518 unsigned OldCost = ConstantMaterializationCost(MulConstVal);
519 unsigned NewCost = ConstantMaterializationCost(NewMulConstVal);
520 return NewCost < OldCost;
523 void ARMDAGToDAGISel::replaceDAGValue(
const SDValue &N,
SDValue M) {
525 CurDAG->ReplaceAllUsesWith(N, M);
528 bool ARMDAGToDAGISel::SelectImmShifterOperand(
SDValue N,
531 bool CheckProfitability) {
538 unsigned PowerOfTwo = 0;
540 if (canExtractShiftFromMul(N, 31, PowerOfTwo, NewMulConst)) {
543 replaceDAGValue(N.
getOperand(1), NewMulConst);
545 Opc = CurDAG->getTargetConstant(
558 unsigned ShImmVal = 0;
560 if (!RHS)
return false;
567 bool ARMDAGToDAGISel::SelectRegShifterOperand(
SDValue N,
571 bool CheckProfitability) {
582 unsigned ShImmVal = 0;
584 if (RHS)
return false;
587 if (CheckProfitability && !isShifterOpProfitable(N, ShOpcVal, ShImmVal))
595 bool ARMDAGToDAGISel::SelectAddrModeImm12(
SDValue N,
602 !CurDAG->isBaseWithConstantOffset(N)) {
605 int FI = cast<FrameIndexSDNode>(
N)->getIndex();
606 Base = CurDAG->getTargetFrameIndex(
607 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
628 if (RHSC > -0x1000 && RHSC < 0x1000) {
631 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
632 Base = CurDAG->getTargetFrameIndex(
633 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
635 OffImm = CurDAG->getTargetConstant(RHSC,
SDLoc(N),
MVT::i32);
651 ((!Subtarget->isLikeA9() && !Subtarget->isSwift()) || N.
hasOneUse())) {
663 unsigned ShAmt =
Log2_32(RHSC);
676 !CurDAG->isBaseWithConstantOffset(N))
683 -0x1000+1, 0x1000, RHSC))
701 ShAmt = Sh->getZExtValue();
702 if (isShifterOpProfitable(Offset, ShOpcVal, ShAmt))
715 !(Subtarget->isLikeA9() || Subtarget->isSwift() ||
723 ShAmt = Sh->getZExtValue();
724 if (isShifterOpProfitable(N.
getOperand(0), ShOpcVal, ShAmt)) {
740 unsigned PowerOfTwo = 0;
742 if (canExtractShiftFromMul(Offset, 31, PowerOfTwo, NewMulConst)) {
744 replaceDAGValue(Offset.
getOperand(1), NewMulConst);
764 (!(Subtarget->isLikeA9() || Subtarget->isSwift()) || N.
hasOneUse())) {
776 unsigned ShAmt =
Log2_32(RHSC);
789 !CurDAG->isBaseWithConstantOffset(N)) {
792 int FI = cast<FrameIndexSDNode>(
N)->getIndex();
793 Base = CurDAG->getTargetFrameIndex(
794 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
801 Offset = CurDAG->getRegister(0,
MVT::i32);
812 -0x1000+1, 0x1000, RHSC)) {
815 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
816 Base = CurDAG->getTargetFrameIndex(
817 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
819 Offset = CurDAG->getRegister(0,
MVT::i32);
833 if ((Subtarget->isLikeA9() || Subtarget->isSwift()) && !N.
hasOneUse()) {
836 Offset = CurDAG->getRegister(0,
MVT::i32);
857 ShAmt = Sh->getZExtValue();
858 if (isShifterOpProfitable(Offset, ShOpcVal, ShAmt))
871 !(Subtarget->isLikeA9() || Subtarget->isSwift() ||
879 ShAmt = Sh->getZExtValue();
880 if (isShifterOpProfitable(N.
getOperand(0), ShOpcVal, ShAmt)) {
902 ? cast<LoadSDNode>(Op)->getAddressingMode()
903 : cast<StoreSDNode>(
Op)->getAddressingMode();
917 ShAmt = Sh->getZExtValue();
918 if (isShifterOpProfitable(N, ShOpcVal, ShAmt))
934 bool ARMDAGToDAGISel::SelectAddrMode2OffsetImmPre(
SDNode *Op,
SDValue N,
938 ? cast<LoadSDNode>(Op)->getAddressingMode()
939 : cast<StoreSDNode>(
Op)->getAddressingMode();
945 Offset = CurDAG->getRegister(0,
MVT::i32);
954 bool ARMDAGToDAGISel::SelectAddrMode2OffsetImm(
SDNode *Op,
SDValue N,
958 ? cast<LoadSDNode>(Op)->getAddressingMode()
959 : cast<StoreSDNode>(
Op)->getAddressingMode();
964 Offset = CurDAG->getRegister(0,
MVT::i32);
974 bool ARMDAGToDAGISel::SelectAddrOffsetNone(
SDValue N,
SDValue &Base) {
979 bool ARMDAGToDAGISel::SelectAddrMode3(
SDValue N,
991 if (!CurDAG->isBaseWithConstantOffset(N)) {
994 int FI = cast<FrameIndexSDNode>(
N)->getIndex();
995 Base = CurDAG->getTargetFrameIndex(
996 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
998 Offset = CurDAG->getRegister(0,
MVT::i32);
1007 -256 + 1, 256, RHSC)) {
1010 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
1011 Base = CurDAG->getTargetFrameIndex(
1012 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
1014 Offset = CurDAG->getRegister(0,
MVT::i32);
1033 bool ARMDAGToDAGISel::SelectAddrMode3Offset(
SDNode *Op,
SDValue N,
1037 ? cast<LoadSDNode>(Op)->getAddressingMode()
1038 : cast<StoreSDNode>(
Op)->getAddressingMode();
1043 Offset = CurDAG->getRegister(0,
MVT::i32);
1055 bool ARMDAGToDAGISel::SelectAddrMode5(
SDValue N,
1057 if (!CurDAG->isBaseWithConstantOffset(N)) {
1060 int FI = cast<FrameIndexSDNode>(
N)->getIndex();
1061 Base = CurDAG->getTargetFrameIndex(
1062 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
1077 -256 + 1, 256, RHSC)) {
1080 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
1081 Base = CurDAG->getTargetFrameIndex(
1082 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
1105 unsigned Alignment = 0;
1107 MemSDNode *MemN = cast<MemSDNode>(Parent);
1109 if (isa<LSBaseSDNode>(MemN) ||
1117 if (MMOAlign >= MemSize && MemSize > 1)
1118 Alignment = MemSize;
1126 Align = CurDAG->getTargetConstant(Alignment,
SDLoc(N),
MVT::i32);
1130 bool ARMDAGToDAGISel::SelectAddrMode6Offset(
SDNode *Op,
SDValue N,
1139 Offset = CurDAG->getRegister(0,
MVT::i32);
1144 bool ARMDAGToDAGISel::SelectAddrModePC(
SDValue N,
1149 Label = CurDAG->getTargetConstant(cast<ConstantSDNode>(N1)->getZExtValue(),
1162 bool ARMDAGToDAGISel::SelectThumbAddrModeRR(
SDValue N,
1179 ARMDAGToDAGISel::SelectThumbAddrModeImm5S(
SDValue N,
unsigned Scale,
1181 if (!CurDAG->isBaseWithConstantOffset(N)) {
1202 OffImm = CurDAG->getTargetConstant(RHSC,
SDLoc(N),
MVT::i32);
1211 ARMDAGToDAGISel::SelectThumbAddrModeImm5S4(
SDValue N,
SDValue &Base,
1213 return SelectThumbAddrModeImm5S(N, 4, Base, OffImm);
1217 ARMDAGToDAGISel::SelectThumbAddrModeImm5S2(
SDValue N,
SDValue &Base,
1219 return SelectThumbAddrModeImm5S(N, 2, Base, OffImm);
1223 ARMDAGToDAGISel::SelectThumbAddrModeImm5S1(
SDValue N,
SDValue &Base,
1225 return SelectThumbAddrModeImm5S(N, 1, Base, OffImm);
1228 bool ARMDAGToDAGISel::SelectThumbAddrModeSP(
SDValue N,
1231 int FI = cast<FrameIndexSDNode>(
N)->getIndex();
1237 Base = CurDAG->getTargetFrameIndex(
1238 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
1243 if (!CurDAG->isBaseWithConstantOffset(N))
1248 (LHSR && LHSR->
getReg() == ARM::SP)) {
1254 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
1260 Base = CurDAG->getTargetFrameIndex(
1261 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
1263 OffImm = CurDAG->getTargetConstant(RHSC,
SDLoc(N),
MVT::i32);
1277 bool ARMDAGToDAGISel::SelectT2AddrModeImm12(
SDValue N,
1283 !CurDAG->isBaseWithConstantOffset(N)) {
1286 int FI = cast<FrameIndexSDNode>(
N)->getIndex();
1287 Base = CurDAG->getTargetFrameIndex(
1288 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
1307 if (SelectT2AddrModeImm8(N, Base, OffImm))
1315 if (RHSC >= 0 && RHSC < 0x1000) {
1318 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
1319 Base = CurDAG->getTargetFrameIndex(
1320 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
1322 OffImm = CurDAG->getTargetConstant(RHSC,
SDLoc(N),
MVT::i32);
1333 bool ARMDAGToDAGISel::SelectT2AddrModeImm8(
SDValue N,
1337 !CurDAG->isBaseWithConstantOffset(N))
1345 if ((RHSC >= -255) && (RHSC < 0)) {
1348 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
1349 Base = CurDAG->getTargetFrameIndex(
1350 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
1352 OffImm = CurDAG->getTargetConstant(RHSC,
SDLoc(N),
MVT::i32);
1360 bool ARMDAGToDAGISel::SelectT2AddrModeImm8Offset(
SDNode *Op,
SDValue N,
1364 ? cast<LoadSDNode>(Op)->getAddressingMode()
1365 : cast<StoreSDNode>(
Op)->getAddressingMode();
1377 bool ARMDAGToDAGISel::SelectT2AddrModeSoReg(
SDValue N,
1387 if (RHSC >= 0 && RHSC < 0x1000)
1389 else if (RHSC < 0 && RHSC >= -255)
1410 ShAmt = Sh->getZExtValue();
1411 if (ShAmt < 4 && isShifterOpProfitable(OffReg, ShOpcVal, ShAmt))
1422 unsigned PowerOfTwo = 0;
1424 if (canExtractShiftFromMul(OffReg, 3, PowerOfTwo, NewMulConst)) {
1426 replaceDAGValue(OffReg.
getOperand(1), NewMulConst);
1432 ShImm = CurDAG->getTargetConstant(ShAmt,
SDLoc(N),
MVT::i32);
1437 bool ARMDAGToDAGISel::SelectT2AddrModeExclusive(
SDValue N,
SDValue &Base,
1452 if (RHSC > 1020 || RHSC % 4 != 0)
1457 int FI = cast<FrameIndexSDNode>(Base)->getIndex();
1458 Base = CurDAG->getTargetFrameIndex(
1459 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
1462 OffImm = CurDAG->getTargetConstant(RHSC/4,
SDLoc(N),
MVT::i32);
1473 void ARMDAGToDAGISel::transferMemOperands(
SDNode *N,
SDNode *Result) {
1475 MemOp[0] = cast<MemSDNode>(
N)->getMemOperand();
1476 cast<MachineSDNode>(Result)->setMemRefs(MemOp, MemOp + 1);
1479 bool ARMDAGToDAGISel::tryARMIndexedLoad(
SDNode *N) {
1488 unsigned Opcode = 0;
1490 if (LoadedVT ==
MVT::i32 && isPre &&
1492 Opcode = ARM::LDR_PRE_IMM;
1494 }
else if (LoadedVT ==
MVT::i32 && !isPre &&
1496 Opcode = ARM::LDR_POST_IMM;
1500 Opcode = isPre ? ARM::LDR_PRE_REG : ARM::LDR_POST_REG;
1507 ? (isPre ? ARM::LDRSH_PRE : ARM::LDRSH_POST)
1508 : (isPre ? ARM::LDRH_PRE : ARM::LDRH_POST);
1513 Opcode = isPre ? ARM::LDRSB_PRE : ARM::LDRSB_POST;
1519 Opcode = ARM::LDRB_PRE_IMM;
1520 }
else if (!isPre &&
1523 Opcode = ARM::LDRB_POST_IMM;
1524 }
else if (SelectAddrMode2OffsetReg(N, LD->
getOffset(),
Offset, AMOpc)) {
1526 Opcode = isPre ? ARM::LDRB_PRE_REG : ARM::LDRB_POST_REG;
1532 if (Opcode == ARM::LDR_PRE_IMM || Opcode == ARM::LDRB_PRE_IMM) {
1536 CurDAG->getRegister(0,
MVT::i32), Chain };
1539 transferMemOperands(N, New);
1540 ReplaceNode(N, New);
1546 CurDAG->getRegister(0,
MVT::i32), Chain };
1549 transferMemOperands(N, New);
1550 ReplaceNode(N, New);
1558 bool ARMDAGToDAGISel::tryT1IndexedLoad(
SDNode *N) {
1563 LoadedVT.getSimpleVT().SimpleTy !=
MVT::i32)
1567 if (!COffs || COffs->getZExtValue() != 4)
1577 CurDAG->getRegister(0,
MVT::i32), Chain };
1580 transferMemOperands(N, New);
1581 ReplaceNode(N, New);
1585 bool ARMDAGToDAGISel::tryT2IndexedLoad(
SDNode *N) {
1595 unsigned Opcode = 0;
1600 Opcode = isPre ? ARM::t2LDR_PRE : ARM::t2LDR_POST;
1604 Opcode = isPre ? ARM::t2LDRSH_PRE : ARM::t2LDRSH_POST;
1606 Opcode = isPre ? ARM::t2LDRH_PRE : ARM::t2LDRH_POST;
1611 Opcode = isPre ? ARM::t2LDRSB_PRE : ARM::t2LDRSB_POST;
1613 Opcode = isPre ? ARM::t2LDRB_PRE : ARM::t2LDRB_POST;
1625 CurDAG->getRegister(0,
MVT::i32), Chain };
1628 transferMemOperands(N, New);
1629 ReplaceNode(N, New);
1640 CurDAG->getTargetConstant(ARM::GPRPairRegClassID, dl,
MVT::i32);
1641 SDValue SubReg0 = CurDAG->getTargetConstant(ARM::gsub_0, dl,
MVT::i32);
1642 SDValue SubReg1 = CurDAG->getTargetConstant(ARM::gsub_1, dl,
MVT::i32);
1643 const SDValue Ops[] = { RegClass, V0, SubReg0, V1, SubReg1 };
1644 return CurDAG->getMachineNode(TargetOpcode::REG_SEQUENCE, dl, VT, Ops);
1651 CurDAG->getTargetConstant(ARM::DPR_VFP2RegClassID, dl,
MVT::i32);
1652 SDValue SubReg0 = CurDAG->getTargetConstant(ARM::ssub_0, dl,
MVT::i32);
1653 SDValue SubReg1 = CurDAG->getTargetConstant(ARM::ssub_1, dl,
MVT::i32);
1654 const SDValue Ops[] = { RegClass, V0, SubReg0, V1, SubReg1 };
1655 return CurDAG->getMachineNode(TargetOpcode::REG_SEQUENCE, dl, VT, Ops);
1661 SDValue RegClass = CurDAG->getTargetConstant(ARM::QPRRegClassID, dl,
1663 SDValue SubReg0 = CurDAG->getTargetConstant(ARM::dsub_0, dl,
MVT::i32);
1664 SDValue SubReg1 = CurDAG->getTargetConstant(ARM::dsub_1, dl,
MVT::i32);
1665 const SDValue Ops[] = { RegClass, V0, SubReg0, V1, SubReg1 };
1666 return CurDAG->getMachineNode(TargetOpcode::REG_SEQUENCE, dl, VT, Ops);
1672 SDValue RegClass = CurDAG->getTargetConstant(ARM::QQPRRegClassID, dl,
1674 SDValue SubReg0 = CurDAG->getTargetConstant(ARM::qsub_0, dl,
MVT::i32);
1675 SDValue SubReg1 = CurDAG->getTargetConstant(ARM::qsub_1, dl,
MVT::i32);
1676 const SDValue Ops[] = { RegClass, V0, SubReg0, V1, SubReg1 };
1677 return CurDAG->getMachineNode(TargetOpcode::REG_SEQUENCE, dl, VT, Ops);
1685 CurDAG->getTargetConstant(ARM::QPR_VFP2RegClassID, dl,
MVT::i32);
1686 SDValue SubReg0 = CurDAG->getTargetConstant(ARM::ssub_0, dl,
MVT::i32);
1687 SDValue SubReg1 = CurDAG->getTargetConstant(ARM::ssub_1, dl,
MVT::i32);
1688 SDValue SubReg2 = CurDAG->getTargetConstant(ARM::ssub_2, dl,
MVT::i32);
1689 SDValue SubReg3 = CurDAG->getTargetConstant(ARM::ssub_3, dl,
MVT::i32);
1690 const SDValue Ops[] = { RegClass, V0, SubReg0, V1, SubReg1,
1691 V2, SubReg2, V3, SubReg3 };
1692 return CurDAG->getMachineNode(TargetOpcode::REG_SEQUENCE, dl, VT, Ops);
1699 SDValue RegClass = CurDAG->getTargetConstant(ARM::QQPRRegClassID, dl,
1701 SDValue SubReg0 = CurDAG->getTargetConstant(ARM::dsub_0, dl,
MVT::i32);
1702 SDValue SubReg1 = CurDAG->getTargetConstant(ARM::dsub_1, dl,
MVT::i32);
1703 SDValue SubReg2 = CurDAG->getTargetConstant(ARM::dsub_2, dl,
MVT::i32);
1704 SDValue SubReg3 = CurDAG->getTargetConstant(ARM::dsub_3, dl,
MVT::i32);
1705 const SDValue Ops[] = { RegClass, V0, SubReg0, V1, SubReg1,
1706 V2, SubReg2, V3, SubReg3 };
1707 return CurDAG->getMachineNode(TargetOpcode::REG_SEQUENCE, dl, VT, Ops);
1714 SDValue RegClass = CurDAG->getTargetConstant(ARM::QQQQPRRegClassID, dl,
1716 SDValue SubReg0 = CurDAG->getTargetConstant(ARM::qsub_0, dl,
MVT::i32);
1717 SDValue SubReg1 = CurDAG->getTargetConstant(ARM::qsub_1, dl,
MVT::i32);
1718 SDValue SubReg2 = CurDAG->getTargetConstant(ARM::qsub_2, dl,
MVT::i32);
1719 SDValue SubReg3 = CurDAG->getTargetConstant(ARM::qsub_3, dl,
MVT::i32);
1720 const SDValue Ops[] = { RegClass, V0, SubReg0, V1, SubReg1,
1721 V2, SubReg2, V3, SubReg3 };
1722 return CurDAG->getMachineNode(TargetOpcode::REG_SEQUENCE, dl, VT, Ops);
1729 unsigned NumVecs,
bool is64BitVector) {
1730 unsigned NumRegs = NumVecs;
1731 if (!is64BitVector && NumVecs < 3)
1734 unsigned Alignment = cast<ConstantSDNode>(
Align)->getZExtValue();
1735 if (Alignment >= 32 && NumRegs == 4)
1737 else if (Alignment >= 16 && (NumRegs == 2 || NumRegs == 4))
1739 else if (Alignment >= 8)
1744 return CurDAG->getTargetConstant(Alignment, dl,
MVT::i32);
1750 default:
return false;
1751 case ARM::VLD1d8wb_fixed :
return true;
1752 case ARM::VLD1d16wb_fixed :
return true;
1753 case ARM::VLD1d64Qwb_fixed :
return true;
1754 case ARM::VLD1d32wb_fixed :
return true;
1755 case ARM::VLD1d64wb_fixed :
return true;
1756 case ARM::VLD1d64TPseudoWB_fixed :
return true;
1757 case ARM::VLD1d64QPseudoWB_fixed :
return true;
1758 case ARM::VLD1q8wb_fixed :
return true;
1759 case ARM::VLD1q16wb_fixed :
return true;
1760 case ARM::VLD1q32wb_fixed :
return true;
1761 case ARM::VLD1q64wb_fixed :
return true;
1762 case ARM::VLD1DUPd8wb_fixed :
return true;
1763 case ARM::VLD1DUPd16wb_fixed :
return true;
1764 case ARM::VLD1DUPd32wb_fixed :
return true;
1765 case ARM::VLD1DUPq8wb_fixed :
return true;
1766 case ARM::VLD1DUPq16wb_fixed :
return true;
1767 case ARM::VLD1DUPq32wb_fixed :
return true;
1768 case ARM::VLD2d8wb_fixed :
return true;
1769 case ARM::VLD2d16wb_fixed :
return true;
1770 case ARM::VLD2d32wb_fixed :
return true;
1771 case ARM::VLD2q8PseudoWB_fixed :
return true;
1772 case ARM::VLD2q16PseudoWB_fixed :
return true;
1773 case ARM::VLD2q32PseudoWB_fixed :
return true;
1774 case ARM::VLD2DUPd8wb_fixed :
return true;
1775 case ARM::VLD2DUPd16wb_fixed :
return true;
1776 case ARM::VLD2DUPd32wb_fixed :
return true;
1783 default:
return false;
1784 case ARM::VST1d8wb_fixed :
return true;
1785 case ARM::VST1d16wb_fixed :
return true;
1786 case ARM::VST1d32wb_fixed :
return true;
1787 case ARM::VST1d64wb_fixed :
return true;
1788 case ARM::VST1q8wb_fixed :
return true;
1789 case ARM::VST1q16wb_fixed :
return true;
1790 case ARM::VST1q32wb_fixed :
return true;
1791 case ARM::VST1q64wb_fixed :
return true;
1792 case ARM::VST1d64TPseudoWB_fixed :
return true;
1793 case ARM::VST1d64QPseudoWB_fixed :
return true;
1794 case ARM::VST2d8wb_fixed :
return true;
1795 case ARM::VST2d16wb_fixed :
return true;
1796 case ARM::VST2d32wb_fixed :
return true;
1797 case ARM::VST2q8PseudoWB_fixed :
return true;
1798 case ARM::VST2q16PseudoWB_fixed :
return true;
1799 case ARM::VST2q32PseudoWB_fixed :
return true;
1807 &&
"Incorrect fixed stride updating instruction.");
1810 case ARM::VLD1d8wb_fixed:
return ARM::VLD1d8wb_register;
1811 case ARM::VLD1d16wb_fixed:
return ARM::VLD1d16wb_register;
1812 case ARM::VLD1d32wb_fixed:
return ARM::VLD1d32wb_register;
1813 case ARM::VLD1d64wb_fixed:
return ARM::VLD1d64wb_register;
1814 case ARM::VLD1q8wb_fixed:
return ARM::VLD1q8wb_register;
1815 case ARM::VLD1q16wb_fixed:
return ARM::VLD1q16wb_register;
1816 case ARM::VLD1q32wb_fixed:
return ARM::VLD1q32wb_register;
1817 case ARM::VLD1q64wb_fixed:
return ARM::VLD1q64wb_register;
1818 case ARM::VLD1d64Twb_fixed:
return ARM::VLD1d64Twb_register;
1819 case ARM::VLD1d64Qwb_fixed:
return ARM::VLD1d64Qwb_register;
1820 case ARM::VLD1d64TPseudoWB_fixed:
return ARM::VLD1d64TPseudoWB_register;
1821 case ARM::VLD1d64QPseudoWB_fixed:
return ARM::VLD1d64QPseudoWB_register;
1822 case ARM::VLD1DUPd8wb_fixed :
return ARM::VLD1DUPd8wb_register;
1823 case ARM::VLD1DUPd16wb_fixed :
return ARM::VLD1DUPd16wb_register;
1824 case ARM::VLD1DUPd32wb_fixed :
return ARM::VLD1DUPd32wb_register;
1825 case ARM::VLD1DUPq8wb_fixed :
return ARM::VLD1DUPq8wb_register;
1826 case ARM::VLD1DUPq16wb_fixed :
return ARM::VLD1DUPq16wb_register;
1827 case ARM::VLD1DUPq32wb_fixed :
return ARM::VLD1DUPq32wb_register;
1829 case ARM::VST1d8wb_fixed:
return ARM::VST1d8wb_register;
1830 case ARM::VST1d16wb_fixed:
return ARM::VST1d16wb_register;
1831 case ARM::VST1d32wb_fixed:
return ARM::VST1d32wb_register;
1832 case ARM::VST1d64wb_fixed:
return ARM::VST1d64wb_register;
1833 case ARM::VST1q8wb_fixed:
return ARM::VST1q8wb_register;
1834 case ARM::VST1q16wb_fixed:
return ARM::VST1q16wb_register;
1835 case ARM::VST1q32wb_fixed:
return ARM::VST1q32wb_register;
1836 case ARM::VST1q64wb_fixed:
return ARM::VST1q64wb_register;
1837 case ARM::VST1d64TPseudoWB_fixed:
return ARM::VST1d64TPseudoWB_register;
1838 case ARM::VST1d64QPseudoWB_fixed:
return ARM::VST1d64QPseudoWB_register;
1840 case ARM::VLD2d8wb_fixed:
return ARM::VLD2d8wb_register;
1841 case ARM::VLD2d16wb_fixed:
return ARM::VLD2d16wb_register;
1842 case ARM::VLD2d32wb_fixed:
return ARM::VLD2d32wb_register;
1843 case ARM::VLD2q8PseudoWB_fixed:
return ARM::VLD2q8PseudoWB_register;
1844 case ARM::VLD2q16PseudoWB_fixed:
return ARM::VLD2q16PseudoWB_register;
1845 case ARM::VLD2q32PseudoWB_fixed:
return ARM::VLD2q32PseudoWB_register;
1847 case ARM::VST2d8wb_fixed:
return ARM::VST2d8wb_register;
1848 case ARM::VST2d16wb_fixed:
return ARM::VST2d16wb_register;
1849 case ARM::VST2d32wb_fixed:
return ARM::VST2d32wb_register;
1850 case ARM::VST2q8PseudoWB_fixed:
return ARM::VST2q8PseudoWB_register;
1851 case ARM::VST2q16PseudoWB_fixed:
return ARM::VST2q16PseudoWB_register;
1852 case ARM::VST2q32PseudoWB_fixed:
return ARM::VST2q32PseudoWB_register;
1854 case ARM::VLD2DUPd8wb_fixed:
return ARM::VLD2DUPd8wb_register;
1855 case ARM::VLD2DUPd16wb_fixed:
return ARM::VLD2DUPd16wb_register;
1856 case ARM::VLD2DUPd32wb_fixed:
return ARM::VLD2DUPd32wb_register;
1869 void ARMDAGToDAGISel::SelectVLD(
SDNode *N,
bool isUpdating,
unsigned NumVecs,
1870 const uint16_t *DOpcodes,
1871 const uint16_t *QOpcodes0,
1872 const uint16_t *QOpcodes1) {
1873 assert(NumVecs >= 1 && NumVecs <= 4 &&
"VLD NumVecs out-of-range");
1877 unsigned AddrOpIdx = isUpdating ? 1 : 2;
1884 Align = GetVLDSTAlign(Align, dl, NumVecs, is64BitVector);
1902 assert(NumVecs == 1 &&
"v2i64 type only supported for VLD1");
1910 unsigned ResTyElts = (NumVecs == 3) ? 4 : NumVecs;
1915 std::vector<EVT> ResTys;
1916 ResTys.push_back(ResTy);
1927 if (is64BitVector || NumVecs <= 2) {
1928 unsigned Opc = (is64BitVector ? DOpcodes[
OpcodeIndex] :
1937 if ((NumVecs <= 2) && !IsImmUpdate)
1941 if ((NumVecs > 2 && !
isVLDfixed(Opc)) || !IsImmUpdate)
1942 Ops.
push_back(IsImmUpdate ? Reg0 : Inc);
1947 VLd = CurDAG->getMachineNode(Opc, dl, ResTys, Ops);
1957 SDValue(CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, dl, ResTy), 0);
1958 const SDValue OpsA[] = { MemAddr,
Align, Reg0, ImplDef, Pred, Reg0, Chain };
1959 SDNode *VLdA = CurDAG->getMachineNode(QOpcodes0[OpcodeIndex], dl,
1969 "only constant post-increment update allowed for VLD3/4");
1977 VLd = CurDAG->getMachineNode(QOpcodes1[OpcodeIndex], dl, ResTys, Ops);
1982 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
1983 cast<MachineSDNode>(VLd)->setMemRefs(MemOp, MemOp + 1);
1986 ReplaceNode(N, VLd);
1992 static_assert(ARM::dsub_7 == ARM::dsub_0 + 7 &&
1993 ARM::qsub_3 == ARM::qsub_0 + 3,
1994 "Unexpected subreg numbering");
1995 unsigned Sub0 = (is64BitVector ? ARM::dsub_0 : ARM::qsub_0);
1996 for (
unsigned Vec = 0; Vec < NumVecs; ++Vec)
1998 CurDAG->getTargetExtractSubreg(Sub0 + Vec, dl, VT, SuperReg));
2002 CurDAG->RemoveDeadNode(N);
2005 void ARMDAGToDAGISel::SelectVST(
SDNode *N,
bool isUpdating,
unsigned NumVecs,
2006 const uint16_t *DOpcodes,
2007 const uint16_t *QOpcodes0,
2008 const uint16_t *QOpcodes1) {
2009 assert(NumVecs >= 1 && NumVecs <= 4 &&
"VST NumVecs out-of-range");
2013 unsigned AddrOpIdx = isUpdating ? 1 : 2;
2014 unsigned Vec0Idx = 3;
2019 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
2024 Align = GetVLDSTAlign(Align, dl, NumVecs, is64BitVector);
2042 assert(NumVecs == 1 &&
"v2i64 type only supported for VST1");
2046 std::vector<EVT> ResTys;
2056 if (is64BitVector || NumVecs <= 2) {
2060 }
else if (is64BitVector) {
2071 ?
SDValue(CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF,dl,VT), 0)
2082 unsigned Opc = (is64BitVector ? DOpcodes[
OpcodeIndex] :
2091 if (NumVecs <= 2 && !IsImmUpdate)
2104 SDNode *VSt = CurDAG->getMachineNode(Opc, dl, ResTys, Ops);
2107 cast<MachineSDNode>(VSt)->setMemRefs(MemOp, MemOp + 1);
2109 ReplaceNode(N, VSt);
2121 ?
SDValue(CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, dl, VT), 0)
2127 const SDValue OpsA[] = { MemAddr,
Align, Reg0, RegSeq, Pred, Reg0, Chain };
2128 SDNode *VStA = CurDAG->getMachineNode(QOpcodes0[OpcodeIndex], dl,
2131 cast<MachineSDNode>(VStA)->setMemRefs(MemOp, MemOp + 1);
2140 "only constant post-increment update allowed for VST3/4");
2148 SDNode *VStB = CurDAG->getMachineNode(QOpcodes1[OpcodeIndex], dl, ResTys,
2150 cast<MachineSDNode>(VStB)->setMemRefs(MemOp, MemOp + 1);
2151 ReplaceNode(N, VStB);
2154 void ARMDAGToDAGISel::SelectVLDSTLane(
SDNode *N,
bool IsLoad,
bool isUpdating,
2156 const uint16_t *DOpcodes,
2157 const uint16_t *QOpcodes) {
2158 assert(NumVecs >=2 && NumVecs <= 4 &&
"VLDSTLane NumVecs out-of-range");
2162 unsigned AddrOpIdx = isUpdating ? 1 : 2;
2163 unsigned Vec0Idx = 3;
2168 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
2172 cast<ConstantSDNode>(N->
getOperand(Vec0Idx + NumVecs))->getZExtValue();
2176 unsigned Alignment = 0;
2178 Alignment = cast<ConstantSDNode>(
Align)->getZExtValue();
2180 if (Alignment > NumBytes)
2181 Alignment = NumBytes;
2182 if (Alignment < 8 && Alignment < NumBytes)
2185 Alignment = (Alignment & -Alignment);
2189 Align = CurDAG->getTargetConstant(Alignment, dl,
MVT::i32);
2205 std::vector<EVT> ResTys;
2207 unsigned ResTyElts = (NumVecs == 3) ? 4 : NumVecs;
2227 Ops.
push_back(IsImmUpdate ? Reg0 : Inc);
2241 ?
SDValue(CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, dl, VT), 0)
2254 unsigned Opc = (is64BitVector ? DOpcodes[
OpcodeIndex] :
2256 SDNode *VLdLn = CurDAG->getMachineNode(Opc, dl, ResTys, Ops);
2257 cast<MachineSDNode>(VLdLn)->setMemRefs(MemOp, MemOp + 1);
2259 ReplaceNode(N, VLdLn);
2265 static_assert(ARM::dsub_7 == ARM::dsub_0 + 7 &&
2266 ARM::qsub_3 == ARM::qsub_0 + 3,
2267 "Unexpected subreg numbering");
2268 unsigned Sub0 = is64BitVector ? ARM::dsub_0 : ARM::qsub_0;
2269 for (
unsigned Vec = 0; Vec < NumVecs; ++Vec)
2271 CurDAG->getTargetExtractSubreg(Sub0 + Vec, dl, VT, SuperReg));
2275 CurDAG->RemoveDeadNode(N);
2278 void ARMDAGToDAGISel::SelectVLDDup(
SDNode *N,
bool isUpdating,
unsigned NumVecs,
2279 const uint16_t *DOpcodes,
2280 const uint16_t *QOpcodes) {
2281 assert(NumVecs >= 1 && NumVecs <= 4 &&
"VLDDup NumVecs out-of-range");
2289 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
2294 unsigned Alignment = 0;
2296 Alignment = cast<ConstantSDNode>(
Align)->getZExtValue();
2298 if (Alignment > NumBytes)
2299 Alignment = NumBytes;
2300 if (Alignment < 8 && Alignment < NumBytes)
2303 Alignment = (Alignment & -Alignment);
2307 Align = CurDAG->getTargetConstant(Alignment, dl,
MVT::i32);
2312 case MVT::v8i8: Opc = DOpcodes[0];
break;
2333 if (NumVecs <= 2 && !IsImmUpdate)
2338 else if (NumVecs > 2)
2345 unsigned ResTyElts = (NumVecs == 3) ? 4 : NumVecs;
2346 std::vector<EVT> ResTys;
2351 SDNode *VLdDup = CurDAG->getMachineNode(Opc, dl, ResTys, Ops);
2352 cast<MachineSDNode>(VLdDup)->setMemRefs(MemOp, MemOp + 1);
2359 static_assert(ARM::dsub_7 == ARM::dsub_0 + 7,
"Unexpected subreg numbering");
2360 unsigned SubIdx = ARM::dsub_0;
2361 for (
unsigned Vec = 0; Vec < NumVecs; ++Vec)
2363 CurDAG->getTargetExtractSubreg(SubIdx+Vec, dl, VT, SuperReg));
2368 CurDAG->RemoveDeadNode(N);
2371 bool ARMDAGToDAGISel::tryV6T2BitfieldExtractOp(
SDNode *N,
bool isSigned) {
2372 if (!Subtarget->hasV6T2Ops())
2375 unsigned Opc = isSigned
2376 ? (Subtarget->isThumb() ? ARM::t2SBFX : ARM::SBFX)
2377 : (Subtarget->isThumb() ? ARM::t2UBFX : ARM::UBFX);
2381 unsigned And_imm = 0;
2386 if (And_imm & (And_imm + 1))
2389 unsigned Srl_imm = 0;
2392 assert(Srl_imm > 0 && Srl_imm < 32 &&
"bad amount in shift node!");
2396 unsigned LSB = Srl_imm;
2402 if (Subtarget->isThumb()) {
2403 Opc = isSigned ? ARM::t2ASRri : ARM::t2LSRri;
2405 CurDAG->getTargetConstant(LSB, dl,
MVT::i32),
2406 getAL(CurDAG, dl), Reg0, Reg0 };
2407 CurDAG->SelectNodeTo(N, Opc,
MVT::i32, Ops);
2417 getAL(CurDAG, dl), Reg0, Reg0 };
2418 CurDAG->SelectNodeTo(N, ARM::MOVsi,
MVT::i32, Ops);
2423 CurDAG->getTargetConstant(LSB, dl,
MVT::i32),
2424 CurDAG->getTargetConstant(Width, dl,
MVT::i32),
2425 getAL(CurDAG, dl), Reg0 };
2426 CurDAG->SelectNodeTo(N, Opc,
MVT::i32, Ops);
2434 unsigned Shl_imm = 0;
2436 assert(Shl_imm > 0 && Shl_imm < 32 &&
"bad amount in shift node!");
2437 unsigned Srl_imm = 0;
2439 assert(Srl_imm > 0 && Srl_imm < 32 &&
"bad amount in shift node!");
2441 unsigned Width = 32 - Srl_imm - 1;
2442 int LSB = Srl_imm - Shl_imm;
2447 CurDAG->getTargetConstant(LSB, dl,
MVT::i32),
2448 CurDAG->getTargetConstant(Width, dl,
MVT::i32),
2449 getAL(CurDAG, dl), Reg0 };
2450 CurDAG->SelectNodeTo(N, Opc,
MVT::i32, Ops);
2458 unsigned Srl_imm = 0;
2462 assert(Srl_imm > 0 && Srl_imm < 32 &&
"bad amount in shift node!");
2465 unsigned Width = MSB - LSB;
2468 CurDAG->getTargetConstant(Srl_imm, dl,
MVT::i32),
2469 CurDAG->getTargetConstant(Width, dl,
MVT::i32),
2470 getAL(CurDAG, dl), Reg0 };
2471 CurDAG->SelectNodeTo(N, Opc,
MVT::i32, Ops);
2477 unsigned Width = cast<VTSDNode>(N->
getOperand(1))->getVT().getSizeInBits();
2483 if (LSB + Width > 32)
2488 CurDAG->getTargetConstant(LSB, dl,
MVT::i32),
2489 CurDAG->getTargetConstant(Width - 1, dl,
MVT::i32),
2490 getAL(CurDAG, dl), Reg0 };
2491 CurDAG->SelectNodeTo(N, Opc,
MVT::i32, Ops);
2508 bool ARMDAGToDAGISel::tryABSOp(
SDNode *N){
2513 if (Subtarget->isThumb1Only())
2525 unsigned Size = XType.getSizeInBits() - 1;
2527 if (ADDSrc1 == XORSrc1 && ADDSrc0 == SRASrc0 &&
2528 XType.isInteger() && SRAConstant !=
nullptr &&
2530 unsigned Opcode = Subtarget->isThumb2() ? ARM::t2ABS :
ARM::ABS;
2531 CurDAG->SelectNodeTo(N, Opcode, VT, ADDSrc0);
2539 void ARMDAGToDAGISel::SelectCMP_SWAP(
SDNode *N) {
2541 EVT MemTy = cast<MemSDNode>(
N)->getMemoryVT();
2543 Opcode = ARM::CMP_SWAP_8;
2545 Opcode = ARM::CMP_SWAP_16;
2547 Opcode = ARM::CMP_SWAP_32;
2553 SDNode *CmpSwap = CurDAG->getMachineNode(
2558 MemOp[0] = cast<MemSDNode>(
N)->getMemOperand();
2559 cast<MachineSDNode>(CmpSwap)->setMemRefs(MemOp, MemOp + 1);
2563 CurDAG->RemoveDeadNode(N);
2572 return std::make_pair(FirstOne, LastOne);
2575 void ARMDAGToDAGISel::SelectCMPZ(
SDNode *N,
bool &SwitchEQNEToPLMI) {
2577 SwitchEQNEToPLMI =
false;
2579 if (!Subtarget->isThumb())
2590 if (!isa<ConstantSDNode>(Zero) || !cast<ConstantSDNode>(Zero)->isNullValue() ||
2606 auto EmitShift = [&](
unsigned Opc,
SDValue Src,
unsigned Imm) ->
SDNode* {
2607 if (Subtarget->isThumb2()) {
2608 Opc = (Opc == ARM::tLSLri) ? ARM::t2LSLri : ARM::t2LSRri;
2611 CurDAG->getRegister(0,
MVT::i32) };
2612 return CurDAG->getMachineNode(Opc, dl,
MVT::i32, Ops);
2615 CurDAG->getTargetConstant(Imm, dl,
MVT::i32),
2617 return CurDAG->getMachineNode(Opc, dl,
MVT::i32, Ops);
2621 if (Range->second == 0) {
2623 NewN = EmitShift(ARM::tLSLri, X, 31 - Range->first);
2624 ReplaceNode(And.
getNode(), NewN);
2625 }
else if (Range->first == 31) {
2627 NewN = EmitShift(ARM::tLSRri, X, Range->second);
2628 ReplaceNode(And.
getNode(), NewN);
2629 }
else if (Range->first == Range->second) {
2632 NewN = EmitShift(ARM::tLSLri, X, 31 - Range->first);
2633 ReplaceNode(And.
getNode(), NewN);
2635 SwitchEQNEToPLMI =
true;
2636 }
else if (!Subtarget->hasV6T2Ops()) {
2639 NewN = EmitShift(ARM::tLSLri, X, 31 - Range->first);
2640 NewN = EmitShift(ARM::tLSRri,
SDValue(NewN, 0),
2641 Range->second + (31 - Range->first));
2642 ReplaceNode(And.
getNode(), NewN);
2658 if (tryWriteRegister(N))
2662 if (tryReadRegister(N))
2666 if (tryInlineAsm(N))
2676 unsigned Val = cast<ConstantSDNode>(
N)->getZExtValue();
2678 if (ConstantMaterializationCost(Val) > 2) {
2679 SDValue CPIdx = CurDAG->getTargetConstantPool(
2681 TLI->getPointerTy(CurDAG->getDataLayout()));
2684 if (Subtarget->isThumb()) {
2689 CurDAG->getEntryNode()
2696 CurDAG->getTargetConstant(0, dl,
MVT::i32),
2699 CurDAG->getEntryNode()
2713 cast<MachineSDNode>(ResNode)->setMemRefs(MemOp, MemOp+1);
2715 ReplaceNode(N, ResNode);
2724 int FI = cast<FrameIndexSDNode>(
N)->getIndex();
2725 SDValue TFI = CurDAG->getTargetFrameIndex(
2726 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
2727 if (Subtarget->isThumb1Only()) {
2733 CurDAG->SelectNodeTo(N, ARM::tADDframe,
MVT::i32, TFI,
2734 CurDAG->getTargetConstant(0, dl,
MVT::i32));
2737 unsigned Opc = ((Subtarget->isThumb() && Subtarget->hasThumb2()) ?
2738 ARM::t2ADDri : ARM::ADDri);
2741 CurDAG->getRegister(0,
MVT::i32) };
2742 CurDAG->SelectNodeTo(N, Opc,
MVT::i32, Ops);
2747 if (tryV6T2BitfieldExtractOp(N,
false))
2752 if (tryV6T2BitfieldExtractOp(N,
true))
2756 if (Subtarget->isThumb1Only())
2759 unsigned RHSV =
C->getZExtValue();
2762 unsigned ShImm =
Log2_32(RHSV-1);
2769 if (Subtarget->isThumb()) {
2770 SDValue Ops[] = { V, V, ShImmOp,
getAL(CurDAG, dl), Reg0, Reg0 };
2771 CurDAG->SelectNodeTo(N, ARM::t2ADDrs,
MVT::i32, Ops);
2774 SDValue Ops[] = { V, V, Reg0, ShImmOp,
getAL(CurDAG, dl), Reg0,
2776 CurDAG->SelectNodeTo(N, ARM::ADDrsi,
MVT::i32, Ops);
2781 unsigned ShImm =
Log2_32(RHSV+1);
2788 if (Subtarget->isThumb()) {
2789 SDValue Ops[] = { V, V, ShImmOp,
getAL(CurDAG, dl), Reg0, Reg0 };
2790 CurDAG->SelectNodeTo(N, ARM::t2RSBrs,
MVT::i32, Ops);
2793 SDValue Ops[] = { V, V, Reg0, ShImmOp,
getAL(CurDAG, dl), Reg0,
2795 CurDAG->SelectNodeTo(N, ARM::RSBrsi,
MVT::i32, Ops);
2803 if (tryV6T2BitfieldExtractOp(N,
false))
2810 if (N1C && N1C->hasOneUse() && Subtarget->isThumb()) {
2817 bool PreferImmediateEncoding =
2818 Subtarget->hasThumb2() && (is_t2_so_imm(Imm) || is_t2_so_imm_not(Imm));
2819 if (!PreferImmediateEncoding &&
2820 ConstantMaterializationCost(Imm) >
2821 ConstantMaterializationCost(~Imm)) {
2825 CurDAG->getConstant(~N1C->getZExtValue(), dl,
MVT::i32);
2831 if (!Subtarget->hasThumb2()) {
2835 ReplaceNode(N, CurDAG->getMachineNode(ARM::tBIC, dl,
MVT::i32, Ops));
2842 CurDAG->getMachineNode(ARM::t2BICrr, dl,
MVT::i32, Ops));
2856 unsigned Opc = (Subtarget->isThumb() && Subtarget->hasThumb2())
2858 : (Subtarget->hasV6T2Ops() ? ARM::MOVTi16 : 0);
2872 if ((N1CVal & 0xffff0000U) == (N2CVal & 0xffff0000U) &&
2873 (N1CVal & 0xffffU) == 0xffffU &&
2874 (N2CVal & 0xffffU) == 0x0U) {
2875 SDValue Imm16 = CurDAG->getTargetConstant((N2CVal & 0xFFFF0000U) >> 16,
2879 ReplaceNode(N, CurDAG->getMachineNode(Opc, dl, VT, Ops));
2887 unsigned Opc = Subtarget->isThumb() ? ARM::t2UMAAL :
ARM::UMAAL;
2891 CurDAG->getRegister(0,
MVT::i32) };
2896 if (Subtarget->isThumb()) {
2907 CurDAG->getRegister(0,
MVT::i32) };
2908 ReplaceNode(N, CurDAG->getMachineNode(
2909 Subtarget->hasV6Ops() ?
ARM::UMLAL : ARM::UMLALv5, dl,
2915 if (Subtarget->isThumb()) {
2926 CurDAG->getRegister(0,
MVT::i32) };
2927 ReplaceNode(N, CurDAG->getMachineNode(
2928 Subtarget->hasV6Ops() ?
ARM::SMLAL : ARM::SMLALv5, dl,
2934 if (!Subtarget->hasV6Ops())
2943 if (Subtarget->isThumb())
2944 assert(Subtarget->hasThumb2() &&
2945 "This pattern should not be generated for Thumb");
2951 if (!Zero || Zero->getZExtValue() != 0 ||
2957 unsigned Opc = Subtarget->isThumb2() ? ARM::t2SMMLS : ARM::SMMLS;
2960 CurDAG->getRegister(0,
MVT::i32) };
2961 ReplaceNode(N, CurDAG->getMachineNode(Opc, dl,
MVT::i32, Ops));
2965 if (Subtarget->isThumb() && Subtarget->hasThumb2()) {
2966 if (tryT2IndexedLoad(N))
2968 }
else if (Subtarget->isThumb()) {
2969 if (tryT1IndexedLoad(N))
2971 }
else if (tryARMIndexedLoad(N))
2989 unsigned Opc = Subtarget->isThumb() ?
2990 ((Subtarget->hasThumb2()) ? ARM::t2Bcc : ARM::tBcc) : ARM::Bcc;
3000 unsigned CC = (
unsigned) cast<ConstantSDNode>(N2)->getZExtValue();
3003 bool SwitchEQNEToPLMI;
3004 SelectCMPZ(InFlag.
getNode(), SwitchEQNEToPLMI);
3007 if (SwitchEQNEToPLMI) {
3021 SDValue Ops[] = { N1, Tmp2, N3, Chain, InFlag };
3027 ReplaceUses(
SDValue(N, 1), InFlag);
3031 CurDAG->RemoveDeadNode(N);
3042 if (
C &&
C->getSExtValue() < 0 && Subtarget->isThumb()) {
3043 int64_t Addend = -
C->getSExtValue();
3050 if (Addend < 1<<8) {
3051 if (Subtarget->isThumb2()) {
3054 CurDAG->getRegister(0,
MVT::i32) };
3055 Add = CurDAG->getMachineNode(ARM::t2ADDri, dl,
MVT::i32, Ops);
3057 unsigned Opc = (Addend < 1<<3) ? ARM::tADDi3 : ARM::tADDi8;
3059 CurDAG->getTargetConstant(Addend, dl,
MVT::i32),
3061 Add = CurDAG->getMachineNode(Opc, dl,
MVT::i32, Ops);
3077 bool SwitchEQNEToPLMI;
3078 SelectCMPZ(InFlag.
getNode(), SwitchEQNEToPLMI);
3080 if (SwitchEQNEToPLMI) {
3110 case MVT::v8i8: Opc = ARM::VZIPd8;
break;
3123 ReplaceNode(N, CurDAG->getMachineNode(Opc, dl, VT, VT, Ops));
3131 case MVT::v8i8: Opc = ARM::VUZPd8;
break;
3144 ReplaceNode(N, CurDAG->getMachineNode(Opc, dl, VT, VT, Ops));
3152 case MVT::v8i8: Opc = ARM::VTRNd8;
break;
3164 ReplaceNode(N, CurDAG->getMachineNode(Opc, dl, VT, VT, Ops));
3172 assert(NumElts == 2 &&
"unexpected type for BUILD_VECTOR");
3183 assert(NumElts == 4 &&
"unexpected type for BUILD_VECTOR");
3191 static const uint16_t DOpcodes[] = { ARM::VLD1DUPd8, ARM::VLD1DUPd16,
3193 static const uint16_t QOpcodes[] = { ARM::VLD1DUPq8, ARM::VLD1DUPq16,
3195 SelectVLDDup(N,
false, 1, DOpcodes, QOpcodes);
3200 static const uint16_t Opcodes[] = { ARM::VLD2DUPd8, ARM::VLD2DUPd16,
3202 SelectVLDDup(N,
false, 2, Opcodes);
3207 static const uint16_t Opcodes[] = { ARM::VLD3DUPd8Pseudo,
3208 ARM::VLD3DUPd16Pseudo,
3209 ARM::VLD3DUPd32Pseudo };
3210 SelectVLDDup(N,
false, 3, Opcodes);
3215 static const uint16_t Opcodes[] = { ARM::VLD4DUPd8Pseudo,
3216 ARM::VLD4DUPd16Pseudo,
3217 ARM::VLD4DUPd32Pseudo };
3218 SelectVLDDup(N,
false, 4, Opcodes);
3223 static const uint16_t DOpcodes[] = { ARM::VLD1DUPd8wb_fixed,
3224 ARM::VLD1DUPd16wb_fixed,
3225 ARM::VLD1DUPd32wb_fixed };
3226 static const uint16_t QOpcodes[] = { ARM::VLD1DUPq8wb_fixed,
3227 ARM::VLD1DUPq16wb_fixed,
3228 ARM::VLD1DUPq32wb_fixed };
3229 SelectVLDDup(N,
true, 1, DOpcodes, QOpcodes);
3234 static const uint16_t Opcodes[] = { ARM::VLD2DUPd8wb_fixed,
3235 ARM::VLD2DUPd16wb_fixed,
3236 ARM::VLD2DUPd32wb_fixed };
3237 SelectVLDDup(N,
true, 2, Opcodes);
3242 static const uint16_t Opcodes[] = { ARM::VLD3DUPd8Pseudo_UPD,
3243 ARM::VLD3DUPd16Pseudo_UPD,
3244 ARM::VLD3DUPd32Pseudo_UPD };
3245 SelectVLDDup(N,
true, 3, Opcodes);
3250 static const uint16_t Opcodes[] = { ARM::VLD4DUPd8Pseudo_UPD,
3251 ARM::VLD4DUPd16Pseudo_UPD,
3252 ARM::VLD4DUPd32Pseudo_UPD };
3253 SelectVLDDup(N,
true, 4, Opcodes);
3258 static const uint16_t DOpcodes[] = { ARM::VLD1d8wb_fixed,
3259 ARM::VLD1d16wb_fixed,
3260 ARM::VLD1d32wb_fixed,
3261 ARM::VLD1d64wb_fixed };
3262 static const uint16_t QOpcodes[] = { ARM::VLD1q8wb_fixed,
3263 ARM::VLD1q16wb_fixed,
3264 ARM::VLD1q32wb_fixed,
3265 ARM::VLD1q64wb_fixed };
3266 SelectVLD(N,
true, 1, DOpcodes, QOpcodes,
nullptr);
3271 static const uint16_t DOpcodes[] = { ARM::VLD2d8wb_fixed,
3272 ARM::VLD2d16wb_fixed,
3273 ARM::VLD2d32wb_fixed,
3274 ARM::VLD1q64wb_fixed};
3275 static const uint16_t QOpcodes[] = { ARM::VLD2q8PseudoWB_fixed,
3276 ARM::VLD2q16PseudoWB_fixed,
3277 ARM::VLD2q32PseudoWB_fixed };
3278 SelectVLD(N,
true, 2, DOpcodes, QOpcodes,
nullptr);
3283 static const uint16_t DOpcodes[] = { ARM::VLD3d8Pseudo_UPD,
3284 ARM::VLD3d16Pseudo_UPD,
3285 ARM::VLD3d32Pseudo_UPD,
3286 ARM::VLD1d64TPseudoWB_fixed};
3287 static const uint16_t QOpcodes0[] = { ARM::VLD3q8Pseudo_UPD,
3288 ARM::VLD3q16Pseudo_UPD,
3289 ARM::VLD3q32Pseudo_UPD };
3290 static const uint16_t QOpcodes1[] = { ARM::VLD3q8oddPseudo_UPD,
3291 ARM::VLD3q16oddPseudo_UPD,
3292 ARM::VLD3q32oddPseudo_UPD };
3293 SelectVLD(N,
true, 3, DOpcodes, QOpcodes0, QOpcodes1);
3298 static const uint16_t DOpcodes[] = { ARM::VLD4d8Pseudo_UPD,
3299 ARM::VLD4d16Pseudo_UPD,
3300 ARM::VLD4d32Pseudo_UPD,
3301 ARM::VLD1d64QPseudoWB_fixed};
3302 static const uint16_t QOpcodes0[] = { ARM::VLD4q8Pseudo_UPD,
3303 ARM::VLD4q16Pseudo_UPD,
3304 ARM::VLD4q32Pseudo_UPD };
3305 static const uint16_t QOpcodes1[] = { ARM::VLD4q8oddPseudo_UPD,
3306 ARM::VLD4q16oddPseudo_UPD,
3307 ARM::VLD4q32oddPseudo_UPD };
3308 SelectVLD(N,
true, 4, DOpcodes, QOpcodes0, QOpcodes1);
3313 static const uint16_t DOpcodes[] = { ARM::VLD2LNd8Pseudo_UPD,
3314 ARM::VLD2LNd16Pseudo_UPD,
3315 ARM::VLD2LNd32Pseudo_UPD };
3316 static const uint16_t QOpcodes[] = { ARM::VLD2LNq16Pseudo_UPD,
3317 ARM::VLD2LNq32Pseudo_UPD };
3318 SelectVLDSTLane(N,
true,
true, 2, DOpcodes, QOpcodes);
3323 static const uint16_t DOpcodes[] = { ARM::VLD3LNd8Pseudo_UPD,
3324 ARM::VLD3LNd16Pseudo_UPD,
3325 ARM::VLD3LNd32Pseudo_UPD };
3326 static const uint16_t QOpcodes[] = { ARM::VLD3LNq16Pseudo_UPD,
3327 ARM::VLD3LNq32Pseudo_UPD };
3328 SelectVLDSTLane(N,
true,
true, 3, DOpcodes, QOpcodes);
3333 static const uint16_t DOpcodes[] = { ARM::VLD4LNd8Pseudo_UPD,
3334 ARM::VLD4LNd16Pseudo_UPD,
3335 ARM::VLD4LNd32Pseudo_UPD };
3336 static const uint16_t QOpcodes[] = { ARM::VLD4LNq16Pseudo_UPD,
3337 ARM::VLD4LNq32Pseudo_UPD };
3338 SelectVLDSTLane(N,
true,
true, 4, DOpcodes, QOpcodes);
3343 static const uint16_t DOpcodes[] = { ARM::VST1d8wb_fixed,
3344 ARM::VST1d16wb_fixed,
3345 ARM::VST1d32wb_fixed,
3346 ARM::VST1d64wb_fixed };
3347 static const uint16_t QOpcodes[] = { ARM::VST1q8wb_fixed,
3348 ARM::VST1q16wb_fixed,
3349 ARM::VST1q32wb_fixed,
3350 ARM::VST1q64wb_fixed };
3351 SelectVST(N,
true, 1, DOpcodes, QOpcodes,
nullptr);
3356 static const uint16_t DOpcodes[] = { ARM::VST2d8wb_fixed,
3357 ARM::VST2d16wb_fixed,
3358 ARM::VST2d32wb_fixed,
3359 ARM::VST1q64wb_fixed};
3360 static const uint16_t QOpcodes[] = { ARM::VST2q8PseudoWB_fixed,
3361 ARM::VST2q16PseudoWB_fixed,
3362 ARM::VST2q32PseudoWB_fixed };
3363 SelectVST(N,
true, 2, DOpcodes, QOpcodes,
nullptr);
3368 static const uint16_t DOpcodes[] = { ARM::VST3d8Pseudo_UPD,
3369 ARM::VST3d16Pseudo_UPD,
3370 ARM::VST3d32Pseudo_UPD,
3371 ARM::VST1d64TPseudoWB_fixed};
3372 static const uint16_t QOpcodes0[] = { ARM::VST3q8Pseudo_UPD,
3373 ARM::VST3q16Pseudo_UPD,
3374 ARM::VST3q32Pseudo_UPD };
3375 static const uint16_t QOpcodes1[] = { ARM::VST3q8oddPseudo_UPD,
3376 ARM::VST3q16oddPseudo_UPD,
3377 ARM::VST3q32oddPseudo_UPD };
3378 SelectVST(N,
true, 3, DOpcodes, QOpcodes0, QOpcodes1);
3383 static const uint16_t DOpcodes[] = { ARM::VST4d8Pseudo_UPD,
3384 ARM::VST4d16Pseudo_UPD,
3385 ARM::VST4d32Pseudo_UPD,
3386 ARM::VST1d64QPseudoWB_fixed};
3387 static const uint16_t QOpcodes0[] = { ARM::VST4q8Pseudo_UPD,
3388 ARM::VST4q16Pseudo_UPD,
3389 ARM::VST4q32Pseudo_UPD };
3390 static const uint16_t QOpcodes1[] = { ARM::VST4q8oddPseudo_UPD,
3391 ARM::VST4q16oddPseudo_UPD,
3392 ARM::VST4q32oddPseudo_UPD };
3393 SelectVST(N,
true, 4, DOpcodes, QOpcodes0, QOpcodes1);
3398 static const uint16_t DOpcodes[] = { ARM::VST2LNd8Pseudo_UPD,
3399 ARM::VST2LNd16Pseudo_UPD,
3400 ARM::VST2LNd32Pseudo_UPD };
3401 static const uint16_t QOpcodes[] = { ARM::VST2LNq16Pseudo_UPD,
3402 ARM::VST2LNq32Pseudo_UPD };
3403 SelectVLDSTLane(N,
false,
true, 2, DOpcodes, QOpcodes);
3408 static const uint16_t DOpcodes[] = { ARM::VST3LNd8Pseudo_UPD,
3409 ARM::VST3LNd16Pseudo_UPD,
3410 ARM::VST3LNd32Pseudo_UPD };
3411 static const uint16_t QOpcodes[] = { ARM::VST3LNq16Pseudo_UPD,
3412 ARM::VST3LNq32Pseudo_UPD };
3413 SelectVLDSTLane(N,
false,
true, 3, DOpcodes, QOpcodes);
3418 static const uint16_t DOpcodes[] = { ARM::VST4LNd8Pseudo_UPD,
3419 ARM::VST4LNd16Pseudo_UPD,
3420 ARM::VST4LNd32Pseudo_UPD };
3421 static const uint16_t QOpcodes[] = { ARM::VST4LNq16Pseudo_UPD,
3422 ARM::VST4LNq32Pseudo_UPD };
3423 SelectVLDSTLane(N,
false,
true, 4, DOpcodes, QOpcodes);
3429 unsigned IntNo = cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue();
3434 case Intrinsic::arm_mrrc:
3435 case Intrinsic::arm_mrrc2: {
3440 if (Subtarget->isThumb())
3441 Opc = (IntNo == Intrinsic::arm_mrrc ? ARM::t2MRRC : ARM::t2MRRC2);
3443 Opc = (IntNo == Intrinsic::arm_mrrc ? ARM::MRRC : ARM::MRRC2);
3453 if (Opc != ARM::MRRC2) {
3463 ReplaceNode(N, CurDAG->getMachineNode(Opc, dl, RetType, Ops));
3466 case Intrinsic::arm_ldaexd:
3467 case Intrinsic::arm_ldrexd: {
3471 bool isThumb = Subtarget->isThumb() && Subtarget->hasV8MBaselineOps();
3473 bool IsAcquire = IntNo == Intrinsic::arm_ldaexd;
3474 unsigned NewOpc = isThumb ? (IsAcquire ? ARM::t2LDAEXD : ARM::t2LDREXD)
3475 : (IsAcquire ? ARM::LDAEXD : ARM::LDREXD);
3478 std::vector<EVT> ResTys;
3488 CurDAG->getRegister(0,
MVT::i32), Chain};
3489 SDNode *Ld = CurDAG->getMachineNode(NewOpc, dl, ResTys, Ops);
3492 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
3493 cast<MachineSDNode>(Ld)->setMemRefs(MemOp, MemOp + 1);
3497 if (!SDValue(N, 0).use_empty()) {
3500 Result = SDValue(Ld, 0);
3503 CurDAG->getTargetConstant(ARM::gsub_0, dl,
MVT::i32);
3504 SDNode *ResNode = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
3505 dl,
MVT::i32, SDValue(Ld, 0), SubRegIdx);
3506 Result = SDValue(ResNode,0);
3508 ReplaceUses(SDValue(N, 0), Result);
3510 if (!SDValue(N, 1).use_empty()) {
3513 Result = SDValue(Ld, 1);
3516 CurDAG->getTargetConstant(ARM::gsub_1, dl,
MVT::i32);
3517 SDNode *ResNode = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
3518 dl,
MVT::i32, SDValue(Ld, 0), SubRegIdx);
3519 Result = SDValue(ResNode,0);
3521 ReplaceUses(SDValue(N, 1), Result);
3523 ReplaceUses(SDValue(N, 2), OutChain);
3524 CurDAG->RemoveDeadNode(N);
3527 case Intrinsic::arm_stlexd:
3528 case Intrinsic::arm_strexd: {
3539 bool isThumb = Subtarget->isThumb() && Subtarget->hasThumb2();
3553 bool IsRelease = IntNo == Intrinsic::arm_stlexd;
3554 unsigned NewOpc = isThumb ? (IsRelease ? ARM::t2STLEXD : ARM::t2STREXD)
3555 : (IsRelease ? ARM::STLEXD : ARM::STREXD);
3557 SDNode *St = CurDAG->getMachineNode(NewOpc, dl, ResTys, Ops);
3560 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
3561 cast<MachineSDNode>(St)->setMemRefs(MemOp, MemOp + 1);
3567 case Intrinsic::arm_neon_vld1: {
3568 static const uint16_t DOpcodes[] = { ARM::VLD1d8, ARM::VLD1d16,
3569 ARM::VLD1d32, ARM::VLD1d64 };
3570 static const uint16_t QOpcodes[] = { ARM::VLD1q8, ARM::VLD1q16,
3571 ARM::VLD1q32, ARM::VLD1q64};
3572 SelectVLD(N,
false, 1, DOpcodes, QOpcodes,
nullptr);
3576 case Intrinsic::arm_neon_vld2: {
3577 static const uint16_t DOpcodes[] = { ARM::VLD2d8, ARM::VLD2d16,
3578 ARM::VLD2d32, ARM::VLD1q64 };
3579 static const uint16_t QOpcodes[] = { ARM::VLD2q8Pseudo, ARM::VLD2q16Pseudo,
3580 ARM::VLD2q32Pseudo };
3581 SelectVLD(N,
false, 2, DOpcodes, QOpcodes,
nullptr);
3585 case Intrinsic::arm_neon_vld3: {
3586 static const uint16_t DOpcodes[] = { ARM::VLD3d8Pseudo,
3589 ARM::VLD1d64TPseudo };
3590 static const uint16_t QOpcodes0[] = { ARM::VLD3q8Pseudo_UPD,
3591 ARM::VLD3q16Pseudo_UPD,
3592 ARM::VLD3q32Pseudo_UPD };
3593 static const uint16_t QOpcodes1[] = { ARM::VLD3q8oddPseudo,
3594 ARM::VLD3q16oddPseudo,
3595 ARM::VLD3q32oddPseudo };
3596 SelectVLD(N,
false, 3, DOpcodes, QOpcodes0, QOpcodes1);
3600 case Intrinsic::arm_neon_vld4: {
3601 static const uint16_t DOpcodes[] = { ARM::VLD4d8Pseudo,
3604 ARM::VLD1d64QPseudo };
3605 static const uint16_t QOpcodes0[] = { ARM::VLD4q8Pseudo_UPD,
3606 ARM::VLD4q16Pseudo_UPD,
3607 ARM::VLD4q32Pseudo_UPD };
3608 static const uint16_t QOpcodes1[] = { ARM::VLD4q8oddPseudo,
3609 ARM::VLD4q16oddPseudo,
3610 ARM::VLD4q32oddPseudo };
3611 SelectVLD(N,
false, 4, DOpcodes, QOpcodes0, QOpcodes1);
3615 case Intrinsic::arm_neon_vld2lane: {
3616 static const uint16_t DOpcodes[] = { ARM::VLD2LNd8Pseudo,
3617 ARM::VLD2LNd16Pseudo,
3618 ARM::VLD2LNd32Pseudo };
3619 static const uint16_t QOpcodes[] = { ARM::VLD2LNq16Pseudo,
3620 ARM::VLD2LNq32Pseudo };
3621 SelectVLDSTLane(N,
true,
false, 2, DOpcodes, QOpcodes);
3625 case Intrinsic::arm_neon_vld3lane: {
3626 static const uint16_t DOpcodes[] = { ARM::VLD3LNd8Pseudo,
3627 ARM::VLD3LNd16Pseudo,
3628 ARM::VLD3LNd32Pseudo };
3629 static const uint16_t QOpcodes[] = { ARM::VLD3LNq16Pseudo,
3630 ARM::VLD3LNq32Pseudo };
3631 SelectVLDSTLane(N,
true,
false, 3, DOpcodes, QOpcodes);
3635 case Intrinsic::arm_neon_vld4lane: {
3636 static const uint16_t DOpcodes[] = { ARM::VLD4LNd8Pseudo,
3637 ARM::VLD4LNd16Pseudo,
3638 ARM::VLD4LNd32Pseudo };
3639 static const uint16_t QOpcodes[] = { ARM::VLD4LNq16Pseudo,
3640 ARM::VLD4LNq32Pseudo };
3641 SelectVLDSTLane(N,
true,
false, 4, DOpcodes, QOpcodes);
3645 case Intrinsic::arm_neon_vst1: {
3646 static const uint16_t DOpcodes[] = { ARM::VST1d8, ARM::VST1d16,
3647 ARM::VST1d32, ARM::VST1d64 };
3648 static const uint16_t QOpcodes[] = { ARM::VST1q8, ARM::VST1q16,
3649 ARM::VST1q32, ARM::VST1q64 };
3650 SelectVST(N,
false, 1, DOpcodes, QOpcodes,
nullptr);
3654 case Intrinsic::arm_neon_vst2: {
3655 static const uint16_t DOpcodes[] = { ARM::VST2d8, ARM::VST2d16,
3656 ARM::VST2d32, ARM::VST1q64 };
3657 static const uint16_t QOpcodes[] = { ARM::VST2q8Pseudo, ARM::VST2q16Pseudo,
3658 ARM::VST2q32Pseudo };
3659 SelectVST(N,
false, 2, DOpcodes, QOpcodes,
nullptr);
3663 case Intrinsic::arm_neon_vst3: {
3664 static const uint16_t DOpcodes[] = { ARM::VST3d8Pseudo,
3667 ARM::VST1d64TPseudo };
3668 static const uint16_t QOpcodes0[] = { ARM::VST3q8Pseudo_UPD,
3669 ARM::VST3q16Pseudo_UPD,
3670 ARM::VST3q32Pseudo_UPD };
3671 static const uint16_t QOpcodes1[] = { ARM::VST3q8oddPseudo,
3672 ARM::VST3q16oddPseudo,
3673 ARM::VST3q32oddPseudo };
3674 SelectVST(N,
false, 3, DOpcodes, QOpcodes0, QOpcodes1);
3678 case Intrinsic::arm_neon_vst4: {
3679 static const uint16_t DOpcodes[] = { ARM::VST4d8Pseudo,
3682 ARM::VST1d64QPseudo };
3683 static const uint16_t QOpcodes0[] = { ARM::VST4q8Pseudo_UPD,
3684 ARM::VST4q16Pseudo_UPD,
3685 ARM::VST4q32Pseudo_UPD };
3686 static const uint16_t QOpcodes1[] = { ARM::VST4q8oddPseudo,
3687 ARM::VST4q16oddPseudo,
3688 ARM::VST4q32oddPseudo };
3689 SelectVST(N,
false, 4, DOpcodes, QOpcodes0, QOpcodes1);
3693 case Intrinsic::arm_neon_vst2lane: {
3694 static const uint16_t DOpcodes[] = { ARM::VST2LNd8Pseudo,
3695 ARM::VST2LNd16Pseudo,
3696 ARM::VST2LNd32Pseudo };
3697 static const uint16_t QOpcodes[] = { ARM::VST2LNq16Pseudo,
3698 ARM::VST2LNq32Pseudo };
3699 SelectVLDSTLane(N,
false,
false, 2, DOpcodes, QOpcodes);
3703 case Intrinsic::arm_neon_vst3lane: {
3704 static const uint16_t DOpcodes[] = { ARM::VST3LNd8Pseudo,
3705 ARM::VST3LNd16Pseudo,
3706 ARM::VST3LNd32Pseudo };
3707 static const uint16_t QOpcodes[] = { ARM::VST3LNq16Pseudo,
3708 ARM::VST3LNq32Pseudo };
3709 SelectVLDSTLane(N,
false,
false, 3, DOpcodes, QOpcodes);
3713 case Intrinsic::arm_neon_vst4lane: {
3714 static const uint16_t DOpcodes[] = { ARM::VST4LNd8Pseudo,
3715 ARM::VST4LNd16Pseudo,
3716 ARM::VST4LNd32Pseudo };
3717 static const uint16_t QOpcodes[] = { ARM::VST4LNq16Pseudo,
3718 ARM::VST4LNq32Pseudo };
3719 SelectVLDSTLane(N,
false,
false, 4, DOpcodes, QOpcodes);
3742 std::vector<SDValue> &Ops) {
3744 RegString.
split(Fields,
':');
3746 if (Fields.
size() > 1) {
3747 bool AllIntFields =
true;
3752 AllIntFields &= !
Field.trim(
"CPcp").getAsInteger(10, IntField);
3757 "Unexpected non-integer value in special register string.");
3768 .Case(
"r8_usr", 0x00)
3769 .
Case(
"r9_usr", 0x01)
3770 .
Case(
"r10_usr", 0x02)
3771 .
Case(
"r11_usr", 0x03)
3772 .
Case(
"r12_usr", 0x04)
3773 .
Case(
"sp_usr", 0x05)
3774 .
Case(
"lr_usr", 0x06)
3775 .
Case(
"r8_fiq", 0x08)
3776 .
Case(
"r9_fiq", 0x09)
3777 .
Case(
"r10_fiq", 0x0a)
3778 .
Case(
"r11_fiq", 0x0b)
3779 .
Case(
"r12_fiq", 0x0c)
3780 .
Case(
"sp_fiq", 0x0d)
3781 .
Case(
"lr_fiq", 0x0e)
3782 .
Case(
"lr_irq", 0x10)
3783 .
Case(
"sp_irq", 0x11)
3784 .
Case(
"lr_svc", 0x12)
3785 .
Case(
"sp_svc", 0x13)
3786 .
Case(
"lr_abt", 0x14)
3787 .
Case(
"sp_abt", 0x15)
3788 .
Case(
"lr_und", 0x16)
3789 .
Case(
"sp_und", 0x17)
3790 .
Case(
"lr_mon", 0x1c)
3791 .
Case(
"sp_mon", 0x1d)
3792 .
Case(
"elr_hyp", 0x1e)
3793 .
Case(
"sp_hyp", 0x1f)
3794 .
Case(
"spsr_fiq", 0x2e)
3795 .
Case(
"spsr_irq", 0x30)
3796 .
Case(
"spsr_svc", 0x32)
3797 .
Case(
"spsr_abt", 0x34)
3798 .
Case(
"spsr_und", 0x36)
3799 .
Case(
"spsr_mon", 0x3c)
3800 .
Case(
"spsr_hyp", 0x3e)
3818 .
Case(
"primask", 0x10)
3819 .
Case(
"basepri", 0x11)
3820 .
Case(
"basepri_max", 0x12)
3821 .
Case(
"faultmask", 0x13)
3822 .
Case(
"control", 0x14)
3823 .
Case(
"msplim", 0x0a)
3824 .
Case(
"psplim", 0x0b)
3838 .
Case(
"nzcvqg", 0x3)
3847 if (SYSmvalue == -1)
3851 if (!Subtarget->
hasV7Ops() && SYSmvalue >= 0x11 && SYSmvalue <= 0x13)
3860 (SYSmvalue == 0xa || SYSmvalue == 0xb || SYSmvalue > 0x14))
3864 (SYSmvalue == 0x8a || SYSmvalue == 0x8b || SYSmvalue == 0x91 ||
3882 if ((SYSmvalue < 0x4 && Mask == -1) || (SYSmvalue > 0x4 && !Flags.
empty()))
3887 if (!Subtarget->
hasDSP() && (Mask & 0x1))
3893 return SYSmvalue | Mask << 10;
3902 if (Reg ==
"apsr") {
3912 if (Reg !=
"cpsr" && Reg !=
"spsr") {
3917 if (Flags.
empty() || Flags ==
"all")
3922 for (
char Flag : Flags) {
3942 if (!FlagVal || (Mask & FlagVal))
3957 bool ARMDAGToDAGISel::tryReadRegister(
SDNode *N){
3960 bool IsThumb2 = Subtarget->isThumb2();
3963 std::vector<SDValue> Ops;
3973 if (Ops.size() == 5){
3974 Opcode = IsThumb2 ? ARM::t2MRC : ARM::MRC;
3977 assert(Ops.size() == 3 &&
3978 "Invalid number of fields in special register string.");
3979 Opcode = IsThumb2 ? ARM::t2MRRC : ARM::MRRC;
3983 Ops.push_back(
getAL(CurDAG, DL));
3984 Ops.push_back(CurDAG->getRegister(0,
MVT::i32));
3986 ReplaceNode(N, CurDAG->getMachineNode(Opcode, DL, ResTypes, Ops));
3990 std::string SpecialReg = RegString->getString().lower();
3993 if (BankedReg != -1) {
3994 Ops = { CurDAG->getTargetConstant(BankedReg, DL,
MVT::i32),
3998 N, CurDAG->getMachineNode(IsThumb2 ? ARM::t2MRSbanked : ARM::MRSbanked,
4007 .Case(
"fpscr", ARM::VMRS)
4008 .
Case(
"fpexc", ARM::VMRS_FPEXC)
4009 .
Case(
"fpsid", ARM::VMRS_FPSID)
4010 .
Case(
"mvfr0", ARM::VMRS_MVFR0)
4011 .
Case(
"mvfr1", ARM::VMRS_MVFR1)
4012 .
Case(
"mvfr2", ARM::VMRS_MVFR2)
4013 .
Case(
"fpinst", ARM::VMRS_FPINST)
4014 .
Case(
"fpinst2", ARM::VMRS_FPINST2)
4019 if (!Subtarget->hasVFP2())
4021 if (Opcode == ARM::VMRS_MVFR2 && !Subtarget->hasFPARMv8())
4024 Ops = {
getAL(CurDAG, DL), CurDAG->getRegister(0,
MVT::i32),
4034 if (Subtarget->isMClass()) {
4036 if (
Reg.endswith(
"_ns")) {
4042 if (SYSmValue == -1)
4045 SDValue Ops[] = { CurDAG->getTargetConstant(SYSmValue, DL,
MVT::i32),
4055 if (SpecialReg ==
"apsr" || SpecialReg ==
"cpsr") {
4056 Ops = {
getAL(CurDAG, DL), CurDAG->getRegister(0,
MVT::i32),
4058 ReplaceNode(N, CurDAG->getMachineNode(IsThumb2 ? ARM::t2MRS_AR : ARM::MRS,
4063 if (SpecialReg ==
"spsr") {
4064 Ops = {
getAL(CurDAG, DL), CurDAG->getRegister(0,
MVT::i32),
4067 N, CurDAG->getMachineNode(IsThumb2 ? ARM::t2MRSsys_AR : ARM::MRSsys, DL,
4078 bool ARMDAGToDAGISel::tryWriteRegister(
SDNode *N){
4081 bool IsThumb2 = Subtarget->isThumb2();
4084 std::vector<SDValue> Ops;
4093 if (Ops.size() == 5) {
4094 Opcode = IsThumb2 ? ARM::t2MCR : ARM::MCR;
4097 assert(Ops.size() == 3 &&
4098 "Invalid number of fields in special register string.");
4099 Opcode = IsThumb2 ? ARM::t2MCRR : ARM::MCRR;
4101 Ops.insert(Ops.begin()+2, WriteValue, WriteValue+2);
4104 Ops.push_back(
getAL(CurDAG, DL));
4105 Ops.push_back(CurDAG->getRegister(0,
MVT::i32));
4108 ReplaceNode(N, CurDAG->getMachineNode(Opcode, DL,
MVT::Other, Ops));
4112 std::string SpecialReg = RegString->getString().lower();
4114 if (BankedReg != -1) {
4119 N, CurDAG->getMachineNode(IsThumb2 ? ARM::t2MSRbanked : ARM::MSRbanked,
4128 .Case(
"fpscr", ARM::VMSR)
4129 .
Case(
"fpexc", ARM::VMSR_FPEXC)
4130 .
Case(
"fpsid", ARM::VMSR_FPSID)
4131 .
Case(
"fpinst", ARM::VMSR_FPINST)
4132 .
Case(
"fpinst2", ARM::VMSR_FPINST2)
4136 if (!Subtarget->hasVFP2())
4140 ReplaceNode(N, CurDAG->getMachineNode(Opcode, DL,
MVT::Other, Ops));
4144 std::pair<StringRef, StringRef> Fields;
4146 std::string
Reg = Fields.first.str();
4151 if (Subtarget->isMClass()) {
4153 if (SpecialReg ==
"basepri_max") {
4158 if (SYSmValue == -1)
4161 SDValue Ops[] = { CurDAG->getTargetConstant(SYSmValue, DL,
MVT::i32),
4164 ReplaceNode(N, CurDAG->getMachineNode(ARM::t2MSR_M, DL,
MVT::Other, Ops));
4176 ReplaceNode(N, CurDAG->getMachineNode(IsThumb2 ? ARM::t2MSR_AR : ARM::MSR,
4184 bool ARMDAGToDAGISel::tryInlineAsm(
SDNode *N){
4185 std::vector<SDValue> AsmNodeOperands;
4187 bool Changed =
false;
4200 : SDValue(
nullptr,0);
4204 for(
unsigned i = 0, e = N->
getGluedNode() ? NumOps - 1 : NumOps; i < e; ++i) {
4206 AsmNodeOperands.push_back(op);
4212 Flag =
C->getZExtValue();
4224 AsmNodeOperands.push_back(op);
4232 unsigned DefIdx = 0;
4233 bool IsTiedToChangedOp =
false;
4237 IsTiedToChangedOp = OpChanged[DefIdx];
4246 AsmNodeOperands.push_back(op);
4256 if ((!IsTiedToChangedOp && (!HasRC || RC != ARM::GPRRegClassID))
4260 assert((i+2 < NumOps) &&
"Invalid number of operands in inline asm");
4263 unsigned Reg0 = cast<RegisterSDNode>(V0)->
getReg();
4264 unsigned Reg1 = cast<RegisterSDNode>(V1)->
getReg();
4275 SDValue Chain = SDValue(N,0);
4278 SDValue RegCopy = CurDAG->getCopyFromReg(Chain, dl, GPVR,
MVT::Untyped,
4282 SDValue Sub0 = CurDAG->getTargetExtractSubreg(ARM::gsub_0, dl,
MVT::i32,
4284 SDValue Sub1 = CurDAG->getTargetExtractSubreg(ARM::gsub_1, dl,
MVT::i32,
4286 SDValue T0 = CurDAG->getCopyToReg(Sub0, dl, Reg0, Sub0,
4288 SDValue
T1 = CurDAG->getCopyToReg(Sub1, dl, Reg1, Sub1, T0.
getValue(1));
4293 CurDAG->UpdateNodeOperands(GU, Ops);
4301 SDValue T0 = CurDAG->getCopyFromReg(Chain, dl, Reg0,
MVT::i32,
4303 SDValue T1 = CurDAG->getCopyFromReg(Chain, dl, Reg1,
MVT::i32,
4311 Chain = CurDAG->getCopyToReg(T1, dl, GPVR, Pair, T1.
getValue(1));
4320 OpChanged[OpChanged.
size() -1 ] =
true;
4322 if (IsTiedToChangedOp)
4327 AsmNodeOperands[AsmNodeOperands.size() -1] = CurDAG->getTargetConstant(
4330 AsmNodeOperands.push_back(PairedReg);
4337 AsmNodeOperands.push_back(Glue);
4344 ReplaceNode(N, New.
getNode());
4349 bool ARMDAGToDAGISel::
4350 SelectInlineAsmMemoryOperand(
const SDValue &Op,
unsigned ConstraintID,
4351 std::vector<SDValue> &OutOps) {
4352 switch(ConstraintID) {
4372 OutOps.push_back(Op);
4383 return new ARMDAGToDAGISel(TM, OptLevel);
void push_back(const T &Elt)
SDValue getValue(unsigned R) const
bool hasOneUse() const
Return true if there is exactly one use of this node.
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
static int getARClassRegisterMask(StringRef Reg, StringRef Flags)
SDVTList getVTList() const
unsigned createVirtualRegister(const TargetRegisterClass *RegClass)
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
static unsigned getSORegOpc(ShiftOpc ShOp, unsigned Imm)
bool mayStore() const
Return true if this instruction could possibly modify memory.
static unsigned getFlagWord(unsigned Kind, unsigned NumOps)
SDNode * getGluedNode() const
If this node has a glue operand, return the node to which the glue operand points.
Describe properties that are true of each instruction in the target description file.
static unsigned getAM5Opc(AddrOpc Opc, unsigned char Offset)
getAM5Opc - This function encodes the addrmode5 opc field.
static Optional< std::pair< unsigned, unsigned > > getContiguousRangeOfSetBits(const APInt &A)
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
static bool isVSTfixed(unsigned Opc)
unsigned getNumOperands() const
Return the number of values used by this operation.
const SDValue & getOperand(unsigned Num) const
static bool isScaledConstantInRange(SDValue Node, int Scale, int RangeMin, int RangeMax, int &ScaledConstant)
Check whether a particular node is a constant value representable as (N * Scale) where (N in [RangeMi...
void setNodeId(int Id)
Set unique node id.
const SDValue & getBasePtr() const
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 isThumb(const MCSubtargetInfo &STI)
static bool isUseOperandTiedToDef(unsigned Flag, unsigned &Idx)
isUseOperandTiedToDef - Return true if the flag of the inline asm operand indicates it is an use oper...
unsigned getResNo() const
get the index which selects a specific result in the SDNode
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
A description of a memory reference used in the backend.
static unsigned getFlagWordForRegClass(unsigned InputFlag, unsigned RC)
getFlagWordForRegClass - Augment an existing flag word returned by getFlagWord with the required regi...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const HexagonInstrInfo * TII
Shift and rotation operations.
std::size_t countTrailingOnes(T Value, ZeroBehavior ZB=ZB_Width)
Count the number of ones from the least significant bit to the first zero bit.
Base class for LoadSDNode and StoreSDNode.
static int getT2SOImmValSplatVal(unsigned V)
getT2SOImmValSplat - Return the 12-bit encoded representation if the specified value can be obtained ...
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
ABS - Determine the unsigned absolute value of a signed integer value of the same bitwidth...
A Use represents the edge between a Value definition and its users.
CopyToReg - This node has three operands: a chain, a register number to set to this value...
bool hasV8MMainlineOps() const
LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(const T &Value) const
Reg
All possible values of the reg field in the ModR/M byte.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
static ShiftOpc getShiftOpcForNode(unsigned Opcode)
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
INLINEASM - Represents an inline asm block.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
bool isFpMLxInstruction(unsigned Opcode) const
isFpMLxInstruction - Return true if the specified opcode is a fp MLA / MLS instruction.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(const char(&S)[N], const T &Value)
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
static bool isVLDfixed(unsigned Opc)
Simple integer binary arithmetic operators.
static int getT2SOImmVal(unsigned Arg)
getT2SOImmVal - Given a 32-bit immediate, if it is something that can fit into a Thumb-2 shifter_oper...
EVT getMemoryVT() const
Return the type of the in-memory value.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
static bool isThumbImmShiftedVal(unsigned V)
isThumbImmShiftedVal - Return true if the specified value can be obtained by left shifting a 8-bit im...
Flag
These should be considered private to the implementation of the MCInstrDesc class.
SDNode * getNode() const
get the SDNode which holds the desired result
unsigned getScalarSizeInBits() const
A switch()-like statement whose cases are string literals.
initializer< Ty > init(const Ty &Val)
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on the DAG, which implements the n...
static unsigned getAM2Opc(AddrOpc Opc, unsigned Imm12, ShiftOpc SO, unsigned IdxMode=0)
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...
static int getBankedRegisterMask(StringRef RegString)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
const SDValue & getOperand(unsigned i) const
static unsigned getVLDSTRegisterUpdateOpcode(unsigned Opc)
static bool isOpcWithIntImmediate(SDNode *N, unsigned Opc, unsigned &Imm)
static int getMClassRegisterSYSmValueMask(StringRef RegString)
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
LLVM_NODISCARD std::pair< StringRef, StringRef > rsplit(char Separator) const
Split into two substrings around the last occurrence of a separator character.
static cl::opt< bool > DisableShifterOp("disable-shifter-op", cl::Hidden, cl::desc("Disable isel of shifter-op"), cl::init(false))
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static unsigned getNumOperandRegisters(unsigned Flag)
getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag...
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
unsigned getBitWidth() const
Return the number of bits in the APInt.
unsigned getOpcode() const
static unsigned getKind(unsigned Flags)
FunctionPass class - This class is used to implement most global optimizations.
self_iterator getIterator()
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
unsigned countPopulation() const
Count the number of bits set.
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc, or post-dec.
static bool isInt32Immediate(SDNode *N, unsigned &Imm)
isInt32Immediate - This method tests to see if the node is a 32-bit constant operand.
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
static SDValue getAL(SelectionDAG *CurDAG, const SDLoc &dl)
getAL - Returns a ARMCC::AL immediate node.
unsigned getOpcode() const
Return the opcode number for this descriptor.
const SDValue & getOffset() const
static int getMClassRegisterMask(StringRef Reg, StringRef Flags, bool IsRead, const ARMSubtarget *Subtarget)
const MDOperand & getOperand(unsigned I) const
Iterator for intrusive lists based on ilist_node.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
SDNode * getGluedUser() const
If this node has a glue value with a user, return the user (there is at most one).
const SDValue & getChain() const
This is an abstract virtual class for memory operations.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Represents one node in the SelectionDAG.
static bool isSOImmTwoPartVal(unsigned V)
isSOImmTwoPartVal - Return true if the specified value can be obtained by or'ing together two SOImmVa...
bool use_empty() const
Return true if there are no nodes using value ResNo of Node.
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT...
Class for arbitrary precision integers.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
int64_t getSExtValue() const
op_iterator op_begin() const
static unsigned getAM3Opc(AddrOpc Opc, unsigned char Offset, unsigned IdxMode=0)
getAM3Opc - This function encodes the addrmode3 opc field.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
static int getSOImmVal(unsigned Arg)
getSOImmVal - Given a 32-bit immediate, if it is something that can fit into an shifter_operand immed...
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
The memory access reads data.
static bool hasRegClassConstraint(unsigned Flag, unsigned &RC)
hasRegClassConstraint - Returns true if the flag contains a register class constraint.
static std::vector< std::string > Flags
Bitwise operators - logical and, logical or, logical xor.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static IntegerType * getInt32Ty(LLVMContext &C)
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
op_iterator op_end() const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static MachinePointerInfo getConstantPool(MachineFunction &MF)
Return a MachinePointerInfo record that refers to the constant pool.
int getNodeId() const
Return the unique node id.
FunctionPass * createARMISelDag(ARMBaseTargetMachine &TM, CodeGenOpt::Level OptLevel)
createARMISelDag - This pass converts a legalized DAG into a ARM-specific DAG, ready for instruction ...
EVT getValueType() const
Return the ValueType of the referenced return value.
const MDNode * getMD() const
This class is used to form a handle around another node that is persistent and is updated across invo...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
static void getIntOperandsFromRegisterString(StringRef RegString, SelectionDAG *CurDAG, const SDLoc &DL, std::vector< SDValue > &Ops)
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
static bool isPerfectIncrement(SDValue Inc, EVT VecTy, unsigned NumVecs)
Returns true if the given increment is a Constant known to be equal to the access size performed by a...
unsigned countLeadingZeros() const
The APInt version of the countLeadingZeros functions in MathExtras.h.
constexpr bool isShiftedMask_32(uint32_t Value)
Return true if the argument contains a non-empty sequence of ones with the remainder zero (32 bit ver...
StringRef - Represent a constant reference to a string, i.e.
static int getMClassFlagsMask(StringRef Flags)
unsigned getAlignment() const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
bool is64BitVector() const
Return true if this is a 64-bit vector type.
void setObjectAlignment(int ObjectIdx, unsigned Align)
setObjectAlignment - Change the alignment of the specified stack object.
MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num)
allocateMemRefsArray - Allocate an array to hold MachineMemOperand pointers.
LLVM_NODISCARD std::string lower() const
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
static unsigned getFlagWordForMatchingOp(unsigned InputFlag, unsigned MatchedOperandNo)
getFlagWordForMatchingOp - Augment an existing flag word returned by getFlagWord with information ind...
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
This file describes how to lower LLVM code to machine code.
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
uint64_t getZExtValue() const
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
This class is used to represent ISD::LOAD nodes.
static SDValue createGPRPairNode(SelectionDAG &DAG, SDValue V)