14 #define DEBUG_TYPE "aarch64-isel"
48 virtual const char *getPassName()
const {
49 return "AArch64 Instruction Selection";
53 #include "AArch64GenDAGISel.inc"
55 template<
unsigned MemSize>
66 template<
unsigned RegW
idth>
68 return SelectCVTFixedPosOperand(N, FixedPos, RegWidth);
74 template<
unsigned LogShift>
77 Shift = CurDAG->getTargetConstant(LogShift,
MVT::i32);
86 bool SelectInlineAsmMemoryOperand(
const SDValue &Op,
88 std::vector<SDValue> &OutOps);
92 template<
unsigned RegW
idth>
94 return SelectTSTBOperand(N, FixedPos, RegWidth);
97 bool SelectTSTBOperand(
SDValue N,
SDValue &FixedPos,
unsigned RegWidth);
99 SDNode *SelectAtomic(
SDNode *N,
unsigned Op8,
unsigned Op16,
unsigned Op32,
113 unsigned getTBLOpc(
bool IsExt,
bool Is64Bit,
unsigned NumOfVec);
117 SDNode *SelectVTBL(
SDNode *N,
unsigned NumVecs,
bool IsExt);
120 SDNode *SelectVLD(
SDNode *N,
bool isUpdating,
unsigned NumVecs,
121 const uint16_t *Opcode);
124 SDNode *SelectVST(
SDNode *N,
bool isUpdating,
unsigned NumVecs,
125 const uint16_t *Opcodes);
141 SDNode *SelectVLDDup(
SDNode *N,
bool isUpdating,
unsigned NumVecs,
142 const uint16_t *Opcodes);
146 SDNode *SelectVLDSTLane(
SDNode *N,
bool IsLoad,
bool isUpdating,
147 unsigned NumVecs,
const uint16_t *Opcodes);
155 AArch64DAGToDAGISel::SelectCVTFixedPosOperand(
SDValue N,
SDValue &FixedPos,
158 if (!CN)
return false;
175 if (!IsExact || !
IntVal.isPowerOf2())
return false;
176 unsigned FBits =
IntVal.logBase2();
180 if (FBits == 0 || FBits > RegWidth)
return false;
182 FixedPos = CurDAG->getTargetConstant(64 - FBits,
MVT::i32);
187 AArch64DAGToDAGISel::SelectInlineAsmMemoryOperand(
const SDValue &Op,
189 std::vector<SDValue> &OutOps) {
190 switch (ConstraintCode) {
199 OutOps.push_back(Op);
212 Dummy = CurDAG->getTargetConstant(0,
MVT::i32);
216 bool AArch64DAGToDAGISel::SelectLogicalImm(
SDValue N,
SDValue &Imm) {
221 if (!CN)
return false;
226 Imm = CurDAG->getTargetConstant(Bits,
MVT::i32);
230 SDNode *AArch64DAGToDAGISel::TrySelectToMoveImm(
SDNode *Node) {
239 uint32_t LogicalBits;
241 uint64_t BitPat = cast<ConstantSDNode>(Node)->getZExtValue();
244 MOVOpcode = DestWidth == 64 ? AArch64::MOVZxii : AArch64::MOVZwii;
247 MOVOpcode = DestWidth == 64 ? AArch64::MOVNxii : AArch64::MOVNwii;
252 MOVOpcode = AArch64::MOVNwii;
254 MOVOpcode = DestWidth == 64 ? AArch64::ORRxxi : AArch64::ORRwwi;
255 uint16_t ZR = DestWidth == 64 ? AArch64::XZR : AArch64::WZR;
257 return CurDAG->getMachineNode(MOVOpcode, dl, DestType,
258 CurDAG->getRegister(ZR, DestType),
259 CurDAG->getTargetConstant(LogicalBits,
MVT::i32));
266 ResNode = CurDAG->getMachineNode(MOVOpcode, dl, MOVType,
267 CurDAG->getTargetConstant(UImm16,
MVT::i32),
268 CurDAG->getTargetConstant(Shift,
MVT::i32));
270 if (MOVType != DestType) {
273 CurDAG->getTargetConstant(0,
MVT::i64),
275 CurDAG->getTargetConstant(AArch64::sub_32,
MVT::i32));
282 AArch64DAGToDAGISel::getConstantPoolItemAddress(
SDLoc DL,
284 EVT PtrVT = getTargetLowering()->getPointerTy();
286 switch (getTargetLowering()->getTargetMachine().getCodeModel()) {
289 getTargetLowering()->getDataLayout()->getABITypeAlignment(CV->
getType());
290 return CurDAG->getNode(
294 CurDAG->getConstant(Alignment,
MVT::i32));
298 LitAddr = CurDAG->getMachineNode(
299 AArch64::MOVZxii, DL, PtrVT,
301 CurDAG->getTargetConstant(3,
MVT::i32));
302 LitAddr = CurDAG->getMachineNode(
303 AArch64::MOVKxii, DL, PtrVT,
SDValue(LitAddr, 0),
305 CurDAG->getTargetConstant(2,
MVT::i32));
306 LitAddr = CurDAG->getMachineNode(
307 AArch64::MOVKxii, DL, PtrVT,
SDValue(LitAddr, 0),
309 CurDAG->getTargetConstant(1,
MVT::i32));
310 LitAddr = CurDAG->getMachineNode(
311 AArch64::MOVKxii, DL, PtrVT,
SDValue(LitAddr, 0),
313 CurDAG->getTargetConstant(0,
MVT::i32));
321 SDNode *AArch64DAGToDAGISel::SelectToLitPool(
SDNode *Node) {
323 uint64_t UnsignedVal = cast<ConstantSDNode>(Node)->getZExtValue();
324 int64_t SignedVal = cast<ConstantSDNode>(Node)->getSExtValue();
333 &&
"Only expect integer constants at the moment");
338 }
else if (UnsignedVal <= UINT32_MAX) {
341 }
else if (SignedVal >= INT32_MIN && SignedVal <= INT32_MAX) {
352 SDValue PoolAddr = getConstantPoolItemAddress(DL, CV);
354 getTargetLowering()->getDataLayout()->getABITypeAlignment(CV->
getType());
356 return CurDAG->getExtLoad(Extension, DL, DestType, CurDAG->getEntryNode(),
361 Alignment).getNode();
364 SDNode *AArch64DAGToDAGISel::LowerToFPLitPool(
SDNode *Node) {
366 const ConstantFP *FV = cast<ConstantFPSDNode>(Node)->getConstantFPValue();
370 getTargetLowering()->getDataLayout()->getABITypeAlignment(FV->
getType());
371 SDValue PoolAddr = getConstantPoolItemAddress(DL, FV);
373 return CurDAG->getLoad(DestType, DL, CurDAG->getEntryNode(), PoolAddr,
378 Alignment).getNode();
382 AArch64DAGToDAGISel::SelectTSTBOperand(
SDValue N,
SDValue &FixedPos,
385 if (!CN)
return false;
391 unsigned TestedBit =
Log2_64(Val);
394 if (TestedBit >= RegWidth)
return false;
396 FixedPos = CurDAG->getTargetConstant(TestedBit,
MVT::i64);
400 SDNode *AArch64DAGToDAGISel::SelectAtomic(
SDNode *Node,
unsigned Op8,
401 unsigned Op16,
unsigned Op32,
427 return CurDAG->SelectNodeTo(Node, Op,
429 &Ops[0], Ops.
size());
433 static unsigned RegClassIDs[] = { AArch64::DPairRegClassID,
434 AArch64::DTripleRegClassID,
435 AArch64::DQuadRegClassID };
436 static unsigned SubRegs[] = { AArch64::dsub_0, AArch64::dsub_1,
437 AArch64::dsub_2, AArch64::dsub_3 };
439 return createTuple(Regs, RegClassIDs, SubRegs);
443 static unsigned RegClassIDs[] = { AArch64::QPairRegClassID,
444 AArch64::QTripleRegClassID,
445 AArch64::QQuadRegClassID };
446 static unsigned SubRegs[] = { AArch64::qsub_0, AArch64::qsub_1,
447 AArch64::qsub_2, AArch64::qsub_3 };
449 return createTuple(Regs, RegClassIDs, SubRegs);
453 unsigned RegClassIDs[],
454 unsigned SubRegs[]) {
457 if (Regs.
size() == 1)
460 assert(Regs.
size() >= 2 && Regs.
size() <= 4);
462 SDLoc DL(Regs[0].getNode());
468 CurDAG->getTargetConstant(RegClassIDs[Regs.
size() - 2],
MVT::i32));
471 for (
unsigned i = 0; i < Regs.
size(); ++i) {
487 case AArch64::LD1WB_8B_fixed:
return AArch64::LD1WB_8B_register;
488 case AArch64::LD1WB_4H_fixed:
return AArch64::LD1WB_4H_register;
489 case AArch64::LD1WB_2S_fixed:
return AArch64::LD1WB_2S_register;
490 case AArch64::LD1WB_1D_fixed:
return AArch64::LD1WB_1D_register;
491 case AArch64::LD1WB_16B_fixed:
return AArch64::LD1WB_16B_register;
492 case AArch64::LD1WB_8H_fixed:
return AArch64::LD1WB_8H_register;
493 case AArch64::LD1WB_4S_fixed:
return AArch64::LD1WB_4S_register;
494 case AArch64::LD1WB_2D_fixed:
return AArch64::LD1WB_2D_register;
496 case AArch64::LD2WB_8B_fixed:
return AArch64::LD2WB_8B_register;
497 case AArch64::LD2WB_4H_fixed:
return AArch64::LD2WB_4H_register;
498 case AArch64::LD2WB_2S_fixed:
return AArch64::LD2WB_2S_register;
499 case AArch64::LD2WB_16B_fixed:
return AArch64::LD2WB_16B_register;
500 case AArch64::LD2WB_8H_fixed:
return AArch64::LD2WB_8H_register;
501 case AArch64::LD2WB_4S_fixed:
return AArch64::LD2WB_4S_register;
502 case AArch64::LD2WB_2D_fixed:
return AArch64::LD2WB_2D_register;
504 case AArch64::LD3WB_8B_fixed:
return AArch64::LD3WB_8B_register;
505 case AArch64::LD3WB_4H_fixed:
return AArch64::LD3WB_4H_register;
506 case AArch64::LD3WB_2S_fixed:
return AArch64::LD3WB_2S_register;
507 case AArch64::LD3WB_16B_fixed:
return AArch64::LD3WB_16B_register;
508 case AArch64::LD3WB_8H_fixed:
return AArch64::LD3WB_8H_register;
509 case AArch64::LD3WB_4S_fixed:
return AArch64::LD3WB_4S_register;
510 case AArch64::LD3WB_2D_fixed:
return AArch64::LD3WB_2D_register;
512 case AArch64::LD4WB_8B_fixed:
return AArch64::LD4WB_8B_register;
513 case AArch64::LD4WB_4H_fixed:
return AArch64::LD4WB_4H_register;
514 case AArch64::LD4WB_2S_fixed:
return AArch64::LD4WB_2S_register;
515 case AArch64::LD4WB_16B_fixed:
return AArch64::LD4WB_16B_register;
516 case AArch64::LD4WB_8H_fixed:
return AArch64::LD4WB_8H_register;
517 case AArch64::LD4WB_4S_fixed:
return AArch64::LD4WB_4S_register;
518 case AArch64::LD4WB_2D_fixed:
return AArch64::LD4WB_2D_register;
520 case AArch64::LD1x2WB_8B_fixed:
return AArch64::LD1x2WB_8B_register;
521 case AArch64::LD1x2WB_4H_fixed:
return AArch64::LD1x2WB_4H_register;
522 case AArch64::LD1x2WB_2S_fixed:
return AArch64::LD1x2WB_2S_register;
523 case AArch64::LD1x2WB_1D_fixed:
return AArch64::LD1x2WB_1D_register;
524 case AArch64::LD1x2WB_16B_fixed:
return AArch64::LD1x2WB_16B_register;
525 case AArch64::LD1x2WB_8H_fixed:
return AArch64::LD1x2WB_8H_register;
526 case AArch64::LD1x2WB_4S_fixed:
return AArch64::LD1x2WB_4S_register;
527 case AArch64::LD1x2WB_2D_fixed:
return AArch64::LD1x2WB_2D_register;
529 case AArch64::LD1x3WB_8B_fixed:
return AArch64::LD1x3WB_8B_register;
530 case AArch64::LD1x3WB_4H_fixed:
return AArch64::LD1x3WB_4H_register;
531 case AArch64::LD1x3WB_2S_fixed:
return AArch64::LD1x3WB_2S_register;
532 case AArch64::LD1x3WB_1D_fixed:
return AArch64::LD1x3WB_1D_register;
533 case AArch64::LD1x3WB_16B_fixed:
return AArch64::LD1x3WB_16B_register;
534 case AArch64::LD1x3WB_8H_fixed:
return AArch64::LD1x3WB_8H_register;
535 case AArch64::LD1x3WB_4S_fixed:
return AArch64::LD1x3WB_4S_register;
536 case AArch64::LD1x3WB_2D_fixed:
return AArch64::LD1x3WB_2D_register;
538 case AArch64::LD1x4WB_8B_fixed:
return AArch64::LD1x4WB_8B_register;
539 case AArch64::LD1x4WB_4H_fixed:
return AArch64::LD1x4WB_4H_register;
540 case AArch64::LD1x4WB_2S_fixed:
return AArch64::LD1x4WB_2S_register;
541 case AArch64::LD1x4WB_1D_fixed:
return AArch64::LD1x4WB_1D_register;
542 case AArch64::LD1x4WB_16B_fixed:
return AArch64::LD1x4WB_16B_register;
543 case AArch64::LD1x4WB_8H_fixed:
return AArch64::LD1x4WB_8H_register;
544 case AArch64::LD1x4WB_4S_fixed:
return AArch64::LD1x4WB_4S_register;
545 case AArch64::LD1x4WB_2D_fixed:
return AArch64::LD1x4WB_2D_register;
547 case AArch64::ST1WB_8B_fixed:
return AArch64::ST1WB_8B_register;
548 case AArch64::ST1WB_4H_fixed:
return AArch64::ST1WB_4H_register;
549 case AArch64::ST1WB_2S_fixed:
return AArch64::ST1WB_2S_register;
550 case AArch64::ST1WB_1D_fixed:
return AArch64::ST1WB_1D_register;
551 case AArch64::ST1WB_16B_fixed:
return AArch64::ST1WB_16B_register;
552 case AArch64::ST1WB_8H_fixed:
return AArch64::ST1WB_8H_register;
553 case AArch64::ST1WB_4S_fixed:
return AArch64::ST1WB_4S_register;
554 case AArch64::ST1WB_2D_fixed:
return AArch64::ST1WB_2D_register;
556 case AArch64::ST2WB_8B_fixed:
return AArch64::ST2WB_8B_register;
557 case AArch64::ST2WB_4H_fixed:
return AArch64::ST2WB_4H_register;
558 case AArch64::ST2WB_2S_fixed:
return AArch64::ST2WB_2S_register;
559 case AArch64::ST2WB_16B_fixed:
return AArch64::ST2WB_16B_register;
560 case AArch64::ST2WB_8H_fixed:
return AArch64::ST2WB_8H_register;
561 case AArch64::ST2WB_4S_fixed:
return AArch64::ST2WB_4S_register;
562 case AArch64::ST2WB_2D_fixed:
return AArch64::ST2WB_2D_register;
564 case AArch64::ST3WB_8B_fixed:
return AArch64::ST3WB_8B_register;
565 case AArch64::ST3WB_4H_fixed:
return AArch64::ST3WB_4H_register;
566 case AArch64::ST3WB_2S_fixed:
return AArch64::ST3WB_2S_register;
567 case AArch64::ST3WB_16B_fixed:
return AArch64::ST3WB_16B_register;
568 case AArch64::ST3WB_8H_fixed:
return AArch64::ST3WB_8H_register;
569 case AArch64::ST3WB_4S_fixed:
return AArch64::ST3WB_4S_register;
570 case AArch64::ST3WB_2D_fixed:
return AArch64::ST3WB_2D_register;
572 case AArch64::ST4WB_8B_fixed:
return AArch64::ST4WB_8B_register;
573 case AArch64::ST4WB_4H_fixed:
return AArch64::ST4WB_4H_register;
574 case AArch64::ST4WB_2S_fixed:
return AArch64::ST4WB_2S_register;
575 case AArch64::ST4WB_16B_fixed:
return AArch64::ST4WB_16B_register;
576 case AArch64::ST4WB_8H_fixed:
return AArch64::ST4WB_8H_register;
577 case AArch64::ST4WB_4S_fixed:
return AArch64::ST4WB_4S_register;
578 case AArch64::ST4WB_2D_fixed:
return AArch64::ST4WB_2D_register;
580 case AArch64::ST1x2WB_8B_fixed:
return AArch64::ST1x2WB_8B_register;
581 case AArch64::ST1x2WB_4H_fixed:
return AArch64::ST1x2WB_4H_register;
582 case AArch64::ST1x2WB_2S_fixed:
return AArch64::ST1x2WB_2S_register;
583 case AArch64::ST1x2WB_1D_fixed:
return AArch64::ST1x2WB_1D_register;
584 case AArch64::ST1x2WB_16B_fixed:
return AArch64::ST1x2WB_16B_register;
585 case AArch64::ST1x2WB_8H_fixed:
return AArch64::ST1x2WB_8H_register;
586 case AArch64::ST1x2WB_4S_fixed:
return AArch64::ST1x2WB_4S_register;
587 case AArch64::ST1x2WB_2D_fixed:
return AArch64::ST1x2WB_2D_register;
589 case AArch64::ST1x3WB_8B_fixed:
return AArch64::ST1x3WB_8B_register;
590 case AArch64::ST1x3WB_4H_fixed:
return AArch64::ST1x3WB_4H_register;
591 case AArch64::ST1x3WB_2S_fixed:
return AArch64::ST1x3WB_2S_register;
592 case AArch64::ST1x3WB_1D_fixed:
return AArch64::ST1x3WB_1D_register;
593 case AArch64::ST1x3WB_16B_fixed:
return AArch64::ST1x3WB_16B_register;
594 case AArch64::ST1x3WB_8H_fixed:
return AArch64::ST1x3WB_8H_register;
595 case AArch64::ST1x3WB_4S_fixed:
return AArch64::ST1x3WB_4S_register;
596 case AArch64::ST1x3WB_2D_fixed:
return AArch64::ST1x3WB_2D_register;
598 case AArch64::ST1x4WB_8B_fixed:
return AArch64::ST1x4WB_8B_register;
599 case AArch64::ST1x4WB_4H_fixed:
return AArch64::ST1x4WB_4H_register;
600 case AArch64::ST1x4WB_2S_fixed:
return AArch64::ST1x4WB_2S_register;
601 case AArch64::ST1x4WB_1D_fixed:
return AArch64::ST1x4WB_1D_register;
602 case AArch64::ST1x4WB_16B_fixed:
return AArch64::ST1x4WB_16B_register;
603 case AArch64::ST1x4WB_8H_fixed:
return AArch64::ST1x4WB_8H_register;
604 case AArch64::ST1x4WB_4S_fixed:
return AArch64::ST1x4WB_4S_register;
605 case AArch64::ST1x4WB_2D_fixed:
return AArch64::ST1x4WB_2D_register;
608 case AArch64::LD2R_WB_8B_fixed:
return AArch64::LD2R_WB_8B_register;
609 case AArch64::LD2R_WB_4H_fixed:
return AArch64::LD2R_WB_4H_register;
610 case AArch64::LD2R_WB_2S_fixed:
return AArch64::LD2R_WB_2S_register;
611 case AArch64::LD2R_WB_1D_fixed:
return AArch64::LD2R_WB_1D_register;
612 case AArch64::LD2R_WB_16B_fixed:
return AArch64::LD2R_WB_16B_register;
613 case AArch64::LD2R_WB_8H_fixed:
return AArch64::LD2R_WB_8H_register;
614 case AArch64::LD2R_WB_4S_fixed:
return AArch64::LD2R_WB_4S_register;
615 case AArch64::LD2R_WB_2D_fixed:
return AArch64::LD2R_WB_2D_register;
617 case AArch64::LD3R_WB_8B_fixed:
return AArch64::LD3R_WB_8B_register;
618 case AArch64::LD3R_WB_4H_fixed:
return AArch64::LD3R_WB_4H_register;
619 case AArch64::LD3R_WB_2S_fixed:
return AArch64::LD3R_WB_2S_register;
620 case AArch64::LD3R_WB_1D_fixed:
return AArch64::LD3R_WB_1D_register;
621 case AArch64::LD3R_WB_16B_fixed:
return AArch64::LD3R_WB_16B_register;
622 case AArch64::LD3R_WB_8H_fixed:
return AArch64::LD3R_WB_8H_register;
623 case AArch64::LD3R_WB_4S_fixed:
return AArch64::LD3R_WB_4S_register;
624 case AArch64::LD3R_WB_2D_fixed:
return AArch64::LD3R_WB_2D_register;
626 case AArch64::LD4R_WB_8B_fixed:
return AArch64::LD4R_WB_8B_register;
627 case AArch64::LD4R_WB_4H_fixed:
return AArch64::LD4R_WB_4H_register;
628 case AArch64::LD4R_WB_2S_fixed:
return AArch64::LD4R_WB_2S_register;
629 case AArch64::LD4R_WB_1D_fixed:
return AArch64::LD4R_WB_1D_register;
630 case AArch64::LD4R_WB_16B_fixed:
return AArch64::LD4R_WB_16B_register;
631 case AArch64::LD4R_WB_8H_fixed:
return AArch64::LD4R_WB_8H_register;
632 case AArch64::LD4R_WB_4S_fixed:
return AArch64::LD4R_WB_4S_register;
633 case AArch64::LD4R_WB_2D_fixed:
return AArch64::LD4R_WB_2D_register;
636 case AArch64::LD2LN_WB_B_fixed:
return AArch64::LD2LN_WB_B_register;
637 case AArch64::LD2LN_WB_H_fixed:
return AArch64::LD2LN_WB_H_register;
638 case AArch64::LD2LN_WB_S_fixed:
return AArch64::LD2LN_WB_S_register;
639 case AArch64::LD2LN_WB_D_fixed:
return AArch64::LD2LN_WB_D_register;
641 case AArch64::LD3LN_WB_B_fixed:
return AArch64::LD3LN_WB_B_register;
642 case AArch64::LD3LN_WB_H_fixed:
return AArch64::LD3LN_WB_H_register;
643 case AArch64::LD3LN_WB_S_fixed:
return AArch64::LD3LN_WB_S_register;
644 case AArch64::LD3LN_WB_D_fixed:
return AArch64::LD3LN_WB_D_register;
646 case AArch64::LD4LN_WB_B_fixed:
return AArch64::LD4LN_WB_B_register;
647 case AArch64::LD4LN_WB_H_fixed:
return AArch64::LD4LN_WB_H_register;
648 case AArch64::LD4LN_WB_S_fixed:
return AArch64::LD4LN_WB_S_register;
649 case AArch64::LD4LN_WB_D_fixed:
return AArch64::LD4LN_WB_D_register;
652 case AArch64::ST2LN_WB_B_fixed:
return AArch64::ST2LN_WB_B_register;
653 case AArch64::ST2LN_WB_H_fixed:
return AArch64::ST2LN_WB_H_register;
654 case AArch64::ST2LN_WB_S_fixed:
return AArch64::ST2LN_WB_S_register;
655 case AArch64::ST2LN_WB_D_fixed:
return AArch64::ST2LN_WB_D_register;
657 case AArch64::ST3LN_WB_B_fixed:
return AArch64::ST3LN_WB_B_register;
658 case AArch64::ST3LN_WB_H_fixed:
return AArch64::ST3LN_WB_H_register;
659 case AArch64::ST3LN_WB_S_fixed:
return AArch64::ST3LN_WB_S_register;
660 case AArch64::ST3LN_WB_D_fixed:
return AArch64::ST3LN_WB_D_register;
662 case AArch64::ST4LN_WB_B_fixed:
return AArch64::ST4LN_WB_B_register;
663 case AArch64::ST4LN_WB_H_fixed:
return AArch64::ST4LN_WB_H_register;
664 case AArch64::ST4LN_WB_S_fixed:
return AArch64::ST4LN_WB_S_register;
665 case AArch64::ST4LN_WB_D_fixed:
return AArch64::ST4LN_WB_D_register;
670 SDNode *AArch64DAGToDAGISel::SelectVLD(
SDNode *N,
bool isUpdating,
672 const uint16_t *Opcodes) {
673 assert(NumVecs >= 1 && NumVecs <= 4 &&
"VLD NumVecs out-of-range");
676 unsigned OpcodeIndex;
679 case 8: OpcodeIndex = is64BitVector ? 0 : 4;
break;
680 case 16: OpcodeIndex = is64BitVector ? 1 : 5;
break;
681 case 32: OpcodeIndex = is64BitVector ? 2 : 6;
break;
682 case 64: OpcodeIndex = is64BitVector ? 3 : 7;
break;
685 unsigned Opc = Opcodes[OpcodeIndex];
688 unsigned AddrOpIdx = isUpdating ? 1 : 2;
693 if (!isa<ConstantSDNode>(Inc.
getNode()))
704 else if (NumVecs == 3)
708 is64BitVector ? NumVecs : NumVecs * 2);
716 SDNode *VLd = CurDAG->getMachineNode(Opc, dl, ResTys, Ops);
720 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
721 cast<MachineSDNode>(VLd)->setMemRefs(MemOp, MemOp + 1);
730 unsigned Sub0 = is64BitVector ? AArch64::dsub_0 : AArch64::qsub_0;
731 for (
unsigned Vec = 0; Vec < NumVecs; ++Vec)
733 CurDAG->getTargetExtractSubreg(Sub0 + Vec, dl, VT, SuperReg));
742 SDNode *AArch64DAGToDAGISel::SelectVST(
SDNode *N,
bool isUpdating,
744 const uint16_t *Opcodes) {
745 assert(NumVecs >= 1 && NumVecs <= 4 &&
"VST NumVecs out-of-range");
749 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
751 unsigned AddrOpIdx = isUpdating ? 1 : 2;
752 unsigned Vec0Idx = 3;
754 unsigned OpcodeIndex;
757 case 8: OpcodeIndex = is64BitVector ? 0 : 4;
break;
758 case 16: OpcodeIndex = is64BitVector ? 1 : 5;
break;
759 case 32: OpcodeIndex = is64BitVector ? 2 : 6;
break;
760 case 64: OpcodeIndex = is64BitVector ? 3 : 7;
break;
763 unsigned Opc = Opcodes[OpcodeIndex];
775 if (!isa<ConstantSDNode>(Inc.
getNode()))
782 SDValue SrcReg = is64BitVector ? createDTuple(Regs) : createQTuple(Regs);
789 SDNode *VSt = CurDAG->getMachineNode(Opc, dl, ResTys, Ops);
790 cast<MachineSDNode>(VSt)->setMemRefs(MemOp, MemOp + 1);
796 AArch64DAGToDAGISel::getTargetSubregToReg(
int SRIdx,
SDLoc DL,
EVT VT,
EVT VTD,
800 CurDAG->getTargetConstant(0,
MVT::i64),
802 CurDAG->getTargetConstant(AArch64::sub_64,
MVT::i32));
806 SDNode *AArch64DAGToDAGISel::SelectVLDDup(
SDNode *N,
bool isUpdating,
808 const uint16_t *Opcodes) {
809 assert(NumVecs >=2 && NumVecs <= 4 &&
"Load Dup NumVecs out-of-range");
813 unsigned OpcodeIndex;
816 case 8: OpcodeIndex = is64BitVector ? 0 : 4;
break;
817 case 16: OpcodeIndex = is64BitVector ? 1 : 5;
break;
818 case 32: OpcodeIndex = is64BitVector ? 2 : 6;
break;
819 case 64: OpcodeIndex = is64BitVector ? 3 : 7;
break;
822 unsigned Opc = Opcodes[OpcodeIndex];
829 if (!isa<ConstantSDNode>(Inc.
getNode()))
841 is64BitVector ? NumVecs : NumVecs * 2);
847 SDNode *VLdDup = CurDAG->getMachineNode(Opc, dl, ResTys, Ops);
851 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
852 cast<MachineSDNode>(VLdDup)->setMemRefs(MemOp, MemOp + 1);
855 unsigned Sub0 = is64BitVector ? AArch64::dsub_0 : AArch64::qsub_0;
857 for (
unsigned Vec = 0; Vec < NumVecs; ++Vec)
859 CurDAG->getTargetExtractSubreg(Sub0 + Vec, dl, VT, SuperReg));
871 SDNode *AArch64DAGToDAGISel::SelectVLDSTLane(
SDNode *N,
bool IsLoad,
872 bool isUpdating,
unsigned NumVecs,
873 const uint16_t *Opcodes) {
874 assert(NumVecs >= 2 && NumVecs <= 4 &&
"VLDSTLane NumVecs out-of-range");
876 unsigned AddrOpIdx = isUpdating ? 1 : 2;
877 unsigned Vec0Idx = 3;
881 cast<ConstantSDNode>(N->
getOperand(Vec0Idx + NumVecs))->getZExtValue();
892 unsigned OpcodeIndex;
894 case 8: OpcodeIndex = 0;
break;
895 case 16: OpcodeIndex = 1;
break;
896 case 32: OpcodeIndex = 2;
break;
897 case 64: OpcodeIndex = 3;
break;
900 unsigned Opc = Opcodes[OpcodeIndex];
909 is64BitVector ? NumVecs : NumVecs * 2);
920 if (!isa<ConstantSDNode>(Inc.
getNode()))
928 for (
unsigned i = 0; i < Regs.
size(); i++)
929 Regs[i] = getTargetSubregToReg(AArch64::sub_64, dl, VT, VT64, Regs[i]);
930 SDValue SuperReg = createQTuple(Regs);
937 SDNode *VLdLn = CurDAG->getMachineNode(Opc, dl, ResTys, Ops);
939 MemOp[0] = cast<MemIntrinsicSDNode>(
N)->getMemOperand();
940 cast<MachineSDNode>(VLdLn)->setMemRefs(MemOp, MemOp + 1);
946 unsigned Sub0 = AArch64::qsub_0;
948 for (
unsigned Vec = 0; Vec < NumVecs; ++Vec) {
949 SDValue SUB0 = CurDAG->getTargetExtractSubreg(Sub0 + Vec, dl, VT, SuperReg);
951 SUB0 = CurDAG->getTargetExtractSubreg(AArch64::sub_64, dl, VT64, SUB0);
953 ReplaceUses(
SDValue(N, Vec), SUB0);
961 unsigned AArch64DAGToDAGISel::getTBLOpc(
bool IsExt,
bool Is64Bit,
963 assert(NumOfVec >= 1 && NumOfVec <= 4 &&
"VST NumVecs out-of-range");
971 Opc = Is64Bit ? AArch64::TBX1_8b : AArch64::TBX1_16b;
973 Opc = Is64Bit ? AArch64::TBL1_8b : AArch64::TBL1_16b;
977 Opc = Is64Bit ? AArch64::TBX2_8b : AArch64::TBX2_16b;
979 Opc = Is64Bit ? AArch64::TBL2_8b : AArch64::TBL2_16b;
983 Opc = Is64Bit ? AArch64::TBX3_8b : AArch64::TBX3_16b;
985 Opc = Is64Bit ? AArch64::TBL3_8b : AArch64::TBL3_16b;
989 Opc = Is64Bit ? AArch64::TBX4_8b : AArch64::TBX4_16b;
991 Opc = Is64Bit ? AArch64::TBL4_8b : AArch64::TBL4_16b;
998 SDNode *AArch64DAGToDAGISel::SelectVTBL(
SDNode *N,
unsigned NumVecs,
1000 assert(NumVecs >= 1 && NumVecs <= 4 &&
"VST NumVecs out-of-range");
1004 unsigned Vec0Idx = IsExt ? 2 : 1;
1006 "The element of lookup table for vtbl and vtbx must be 128-bit");
1014 N->
op_begin() + Vec0Idx + NumVecs);
1015 SDValue TblReg = createQTuple(Regs);
1016 unsigned Opc = getTBLOpc(IsExt, is64BitRes, NumVecs);
1023 return CurDAG->getMachineNode(Opc, dl, ResVT, Ops);
1038 return SelectAtomic(Node,
1039 AArch64::ATOMIC_LOAD_ADD_I8,
1040 AArch64::ATOMIC_LOAD_ADD_I16,
1041 AArch64::ATOMIC_LOAD_ADD_I32,
1042 AArch64::ATOMIC_LOAD_ADD_I64);
1044 return SelectAtomic(Node,
1045 AArch64::ATOMIC_LOAD_SUB_I8,
1046 AArch64::ATOMIC_LOAD_SUB_I16,
1047 AArch64::ATOMIC_LOAD_SUB_I32,
1048 AArch64::ATOMIC_LOAD_SUB_I64);
1050 return SelectAtomic(Node,
1051 AArch64::ATOMIC_LOAD_AND_I8,
1052 AArch64::ATOMIC_LOAD_AND_I16,
1053 AArch64::ATOMIC_LOAD_AND_I32,
1054 AArch64::ATOMIC_LOAD_AND_I64);
1056 return SelectAtomic(Node,
1057 AArch64::ATOMIC_LOAD_OR_I8,
1058 AArch64::ATOMIC_LOAD_OR_I16,
1059 AArch64::ATOMIC_LOAD_OR_I32,
1060 AArch64::ATOMIC_LOAD_OR_I64);
1062 return SelectAtomic(Node,
1063 AArch64::ATOMIC_LOAD_XOR_I8,
1064 AArch64::ATOMIC_LOAD_XOR_I16,
1065 AArch64::ATOMIC_LOAD_XOR_I32,
1066 AArch64::ATOMIC_LOAD_XOR_I64);
1068 return SelectAtomic(Node,
1069 AArch64::ATOMIC_LOAD_NAND_I8,
1070 AArch64::ATOMIC_LOAD_NAND_I16,
1071 AArch64::ATOMIC_LOAD_NAND_I32,
1072 AArch64::ATOMIC_LOAD_NAND_I64);
1074 return SelectAtomic(Node,
1075 AArch64::ATOMIC_LOAD_MIN_I8,
1076 AArch64::ATOMIC_LOAD_MIN_I16,
1077 AArch64::ATOMIC_LOAD_MIN_I32,
1078 AArch64::ATOMIC_LOAD_MIN_I64);
1080 return SelectAtomic(Node,
1081 AArch64::ATOMIC_LOAD_MAX_I8,
1082 AArch64::ATOMIC_LOAD_MAX_I16,
1083 AArch64::ATOMIC_LOAD_MAX_I32,
1084 AArch64::ATOMIC_LOAD_MAX_I64);
1086 return SelectAtomic(Node,
1087 AArch64::ATOMIC_LOAD_UMIN_I8,
1088 AArch64::ATOMIC_LOAD_UMIN_I16,
1089 AArch64::ATOMIC_LOAD_UMIN_I32,
1090 AArch64::ATOMIC_LOAD_UMIN_I64);
1092 return SelectAtomic(Node,
1093 AArch64::ATOMIC_LOAD_UMAX_I8,
1094 AArch64::ATOMIC_LOAD_UMAX_I16,
1095 AArch64::ATOMIC_LOAD_UMAX_I32,
1096 AArch64::ATOMIC_LOAD_UMAX_I64);
1098 return SelectAtomic(Node,
1099 AArch64::ATOMIC_SWAP_I8,
1100 AArch64::ATOMIC_SWAP_I16,
1101 AArch64::ATOMIC_SWAP_I32,
1102 AArch64::ATOMIC_SWAP_I64);
1104 return SelectAtomic(Node,
1105 AArch64::ATOMIC_CMP_SWAP_I8,
1106 AArch64::ATOMIC_CMP_SWAP_I16,
1107 AArch64::ATOMIC_CMP_SWAP_I32,
1108 AArch64::ATOMIC_CMP_SWAP_I64);
1110 int FI = cast<FrameIndexSDNode>(Node)->getIndex();
1111 EVT PtrTy = getTargetLowering()->getPointerTy();
1112 SDValue TFI = CurDAG->getTargetFrameIndex(FI, PtrTy);
1113 return CurDAG->SelectNodeTo(Node, AArch64::ADDxxi_lsl0_s, PtrTy,
1114 TFI, CurDAG->getTargetConstant(0, PtrTy));
1122 ReplaceUses(
SDValue(Node, 0), CP);
1127 if (cast<ConstantSDNode>(Node)->getZExtValue() == 0) {
1134 ResNode = CurDAG->getCopyFromReg(CurDAG->getEntryNode(),
1141 ResNode = TrySelectToMoveImm(Node);
1149 ResNode = SelectToLitPool(Node);
1150 assert(ResNode &&
"We need *some* way to materialise a constant");
1164 SDNode *ResNode = LowerToFPLitPool(Node);
1173 static const uint16_t Opcodes[] = {
1174 AArch64::LD1WB_8B_fixed, AArch64::LD1WB_4H_fixed,
1175 AArch64::LD1WB_2S_fixed, AArch64::LD1WB_1D_fixed,
1176 AArch64::LD1WB_16B_fixed, AArch64::LD1WB_8H_fixed,
1177 AArch64::LD1WB_4S_fixed, AArch64::LD1WB_2D_fixed
1179 return SelectVLD(Node,
true, 1, Opcodes);
1182 static const uint16_t Opcodes[] = {
1183 AArch64::LD2WB_8B_fixed, AArch64::LD2WB_4H_fixed,
1184 AArch64::LD2WB_2S_fixed, AArch64::LD1x2WB_1D_fixed,
1185 AArch64::LD2WB_16B_fixed, AArch64::LD2WB_8H_fixed,
1186 AArch64::LD2WB_4S_fixed, AArch64::LD2WB_2D_fixed
1188 return SelectVLD(Node,
true, 2, Opcodes);
1191 static const uint16_t Opcodes[] = {
1192 AArch64::LD3WB_8B_fixed, AArch64::LD3WB_4H_fixed,
1193 AArch64::LD3WB_2S_fixed, AArch64::LD1x3WB_1D_fixed,
1194 AArch64::LD3WB_16B_fixed, AArch64::LD3WB_8H_fixed,
1195 AArch64::LD3WB_4S_fixed, AArch64::LD3WB_2D_fixed
1197 return SelectVLD(Node,
true, 3, Opcodes);
1200 static const uint16_t Opcodes[] = {
1201 AArch64::LD4WB_8B_fixed, AArch64::LD4WB_4H_fixed,
1202 AArch64::LD4WB_2S_fixed, AArch64::LD1x4WB_1D_fixed,
1203 AArch64::LD4WB_16B_fixed, AArch64::LD4WB_8H_fixed,
1204 AArch64::LD4WB_4S_fixed, AArch64::LD4WB_2D_fixed
1206 return SelectVLD(Node,
true, 4, Opcodes);
1209 static const uint16_t Opcodes[] = {
1210 AArch64::LD1x2WB_8B_fixed, AArch64::LD1x2WB_4H_fixed,
1211 AArch64::LD1x2WB_2S_fixed, AArch64::LD1x2WB_1D_fixed,
1212 AArch64::LD1x2WB_16B_fixed, AArch64::LD1x2WB_8H_fixed,
1213 AArch64::LD1x2WB_4S_fixed, AArch64::LD1x2WB_2D_fixed
1215 return SelectVLD(Node,
true, 2, Opcodes);
1218 static const uint16_t Opcodes[] = {
1219 AArch64::LD1x3WB_8B_fixed, AArch64::LD1x3WB_4H_fixed,
1220 AArch64::LD1x3WB_2S_fixed, AArch64::LD1x3WB_1D_fixed,
1221 AArch64::LD1x3WB_16B_fixed, AArch64::LD1x3WB_8H_fixed,
1222 AArch64::LD1x3WB_4S_fixed, AArch64::LD1x3WB_2D_fixed
1224 return SelectVLD(Node,
true, 3, Opcodes);
1227 static const uint16_t Opcodes[] = {
1228 AArch64::LD1x4WB_8B_fixed, AArch64::LD1x4WB_4H_fixed,
1229 AArch64::LD1x4WB_2S_fixed, AArch64::LD1x4WB_1D_fixed,
1230 AArch64::LD1x4WB_16B_fixed, AArch64::LD1x4WB_8H_fixed,
1231 AArch64::LD1x4WB_4S_fixed, AArch64::LD1x4WB_2D_fixed
1233 return SelectVLD(Node,
true, 4, Opcodes);
1236 static const uint16_t Opcodes[] = {
1237 AArch64::ST1WB_8B_fixed, AArch64::ST1WB_4H_fixed,
1238 AArch64::ST1WB_2S_fixed, AArch64::ST1WB_1D_fixed,
1239 AArch64::ST1WB_16B_fixed, AArch64::ST1WB_8H_fixed,
1240 AArch64::ST1WB_4S_fixed, AArch64::ST1WB_2D_fixed
1242 return SelectVST(Node,
true, 1, Opcodes);
1245 static const uint16_t Opcodes[] = {
1246 AArch64::ST2WB_8B_fixed, AArch64::ST2WB_4H_fixed,
1247 AArch64::ST2WB_2S_fixed, AArch64::ST1x2WB_1D_fixed,
1248 AArch64::ST2WB_16B_fixed, AArch64::ST2WB_8H_fixed,
1249 AArch64::ST2WB_4S_fixed, AArch64::ST2WB_2D_fixed
1251 return SelectVST(Node,
true, 2, Opcodes);
1254 static const uint16_t Opcodes[] = {
1255 AArch64::ST3WB_8B_fixed, AArch64::ST3WB_4H_fixed,
1256 AArch64::ST3WB_2S_fixed, AArch64::ST1x3WB_1D_fixed,
1257 AArch64::ST3WB_16B_fixed, AArch64::ST3WB_8H_fixed,
1258 AArch64::ST3WB_4S_fixed, AArch64::ST3WB_2D_fixed
1260 return SelectVST(Node,
true, 3, Opcodes);
1263 static const uint16_t Opcodes[] = {
1264 AArch64::ST4WB_8B_fixed, AArch64::ST4WB_4H_fixed,
1265 AArch64::ST4WB_2S_fixed, AArch64::ST1x4WB_1D_fixed,
1266 AArch64::ST4WB_16B_fixed, AArch64::ST4WB_8H_fixed,
1267 AArch64::ST4WB_4S_fixed, AArch64::ST4WB_2D_fixed
1269 return SelectVST(Node,
true, 4, Opcodes);
1272 static const uint16_t Opcodes[] = {
1273 AArch64::LD2R_8B, AArch64::LD2R_4H, AArch64::LD2R_2S,
1274 AArch64::LD2R_1D, AArch64::LD2R_16B, AArch64::LD2R_8H,
1275 AArch64::LD2R_4S, AArch64::LD2R_2D
1277 return SelectVLDDup(Node,
false, 2, Opcodes);
1280 static const uint16_t Opcodes[] = {
1281 AArch64::LD3R_8B, AArch64::LD3R_4H, AArch64::LD3R_2S,
1282 AArch64::LD3R_1D, AArch64::LD3R_16B, AArch64::LD3R_8H,
1283 AArch64::LD3R_4S, AArch64::LD3R_2D
1285 return SelectVLDDup(Node,
false, 3, Opcodes);
1288 static const uint16_t Opcodes[] = {
1289 AArch64::LD4R_8B, AArch64::LD4R_4H, AArch64::LD4R_2S,
1290 AArch64::LD4R_1D, AArch64::LD4R_16B, AArch64::LD4R_8H,
1291 AArch64::LD4R_4S, AArch64::LD4R_2D
1293 return SelectVLDDup(Node,
false, 4, Opcodes);
1296 static const uint16_t Opcodes[] = {
1297 AArch64::LD2R_WB_8B_fixed, AArch64::LD2R_WB_4H_fixed,
1298 AArch64::LD2R_WB_2S_fixed, AArch64::LD2R_WB_1D_fixed,
1299 AArch64::LD2R_WB_16B_fixed, AArch64::LD2R_WB_8H_fixed,
1300 AArch64::LD2R_WB_4S_fixed, AArch64::LD2R_WB_2D_fixed
1302 return SelectVLDDup(Node,
true, 2, Opcodes);
1305 static const uint16_t Opcodes[] = {
1306 AArch64::LD3R_WB_8B_fixed, AArch64::LD3R_WB_4H_fixed,
1307 AArch64::LD3R_WB_2S_fixed, AArch64::LD3R_WB_1D_fixed,
1308 AArch64::LD3R_WB_16B_fixed, AArch64::LD3R_WB_8H_fixed,
1309 AArch64::LD3R_WB_4S_fixed, AArch64::LD3R_WB_2D_fixed
1311 return SelectVLDDup(Node,
true, 3, Opcodes);
1314 static const uint16_t Opcodes[] = {
1315 AArch64::LD4R_WB_8B_fixed, AArch64::LD4R_WB_4H_fixed,
1316 AArch64::LD4R_WB_2S_fixed, AArch64::LD4R_WB_1D_fixed,
1317 AArch64::LD4R_WB_16B_fixed, AArch64::LD4R_WB_8H_fixed,
1318 AArch64::LD4R_WB_4S_fixed, AArch64::LD4R_WB_2D_fixed
1320 return SelectVLDDup(Node,
true, 4, Opcodes);
1323 static const uint16_t Opcodes[] = {
1324 AArch64::LD2LN_WB_B_fixed, AArch64::LD2LN_WB_H_fixed,
1325 AArch64::LD2LN_WB_S_fixed, AArch64::LD2LN_WB_D_fixed
1327 return SelectVLDSTLane(Node,
true,
true, 2, Opcodes);
1330 static const uint16_t Opcodes[] = {
1331 AArch64::LD3LN_WB_B_fixed, AArch64::LD3LN_WB_H_fixed,
1332 AArch64::LD3LN_WB_S_fixed, AArch64::LD3LN_WB_D_fixed
1334 return SelectVLDSTLane(Node,
true,
true, 3, Opcodes);
1337 static const uint16_t Opcodes[] = {
1338 AArch64::LD4LN_WB_B_fixed, AArch64::LD4LN_WB_H_fixed,
1339 AArch64::LD4LN_WB_S_fixed, AArch64::LD4LN_WB_D_fixed
1341 return SelectVLDSTLane(Node,
true,
true, 4, Opcodes);
1344 static const uint16_t Opcodes[] = {
1345 AArch64::ST2LN_WB_B_fixed, AArch64::ST2LN_WB_H_fixed,
1346 AArch64::ST2LN_WB_S_fixed, AArch64::ST2LN_WB_D_fixed
1348 return SelectVLDSTLane(Node,
false,
true, 2, Opcodes);
1351 static const uint16_t Opcodes[] = {
1352 AArch64::ST3LN_WB_B_fixed, AArch64::ST3LN_WB_H_fixed,
1353 AArch64::ST3LN_WB_S_fixed, AArch64::ST3LN_WB_D_fixed
1355 return SelectVLDSTLane(Node,
false,
true, 3, Opcodes);
1358 static const uint16_t Opcodes[] = {
1359 AArch64::ST4LN_WB_B_fixed, AArch64::ST4LN_WB_H_fixed,
1360 AArch64::ST4LN_WB_S_fixed, AArch64::ST4LN_WB_D_fixed
1362 return SelectVLDSTLane(Node,
false,
true, 4, Opcodes);
1365 static const uint16_t Opcodes[] = {
1366 AArch64::ST1x2WB_8B_fixed, AArch64::ST1x2WB_4H_fixed,
1367 AArch64::ST1x2WB_2S_fixed, AArch64::ST1x2WB_1D_fixed,
1368 AArch64::ST1x2WB_16B_fixed, AArch64::ST1x2WB_8H_fixed,
1369 AArch64::ST1x2WB_4S_fixed, AArch64::ST1x2WB_2D_fixed
1371 return SelectVST(Node,
true, 2, Opcodes);
1374 static const uint16_t Opcodes[] = {
1375 AArch64::ST1x3WB_8B_fixed, AArch64::ST1x3WB_4H_fixed,
1376 AArch64::ST1x3WB_2S_fixed, AArch64::ST1x3WB_1D_fixed,
1377 AArch64::ST1x3WB_16B_fixed, AArch64::ST1x3WB_8H_fixed,
1378 AArch64::ST1x3WB_4S_fixed, AArch64::ST1x3WB_2D_fixed
1380 return SelectVST(Node,
true, 3, Opcodes);
1383 static const uint16_t Opcodes[] = {
1384 AArch64::ST1x4WB_8B_fixed, AArch64::ST1x4WB_4H_fixed,
1385 AArch64::ST1x4WB_2S_fixed, AArch64::ST1x4WB_1D_fixed,
1386 AArch64::ST1x4WB_16B_fixed, AArch64::ST1x4WB_8H_fixed,
1387 AArch64::ST1x4WB_4S_fixed, AArch64::ST1x4WB_2D_fixed
1389 return SelectVST(Node,
true, 4, Opcodes);
1392 unsigned IntNo = cast<ConstantSDNode>(Node->
getOperand(0))->getZExtValue();
1400 return SelectVTBL(Node, 1, IsExt);
1404 return SelectVTBL(Node, 2, IsExt);
1408 return SelectVTBL(Node, 3, IsExt);
1412 return SelectVTBL(Node, 4, IsExt);
1418 unsigned IntNo = cast<ConstantSDNode>(Node->
getOperand(1))->getZExtValue();
1423 static const uint16_t Opcodes[] = {
1424 AArch64::LD1_8B, AArch64::LD1_4H, AArch64::LD1_2S, AArch64::LD1_1D,
1425 AArch64::LD1_16B, AArch64::LD1_8H, AArch64::LD1_4S, AArch64::LD1_2D
1427 return SelectVLD(Node,
false, 1, Opcodes);
1430 static const uint16_t Opcodes[] = {
1431 AArch64::LD2_8B, AArch64::LD2_4H, AArch64::LD2_2S, AArch64::LD1x2_1D,
1432 AArch64::LD2_16B, AArch64::LD2_8H, AArch64::LD2_4S, AArch64::LD2_2D
1434 return SelectVLD(Node,
false, 2, Opcodes);
1437 static const uint16_t Opcodes[] = {
1438 AArch64::LD3_8B, AArch64::LD3_4H, AArch64::LD3_2S, AArch64::LD1x3_1D,
1439 AArch64::LD3_16B, AArch64::LD3_8H, AArch64::LD3_4S, AArch64::LD3_2D
1441 return SelectVLD(Node,
false, 3, Opcodes);
1444 static const uint16_t Opcodes[] = {
1445 AArch64::LD4_8B, AArch64::LD4_4H, AArch64::LD4_2S, AArch64::LD1x4_1D,
1446 AArch64::LD4_16B, AArch64::LD4_8H, AArch64::LD4_4S, AArch64::LD4_2D
1448 return SelectVLD(Node,
false, 4, Opcodes);
1451 static const uint16_t Opcodes[] = {
1452 AArch64::LD1x2_8B, AArch64::LD1x2_4H, AArch64::LD1x2_2S,
1453 AArch64::LD1x2_1D, AArch64::LD1x2_16B, AArch64::LD1x2_8H,
1454 AArch64::LD1x2_4S, AArch64::LD1x2_2D
1456 return SelectVLD(Node,
false, 2, Opcodes);
1459 static const uint16_t Opcodes[] = {
1460 AArch64::LD1x3_8B, AArch64::LD1x3_4H, AArch64::LD1x3_2S,
1461 AArch64::LD1x3_1D, AArch64::LD1x3_16B, AArch64::LD1x3_8H,
1462 AArch64::LD1x3_4S, AArch64::LD1x3_2D
1464 return SelectVLD(Node,
false, 3, Opcodes);
1467 static const uint16_t Opcodes[] = {
1468 AArch64::LD1x4_8B, AArch64::LD1x4_4H, AArch64::LD1x4_2S,
1469 AArch64::LD1x4_1D, AArch64::LD1x4_16B, AArch64::LD1x4_8H,
1470 AArch64::LD1x4_4S, AArch64::LD1x4_2D
1472 return SelectVLD(Node,
false, 4, Opcodes);
1475 static const uint16_t Opcodes[] = {
1476 AArch64::ST1_8B, AArch64::ST1_4H, AArch64::ST1_2S, AArch64::ST1_1D,
1477 AArch64::ST1_16B, AArch64::ST1_8H, AArch64::ST1_4S, AArch64::ST1_2D
1479 return SelectVST(Node,
false, 1, Opcodes);
1482 static const uint16_t Opcodes[] = {
1483 AArch64::ST2_8B, AArch64::ST2_4H, AArch64::ST2_2S, AArch64::ST1x2_1D,
1484 AArch64::ST2_16B, AArch64::ST2_8H, AArch64::ST2_4S, AArch64::ST2_2D
1486 return SelectVST(Node,
false, 2, Opcodes);
1489 static const uint16_t Opcodes[] = {
1490 AArch64::ST3_8B, AArch64::ST3_4H, AArch64::ST3_2S, AArch64::ST1x3_1D,
1491 AArch64::ST3_16B, AArch64::ST3_8H, AArch64::ST3_4S, AArch64::ST3_2D
1493 return SelectVST(Node,
false, 3, Opcodes);
1496 static const uint16_t Opcodes[] = {
1497 AArch64::ST4_8B, AArch64::ST4_4H, AArch64::ST4_2S, AArch64::ST1x4_1D,
1498 AArch64::ST4_16B, AArch64::ST4_8H, AArch64::ST4_4S, AArch64::ST4_2D
1500 return SelectVST(Node,
false, 4, Opcodes);
1503 static const uint16_t Opcodes[] = {
1504 AArch64::ST1x2_8B, AArch64::ST1x2_4H, AArch64::ST1x2_2S,
1505 AArch64::ST1x2_1D, AArch64::ST1x2_16B, AArch64::ST1x2_8H,
1506 AArch64::ST1x2_4S, AArch64::ST1x2_2D
1508 return SelectVST(Node,
false, 2, Opcodes);
1511 static const uint16_t Opcodes[] = {
1512 AArch64::ST1x3_8B, AArch64::ST1x3_4H, AArch64::ST1x3_2S,
1513 AArch64::ST1x3_1D, AArch64::ST1x3_16B, AArch64::ST1x3_8H,
1514 AArch64::ST1x3_4S, AArch64::ST1x3_2D
1516 return SelectVST(Node,
false, 3, Opcodes);
1519 static const uint16_t Opcodes[] = {
1520 AArch64::ST1x4_8B, AArch64::ST1x4_4H, AArch64::ST1x4_2S,
1521 AArch64::ST1x4_1D, AArch64::ST1x4_16B, AArch64::ST1x4_8H,
1522 AArch64::ST1x4_4S, AArch64::ST1x4_2D
1524 return SelectVST(Node,
false, 4, Opcodes);
1527 static const uint16_t Opcodes[] = {
1528 AArch64::LD2LN_B, AArch64::LD2LN_H, AArch64::LD2LN_S, AArch64::LD2LN_D
1530 return SelectVLDSTLane(Node,
true,
false, 2, Opcodes);
1533 static const uint16_t Opcodes[] = {
1534 AArch64::LD3LN_B, AArch64::LD3LN_H, AArch64::LD3LN_S, AArch64::LD3LN_D
1536 return SelectVLDSTLane(Node,
true,
false, 3, Opcodes);
1539 static const uint16_t Opcodes[] = {
1540 AArch64::LD4LN_B, AArch64::LD4LN_H, AArch64::LD4LN_S, AArch64::LD4LN_D
1542 return SelectVLDSTLane(Node,
true,
false, 4, Opcodes);
1545 static const uint16_t Opcodes[] = {
1546 AArch64::ST2LN_B, AArch64::ST2LN_H, AArch64::ST2LN_S, AArch64::ST2LN_D
1548 return SelectVLDSTLane(Node,
false,
false, 2, Opcodes);
1551 static const uint16_t Opcodes[] = {
1552 AArch64::ST3LN_B, AArch64::ST3LN_H, AArch64::ST3LN_S, AArch64::ST3LN_D
1554 return SelectVLDSTLane(Node,
false,
false, 3, Opcodes);
1557 static const uint16_t Opcodes[] = {
1558 AArch64::ST4LN_B, AArch64::ST4LN_H, AArch64::ST4LN_S, AArch64::ST4LN_D
1560 return SelectVLDSTLane(Node,
false,
false, 4, Opcodes);
1569 SDNode *ResNode = SelectCode(Node);
1572 if (ResNode == NULL || ResNode == Node)
1575 ResNode->
dump(CurDAG);
1585 return new AArch64DAGToDAGISel(TM, OptLevel);
void push_back(const T &Elt)
bool isMOVNImm(int RegWidth, uint64_t Value, int &UImm16, int &Shift)
void dump() const
dump - Dump this node, for debugging.
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getOpcode() const
unsigned getNumOperands() const
const SDValue & getOperand(unsigned Num) const
static MachinePointerInfo getConstantPool()
void setNodeId(int Id)
setNodeId - Set unique node id.
bool isLogicalImm(unsigned RegWidth, uint64_t Imm, uint32_t &Bits)
opStatus convertToInteger(integerPart *, unsigned int, bool, roundingMode, bool *) const
#define llvm_unreachable(msg)
bool isMOVZImm(int RegWidth, uint64_t Value, int &UImm16, int &Shift)
EVT getValueType(unsigned ResNo) const
EVT getScalarType() const
EVT getVectorElementType() const
AtomicOrdering getOrdering() const
EVT getMemoryVT() const
getMemoryVT - Return the type of the in-memory value.
size_t size() const
size - Get the array size.
SDNode * getNode() const
get the SDNode which holds the desired result
static unsigned getVLDSTRegisterUpdateOpcode(unsigned Opc)
LLVM Constant Representation.
const Constant * getConstVal() const
const APFloat & getValueAPF() const
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements)
Promote Memory to Register
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
op_iterator op_begin() const
bool isPowerOf2_64(uint64_t Value)
unsigned getSizeInBits() const
getSizeInBits - Return the size of the specified value type in bits.
FunctionPass * createAArch64ISelDAG(AArch64TargetMachine &TM, CodeGenOpt::Level OptLevel)
bool isFPImm(const APFloat &Val, uint32_t &Imm8Bits)
bool is64BitVector() const
is64BitVector - Return true if this is a 64-bit vector type.
unsigned Log2_64(uint64_t Value)
bool isMachineOpcode() const
uint64_t getZExtValue() const
unsigned getVectorNumElements() const