28 if (FirstMI ==
nullptr)
40 case AArch64::ADDSWri:
41 case AArch64::ADDSWrr:
42 case AArch64::ADDSXri:
43 case AArch64::ADDSXrr:
44 case AArch64::ANDSWri:
45 case AArch64::ANDSWrr:
46 case AArch64::ANDSXri:
47 case AArch64::ANDSXrr:
48 case AArch64::SUBSWri:
49 case AArch64::SUBSWrr:
50 case AArch64::SUBSXri:
51 case AArch64::SUBSXrr:
52 case AArch64::BICSWrr:
53 case AArch64::BICSXrr:
55 case AArch64::ADDSWrs:
56 case AArch64::ADDSXrs:
57 case AArch64::ANDSWrs:
58 case AArch64::ANDSXrs:
59 case AArch64::SUBSWrs:
60 case AArch64::SUBSXrs:
61 case AArch64::BICSWrs:
62 case AArch64::BICSXrs:
64 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
73 if (SecondMI.
getOpcode() != AArch64::CBZW &&
84 if (FirstMI ==
nullptr)
100 case AArch64::ORRWri:
101 case AArch64::ORRWrr:
102 case AArch64::ORRXri:
103 case AArch64::ORRXrr:
104 case AArch64::ORNWrr:
105 case AArch64::ORNXrr:
106 case AArch64::SUBWri:
107 case AArch64::SUBWrr:
108 case AArch64::SUBXri:
109 case AArch64::SUBXrr:
110 case AArch64::BICWrr:
111 case AArch64::BICXrr:
113 case AArch64::ADDWrs:
114 case AArch64::ADDXrs:
115 case AArch64::ANDWrs:
116 case AArch64::ANDXrs:
117 case AArch64::EORWrs:
118 case AArch64::EORXrs:
119 case AArch64::ORNWrs:
120 case AArch64::ORNXrs:
121 case AArch64::ORRWrs:
122 case AArch64::ORRXrs:
123 case AArch64::SUBWrs:
124 case AArch64::SUBXrs:
125 case AArch64::BICWrs:
126 case AArch64::BICXrs:
128 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
143 return DestFirst == DestSecond;
150 unsigned SecondOpcode = SecondMI.
getOpcode();
151 switch (SecondOpcode) {
153 case AArch64::AESMCrr:
154 case AArch64::AESMCrrTied:
155 if (FirstMI ==
nullptr)
157 if (FirstMI->
getOpcode() != AArch64::AESErr)
159 return SecondOpcode == AArch64::AESMCrrTied ||
162 case AArch64::AESIMCrr:
163 case AArch64::AESIMCrrTied:
164 if (FirstMI ==
nullptr)
166 if (FirstMI->
getOpcode() != AArch64::AESDrr)
168 return SecondOpcode == AArch64::AESIMCrrTied ||
178 if (SecondMI.
getOpcode() != AArch64::EORv16i8)
182 if (FirstMI ==
nullptr)
186 case AArch64::AESErr:
187 case AArch64::AESDrr:
188 case AArch64::PMULLv16i8:
189 case AArch64::PMULLv8i8:
190 case AArch64::PMULLv1i64:
191 case AArch64::PMULLv2i64:
201 if ((FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::ADRP) &&
212 if ((FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::MOVZWi) &&
213 (SecondMI.
getOpcode() == AArch64::MOVKWi &&
218 if((FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::MOVZXi) &&
219 (SecondMI.
getOpcode() == AArch64::MOVKXi &&
224 if ((FirstMI ==
nullptr ||
225 (FirstMI->
getOpcode() == AArch64::MOVKXi &&
227 (SecondMI.
getOpcode() == AArch64::MOVKXi &&
238 case AArch64::STRBBui:
239 case AArch64::STRBui:
240 case AArch64::STRDui:
241 case AArch64::STRHHui:
242 case AArch64::STRHui:
243 case AArch64::STRQui:
244 case AArch64::STRSui:
245 case AArch64::STRWui:
246 case AArch64::STRXui:
247 case AArch64::LDRBBui:
248 case AArch64::LDRBui:
249 case AArch64::LDRDui:
250 case AArch64::LDRHHui:
251 case AArch64::LDRHui:
252 case AArch64::LDRQui:
253 case AArch64::LDRSui:
254 case AArch64::LDRWui:
255 case AArch64::LDRXui:
256 case AArch64::LDRSBWui:
257 case AArch64::LDRSBXui:
258 case AArch64::LDRSHWui:
259 case AArch64::LDRSHXui:
260 case AArch64::LDRSWui:
262 if (FirstMI ==
nullptr)
280 if (SecondMI.
getOpcode() == AArch64::CSELWr) {
282 if (FirstMI ==
nullptr)
287 case AArch64::SUBSWrs:
288 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
289 case AArch64::SUBSWrx:
290 return !AArch64InstrInfo::hasExtendedReg(*FirstMI);
291 case AArch64::SUBSWrr:
292 case AArch64::SUBSWri:
298 if (SecondMI.
getOpcode() == AArch64::CSELXr) {
300 if (FirstMI ==
nullptr)
305 case AArch64::SUBSXrs:
306 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
307 case AArch64::SUBSXrx:
308 case AArch64::SUBSXrx64:
309 return !AArch64InstrInfo::hasExtendedReg(*FirstMI);
310 case AArch64::SUBSXrr:
311 case AArch64::SUBSXri:
323 case AArch64::FCSELSrrr:
324 case AArch64::FCSELDrrr:
325 case AArch64::FCSELHrrr:
332 if (FirstMI ==
nullptr)
336 case AArch64::FCMPSrr:
337 case AArch64::FCMPDrr:
338 case AArch64::FCMPESrr:
339 case AArch64::FCMPEDrr:
340 case AArch64::FCMPHrr:
341 case AArch64::FCMPEHrr:
351 if ((SecondMI.
getOpcode() == AArch64::CSINCWr &&
354 (SecondMI.
getOpcode() == AArch64::CSINCXr &&
358 if (FirstMI ==
nullptr)
364 case AArch64::SUBSWrs:
365 case AArch64::SUBSXrs:
366 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
367 case AArch64::SUBSWrx:
368 case AArch64::SUBSXrx:
369 case AArch64::SUBSXrx64:
370 return !AArch64InstrInfo::hasExtendedReg(*FirstMI);
371 case AArch64::SUBSWri:
372 case AArch64::SUBSWrr:
373 case AArch64::SUBSXri:
374 case AArch64::SUBSXrr:
385 if (AArch64InstrInfo::hasShiftedReg(SecondMI))
390 case AArch64::ADDWrr:
391 case AArch64::ADDXrr:
392 case AArch64::SUBWrr:
393 case AArch64::SUBXrr:
394 case AArch64::ADDWrs:
395 case AArch64::ADDXrs:
396 case AArch64::SUBWrs:
397 case AArch64::SUBXrs:
399 case AArch64::ANDWrr:
400 case AArch64::ANDXrr:
401 case AArch64::BICWrr:
402 case AArch64::BICXrr:
403 case AArch64::EONWrr:
404 case AArch64::EONXrr:
405 case AArch64::EORWrr:
406 case AArch64::EORXrr:
407 case AArch64::ORNWrr:
408 case AArch64::ORNXrr:
409 case AArch64::ORRWrr:
410 case AArch64::ORRXrr:
411 case AArch64::ANDWrs:
412 case AArch64::ANDXrs:
413 case AArch64::BICWrs:
414 case AArch64::BICXrs:
415 case AArch64::EONWrs:
416 case AArch64::EONXrs:
417 case AArch64::EORWrs:
418 case AArch64::EORXrs:
419 case AArch64::ORNWrs:
420 case AArch64::ORNXrs:
421 case AArch64::ORRWrs:
422 case AArch64::ORRXrs:
424 if (FirstMI ==
nullptr)
429 case AArch64::ADDWrr:
430 case AArch64::ADDXrr:
431 case AArch64::ADDSWrr:
432 case AArch64::ADDSXrr:
433 case AArch64::SUBWrr:
434 case AArch64::SUBXrr:
435 case AArch64::SUBSWrr:
436 case AArch64::SUBSXrr:
438 case AArch64::ADDWrs:
439 case AArch64::ADDXrs:
440 case AArch64::ADDSWrs:
441 case AArch64::ADDSXrs:
442 case AArch64::SUBWrs:
443 case AArch64::SUBXrs:
444 case AArch64::SUBSWrs:
445 case AArch64::SUBSXrs:
446 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
451 case AArch64::ADDSWrr:
452 case AArch64::ADDSXrr:
453 case AArch64::SUBSWrr:
454 case AArch64::SUBSXrr:
455 case AArch64::ADDSWrs:
456 case AArch64::ADDSXrs:
457 case AArch64::SUBSWrs:
458 case AArch64::SUBSXrs:
460 if (FirstMI ==
nullptr)
465 case AArch64::ADDWrr:
466 case AArch64::ADDXrr:
467 case AArch64::SUBWrr:
468 case AArch64::SUBXrr:
470 case AArch64::ADDWrs:
471 case AArch64::ADDXrs:
472 case AArch64::SUBWrs:
473 case AArch64::SUBXrs:
474 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
485 bool NeedsSubtract =
false;
489 case AArch64::SUBWri:
490 case AArch64::SUBXri:
491 NeedsSubtract =
true;
493 case AArch64::ADDWri:
494 case AArch64::ADDXri:
507 if (FirstMI ==
nullptr) {
512 case AArch64::SUBWrs:
513 case AArch64::SUBXrs:
514 if (AArch64InstrInfo::hasShiftedReg(*FirstMI))
517 case AArch64::SUBWrr:
518 case AArch64::SUBXrr:
524 case AArch64::ADDWrs:
525 case AArch64::ADDXrs:
526 if (AArch64InstrInfo::hasShiftedReg(*FirstMI))
529 case AArch64::ADDWrr:
530 case AArch64::ADDXrr:
531 if (!NeedsSubtract) {
551 if (ST.hasCmpBccFusion() || ST.hasArithmeticBccFusion()) {
552 bool CmpOnly = !ST.hasArithmeticBccFusion();
558 if (ST.hasFuseAES() &&
isAESPair(FirstMI, SecondMI))
576 if (ST.hasFuseAddSub2RegAndConstOne() &&
583std::unique_ptr<ScheduleDAGMutation>
static bool isFCmpFCSelPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Floating-point compare and floating-point conditional select.
static bool isAddSub2RegAndConstOnePair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool isCmpCSelPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Compare and conditional select.
static bool isArithmeticBccPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI, bool CmpOnly)
CMN, CMP, TST followed by Bcc.
static bool isAddressLdStPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Fuse address generation and loads or stores.
static bool isArithmeticCbzPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
ALU operations followed by CBZ/CBNZ.
static bool shouldScheduleAdjacent(const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Check if the instr pair, FirstMI and SecondMI, should be fused together.
static bool isAESPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
AES crypto encoding or decoding.
static bool isCmpCSetPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Compare and cset.
static bool isAdrpAddPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool mayHaveWAWDependency(const MachineInstr &FirstMI, const MachineInstr &SecondMI)
static bool isArithmeticLogicPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool isCryptoEORPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
AESE/AESD/PMULL + EOR.
static bool isLiteralsPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Literal generation.
const HexagonInstrInfo * TII
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool definesRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr fully defines the specified register.
const MachineOperand & getOperand(unsigned i) const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
Register getReg() const
getReg - Returns the register number.
Wrapper class representing virtual and physical registers.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
TargetInstrInfo - Interface to description of machine instruction set.
TargetSubtargetInfo - Generic base class for all target subtargets.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::unique_ptr< ScheduleDAGMutation > createMacroFusionDAGMutation(ArrayRef< MacroFusionPredTy > Predicates, bool BranchOnly=false)
Create a DAG scheduling mutation to pair instructions back to back for instructions that benefit acco...
std::unique_ptr< ScheduleDAGMutation > createAArch64MacroFusionDAGMutation()
Note that you have to add: DAG.addMutation(createAArch64MacroFusionDAGMutation()); to AArch64TargetMa...
static bool shouldScheduleAdjacent(const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Check if the instr pair, FirstMI and SecondMI, should be fused together.