1 //===----- HexagonPacketizer.cpp - vliw packetizer ---------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This implements a simple VLIW packetizer using DFA. The packetizer works on
11 // machine basic blocks. For each instruction I in BB, the packetizer consults
12 // the DFA to see if machine resources are available to execute I. If so, the
13 // packetizer checks if I depends on any instruction J in the current packet.
14 // If no dependency is found, I is added to current packet and machine resource
15 // is marked as taken. If any dependency is found, a target API call is made to
16 // prune the dependence.
18 //===----------------------------------------------------------------------===//
19 #define DEBUG_TYPE "packets"
20 #include "llvm/CodeGen/DFAPacketizer.h"
21 #include "llvm/CodeGen/Passes.h"
22 #include "llvm/CodeGen/MachineDominators.h"
23 #include "llvm/CodeGen/MachineFunctionPass.h"
24 #include "llvm/CodeGen/MachineLoopInfo.h"
25 #include "llvm/CodeGen/ScheduleDAG.h"
26 #include "llvm/CodeGen/ScheduleDAGInstrs.h"
27 #include "llvm/CodeGen/LatencyPriorityQueue.h"
28 #include "llvm/CodeGen/SchedulerRegistry.h"
29 #include "llvm/CodeGen/MachineFrameInfo.h"
30 #include "llvm/CodeGen/MachineInstrBuilder.h"
31 #include "llvm/CodeGen/MachineRegisterInfo.h"
32 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
33 #include "llvm/CodeGen/ScheduleHazardRecognizer.h"
34 #include "llvm/Target/TargetMachine.h"
35 #include "llvm/Target/TargetInstrInfo.h"
36 #include "llvm/Target/TargetRegisterInfo.h"
37 #include "llvm/ADT/DenseMap.h"
38 #include "llvm/ADT/Statistic.h"
39 #include "llvm/Support/MathExtras.h"
40 #include "llvm/MC/MCInstrItineraries.h"
41 #include "llvm/Support/Compiler.h"
42 #include "llvm/Support/CommandLine.h"
43 #include "llvm/Support/Debug.h"
45 #include "HexagonTargetMachine.h"
46 #include "HexagonRegisterInfo.h"
47 #include "HexagonSubtarget.h"
48 #include "HexagonMachineFunctionInfo.h"
55 class HexagonPacketizer : public MachineFunctionPass {
59 HexagonPacketizer() : MachineFunctionPass(ID) {}
61 void getAnalysisUsage(AnalysisUsage &AU) const {
63 AU.addRequired<MachineDominatorTree>();
64 AU.addPreserved<MachineDominatorTree>();
65 AU.addRequired<MachineLoopInfo>();
66 AU.addPreserved<MachineLoopInfo>();
67 MachineFunctionPass::getAnalysisUsage(AU);
70 const char *getPassName() const {
71 return "Hexagon Packetizer";
74 bool runOnMachineFunction(MachineFunction &Fn);
76 char HexagonPacketizer::ID = 0;
78 class HexagonPacketizerList : public VLIWPacketizerList {
82 // Has the instruction been promoted to a dot-new instruction.
83 bool PromotedToDotNew;
85 // Has the instruction been glued to allocframe.
86 bool GlueAllocframeStore;
88 // Has the feeder instruction been glued to new value jump.
89 bool GlueToNewValueJump;
91 // Check if there is a dependence between some instruction already in this
92 // packet and this instruction.
95 // Only check for dependence if there are resources available to
96 // schedule this instruction.
97 bool FoundSequentialDependence;
101 HexagonPacketizerList(MachineFunction &MF, MachineLoopInfo &MLI,
102 MachineDominatorTree &MDT);
104 // initPacketizerState - initialize some internal flags.
105 void initPacketizerState(void);
107 // ignorePseudoInstruction - Ignore bundling of pseudo instructions.
108 bool ignorePseudoInstruction(MachineInstr *MI, MachineBasicBlock *MBB);
110 // isSoloInstruction - return true if instruction MI can not be packetized
111 // with any other instruction, which means that MI itself is a packet.
112 bool isSoloInstruction(MachineInstr *MI);
114 // isLegalToPacketizeTogether - Is it legal to packetize SUI and SUJ
116 bool isLegalToPacketizeTogether(SUnit *SUI, SUnit *SUJ);
118 // isLegalToPruneDependencies - Is it legal to prune dependece between SUI
120 bool isLegalToPruneDependencies(SUnit *SUI, SUnit *SUJ);
122 MachineBasicBlock::iterator addToPacket(MachineInstr *MI);
124 bool IsCallDependent(MachineInstr* MI, SDep::Kind DepType, unsigned DepReg);
125 bool PromoteToDotNew(MachineInstr* MI, SDep::Kind DepType,
126 MachineBasicBlock::iterator &MII,
127 const TargetRegisterClass* RC);
128 bool CanPromoteToDotNew(MachineInstr* MI, SUnit* PacketSU,
130 std::map <MachineInstr*, SUnit*> MIToSUnit,
131 MachineBasicBlock::iterator &MII,
132 const TargetRegisterClass* RC);
133 bool CanPromoteToNewValue(MachineInstr* MI, SUnit* PacketSU,
135 std::map <MachineInstr*, SUnit*> MIToSUnit,
136 MachineBasicBlock::iterator &MII);
137 bool CanPromoteToNewValueStore(MachineInstr* MI, MachineInstr* PacketMI,
139 std::map <MachineInstr*, SUnit*> MIToSUnit);
140 bool DemoteToDotOld(MachineInstr* MI);
141 bool ArePredicatesComplements(MachineInstr* MI1, MachineInstr* MI2,
142 std::map <MachineInstr*, SUnit*> MIToSUnit);
143 bool RestrictingDepExistInPacket(MachineInstr*,
144 unsigned, std::map <MachineInstr*, SUnit*>);
145 bool isNewifiable(MachineInstr* MI);
146 bool isCondInst(MachineInstr* MI);
147 bool IsNewifyStore (MachineInstr* MI);
148 bool tryAllocateResourcesForConstExt(MachineInstr* MI);
149 bool canReserveResourcesForConstExt(MachineInstr *MI);
150 void reserveResourcesForConstExt(MachineInstr* MI);
151 bool isNewValueInst(MachineInstr* MI);
152 bool isDotNewInst(MachineInstr* MI);
156 // HexagonPacketizerList Ctor.
157 HexagonPacketizerList::HexagonPacketizerList(
158 MachineFunction &MF, MachineLoopInfo &MLI,MachineDominatorTree &MDT)
159 : VLIWPacketizerList(MF, MLI, MDT, true){
162 bool HexagonPacketizer::runOnMachineFunction(MachineFunction &Fn) {
163 const TargetInstrInfo *TII = Fn.getTarget().getInstrInfo();
164 MachineLoopInfo &MLI = getAnalysis<MachineLoopInfo>();
165 MachineDominatorTree &MDT = getAnalysis<MachineDominatorTree>();
167 // Instantiate the packetizer.
168 HexagonPacketizerList Packetizer(Fn, MLI, MDT);
170 // DFA state table should not be empty.
171 assert(Packetizer.getResourceTracker() && "Empty DFA table!");
174 // Loop over all basic blocks and remove KILL pseudo-instructions
175 // These instructions confuse the dependence analysis. Consider:
177 // R0 = KILL R0, D0 (Insn 1)
179 // Here, Insn 1 will result in the dependence graph not emitting an output
180 // dependence between Insn 0 and Insn 2. This can lead to incorrect
183 for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
184 MBB != MBBe; ++MBB) {
185 MachineBasicBlock::iterator End = MBB->end();
186 MachineBasicBlock::iterator MI = MBB->begin();
189 MachineBasicBlock::iterator DeleteMI = MI;
191 MBB->erase(DeleteMI);
199 // Loop over all of the basic blocks.
200 for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
201 MBB != MBBe; ++MBB) {
202 // Find scheduling regions and schedule / packetize each region.
203 unsigned RemainingCount = MBB->size();
204 for(MachineBasicBlock::iterator RegionEnd = MBB->end();
205 RegionEnd != MBB->begin();) {
206 // The next region starts above the previous region. Look backward in the
207 // instruction stream until we find the nearest boundary.
208 MachineBasicBlock::iterator I = RegionEnd;
209 for(;I != MBB->begin(); --I, --RemainingCount) {
210 if (TII->isSchedulingBoundary(llvm::prior(I), MBB, Fn))
215 // Skip empty scheduling regions.
216 if (I == RegionEnd) {
217 RegionEnd = llvm::prior(RegionEnd);
221 // Skip regions with one instruction.
222 if (I == llvm::prior(RegionEnd)) {
223 RegionEnd = llvm::prior(RegionEnd);
227 Packetizer.PacketizeMIs(MBB, I, RegionEnd);
236 static bool IsIndirectCall(MachineInstr* MI) {
237 return ((MI->getOpcode() == Hexagon::CALLR) ||
238 (MI->getOpcode() == Hexagon::CALLRv3));
241 // Reserve resources for constant extender. Trigure an assertion if
243 void HexagonPacketizerList::reserveResourcesForConstExt(MachineInstr* MI) {
244 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
245 MachineInstr *PseudoMI = MI->getParent()->getParent()->CreateMachineInstr(
246 QII->get(Hexagon::IMMEXT), MI->getDebugLoc());
248 if (ResourceTracker->canReserveResources(PseudoMI)) {
249 ResourceTracker->reserveResources(PseudoMI);
250 MI->getParent()->getParent()->DeleteMachineInstr(PseudoMI);
252 MI->getParent()->getParent()->DeleteMachineInstr(PseudoMI);
253 llvm_unreachable("can not reserve resources for constant extender.");
258 bool HexagonPacketizerList::canReserveResourcesForConstExt(MachineInstr *MI) {
259 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
260 assert(QII->isExtended(MI) &&
261 "Should only be called for constant extended instructions");
262 MachineFunction *MF = MI->getParent()->getParent();
263 MachineInstr *PseudoMI = MF->CreateMachineInstr(QII->get(Hexagon::IMMEXT),
265 bool CanReserve = ResourceTracker->canReserveResources(PseudoMI);
266 MF->DeleteMachineInstr(PseudoMI);
270 // Allocate resources (i.e. 4 bytes) for constant extender. If succeed, return
271 // true, otherwise, return false.
272 bool HexagonPacketizerList::tryAllocateResourcesForConstExt(MachineInstr* MI) {
273 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
274 MachineInstr *PseudoMI = MI->getParent()->getParent()->CreateMachineInstr(
275 QII->get(Hexagon::IMMEXT), MI->getDebugLoc());
277 if (ResourceTracker->canReserveResources(PseudoMI)) {
278 ResourceTracker->reserveResources(PseudoMI);
279 MI->getParent()->getParent()->DeleteMachineInstr(PseudoMI);
282 MI->getParent()->getParent()->DeleteMachineInstr(PseudoMI);
288 bool HexagonPacketizerList::IsCallDependent(MachineInstr* MI,
292 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
293 const HexagonRegisterInfo* QRI = (const HexagonRegisterInfo *) TM.getRegisterInfo();
295 // Check for lr dependence
296 if (DepReg == QRI->getRARegister()) {
300 if (QII->isDeallocRet(MI)) {
301 if (DepReg == QRI->getFrameRegister() ||
302 DepReg == QRI->getStackRegister())
306 // Check if this is a predicate dependence
307 const TargetRegisterClass* RC = QRI->getMinimalPhysRegClass(DepReg);
308 if (RC == &Hexagon::PredRegsRegClass) {
313 // Lastly check for an operand used in an indirect call
314 // If we had an attribute for checking if an instruction is an indirect call,
315 // then we could have avoided this relatively brittle implementation of
318 // Assumes that the first operand of the CALLr is the function address
320 if (IsIndirectCall(MI) && (DepType == SDep::Data)) {
321 MachineOperand MO = MI->getOperand(0);
322 if (MO.isReg() && MO.isUse() && (MO.getReg() == DepReg)) {
330 static bool IsRegDependence(const SDep::Kind DepType) {
331 return (DepType == SDep::Data || DepType == SDep::Anti ||
332 DepType == SDep::Output);
335 static bool IsDirectJump(MachineInstr* MI) {
336 return (MI->getOpcode() == Hexagon::JMP);
339 static bool IsSchedBarrier(MachineInstr* MI) {
340 switch (MI->getOpcode()) {
341 case Hexagon::BARRIER:
347 static bool IsControlFlow(MachineInstr* MI) {
348 return (MI->getDesc().isTerminator() || MI->getDesc().isCall());
351 bool HexagonPacketizerList::isNewValueInst(MachineInstr* MI) {
352 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
353 if (QII->isNewValueJump(MI))
356 if (QII->isNewValueStore(MI))
362 // Function returns true if an instruction can be promoted to the new-value
363 // store. It will always return false for v2 and v3.
364 // It lists all the conditional and unconditional stores that can be promoted
365 // to the new-value stores.
367 bool HexagonPacketizerList::IsNewifyStore (MachineInstr* MI) {
368 const HexagonRegisterInfo* QRI = (const HexagonRegisterInfo *) TM.getRegisterInfo();
369 switch (MI->getOpcode())
373 case Hexagon::STrib_indexed:
374 case Hexagon::STrib_indexed_shl_V4:
375 case Hexagon::STrib_shl_V4:
376 case Hexagon::STrib_GP_V4:
377 case Hexagon::STb_GP_V4:
378 case Hexagon::POST_STbri:
379 case Hexagon::STrib_cPt:
380 case Hexagon::STrib_cdnPt_V4:
381 case Hexagon::STrib_cNotPt:
382 case Hexagon::STrib_cdnNotPt_V4:
383 case Hexagon::STrib_indexed_cPt:
384 case Hexagon::STrib_indexed_cdnPt_V4:
385 case Hexagon::STrib_indexed_cNotPt:
386 case Hexagon::STrib_indexed_cdnNotPt_V4:
387 case Hexagon::STrib_indexed_shl_cPt_V4:
388 case Hexagon::STrib_indexed_shl_cdnPt_V4:
389 case Hexagon::STrib_indexed_shl_cNotPt_V4:
390 case Hexagon::STrib_indexed_shl_cdnNotPt_V4:
391 case Hexagon::POST_STbri_cPt:
392 case Hexagon::POST_STbri_cdnPt_V4:
393 case Hexagon::POST_STbri_cNotPt:
394 case Hexagon::POST_STbri_cdnNotPt_V4:
395 case Hexagon::STb_GP_cPt_V4:
396 case Hexagon::STb_GP_cNotPt_V4:
397 case Hexagon::STb_GP_cdnPt_V4:
398 case Hexagon::STb_GP_cdnNotPt_V4:
399 case Hexagon::STrib_GP_cPt_V4:
400 case Hexagon::STrib_GP_cNotPt_V4:
401 case Hexagon::STrib_GP_cdnPt_V4:
402 case Hexagon::STrib_GP_cdnNotPt_V4:
406 case Hexagon::STrih_indexed:
407 case Hexagon::STrih_indexed_shl_V4:
408 case Hexagon::STrih_shl_V4:
409 case Hexagon::STrih_GP_V4:
410 case Hexagon::STh_GP_V4:
411 case Hexagon::POST_SThri:
412 case Hexagon::STrih_cPt:
413 case Hexagon::STrih_cdnPt_V4:
414 case Hexagon::STrih_cNotPt:
415 case Hexagon::STrih_cdnNotPt_V4:
416 case Hexagon::STrih_indexed_cPt:
417 case Hexagon::STrih_indexed_cdnPt_V4:
418 case Hexagon::STrih_indexed_cNotPt:
419 case Hexagon::STrih_indexed_cdnNotPt_V4:
420 case Hexagon::STrih_indexed_shl_cPt_V4:
421 case Hexagon::STrih_indexed_shl_cdnPt_V4:
422 case Hexagon::STrih_indexed_shl_cNotPt_V4:
423 case Hexagon::STrih_indexed_shl_cdnNotPt_V4:
424 case Hexagon::POST_SThri_cPt:
425 case Hexagon::POST_SThri_cdnPt_V4:
426 case Hexagon::POST_SThri_cNotPt:
427 case Hexagon::POST_SThri_cdnNotPt_V4:
428 case Hexagon::STh_GP_cPt_V4:
429 case Hexagon::STh_GP_cNotPt_V4:
430 case Hexagon::STh_GP_cdnPt_V4:
431 case Hexagon::STh_GP_cdnNotPt_V4:
432 case Hexagon::STrih_GP_cPt_V4:
433 case Hexagon::STrih_GP_cNotPt_V4:
434 case Hexagon::STrih_GP_cdnPt_V4:
435 case Hexagon::STrih_GP_cdnNotPt_V4:
439 case Hexagon::STriw_indexed:
440 case Hexagon::STriw_indexed_shl_V4:
441 case Hexagon::STriw_shl_V4:
442 case Hexagon::STriw_GP_V4:
443 case Hexagon::STw_GP_V4:
444 case Hexagon::POST_STwri:
445 case Hexagon::STriw_cPt:
446 case Hexagon::STriw_cdnPt_V4:
447 case Hexagon::STriw_cNotPt:
448 case Hexagon::STriw_cdnNotPt_V4:
449 case Hexagon::STriw_indexed_cPt:
450 case Hexagon::STriw_indexed_cdnPt_V4:
451 case Hexagon::STriw_indexed_cNotPt:
452 case Hexagon::STriw_indexed_cdnNotPt_V4:
453 case Hexagon::STriw_indexed_shl_cPt_V4:
454 case Hexagon::STriw_indexed_shl_cdnPt_V4:
455 case Hexagon::STriw_indexed_shl_cNotPt_V4:
456 case Hexagon::STriw_indexed_shl_cdnNotPt_V4:
457 case Hexagon::POST_STwri_cPt:
458 case Hexagon::POST_STwri_cdnPt_V4:
459 case Hexagon::POST_STwri_cNotPt:
460 case Hexagon::POST_STwri_cdnNotPt_V4:
461 case Hexagon::STw_GP_cPt_V4:
462 case Hexagon::STw_GP_cNotPt_V4:
463 case Hexagon::STw_GP_cdnPt_V4:
464 case Hexagon::STw_GP_cdnNotPt_V4:
465 case Hexagon::STriw_GP_cPt_V4:
466 case Hexagon::STriw_GP_cNotPt_V4:
467 case Hexagon::STriw_GP_cdnPt_V4:
468 case Hexagon::STriw_GP_cdnNotPt_V4:
469 return QRI->Subtarget.hasV4TOps();
474 static bool IsLoopN(MachineInstr *MI) {
475 return (MI->getOpcode() == Hexagon::LOOP0_i ||
476 MI->getOpcode() == Hexagon::LOOP0_r);
479 /// DoesModifyCalleeSavedReg - Returns true if the instruction modifies a
480 /// callee-saved register.
481 static bool DoesModifyCalleeSavedReg(MachineInstr *MI,
482 const TargetRegisterInfo *TRI) {
483 for (const uint16_t *CSR = TRI->getCalleeSavedRegs(); *CSR; ++CSR) {
484 unsigned CalleeSavedReg = *CSR;
485 if (MI->modifiesRegister(CalleeSavedReg, TRI))
491 // Return the new value instruction for a given store.
492 static int GetDotNewOp(const int opc) {
494 default: llvm_unreachable("Unknown .new type");
495 // store new value byte
497 return Hexagon::STrib_nv_V4;
499 case Hexagon::STrib_indexed:
500 return Hexagon::STrib_indexed_nv_V4;
502 case Hexagon::STrib_indexed_shl_V4:
503 return Hexagon::STrib_indexed_shl_nv_V4;
505 case Hexagon::STrib_shl_V4:
506 return Hexagon::STrib_shl_nv_V4;
508 case Hexagon::STrib_GP_V4:
509 return Hexagon::STrib_GP_nv_V4;
511 case Hexagon::STb_GP_V4:
512 return Hexagon::STb_GP_nv_V4;
514 case Hexagon::POST_STbri:
515 return Hexagon::POST_STbri_nv_V4;
517 case Hexagon::STrib_cPt:
518 return Hexagon::STrib_cPt_nv_V4;
520 case Hexagon::STrib_cdnPt_V4:
521 return Hexagon::STrib_cdnPt_nv_V4;
523 case Hexagon::STrib_cNotPt:
524 return Hexagon::STrib_cNotPt_nv_V4;
526 case Hexagon::STrib_cdnNotPt_V4:
527 return Hexagon::STrib_cdnNotPt_nv_V4;
529 case Hexagon::STrib_indexed_cPt:
530 return Hexagon::STrib_indexed_cPt_nv_V4;
532 case Hexagon::STrib_indexed_cdnPt_V4:
533 return Hexagon::STrib_indexed_cdnPt_nv_V4;
535 case Hexagon::STrib_indexed_cNotPt:
536 return Hexagon::STrib_indexed_cNotPt_nv_V4;
538 case Hexagon::STrib_indexed_cdnNotPt_V4:
539 return Hexagon::STrib_indexed_cdnNotPt_nv_V4;
541 case Hexagon::STrib_indexed_shl_cPt_V4:
542 return Hexagon::STrib_indexed_shl_cPt_nv_V4;
544 case Hexagon::STrib_indexed_shl_cdnPt_V4:
545 return Hexagon::STrib_indexed_shl_cdnPt_nv_V4;
547 case Hexagon::STrib_indexed_shl_cNotPt_V4:
548 return Hexagon::STrib_indexed_shl_cNotPt_nv_V4;
550 case Hexagon::STrib_indexed_shl_cdnNotPt_V4:
551 return Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4;
553 case Hexagon::POST_STbri_cPt:
554 return Hexagon::POST_STbri_cPt_nv_V4;
556 case Hexagon::POST_STbri_cdnPt_V4:
557 return Hexagon::POST_STbri_cdnPt_nv_V4;
559 case Hexagon::POST_STbri_cNotPt:
560 return Hexagon::POST_STbri_cNotPt_nv_V4;
562 case Hexagon::POST_STbri_cdnNotPt_V4:
563 return Hexagon::POST_STbri_cdnNotPt_nv_V4;
565 case Hexagon::STb_GP_cPt_V4:
566 return Hexagon::STb_GP_cPt_nv_V4;
568 case Hexagon::STb_GP_cNotPt_V4:
569 return Hexagon::STb_GP_cNotPt_nv_V4;
571 case Hexagon::STb_GP_cdnPt_V4:
572 return Hexagon::STb_GP_cdnPt_nv_V4;
574 case Hexagon::STb_GP_cdnNotPt_V4:
575 return Hexagon::STb_GP_cdnNotPt_nv_V4;
577 case Hexagon::STrib_GP_cPt_V4:
578 return Hexagon::STrib_GP_cPt_nv_V4;
580 case Hexagon::STrib_GP_cNotPt_V4:
581 return Hexagon::STrib_GP_cNotPt_nv_V4;
583 case Hexagon::STrib_GP_cdnPt_V4:
584 return Hexagon::STrib_GP_cdnPt_nv_V4;
586 case Hexagon::STrib_GP_cdnNotPt_V4:
587 return Hexagon::STrib_GP_cdnNotPt_nv_V4;
589 // store new value halfword
591 return Hexagon::STrih_nv_V4;
593 case Hexagon::STrih_indexed:
594 return Hexagon::STrih_indexed_nv_V4;
596 case Hexagon::STrih_indexed_shl_V4:
597 return Hexagon::STrih_indexed_shl_nv_V4;
599 case Hexagon::STrih_shl_V4:
600 return Hexagon::STrih_shl_nv_V4;
602 case Hexagon::STrih_GP_V4:
603 return Hexagon::STrih_GP_nv_V4;
605 case Hexagon::STh_GP_V4:
606 return Hexagon::STh_GP_nv_V4;
608 case Hexagon::POST_SThri:
609 return Hexagon::POST_SThri_nv_V4;
611 case Hexagon::STrih_cPt:
612 return Hexagon::STrih_cPt_nv_V4;
614 case Hexagon::STrih_cdnPt_V4:
615 return Hexagon::STrih_cdnPt_nv_V4;
617 case Hexagon::STrih_cNotPt:
618 return Hexagon::STrih_cNotPt_nv_V4;
620 case Hexagon::STrih_cdnNotPt_V4:
621 return Hexagon::STrih_cdnNotPt_nv_V4;
623 case Hexagon::STrih_indexed_cPt:
624 return Hexagon::STrih_indexed_cPt_nv_V4;
626 case Hexagon::STrih_indexed_cdnPt_V4:
627 return Hexagon::STrih_indexed_cdnPt_nv_V4;
629 case Hexagon::STrih_indexed_cNotPt:
630 return Hexagon::STrih_indexed_cNotPt_nv_V4;
632 case Hexagon::STrih_indexed_cdnNotPt_V4:
633 return Hexagon::STrih_indexed_cdnNotPt_nv_V4;
635 case Hexagon::STrih_indexed_shl_cPt_V4:
636 return Hexagon::STrih_indexed_shl_cPt_nv_V4;
638 case Hexagon::STrih_indexed_shl_cdnPt_V4:
639 return Hexagon::STrih_indexed_shl_cdnPt_nv_V4;
641 case Hexagon::STrih_indexed_shl_cNotPt_V4:
642 return Hexagon::STrih_indexed_shl_cNotPt_nv_V4;
644 case Hexagon::STrih_indexed_shl_cdnNotPt_V4:
645 return Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4;
647 case Hexagon::POST_SThri_cPt:
648 return Hexagon::POST_SThri_cPt_nv_V4;
650 case Hexagon::POST_SThri_cdnPt_V4:
651 return Hexagon::POST_SThri_cdnPt_nv_V4;
653 case Hexagon::POST_SThri_cNotPt:
654 return Hexagon::POST_SThri_cNotPt_nv_V4;
656 case Hexagon::POST_SThri_cdnNotPt_V4:
657 return Hexagon::POST_SThri_cdnNotPt_nv_V4;
659 case Hexagon::STh_GP_cPt_V4:
660 return Hexagon::STh_GP_cPt_nv_V4;
662 case Hexagon::STh_GP_cNotPt_V4:
663 return Hexagon::STh_GP_cNotPt_nv_V4;
665 case Hexagon::STh_GP_cdnPt_V4:
666 return Hexagon::STh_GP_cdnPt_nv_V4;
668 case Hexagon::STh_GP_cdnNotPt_V4:
669 return Hexagon::STh_GP_cdnNotPt_nv_V4;
671 case Hexagon::STrih_GP_cPt_V4:
672 return Hexagon::STrih_GP_cPt_nv_V4;
674 case Hexagon::STrih_GP_cNotPt_V4:
675 return Hexagon::STrih_GP_cNotPt_nv_V4;
677 case Hexagon::STrih_GP_cdnPt_V4:
678 return Hexagon::STrih_GP_cdnPt_nv_V4;
680 case Hexagon::STrih_GP_cdnNotPt_V4:
681 return Hexagon::STrih_GP_cdnNotPt_nv_V4;
683 // store new value word
685 return Hexagon::STriw_nv_V4;
687 case Hexagon::STriw_indexed:
688 return Hexagon::STriw_indexed_nv_V4;
690 case Hexagon::STriw_indexed_shl_V4:
691 return Hexagon::STriw_indexed_shl_nv_V4;
693 case Hexagon::STriw_shl_V4:
694 return Hexagon::STriw_shl_nv_V4;
696 case Hexagon::STriw_GP_V4:
697 return Hexagon::STriw_GP_nv_V4;
699 case Hexagon::STw_GP_V4:
700 return Hexagon::STw_GP_nv_V4;
702 case Hexagon::POST_STwri:
703 return Hexagon::POST_STwri_nv_V4;
705 case Hexagon::STriw_cPt:
706 return Hexagon::STriw_cPt_nv_V4;
708 case Hexagon::STriw_cdnPt_V4:
709 return Hexagon::STriw_cdnPt_nv_V4;
711 case Hexagon::STriw_cNotPt:
712 return Hexagon::STriw_cNotPt_nv_V4;
714 case Hexagon::STriw_cdnNotPt_V4:
715 return Hexagon::STriw_cdnNotPt_nv_V4;
717 case Hexagon::STriw_indexed_cPt:
718 return Hexagon::STriw_indexed_cPt_nv_V4;
720 case Hexagon::STriw_indexed_cdnPt_V4:
721 return Hexagon::STriw_indexed_cdnPt_nv_V4;
723 case Hexagon::STriw_indexed_cNotPt:
724 return Hexagon::STriw_indexed_cNotPt_nv_V4;
726 case Hexagon::STriw_indexed_cdnNotPt_V4:
727 return Hexagon::STriw_indexed_cdnNotPt_nv_V4;
729 case Hexagon::STriw_indexed_shl_cPt_V4:
730 return Hexagon::STriw_indexed_shl_cPt_nv_V4;
732 case Hexagon::STriw_indexed_shl_cdnPt_V4:
733 return Hexagon::STriw_indexed_shl_cdnPt_nv_V4;
735 case Hexagon::STriw_indexed_shl_cNotPt_V4:
736 return Hexagon::STriw_indexed_shl_cNotPt_nv_V4;
738 case Hexagon::STriw_indexed_shl_cdnNotPt_V4:
739 return Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4;
741 case Hexagon::POST_STwri_cPt:
742 return Hexagon::POST_STwri_cPt_nv_V4;
744 case Hexagon::POST_STwri_cdnPt_V4:
745 return Hexagon::POST_STwri_cdnPt_nv_V4;
747 case Hexagon::POST_STwri_cNotPt:
748 return Hexagon::POST_STwri_cNotPt_nv_V4;
750 case Hexagon::POST_STwri_cdnNotPt_V4:
751 return Hexagon::POST_STwri_cdnNotPt_nv_V4;
753 case Hexagon::STw_GP_cPt_V4:
754 return Hexagon::STw_GP_cPt_nv_V4;
756 case Hexagon::STw_GP_cNotPt_V4:
757 return Hexagon::STw_GP_cNotPt_nv_V4;
759 case Hexagon::STw_GP_cdnPt_V4:
760 return Hexagon::STw_GP_cdnPt_nv_V4;
762 case Hexagon::STw_GP_cdnNotPt_V4:
763 return Hexagon::STw_GP_cdnNotPt_nv_V4;
765 case Hexagon::STriw_GP_cPt_V4:
766 return Hexagon::STriw_GP_cPt_nv_V4;
768 case Hexagon::STriw_GP_cNotPt_V4:
769 return Hexagon::STriw_GP_cNotPt_nv_V4;
771 case Hexagon::STriw_GP_cdnPt_V4:
772 return Hexagon::STriw_GP_cdnPt_nv_V4;
774 case Hexagon::STriw_GP_cdnNotPt_V4:
775 return Hexagon::STriw_GP_cdnNotPt_nv_V4;
779 // Return .new predicate version for an instruction
780 static int GetDotNewPredOp(const int opc) {
782 default: llvm_unreachable("Unknown .new type");
783 // Conditional stores
784 // Store byte conditionally
785 case Hexagon::STrib_cPt :
786 return Hexagon::STrib_cdnPt_V4;
788 case Hexagon::STrib_cNotPt :
789 return Hexagon::STrib_cdnNotPt_V4;
791 case Hexagon::STrib_indexed_cPt :
792 return Hexagon::STrib_indexed_cdnPt_V4;
794 case Hexagon::STrib_indexed_cNotPt :
795 return Hexagon::STrib_indexed_cdnNotPt_V4;
797 case Hexagon::STrib_imm_cPt_V4 :
798 return Hexagon::STrib_imm_cdnPt_V4;
800 case Hexagon::STrib_imm_cNotPt_V4 :
801 return Hexagon::STrib_imm_cdnNotPt_V4;
803 case Hexagon::POST_STbri_cPt :
804 return Hexagon::POST_STbri_cdnPt_V4;
806 case Hexagon::POST_STbri_cNotPt :
807 return Hexagon::POST_STbri_cdnNotPt_V4;
809 case Hexagon::STrib_indexed_shl_cPt_V4 :
810 return Hexagon::STrib_indexed_shl_cdnPt_V4;
812 case Hexagon::STrib_indexed_shl_cNotPt_V4 :
813 return Hexagon::STrib_indexed_shl_cdnNotPt_V4;
815 case Hexagon::STb_GP_cPt_V4 :
816 return Hexagon::STb_GP_cdnPt_V4;
818 case Hexagon::STb_GP_cNotPt_V4 :
819 return Hexagon::STb_GP_cdnNotPt_V4;
821 case Hexagon::STrib_GP_cPt_V4 :
822 return Hexagon::STrib_GP_cdnPt_V4;
824 case Hexagon::STrib_GP_cNotPt_V4 :
825 return Hexagon::STrib_GP_cdnNotPt_V4;
827 // Store doubleword conditionally
828 case Hexagon::STrid_cPt :
829 return Hexagon::STrid_cdnPt_V4;
831 case Hexagon::STrid_cNotPt :
832 return Hexagon::STrid_cdnNotPt_V4;
834 case Hexagon::STrid_indexed_cPt :
835 return Hexagon::STrid_indexed_cdnPt_V4;
837 case Hexagon::STrid_indexed_cNotPt :
838 return Hexagon::STrid_indexed_cdnNotPt_V4;
840 case Hexagon::STrid_indexed_shl_cPt_V4 :
841 return Hexagon::STrid_indexed_shl_cdnPt_V4;
843 case Hexagon::STrid_indexed_shl_cNotPt_V4 :
844 return Hexagon::STrid_indexed_shl_cdnNotPt_V4;
846 case Hexagon::POST_STdri_cPt :
847 return Hexagon::POST_STdri_cdnPt_V4;
849 case Hexagon::POST_STdri_cNotPt :
850 return Hexagon::POST_STdri_cdnNotPt_V4;
852 case Hexagon::STd_GP_cPt_V4 :
853 return Hexagon::STd_GP_cdnPt_V4;
855 case Hexagon::STd_GP_cNotPt_V4 :
856 return Hexagon::STd_GP_cdnNotPt_V4;
858 case Hexagon::STrid_GP_cPt_V4 :
859 return Hexagon::STrid_GP_cdnPt_V4;
861 case Hexagon::STrid_GP_cNotPt_V4 :
862 return Hexagon::STrid_GP_cdnNotPt_V4;
864 // Store halfword conditionally
865 case Hexagon::STrih_cPt :
866 return Hexagon::STrih_cdnPt_V4;
868 case Hexagon::STrih_cNotPt :
869 return Hexagon::STrih_cdnNotPt_V4;
871 case Hexagon::STrih_indexed_cPt :
872 return Hexagon::STrih_indexed_cdnPt_V4;
874 case Hexagon::STrih_indexed_cNotPt :
875 return Hexagon::STrih_indexed_cdnNotPt_V4;
877 case Hexagon::STrih_imm_cPt_V4 :
878 return Hexagon::STrih_imm_cdnPt_V4;
880 case Hexagon::STrih_imm_cNotPt_V4 :
881 return Hexagon::STrih_imm_cdnNotPt_V4;
883 case Hexagon::STrih_indexed_shl_cPt_V4 :
884 return Hexagon::STrih_indexed_shl_cdnPt_V4;
886 case Hexagon::STrih_indexed_shl_cNotPt_V4 :
887 return Hexagon::STrih_indexed_shl_cdnNotPt_V4;
889 case Hexagon::POST_SThri_cPt :
890 return Hexagon::POST_SThri_cdnPt_V4;
892 case Hexagon::POST_SThri_cNotPt :
893 return Hexagon::POST_SThri_cdnNotPt_V4;
895 case Hexagon::STh_GP_cPt_V4 :
896 return Hexagon::STh_GP_cdnPt_V4;
898 case Hexagon::STh_GP_cNotPt_V4 :
899 return Hexagon::STh_GP_cdnNotPt_V4;
901 case Hexagon::STrih_GP_cPt_V4 :
902 return Hexagon::STrih_GP_cdnPt_V4;
904 case Hexagon::STrih_GP_cNotPt_V4 :
905 return Hexagon::STrih_GP_cdnNotPt_V4;
907 // Store word conditionally
908 case Hexagon::STriw_cPt :
909 return Hexagon::STriw_cdnPt_V4;
911 case Hexagon::STriw_cNotPt :
912 return Hexagon::STriw_cdnNotPt_V4;
914 case Hexagon::STriw_indexed_cPt :
915 return Hexagon::STriw_indexed_cdnPt_V4;
917 case Hexagon::STriw_indexed_cNotPt :
918 return Hexagon::STriw_indexed_cdnNotPt_V4;
920 case Hexagon::STriw_imm_cPt_V4 :
921 return Hexagon::STriw_imm_cdnPt_V4;
923 case Hexagon::STriw_imm_cNotPt_V4 :
924 return Hexagon::STriw_imm_cdnNotPt_V4;
926 case Hexagon::STriw_indexed_shl_cPt_V4 :
927 return Hexagon::STriw_indexed_shl_cdnPt_V4;
929 case Hexagon::STriw_indexed_shl_cNotPt_V4 :
930 return Hexagon::STriw_indexed_shl_cdnNotPt_V4;
932 case Hexagon::POST_STwri_cPt :
933 return Hexagon::POST_STwri_cdnPt_V4;
935 case Hexagon::POST_STwri_cNotPt :
936 return Hexagon::POST_STwri_cdnNotPt_V4;
938 case Hexagon::STw_GP_cPt_V4 :
939 return Hexagon::STw_GP_cdnPt_V4;
941 case Hexagon::STw_GP_cNotPt_V4 :
942 return Hexagon::STw_GP_cdnNotPt_V4;
944 case Hexagon::STriw_GP_cPt_V4 :
945 return Hexagon::STriw_GP_cdnPt_V4;
947 case Hexagon::STriw_GP_cNotPt_V4 :
948 return Hexagon::STriw_GP_cdnNotPt_V4;
952 return Hexagon::JMP_cdnPt;
954 case Hexagon::JMP_cNot:
955 return Hexagon::JMP_cdnNotPt;
957 case Hexagon::JMPR_cPt:
958 return Hexagon::JMPR_cdnPt_V3;
960 case Hexagon::JMPR_cNotPt:
961 return Hexagon::JMPR_cdnNotPt_V3;
963 // Conditional Transfers
964 case Hexagon::TFR_cPt:
965 return Hexagon::TFR_cdnPt;
967 case Hexagon::TFR_cNotPt:
968 return Hexagon::TFR_cdnNotPt;
970 case Hexagon::TFRI_cPt:
971 return Hexagon::TFRI_cdnPt;
973 case Hexagon::TFRI_cNotPt:
974 return Hexagon::TFRI_cdnNotPt;
977 case Hexagon::LDrid_cPt :
978 return Hexagon::LDrid_cdnPt;
980 case Hexagon::LDrid_cNotPt :
981 return Hexagon::LDrid_cdnNotPt;
983 case Hexagon::LDrid_indexed_cPt :
984 return Hexagon::LDrid_indexed_cdnPt;
986 case Hexagon::LDrid_indexed_cNotPt :
987 return Hexagon::LDrid_indexed_cdnNotPt;
989 case Hexagon::POST_LDrid_cPt :
990 return Hexagon::POST_LDrid_cdnPt_V4;
992 case Hexagon::POST_LDrid_cNotPt :
993 return Hexagon::POST_LDrid_cdnNotPt_V4;
996 case Hexagon::LDriw_cPt :
997 return Hexagon::LDriw_cdnPt;
999 case Hexagon::LDriw_cNotPt :
1000 return Hexagon::LDriw_cdnNotPt;
1002 case Hexagon::LDriw_indexed_cPt :
1003 return Hexagon::LDriw_indexed_cdnPt;
1005 case Hexagon::LDriw_indexed_cNotPt :
1006 return Hexagon::LDriw_indexed_cdnNotPt;
1008 case Hexagon::POST_LDriw_cPt :
1009 return Hexagon::POST_LDriw_cdnPt_V4;
1011 case Hexagon::POST_LDriw_cNotPt :
1012 return Hexagon::POST_LDriw_cdnNotPt_V4;
1015 case Hexagon::LDrih_cPt :
1016 return Hexagon::LDrih_cdnPt;
1018 case Hexagon::LDrih_cNotPt :
1019 return Hexagon::LDrih_cdnNotPt;
1021 case Hexagon::LDrih_indexed_cPt :
1022 return Hexagon::LDrih_indexed_cdnPt;
1024 case Hexagon::LDrih_indexed_cNotPt :
1025 return Hexagon::LDrih_indexed_cdnNotPt;
1027 case Hexagon::POST_LDrih_cPt :
1028 return Hexagon::POST_LDrih_cdnPt_V4;
1030 case Hexagon::POST_LDrih_cNotPt :
1031 return Hexagon::POST_LDrih_cdnNotPt_V4;
1034 case Hexagon::LDrib_cPt :
1035 return Hexagon::LDrib_cdnPt;
1037 case Hexagon::LDrib_cNotPt :
1038 return Hexagon::LDrib_cdnNotPt;
1040 case Hexagon::LDrib_indexed_cPt :
1041 return Hexagon::LDrib_indexed_cdnPt;
1043 case Hexagon::LDrib_indexed_cNotPt :
1044 return Hexagon::LDrib_indexed_cdnNotPt;
1046 case Hexagon::POST_LDrib_cPt :
1047 return Hexagon::POST_LDrib_cdnPt_V4;
1049 case Hexagon::POST_LDrib_cNotPt :
1050 return Hexagon::POST_LDrib_cdnNotPt_V4;
1052 // Load unsigned halfword
1053 case Hexagon::LDriuh_cPt :
1054 return Hexagon::LDriuh_cdnPt;
1056 case Hexagon::LDriuh_cNotPt :
1057 return Hexagon::LDriuh_cdnNotPt;
1059 case Hexagon::LDriuh_indexed_cPt :
1060 return Hexagon::LDriuh_indexed_cdnPt;
1062 case Hexagon::LDriuh_indexed_cNotPt :
1063 return Hexagon::LDriuh_indexed_cdnNotPt;
1065 case Hexagon::POST_LDriuh_cPt :
1066 return Hexagon::POST_LDriuh_cdnPt_V4;
1068 case Hexagon::POST_LDriuh_cNotPt :
1069 return Hexagon::POST_LDriuh_cdnNotPt_V4;
1071 // Load unsigned byte
1072 case Hexagon::LDriub_cPt :
1073 return Hexagon::LDriub_cdnPt;
1075 case Hexagon::LDriub_cNotPt :
1076 return Hexagon::LDriub_cdnNotPt;
1078 case Hexagon::LDriub_indexed_cPt :
1079 return Hexagon::LDriub_indexed_cdnPt;
1081 case Hexagon::LDriub_indexed_cNotPt :
1082 return Hexagon::LDriub_indexed_cdnNotPt;
1084 case Hexagon::POST_LDriub_cPt :
1085 return Hexagon::POST_LDriub_cdnPt_V4;
1087 case Hexagon::POST_LDriub_cNotPt :
1088 return Hexagon::POST_LDriub_cdnNotPt_V4;
1090 // V4 indexed+scaled load
1092 case Hexagon::LDrid_indexed_cPt_V4 :
1093 return Hexagon::LDrid_indexed_cdnPt_V4;
1095 case Hexagon::LDrid_indexed_cNotPt_V4 :
1096 return Hexagon::LDrid_indexed_cdnNotPt_V4;
1098 case Hexagon::LDrid_indexed_shl_cPt_V4 :
1099 return Hexagon::LDrid_indexed_shl_cdnPt_V4;
1101 case Hexagon::LDrid_indexed_shl_cNotPt_V4 :
1102 return Hexagon::LDrid_indexed_shl_cdnNotPt_V4;
1104 case Hexagon::LDrib_indexed_cPt_V4 :
1105 return Hexagon::LDrib_indexed_cdnPt_V4;
1107 case Hexagon::LDrib_indexed_cNotPt_V4 :
1108 return Hexagon::LDrib_indexed_cdnNotPt_V4;
1110 case Hexagon::LDrib_indexed_shl_cPt_V4 :
1111 return Hexagon::LDrib_indexed_shl_cdnPt_V4;
1113 case Hexagon::LDrib_indexed_shl_cNotPt_V4 :
1114 return Hexagon::LDrib_indexed_shl_cdnNotPt_V4;
1116 case Hexagon::LDriub_indexed_cPt_V4 :
1117 return Hexagon::LDriub_indexed_cdnPt_V4;
1119 case Hexagon::LDriub_indexed_cNotPt_V4 :
1120 return Hexagon::LDriub_indexed_cdnNotPt_V4;
1122 case Hexagon::LDriub_indexed_shl_cPt_V4 :
1123 return Hexagon::LDriub_indexed_shl_cdnPt_V4;
1125 case Hexagon::LDriub_indexed_shl_cNotPt_V4 :
1126 return Hexagon::LDriub_indexed_shl_cdnNotPt_V4;
1128 case Hexagon::LDrih_indexed_cPt_V4 :
1129 return Hexagon::LDrih_indexed_cdnPt_V4;
1131 case Hexagon::LDrih_indexed_cNotPt_V4 :
1132 return Hexagon::LDrih_indexed_cdnNotPt_V4;
1134 case Hexagon::LDrih_indexed_shl_cPt_V4 :
1135 return Hexagon::LDrih_indexed_shl_cdnPt_V4;
1137 case Hexagon::LDrih_indexed_shl_cNotPt_V4 :
1138 return Hexagon::LDrih_indexed_shl_cdnNotPt_V4;
1140 case Hexagon::LDriuh_indexed_cPt_V4 :
1141 return Hexagon::LDriuh_indexed_cdnPt_V4;
1143 case Hexagon::LDriuh_indexed_cNotPt_V4 :
1144 return Hexagon::LDriuh_indexed_cdnNotPt_V4;
1146 case Hexagon::LDriuh_indexed_shl_cPt_V4 :
1147 return Hexagon::LDriuh_indexed_shl_cdnPt_V4;
1149 case Hexagon::LDriuh_indexed_shl_cNotPt_V4 :
1150 return Hexagon::LDriuh_indexed_shl_cdnNotPt_V4;
1152 case Hexagon::LDriw_indexed_cPt_V4 :
1153 return Hexagon::LDriw_indexed_cdnPt_V4;
1155 case Hexagon::LDriw_indexed_cNotPt_V4 :
1156 return Hexagon::LDriw_indexed_cdnNotPt_V4;
1158 case Hexagon::LDriw_indexed_shl_cPt_V4 :
1159 return Hexagon::LDriw_indexed_shl_cdnPt_V4;
1161 case Hexagon::LDriw_indexed_shl_cNotPt_V4 :
1162 return Hexagon::LDriw_indexed_shl_cdnNotPt_V4;
1164 // V4 global address load
1166 case Hexagon::LDd_GP_cPt_V4:
1167 return Hexagon::LDd_GP_cdnPt_V4;
1169 case Hexagon::LDd_GP_cNotPt_V4:
1170 return Hexagon::LDd_GP_cdnNotPt_V4;
1172 case Hexagon::LDb_GP_cPt_V4:
1173 return Hexagon::LDb_GP_cdnPt_V4;
1175 case Hexagon::LDb_GP_cNotPt_V4:
1176 return Hexagon::LDb_GP_cdnNotPt_V4;
1178 case Hexagon::LDub_GP_cPt_V4:
1179 return Hexagon::LDub_GP_cdnPt_V4;
1181 case Hexagon::LDub_GP_cNotPt_V4:
1182 return Hexagon::LDub_GP_cdnNotPt_V4;
1184 case Hexagon::LDh_GP_cPt_V4:
1185 return Hexagon::LDh_GP_cdnPt_V4;
1187 case Hexagon::LDh_GP_cNotPt_V4:
1188 return Hexagon::LDh_GP_cdnNotPt_V4;
1190 case Hexagon::LDuh_GP_cPt_V4:
1191 return Hexagon::LDuh_GP_cdnPt_V4;
1193 case Hexagon::LDuh_GP_cNotPt_V4:
1194 return Hexagon::LDuh_GP_cdnNotPt_V4;
1196 case Hexagon::LDw_GP_cPt_V4:
1197 return Hexagon::LDw_GP_cdnPt_V4;
1199 case Hexagon::LDw_GP_cNotPt_V4:
1200 return Hexagon::LDw_GP_cdnNotPt_V4;
1202 case Hexagon::LDrid_GP_cPt_V4:
1203 return Hexagon::LDrid_GP_cdnPt_V4;
1205 case Hexagon::LDrid_GP_cNotPt_V4:
1206 return Hexagon::LDrid_GP_cdnNotPt_V4;
1208 case Hexagon::LDrib_GP_cPt_V4:
1209 return Hexagon::LDrib_GP_cdnPt_V4;
1211 case Hexagon::LDrib_GP_cNotPt_V4:
1212 return Hexagon::LDrib_GP_cdnNotPt_V4;
1214 case Hexagon::LDriub_GP_cPt_V4:
1215 return Hexagon::LDriub_GP_cdnPt_V4;
1217 case Hexagon::LDriub_GP_cNotPt_V4:
1218 return Hexagon::LDriub_GP_cdnNotPt_V4;
1220 case Hexagon::LDrih_GP_cPt_V4:
1221 return Hexagon::LDrih_GP_cdnPt_V4;
1223 case Hexagon::LDrih_GP_cNotPt_V4:
1224 return Hexagon::LDrih_GP_cdnNotPt_V4;
1226 case Hexagon::LDriuh_GP_cPt_V4:
1227 return Hexagon::LDriuh_GP_cdnPt_V4;
1229 case Hexagon::LDriuh_GP_cNotPt_V4:
1230 return Hexagon::LDriuh_GP_cdnNotPt_V4;
1232 case Hexagon::LDriw_GP_cPt_V4:
1233 return Hexagon::LDriw_GP_cdnPt_V4;
1235 case Hexagon::LDriw_GP_cNotPt_V4:
1236 return Hexagon::LDriw_GP_cdnNotPt_V4;
1238 // Conditional store new-value byte
1239 case Hexagon::STrib_cPt_nv_V4 :
1240 return Hexagon::STrib_cdnPt_nv_V4;
1241 case Hexagon::STrib_cNotPt_nv_V4 :
1242 return Hexagon::STrib_cdnNotPt_nv_V4;
1244 case Hexagon::STrib_indexed_cPt_nv_V4 :
1245 return Hexagon::STrib_indexed_cdnPt_nv_V4;
1246 case Hexagon::STrib_indexed_cNotPt_nv_V4 :
1247 return Hexagon::STrib_indexed_cdnNotPt_nv_V4;
1249 case Hexagon::STrib_indexed_shl_cPt_nv_V4 :
1250 return Hexagon::STrib_indexed_shl_cdnPt_nv_V4;
1251 case Hexagon::STrib_indexed_shl_cNotPt_nv_V4 :
1252 return Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4;
1254 case Hexagon::POST_STbri_cPt_nv_V4 :
1255 return Hexagon::POST_STbri_cdnPt_nv_V4;
1256 case Hexagon::POST_STbri_cNotPt_nv_V4 :
1257 return Hexagon::POST_STbri_cdnNotPt_nv_V4;
1259 case Hexagon::STb_GP_cPt_nv_V4 :
1260 return Hexagon::STb_GP_cdnPt_nv_V4;
1262 case Hexagon::STb_GP_cNotPt_nv_V4 :
1263 return Hexagon::STb_GP_cdnNotPt_nv_V4;
1265 case Hexagon::STrib_GP_cPt_nv_V4 :
1266 return Hexagon::STrib_GP_cdnPt_nv_V4;
1268 case Hexagon::STrib_GP_cNotPt_nv_V4 :
1269 return Hexagon::STrib_GP_cdnNotPt_nv_V4;
1271 // Conditional store new-value halfword
1272 case Hexagon::STrih_cPt_nv_V4 :
1273 return Hexagon::STrih_cdnPt_nv_V4;
1274 case Hexagon::STrih_cNotPt_nv_V4 :
1275 return Hexagon::STrih_cdnNotPt_nv_V4;
1277 case Hexagon::STrih_indexed_cPt_nv_V4 :
1278 return Hexagon::STrih_indexed_cdnPt_nv_V4;
1279 case Hexagon::STrih_indexed_cNotPt_nv_V4 :
1280 return Hexagon::STrih_indexed_cdnNotPt_nv_V4;
1282 case Hexagon::STrih_indexed_shl_cPt_nv_V4 :
1283 return Hexagon::STrih_indexed_shl_cdnPt_nv_V4;
1284 case Hexagon::STrih_indexed_shl_cNotPt_nv_V4 :
1285 return Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4;
1287 case Hexagon::POST_SThri_cPt_nv_V4 :
1288 return Hexagon::POST_SThri_cdnPt_nv_V4;
1289 case Hexagon::POST_SThri_cNotPt_nv_V4 :
1290 return Hexagon::POST_SThri_cdnNotPt_nv_V4;
1292 case Hexagon::STh_GP_cPt_nv_V4 :
1293 return Hexagon::STh_GP_cdnPt_nv_V4;
1295 case Hexagon::STh_GP_cNotPt_nv_V4 :
1296 return Hexagon::STh_GP_cdnNotPt_nv_V4;
1298 case Hexagon::STrih_GP_cPt_nv_V4 :
1299 return Hexagon::STrih_GP_cdnPt_nv_V4;
1301 case Hexagon::STrih_GP_cNotPt_nv_V4 :
1302 return Hexagon::STrih_GP_cdnNotPt_nv_V4;
1304 // Conditional store new-value word
1305 case Hexagon::STriw_cPt_nv_V4 :
1306 return Hexagon::STriw_cdnPt_nv_V4;
1307 case Hexagon::STriw_cNotPt_nv_V4 :
1308 return Hexagon::STriw_cdnNotPt_nv_V4;
1310 case Hexagon::STriw_indexed_cPt_nv_V4 :
1311 return Hexagon::STriw_indexed_cdnPt_nv_V4;
1312 case Hexagon::STriw_indexed_cNotPt_nv_V4 :
1313 return Hexagon::STriw_indexed_cdnNotPt_nv_V4;
1315 case Hexagon::STriw_indexed_shl_cPt_nv_V4 :
1316 return Hexagon::STriw_indexed_shl_cdnPt_nv_V4;
1317 case Hexagon::STriw_indexed_shl_cNotPt_nv_V4 :
1318 return Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4;
1320 case Hexagon::POST_STwri_cPt_nv_V4 :
1321 return Hexagon::POST_STwri_cdnPt_nv_V4;
1322 case Hexagon::POST_STwri_cNotPt_nv_V4:
1323 return Hexagon::POST_STwri_cdnNotPt_nv_V4;
1325 case Hexagon::STw_GP_cPt_nv_V4 :
1326 return Hexagon::STw_GP_cdnPt_nv_V4;
1328 case Hexagon::STw_GP_cNotPt_nv_V4 :
1329 return Hexagon::STw_GP_cdnNotPt_nv_V4;
1331 case Hexagon::STriw_GP_cPt_nv_V4 :
1332 return Hexagon::STriw_GP_cdnPt_nv_V4;
1334 case Hexagon::STriw_GP_cNotPt_nv_V4 :
1335 return Hexagon::STriw_GP_cdnNotPt_nv_V4;
1338 case Hexagon::ADD_ri_cPt :
1339 return Hexagon::ADD_ri_cdnPt;
1340 case Hexagon::ADD_ri_cNotPt :
1341 return Hexagon::ADD_ri_cdnNotPt;
1343 case Hexagon::ADD_rr_cPt :
1344 return Hexagon::ADD_rr_cdnPt;
1345 case Hexagon::ADD_rr_cNotPt :
1346 return Hexagon::ADD_rr_cdnNotPt;
1348 // Conditional logical Operations
1349 case Hexagon::XOR_rr_cPt :
1350 return Hexagon::XOR_rr_cdnPt;
1351 case Hexagon::XOR_rr_cNotPt :
1352 return Hexagon::XOR_rr_cdnNotPt;
1354 case Hexagon::AND_rr_cPt :
1355 return Hexagon::AND_rr_cdnPt;
1356 case Hexagon::AND_rr_cNotPt :
1357 return Hexagon::AND_rr_cdnNotPt;
1359 case Hexagon::OR_rr_cPt :
1360 return Hexagon::OR_rr_cdnPt;
1361 case Hexagon::OR_rr_cNotPt :
1362 return Hexagon::OR_rr_cdnNotPt;
1364 // Conditional Subtract
1365 case Hexagon::SUB_rr_cPt :
1366 return Hexagon::SUB_rr_cdnPt;
1367 case Hexagon::SUB_rr_cNotPt :
1368 return Hexagon::SUB_rr_cdnNotPt;
1370 // Conditional combine
1371 case Hexagon::COMBINE_rr_cPt :
1372 return Hexagon::COMBINE_rr_cdnPt;
1373 case Hexagon::COMBINE_rr_cNotPt :
1374 return Hexagon::COMBINE_rr_cdnNotPt;
1376 case Hexagon::ASLH_cPt_V4 :
1377 return Hexagon::ASLH_cdnPt_V4;
1378 case Hexagon::ASLH_cNotPt_V4 :
1379 return Hexagon::ASLH_cdnNotPt_V4;
1381 case Hexagon::ASRH_cPt_V4 :
1382 return Hexagon::ASRH_cdnPt_V4;
1383 case Hexagon::ASRH_cNotPt_V4 :
1384 return Hexagon::ASRH_cdnNotPt_V4;
1386 case Hexagon::SXTB_cPt_V4 :
1387 return Hexagon::SXTB_cdnPt_V4;
1388 case Hexagon::SXTB_cNotPt_V4 :
1389 return Hexagon::SXTB_cdnNotPt_V4;
1391 case Hexagon::SXTH_cPt_V4 :
1392 return Hexagon::SXTH_cdnPt_V4;
1393 case Hexagon::SXTH_cNotPt_V4 :
1394 return Hexagon::SXTH_cdnNotPt_V4;
1396 case Hexagon::ZXTB_cPt_V4 :
1397 return Hexagon::ZXTB_cdnPt_V4;
1398 case Hexagon::ZXTB_cNotPt_V4 :
1399 return Hexagon::ZXTB_cdnNotPt_V4;
1401 case Hexagon::ZXTH_cPt_V4 :
1402 return Hexagon::ZXTH_cdnPt_V4;
1403 case Hexagon::ZXTH_cNotPt_V4 :
1404 return Hexagon::ZXTH_cdnNotPt_V4;
1408 // Returns true if an instruction can be promoted to .new predicate
1409 // or new-value store.
1410 bool HexagonPacketizerList::isNewifiable(MachineInstr* MI) {
1411 if ( isCondInst(MI) || IsNewifyStore(MI))
1417 bool HexagonPacketizerList::isCondInst (MachineInstr* MI) {
1418 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
1419 const MCInstrDesc& TID = MI->getDesc();
1420 // bug 5670: until that is fixed,
1421 // this portion is disabled.
1422 if ( TID.isConditionalBranch() // && !IsRegisterJump(MI)) ||
1423 || QII->isConditionalTransfer(MI)
1424 || QII->isConditionalALU32(MI)
1425 || QII->isConditionalLoad(MI)
1426 || QII->isConditionalStore(MI)) {
1433 // Promote an instructiont to its .new form.
1434 // At this time, we have already made a call to CanPromoteToDotNew
1435 // and made sure that it can *indeed* be promoted.
1436 bool HexagonPacketizerList::PromoteToDotNew(MachineInstr* MI,
1437 SDep::Kind DepType, MachineBasicBlock::iterator &MII,
1438 const TargetRegisterClass* RC) {
1440 assert (DepType == SDep::Data);
1441 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
1444 if (RC == &Hexagon::PredRegsRegClass)
1445 NewOpcode = GetDotNewPredOp(MI->getOpcode());
1447 NewOpcode = GetDotNewOp(MI->getOpcode());
1448 MI->setDesc(QII->get(NewOpcode));
1453 // Returns the most basic instruction for the .new predicated instructions and
1454 // new-value stores.
1455 // For example, all of the following instructions will be converted back to the
1456 // same instruction:
1457 // 1) if (p0.new) memw(R0+#0) = R1.new --->
1458 // 2) if (p0) memw(R0+#0)= R1.new -------> if (p0) memw(R0+#0) = R1
1459 // 3) if (p0.new) memw(R0+#0) = R1 --->
1461 // To understand the translation of instruction 1 to its original form, consider
1462 // a packet with 3 instructions.
1463 // { p0 = cmp.eq(R0,R1)
1464 // if (p0.new) R2 = add(R3, R4)
1465 // R5 = add (R3, R1)
1467 // if (p0) memw(R5+#0) = R2 <--- trying to include it in the previous packet
1469 // This instruction can be part of the previous packet only if both p0 and R2
1470 // are promoted to .new values. This promotion happens in steps, first
1471 // predicate register is promoted to .new and in the next iteration R2 is
1472 // promoted. Therefore, in case of dependence check failure (due to R5) during
1473 // next iteration, it should be converted back to its most basic form.
1475 static int GetDotOldOp(const int opc) {
1477 default: llvm_unreachable("Unknown .old type");
1478 case Hexagon::TFR_cdnPt:
1479 return Hexagon::TFR_cPt;
1481 case Hexagon::TFR_cdnNotPt:
1482 return Hexagon::TFR_cNotPt;
1484 case Hexagon::TFRI_cdnPt:
1485 return Hexagon::TFRI_cPt;
1487 case Hexagon::TFRI_cdnNotPt:
1488 return Hexagon::TFRI_cNotPt;
1490 case Hexagon::JMP_cdnPt:
1491 return Hexagon::JMP_c;
1493 case Hexagon::JMP_cdnNotPt:
1494 return Hexagon::JMP_cNot;
1496 case Hexagon::JMPR_cdnPt_V3:
1497 return Hexagon::JMPR_cPt;
1499 case Hexagon::JMPR_cdnNotPt_V3:
1500 return Hexagon::JMPR_cNotPt;
1504 case Hexagon::LDrid_cdnPt :
1505 return Hexagon::LDrid_cPt;
1507 case Hexagon::LDrid_cdnNotPt :
1508 return Hexagon::LDrid_cNotPt;
1510 case Hexagon::LDrid_indexed_cdnPt :
1511 return Hexagon::LDrid_indexed_cPt;
1513 case Hexagon::LDrid_indexed_cdnNotPt :
1514 return Hexagon::LDrid_indexed_cNotPt;
1516 case Hexagon::POST_LDrid_cdnPt_V4 :
1517 return Hexagon::POST_LDrid_cPt;
1519 case Hexagon::POST_LDrid_cdnNotPt_V4 :
1520 return Hexagon::POST_LDrid_cNotPt;
1524 case Hexagon::LDriw_cdnPt :
1525 return Hexagon::LDriw_cPt;
1527 case Hexagon::LDriw_cdnNotPt :
1528 return Hexagon::LDriw_cNotPt;
1530 case Hexagon::LDriw_indexed_cdnPt :
1531 return Hexagon::LDriw_indexed_cPt;
1533 case Hexagon::LDriw_indexed_cdnNotPt :
1534 return Hexagon::LDriw_indexed_cNotPt;
1536 case Hexagon::POST_LDriw_cdnPt_V4 :
1537 return Hexagon::POST_LDriw_cPt;
1539 case Hexagon::POST_LDriw_cdnNotPt_V4 :
1540 return Hexagon::POST_LDriw_cNotPt;
1544 case Hexagon::LDrih_cdnPt :
1545 return Hexagon::LDrih_cPt;
1547 case Hexagon::LDrih_cdnNotPt :
1548 return Hexagon::LDrih_cNotPt;
1550 case Hexagon::LDrih_indexed_cdnPt :
1551 return Hexagon::LDrih_indexed_cPt;
1553 case Hexagon::LDrih_indexed_cdnNotPt :
1554 return Hexagon::LDrih_indexed_cNotPt;
1556 case Hexagon::POST_LDrih_cdnPt_V4 :
1557 return Hexagon::POST_LDrih_cPt;
1559 case Hexagon::POST_LDrih_cdnNotPt_V4 :
1560 return Hexagon::POST_LDrih_cNotPt;
1564 case Hexagon::LDrib_cdnPt :
1565 return Hexagon::LDrib_cPt;
1567 case Hexagon::LDrib_cdnNotPt :
1568 return Hexagon::LDrib_cNotPt;
1570 case Hexagon::LDrib_indexed_cdnPt :
1571 return Hexagon::LDrib_indexed_cPt;
1573 case Hexagon::LDrib_indexed_cdnNotPt :
1574 return Hexagon::LDrib_indexed_cNotPt;
1576 case Hexagon::POST_LDrib_cdnPt_V4 :
1577 return Hexagon::POST_LDrib_cPt;
1579 case Hexagon::POST_LDrib_cdnNotPt_V4 :
1580 return Hexagon::POST_LDrib_cNotPt;
1582 // Load unsigned half
1584 case Hexagon::LDriuh_cdnPt :
1585 return Hexagon::LDriuh_cPt;
1587 case Hexagon::LDriuh_cdnNotPt :
1588 return Hexagon::LDriuh_cNotPt;
1590 case Hexagon::LDriuh_indexed_cdnPt :
1591 return Hexagon::LDriuh_indexed_cPt;
1593 case Hexagon::LDriuh_indexed_cdnNotPt :
1594 return Hexagon::LDriuh_indexed_cNotPt;
1596 case Hexagon::POST_LDriuh_cdnPt_V4 :
1597 return Hexagon::POST_LDriuh_cPt;
1599 case Hexagon::POST_LDriuh_cdnNotPt_V4 :
1600 return Hexagon::POST_LDriuh_cNotPt;
1602 // Load unsigned byte
1603 case Hexagon::LDriub_cdnPt :
1604 return Hexagon::LDriub_cPt;
1606 case Hexagon::LDriub_cdnNotPt :
1607 return Hexagon::LDriub_cNotPt;
1609 case Hexagon::LDriub_indexed_cdnPt :
1610 return Hexagon::LDriub_indexed_cPt;
1612 case Hexagon::LDriub_indexed_cdnNotPt :
1613 return Hexagon::LDriub_indexed_cNotPt;
1615 case Hexagon::POST_LDriub_cdnPt_V4 :
1616 return Hexagon::POST_LDriub_cPt;
1618 case Hexagon::POST_LDriub_cdnNotPt_V4 :
1619 return Hexagon::POST_LDriub_cNotPt;
1621 // V4 indexed+scaled Load
1623 case Hexagon::LDrid_indexed_cdnPt_V4 :
1624 return Hexagon::LDrid_indexed_cPt_V4;
1626 case Hexagon::LDrid_indexed_cdnNotPt_V4 :
1627 return Hexagon::LDrid_indexed_cNotPt_V4;
1629 case Hexagon::LDrid_indexed_shl_cdnPt_V4 :
1630 return Hexagon::LDrid_indexed_shl_cPt_V4;
1632 case Hexagon::LDrid_indexed_shl_cdnNotPt_V4 :
1633 return Hexagon::LDrid_indexed_shl_cNotPt_V4;
1635 case Hexagon::LDrib_indexed_cdnPt_V4 :
1636 return Hexagon::LDrib_indexed_cPt_V4;
1638 case Hexagon::LDrib_indexed_cdnNotPt_V4 :
1639 return Hexagon::LDrib_indexed_cNotPt_V4;
1641 case Hexagon::LDrib_indexed_shl_cdnPt_V4 :
1642 return Hexagon::LDrib_indexed_shl_cPt_V4;
1644 case Hexagon::LDrib_indexed_shl_cdnNotPt_V4 :
1645 return Hexagon::LDrib_indexed_shl_cNotPt_V4;
1647 case Hexagon::LDriub_indexed_cdnPt_V4 :
1648 return Hexagon::LDriub_indexed_cPt_V4;
1650 case Hexagon::LDriub_indexed_cdnNotPt_V4 :
1651 return Hexagon::LDriub_indexed_cNotPt_V4;
1653 case Hexagon::LDriub_indexed_shl_cdnPt_V4 :
1654 return Hexagon::LDriub_indexed_shl_cPt_V4;
1656 case Hexagon::LDriub_indexed_shl_cdnNotPt_V4 :
1657 return Hexagon::LDriub_indexed_shl_cNotPt_V4;
1659 case Hexagon::LDrih_indexed_cdnPt_V4 :
1660 return Hexagon::LDrih_indexed_cPt_V4;
1662 case Hexagon::LDrih_indexed_cdnNotPt_V4 :
1663 return Hexagon::LDrih_indexed_cNotPt_V4;
1665 case Hexagon::LDrih_indexed_shl_cdnPt_V4 :
1666 return Hexagon::LDrih_indexed_shl_cPt_V4;
1668 case Hexagon::LDrih_indexed_shl_cdnNotPt_V4 :
1669 return Hexagon::LDrih_indexed_shl_cNotPt_V4;
1671 case Hexagon::LDriuh_indexed_cdnPt_V4 :
1672 return Hexagon::LDriuh_indexed_cPt_V4;
1674 case Hexagon::LDriuh_indexed_cdnNotPt_V4 :
1675 return Hexagon::LDriuh_indexed_cNotPt_V4;
1677 case Hexagon::LDriuh_indexed_shl_cdnPt_V4 :
1678 return Hexagon::LDriuh_indexed_shl_cPt_V4;
1680 case Hexagon::LDriuh_indexed_shl_cdnNotPt_V4 :
1681 return Hexagon::LDriuh_indexed_shl_cNotPt_V4;
1683 case Hexagon::LDriw_indexed_cdnPt_V4 :
1684 return Hexagon::LDriw_indexed_cPt_V4;
1686 case Hexagon::LDriw_indexed_cdnNotPt_V4 :
1687 return Hexagon::LDriw_indexed_cNotPt_V4;
1689 case Hexagon::LDriw_indexed_shl_cdnPt_V4 :
1690 return Hexagon::LDriw_indexed_shl_cPt_V4;
1692 case Hexagon::LDriw_indexed_shl_cdnNotPt_V4 :
1693 return Hexagon::LDriw_indexed_shl_cNotPt_V4;
1695 // V4 global address load
1697 case Hexagon::LDd_GP_cdnPt_V4:
1698 return Hexagon::LDd_GP_cPt_V4;
1700 case Hexagon::LDd_GP_cdnNotPt_V4:
1701 return Hexagon::LDd_GP_cNotPt_V4;
1703 case Hexagon::LDb_GP_cdnPt_V4:
1704 return Hexagon::LDb_GP_cPt_V4;
1706 case Hexagon::LDb_GP_cdnNotPt_V4:
1707 return Hexagon::LDb_GP_cNotPt_V4;
1709 case Hexagon::LDub_GP_cdnPt_V4:
1710 return Hexagon::LDub_GP_cPt_V4;
1712 case Hexagon::LDub_GP_cdnNotPt_V4:
1713 return Hexagon::LDub_GP_cNotPt_V4;
1715 case Hexagon::LDh_GP_cdnPt_V4:
1716 return Hexagon::LDh_GP_cPt_V4;
1718 case Hexagon::LDh_GP_cdnNotPt_V4:
1719 return Hexagon::LDh_GP_cNotPt_V4;
1721 case Hexagon::LDuh_GP_cdnPt_V4:
1722 return Hexagon::LDuh_GP_cPt_V4;
1724 case Hexagon::LDuh_GP_cdnNotPt_V4:
1725 return Hexagon::LDuh_GP_cNotPt_V4;
1727 case Hexagon::LDw_GP_cdnPt_V4:
1728 return Hexagon::LDw_GP_cPt_V4;
1730 case Hexagon::LDw_GP_cdnNotPt_V4:
1731 return Hexagon::LDw_GP_cNotPt_V4;
1733 case Hexagon::LDrid_GP_cdnPt_V4:
1734 return Hexagon::LDrid_GP_cPt_V4;
1736 case Hexagon::LDrid_GP_cdnNotPt_V4:
1737 return Hexagon::LDrid_GP_cNotPt_V4;
1739 case Hexagon::LDrib_GP_cdnPt_V4:
1740 return Hexagon::LDrib_GP_cPt_V4;
1742 case Hexagon::LDrib_GP_cdnNotPt_V4:
1743 return Hexagon::LDrib_GP_cNotPt_V4;
1745 case Hexagon::LDriub_GP_cdnPt_V4:
1746 return Hexagon::LDriub_GP_cPt_V4;
1748 case Hexagon::LDriub_GP_cdnNotPt_V4:
1749 return Hexagon::LDriub_GP_cNotPt_V4;
1751 case Hexagon::LDrih_GP_cdnPt_V4:
1752 return Hexagon::LDrih_GP_cPt_V4;
1754 case Hexagon::LDrih_GP_cdnNotPt_V4:
1755 return Hexagon::LDrih_GP_cNotPt_V4;
1757 case Hexagon::LDriuh_GP_cdnPt_V4:
1758 return Hexagon::LDriuh_GP_cPt_V4;
1760 case Hexagon::LDriuh_GP_cdnNotPt_V4:
1761 return Hexagon::LDriuh_GP_cNotPt_V4;
1763 case Hexagon::LDriw_GP_cdnPt_V4:
1764 return Hexagon::LDriw_GP_cPt_V4;
1766 case Hexagon::LDriw_GP_cdnNotPt_V4:
1767 return Hexagon::LDriw_GP_cNotPt_V4;
1771 case Hexagon::ADD_ri_cdnPt :
1772 return Hexagon::ADD_ri_cPt;
1773 case Hexagon::ADD_ri_cdnNotPt :
1774 return Hexagon::ADD_ri_cNotPt;
1776 case Hexagon::ADD_rr_cdnPt :
1777 return Hexagon::ADD_rr_cPt;
1778 case Hexagon::ADD_rr_cdnNotPt:
1779 return Hexagon::ADD_rr_cNotPt;
1781 // Conditional logical Operations
1783 case Hexagon::XOR_rr_cdnPt :
1784 return Hexagon::XOR_rr_cPt;
1785 case Hexagon::XOR_rr_cdnNotPt :
1786 return Hexagon::XOR_rr_cNotPt;
1788 case Hexagon::AND_rr_cdnPt :
1789 return Hexagon::AND_rr_cPt;
1790 case Hexagon::AND_rr_cdnNotPt :
1791 return Hexagon::AND_rr_cNotPt;
1793 case Hexagon::OR_rr_cdnPt :
1794 return Hexagon::OR_rr_cPt;
1795 case Hexagon::OR_rr_cdnNotPt :
1796 return Hexagon::OR_rr_cNotPt;
1798 // Conditional Subtract
1800 case Hexagon::SUB_rr_cdnPt :
1801 return Hexagon::SUB_rr_cPt;
1802 case Hexagon::SUB_rr_cdnNotPt :
1803 return Hexagon::SUB_rr_cNotPt;
1805 // Conditional combine
1807 case Hexagon::COMBINE_rr_cdnPt :
1808 return Hexagon::COMBINE_rr_cPt;
1809 case Hexagon::COMBINE_rr_cdnNotPt :
1810 return Hexagon::COMBINE_rr_cNotPt;
1812 // Conditional shift operations
1814 case Hexagon::ASLH_cdnPt_V4 :
1815 return Hexagon::ASLH_cPt_V4;
1816 case Hexagon::ASLH_cdnNotPt_V4 :
1817 return Hexagon::ASLH_cNotPt_V4;
1819 case Hexagon::ASRH_cdnPt_V4 :
1820 return Hexagon::ASRH_cPt_V4;
1821 case Hexagon::ASRH_cdnNotPt_V4 :
1822 return Hexagon::ASRH_cNotPt_V4;
1824 case Hexagon::SXTB_cdnPt_V4 :
1825 return Hexagon::SXTB_cPt_V4;
1826 case Hexagon::SXTB_cdnNotPt_V4 :
1827 return Hexagon::SXTB_cNotPt_V4;
1829 case Hexagon::SXTH_cdnPt_V4 :
1830 return Hexagon::SXTH_cPt_V4;
1831 case Hexagon::SXTH_cdnNotPt_V4 :
1832 return Hexagon::SXTH_cNotPt_V4;
1834 case Hexagon::ZXTB_cdnPt_V4 :
1835 return Hexagon::ZXTB_cPt_V4;
1836 case Hexagon::ZXTB_cdnNotPt_V4 :
1837 return Hexagon::ZXTB_cNotPt_V4;
1839 case Hexagon::ZXTH_cdnPt_V4 :
1840 return Hexagon::ZXTH_cPt_V4;
1841 case Hexagon::ZXTH_cdnNotPt_V4 :
1842 return Hexagon::ZXTH_cNotPt_V4;
1846 case Hexagon::STrib_imm_cdnPt_V4 :
1847 return Hexagon::STrib_imm_cPt_V4;
1849 case Hexagon::STrib_imm_cdnNotPt_V4 :
1850 return Hexagon::STrib_imm_cNotPt_V4;
1852 case Hexagon::STrib_cdnPt_nv_V4 :
1853 case Hexagon::STrib_cPt_nv_V4 :
1854 case Hexagon::STrib_cdnPt_V4 :
1855 return Hexagon::STrib_cPt;
1857 case Hexagon::STrib_cdnNotPt_nv_V4 :
1858 case Hexagon::STrib_cNotPt_nv_V4 :
1859 case Hexagon::STrib_cdnNotPt_V4 :
1860 return Hexagon::STrib_cNotPt;
1862 case Hexagon::STrib_indexed_cdnPt_V4 :
1863 case Hexagon::STrib_indexed_cPt_nv_V4 :
1864 case Hexagon::STrib_indexed_cdnPt_nv_V4 :
1865 return Hexagon::STrib_indexed_cPt;
1867 case Hexagon::STrib_indexed_cdnNotPt_V4 :
1868 case Hexagon::STrib_indexed_cNotPt_nv_V4 :
1869 case Hexagon::STrib_indexed_cdnNotPt_nv_V4 :
1870 return Hexagon::STrib_indexed_cNotPt;
1872 case Hexagon::STrib_indexed_shl_cdnPt_nv_V4:
1873 case Hexagon::STrib_indexed_shl_cPt_nv_V4 :
1874 case Hexagon::STrib_indexed_shl_cdnPt_V4 :
1875 return Hexagon::STrib_indexed_shl_cPt_V4;
1877 case Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4:
1878 case Hexagon::STrib_indexed_shl_cNotPt_nv_V4 :
1879 case Hexagon::STrib_indexed_shl_cdnNotPt_V4 :
1880 return Hexagon::STrib_indexed_shl_cNotPt_V4;
1882 case Hexagon::POST_STbri_cdnPt_nv_V4 :
1883 case Hexagon::POST_STbri_cPt_nv_V4 :
1884 case Hexagon::POST_STbri_cdnPt_V4 :
1885 return Hexagon::POST_STbri_cPt;
1887 case Hexagon::POST_STbri_cdnNotPt_nv_V4 :
1888 case Hexagon::POST_STbri_cNotPt_nv_V4:
1889 case Hexagon::POST_STbri_cdnNotPt_V4 :
1890 return Hexagon::POST_STbri_cNotPt;
1892 case Hexagon::STb_GP_cdnPt_nv_V4:
1893 case Hexagon::STb_GP_cdnPt_V4:
1894 case Hexagon::STb_GP_cPt_nv_V4:
1895 return Hexagon::STb_GP_cPt_V4;
1897 case Hexagon::STb_GP_cdnNotPt_nv_V4:
1898 case Hexagon::STb_GP_cdnNotPt_V4:
1899 case Hexagon::STb_GP_cNotPt_nv_V4:
1900 return Hexagon::STb_GP_cNotPt_V4;
1902 case Hexagon::STrib_GP_cdnPt_nv_V4:
1903 case Hexagon::STrib_GP_cdnPt_V4:
1904 case Hexagon::STrib_GP_cPt_nv_V4:
1905 return Hexagon::STrib_GP_cPt_V4;
1907 case Hexagon::STrib_GP_cdnNotPt_nv_V4:
1908 case Hexagon::STrib_GP_cdnNotPt_V4:
1909 case Hexagon::STrib_GP_cNotPt_nv_V4:
1910 return Hexagon::STrib_GP_cNotPt_V4;
1912 // Store new-value byte - unconditional
1913 case Hexagon::STrib_nv_V4:
1914 return Hexagon::STrib;
1916 case Hexagon::STrib_indexed_nv_V4:
1917 return Hexagon::STrib_indexed;
1919 case Hexagon::STrib_indexed_shl_nv_V4:
1920 return Hexagon::STrib_indexed_shl_V4;
1922 case Hexagon::STrib_shl_nv_V4:
1923 return Hexagon::STrib_shl_V4;
1925 case Hexagon::STrib_GP_nv_V4:
1926 return Hexagon::STrib_GP_V4;
1928 case Hexagon::STb_GP_nv_V4:
1929 return Hexagon::STb_GP_V4;
1931 case Hexagon::POST_STbri_nv_V4:
1932 return Hexagon::POST_STbri;
1935 case Hexagon::STrih_imm_cdnPt_V4 :
1936 return Hexagon::STrih_imm_cPt_V4;
1938 case Hexagon::STrih_imm_cdnNotPt_V4 :
1939 return Hexagon::STrih_imm_cNotPt_V4;
1941 case Hexagon::STrih_cdnPt_nv_V4 :
1942 case Hexagon::STrih_cPt_nv_V4 :
1943 case Hexagon::STrih_cdnPt_V4 :
1944 return Hexagon::STrih_cPt;
1946 case Hexagon::STrih_cdnNotPt_nv_V4 :
1947 case Hexagon::STrih_cNotPt_nv_V4 :
1948 case Hexagon::STrih_cdnNotPt_V4 :
1949 return Hexagon::STrih_cNotPt;
1951 case Hexagon::STrih_indexed_cdnPt_nv_V4:
1952 case Hexagon::STrih_indexed_cPt_nv_V4 :
1953 case Hexagon::STrih_indexed_cdnPt_V4 :
1954 return Hexagon::STrih_indexed_cPt;
1956 case Hexagon::STrih_indexed_cdnNotPt_nv_V4:
1957 case Hexagon::STrih_indexed_cNotPt_nv_V4 :
1958 case Hexagon::STrih_indexed_cdnNotPt_V4 :
1959 return Hexagon::STrih_indexed_cNotPt;
1961 case Hexagon::STrih_indexed_shl_cdnPt_nv_V4 :
1962 case Hexagon::STrih_indexed_shl_cPt_nv_V4 :
1963 case Hexagon::STrih_indexed_shl_cdnPt_V4 :
1964 return Hexagon::STrih_indexed_shl_cPt_V4;
1966 case Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4 :
1967 case Hexagon::STrih_indexed_shl_cNotPt_nv_V4 :
1968 case Hexagon::STrih_indexed_shl_cdnNotPt_V4 :
1969 return Hexagon::STrih_indexed_shl_cNotPt_V4;
1971 case Hexagon::POST_SThri_cdnPt_nv_V4 :
1972 case Hexagon::POST_SThri_cPt_nv_V4 :
1973 case Hexagon::POST_SThri_cdnPt_V4 :
1974 return Hexagon::POST_SThri_cPt;
1976 case Hexagon::POST_SThri_cdnNotPt_nv_V4 :
1977 case Hexagon::POST_SThri_cNotPt_nv_V4 :
1978 case Hexagon::POST_SThri_cdnNotPt_V4 :
1979 return Hexagon::POST_SThri_cNotPt;
1981 case Hexagon::STh_GP_cdnPt_nv_V4:
1982 case Hexagon::STh_GP_cdnPt_V4:
1983 case Hexagon::STh_GP_cPt_nv_V4:
1984 return Hexagon::STh_GP_cPt_V4;
1986 case Hexagon::STh_GP_cdnNotPt_nv_V4:
1987 case Hexagon::STh_GP_cdnNotPt_V4:
1988 case Hexagon::STh_GP_cNotPt_nv_V4:
1989 return Hexagon::STh_GP_cNotPt_V4;
1991 case Hexagon::STrih_GP_cdnPt_nv_V4:
1992 case Hexagon::STrih_GP_cdnPt_V4:
1993 case Hexagon::STrih_GP_cPt_nv_V4:
1994 return Hexagon::STrih_GP_cPt_V4;
1996 case Hexagon::STrih_GP_cdnNotPt_nv_V4:
1997 case Hexagon::STrih_GP_cdnNotPt_V4:
1998 case Hexagon::STrih_GP_cNotPt_nv_V4:
1999 return Hexagon::STrih_GP_cNotPt_V4;
2001 // Store new-value halfword - unconditional
2003 case Hexagon::STrih_nv_V4:
2004 return Hexagon::STrih;
2006 case Hexagon::STrih_indexed_nv_V4:
2007 return Hexagon::STrih_indexed;
2009 case Hexagon::STrih_indexed_shl_nv_V4:
2010 return Hexagon::STrih_indexed_shl_V4;
2012 case Hexagon::STrih_shl_nv_V4:
2013 return Hexagon::STrih_shl_V4;
2015 case Hexagon::STrih_GP_nv_V4:
2016 return Hexagon::STrih_GP_V4;
2018 case Hexagon::STh_GP_nv_V4:
2019 return Hexagon::STh_GP_V4;
2021 case Hexagon::POST_SThri_nv_V4:
2022 return Hexagon::POST_SThri;
2026 case Hexagon::STriw_imm_cdnPt_V4 :
2027 return Hexagon::STriw_imm_cPt_V4;
2029 case Hexagon::STriw_imm_cdnNotPt_V4 :
2030 return Hexagon::STriw_imm_cNotPt_V4;
2032 case Hexagon::STriw_cdnPt_nv_V4 :
2033 case Hexagon::STriw_cPt_nv_V4 :
2034 case Hexagon::STriw_cdnPt_V4 :
2035 return Hexagon::STriw_cPt;
2037 case Hexagon::STriw_cdnNotPt_nv_V4 :
2038 case Hexagon::STriw_cNotPt_nv_V4 :
2039 case Hexagon::STriw_cdnNotPt_V4 :
2040 return Hexagon::STriw_cNotPt;
2042 case Hexagon::STriw_indexed_cdnPt_nv_V4 :
2043 case Hexagon::STriw_indexed_cPt_nv_V4 :
2044 case Hexagon::STriw_indexed_cdnPt_V4 :
2045 return Hexagon::STriw_indexed_cPt;
2047 case Hexagon::STriw_indexed_cdnNotPt_nv_V4 :
2048 case Hexagon::STriw_indexed_cNotPt_nv_V4 :
2049 case Hexagon::STriw_indexed_cdnNotPt_V4 :
2050 return Hexagon::STriw_indexed_cNotPt;
2052 case Hexagon::STriw_indexed_shl_cdnPt_nv_V4 :
2053 case Hexagon::STriw_indexed_shl_cPt_nv_V4 :
2054 case Hexagon::STriw_indexed_shl_cdnPt_V4 :
2055 return Hexagon::STriw_indexed_shl_cPt_V4;
2057 case Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4 :
2058 case Hexagon::STriw_indexed_shl_cNotPt_nv_V4 :
2059 case Hexagon::STriw_indexed_shl_cdnNotPt_V4 :
2060 return Hexagon::STriw_indexed_shl_cNotPt_V4;
2062 case Hexagon::POST_STwri_cdnPt_nv_V4 :
2063 case Hexagon::POST_STwri_cPt_nv_V4 :
2064 case Hexagon::POST_STwri_cdnPt_V4 :
2065 return Hexagon::POST_STwri_cPt;
2067 case Hexagon::POST_STwri_cdnNotPt_nv_V4 :
2068 case Hexagon::POST_STwri_cNotPt_nv_V4 :
2069 case Hexagon::POST_STwri_cdnNotPt_V4 :
2070 return Hexagon::POST_STwri_cNotPt;
2072 case Hexagon::STw_GP_cdnPt_nv_V4:
2073 case Hexagon::STw_GP_cdnPt_V4:
2074 case Hexagon::STw_GP_cPt_nv_V4:
2075 return Hexagon::STw_GP_cPt_V4;
2077 case Hexagon::STw_GP_cdnNotPt_nv_V4:
2078 case Hexagon::STw_GP_cdnNotPt_V4:
2079 case Hexagon::STw_GP_cNotPt_nv_V4:
2080 return Hexagon::STw_GP_cNotPt_V4;
2082 case Hexagon::STriw_GP_cdnPt_nv_V4:
2083 case Hexagon::STriw_GP_cdnPt_V4:
2084 case Hexagon::STriw_GP_cPt_nv_V4:
2085 return Hexagon::STriw_GP_cPt_V4;
2087 case Hexagon::STriw_GP_cdnNotPt_nv_V4:
2088 case Hexagon::STriw_GP_cdnNotPt_V4:
2089 case Hexagon::STriw_GP_cNotPt_nv_V4:
2090 return Hexagon::STriw_GP_cNotPt_V4;
2092 // Store new-value word - unconditional
2094 case Hexagon::STriw_nv_V4:
2095 return Hexagon::STriw;
2097 case Hexagon::STriw_indexed_nv_V4:
2098 return Hexagon::STriw_indexed;
2100 case Hexagon::STriw_indexed_shl_nv_V4:
2101 return Hexagon::STriw_indexed_shl_V4;
2103 case Hexagon::STriw_shl_nv_V4:
2104 return Hexagon::STriw_shl_V4;
2106 case Hexagon::STriw_GP_nv_V4:
2107 return Hexagon::STriw_GP_V4;
2109 case Hexagon::STw_GP_nv_V4:
2110 return Hexagon::STw_GP_V4;
2112 case Hexagon::POST_STwri_nv_V4:
2113 return Hexagon::POST_STwri;
2117 case Hexagon::STrid_cdnPt_V4 :
2118 return Hexagon::STrid_cPt;
2120 case Hexagon::STrid_cdnNotPt_V4 :
2121 return Hexagon::STrid_cNotPt;
2123 case Hexagon::STrid_indexed_cdnPt_V4 :
2124 return Hexagon::STrid_indexed_cPt;
2126 case Hexagon::STrid_indexed_cdnNotPt_V4 :
2127 return Hexagon::STrid_indexed_cNotPt;
2129 case Hexagon::STrid_indexed_shl_cdnPt_V4 :
2130 return Hexagon::STrid_indexed_shl_cPt_V4;
2132 case Hexagon::STrid_indexed_shl_cdnNotPt_V4 :
2133 return Hexagon::STrid_indexed_shl_cNotPt_V4;
2135 case Hexagon::POST_STdri_cdnPt_V4 :
2136 return Hexagon::POST_STdri_cPt;
2138 case Hexagon::POST_STdri_cdnNotPt_V4 :
2139 return Hexagon::POST_STdri_cNotPt;
2141 case Hexagon::STd_GP_cdnPt_V4 :
2142 return Hexagon::STd_GP_cPt_V4;
2144 case Hexagon::STd_GP_cdnNotPt_V4 :
2145 return Hexagon::STd_GP_cNotPt_V4;
2147 case Hexagon::STrid_GP_cdnPt_V4 :
2148 return Hexagon::STrid_GP_cPt_V4;
2150 case Hexagon::STrid_GP_cdnNotPt_V4 :
2151 return Hexagon::STrid_GP_cNotPt_V4;
2155 bool HexagonPacketizerList::DemoteToDotOld(MachineInstr* MI) {
2156 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2157 int NewOpcode = GetDotOldOp(MI->getOpcode());
2158 MI->setDesc(QII->get(NewOpcode));
2162 // Returns true if an instruction is predicated on p0 and false if it's
2163 // predicated on !p0.
2165 static bool GetPredicateSense(MachineInstr* MI,
2166 const HexagonInstrInfo *QII) {
2168 switch (MI->getOpcode()) {
2169 case Hexagon::TFR_cPt:
2170 case Hexagon::TFR_cdnPt:
2171 case Hexagon::TFRI_cPt:
2172 case Hexagon::TFRI_cdnPt:
2173 case Hexagon::STrib_cPt :
2174 case Hexagon::STrib_cdnPt_V4 :
2175 case Hexagon::STrib_indexed_cPt :
2176 case Hexagon::STrib_indexed_cdnPt_V4 :
2177 case Hexagon::STrib_indexed_shl_cPt_V4 :
2178 case Hexagon::STrib_indexed_shl_cdnPt_V4 :
2179 case Hexagon::POST_STbri_cPt :
2180 case Hexagon::POST_STbri_cdnPt_V4 :
2181 case Hexagon::STrih_cPt :
2182 case Hexagon::STrih_cdnPt_V4 :
2183 case Hexagon::STrih_indexed_cPt :
2184 case Hexagon::STrih_indexed_cdnPt_V4 :
2185 case Hexagon::STrih_indexed_shl_cPt_V4 :
2186 case Hexagon::STrih_indexed_shl_cdnPt_V4 :
2187 case Hexagon::POST_SThri_cPt :
2188 case Hexagon::POST_SThri_cdnPt_V4 :
2189 case Hexagon::STriw_cPt :
2190 case Hexagon::STriw_cdnPt_V4 :
2191 case Hexagon::STriw_indexed_cPt :
2192 case Hexagon::STriw_indexed_cdnPt_V4 :
2193 case Hexagon::STriw_indexed_shl_cPt_V4 :
2194 case Hexagon::STriw_indexed_shl_cdnPt_V4 :
2195 case Hexagon::POST_STwri_cPt :
2196 case Hexagon::POST_STwri_cdnPt_V4 :
2197 case Hexagon::STrib_imm_cPt_V4 :
2198 case Hexagon::STrib_imm_cdnPt_V4 :
2199 case Hexagon::STrid_cPt :
2200 case Hexagon::STrid_cdnPt_V4 :
2201 case Hexagon::STrid_indexed_cPt :
2202 case Hexagon::STrid_indexed_cdnPt_V4 :
2203 case Hexagon::STrid_indexed_shl_cPt_V4 :
2204 case Hexagon::STrid_indexed_shl_cdnPt_V4 :
2205 case Hexagon::POST_STdri_cPt :
2206 case Hexagon::POST_STdri_cdnPt_V4 :
2207 case Hexagon::STrih_imm_cPt_V4 :
2208 case Hexagon::STrih_imm_cdnPt_V4 :
2209 case Hexagon::STriw_imm_cPt_V4 :
2210 case Hexagon::STriw_imm_cdnPt_V4 :
2211 case Hexagon::JMP_cdnPt :
2212 case Hexagon::LDrid_cPt :
2213 case Hexagon::LDrid_cdnPt :
2214 case Hexagon::LDrid_indexed_cPt :
2215 case Hexagon::LDrid_indexed_cdnPt :
2216 case Hexagon::POST_LDrid_cPt :
2217 case Hexagon::POST_LDrid_cdnPt_V4 :
2218 case Hexagon::LDriw_cPt :
2219 case Hexagon::LDriw_cdnPt :
2220 case Hexagon::LDriw_indexed_cPt :
2221 case Hexagon::LDriw_indexed_cdnPt :
2222 case Hexagon::POST_LDriw_cPt :
2223 case Hexagon::POST_LDriw_cdnPt_V4 :
2224 case Hexagon::LDrih_cPt :
2225 case Hexagon::LDrih_cdnPt :
2226 case Hexagon::LDrih_indexed_cPt :
2227 case Hexagon::LDrih_indexed_cdnPt :
2228 case Hexagon::POST_LDrih_cPt :
2229 case Hexagon::POST_LDrih_cdnPt_V4 :
2230 case Hexagon::LDrib_cPt :
2231 case Hexagon::LDrib_cdnPt :
2232 case Hexagon::LDrib_indexed_cPt :
2233 case Hexagon::LDrib_indexed_cdnPt :
2234 case Hexagon::POST_LDrib_cPt :
2235 case Hexagon::POST_LDrib_cdnPt_V4 :
2236 case Hexagon::LDriuh_cPt :
2237 case Hexagon::LDriuh_cdnPt :
2238 case Hexagon::LDriuh_indexed_cPt :
2239 case Hexagon::LDriuh_indexed_cdnPt :
2240 case Hexagon::POST_LDriuh_cPt :
2241 case Hexagon::POST_LDriuh_cdnPt_V4 :
2242 case Hexagon::LDriub_cPt :
2243 case Hexagon::LDriub_cdnPt :
2244 case Hexagon::LDriub_indexed_cPt :
2245 case Hexagon::LDriub_indexed_cdnPt :
2246 case Hexagon::POST_LDriub_cPt :
2247 case Hexagon::POST_LDriub_cdnPt_V4 :
2248 case Hexagon::LDrid_indexed_cPt_V4 :
2249 case Hexagon::LDrid_indexed_cdnPt_V4 :
2250 case Hexagon::LDrid_indexed_shl_cPt_V4 :
2251 case Hexagon::LDrid_indexed_shl_cdnPt_V4 :
2252 case Hexagon::LDrib_indexed_cPt_V4 :
2253 case Hexagon::LDrib_indexed_cdnPt_V4 :
2254 case Hexagon::LDrib_indexed_shl_cPt_V4 :
2255 case Hexagon::LDrib_indexed_shl_cdnPt_V4 :
2256 case Hexagon::LDriub_indexed_cPt_V4 :
2257 case Hexagon::LDriub_indexed_cdnPt_V4 :
2258 case Hexagon::LDriub_indexed_shl_cPt_V4 :
2259 case Hexagon::LDriub_indexed_shl_cdnPt_V4 :
2260 case Hexagon::LDrih_indexed_cPt_V4 :
2261 case Hexagon::LDrih_indexed_cdnPt_V4 :
2262 case Hexagon::LDrih_indexed_shl_cPt_V4 :
2263 case Hexagon::LDrih_indexed_shl_cdnPt_V4 :
2264 case Hexagon::LDriuh_indexed_cPt_V4 :
2265 case Hexagon::LDriuh_indexed_cdnPt_V4 :
2266 case Hexagon::LDriuh_indexed_shl_cPt_V4 :
2267 case Hexagon::LDriuh_indexed_shl_cdnPt_V4 :
2268 case Hexagon::LDriw_indexed_cPt_V4 :
2269 case Hexagon::LDriw_indexed_cdnPt_V4 :
2270 case Hexagon::LDriw_indexed_shl_cPt_V4 :
2271 case Hexagon::LDriw_indexed_shl_cdnPt_V4 :
2272 case Hexagon::ADD_ri_cPt :
2273 case Hexagon::ADD_ri_cdnPt :
2274 case Hexagon::ADD_rr_cPt :
2275 case Hexagon::ADD_rr_cdnPt :
2276 case Hexagon::XOR_rr_cPt :
2277 case Hexagon::XOR_rr_cdnPt :
2278 case Hexagon::AND_rr_cPt :
2279 case Hexagon::AND_rr_cdnPt :
2280 case Hexagon::OR_rr_cPt :
2281 case Hexagon::OR_rr_cdnPt :
2282 case Hexagon::SUB_rr_cPt :
2283 case Hexagon::SUB_rr_cdnPt :
2284 case Hexagon::COMBINE_rr_cPt :
2285 case Hexagon::COMBINE_rr_cdnPt :
2286 case Hexagon::ASLH_cPt_V4 :
2287 case Hexagon::ASLH_cdnPt_V4 :
2288 case Hexagon::ASRH_cPt_V4 :
2289 case Hexagon::ASRH_cdnPt_V4 :
2290 case Hexagon::SXTB_cPt_V4 :
2291 case Hexagon::SXTB_cdnPt_V4 :
2292 case Hexagon::SXTH_cPt_V4 :
2293 case Hexagon::SXTH_cdnPt_V4 :
2294 case Hexagon::ZXTB_cPt_V4 :
2295 case Hexagon::ZXTB_cdnPt_V4 :
2296 case Hexagon::ZXTH_cPt_V4 :
2297 case Hexagon::ZXTH_cdnPt_V4 :
2298 case Hexagon::LDrid_GP_cPt_V4 :
2299 case Hexagon::LDrib_GP_cPt_V4 :
2300 case Hexagon::LDriub_GP_cPt_V4 :
2301 case Hexagon::LDrih_GP_cPt_V4 :
2302 case Hexagon::LDriuh_GP_cPt_V4 :
2303 case Hexagon::LDriw_GP_cPt_V4 :
2304 case Hexagon::LDd_GP_cPt_V4 :
2305 case Hexagon::LDb_GP_cPt_V4 :
2306 case Hexagon::LDub_GP_cPt_V4 :
2307 case Hexagon::LDh_GP_cPt_V4 :
2308 case Hexagon::LDuh_GP_cPt_V4 :
2309 case Hexagon::LDw_GP_cPt_V4 :
2310 case Hexagon::STrid_GP_cPt_V4 :
2311 case Hexagon::STrib_GP_cPt_V4 :
2312 case Hexagon::STrih_GP_cPt_V4 :
2313 case Hexagon::STriw_GP_cPt_V4 :
2314 case Hexagon::STd_GP_cPt_V4 :
2315 case Hexagon::STb_GP_cPt_V4 :
2316 case Hexagon::STh_GP_cPt_V4 :
2317 case Hexagon::STw_GP_cPt_V4 :
2318 case Hexagon::LDrid_GP_cdnPt_V4 :
2319 case Hexagon::LDrib_GP_cdnPt_V4 :
2320 case Hexagon::LDriub_GP_cdnPt_V4 :
2321 case Hexagon::LDrih_GP_cdnPt_V4 :
2322 case Hexagon::LDriuh_GP_cdnPt_V4 :
2323 case Hexagon::LDriw_GP_cdnPt_V4 :
2324 case Hexagon::LDd_GP_cdnPt_V4 :
2325 case Hexagon::LDb_GP_cdnPt_V4 :
2326 case Hexagon::LDub_GP_cdnPt_V4 :
2327 case Hexagon::LDh_GP_cdnPt_V4 :
2328 case Hexagon::LDuh_GP_cdnPt_V4 :
2329 case Hexagon::LDw_GP_cdnPt_V4 :
2330 case Hexagon::STrid_GP_cdnPt_V4 :
2331 case Hexagon::STrib_GP_cdnPt_V4 :
2332 case Hexagon::STrih_GP_cdnPt_V4 :
2333 case Hexagon::STriw_GP_cdnPt_V4 :
2334 case Hexagon::STd_GP_cdnPt_V4 :
2335 case Hexagon::STb_GP_cdnPt_V4 :
2336 case Hexagon::STh_GP_cdnPt_V4 :
2337 case Hexagon::STw_GP_cdnPt_V4 :
2340 case Hexagon::TFR_cNotPt:
2341 case Hexagon::TFR_cdnNotPt:
2342 case Hexagon::TFRI_cNotPt:
2343 case Hexagon::TFRI_cdnNotPt:
2344 case Hexagon::STrib_cNotPt :
2345 case Hexagon::STrib_cdnNotPt_V4 :
2346 case Hexagon::STrib_indexed_cNotPt :
2347 case Hexagon::STrib_indexed_cdnNotPt_V4 :
2348 case Hexagon::STrib_indexed_shl_cNotPt_V4 :
2349 case Hexagon::STrib_indexed_shl_cdnNotPt_V4 :
2350 case Hexagon::POST_STbri_cNotPt :
2351 case Hexagon::POST_STbri_cdnNotPt_V4 :
2352 case Hexagon::STrih_cNotPt :
2353 case Hexagon::STrih_cdnNotPt_V4 :
2354 case Hexagon::STrih_indexed_cNotPt :
2355 case Hexagon::STrih_indexed_cdnNotPt_V4 :
2356 case Hexagon::STrih_indexed_shl_cNotPt_V4 :
2357 case Hexagon::STrih_indexed_shl_cdnNotPt_V4 :
2358 case Hexagon::POST_SThri_cNotPt :
2359 case Hexagon::POST_SThri_cdnNotPt_V4 :
2360 case Hexagon::STriw_cNotPt :
2361 case Hexagon::STriw_cdnNotPt_V4 :
2362 case Hexagon::STriw_indexed_cNotPt :
2363 case Hexagon::STriw_indexed_cdnNotPt_V4 :
2364 case Hexagon::STriw_indexed_shl_cNotPt_V4 :
2365 case Hexagon::STriw_indexed_shl_cdnNotPt_V4 :
2366 case Hexagon::POST_STwri_cNotPt :
2367 case Hexagon::POST_STwri_cdnNotPt_V4 :
2368 case Hexagon::STrib_imm_cNotPt_V4 :
2369 case Hexagon::STrib_imm_cdnNotPt_V4 :
2370 case Hexagon::STrid_cNotPt :
2371 case Hexagon::STrid_cdnNotPt_V4 :
2372 case Hexagon::STrid_indexed_cdnNotPt_V4 :
2373 case Hexagon::STrid_indexed_cNotPt :
2374 case Hexagon::STrid_indexed_shl_cNotPt_V4 :
2375 case Hexagon::STrid_indexed_shl_cdnNotPt_V4 :
2376 case Hexagon::POST_STdri_cNotPt :
2377 case Hexagon::POST_STdri_cdnNotPt_V4 :
2378 case Hexagon::STrih_imm_cNotPt_V4 :
2379 case Hexagon::STrih_imm_cdnNotPt_V4 :
2380 case Hexagon::STriw_imm_cNotPt_V4 :
2381 case Hexagon::STriw_imm_cdnNotPt_V4 :
2382 case Hexagon::JMP_cdnNotPt :
2383 case Hexagon::LDrid_cNotPt :
2384 case Hexagon::LDrid_cdnNotPt :
2385 case Hexagon::LDrid_indexed_cNotPt :
2386 case Hexagon::LDrid_indexed_cdnNotPt :
2387 case Hexagon::POST_LDrid_cNotPt :
2388 case Hexagon::POST_LDrid_cdnNotPt_V4 :
2389 case Hexagon::LDriw_cNotPt :
2390 case Hexagon::LDriw_cdnNotPt :
2391 case Hexagon::LDriw_indexed_cNotPt :
2392 case Hexagon::LDriw_indexed_cdnNotPt :
2393 case Hexagon::POST_LDriw_cNotPt :
2394 case Hexagon::POST_LDriw_cdnNotPt_V4 :
2395 case Hexagon::LDrih_cNotPt :
2396 case Hexagon::LDrih_cdnNotPt :
2397 case Hexagon::LDrih_indexed_cNotPt :
2398 case Hexagon::LDrih_indexed_cdnNotPt :
2399 case Hexagon::POST_LDrih_cNotPt :
2400 case Hexagon::POST_LDrih_cdnNotPt_V4 :
2401 case Hexagon::LDrib_cNotPt :
2402 case Hexagon::LDrib_cdnNotPt :
2403 case Hexagon::LDrib_indexed_cNotPt :
2404 case Hexagon::LDrib_indexed_cdnNotPt :
2405 case Hexagon::POST_LDrib_cNotPt :
2406 case Hexagon::POST_LDrib_cdnNotPt_V4 :
2407 case Hexagon::LDriuh_cNotPt :
2408 case Hexagon::LDriuh_cdnNotPt :
2409 case Hexagon::LDriuh_indexed_cNotPt :
2410 case Hexagon::LDriuh_indexed_cdnNotPt :
2411 case Hexagon::POST_LDriuh_cNotPt :
2412 case Hexagon::POST_LDriuh_cdnNotPt_V4 :
2413 case Hexagon::LDriub_cNotPt :
2414 case Hexagon::LDriub_cdnNotPt :
2415 case Hexagon::LDriub_indexed_cNotPt :
2416 case Hexagon::LDriub_indexed_cdnNotPt :
2417 case Hexagon::POST_LDriub_cNotPt :
2418 case Hexagon::POST_LDriub_cdnNotPt_V4 :
2419 case Hexagon::LDrid_indexed_cNotPt_V4 :
2420 case Hexagon::LDrid_indexed_cdnNotPt_V4 :
2421 case Hexagon::LDrid_indexed_shl_cNotPt_V4 :
2422 case Hexagon::LDrid_indexed_shl_cdnNotPt_V4 :
2423 case Hexagon::LDrib_indexed_cNotPt_V4 :
2424 case Hexagon::LDrib_indexed_cdnNotPt_V4 :
2425 case Hexagon::LDrib_indexed_shl_cNotPt_V4 :
2426 case Hexagon::LDrib_indexed_shl_cdnNotPt_V4 :
2427 case Hexagon::LDriub_indexed_cNotPt_V4 :
2428 case Hexagon::LDriub_indexed_cdnNotPt_V4 :
2429 case Hexagon::LDriub_indexed_shl_cNotPt_V4 :
2430 case Hexagon::LDriub_indexed_shl_cdnNotPt_V4 :
2431 case Hexagon::LDrih_indexed_cNotPt_V4 :
2432 case Hexagon::LDrih_indexed_cdnNotPt_V4 :
2433 case Hexagon::LDrih_indexed_shl_cNotPt_V4 :
2434 case Hexagon::LDrih_indexed_shl_cdnNotPt_V4 :
2435 case Hexagon::LDriuh_indexed_cNotPt_V4 :
2436 case Hexagon::LDriuh_indexed_cdnNotPt_V4 :
2437 case Hexagon::LDriuh_indexed_shl_cNotPt_V4 :
2438 case Hexagon::LDriuh_indexed_shl_cdnNotPt_V4 :
2439 case Hexagon::LDriw_indexed_cNotPt_V4 :
2440 case Hexagon::LDriw_indexed_cdnNotPt_V4 :
2441 case Hexagon::LDriw_indexed_shl_cNotPt_V4 :
2442 case Hexagon::LDriw_indexed_shl_cdnNotPt_V4 :
2443 case Hexagon::ADD_ri_cNotPt :
2444 case Hexagon::ADD_ri_cdnNotPt :
2445 case Hexagon::ADD_rr_cNotPt :
2446 case Hexagon::ADD_rr_cdnNotPt :
2447 case Hexagon::XOR_rr_cNotPt :
2448 case Hexagon::XOR_rr_cdnNotPt :
2449 case Hexagon::AND_rr_cNotPt :
2450 case Hexagon::AND_rr_cdnNotPt :
2451 case Hexagon::OR_rr_cNotPt :
2452 case Hexagon::OR_rr_cdnNotPt :
2453 case Hexagon::SUB_rr_cNotPt :
2454 case Hexagon::SUB_rr_cdnNotPt :
2455 case Hexagon::COMBINE_rr_cNotPt :
2456 case Hexagon::COMBINE_rr_cdnNotPt :
2457 case Hexagon::ASLH_cNotPt_V4 :
2458 case Hexagon::ASLH_cdnNotPt_V4 :
2459 case Hexagon::ASRH_cNotPt_V4 :
2460 case Hexagon::ASRH_cdnNotPt_V4 :
2461 case Hexagon::SXTB_cNotPt_V4 :
2462 case Hexagon::SXTB_cdnNotPt_V4 :
2463 case Hexagon::SXTH_cNotPt_V4 :
2464 case Hexagon::SXTH_cdnNotPt_V4 :
2465 case Hexagon::ZXTB_cNotPt_V4 :
2466 case Hexagon::ZXTB_cdnNotPt_V4 :
2467 case Hexagon::ZXTH_cNotPt_V4 :
2468 case Hexagon::ZXTH_cdnNotPt_V4 :
2470 case Hexagon::LDrid_GP_cNotPt_V4 :
2471 case Hexagon::LDrib_GP_cNotPt_V4 :
2472 case Hexagon::LDriub_GP_cNotPt_V4 :
2473 case Hexagon::LDrih_GP_cNotPt_V4 :
2474 case Hexagon::LDriuh_GP_cNotPt_V4 :
2475 case Hexagon::LDriw_GP_cNotPt_V4 :
2476 case Hexagon::LDd_GP_cNotPt_V4 :
2477 case Hexagon::LDb_GP_cNotPt_V4 :
2478 case Hexagon::LDub_GP_cNotPt_V4 :
2479 case Hexagon::LDh_GP_cNotPt_V4 :
2480 case Hexagon::LDuh_GP_cNotPt_V4 :
2481 case Hexagon::LDw_GP_cNotPt_V4 :
2482 case Hexagon::STrid_GP_cNotPt_V4 :
2483 case Hexagon::STrib_GP_cNotPt_V4 :
2484 case Hexagon::STrih_GP_cNotPt_V4 :
2485 case Hexagon::STriw_GP_cNotPt_V4 :
2486 case Hexagon::STd_GP_cNotPt_V4 :
2487 case Hexagon::STb_GP_cNotPt_V4 :
2488 case Hexagon::STh_GP_cNotPt_V4 :
2489 case Hexagon::STw_GP_cNotPt_V4 :
2490 case Hexagon::LDrid_GP_cdnNotPt_V4 :
2491 case Hexagon::LDrib_GP_cdnNotPt_V4 :
2492 case Hexagon::LDriub_GP_cdnNotPt_V4 :
2493 case Hexagon::LDrih_GP_cdnNotPt_V4 :
2494 case Hexagon::LDriuh_GP_cdnNotPt_V4 :
2495 case Hexagon::LDriw_GP_cdnNotPt_V4 :
2496 case Hexagon::LDd_GP_cdnNotPt_V4 :
2497 case Hexagon::LDb_GP_cdnNotPt_V4 :
2498 case Hexagon::LDub_GP_cdnNotPt_V4 :
2499 case Hexagon::LDh_GP_cdnNotPt_V4 :
2500 case Hexagon::LDuh_GP_cdnNotPt_V4 :
2501 case Hexagon::LDw_GP_cdnNotPt_V4 :
2502 case Hexagon::STrid_GP_cdnNotPt_V4 :
2503 case Hexagon::STrib_GP_cdnNotPt_V4 :
2504 case Hexagon::STrih_GP_cdnNotPt_V4 :
2505 case Hexagon::STriw_GP_cdnNotPt_V4 :
2506 case Hexagon::STd_GP_cdnNotPt_V4 :
2507 case Hexagon::STb_GP_cdnNotPt_V4 :
2508 case Hexagon::STh_GP_cdnNotPt_V4 :
2509 case Hexagon::STw_GP_cdnNotPt_V4 :
2513 assert (false && "Unknown predicate sense of the instruction");
2515 // return *some value* to avoid compiler warning
2519 bool HexagonPacketizerList::isDotNewInst(MachineInstr* MI) {
2520 if (isNewValueInst(MI))
2523 switch (MI->getOpcode()) {
2524 case Hexagon::TFR_cdnNotPt:
2525 case Hexagon::TFR_cdnPt:
2526 case Hexagon::TFRI_cdnNotPt:
2527 case Hexagon::TFRI_cdnPt:
2528 case Hexagon::LDrid_cdnPt :
2529 case Hexagon::LDrid_cdnNotPt :
2530 case Hexagon::LDrid_indexed_cdnPt :
2531 case Hexagon::LDrid_indexed_cdnNotPt :
2532 case Hexagon::POST_LDrid_cdnPt_V4 :
2533 case Hexagon::POST_LDrid_cdnNotPt_V4 :
2534 case Hexagon::LDriw_cdnPt :
2535 case Hexagon::LDriw_cdnNotPt :
2536 case Hexagon::LDriw_indexed_cdnPt :
2537 case Hexagon::LDriw_indexed_cdnNotPt :
2538 case Hexagon::POST_LDriw_cdnPt_V4 :
2539 case Hexagon::POST_LDriw_cdnNotPt_V4 :
2540 case Hexagon::LDrih_cdnPt :
2541 case Hexagon::LDrih_cdnNotPt :
2542 case Hexagon::LDrih_indexed_cdnPt :
2543 case Hexagon::LDrih_indexed_cdnNotPt :
2544 case Hexagon::POST_LDrih_cdnPt_V4 :
2545 case Hexagon::POST_LDrih_cdnNotPt_V4 :
2546 case Hexagon::LDrib_cdnPt :
2547 case Hexagon::LDrib_cdnNotPt :
2548 case Hexagon::LDrib_indexed_cdnPt :
2549 case Hexagon::LDrib_indexed_cdnNotPt :
2550 case Hexagon::POST_LDrib_cdnPt_V4 :
2551 case Hexagon::POST_LDrib_cdnNotPt_V4 :
2552 case Hexagon::LDriuh_cdnPt :
2553 case Hexagon::LDriuh_cdnNotPt :
2554 case Hexagon::LDriuh_indexed_cdnPt :
2555 case Hexagon::LDriuh_indexed_cdnNotPt :
2556 case Hexagon::POST_LDriuh_cdnPt_V4 :
2557 case Hexagon::POST_LDriuh_cdnNotPt_V4 :
2558 case Hexagon::LDriub_cdnPt :
2559 case Hexagon::LDriub_cdnNotPt :
2560 case Hexagon::LDriub_indexed_cdnPt :
2561 case Hexagon::LDriub_indexed_cdnNotPt :
2562 case Hexagon::POST_LDriub_cdnPt_V4 :
2563 case Hexagon::POST_LDriub_cdnNotPt_V4 :
2565 case Hexagon::LDrid_indexed_cdnPt_V4 :
2566 case Hexagon::LDrid_indexed_cdnNotPt_V4 :
2567 case Hexagon::LDrid_indexed_shl_cdnPt_V4 :
2568 case Hexagon::LDrid_indexed_shl_cdnNotPt_V4 :
2569 case Hexagon::LDrib_indexed_cdnPt_V4 :
2570 case Hexagon::LDrib_indexed_cdnNotPt_V4 :
2571 case Hexagon::LDrib_indexed_shl_cdnPt_V4 :
2572 case Hexagon::LDrib_indexed_shl_cdnNotPt_V4 :
2573 case Hexagon::LDriub_indexed_cdnPt_V4 :
2574 case Hexagon::LDriub_indexed_cdnNotPt_V4 :
2575 case Hexagon::LDriub_indexed_shl_cdnPt_V4 :
2576 case Hexagon::LDriub_indexed_shl_cdnNotPt_V4 :
2577 case Hexagon::LDrih_indexed_cdnPt_V4 :
2578 case Hexagon::LDrih_indexed_cdnNotPt_V4 :
2579 case Hexagon::LDrih_indexed_shl_cdnPt_V4 :
2580 case Hexagon::LDrih_indexed_shl_cdnNotPt_V4 :
2581 case Hexagon::LDriuh_indexed_cdnPt_V4 :
2582 case Hexagon::LDriuh_indexed_cdnNotPt_V4 :
2583 case Hexagon::LDriuh_indexed_shl_cdnPt_V4 :
2584 case Hexagon::LDriuh_indexed_shl_cdnNotPt_V4 :
2585 case Hexagon::LDriw_indexed_cdnPt_V4 :
2586 case Hexagon::LDriw_indexed_cdnNotPt_V4 :
2587 case Hexagon::LDriw_indexed_shl_cdnPt_V4 :
2588 case Hexagon::LDriw_indexed_shl_cdnNotPt_V4 :
2591 case Hexagon::ADD_ri_cdnPt:
2592 case Hexagon::ADD_ri_cdnNotPt:
2593 case Hexagon::ADD_rr_cdnPt:
2594 case Hexagon::ADD_rr_cdnNotPt:
2596 // Conditional logical operations
2597 case Hexagon::XOR_rr_cdnPt :
2598 case Hexagon::XOR_rr_cdnNotPt :
2599 case Hexagon::AND_rr_cdnPt :
2600 case Hexagon::AND_rr_cdnNotPt :
2601 case Hexagon::OR_rr_cdnPt :
2602 case Hexagon::OR_rr_cdnNotPt :
2604 // Conditonal subtract
2605 case Hexagon::SUB_rr_cdnPt :
2606 case Hexagon::SUB_rr_cdnNotPt :
2608 // Conditional combine
2609 case Hexagon::COMBINE_rr_cdnPt :
2610 case Hexagon::COMBINE_rr_cdnNotPt :
2612 // Conditional shift operations
2613 case Hexagon::ASLH_cdnPt_V4:
2614 case Hexagon::ASLH_cdnNotPt_V4:
2615 case Hexagon::ASRH_cdnPt_V4:
2616 case Hexagon::ASRH_cdnNotPt_V4:
2617 case Hexagon::SXTB_cdnPt_V4:
2618 case Hexagon::SXTB_cdnNotPt_V4:
2619 case Hexagon::SXTH_cdnPt_V4:
2620 case Hexagon::SXTH_cdnNotPt_V4:
2621 case Hexagon::ZXTB_cdnPt_V4:
2622 case Hexagon::ZXTB_cdnNotPt_V4:
2623 case Hexagon::ZXTH_cdnPt_V4:
2624 case Hexagon::ZXTH_cdnNotPt_V4:
2626 // Conditional stores
2627 case Hexagon::STrib_imm_cdnPt_V4 :
2628 case Hexagon::STrib_imm_cdnNotPt_V4 :
2629 case Hexagon::STrib_cdnPt_V4 :
2630 case Hexagon::STrib_cdnNotPt_V4 :
2631 case Hexagon::STrib_indexed_cdnPt_V4 :
2632 case Hexagon::STrib_indexed_cdnNotPt_V4 :
2633 case Hexagon::POST_STbri_cdnPt_V4 :
2634 case Hexagon::POST_STbri_cdnNotPt_V4 :
2635 case Hexagon::STrib_indexed_shl_cdnPt_V4 :
2636 case Hexagon::STrib_indexed_shl_cdnNotPt_V4 :
2638 // Store doubleword conditionally
2639 case Hexagon::STrid_indexed_cdnPt_V4 :
2640 case Hexagon::STrid_indexed_cdnNotPt_V4 :
2641 case Hexagon::STrid_indexed_shl_cdnPt_V4 :
2642 case Hexagon::STrid_indexed_shl_cdnNotPt_V4 :
2643 case Hexagon::POST_STdri_cdnPt_V4 :
2644 case Hexagon::POST_STdri_cdnNotPt_V4 :
2646 // Store halfword conditionally
2647 case Hexagon::STrih_cdnPt_V4 :
2648 case Hexagon::STrih_cdnNotPt_V4 :
2649 case Hexagon::STrih_indexed_cdnPt_V4 :
2650 case Hexagon::STrih_indexed_cdnNotPt_V4 :
2651 case Hexagon::STrih_imm_cdnPt_V4 :
2652 case Hexagon::STrih_imm_cdnNotPt_V4 :
2653 case Hexagon::STrih_indexed_shl_cdnPt_V4 :
2654 case Hexagon::STrih_indexed_shl_cdnNotPt_V4 :
2655 case Hexagon::POST_SThri_cdnPt_V4 :
2656 case Hexagon::POST_SThri_cdnNotPt_V4 :
2658 // Store word conditionally
2659 case Hexagon::STriw_cdnPt_V4 :
2660 case Hexagon::STriw_cdnNotPt_V4 :
2661 case Hexagon::STriw_indexed_cdnPt_V4 :
2662 case Hexagon::STriw_indexed_cdnNotPt_V4 :
2663 case Hexagon::STriw_imm_cdnPt_V4 :
2664 case Hexagon::STriw_imm_cdnNotPt_V4 :
2665 case Hexagon::STriw_indexed_shl_cdnPt_V4 :
2666 case Hexagon::STriw_indexed_shl_cdnNotPt_V4 :
2667 case Hexagon::POST_STwri_cdnPt_V4 :
2668 case Hexagon::POST_STwri_cdnNotPt_V4 :
2670 case Hexagon::LDd_GP_cdnPt_V4:
2671 case Hexagon::LDd_GP_cdnNotPt_V4:
2672 case Hexagon::LDb_GP_cdnPt_V4:
2673 case Hexagon::LDb_GP_cdnNotPt_V4:
2674 case Hexagon::LDub_GP_cdnPt_V4:
2675 case Hexagon::LDub_GP_cdnNotPt_V4:
2676 case Hexagon::LDh_GP_cdnPt_V4:
2677 case Hexagon::LDh_GP_cdnNotPt_V4:
2678 case Hexagon::LDuh_GP_cdnPt_V4:
2679 case Hexagon::LDuh_GP_cdnNotPt_V4:
2680 case Hexagon::LDw_GP_cdnPt_V4:
2681 case Hexagon::LDw_GP_cdnNotPt_V4:
2682 case Hexagon::LDrid_GP_cdnPt_V4:
2683 case Hexagon::LDrid_GP_cdnNotPt_V4:
2684 case Hexagon::LDrib_GP_cdnPt_V4:
2685 case Hexagon::LDrib_GP_cdnNotPt_V4:
2686 case Hexagon::LDriub_GP_cdnPt_V4:
2687 case Hexagon::LDriub_GP_cdnNotPt_V4:
2688 case Hexagon::LDrih_GP_cdnPt_V4:
2689 case Hexagon::LDrih_GP_cdnNotPt_V4:
2690 case Hexagon::LDriuh_GP_cdnPt_V4:
2691 case Hexagon::LDriuh_GP_cdnNotPt_V4:
2692 case Hexagon::LDriw_GP_cdnPt_V4:
2693 case Hexagon::LDriw_GP_cdnNotPt_V4:
2695 case Hexagon::STrid_GP_cdnPt_V4:
2696 case Hexagon::STrid_GP_cdnNotPt_V4:
2697 case Hexagon::STrib_GP_cdnPt_V4:
2698 case Hexagon::STrib_GP_cdnNotPt_V4:
2699 case Hexagon::STrih_GP_cdnPt_V4:
2700 case Hexagon::STrih_GP_cdnNotPt_V4:
2701 case Hexagon::STriw_GP_cdnPt_V4:
2702 case Hexagon::STriw_GP_cdnNotPt_V4:
2703 case Hexagon::STd_GP_cdnPt_V4:
2704 case Hexagon::STd_GP_cdnNotPt_V4:
2705 case Hexagon::STb_GP_cdnPt_V4:
2706 case Hexagon::STb_GP_cdnNotPt_V4:
2707 case Hexagon::STh_GP_cdnPt_V4:
2708 case Hexagon::STh_GP_cdnNotPt_V4:
2709 case Hexagon::STw_GP_cdnPt_V4:
2710 case Hexagon::STw_GP_cdnNotPt_V4:
2717 static MachineOperand& GetPostIncrementOperand(MachineInstr *MI,
2718 const HexagonInstrInfo *QII) {
2719 assert(QII->isPostIncrement(MI) && "Not a post increment operation.");
2721 // Post Increment means duplicates. Use dense map to find duplicates in the
2722 // list. Caution: Densemap initializes with the minimum of 64 buckets,
2723 // whereas there are at most 5 operands in the post increment.
2724 DenseMap<unsigned, unsigned> DefRegsSet;
2725 for(unsigned opNum = 0; opNum < MI->getNumOperands(); opNum++)
2726 if (MI->getOperand(opNum).isReg() &&
2727 MI->getOperand(opNum).isDef()) {
2728 DefRegsSet[MI->getOperand(opNum).getReg()] = 1;
2731 for(unsigned opNum = 0; opNum < MI->getNumOperands(); opNum++)
2732 if (MI->getOperand(opNum).isReg() &&
2733 MI->getOperand(opNum).isUse()) {
2734 if (DefRegsSet[MI->getOperand(opNum).getReg()]) {
2735 return MI->getOperand(opNum);
2739 if (MI->getDesc().mayLoad()) {
2740 // The 2nd operand is always the post increment operand in load.
2741 assert(MI->getOperand(1).isReg() &&
2742 "Post increment operand has be to a register.");
2743 return (MI->getOperand(1));
2745 if (MI->getDesc().mayStore()) {
2746 // The 1st operand is always the post increment operand in store.
2747 assert(MI->getOperand(0).isReg() &&
2748 "Post increment operand has be to a register.");
2749 return (MI->getOperand(0));
2752 // we should never come here.
2753 llvm_unreachable("mayLoad or mayStore not set for Post Increment operation");
2756 // get the value being stored
2757 static MachineOperand& GetStoreValueOperand(MachineInstr *MI) {
2758 // value being stored is always the last operand.
2759 return (MI->getOperand(MI->getNumOperands()-1));
2762 // can be new value store?
2763 // Following restrictions are to be respected in convert a store into
2764 // a new value store.
2765 // 1. If an instruction uses auto-increment, its address register cannot
2766 // be a new-value register. Arch Spec 5.4.2.1
2767 // 2. If an instruction uses absolute-set addressing mode,
2768 // its address register cannot be a new-value register.
2769 // Arch Spec 5.4.2.1.TODO: This is not enabled as
2770 // as absolute-set address mode patters are not implemented.
2771 // 3. If an instruction produces a 64-bit result, its registers cannot be used
2772 // as new-value registers. Arch Spec 5.4.2.2.
2773 // 4. If the instruction that sets a new-value register is conditional, then
2774 // the instruction that uses the new-value register must also be conditional,
2775 // and both must always have their predicates evaluate identically.
2776 // Arch Spec 5.4.2.3.
2777 // 5. There is an implied restriction of a packet can not have another store,
2778 // if there is a new value store in the packet. Corollary, if there is
2779 // already a store in a packet, there can not be a new value store.
2780 // Arch Spec: 3.4.4.2
2781 bool HexagonPacketizerList::CanPromoteToNewValueStore( MachineInstr *MI,
2782 MachineInstr *PacketMI, unsigned DepReg,
2783 std::map <MachineInstr*, SUnit*> MIToSUnit)
2785 // Make sure we are looking at the store
2786 if (!IsNewifyStore(MI))
2789 // Make sure there is dependency and can be new value'ed
2790 if (GetStoreValueOperand(MI).isReg() &&
2791 GetStoreValueOperand(MI).getReg() != DepReg)
2794 const HexagonRegisterInfo* QRI = (const HexagonRegisterInfo *) TM.getRegisterInfo();
2795 const MCInstrDesc& MCID = PacketMI->getDesc();
2796 // first operand is always the result
2798 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2799 const TargetRegisterClass* PacketRC = QII->getRegClass(MCID, 0, QRI);
2801 // if there is already an store in the packet, no can do new value store
2802 // Arch Spec 3.4.4.2.
2803 for (std::vector<MachineInstr*>::iterator VI = CurrentPacketMIs.begin(),
2804 VE = CurrentPacketMIs.end();
2806 SUnit* PacketSU = MIToSUnit[*VI];
2807 if (PacketSU->getInstr()->getDesc().mayStore() ||
2808 // if we have mayStore = 1 set on ALLOCFRAME and DEALLOCFRAME,
2809 // then we don't need this
2810 PacketSU->getInstr()->getOpcode() == Hexagon::ALLOCFRAME ||
2811 PacketSU->getInstr()->getOpcode() == Hexagon::DEALLOCFRAME)
2815 if (PacketRC == &Hexagon::DoubleRegsRegClass) {
2816 // new value store constraint: double regs can not feed into new value store
2817 // arch spec section: 5.4.2.2
2821 // Make sure it's NOT the post increment register that we are going to
2823 if (QII->isPostIncrement(MI) &&
2824 MI->getDesc().mayStore() &&
2825 GetPostIncrementOperand(MI, QII).getReg() == DepReg) {
2829 if (QII->isPostIncrement(PacketMI) &&
2830 PacketMI->getDesc().mayLoad() &&
2831 GetPostIncrementOperand(PacketMI, QII).getReg() == DepReg) {
2832 // if source is post_inc, or absolute-set addressing,
2833 // it can not feed into new value store
2834 // r3 = memw(r2++#4)
2835 // memw(r30 + #-1404) = r2.new -> can not be new value store
2836 // arch spec section: 5.4.2.1
2840 // If the source that feeds the store is predicated, new value store must also be
2842 if (QII->isPredicated(PacketMI)) {
2843 if (!QII->isPredicated(MI))
2846 // Check to make sure that they both will have their predicates
2847 // evaluate identically
2848 unsigned predRegNumSrc;
2849 unsigned predRegNumDst;
2850 const TargetRegisterClass* predRegClass;
2852 // Get predicate register used in the source instruction
2853 for(unsigned opNum = 0; opNum < PacketMI->getNumOperands(); opNum++) {
2854 if ( PacketMI->getOperand(opNum).isReg())
2855 predRegNumSrc = PacketMI->getOperand(opNum).getReg();
2856 predRegClass = QRI->getMinimalPhysRegClass(predRegNumSrc);
2857 if (predRegClass == &Hexagon::PredRegsRegClass) {
2861 assert ((predRegClass == &Hexagon::PredRegsRegClass ) &&
2862 ("predicate register not found in a predicated PacketMI instruction"));
2864 // Get predicate register used in new-value store instruction
2865 for(unsigned opNum = 0; opNum < MI->getNumOperands(); opNum++) {
2866 if ( MI->getOperand(opNum).isReg())
2867 predRegNumDst = MI->getOperand(opNum).getReg();
2868 predRegClass = QRI->getMinimalPhysRegClass(predRegNumDst);
2869 if (predRegClass == &Hexagon::PredRegsRegClass) {
2873 assert ((predRegClass == &Hexagon::PredRegsRegClass ) &&
2874 ("predicate register not found in a predicated MI instruction"));
2876 // New-value register producer and user (store) need to satisfy these
2878 // 1) Both instructions should be predicated on the same register.
2879 // 2) If producer of the new-value register is .new predicated then store
2880 // should also be .new predicated and if producer is not .new predicated
2881 // then store should not be .new predicated.
2882 // 3) Both new-value register producer and user should have same predicate
2883 // sense, i.e, either both should be negated or both should be none negated.
2885 if (( predRegNumDst != predRegNumSrc) ||
2886 isDotNewInst(PacketMI) != isDotNewInst(MI) ||
2887 GetPredicateSense(MI, QII) != GetPredicateSense(PacketMI, QII)) {
2892 // Make sure that other than the new-value register no other store instruction
2893 // register has been modified in the same packet. Predicate registers can be
2894 // modified by they should not be modified between the producer and the store
2895 // instruction as it will make them both conditional on different values.
2896 // We already know this to be true for all the instructions before and
2897 // including PacketMI. Howerver, we need to perform the check for the
2898 // remaining instructions in the packet.
2900 std::vector<MachineInstr*>::iterator VI;
2901 std::vector<MachineInstr*>::iterator VE;
2902 unsigned StartCheck = 0;
2904 for (VI=CurrentPacketMIs.begin(), VE = CurrentPacketMIs.end();
2906 SUnit* TempSU = MIToSUnit[*VI];
2907 MachineInstr* TempMI = TempSU->getInstr();
2909 // Following condition is true for all the instructions until PacketMI is
2910 // reached (StartCheck is set to 0 before the for loop).
2911 // StartCheck flag is 1 for all the instructions after PacketMI.
2912 if (TempMI != PacketMI && !StartCheck) // start processing only after
2913 continue; // encountering PacketMI
2916 if (TempMI == PacketMI) // We don't want to check PacketMI for dependence
2919 for(unsigned opNum = 0; opNum < MI->getNumOperands(); opNum++) {
2920 if (MI->getOperand(opNum).isReg() &&
2921 TempSU->getInstr()->modifiesRegister(MI->getOperand(opNum).getReg(), QRI))
2926 // Make sure that for non POST_INC stores:
2927 // 1. The only use of reg is DepReg and no other registers.
2928 // This handles V4 base+index registers.
2929 // The following store can not be dot new.
2930 // Eg. r0 = add(r0, #3)a
2931 // memw(r1+r0<<#2) = r0
2932 if (!QII->isPostIncrement(MI) &&
2933 GetStoreValueOperand(MI).isReg() &&
2934 GetStoreValueOperand(MI).getReg() == DepReg) {
2935 for(unsigned opNum = 0; opNum < MI->getNumOperands()-1; opNum++) {
2936 if (MI->getOperand(opNum).isReg() &&
2937 MI->getOperand(opNum).getReg() == DepReg) {
2941 // 2. If data definition is because of implicit definition of the register,
2942 // do not newify the store. Eg.
2943 // %R9<def> = ZXTH %R12, %D6<imp-use>, %R12<imp-def>
2944 // STrih_indexed %R8, 2, %R12<kill>; mem:ST2[%scevgep343]
2945 for(unsigned opNum = 0; opNum < PacketMI->getNumOperands(); opNum++) {
2946 if (PacketMI->getOperand(opNum).isReg() &&
2947 PacketMI->getOperand(opNum).getReg() == DepReg &&
2948 PacketMI->getOperand(opNum).isDef() &&
2949 PacketMI->getOperand(opNum).isImplicit()) {
2955 // Can be dot new store.
2959 // can this MI to promoted to either
2960 // new value store or new value jump
2961 bool HexagonPacketizerList::CanPromoteToNewValue( MachineInstr *MI,
2962 SUnit *PacketSU, unsigned DepReg,
2963 std::map <MachineInstr*, SUnit*> MIToSUnit,
2964 MachineBasicBlock::iterator &MII)
2967 const HexagonRegisterInfo* QRI = (const HexagonRegisterInfo *) TM.getRegisterInfo();
2968 if (!QRI->Subtarget.hasV4TOps() ||
2972 MachineInstr *PacketMI = PacketSU->getInstr();
2974 // Check to see the store can be new value'ed.
2975 if (CanPromoteToNewValueStore(MI, PacketMI, DepReg, MIToSUnit))
2978 // Check to see the compare/jump can be new value'ed.
2979 // This is done as a pass on its own. Don't need to check it here.
2983 // Check to see if an instruction can be dot new
2984 // There are three kinds.
2985 // 1. dot new on predicate - V2/V3/V4
2986 // 2. dot new on stores NV/ST - V4
2987 // 3. dot new on jump NV/J - V4 -- This is generated in a pass.
2988 bool HexagonPacketizerList::CanPromoteToDotNew( MachineInstr *MI,
2989 SUnit *PacketSU, unsigned DepReg,
2990 std::map <MachineInstr*, SUnit*> MIToSUnit,
2991 MachineBasicBlock::iterator &MII,
2992 const TargetRegisterClass* RC )
2994 // already a dot new instruction
2995 if (isDotNewInst(MI) && !IsNewifyStore(MI))
2998 if (!isNewifiable(MI))
3002 if (RC == &Hexagon::PredRegsRegClass && isCondInst(MI))
3004 else if (RC != &Hexagon::PredRegsRegClass &&
3005 !IsNewifyStore(MI)) // MI is not a new-value store
3008 // Create a dot new machine instruction to see if resources can be
3009 // allocated. If not, bail out now.
3010 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
3011 int NewOpcode = GetDotNewOp(MI->getOpcode());
3012 const MCInstrDesc &desc = QII->get(NewOpcode);
3014 MachineInstr *NewMI = MI->getParent()->getParent()->CreateMachineInstr(desc, dl);
3015 bool ResourcesAvailable = ResourceTracker->canReserveResources(NewMI);
3016 MI->getParent()->getParent()->DeleteMachineInstr(NewMI);
3018 if (!ResourcesAvailable)
3021 // new value store only
3022 // new new value jump generated as a passes
3023 if (!CanPromoteToNewValue(MI, PacketSU, DepReg, MIToSUnit, MII)) {
3030 // Go through the packet instructions and search for anti dependency
3031 // between them and DepReg from MI
3032 // Consider this case:
3034 // a) %R1<def> = TFRI_cdNotPt %P3, 2
3037 // b) %P0<def> = OR_pp %P3<kill>, %P0<kill>
3038 // c) %P3<def> = TFR_PdRs %R23
3039 // d) %R1<def> = TFRI_cdnPt %P3, 4
3041 // The P3 from a) and d) will be complements after
3042 // a)'s P3 is converted to .new form
3043 // Anti Dep between c) and b) is irrelevant for this case
3044 bool HexagonPacketizerList::RestrictingDepExistInPacket (MachineInstr* MI,
3046 std::map <MachineInstr*, SUnit*> MIToSUnit) {
3048 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
3049 SUnit* PacketSUDep = MIToSUnit[MI];
3051 for (std::vector<MachineInstr*>::iterator VIN = CurrentPacketMIs.begin(),
3052 VEN = CurrentPacketMIs.end(); (VIN != VEN); ++VIN) {
3054 // We only care for dependencies to predicated instructions
3055 if(!QII->isPredicated(*VIN)) continue;
3057 // Scheduling Unit for current insn in the packet
3058 SUnit* PacketSU = MIToSUnit[*VIN];
3060 // Look at dependencies between current members of the packet
3061 // and predicate defining instruction MI.
3062 // Make sure that dependency is on the exact register
3064 if (PacketSU->isSucc(PacketSUDep)) {
3065 for (unsigned i = 0; i < PacketSU->Succs.size(); ++i) {
3066 if ((PacketSU->Succs[i].getSUnit() == PacketSUDep) &&
3067 (PacketSU->Succs[i].getKind() == SDep::Anti) &&
3068 (PacketSU->Succs[i].getReg() == DepReg)) {
3079 // Given two predicated instructions, this function detects whether
3080 // the predicates are complements
3081 bool HexagonPacketizerList::ArePredicatesComplements (MachineInstr* MI1,
3082 MachineInstr* MI2, std::map <MachineInstr*, SUnit*> MIToSUnit) {
3084 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
3085 // Currently can only reason about conditional transfers
3086 if (!QII->isConditionalTransfer(MI1) || !QII->isConditionalTransfer(MI2)) {
3090 // Scheduling unit for candidate
3091 SUnit* SU = MIToSUnit[MI1];
3093 // One corner case deals with the following scenario:
3095 // a) %R24<def> = TFR_cPt %P0, %R25
3099 // b) %R25<def> = TFR_cNotPt %P0, %R24
3100 // c) %P0<def> = CMPEQri %R26, 1
3103 // On general check a) and b) are complements, but
3104 // presence of c) will convert a) to .new form, and
3105 // then it is not a complement
3106 // We attempt to detect it by analyzing existing
3107 // dependencies in the packet
3109 // Analyze relationships between all existing members of the packet.
3110 // Look for Anti dependecy on the same predicate reg
3111 // as used in the candidate
3112 for (std::vector<MachineInstr*>::iterator VIN = CurrentPacketMIs.begin(),
3113 VEN = CurrentPacketMIs.end(); (VIN != VEN); ++VIN) {
3115 // Scheduling Unit for current insn in the packet
3116 SUnit* PacketSU = MIToSUnit[*VIN];
3118 // If this instruction in the packet is succeeded by the candidate...
3119 if (PacketSU->isSucc(SU)) {
3120 for (unsigned i = 0; i < PacketSU->Succs.size(); ++i) {
3121 // The corner case exist when there is true data
3122 // dependency between candidate and one of current
3123 // packet members, this dep is on predicate reg, and
3124 // there already exist anti dep on the same pred in
3126 if (PacketSU->Succs[i].getSUnit() == SU &&
3127 Hexagon::PredRegsRegClass.contains(
3128 PacketSU->Succs[i].getReg()) &&
3129 PacketSU->Succs[i].getKind() == SDep::Data &&
3130 // Here I know that *VIN is predicate setting instruction
3131 // with true data dep to candidate on the register
3132 // we care about - c) in the above example.
3133 // Now I need to see if there is an anti dependency
3134 // from c) to any other instruction in the
3135 // same packet on the pred reg of interest
3136 RestrictingDepExistInPacket(*VIN,PacketSU->Succs[i].getReg(),
3144 // If the above case does not apply, check regular
3145 // complement condition.
3146 // Check that the predicate register is the same and
3147 // that the predicate sense is different
3148 // We also need to differentiate .old vs. .new:
3149 // !p0 is not complimentary to p0.new
3150 return ((MI1->getOperand(1).getReg() == MI2->getOperand(1).getReg()) &&
3151 (GetPredicateSense(MI1, QII) != GetPredicateSense(MI2, QII)) &&
3152 (isDotNewInst(MI1) == isDotNewInst(MI2)));
3155 // initPacketizerState - Initialize packetizer flags
3156 void HexagonPacketizerList::initPacketizerState(void) {
3159 PromotedToDotNew = false;
3160 GlueToNewValueJump = false;
3161 GlueAllocframeStore = false;
3162 FoundSequentialDependence = false;
3167 // ignorePseudoInstruction - Ignore bundling of pseudo instructions.
3168 bool HexagonPacketizerList::ignorePseudoInstruction(MachineInstr *MI,
3169 MachineBasicBlock *MBB) {
3170 if (MI->isDebugValue())
3173 // We must print out inline assembly
3174 if (MI->isInlineAsm())
3177 // We check if MI has any functional units mapped to it.
3178 // If it doesn't, we ignore the instruction.
3179 const MCInstrDesc& TID = MI->getDesc();
3180 unsigned SchedClass = TID.getSchedClass();
3181 const InstrStage* IS = ResourceTracker->getInstrItins()->beginStage(SchedClass);
3182 unsigned FuncUnits = IS->getUnits();
3186 // isSoloInstruction: - Returns true for instructions that must be
3187 // scheduled in their own packet.
3188 bool HexagonPacketizerList::isSoloInstruction(MachineInstr *MI) {
3190 if (MI->isInlineAsm())
3193 if (MI->isEHLabel())
3196 // From Hexagon V4 Programmer's Reference Manual 3.4.4 Grouping constraints:
3197 // trap, pause, barrier, icinva, isync, and syncht are solo instructions.
3198 // They must not be grouped with other instructions in a packet.
3199 if (IsSchedBarrier(MI))
3205 // isLegalToPacketizeTogether:
3206 // SUI is the current instruction that is out side of the current packet.
3207 // SUJ is the current instruction inside the current packet against which that
3208 // SUI will be packetized.
3209 bool HexagonPacketizerList::isLegalToPacketizeTogether(SUnit *SUI, SUnit *SUJ) {
3210 MachineInstr *I = SUI->getInstr();
3211 MachineInstr *J = SUJ->getInstr();
3212 assert(I && J && "Unable to packetize null instruction!");
3214 const MCInstrDesc &MCIDI = I->getDesc();
3215 const MCInstrDesc &MCIDJ = J->getDesc();
3217 MachineBasicBlock::iterator II = I;
3219 const unsigned FrameSize = MF.getFrameInfo()->getStackSize();
3220 const HexagonRegisterInfo* QRI = (const HexagonRegisterInfo *) TM.getRegisterInfo();
3221 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
3223 // Inline asm cannot go in the packet.
3224 if (I->getOpcode() == Hexagon::INLINEASM)
3225 llvm_unreachable("Should not meet inline asm here!");
3227 if (isSoloInstruction(I))
3228 llvm_unreachable("Should not meet solo instr here!");
3230 // A save callee-save register function call can only be in a packet
3231 // with instructions that don't write to the callee-save registers.
3232 if ((QII->isSaveCalleeSavedRegsCall(I) &&
3233 DoesModifyCalleeSavedReg(J, QRI)) ||
3234 (QII->isSaveCalleeSavedRegsCall(J) &&
3235 DoesModifyCalleeSavedReg(I, QRI))) {
3240 // Two control flow instructions cannot go in the same packet.
3241 if (IsControlFlow(I) && IsControlFlow(J)) {
3246 // A LoopN instruction cannot appear in the same packet as a jump or call.
3247 if (IsLoopN(I) && ( IsDirectJump(J)
3249 || QII->isDeallocRet(J))) {
3253 if (IsLoopN(J) && ( IsDirectJump(I)
3255 || QII->isDeallocRet(I))) {
3260 // dealloc_return cannot appear in the same packet as a conditional or
3261 // unconditional jump.
3262 if (QII->isDeallocRet(I) && ( MCIDJ.isBranch()
3264 || MCIDJ.isBarrier())) {
3270 // V4 allows dual store. But does not allow second store, if the
3271 // first store is not in SLOT0. New value store, new value jump,
3272 // dealloc_return and memop always take SLOT0.
3273 // Arch spec 3.4.4.2
3274 if (QRI->Subtarget.hasV4TOps()) {
3276 if (MCIDI.mayStore() && MCIDJ.mayStore() && isNewValueInst(J)) {
3281 if ( (QII->isMemOp(J) && MCIDI.mayStore())
3282 || (MCIDJ.mayStore() && QII->isMemOp(I))
3283 || (QII->isMemOp(J) && QII->isMemOp(I))) {
3289 if (MCIDJ.mayStore() && QII->isDeallocRet(I)){
3294 // If an instruction feeds new value jump, glue it.
3295 MachineBasicBlock::iterator NextMII = I;
3297 MachineInstr *NextMI = NextMII;
3299 if (QII->isNewValueJump(NextMI)) {
3301 bool secondRegMatch = false;
3302 bool maintainNewValueJump = false;
3304 if (NextMI->getOperand(1).isReg() &&
3305 I->getOperand(0).getReg() == NextMI->getOperand(1).getReg()) {
3306 secondRegMatch = true;
3307 maintainNewValueJump = true;
3310 if (!secondRegMatch &&
3311 I->getOperand(0).getReg() == NextMI->getOperand(0).getReg()) {
3312 maintainNewValueJump = true;
3315 for (std::vector<MachineInstr*>::iterator
3316 VI = CurrentPacketMIs.begin(),
3317 VE = CurrentPacketMIs.end();
3318 (VI != VE && maintainNewValueJump); ++VI) {
3319 SUnit* PacketSU = MIToSUnit[*VI];
3321 // NVJ can not be part of the dual jump - Arch Spec: section 7.8
3322 if (PacketSU->getInstr()->getDesc().isCall()) {
3327 // 1. Packet does not have a store in it.
3328 // 2. If the first operand of the nvj is newified, and the second
3329 // operand is also a reg, it (second reg) is not defined in
3331 // 3. If the second operand of the nvj is newified, (which means
3332 // first operand is also a reg), first reg is not defined in
3334 if (PacketSU->getInstr()->getDesc().mayStore() ||
3335 PacketSU->getInstr()->getOpcode() == Hexagon::ALLOCFRAME ||
3337 (!secondRegMatch && NextMI->getOperand(1).isReg() &&
3338 PacketSU->getInstr()->modifiesRegister(
3339 NextMI->getOperand(1).getReg(), QRI)) ||
3342 PacketSU->getInstr()->modifiesRegister(
3343 NextMI->getOperand(0).getReg(), QRI))) {
3349 GlueToNewValueJump = true;
3355 if (SUJ->isSucc(SUI)) {
3356 for (unsigned i = 0;
3357 (i < SUJ->Succs.size()) && !FoundSequentialDependence;
3360 if (SUJ->Succs[i].getSUnit() != SUI) {
3364 SDep::Kind DepType = SUJ->Succs[i].getKind();
3366 // For direct calls:
3367 // Ignore register dependences for call instructions for
3368 // packetization purposes except for those due to r31 and
3369 // predicate registers.
3371 // For indirect calls:
3372 // Same as direct calls + check for true dependences to the register
3373 // used in the indirect call.
3375 // We completely ignore Order dependences for call instructions
3378 // Ignore register dependences for return instructions like jumpr,
3379 // dealloc return unless we have dependencies on the explicit uses
3380 // of the registers used by jumpr (like r31) or dealloc return
3381 // (like r29 or r30).
3383 // TODO: Currently, jumpr is handling only return of r31. So, the
3384 // following logic (specificaly IsCallDependent) is working fine.
3385 // We need to enable jumpr for register other than r31 and then,
3386 // we need to rework the last part, where it handles indirect call
3387 // of that (IsCallDependent) function. Bug 6216 is opened for this.
3389 unsigned DepReg = 0;
3390 const TargetRegisterClass* RC = NULL;
3391 if (DepType == SDep::Data) {
3392 DepReg = SUJ->Succs[i].getReg();
3393 RC = QRI->getMinimalPhysRegClass(DepReg);
3395 if ((MCIDI.isCall() || MCIDI.isReturn()) &&
3396 (!IsRegDependence(DepType) ||
3397 !IsCallDependent(I, DepType, SUJ->Succs[i].getReg()))) {
3401 // For instructions that can be promoted to dot-new, try to promote.
3402 else if ((DepType == SDep::Data) &&
3403 CanPromoteToDotNew(I, SUJ, DepReg, MIToSUnit, II, RC) &&
3404 PromoteToDotNew(I, DepType, II, RC)) {
3405 PromotedToDotNew = true;
3409 else if ((DepType == SDep::Data) &&
3410 (QII->isNewValueJump(I))) {
3414 // For predicated instructions, if the predicates are complements
3415 // then there can be no dependence.
3416 else if (QII->isPredicated(I) &&
3417 QII->isPredicated(J) &&
3418 ArePredicatesComplements(I, J, MIToSUnit)) {
3422 else if (IsDirectJump(I) &&
3423 !MCIDJ.isBranch() &&
3425 (DepType == SDep::Order)) {
3426 // Ignore Order dependences between unconditional direct branches
3427 // and non-control-flow instructions
3430 else if (MCIDI.isConditionalBranch() && (DepType != SDep::Data) &&
3431 (DepType != SDep::Output)) {
3432 // Ignore all dependences for jumps except for true and output
3437 // Ignore output dependences due to superregs. We can
3438 // write to two different subregisters of R1:0 for instance
3439 // in the same cycle
3444 // If neither I nor J defines DepReg, then this is a
3445 // superfluous output dependence. The dependence must be of the
3449 // and there is an output dependence between the two instructions
3452 // We want to ignore these dependences.
3453 // Ideally, the dependence constructor should annotate such
3454 // dependences. We can then avoid this relatively expensive check.
3456 else if (DepType == SDep::Output) {
3457 // DepReg is the register that's responsible for the dependence.
3458 unsigned DepReg = SUJ->Succs[i].getReg();
3460 // Check if I and J really defines DepReg.
3461 if (I->definesRegister(DepReg) ||
3462 J->definesRegister(DepReg)) {
3463 FoundSequentialDependence = true;
3468 // We ignore Order dependences for
3469 // 1. Two loads unless they are volatile.
3470 // 2. Two stores in V4 unless they are volatile.
3471 else if ((DepType == SDep::Order) &&
3472 !I->hasVolatileMemoryRef() &&
3473 !J->hasVolatileMemoryRef()) {
3474 if (QRI->Subtarget.hasV4TOps() &&
3475 // hexagonv4 allows dual store.
3476 MCIDI.mayStore() && MCIDJ.mayStore()) {
3479 // store followed by store-- not OK on V2
3480 // store followed by load -- not OK on all (OK if addresses
3482 // load followed by store -- OK on all
3483 // load followed by load -- OK on all
3484 else if ( !MCIDJ.mayStore()) {
3488 FoundSequentialDependence = true;
3493 // For V4, special case ALLOCFRAME. Even though there is dependency
3494 // between ALLOCAFRAME and subsequent store, allow it to be
3495 // packetized in a same packet. This implies that the store is using
3496 // caller's SP. Hense, offset needs to be updated accordingly.
3497 else if (DepType == SDep::Data
3498 && QRI->Subtarget.hasV4TOps()
3499 && J->getOpcode() == Hexagon::ALLOCFRAME
3500 && (I->getOpcode() == Hexagon::STrid
3501 || I->getOpcode() == Hexagon::STriw
3502 || I->getOpcode() == Hexagon::STrib)
3503 && I->getOperand(0).getReg() == QRI->getStackRegister()
3504 && QII->isValidOffset(I->getOpcode(),
3505 I->getOperand(1).getImm() -
3506 (FrameSize + HEXAGON_LRFP_SIZE)))
3508 GlueAllocframeStore = true;
3509 // Since this store is to be glued with allocframe in the same
3510 // packet, it will use SP of the previous stack frame, i.e
3511 // caller's SP. Therefore, we need to recalculate offset according
3513 I->getOperand(1).setImm(I->getOperand(1).getImm() -
3514 (FrameSize + HEXAGON_LRFP_SIZE));
3518 // Skip over anti-dependences. Two instructions that are
3519 // anti-dependent can share a packet
3521 else if (DepType != SDep::Anti) {
3522 FoundSequentialDependence = true;
3527 if (FoundSequentialDependence) {
3536 // isLegalToPruneDependencies
3537 bool HexagonPacketizerList::isLegalToPruneDependencies(SUnit *SUI, SUnit *SUJ) {
3538 MachineInstr *I = SUI->getInstr();
3539 MachineInstr *J = SUJ->getInstr();
3540 assert(I && J && "Unable to packetize null instruction!");
3542 const unsigned FrameSize = MF.getFrameInfo()->getStackSize();
3546 // Check if the instruction was promoted to a dot-new. If so, demote it
3547 // back into a dot-old.
3548 if (PromotedToDotNew) {
3552 // Check if the instruction (must be a store) was glued with an Allocframe
3553 // instruction. If so, restore its offset to its original value, i.e. use
3554 // curent SP instead of caller's SP.
3555 if (GlueAllocframeStore) {
3556 I->getOperand(1).setImm(I->getOperand(1).getImm() +
3557 FrameSize + HEXAGON_LRFP_SIZE);
3565 MachineBasicBlock::iterator HexagonPacketizerList::addToPacket(MachineInstr *MI) {
3567 MachineBasicBlock::iterator MII = MI;
3568 MachineBasicBlock *MBB = MI->getParent();
3570 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
3572 if (GlueToNewValueJump) {
3575 MachineInstr *nvjMI = MII;
3576 assert(ResourceTracker->canReserveResources(MI));
3577 ResourceTracker->reserveResources(MI);
3578 if (QII->isExtended(MI) &&
3579 !tryAllocateResourcesForConstExt(MI)) {
3581 ResourceTracker->reserveResources(MI);
3582 assert(canReserveResourcesForConstExt(MI) &&
3583 "Ensure that there is a slot");
3584 reserveResourcesForConstExt(MI);
3585 // Reserve resources for new value jump constant extender.
3586 assert(canReserveResourcesForConstExt(MI) &&
3587 "Ensure that there is a slot");
3588 reserveResourcesForConstExt(nvjMI);
3589 assert(ResourceTracker->canReserveResources(nvjMI) &&
3590 "Ensure that there is a slot");
3592 } else if ( // Extended instruction takes two slots in the packet.
3593 // Try reserve and allocate 4-byte in the current packet first.
3594 (QII->isExtended(nvjMI)
3595 && (!tryAllocateResourcesForConstExt(nvjMI)
3596 || !ResourceTracker->canReserveResources(nvjMI)))
3597 || // For non-extended instruction, no need to allocate extra 4 bytes.
3598 (!QII->isExtended(nvjMI) && !ResourceTracker->canReserveResources(nvjMI)))
3601 // A new and empty packet starts.
3602 // We are sure that the resources requirements can be satisfied.
3603 // Therefore, do not need to call "canReserveResources" anymore.
3604 ResourceTracker->reserveResources(MI);
3605 if (QII->isExtended(nvjMI))
3606 reserveResourcesForConstExt(nvjMI);
3608 // Here, we are sure that "reserveResources" would succeed.
3609 ResourceTracker->reserveResources(nvjMI);
3610 CurrentPacketMIs.push_back(MI);
3611 CurrentPacketMIs.push_back(nvjMI);
3613 if ( QII->isExtended(MI)
3614 && ( !tryAllocateResourcesForConstExt(MI)
3615 || !ResourceTracker->canReserveResources(MI)))
3618 // Check if the instruction was promoted to a dot-new. If so, demote it
3619 // back into a dot-old
3620 if (PromotedToDotNew) {
3623 reserveResourcesForConstExt(MI);
3625 // In case that "MI" is not an extended insn,
3626 // the resource availability has already been checked.
3627 ResourceTracker->reserveResources(MI);
3628 CurrentPacketMIs.push_back(MI);
3633 //===----------------------------------------------------------------------===//
3634 // Public Constructor Functions
3635 //===----------------------------------------------------------------------===//
3637 FunctionPass *llvm::createHexagonPacketizer() {
3638 return new HexagonPacketizer();