1 //===-- HexagonInstrInfo.cpp - Hexagon Instruction Information ------------===//
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 file contains the Hexagon implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #include "HexagonInstrInfo.h"
15 #include "HexagonRegisterInfo.h"
16 #include "HexagonSubtarget.h"
18 #include "llvm/ADT/STLExtras.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/CodeGen/DFAPacketizer.h"
21 #include "llvm/CodeGen/MachineInstrBuilder.h"
22 #include "llvm/CodeGen/MachineRegisterInfo.h"
23 #include "llvm/CodeGen/MachineFrameInfo.h"
24 #include "llvm/CodeGen/MachineMemOperand.h"
25 #include "llvm/CodeGen/PseudoSourceValue.h"
26 #include "llvm/Support/MathExtras.h"
27 #define GET_INSTRINFO_CTOR
28 #include "HexagonGenInstrInfo.inc"
29 #include "HexagonGenDFAPacketizer.inc"
30 #include "HexagonConstExtInfo.h"
35 /// Constants for Hexagon instructions.
37 const int Hexagon_MEMW_OFFSET_MAX = 4095;
38 const int Hexagon_MEMW_OFFSET_MIN = -4096;
39 const int Hexagon_MEMD_OFFSET_MAX = 8191;
40 const int Hexagon_MEMD_OFFSET_MIN = -8192;
41 const int Hexagon_MEMH_OFFSET_MAX = 2047;
42 const int Hexagon_MEMH_OFFSET_MIN = -2048;
43 const int Hexagon_MEMB_OFFSET_MAX = 1023;
44 const int Hexagon_MEMB_OFFSET_MIN = -1024;
45 const int Hexagon_ADDI_OFFSET_MAX = 32767;
46 const int Hexagon_ADDI_OFFSET_MIN = -32768;
47 const int Hexagon_MEMD_AUTOINC_MAX = 56;
48 const int Hexagon_MEMD_AUTOINC_MIN = -64;
49 const int Hexagon_MEMW_AUTOINC_MAX = 28;
50 const int Hexagon_MEMW_AUTOINC_MIN = -32;
51 const int Hexagon_MEMH_AUTOINC_MAX = 14;
52 const int Hexagon_MEMH_AUTOINC_MIN = -16;
53 const int Hexagon_MEMB_AUTOINC_MAX = 7;
54 const int Hexagon_MEMB_AUTOINC_MIN = -8;
57 HexagonInstrInfo::HexagonInstrInfo(HexagonSubtarget &ST)
58 : HexagonGenInstrInfo(Hexagon::ADJCALLSTACKDOWN, Hexagon::ADJCALLSTACKUP),
59 RI(ST, *this), Subtarget(ST) {
63 /// isLoadFromStackSlot - If the specified machine instruction is a direct
64 /// load from a stack slot, return the virtual or physical register number of
65 /// the destination along with the FrameIndex of the loaded stack slot. If
66 /// not, return 0. This predicate must return 0 if the instruction has
67 /// any side effects other than loading from the stack slot.
68 unsigned HexagonInstrInfo::isLoadFromStackSlot(const MachineInstr *MI,
69 int &FrameIndex) const {
72 switch (MI->getOpcode()) {
79 if (MI->getOperand(2).isFI() &&
80 MI->getOperand(1).isImm() && (MI->getOperand(1).getImm() == 0)) {
81 FrameIndex = MI->getOperand(2).getIndex();
82 return MI->getOperand(0).getReg();
90 /// isStoreToStackSlot - If the specified machine instruction is a direct
91 /// store to a stack slot, return the virtual or physical register number of
92 /// the source reg along with the FrameIndex of the loaded stack slot. If
93 /// not, return 0. This predicate must return 0 if the instruction has
94 /// any side effects other than storing to the stack slot.
95 unsigned HexagonInstrInfo::isStoreToStackSlot(const MachineInstr *MI,
96 int &FrameIndex) const {
97 switch (MI->getOpcode()) {
99 case Hexagon::STriw_indexed:
104 if (MI->getOperand(2).isFI() &&
105 MI->getOperand(1).isImm() && (MI->getOperand(1).getImm() == 0)) {
106 FrameIndex = MI->getOperand(0).getIndex();
107 return MI->getOperand(2).getReg();
116 HexagonInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB,
117 MachineBasicBlock *FBB,
118 const SmallVectorImpl<MachineOperand> &Cond,
121 int BOpc = Hexagon::JMP;
122 int BccOpc = Hexagon::JMP_c;
124 assert(TBB && "InsertBranch must not be told to insert a fallthrough");
127 // Check if ReverseBranchCondition has asked to reverse this branch
128 // If we want to reverse the branch an odd number of times, we want
130 if (!Cond.empty() && Cond[0].isImm() && Cond[0].getImm() == 0) {
131 BccOpc = Hexagon::JMP_cNot;
137 // Due to a bug in TailMerging/CFG Optimization, we need to add a
138 // special case handling of a predicated jump followed by an
139 // unconditional jump. If not, Tail Merging and CFG Optimization go
140 // into an infinite loop.
141 MachineBasicBlock *NewTBB, *NewFBB;
142 SmallVector<MachineOperand, 4> Cond;
143 MachineInstr *Term = MBB.getFirstTerminator();
144 if (isPredicated(Term) && !AnalyzeBranch(MBB, NewTBB, NewFBB, Cond,
146 MachineBasicBlock *NextBB =
147 llvm::next(MachineFunction::iterator(&MBB));
148 if (NewTBB == NextBB) {
149 ReverseBranchCondition(Cond);
151 return InsertBranch(MBB, TBB, 0, Cond, DL);
154 BuildMI(&MBB, DL, get(BOpc)).addMBB(TBB);
157 get(BccOpc)).addReg(Cond[regPos].getReg()).addMBB(TBB);
162 BuildMI(&MBB, DL, get(BccOpc)).addReg(Cond[regPos].getReg()).addMBB(TBB);
163 BuildMI(&MBB, DL, get(BOpc)).addMBB(FBB);
169 bool HexagonInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
170 MachineBasicBlock *&TBB,
171 MachineBasicBlock *&FBB,
172 SmallVectorImpl<MachineOperand> &Cond,
173 bool AllowModify) const {
177 // If the block has no terminators, it just falls into the block after it.
178 MachineBasicBlock::iterator I = MBB.end();
179 if (I == MBB.begin())
182 // A basic block may looks like this:
192 // It has two succs but does not have a terminator
193 // Don't know how to handle it.
198 } while (I != MBB.begin());
203 while (I->isDebugValue()) {
204 if (I == MBB.begin())
208 if (!isUnpredicatedTerminator(I))
211 // Get the last instruction in the block.
212 MachineInstr *LastInst = I;
214 // If there is only one terminator instruction, process it.
215 if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) {
216 if (LastInst->getOpcode() == Hexagon::JMP) {
217 TBB = LastInst->getOperand(0).getMBB();
220 if (LastInst->getOpcode() == Hexagon::JMP_c) {
221 // Block ends with fall-through true condbranch.
222 TBB = LastInst->getOperand(1).getMBB();
223 Cond.push_back(LastInst->getOperand(0));
226 if (LastInst->getOpcode() == Hexagon::JMP_cNot) {
227 // Block ends with fall-through false condbranch.
228 TBB = LastInst->getOperand(1).getMBB();
229 Cond.push_back(MachineOperand::CreateImm(0));
230 Cond.push_back(LastInst->getOperand(0));
233 // Otherwise, don't know what this is.
237 // Get the instruction before it if it's a terminator.
238 MachineInstr *SecondLastInst = I;
240 // If there are three terminators, we don't know what sort of block this is.
241 if (SecondLastInst && I != MBB.begin() &&
242 isUnpredicatedTerminator(--I))
245 // If the block ends with Hexagon::BRCOND and Hexagon:JMP, handle it.
246 if (((SecondLastInst->getOpcode() == Hexagon::BRCOND) ||
247 (SecondLastInst->getOpcode() == Hexagon::JMP_c)) &&
248 LastInst->getOpcode() == Hexagon::JMP) {
249 TBB = SecondLastInst->getOperand(1).getMBB();
250 Cond.push_back(SecondLastInst->getOperand(0));
251 FBB = LastInst->getOperand(0).getMBB();
255 // If the block ends with Hexagon::JMP_cNot and Hexagon:JMP, handle it.
256 if ((SecondLastInst->getOpcode() == Hexagon::JMP_cNot) &&
257 LastInst->getOpcode() == Hexagon::JMP) {
258 TBB = SecondLastInst->getOperand(1).getMBB();
259 Cond.push_back(MachineOperand::CreateImm(0));
260 Cond.push_back(SecondLastInst->getOperand(0));
261 FBB = LastInst->getOperand(0).getMBB();
265 // If the block ends with two Hexagon:JMPs, handle it. The second one is not
266 // executed, so remove it.
267 if (SecondLastInst->getOpcode() == Hexagon::JMP &&
268 LastInst->getOpcode() == Hexagon::JMP) {
269 TBB = SecondLastInst->getOperand(0).getMBB();
272 I->eraseFromParent();
276 // Otherwise, can't handle this.
281 unsigned HexagonInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
282 int BOpc = Hexagon::JMP;
283 int BccOpc = Hexagon::JMP_c;
284 int BccOpcNot = Hexagon::JMP_cNot;
286 MachineBasicBlock::iterator I = MBB.end();
287 if (I == MBB.begin()) return 0;
289 if (I->getOpcode() != BOpc && I->getOpcode() != BccOpc &&
290 I->getOpcode() != BccOpcNot)
293 // Remove the branch.
294 I->eraseFromParent();
298 if (I == MBB.begin()) return 1;
300 if (I->getOpcode() != BccOpc && I->getOpcode() != BccOpcNot)
303 // Remove the branch.
304 I->eraseFromParent();
309 void HexagonInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
310 MachineBasicBlock::iterator I, DebugLoc DL,
311 unsigned DestReg, unsigned SrcReg,
312 bool KillSrc) const {
313 if (Hexagon::IntRegsRegClass.contains(SrcReg, DestReg)) {
314 BuildMI(MBB, I, DL, get(Hexagon::TFR), DestReg).addReg(SrcReg);
317 if (Hexagon::DoubleRegsRegClass.contains(SrcReg, DestReg)) {
318 BuildMI(MBB, I, DL, get(Hexagon::TFR_64), DestReg).addReg(SrcReg);
321 if (Hexagon::PredRegsRegClass.contains(SrcReg, DestReg)) {
322 // Map Pd = Ps to Pd = or(Ps, Ps).
323 BuildMI(MBB, I, DL, get(Hexagon::OR_pp),
324 DestReg).addReg(SrcReg).addReg(SrcReg);
327 if (Hexagon::DoubleRegsRegClass.contains(DestReg) &&
328 Hexagon::IntRegsRegClass.contains(SrcReg)) {
329 // We can have an overlap between single and double reg: r1:0 = r0.
330 if(SrcReg == RI.getSubReg(DestReg, Hexagon::subreg_loreg)) {
332 BuildMI(MBB, I, DL, get(Hexagon::TFRI), (RI.getSubReg(DestReg,
333 Hexagon::subreg_hireg))).addImm(0);
335 // r1:0 = r1 or no overlap.
336 BuildMI(MBB, I, DL, get(Hexagon::TFR), (RI.getSubReg(DestReg,
337 Hexagon::subreg_loreg))).addReg(SrcReg);
338 BuildMI(MBB, I, DL, get(Hexagon::TFRI), (RI.getSubReg(DestReg,
339 Hexagon::subreg_hireg))).addImm(0);
343 if (Hexagon::CRRegsRegClass.contains(DestReg) &&
344 Hexagon::IntRegsRegClass.contains(SrcReg)) {
345 BuildMI(MBB, I, DL, get(Hexagon::TFCR), DestReg).addReg(SrcReg);
349 llvm_unreachable("Unimplemented");
353 void HexagonInstrInfo::
354 storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
355 unsigned SrcReg, bool isKill, int FI,
356 const TargetRegisterClass *RC,
357 const TargetRegisterInfo *TRI) const {
359 DebugLoc DL = MBB.findDebugLoc(I);
360 MachineFunction &MF = *MBB.getParent();
361 MachineFrameInfo &MFI = *MF.getFrameInfo();
362 unsigned Align = MFI.getObjectAlignment(FI);
364 MachineMemOperand *MMO =
365 MF.getMachineMemOperand(
366 MachinePointerInfo(PseudoSourceValue::getFixedStack(FI)),
367 MachineMemOperand::MOStore,
368 MFI.getObjectSize(FI),
371 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
372 BuildMI(MBB, I, DL, get(Hexagon::STriw_indexed))
373 .addFrameIndex(FI).addImm(0)
374 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
375 } else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
376 BuildMI(MBB, I, DL, get(Hexagon::STrid))
377 .addFrameIndex(FI).addImm(0)
378 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
379 } else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
380 BuildMI(MBB, I, DL, get(Hexagon::STriw_pred))
381 .addFrameIndex(FI).addImm(0)
382 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
384 llvm_unreachable("Unimplemented");
389 void HexagonInstrInfo::storeRegToAddr(
390 MachineFunction &MF, unsigned SrcReg,
392 SmallVectorImpl<MachineOperand> &Addr,
393 const TargetRegisterClass *RC,
394 SmallVectorImpl<MachineInstr*> &NewMIs) const
396 llvm_unreachable("Unimplemented");
400 void HexagonInstrInfo::
401 loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
402 unsigned DestReg, int FI,
403 const TargetRegisterClass *RC,
404 const TargetRegisterInfo *TRI) const {
405 DebugLoc DL = MBB.findDebugLoc(I);
406 MachineFunction &MF = *MBB.getParent();
407 MachineFrameInfo &MFI = *MF.getFrameInfo();
408 unsigned Align = MFI.getObjectAlignment(FI);
410 MachineMemOperand *MMO =
411 MF.getMachineMemOperand(
412 MachinePointerInfo(PseudoSourceValue::getFixedStack(FI)),
413 MachineMemOperand::MOLoad,
414 MFI.getObjectSize(FI),
416 if (RC == &Hexagon::IntRegsRegClass) {
417 BuildMI(MBB, I, DL, get(Hexagon::LDriw), DestReg)
418 .addFrameIndex(FI).addImm(0).addMemOperand(MMO);
419 } else if (RC == &Hexagon::DoubleRegsRegClass) {
420 BuildMI(MBB, I, DL, get(Hexagon::LDrid), DestReg)
421 .addFrameIndex(FI).addImm(0).addMemOperand(MMO);
422 } else if (RC == &Hexagon::PredRegsRegClass) {
423 BuildMI(MBB, I, DL, get(Hexagon::LDriw_pred), DestReg)
424 .addFrameIndex(FI).addImm(0).addMemOperand(MMO);
426 llvm_unreachable("Can't store this register to stack slot");
431 void HexagonInstrInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
432 SmallVectorImpl<MachineOperand> &Addr,
433 const TargetRegisterClass *RC,
434 SmallVectorImpl<MachineInstr*> &NewMIs) const {
435 llvm_unreachable("Unimplemented");
439 MachineInstr *HexagonInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
441 const SmallVectorImpl<unsigned> &Ops,
443 // Hexagon_TODO: Implement.
448 unsigned HexagonInstrInfo::createVR(MachineFunction* MF, MVT VT) const {
450 MachineRegisterInfo &RegInfo = MF->getRegInfo();
451 const TargetRegisterClass *TRC;
453 TRC = &Hexagon::PredRegsRegClass;
454 } else if (VT == MVT::i32 || VT == MVT::f32) {
455 TRC = &Hexagon::IntRegsRegClass;
456 } else if (VT == MVT::i64 || VT == MVT::f64) {
457 TRC = &Hexagon::DoubleRegsRegClass;
459 llvm_unreachable("Cannot handle this register class");
462 unsigned NewReg = RegInfo.createVirtualRegister(TRC);
466 bool HexagonInstrInfo::isExtendable(const MachineInstr *MI) const {
467 switch(MI->getOpcode()) {
468 default: return false;
470 case Hexagon::JMP_EQriPt_nv_V4:
471 case Hexagon::JMP_EQriPnt_nv_V4:
472 case Hexagon::JMP_EQriNotPt_nv_V4:
473 case Hexagon::JMP_EQriNotPnt_nv_V4:
475 // JMP_EQri - with -1
476 case Hexagon::JMP_EQriPtneg_nv_V4:
477 case Hexagon::JMP_EQriPntneg_nv_V4:
478 case Hexagon::JMP_EQriNotPtneg_nv_V4:
479 case Hexagon::JMP_EQriNotPntneg_nv_V4:
482 case Hexagon::JMP_EQrrPt_nv_V4:
483 case Hexagon::JMP_EQrrPnt_nv_V4:
484 case Hexagon::JMP_EQrrNotPt_nv_V4:
485 case Hexagon::JMP_EQrrNotPnt_nv_V4:
488 case Hexagon::JMP_GTriPt_nv_V4:
489 case Hexagon::JMP_GTriPnt_nv_V4:
490 case Hexagon::JMP_GTriNotPt_nv_V4:
491 case Hexagon::JMP_GTriNotPnt_nv_V4:
493 // JMP_GTri - with -1
494 case Hexagon::JMP_GTriPtneg_nv_V4:
495 case Hexagon::JMP_GTriPntneg_nv_V4:
496 case Hexagon::JMP_GTriNotPtneg_nv_V4:
497 case Hexagon::JMP_GTriNotPntneg_nv_V4:
500 case Hexagon::JMP_GTrrPt_nv_V4:
501 case Hexagon::JMP_GTrrPnt_nv_V4:
502 case Hexagon::JMP_GTrrNotPt_nv_V4:
503 case Hexagon::JMP_GTrrNotPnt_nv_V4:
506 case Hexagon::JMP_GTrrdnPt_nv_V4:
507 case Hexagon::JMP_GTrrdnPnt_nv_V4:
508 case Hexagon::JMP_GTrrdnNotPt_nv_V4:
509 case Hexagon::JMP_GTrrdnNotPnt_nv_V4:
512 case Hexagon::JMP_GTUriPt_nv_V4:
513 case Hexagon::JMP_GTUriPnt_nv_V4:
514 case Hexagon::JMP_GTUriNotPt_nv_V4:
515 case Hexagon::JMP_GTUriNotPnt_nv_V4:
518 case Hexagon::JMP_GTUrrPt_nv_V4:
519 case Hexagon::JMP_GTUrrPnt_nv_V4:
520 case Hexagon::JMP_GTUrrNotPt_nv_V4:
521 case Hexagon::JMP_GTUrrNotPnt_nv_V4:
524 case Hexagon::JMP_GTUrrdnPt_nv_V4:
525 case Hexagon::JMP_GTUrrdnPnt_nv_V4:
526 case Hexagon::JMP_GTUrrdnNotPt_nv_V4:
527 case Hexagon::JMP_GTUrrdnNotPnt_nv_V4:
530 case Hexagon::TFR_FI:
535 bool HexagonInstrInfo::isExtended(const MachineInstr *MI) const {
536 switch(MI->getOpcode()) {
537 default: return false;
539 case Hexagon::JMP_EQriPt_ie_nv_V4:
540 case Hexagon::JMP_EQriPnt_ie_nv_V4:
541 case Hexagon::JMP_EQriNotPt_ie_nv_V4:
542 case Hexagon::JMP_EQriNotPnt_ie_nv_V4:
544 // JMP_EQri - with -1
545 case Hexagon::JMP_EQriPtneg_ie_nv_V4:
546 case Hexagon::JMP_EQriPntneg_ie_nv_V4:
547 case Hexagon::JMP_EQriNotPtneg_ie_nv_V4:
548 case Hexagon::JMP_EQriNotPntneg_ie_nv_V4:
551 case Hexagon::JMP_EQrrPt_ie_nv_V4:
552 case Hexagon::JMP_EQrrPnt_ie_nv_V4:
553 case Hexagon::JMP_EQrrNotPt_ie_nv_V4:
554 case Hexagon::JMP_EQrrNotPnt_ie_nv_V4:
557 case Hexagon::JMP_GTriPt_ie_nv_V4:
558 case Hexagon::JMP_GTriPnt_ie_nv_V4:
559 case Hexagon::JMP_GTriNotPt_ie_nv_V4:
560 case Hexagon::JMP_GTriNotPnt_ie_nv_V4:
562 // JMP_GTri - with -1
563 case Hexagon::JMP_GTriPtneg_ie_nv_V4:
564 case Hexagon::JMP_GTriPntneg_ie_nv_V4:
565 case Hexagon::JMP_GTriNotPtneg_ie_nv_V4:
566 case Hexagon::JMP_GTriNotPntneg_ie_nv_V4:
569 case Hexagon::JMP_GTrrPt_ie_nv_V4:
570 case Hexagon::JMP_GTrrPnt_ie_nv_V4:
571 case Hexagon::JMP_GTrrNotPt_ie_nv_V4:
572 case Hexagon::JMP_GTrrNotPnt_ie_nv_V4:
575 case Hexagon::JMP_GTrrdnPt_ie_nv_V4:
576 case Hexagon::JMP_GTrrdnPnt_ie_nv_V4:
577 case Hexagon::JMP_GTrrdnNotPt_ie_nv_V4:
578 case Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4:
581 case Hexagon::JMP_GTUriPt_ie_nv_V4:
582 case Hexagon::JMP_GTUriPnt_ie_nv_V4:
583 case Hexagon::JMP_GTUriNotPt_ie_nv_V4:
584 case Hexagon::JMP_GTUriNotPnt_ie_nv_V4:
587 case Hexagon::JMP_GTUrrPt_ie_nv_V4:
588 case Hexagon::JMP_GTUrrPnt_ie_nv_V4:
589 case Hexagon::JMP_GTUrrNotPt_ie_nv_V4:
590 case Hexagon::JMP_GTUrrNotPnt_ie_nv_V4:
593 case Hexagon::JMP_GTUrrdnPt_ie_nv_V4:
594 case Hexagon::JMP_GTUrrdnPnt_ie_nv_V4:
595 case Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4:
596 case Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4:
598 // V4 absolute set addressing.
599 case Hexagon::LDrid_abs_setimm_V4:
600 case Hexagon::LDriw_abs_setimm_V4:
601 case Hexagon::LDrih_abs_setimm_V4:
602 case Hexagon::LDrib_abs_setimm_V4:
603 case Hexagon::LDriuh_abs_setimm_V4:
604 case Hexagon::LDriub_abs_setimm_V4:
606 case Hexagon::STrid_abs_setimm_V4:
607 case Hexagon::STrib_abs_setimm_V4:
608 case Hexagon::STrih_abs_setimm_V4:
609 case Hexagon::STriw_abs_setimm_V4:
611 // V4 global address load.
612 case Hexagon::LDrid_GP_cPt_V4 :
613 case Hexagon::LDrid_GP_cNotPt_V4 :
614 case Hexagon::LDrid_GP_cdnPt_V4 :
615 case Hexagon::LDrid_GP_cdnNotPt_V4 :
616 case Hexagon::LDrib_GP_cPt_V4 :
617 case Hexagon::LDrib_GP_cNotPt_V4 :
618 case Hexagon::LDrib_GP_cdnPt_V4 :
619 case Hexagon::LDrib_GP_cdnNotPt_V4 :
620 case Hexagon::LDriub_GP_cPt_V4 :
621 case Hexagon::LDriub_GP_cNotPt_V4 :
622 case Hexagon::LDriub_GP_cdnPt_V4 :
623 case Hexagon::LDriub_GP_cdnNotPt_V4 :
624 case Hexagon::LDrih_GP_cPt_V4 :
625 case Hexagon::LDrih_GP_cNotPt_V4 :
626 case Hexagon::LDrih_GP_cdnPt_V4 :
627 case Hexagon::LDrih_GP_cdnNotPt_V4 :
628 case Hexagon::LDriuh_GP_cPt_V4 :
629 case Hexagon::LDriuh_GP_cNotPt_V4 :
630 case Hexagon::LDriuh_GP_cdnPt_V4 :
631 case Hexagon::LDriuh_GP_cdnNotPt_V4 :
632 case Hexagon::LDriw_GP_cPt_V4 :
633 case Hexagon::LDriw_GP_cNotPt_V4 :
634 case Hexagon::LDriw_GP_cdnPt_V4 :
635 case Hexagon::LDriw_GP_cdnNotPt_V4 :
636 case Hexagon::LDd_GP_cPt_V4 :
637 case Hexagon::LDd_GP_cNotPt_V4 :
638 case Hexagon::LDd_GP_cdnPt_V4 :
639 case Hexagon::LDd_GP_cdnNotPt_V4 :
640 case Hexagon::LDb_GP_cPt_V4 :
641 case Hexagon::LDb_GP_cNotPt_V4 :
642 case Hexagon::LDb_GP_cdnPt_V4 :
643 case Hexagon::LDb_GP_cdnNotPt_V4 :
644 case Hexagon::LDub_GP_cPt_V4 :
645 case Hexagon::LDub_GP_cNotPt_V4 :
646 case Hexagon::LDub_GP_cdnPt_V4 :
647 case Hexagon::LDub_GP_cdnNotPt_V4 :
648 case Hexagon::LDh_GP_cPt_V4 :
649 case Hexagon::LDh_GP_cNotPt_V4 :
650 case Hexagon::LDh_GP_cdnPt_V4 :
651 case Hexagon::LDh_GP_cdnNotPt_V4 :
652 case Hexagon::LDuh_GP_cPt_V4 :
653 case Hexagon::LDuh_GP_cNotPt_V4 :
654 case Hexagon::LDuh_GP_cdnPt_V4 :
655 case Hexagon::LDuh_GP_cdnNotPt_V4 :
656 case Hexagon::LDw_GP_cPt_V4 :
657 case Hexagon::LDw_GP_cNotPt_V4 :
658 case Hexagon::LDw_GP_cdnPt_V4 :
659 case Hexagon::LDw_GP_cdnNotPt_V4 :
661 // V4 global address store.
662 case Hexagon::STrid_GP_cPt_V4 :
663 case Hexagon::STrid_GP_cNotPt_V4 :
664 case Hexagon::STrid_GP_cdnPt_V4 :
665 case Hexagon::STrid_GP_cdnNotPt_V4 :
666 case Hexagon::STrib_GP_cPt_V4 :
667 case Hexagon::STrib_GP_cNotPt_V4 :
668 case Hexagon::STrib_GP_cdnPt_V4 :
669 case Hexagon::STrib_GP_cdnNotPt_V4 :
670 case Hexagon::STrih_GP_cPt_V4 :
671 case Hexagon::STrih_GP_cNotPt_V4 :
672 case Hexagon::STrih_GP_cdnPt_V4 :
673 case Hexagon::STrih_GP_cdnNotPt_V4 :
674 case Hexagon::STriw_GP_cPt_V4 :
675 case Hexagon::STriw_GP_cNotPt_V4 :
676 case Hexagon::STriw_GP_cdnPt_V4 :
677 case Hexagon::STriw_GP_cdnNotPt_V4 :
678 case Hexagon::STd_GP_cPt_V4 :
679 case Hexagon::STd_GP_cNotPt_V4 :
680 case Hexagon::STd_GP_cdnPt_V4 :
681 case Hexagon::STd_GP_cdnNotPt_V4 :
682 case Hexagon::STb_GP_cPt_V4 :
683 case Hexagon::STb_GP_cNotPt_V4 :
684 case Hexagon::STb_GP_cdnPt_V4 :
685 case Hexagon::STb_GP_cdnNotPt_V4 :
686 case Hexagon::STh_GP_cPt_V4 :
687 case Hexagon::STh_GP_cNotPt_V4 :
688 case Hexagon::STh_GP_cdnPt_V4 :
689 case Hexagon::STh_GP_cdnNotPt_V4 :
690 case Hexagon::STw_GP_cPt_V4 :
691 case Hexagon::STw_GP_cNotPt_V4 :
692 case Hexagon::STw_GP_cdnPt_V4 :
693 case Hexagon::STw_GP_cdnNotPt_V4 :
695 // V4 predicated global address new value store.
696 case Hexagon::STrib_GP_cPt_nv_V4 :
697 case Hexagon::STrib_GP_cNotPt_nv_V4 :
698 case Hexagon::STrib_GP_cdnPt_nv_V4 :
699 case Hexagon::STrib_GP_cdnNotPt_nv_V4 :
700 case Hexagon::STrih_GP_cPt_nv_V4 :
701 case Hexagon::STrih_GP_cNotPt_nv_V4 :
702 case Hexagon::STrih_GP_cdnPt_nv_V4 :
703 case Hexagon::STrih_GP_cdnNotPt_nv_V4 :
704 case Hexagon::STriw_GP_cPt_nv_V4 :
705 case Hexagon::STriw_GP_cNotPt_nv_V4 :
706 case Hexagon::STriw_GP_cdnPt_nv_V4 :
707 case Hexagon::STriw_GP_cdnNotPt_nv_V4 :
708 case Hexagon::STb_GP_cPt_nv_V4 :
709 case Hexagon::STb_GP_cNotPt_nv_V4 :
710 case Hexagon::STb_GP_cdnPt_nv_V4 :
711 case Hexagon::STb_GP_cdnNotPt_nv_V4 :
712 case Hexagon::STh_GP_cPt_nv_V4 :
713 case Hexagon::STh_GP_cNotPt_nv_V4 :
714 case Hexagon::STh_GP_cdnPt_nv_V4 :
715 case Hexagon::STh_GP_cdnNotPt_nv_V4 :
716 case Hexagon::STw_GP_cPt_nv_V4 :
717 case Hexagon::STw_GP_cNotPt_nv_V4 :
718 case Hexagon::STw_GP_cdnPt_nv_V4 :
719 case Hexagon::STw_GP_cdnNotPt_nv_V4 :
722 case Hexagon::TFR_FI_immext_V4:
725 case Hexagon::TFRI_f:
726 case Hexagon::TFRI_cPt_f:
727 case Hexagon::TFRI_cNotPt_f:
728 case Hexagon::CONST64_Float_Real:
733 bool HexagonInstrInfo::isNewValueJump(const MachineInstr *MI) const {
734 switch (MI->getOpcode()) {
735 default: return false;
737 case Hexagon::JMP_EQriPt_nv_V4:
738 case Hexagon::JMP_EQriPnt_nv_V4:
739 case Hexagon::JMP_EQriNotPt_nv_V4:
740 case Hexagon::JMP_EQriNotPnt_nv_V4:
741 case Hexagon::JMP_EQriPt_ie_nv_V4:
742 case Hexagon::JMP_EQriPnt_ie_nv_V4:
743 case Hexagon::JMP_EQriNotPt_ie_nv_V4:
744 case Hexagon::JMP_EQriNotPnt_ie_nv_V4:
746 // JMP_EQri - with -1
747 case Hexagon::JMP_EQriPtneg_nv_V4:
748 case Hexagon::JMP_EQriPntneg_nv_V4:
749 case Hexagon::JMP_EQriNotPtneg_nv_V4:
750 case Hexagon::JMP_EQriNotPntneg_nv_V4:
751 case Hexagon::JMP_EQriPtneg_ie_nv_V4:
752 case Hexagon::JMP_EQriPntneg_ie_nv_V4:
753 case Hexagon::JMP_EQriNotPtneg_ie_nv_V4:
754 case Hexagon::JMP_EQriNotPntneg_ie_nv_V4:
757 case Hexagon::JMP_EQrrPt_nv_V4:
758 case Hexagon::JMP_EQrrPnt_nv_V4:
759 case Hexagon::JMP_EQrrNotPt_nv_V4:
760 case Hexagon::JMP_EQrrNotPnt_nv_V4:
761 case Hexagon::JMP_EQrrPt_ie_nv_V4:
762 case Hexagon::JMP_EQrrPnt_ie_nv_V4:
763 case Hexagon::JMP_EQrrNotPt_ie_nv_V4:
764 case Hexagon::JMP_EQrrNotPnt_ie_nv_V4:
767 case Hexagon::JMP_GTriPt_nv_V4:
768 case Hexagon::JMP_GTriPnt_nv_V4:
769 case Hexagon::JMP_GTriNotPt_nv_V4:
770 case Hexagon::JMP_GTriNotPnt_nv_V4:
771 case Hexagon::JMP_GTriPt_ie_nv_V4:
772 case Hexagon::JMP_GTriPnt_ie_nv_V4:
773 case Hexagon::JMP_GTriNotPt_ie_nv_V4:
774 case Hexagon::JMP_GTriNotPnt_ie_nv_V4:
776 // JMP_GTri - with -1
777 case Hexagon::JMP_GTriPtneg_nv_V4:
778 case Hexagon::JMP_GTriPntneg_nv_V4:
779 case Hexagon::JMP_GTriNotPtneg_nv_V4:
780 case Hexagon::JMP_GTriNotPntneg_nv_V4:
781 case Hexagon::JMP_GTriPtneg_ie_nv_V4:
782 case Hexagon::JMP_GTriPntneg_ie_nv_V4:
783 case Hexagon::JMP_GTriNotPtneg_ie_nv_V4:
784 case Hexagon::JMP_GTriNotPntneg_ie_nv_V4:
787 case Hexagon::JMP_GTrrPt_nv_V4:
788 case Hexagon::JMP_GTrrPnt_nv_V4:
789 case Hexagon::JMP_GTrrNotPt_nv_V4:
790 case Hexagon::JMP_GTrrNotPnt_nv_V4:
791 case Hexagon::JMP_GTrrPt_ie_nv_V4:
792 case Hexagon::JMP_GTrrPnt_ie_nv_V4:
793 case Hexagon::JMP_GTrrNotPt_ie_nv_V4:
794 case Hexagon::JMP_GTrrNotPnt_ie_nv_V4:
797 case Hexagon::JMP_GTrrdnPt_nv_V4:
798 case Hexagon::JMP_GTrrdnPnt_nv_V4:
799 case Hexagon::JMP_GTrrdnNotPt_nv_V4:
800 case Hexagon::JMP_GTrrdnNotPnt_nv_V4:
801 case Hexagon::JMP_GTrrdnPt_ie_nv_V4:
802 case Hexagon::JMP_GTrrdnPnt_ie_nv_V4:
803 case Hexagon::JMP_GTrrdnNotPt_ie_nv_V4:
804 case Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4:
807 case Hexagon::JMP_GTUriPt_nv_V4:
808 case Hexagon::JMP_GTUriPnt_nv_V4:
809 case Hexagon::JMP_GTUriNotPt_nv_V4:
810 case Hexagon::JMP_GTUriNotPnt_nv_V4:
811 case Hexagon::JMP_GTUriPt_ie_nv_V4:
812 case Hexagon::JMP_GTUriPnt_ie_nv_V4:
813 case Hexagon::JMP_GTUriNotPt_ie_nv_V4:
814 case Hexagon::JMP_GTUriNotPnt_ie_nv_V4:
817 case Hexagon::JMP_GTUrrPt_nv_V4:
818 case Hexagon::JMP_GTUrrPnt_nv_V4:
819 case Hexagon::JMP_GTUrrNotPt_nv_V4:
820 case Hexagon::JMP_GTUrrNotPnt_nv_V4:
821 case Hexagon::JMP_GTUrrPt_ie_nv_V4:
822 case Hexagon::JMP_GTUrrPnt_ie_nv_V4:
823 case Hexagon::JMP_GTUrrNotPt_ie_nv_V4:
824 case Hexagon::JMP_GTUrrNotPnt_ie_nv_V4:
827 case Hexagon::JMP_GTUrrdnPt_nv_V4:
828 case Hexagon::JMP_GTUrrdnPnt_nv_V4:
829 case Hexagon::JMP_GTUrrdnNotPt_nv_V4:
830 case Hexagon::JMP_GTUrrdnNotPnt_nv_V4:
831 case Hexagon::JMP_GTUrrdnPt_ie_nv_V4:
832 case Hexagon::JMP_GTUrrdnPnt_ie_nv_V4:
833 case Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4:
834 case Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4:
839 unsigned HexagonInstrInfo::getImmExtForm(const MachineInstr* MI) const {
840 switch(MI->getOpcode()) {
841 default: llvm_unreachable("Unknown type of instruction.");
843 case Hexagon::JMP_EQriPt_nv_V4:
844 return Hexagon::JMP_EQriPt_ie_nv_V4;
845 case Hexagon::JMP_EQriNotPt_nv_V4:
846 return Hexagon::JMP_EQriNotPt_ie_nv_V4;
847 case Hexagon::JMP_EQriPnt_nv_V4:
848 return Hexagon::JMP_EQriPnt_ie_nv_V4;
849 case Hexagon::JMP_EQriNotPnt_nv_V4:
850 return Hexagon::JMP_EQriNotPnt_ie_nv_V4;
852 // JMP_EQri -- with -1
853 case Hexagon::JMP_EQriPtneg_nv_V4:
854 return Hexagon::JMP_EQriPtneg_ie_nv_V4;
855 case Hexagon::JMP_EQriNotPtneg_nv_V4:
856 return Hexagon::JMP_EQriNotPtneg_ie_nv_V4;
857 case Hexagon::JMP_EQriPntneg_nv_V4:
858 return Hexagon::JMP_EQriPntneg_ie_nv_V4;
859 case Hexagon::JMP_EQriNotPntneg_nv_V4:
860 return Hexagon::JMP_EQriNotPntneg_ie_nv_V4;
863 case Hexagon::JMP_EQrrPt_nv_V4:
864 return Hexagon::JMP_EQrrPt_ie_nv_V4;
865 case Hexagon::JMP_EQrrNotPt_nv_V4:
866 return Hexagon::JMP_EQrrNotPt_ie_nv_V4;
867 case Hexagon::JMP_EQrrPnt_nv_V4:
868 return Hexagon::JMP_EQrrPnt_ie_nv_V4;
869 case Hexagon::JMP_EQrrNotPnt_nv_V4:
870 return Hexagon::JMP_EQrrNotPnt_ie_nv_V4;
873 case Hexagon::JMP_GTriPt_nv_V4:
874 return Hexagon::JMP_GTriPt_ie_nv_V4;
875 case Hexagon::JMP_GTriNotPt_nv_V4:
876 return Hexagon::JMP_GTriNotPt_ie_nv_V4;
877 case Hexagon::JMP_GTriPnt_nv_V4:
878 return Hexagon::JMP_GTriPnt_ie_nv_V4;
879 case Hexagon::JMP_GTriNotPnt_nv_V4:
880 return Hexagon::JMP_GTriNotPnt_ie_nv_V4;
882 // JMP_GTri -- with -1
883 case Hexagon::JMP_GTriPtneg_nv_V4:
884 return Hexagon::JMP_GTriPtneg_ie_nv_V4;
885 case Hexagon::JMP_GTriNotPtneg_nv_V4:
886 return Hexagon::JMP_GTriNotPtneg_ie_nv_V4;
887 case Hexagon::JMP_GTriPntneg_nv_V4:
888 return Hexagon::JMP_GTriPntneg_ie_nv_V4;
889 case Hexagon::JMP_GTriNotPntneg_nv_V4:
890 return Hexagon::JMP_GTriNotPntneg_ie_nv_V4;
893 case Hexagon::JMP_GTrrPt_nv_V4:
894 return Hexagon::JMP_GTrrPt_ie_nv_V4;
895 case Hexagon::JMP_GTrrNotPt_nv_V4:
896 return Hexagon::JMP_GTrrNotPt_ie_nv_V4;
897 case Hexagon::JMP_GTrrPnt_nv_V4:
898 return Hexagon::JMP_GTrrPnt_ie_nv_V4;
899 case Hexagon::JMP_GTrrNotPnt_nv_V4:
900 return Hexagon::JMP_GTrrNotPnt_ie_nv_V4;
903 case Hexagon::JMP_GTrrdnPt_nv_V4:
904 return Hexagon::JMP_GTrrdnPt_ie_nv_V4;
905 case Hexagon::JMP_GTrrdnNotPt_nv_V4:
906 return Hexagon::JMP_GTrrdnNotPt_ie_nv_V4;
907 case Hexagon::JMP_GTrrdnPnt_nv_V4:
908 return Hexagon::JMP_GTrrdnPnt_ie_nv_V4;
909 case Hexagon::JMP_GTrrdnNotPnt_nv_V4:
910 return Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4;
913 case Hexagon::JMP_GTUriPt_nv_V4:
914 return Hexagon::JMP_GTUriPt_ie_nv_V4;
915 case Hexagon::JMP_GTUriNotPt_nv_V4:
916 return Hexagon::JMP_GTUriNotPt_ie_nv_V4;
917 case Hexagon::JMP_GTUriPnt_nv_V4:
918 return Hexagon::JMP_GTUriPnt_ie_nv_V4;
919 case Hexagon::JMP_GTUriNotPnt_nv_V4:
920 return Hexagon::JMP_GTUriNotPnt_ie_nv_V4;
923 case Hexagon::JMP_GTUrrPt_nv_V4:
924 return Hexagon::JMP_GTUrrPt_ie_nv_V4;
925 case Hexagon::JMP_GTUrrNotPt_nv_V4:
926 return Hexagon::JMP_GTUrrNotPt_ie_nv_V4;
927 case Hexagon::JMP_GTUrrPnt_nv_V4:
928 return Hexagon::JMP_GTUrrPnt_ie_nv_V4;
929 case Hexagon::JMP_GTUrrNotPnt_nv_V4:
930 return Hexagon::JMP_GTUrrNotPnt_ie_nv_V4;
933 case Hexagon::JMP_GTUrrdnPt_nv_V4:
934 return Hexagon::JMP_GTUrrdnPt_ie_nv_V4;
935 case Hexagon::JMP_GTUrrdnNotPt_nv_V4:
936 return Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4;
937 case Hexagon::JMP_GTUrrdnPnt_nv_V4:
938 return Hexagon::JMP_GTUrrdnPnt_ie_nv_V4;
939 case Hexagon::JMP_GTUrrdnNotPnt_nv_V4:
940 return Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4;
942 case Hexagon::TFR_FI:
943 return Hexagon::TFR_FI_immext_V4;
945 case Hexagon::MEMw_ADDSUBi_indexed_MEM_V4 :
946 case Hexagon::MEMw_ADDi_indexed_MEM_V4 :
947 case Hexagon::MEMw_SUBi_indexed_MEM_V4 :
948 case Hexagon::MEMw_ADDr_indexed_MEM_V4 :
949 case Hexagon::MEMw_SUBr_indexed_MEM_V4 :
950 case Hexagon::MEMw_ANDr_indexed_MEM_V4 :
951 case Hexagon::MEMw_ORr_indexed_MEM_V4 :
952 case Hexagon::MEMw_ADDSUBi_MEM_V4 :
953 case Hexagon::MEMw_ADDi_MEM_V4 :
954 case Hexagon::MEMw_SUBi_MEM_V4 :
955 case Hexagon::MEMw_ADDr_MEM_V4 :
956 case Hexagon::MEMw_SUBr_MEM_V4 :
957 case Hexagon::MEMw_ANDr_MEM_V4 :
958 case Hexagon::MEMw_ORr_MEM_V4 :
959 case Hexagon::MEMh_ADDSUBi_indexed_MEM_V4 :
960 case Hexagon::MEMh_ADDi_indexed_MEM_V4 :
961 case Hexagon::MEMh_SUBi_indexed_MEM_V4 :
962 case Hexagon::MEMh_ADDr_indexed_MEM_V4 :
963 case Hexagon::MEMh_SUBr_indexed_MEM_V4 :
964 case Hexagon::MEMh_ANDr_indexed_MEM_V4 :
965 case Hexagon::MEMh_ORr_indexed_MEM_V4 :
966 case Hexagon::MEMh_ADDSUBi_MEM_V4 :
967 case Hexagon::MEMh_ADDi_MEM_V4 :
968 case Hexagon::MEMh_SUBi_MEM_V4 :
969 case Hexagon::MEMh_ADDr_MEM_V4 :
970 case Hexagon::MEMh_SUBr_MEM_V4 :
971 case Hexagon::MEMh_ANDr_MEM_V4 :
972 case Hexagon::MEMh_ORr_MEM_V4 :
973 case Hexagon::MEMb_ADDSUBi_indexed_MEM_V4 :
974 case Hexagon::MEMb_ADDi_indexed_MEM_V4 :
975 case Hexagon::MEMb_SUBi_indexed_MEM_V4 :
976 case Hexagon::MEMb_ADDr_indexed_MEM_V4 :
977 case Hexagon::MEMb_SUBr_indexed_MEM_V4 :
978 case Hexagon::MEMb_ANDr_indexed_MEM_V4 :
979 case Hexagon::MEMb_ORr_indexed_MEM_V4 :
980 case Hexagon::MEMb_ADDSUBi_MEM_V4 :
981 case Hexagon::MEMb_ADDi_MEM_V4 :
982 case Hexagon::MEMb_SUBi_MEM_V4 :
983 case Hexagon::MEMb_ADDr_MEM_V4 :
984 case Hexagon::MEMb_SUBr_MEM_V4 :
985 case Hexagon::MEMb_ANDr_MEM_V4 :
986 case Hexagon::MEMb_ORr_MEM_V4 :
987 llvm_unreachable("Needs implementing.");
991 unsigned HexagonInstrInfo::getNormalBranchForm(const MachineInstr* MI) const {
992 switch(MI->getOpcode()) {
993 default: llvm_unreachable("Unknown type of jump instruction.");
995 case Hexagon::JMP_EQriPt_ie_nv_V4:
996 return Hexagon::JMP_EQriPt_nv_V4;
997 case Hexagon::JMP_EQriNotPt_ie_nv_V4:
998 return Hexagon::JMP_EQriNotPt_nv_V4;
999 case Hexagon::JMP_EQriPnt_ie_nv_V4:
1000 return Hexagon::JMP_EQriPnt_nv_V4;
1001 case Hexagon::JMP_EQriNotPnt_ie_nv_V4:
1002 return Hexagon::JMP_EQriNotPnt_nv_V4;
1004 // JMP_EQri -- with -1
1005 case Hexagon::JMP_EQriPtneg_ie_nv_V4:
1006 return Hexagon::JMP_EQriPtneg_nv_V4;
1007 case Hexagon::JMP_EQriNotPtneg_ie_nv_V4:
1008 return Hexagon::JMP_EQriNotPtneg_nv_V4;
1009 case Hexagon::JMP_EQriPntneg_ie_nv_V4:
1010 return Hexagon::JMP_EQriPntneg_nv_V4;
1011 case Hexagon::JMP_EQriNotPntneg_ie_nv_V4:
1012 return Hexagon::JMP_EQriNotPntneg_nv_V4;
1015 case Hexagon::JMP_EQrrPt_ie_nv_V4:
1016 return Hexagon::JMP_EQrrPt_nv_V4;
1017 case Hexagon::JMP_EQrrNotPt_ie_nv_V4:
1018 return Hexagon::JMP_EQrrNotPt_nv_V4;
1019 case Hexagon::JMP_EQrrPnt_ie_nv_V4:
1020 return Hexagon::JMP_EQrrPnt_nv_V4;
1021 case Hexagon::JMP_EQrrNotPnt_ie_nv_V4:
1022 return Hexagon::JMP_EQrrNotPnt_nv_V4;
1025 case Hexagon::JMP_GTriPt_ie_nv_V4:
1026 return Hexagon::JMP_GTriPt_nv_V4;
1027 case Hexagon::JMP_GTriNotPt_ie_nv_V4:
1028 return Hexagon::JMP_GTriNotPt_nv_V4;
1029 case Hexagon::JMP_GTriPnt_ie_nv_V4:
1030 return Hexagon::JMP_GTriPnt_nv_V4;
1031 case Hexagon::JMP_GTriNotPnt_ie_nv_V4:
1032 return Hexagon::JMP_GTriNotPnt_nv_V4;
1034 // JMP_GTri -- with -1
1035 case Hexagon::JMP_GTriPtneg_ie_nv_V4:
1036 return Hexagon::JMP_GTriPtneg_nv_V4;
1037 case Hexagon::JMP_GTriNotPtneg_ie_nv_V4:
1038 return Hexagon::JMP_GTriNotPtneg_nv_V4;
1039 case Hexagon::JMP_GTriPntneg_ie_nv_V4:
1040 return Hexagon::JMP_GTriPntneg_nv_V4;
1041 case Hexagon::JMP_GTriNotPntneg_ie_nv_V4:
1042 return Hexagon::JMP_GTriNotPntneg_nv_V4;
1045 case Hexagon::JMP_GTrrPt_ie_nv_V4:
1046 return Hexagon::JMP_GTrrPt_nv_V4;
1047 case Hexagon::JMP_GTrrNotPt_ie_nv_V4:
1048 return Hexagon::JMP_GTrrNotPt_nv_V4;
1049 case Hexagon::JMP_GTrrPnt_ie_nv_V4:
1050 return Hexagon::JMP_GTrrPnt_nv_V4;
1051 case Hexagon::JMP_GTrrNotPnt_ie_nv_V4:
1052 return Hexagon::JMP_GTrrNotPnt_nv_V4;
1055 case Hexagon::JMP_GTrrdnPt_ie_nv_V4:
1056 return Hexagon::JMP_GTrrdnPt_nv_V4;
1057 case Hexagon::JMP_GTrrdnNotPt_ie_nv_V4:
1058 return Hexagon::JMP_GTrrdnNotPt_nv_V4;
1059 case Hexagon::JMP_GTrrdnPnt_ie_nv_V4:
1060 return Hexagon::JMP_GTrrdnPnt_nv_V4;
1061 case Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4:
1062 return Hexagon::JMP_GTrrdnNotPnt_nv_V4;
1065 case Hexagon::JMP_GTUriPt_ie_nv_V4:
1066 return Hexagon::JMP_GTUriPt_nv_V4;
1067 case Hexagon::JMP_GTUriNotPt_ie_nv_V4:
1068 return Hexagon::JMP_GTUriNotPt_nv_V4;
1069 case Hexagon::JMP_GTUriPnt_ie_nv_V4:
1070 return Hexagon::JMP_GTUriPnt_nv_V4;
1071 case Hexagon::JMP_GTUriNotPnt_ie_nv_V4:
1072 return Hexagon::JMP_GTUriNotPnt_nv_V4;
1075 case Hexagon::JMP_GTUrrPt_ie_nv_V4:
1076 return Hexagon::JMP_GTUrrPt_nv_V4;
1077 case Hexagon::JMP_GTUrrNotPt_ie_nv_V4:
1078 return Hexagon::JMP_GTUrrNotPt_nv_V4;
1079 case Hexagon::JMP_GTUrrPnt_ie_nv_V4:
1080 return Hexagon::JMP_GTUrrPnt_nv_V4;
1081 case Hexagon::JMP_GTUrrNotPnt_ie_nv_V4:
1082 return Hexagon::JMP_GTUrrNotPnt_nv_V4;
1085 case Hexagon::JMP_GTUrrdnPt_ie_nv_V4:
1086 return Hexagon::JMP_GTUrrdnPt_nv_V4;
1087 case Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4:
1088 return Hexagon::JMP_GTUrrdnNotPt_nv_V4;
1089 case Hexagon::JMP_GTUrrdnPnt_ie_nv_V4:
1090 return Hexagon::JMP_GTUrrdnPnt_nv_V4;
1091 case Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4:
1092 return Hexagon::JMP_GTUrrdnNotPnt_nv_V4;
1097 bool HexagonInstrInfo::isNewValueStore(const MachineInstr *MI) const {
1098 switch (MI->getOpcode()) {
1099 default: return false;
1101 case Hexagon::STrib_nv_V4:
1102 case Hexagon::STrib_indexed_nv_V4:
1103 case Hexagon::STrib_indexed_shl_nv_V4:
1104 case Hexagon::STrib_shl_nv_V4:
1105 case Hexagon::STrib_GP_nv_V4:
1106 case Hexagon::STb_GP_nv_V4:
1107 case Hexagon::POST_STbri_nv_V4:
1108 case Hexagon::STrib_cPt_nv_V4:
1109 case Hexagon::STrib_cdnPt_nv_V4:
1110 case Hexagon::STrib_cNotPt_nv_V4:
1111 case Hexagon::STrib_cdnNotPt_nv_V4:
1112 case Hexagon::STrib_indexed_cPt_nv_V4:
1113 case Hexagon::STrib_indexed_cdnPt_nv_V4:
1114 case Hexagon::STrib_indexed_cNotPt_nv_V4:
1115 case Hexagon::STrib_indexed_cdnNotPt_nv_V4:
1116 case Hexagon::STrib_indexed_shl_cPt_nv_V4:
1117 case Hexagon::STrib_indexed_shl_cdnPt_nv_V4:
1118 case Hexagon::STrib_indexed_shl_cNotPt_nv_V4:
1119 case Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4:
1120 case Hexagon::POST_STbri_cPt_nv_V4:
1121 case Hexagon::POST_STbri_cdnPt_nv_V4:
1122 case Hexagon::POST_STbri_cNotPt_nv_V4:
1123 case Hexagon::POST_STbri_cdnNotPt_nv_V4:
1124 case Hexagon::STb_GP_cPt_nv_V4:
1125 case Hexagon::STb_GP_cNotPt_nv_V4:
1126 case Hexagon::STb_GP_cdnPt_nv_V4:
1127 case Hexagon::STb_GP_cdnNotPt_nv_V4:
1128 case Hexagon::STrib_GP_cPt_nv_V4:
1129 case Hexagon::STrib_GP_cNotPt_nv_V4:
1130 case Hexagon::STrib_GP_cdnPt_nv_V4:
1131 case Hexagon::STrib_GP_cdnNotPt_nv_V4:
1132 case Hexagon::STrib_abs_nv_V4:
1133 case Hexagon::STrib_abs_cPt_nv_V4:
1134 case Hexagon::STrib_abs_cdnPt_nv_V4:
1135 case Hexagon::STrib_abs_cNotPt_nv_V4:
1136 case Hexagon::STrib_abs_cdnNotPt_nv_V4:
1137 case Hexagon::STrib_imm_abs_nv_V4:
1138 case Hexagon::STrib_imm_abs_cPt_nv_V4:
1139 case Hexagon::STrib_imm_abs_cdnPt_nv_V4:
1140 case Hexagon::STrib_imm_abs_cNotPt_nv_V4:
1141 case Hexagon::STrib_imm_abs_cdnNotPt_nv_V4:
1144 case Hexagon::STrih_nv_V4:
1145 case Hexagon::STrih_indexed_nv_V4:
1146 case Hexagon::STrih_indexed_shl_nv_V4:
1147 case Hexagon::STrih_shl_nv_V4:
1148 case Hexagon::STrih_GP_nv_V4:
1149 case Hexagon::STh_GP_nv_V4:
1150 case Hexagon::POST_SThri_nv_V4:
1151 case Hexagon::STrih_cPt_nv_V4:
1152 case Hexagon::STrih_cdnPt_nv_V4:
1153 case Hexagon::STrih_cNotPt_nv_V4:
1154 case Hexagon::STrih_cdnNotPt_nv_V4:
1155 case Hexagon::STrih_indexed_cPt_nv_V4:
1156 case Hexagon::STrih_indexed_cdnPt_nv_V4:
1157 case Hexagon::STrih_indexed_cNotPt_nv_V4:
1158 case Hexagon::STrih_indexed_cdnNotPt_nv_V4:
1159 case Hexagon::STrih_indexed_shl_cPt_nv_V4:
1160 case Hexagon::STrih_indexed_shl_cdnPt_nv_V4:
1161 case Hexagon::STrih_indexed_shl_cNotPt_nv_V4:
1162 case Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4:
1163 case Hexagon::POST_SThri_cPt_nv_V4:
1164 case Hexagon::POST_SThri_cdnPt_nv_V4:
1165 case Hexagon::POST_SThri_cNotPt_nv_V4:
1166 case Hexagon::POST_SThri_cdnNotPt_nv_V4:
1167 case Hexagon::STh_GP_cPt_nv_V4:
1168 case Hexagon::STh_GP_cNotPt_nv_V4:
1169 case Hexagon::STh_GP_cdnPt_nv_V4:
1170 case Hexagon::STh_GP_cdnNotPt_nv_V4:
1171 case Hexagon::STrih_GP_cPt_nv_V4:
1172 case Hexagon::STrih_GP_cNotPt_nv_V4:
1173 case Hexagon::STrih_GP_cdnPt_nv_V4:
1174 case Hexagon::STrih_GP_cdnNotPt_nv_V4:
1175 case Hexagon::STrih_abs_nv_V4:
1176 case Hexagon::STrih_abs_cPt_nv_V4:
1177 case Hexagon::STrih_abs_cdnPt_nv_V4:
1178 case Hexagon::STrih_abs_cNotPt_nv_V4:
1179 case Hexagon::STrih_abs_cdnNotPt_nv_V4:
1180 case Hexagon::STrih_imm_abs_nv_V4:
1181 case Hexagon::STrih_imm_abs_cPt_nv_V4:
1182 case Hexagon::STrih_imm_abs_cdnPt_nv_V4:
1183 case Hexagon::STrih_imm_abs_cNotPt_nv_V4:
1184 case Hexagon::STrih_imm_abs_cdnNotPt_nv_V4:
1187 case Hexagon::STriw_nv_V4:
1188 case Hexagon::STriw_indexed_nv_V4:
1189 case Hexagon::STriw_indexed_shl_nv_V4:
1190 case Hexagon::STriw_shl_nv_V4:
1191 case Hexagon::STriw_GP_nv_V4:
1192 case Hexagon::STw_GP_nv_V4:
1193 case Hexagon::POST_STwri_nv_V4:
1194 case Hexagon::STriw_cPt_nv_V4:
1195 case Hexagon::STriw_cdnPt_nv_V4:
1196 case Hexagon::STriw_cNotPt_nv_V4:
1197 case Hexagon::STriw_cdnNotPt_nv_V4:
1198 case Hexagon::STriw_indexed_cPt_nv_V4:
1199 case Hexagon::STriw_indexed_cdnPt_nv_V4:
1200 case Hexagon::STriw_indexed_cNotPt_nv_V4:
1201 case Hexagon::STriw_indexed_cdnNotPt_nv_V4:
1202 case Hexagon::STriw_indexed_shl_cPt_nv_V4:
1203 case Hexagon::STriw_indexed_shl_cdnPt_nv_V4:
1204 case Hexagon::STriw_indexed_shl_cNotPt_nv_V4:
1205 case Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4:
1206 case Hexagon::POST_STwri_cPt_nv_V4:
1207 case Hexagon::POST_STwri_cdnPt_nv_V4:
1208 case Hexagon::POST_STwri_cNotPt_nv_V4:
1209 case Hexagon::POST_STwri_cdnNotPt_nv_V4:
1210 case Hexagon::STw_GP_cPt_nv_V4:
1211 case Hexagon::STw_GP_cNotPt_nv_V4:
1212 case Hexagon::STw_GP_cdnPt_nv_V4:
1213 case Hexagon::STw_GP_cdnNotPt_nv_V4:
1214 case Hexagon::STriw_GP_cPt_nv_V4:
1215 case Hexagon::STriw_GP_cNotPt_nv_V4:
1216 case Hexagon::STriw_GP_cdnPt_nv_V4:
1217 case Hexagon::STriw_GP_cdnNotPt_nv_V4:
1218 case Hexagon::STriw_abs_nv_V4:
1219 case Hexagon::STriw_abs_cPt_nv_V4:
1220 case Hexagon::STriw_abs_cdnPt_nv_V4:
1221 case Hexagon::STriw_abs_cNotPt_nv_V4:
1222 case Hexagon::STriw_abs_cdnNotPt_nv_V4:
1223 case Hexagon::STriw_imm_abs_nv_V4:
1224 case Hexagon::STriw_imm_abs_cPt_nv_V4:
1225 case Hexagon::STriw_imm_abs_cdnPt_nv_V4:
1226 case Hexagon::STriw_imm_abs_cNotPt_nv_V4:
1227 case Hexagon::STriw_imm_abs_cdnNotPt_nv_V4:
1232 bool HexagonInstrInfo::isPostIncrement (const MachineInstr* MI) const {
1233 switch (MI->getOpcode())
1235 default: return false;
1237 case Hexagon::POST_LDrib:
1238 case Hexagon::POST_LDrib_cPt:
1239 case Hexagon::POST_LDrib_cNotPt:
1240 case Hexagon::POST_LDrib_cdnPt_V4:
1241 case Hexagon::POST_LDrib_cdnNotPt_V4:
1243 // Load unsigned byte
1244 case Hexagon::POST_LDriub:
1245 case Hexagon::POST_LDriub_cPt:
1246 case Hexagon::POST_LDriub_cNotPt:
1247 case Hexagon::POST_LDriub_cdnPt_V4:
1248 case Hexagon::POST_LDriub_cdnNotPt_V4:
1251 case Hexagon::POST_LDrih:
1252 case Hexagon::POST_LDrih_cPt:
1253 case Hexagon::POST_LDrih_cNotPt:
1254 case Hexagon::POST_LDrih_cdnPt_V4:
1255 case Hexagon::POST_LDrih_cdnNotPt_V4:
1257 // Load unsigned halfword
1258 case Hexagon::POST_LDriuh:
1259 case Hexagon::POST_LDriuh_cPt:
1260 case Hexagon::POST_LDriuh_cNotPt:
1261 case Hexagon::POST_LDriuh_cdnPt_V4:
1262 case Hexagon::POST_LDriuh_cdnNotPt_V4:
1265 case Hexagon::POST_LDriw:
1266 case Hexagon::POST_LDriw_cPt:
1267 case Hexagon::POST_LDriw_cNotPt:
1268 case Hexagon::POST_LDriw_cdnPt_V4:
1269 case Hexagon::POST_LDriw_cdnNotPt_V4:
1272 case Hexagon::POST_LDrid:
1273 case Hexagon::POST_LDrid_cPt:
1274 case Hexagon::POST_LDrid_cNotPt:
1275 case Hexagon::POST_LDrid_cdnPt_V4:
1276 case Hexagon::POST_LDrid_cdnNotPt_V4:
1279 case Hexagon::POST_STbri:
1280 case Hexagon::POST_STbri_cPt:
1281 case Hexagon::POST_STbri_cNotPt:
1282 case Hexagon::POST_STbri_cdnPt_V4:
1283 case Hexagon::POST_STbri_cdnNotPt_V4:
1286 case Hexagon::POST_SThri:
1287 case Hexagon::POST_SThri_cPt:
1288 case Hexagon::POST_SThri_cNotPt:
1289 case Hexagon::POST_SThri_cdnPt_V4:
1290 case Hexagon::POST_SThri_cdnNotPt_V4:
1293 case Hexagon::POST_STwri:
1294 case Hexagon::POST_STwri_cPt:
1295 case Hexagon::POST_STwri_cNotPt:
1296 case Hexagon::POST_STwri_cdnPt_V4:
1297 case Hexagon::POST_STwri_cdnNotPt_V4:
1299 // Store double word
1300 case Hexagon::POST_STdri:
1301 case Hexagon::POST_STdri_cPt:
1302 case Hexagon::POST_STdri_cNotPt:
1303 case Hexagon::POST_STdri_cdnPt_V4:
1304 case Hexagon::POST_STdri_cdnNotPt_V4:
1309 bool HexagonInstrInfo::isSaveCalleeSavedRegsCall(const MachineInstr *MI) const {
1310 return MI->getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4;
1313 bool HexagonInstrInfo::isPredicable(MachineInstr *MI) const {
1314 bool isPred = MI->getDesc().isPredicable();
1319 const int Opc = MI->getOpcode();
1320 int NumOperands = MI->getNumOperands();
1322 // Keep a flag for upto 4 operands in the instructions, to indicate if
1323 // that operand has been constant extended.
1324 bool OpCExtended[4];
1325 if (NumOperands > 4)
1328 for (int i=0; i<NumOperands; i++)
1329 OpCExtended[i] = (HexagonConstExt::isOperandExtended(Opc, 1) &&
1330 isConstExtended(MI));
1334 // Return true if MI is constant extended as predicated form will also be
1335 // extended so immediate value doesn't have to fit within range.
1336 return OpCExtended[1] || isInt<12>(MI->getOperand(1).getImm());
1338 case Hexagon::STrid:
1339 case Hexagon::STrid_indexed:
1340 return OpCExtended[1] || isShiftedUInt<6,3>(MI->getOperand(1).getImm());
1342 case Hexagon::STriw:
1343 case Hexagon::STriw_indexed:
1344 case Hexagon::STriw_nv_V4:
1345 return OpCExtended[1] || isShiftedUInt<6,2>(MI->getOperand(1).getImm());
1347 case Hexagon::STrih:
1348 case Hexagon::STrih_indexed:
1349 case Hexagon::STrih_nv_V4:
1350 return OpCExtended[1] || isShiftedUInt<6,1>(MI->getOperand(1).getImm());
1352 case Hexagon::STrib:
1353 case Hexagon::STrib_indexed:
1354 case Hexagon::STrib_nv_V4:
1355 return OpCExtended[1] || isUInt<6>(MI->getOperand(1).getImm());
1357 case Hexagon::LDrid:
1358 case Hexagon::LDrid_indexed:
1359 return OpCExtended[2] || isShiftedUInt<6,3>(MI->getOperand(2).getImm());
1361 case Hexagon::LDriw:
1362 case Hexagon::LDriw_indexed:
1363 return OpCExtended[2] || isShiftedUInt<6,2>(MI->getOperand(2).getImm());
1365 case Hexagon::LDrih:
1366 case Hexagon::LDriuh:
1367 case Hexagon::LDrih_indexed:
1368 case Hexagon::LDriuh_indexed:
1369 return OpCExtended[2] || isShiftedUInt<6,1>(MI->getOperand(2).getImm());
1371 case Hexagon::LDrib:
1372 case Hexagon::LDriub:
1373 case Hexagon::LDrib_indexed:
1374 case Hexagon::LDriub_indexed:
1375 return OpCExtended[2] || isUInt<6>(MI->getOperand(2).getImm());
1377 case Hexagon::POST_LDrid:
1378 return OpCExtended[3] || isShiftedInt<4,3>(MI->getOperand(3).getImm());
1380 case Hexagon::POST_LDriw:
1381 return OpCExtended[3] || isShiftedInt<4,2>(MI->getOperand(3).getImm());
1383 case Hexagon::POST_LDrih:
1384 case Hexagon::POST_LDriuh:
1385 return OpCExtended[3] || isShiftedInt<4,1>(MI->getOperand(3).getImm());
1387 case Hexagon::POST_LDrib:
1388 case Hexagon::POST_LDriub:
1389 return OpCExtended[3] || isInt<4>(MI->getOperand(3).getImm());
1391 case Hexagon::STrib_imm_V4:
1392 case Hexagon::STrih_imm_V4:
1393 case Hexagon::STriw_imm_V4:
1394 return ((OpCExtended[1] || isUInt<6>(MI->getOperand(1).getImm())) &&
1395 (OpCExtended[2] || isInt<6>(MI->getOperand(2).getImm())));
1397 case Hexagon::ADD_ri:
1398 return OpCExtended[2] || isInt<8>(MI->getOperand(2).getImm());
1406 return Subtarget.hasV4TOps();
1415 // This function performs the following inversiones:
1420 // however, these inversiones are NOT included:
1422 // cdnPt -X-> cdnNotPt
1423 // cdnNotPt -X-> cdnPt
1424 // cPt_nv -X-> cNotPt_nv (new value stores)
1425 // cNotPt_nv -X-> cPt_nv (new value stores)
1427 // because only the following transformations are allowed:
1429 // cNotPt ---> cdnNotPt
1431 // cNotPt ---> cNotPt_nv
1433 unsigned HexagonInstrInfo::getInvertedPredicatedOpcode(const int Opc) const {
1435 default: llvm_unreachable("Unexpected predicated instruction");
1436 case Hexagon::TFR_cPt:
1437 return Hexagon::TFR_cNotPt;
1438 case Hexagon::TFR_cNotPt:
1439 return Hexagon::TFR_cPt;
1441 case Hexagon::TFRI_cPt:
1442 return Hexagon::TFRI_cNotPt;
1443 case Hexagon::TFRI_cNotPt:
1444 return Hexagon::TFRI_cPt;
1446 case Hexagon::JMP_c:
1447 return Hexagon::JMP_cNot;
1448 case Hexagon::JMP_cNot:
1449 return Hexagon::JMP_c;
1451 case Hexagon::ADD_ri_cPt:
1452 return Hexagon::ADD_ri_cNotPt;
1453 case Hexagon::ADD_ri_cNotPt:
1454 return Hexagon::ADD_ri_cPt;
1456 case Hexagon::ADD_rr_cPt:
1457 return Hexagon::ADD_rr_cNotPt;
1458 case Hexagon::ADD_rr_cNotPt:
1459 return Hexagon::ADD_rr_cPt;
1461 case Hexagon::XOR_rr_cPt:
1462 return Hexagon::XOR_rr_cNotPt;
1463 case Hexagon::XOR_rr_cNotPt:
1464 return Hexagon::XOR_rr_cPt;
1466 case Hexagon::AND_rr_cPt:
1467 return Hexagon::AND_rr_cNotPt;
1468 case Hexagon::AND_rr_cNotPt:
1469 return Hexagon::AND_rr_cPt;
1471 case Hexagon::OR_rr_cPt:
1472 return Hexagon::OR_rr_cNotPt;
1473 case Hexagon::OR_rr_cNotPt:
1474 return Hexagon::OR_rr_cPt;
1476 case Hexagon::SUB_rr_cPt:
1477 return Hexagon::SUB_rr_cNotPt;
1478 case Hexagon::SUB_rr_cNotPt:
1479 return Hexagon::SUB_rr_cPt;
1481 case Hexagon::COMBINE_rr_cPt:
1482 return Hexagon::COMBINE_rr_cNotPt;
1483 case Hexagon::COMBINE_rr_cNotPt:
1484 return Hexagon::COMBINE_rr_cPt;
1486 case Hexagon::ASLH_cPt_V4:
1487 return Hexagon::ASLH_cNotPt_V4;
1488 case Hexagon::ASLH_cNotPt_V4:
1489 return Hexagon::ASLH_cPt_V4;
1491 case Hexagon::ASRH_cPt_V4:
1492 return Hexagon::ASRH_cNotPt_V4;
1493 case Hexagon::ASRH_cNotPt_V4:
1494 return Hexagon::ASRH_cPt_V4;
1496 case Hexagon::SXTB_cPt_V4:
1497 return Hexagon::SXTB_cNotPt_V4;
1498 case Hexagon::SXTB_cNotPt_V4:
1499 return Hexagon::SXTB_cPt_V4;
1501 case Hexagon::SXTH_cPt_V4:
1502 return Hexagon::SXTH_cNotPt_V4;
1503 case Hexagon::SXTH_cNotPt_V4:
1504 return Hexagon::SXTH_cPt_V4;
1506 case Hexagon::ZXTB_cPt_V4:
1507 return Hexagon::ZXTB_cNotPt_V4;
1508 case Hexagon::ZXTB_cNotPt_V4:
1509 return Hexagon::ZXTB_cPt_V4;
1511 case Hexagon::ZXTH_cPt_V4:
1512 return Hexagon::ZXTH_cNotPt_V4;
1513 case Hexagon::ZXTH_cNotPt_V4:
1514 return Hexagon::ZXTH_cPt_V4;
1517 case Hexagon::JMPR_cPt:
1518 return Hexagon::JMPR_cNotPt;
1519 case Hexagon::JMPR_cNotPt:
1520 return Hexagon::JMPR_cPt;
1522 // V4 indexed+scaled load.
1523 case Hexagon::LDrid_indexed_cPt_V4:
1524 return Hexagon::LDrid_indexed_cNotPt_V4;
1525 case Hexagon::LDrid_indexed_cNotPt_V4:
1526 return Hexagon::LDrid_indexed_cPt_V4;
1528 case Hexagon::LDrid_indexed_shl_cPt_V4:
1529 return Hexagon::LDrid_indexed_shl_cNotPt_V4;
1530 case Hexagon::LDrid_indexed_shl_cNotPt_V4:
1531 return Hexagon::LDrid_indexed_shl_cPt_V4;
1533 case Hexagon::LDrib_indexed_cPt_V4:
1534 return Hexagon::LDrib_indexed_cNotPt_V4;
1535 case Hexagon::LDrib_indexed_cNotPt_V4:
1536 return Hexagon::LDrib_indexed_cPt_V4;
1538 case Hexagon::LDriub_indexed_cPt_V4:
1539 return Hexagon::LDriub_indexed_cNotPt_V4;
1540 case Hexagon::LDriub_indexed_cNotPt_V4:
1541 return Hexagon::LDriub_indexed_cPt_V4;
1543 case Hexagon::LDrib_indexed_shl_cPt_V4:
1544 return Hexagon::LDrib_indexed_shl_cNotPt_V4;
1545 case Hexagon::LDrib_indexed_shl_cNotPt_V4:
1546 return Hexagon::LDrib_indexed_shl_cPt_V4;
1548 case Hexagon::LDriub_indexed_shl_cPt_V4:
1549 return Hexagon::LDriub_indexed_shl_cNotPt_V4;
1550 case Hexagon::LDriub_indexed_shl_cNotPt_V4:
1551 return Hexagon::LDriub_indexed_shl_cPt_V4;
1553 case Hexagon::LDrih_indexed_cPt_V4:
1554 return Hexagon::LDrih_indexed_cNotPt_V4;
1555 case Hexagon::LDrih_indexed_cNotPt_V4:
1556 return Hexagon::LDrih_indexed_cPt_V4;
1558 case Hexagon::LDriuh_indexed_cPt_V4:
1559 return Hexagon::LDriuh_indexed_cNotPt_V4;
1560 case Hexagon::LDriuh_indexed_cNotPt_V4:
1561 return Hexagon::LDriuh_indexed_cPt_V4;
1563 case Hexagon::LDrih_indexed_shl_cPt_V4:
1564 return Hexagon::LDrih_indexed_shl_cNotPt_V4;
1565 case Hexagon::LDrih_indexed_shl_cNotPt_V4:
1566 return Hexagon::LDrih_indexed_shl_cPt_V4;
1568 case Hexagon::LDriuh_indexed_shl_cPt_V4:
1569 return Hexagon::LDriuh_indexed_shl_cNotPt_V4;
1570 case Hexagon::LDriuh_indexed_shl_cNotPt_V4:
1571 return Hexagon::LDriuh_indexed_shl_cPt_V4;
1573 case Hexagon::LDriw_indexed_cPt_V4:
1574 return Hexagon::LDriw_indexed_cNotPt_V4;
1575 case Hexagon::LDriw_indexed_cNotPt_V4:
1576 return Hexagon::LDriw_indexed_cPt_V4;
1578 case Hexagon::LDriw_indexed_shl_cPt_V4:
1579 return Hexagon::LDriw_indexed_shl_cNotPt_V4;
1580 case Hexagon::LDriw_indexed_shl_cNotPt_V4:
1581 return Hexagon::LDriw_indexed_shl_cPt_V4;
1584 case Hexagon::POST_STbri_cPt:
1585 return Hexagon::POST_STbri_cNotPt;
1586 case Hexagon::POST_STbri_cNotPt:
1587 return Hexagon::POST_STbri_cPt;
1589 case Hexagon::STrib_cPt:
1590 return Hexagon::STrib_cNotPt;
1591 case Hexagon::STrib_cNotPt:
1592 return Hexagon::STrib_cPt;
1594 case Hexagon::STrib_indexed_cPt:
1595 return Hexagon::STrib_indexed_cNotPt;
1596 case Hexagon::STrib_indexed_cNotPt:
1597 return Hexagon::STrib_indexed_cPt;
1599 case Hexagon::STrib_imm_cPt_V4:
1600 return Hexagon::STrib_imm_cNotPt_V4;
1601 case Hexagon::STrib_imm_cNotPt_V4:
1602 return Hexagon::STrib_imm_cPt_V4;
1604 case Hexagon::STrib_indexed_shl_cPt_V4:
1605 return Hexagon::STrib_indexed_shl_cNotPt_V4;
1606 case Hexagon::STrib_indexed_shl_cNotPt_V4:
1607 return Hexagon::STrib_indexed_shl_cPt_V4;
1610 case Hexagon::POST_SThri_cPt:
1611 return Hexagon::POST_SThri_cNotPt;
1612 case Hexagon::POST_SThri_cNotPt:
1613 return Hexagon::POST_SThri_cPt;
1615 case Hexagon::STrih_cPt:
1616 return Hexagon::STrih_cNotPt;
1617 case Hexagon::STrih_cNotPt:
1618 return Hexagon::STrih_cPt;
1620 case Hexagon::STrih_indexed_cPt:
1621 return Hexagon::STrih_indexed_cNotPt;
1622 case Hexagon::STrih_indexed_cNotPt:
1623 return Hexagon::STrih_indexed_cPt;
1625 case Hexagon::STrih_imm_cPt_V4:
1626 return Hexagon::STrih_imm_cNotPt_V4;
1627 case Hexagon::STrih_imm_cNotPt_V4:
1628 return Hexagon::STrih_imm_cPt_V4;
1630 case Hexagon::STrih_indexed_shl_cPt_V4:
1631 return Hexagon::STrih_indexed_shl_cNotPt_V4;
1632 case Hexagon::STrih_indexed_shl_cNotPt_V4:
1633 return Hexagon::STrih_indexed_shl_cPt_V4;
1636 case Hexagon::POST_STwri_cPt:
1637 return Hexagon::POST_STwri_cNotPt;
1638 case Hexagon::POST_STwri_cNotPt:
1639 return Hexagon::POST_STwri_cPt;
1641 case Hexagon::STriw_cPt:
1642 return Hexagon::STriw_cNotPt;
1643 case Hexagon::STriw_cNotPt:
1644 return Hexagon::STriw_cPt;
1646 case Hexagon::STriw_indexed_cPt:
1647 return Hexagon::STriw_indexed_cNotPt;
1648 case Hexagon::STriw_indexed_cNotPt:
1649 return Hexagon::STriw_indexed_cPt;
1651 case Hexagon::STriw_indexed_shl_cPt_V4:
1652 return Hexagon::STriw_indexed_shl_cNotPt_V4;
1653 case Hexagon::STriw_indexed_shl_cNotPt_V4:
1654 return Hexagon::STriw_indexed_shl_cPt_V4;
1656 case Hexagon::STriw_imm_cPt_V4:
1657 return Hexagon::STriw_imm_cNotPt_V4;
1658 case Hexagon::STriw_imm_cNotPt_V4:
1659 return Hexagon::STriw_imm_cPt_V4;
1662 case Hexagon::POST_STdri_cPt:
1663 return Hexagon::POST_STdri_cNotPt;
1664 case Hexagon::POST_STdri_cNotPt:
1665 return Hexagon::POST_STdri_cPt;
1667 case Hexagon::STrid_cPt:
1668 return Hexagon::STrid_cNotPt;
1669 case Hexagon::STrid_cNotPt:
1670 return Hexagon::STrid_cPt;
1672 case Hexagon::STrid_indexed_cPt:
1673 return Hexagon::STrid_indexed_cNotPt;
1674 case Hexagon::STrid_indexed_cNotPt:
1675 return Hexagon::STrid_indexed_cPt;
1677 case Hexagon::STrid_indexed_shl_cPt_V4:
1678 return Hexagon::STrid_indexed_shl_cNotPt_V4;
1679 case Hexagon::STrid_indexed_shl_cNotPt_V4:
1680 return Hexagon::STrid_indexed_shl_cPt_V4;
1682 // V4 Store to global address.
1683 case Hexagon::STd_GP_cPt_V4:
1684 return Hexagon::STd_GP_cNotPt_V4;
1685 case Hexagon::STd_GP_cNotPt_V4:
1686 return Hexagon::STd_GP_cPt_V4;
1688 case Hexagon::STb_GP_cPt_V4:
1689 return Hexagon::STb_GP_cNotPt_V4;
1690 case Hexagon::STb_GP_cNotPt_V4:
1691 return Hexagon::STb_GP_cPt_V4;
1693 case Hexagon::STh_GP_cPt_V4:
1694 return Hexagon::STh_GP_cNotPt_V4;
1695 case Hexagon::STh_GP_cNotPt_V4:
1696 return Hexagon::STh_GP_cPt_V4;
1698 case Hexagon::STw_GP_cPt_V4:
1699 return Hexagon::STw_GP_cNotPt_V4;
1700 case Hexagon::STw_GP_cNotPt_V4:
1701 return Hexagon::STw_GP_cPt_V4;
1703 case Hexagon::STrid_GP_cPt_V4:
1704 return Hexagon::STrid_GP_cNotPt_V4;
1705 case Hexagon::STrid_GP_cNotPt_V4:
1706 return Hexagon::STrid_GP_cPt_V4;
1708 case Hexagon::STrib_GP_cPt_V4:
1709 return Hexagon::STrib_GP_cNotPt_V4;
1710 case Hexagon::STrib_GP_cNotPt_V4:
1711 return Hexagon::STrib_GP_cPt_V4;
1713 case Hexagon::STrih_GP_cPt_V4:
1714 return Hexagon::STrih_GP_cNotPt_V4;
1715 case Hexagon::STrih_GP_cNotPt_V4:
1716 return Hexagon::STrih_GP_cPt_V4;
1718 case Hexagon::STriw_GP_cPt_V4:
1719 return Hexagon::STriw_GP_cNotPt_V4;
1720 case Hexagon::STriw_GP_cNotPt_V4:
1721 return Hexagon::STriw_GP_cPt_V4;
1724 case Hexagon::LDrid_cPt:
1725 return Hexagon::LDrid_cNotPt;
1726 case Hexagon::LDrid_cNotPt:
1727 return Hexagon::LDrid_cPt;
1729 case Hexagon::LDriw_cPt:
1730 return Hexagon::LDriw_cNotPt;
1731 case Hexagon::LDriw_cNotPt:
1732 return Hexagon::LDriw_cPt;
1734 case Hexagon::LDrih_cPt:
1735 return Hexagon::LDrih_cNotPt;
1736 case Hexagon::LDrih_cNotPt:
1737 return Hexagon::LDrih_cPt;
1739 case Hexagon::LDriuh_cPt:
1740 return Hexagon::LDriuh_cNotPt;
1741 case Hexagon::LDriuh_cNotPt:
1742 return Hexagon::LDriuh_cPt;
1744 case Hexagon::LDrib_cPt:
1745 return Hexagon::LDrib_cNotPt;
1746 case Hexagon::LDrib_cNotPt:
1747 return Hexagon::LDrib_cPt;
1749 case Hexagon::LDriub_cPt:
1750 return Hexagon::LDriub_cNotPt;
1751 case Hexagon::LDriub_cNotPt:
1752 return Hexagon::LDriub_cPt;
1755 case Hexagon::LDrid_indexed_cPt:
1756 return Hexagon::LDrid_indexed_cNotPt;
1757 case Hexagon::LDrid_indexed_cNotPt:
1758 return Hexagon::LDrid_indexed_cPt;
1760 case Hexagon::LDriw_indexed_cPt:
1761 return Hexagon::LDriw_indexed_cNotPt;
1762 case Hexagon::LDriw_indexed_cNotPt:
1763 return Hexagon::LDriw_indexed_cPt;
1765 case Hexagon::LDrih_indexed_cPt:
1766 return Hexagon::LDrih_indexed_cNotPt;
1767 case Hexagon::LDrih_indexed_cNotPt:
1768 return Hexagon::LDrih_indexed_cPt;
1770 case Hexagon::LDriuh_indexed_cPt:
1771 return Hexagon::LDriuh_indexed_cNotPt;
1772 case Hexagon::LDriuh_indexed_cNotPt:
1773 return Hexagon::LDriuh_indexed_cPt;
1775 case Hexagon::LDrib_indexed_cPt:
1776 return Hexagon::LDrib_indexed_cNotPt;
1777 case Hexagon::LDrib_indexed_cNotPt:
1778 return Hexagon::LDrib_indexed_cPt;
1780 case Hexagon::LDriub_indexed_cPt:
1781 return Hexagon::LDriub_indexed_cNotPt;
1782 case Hexagon::LDriub_indexed_cNotPt:
1783 return Hexagon::LDriub_indexed_cPt;
1786 case Hexagon::POST_LDrid_cPt:
1787 return Hexagon::POST_LDrid_cNotPt;
1788 case Hexagon::POST_LDriw_cNotPt:
1789 return Hexagon::POST_LDriw_cPt;
1791 case Hexagon::POST_LDrih_cPt:
1792 return Hexagon::POST_LDrih_cNotPt;
1793 case Hexagon::POST_LDrih_cNotPt:
1794 return Hexagon::POST_LDrih_cPt;
1796 case Hexagon::POST_LDriuh_cPt:
1797 return Hexagon::POST_LDriuh_cNotPt;
1798 case Hexagon::POST_LDriuh_cNotPt:
1799 return Hexagon::POST_LDriuh_cPt;
1801 case Hexagon::POST_LDrib_cPt:
1802 return Hexagon::POST_LDrib_cNotPt;
1803 case Hexagon::POST_LDrib_cNotPt:
1804 return Hexagon::POST_LDrib_cPt;
1806 case Hexagon::POST_LDriub_cPt:
1807 return Hexagon::POST_LDriub_cNotPt;
1808 case Hexagon::POST_LDriub_cNotPt:
1809 return Hexagon::POST_LDriub_cPt;
1812 case Hexagon::DEALLOC_RET_cPt_V4:
1813 return Hexagon::DEALLOC_RET_cNotPt_V4;
1814 case Hexagon::DEALLOC_RET_cNotPt_V4:
1815 return Hexagon::DEALLOC_RET_cPt_V4;
1818 // JMPEQ_ri - with -1.
1819 case Hexagon::JMP_EQriPtneg_nv_V4:
1820 return Hexagon::JMP_EQriNotPtneg_nv_V4;
1821 case Hexagon::JMP_EQriNotPtneg_nv_V4:
1822 return Hexagon::JMP_EQriPtneg_nv_V4;
1824 case Hexagon::JMP_EQriPntneg_nv_V4:
1825 return Hexagon::JMP_EQriNotPntneg_nv_V4;
1826 case Hexagon::JMP_EQriNotPntneg_nv_V4:
1827 return Hexagon::JMP_EQriPntneg_nv_V4;
1830 case Hexagon::JMP_EQriPt_nv_V4:
1831 return Hexagon::JMP_EQriNotPt_nv_V4;
1832 case Hexagon::JMP_EQriNotPt_nv_V4:
1833 return Hexagon::JMP_EQriPt_nv_V4;
1835 case Hexagon::JMP_EQriPnt_nv_V4:
1836 return Hexagon::JMP_EQriNotPnt_nv_V4;
1837 case Hexagon::JMP_EQriNotPnt_nv_V4:
1838 return Hexagon::JMP_EQriPnt_nv_V4;
1841 case Hexagon::JMP_EQrrPt_nv_V4:
1842 return Hexagon::JMP_EQrrNotPt_nv_V4;
1843 case Hexagon::JMP_EQrrNotPt_nv_V4:
1844 return Hexagon::JMP_EQrrPt_nv_V4;
1846 case Hexagon::JMP_EQrrPnt_nv_V4:
1847 return Hexagon::JMP_EQrrNotPnt_nv_V4;
1848 case Hexagon::JMP_EQrrNotPnt_nv_V4:
1849 return Hexagon::JMP_EQrrPnt_nv_V4;
1851 // JMPGT_ri - with -1.
1852 case Hexagon::JMP_GTriPtneg_nv_V4:
1853 return Hexagon::JMP_GTriNotPtneg_nv_V4;
1854 case Hexagon::JMP_GTriNotPtneg_nv_V4:
1855 return Hexagon::JMP_GTriPtneg_nv_V4;
1857 case Hexagon::JMP_GTriPntneg_nv_V4:
1858 return Hexagon::JMP_GTriNotPntneg_nv_V4;
1859 case Hexagon::JMP_GTriNotPntneg_nv_V4:
1860 return Hexagon::JMP_GTriPntneg_nv_V4;
1863 case Hexagon::JMP_GTriPt_nv_V4:
1864 return Hexagon::JMP_GTriNotPt_nv_V4;
1865 case Hexagon::JMP_GTriNotPt_nv_V4:
1866 return Hexagon::JMP_GTriPt_nv_V4;
1868 case Hexagon::JMP_GTriPnt_nv_V4:
1869 return Hexagon::JMP_GTriNotPnt_nv_V4;
1870 case Hexagon::JMP_GTriNotPnt_nv_V4:
1871 return Hexagon::JMP_GTriPnt_nv_V4;
1874 case Hexagon::JMP_GTrrPt_nv_V4:
1875 return Hexagon::JMP_GTrrNotPt_nv_V4;
1876 case Hexagon::JMP_GTrrNotPt_nv_V4:
1877 return Hexagon::JMP_GTrrPt_nv_V4;
1879 case Hexagon::JMP_GTrrPnt_nv_V4:
1880 return Hexagon::JMP_GTrrNotPnt_nv_V4;
1881 case Hexagon::JMP_GTrrNotPnt_nv_V4:
1882 return Hexagon::JMP_GTrrPnt_nv_V4;
1885 case Hexagon::JMP_GTrrdnPt_nv_V4:
1886 return Hexagon::JMP_GTrrdnNotPt_nv_V4;
1887 case Hexagon::JMP_GTrrdnNotPt_nv_V4:
1888 return Hexagon::JMP_GTrrdnPt_nv_V4;
1890 case Hexagon::JMP_GTrrdnPnt_nv_V4:
1891 return Hexagon::JMP_GTrrdnNotPnt_nv_V4;
1892 case Hexagon::JMP_GTrrdnNotPnt_nv_V4:
1893 return Hexagon::JMP_GTrrdnPnt_nv_V4;
1896 case Hexagon::JMP_GTUriPt_nv_V4:
1897 return Hexagon::JMP_GTUriNotPt_nv_V4;
1898 case Hexagon::JMP_GTUriNotPt_nv_V4:
1899 return Hexagon::JMP_GTUriPt_nv_V4;
1901 case Hexagon::JMP_GTUriPnt_nv_V4:
1902 return Hexagon::JMP_GTUriNotPnt_nv_V4;
1903 case Hexagon::JMP_GTUriNotPnt_nv_V4:
1904 return Hexagon::JMP_GTUriPnt_nv_V4;
1907 case Hexagon::JMP_GTUrrPt_nv_V4:
1908 return Hexagon::JMP_GTUrrNotPt_nv_V4;
1909 case Hexagon::JMP_GTUrrNotPt_nv_V4:
1910 return Hexagon::JMP_GTUrrPt_nv_V4;
1912 case Hexagon::JMP_GTUrrPnt_nv_V4:
1913 return Hexagon::JMP_GTUrrNotPnt_nv_V4;
1914 case Hexagon::JMP_GTUrrNotPnt_nv_V4:
1915 return Hexagon::JMP_GTUrrPnt_nv_V4;
1918 case Hexagon::JMP_GTUrrdnPt_nv_V4:
1919 return Hexagon::JMP_GTUrrdnNotPt_nv_V4;
1920 case Hexagon::JMP_GTUrrdnNotPt_nv_V4:
1921 return Hexagon::JMP_GTUrrdnPt_nv_V4;
1923 case Hexagon::JMP_GTUrrdnPnt_nv_V4:
1924 return Hexagon::JMP_GTUrrdnNotPnt_nv_V4;
1925 case Hexagon::JMP_GTUrrdnNotPnt_nv_V4:
1926 return Hexagon::JMP_GTUrrdnPnt_nv_V4;
1931 int HexagonInstrInfo::
1932 getMatchingCondBranchOpcode(int Opc, bool invertPredicate) const {
1935 return !invertPredicate ? Hexagon::TFR_cPt :
1936 Hexagon::TFR_cNotPt;
1937 case Hexagon::TFRI_f:
1938 return !invertPredicate ? Hexagon::TFRI_cPt_f :
1939 Hexagon::TFRI_cNotPt_f;
1941 return !invertPredicate ? Hexagon::TFRI_cPt :
1942 Hexagon::TFRI_cNotPt;
1944 return !invertPredicate ? Hexagon::JMP_c :
1946 case Hexagon::JMP_EQrrPt_nv_V4:
1947 return !invertPredicate ? Hexagon::JMP_EQrrPt_nv_V4 :
1948 Hexagon::JMP_EQrrNotPt_nv_V4;
1949 case Hexagon::JMP_EQriPt_nv_V4:
1950 return !invertPredicate ? Hexagon::JMP_EQriPt_nv_V4 :
1951 Hexagon::JMP_EQriNotPt_nv_V4;
1952 case Hexagon::ADD_ri:
1953 return !invertPredicate ? Hexagon::ADD_ri_cPt :
1954 Hexagon::ADD_ri_cNotPt;
1955 case Hexagon::ADD_rr:
1956 return !invertPredicate ? Hexagon::ADD_rr_cPt :
1957 Hexagon::ADD_rr_cNotPt;
1958 case Hexagon::XOR_rr:
1959 return !invertPredicate ? Hexagon::XOR_rr_cPt :
1960 Hexagon::XOR_rr_cNotPt;
1961 case Hexagon::AND_rr:
1962 return !invertPredicate ? Hexagon::AND_rr_cPt :
1963 Hexagon::AND_rr_cNotPt;
1964 case Hexagon::OR_rr:
1965 return !invertPredicate ? Hexagon::OR_rr_cPt :
1966 Hexagon::OR_rr_cNotPt;
1967 case Hexagon::SUB_rr:
1968 return !invertPredicate ? Hexagon::SUB_rr_cPt :
1969 Hexagon::SUB_rr_cNotPt;
1970 case Hexagon::COMBINE_rr:
1971 return !invertPredicate ? Hexagon::COMBINE_rr_cPt :
1972 Hexagon::COMBINE_rr_cNotPt;
1974 return !invertPredicate ? Hexagon::ASLH_cPt_V4 :
1975 Hexagon::ASLH_cNotPt_V4;
1977 return !invertPredicate ? Hexagon::ASRH_cPt_V4 :
1978 Hexagon::ASRH_cNotPt_V4;
1980 return !invertPredicate ? Hexagon::SXTB_cPt_V4 :
1981 Hexagon::SXTB_cNotPt_V4;
1983 return !invertPredicate ? Hexagon::SXTH_cPt_V4 :
1984 Hexagon::SXTH_cNotPt_V4;
1986 return !invertPredicate ? Hexagon::ZXTB_cPt_V4 :
1987 Hexagon::ZXTB_cNotPt_V4;
1989 return !invertPredicate ? Hexagon::ZXTH_cPt_V4 :
1990 Hexagon::ZXTH_cNotPt_V4;
1993 return !invertPredicate ? Hexagon::JMPR_cPt :
1994 Hexagon::JMPR_cNotPt;
1996 // V4 indexed+scaled load.
1997 case Hexagon::LDrid_indexed_V4:
1998 return !invertPredicate ? Hexagon::LDrid_indexed_cPt_V4 :
1999 Hexagon::LDrid_indexed_cNotPt_V4;
2000 case Hexagon::LDrid_indexed_shl_V4:
2001 return !invertPredicate ? Hexagon::LDrid_indexed_shl_cPt_V4 :
2002 Hexagon::LDrid_indexed_shl_cNotPt_V4;
2003 case Hexagon::LDrib_indexed_V4:
2004 return !invertPredicate ? Hexagon::LDrib_indexed_cPt_V4 :
2005 Hexagon::LDrib_indexed_cNotPt_V4;
2006 case Hexagon::LDriub_indexed_V4:
2007 return !invertPredicate ? Hexagon::LDriub_indexed_cPt_V4 :
2008 Hexagon::LDriub_indexed_cNotPt_V4;
2009 case Hexagon::LDriub_ae_indexed_V4:
2010 return !invertPredicate ? Hexagon::LDriub_indexed_cPt_V4 :
2011 Hexagon::LDriub_indexed_cNotPt_V4;
2012 case Hexagon::LDrib_indexed_shl_V4:
2013 return !invertPredicate ? Hexagon::LDrib_indexed_shl_cPt_V4 :
2014 Hexagon::LDrib_indexed_shl_cNotPt_V4;
2015 case Hexagon::LDriub_indexed_shl_V4:
2016 return !invertPredicate ? Hexagon::LDriub_indexed_shl_cPt_V4 :
2017 Hexagon::LDriub_indexed_shl_cNotPt_V4;
2018 case Hexagon::LDriub_ae_indexed_shl_V4:
2019 return !invertPredicate ? Hexagon::LDriub_indexed_shl_cPt_V4 :
2020 Hexagon::LDriub_indexed_shl_cNotPt_V4;
2021 case Hexagon::LDrih_indexed_V4:
2022 return !invertPredicate ? Hexagon::LDrih_indexed_cPt_V4 :
2023 Hexagon::LDrih_indexed_cNotPt_V4;
2024 case Hexagon::LDriuh_indexed_V4:
2025 return !invertPredicate ? Hexagon::LDriuh_indexed_cPt_V4 :
2026 Hexagon::LDriuh_indexed_cNotPt_V4;
2027 case Hexagon::LDriuh_ae_indexed_V4:
2028 return !invertPredicate ? Hexagon::LDriuh_indexed_cPt_V4 :
2029 Hexagon::LDriuh_indexed_cNotPt_V4;
2030 case Hexagon::LDrih_indexed_shl_V4:
2031 return !invertPredicate ? Hexagon::LDrih_indexed_shl_cPt_V4 :
2032 Hexagon::LDrih_indexed_shl_cNotPt_V4;
2033 case Hexagon::LDriuh_indexed_shl_V4:
2034 return !invertPredicate ? Hexagon::LDriuh_indexed_shl_cPt_V4 :
2035 Hexagon::LDriuh_indexed_shl_cNotPt_V4;
2036 case Hexagon::LDriuh_ae_indexed_shl_V4:
2037 return !invertPredicate ? Hexagon::LDriuh_indexed_shl_cPt_V4 :
2038 Hexagon::LDriuh_indexed_shl_cNotPt_V4;
2039 case Hexagon::LDriw_indexed_V4:
2040 return !invertPredicate ? Hexagon::LDriw_indexed_cPt_V4 :
2041 Hexagon::LDriw_indexed_cNotPt_V4;
2042 case Hexagon::LDriw_indexed_shl_V4:
2043 return !invertPredicate ? Hexagon::LDriw_indexed_shl_cPt_V4 :
2044 Hexagon::LDriw_indexed_shl_cNotPt_V4;
2046 // V4 Load from global address
2047 case Hexagon::LDrid_GP_V4:
2048 return !invertPredicate ? Hexagon::LDrid_GP_cPt_V4 :
2049 Hexagon::LDrid_GP_cNotPt_V4;
2050 case Hexagon::LDrib_GP_V4:
2051 return !invertPredicate ? Hexagon::LDrib_GP_cPt_V4 :
2052 Hexagon::LDrib_GP_cNotPt_V4;
2053 case Hexagon::LDriub_GP_V4:
2054 return !invertPredicate ? Hexagon::LDriub_GP_cPt_V4 :
2055 Hexagon::LDriub_GP_cNotPt_V4;
2056 case Hexagon::LDrih_GP_V4:
2057 return !invertPredicate ? Hexagon::LDrih_GP_cPt_V4 :
2058 Hexagon::LDrih_GP_cNotPt_V4;
2059 case Hexagon::LDriuh_GP_V4:
2060 return !invertPredicate ? Hexagon::LDriuh_GP_cPt_V4 :
2061 Hexagon::LDriuh_GP_cNotPt_V4;
2062 case Hexagon::LDriw_GP_V4:
2063 return !invertPredicate ? Hexagon::LDriw_GP_cPt_V4 :
2064 Hexagon::LDriw_GP_cNotPt_V4;
2066 case Hexagon::LDd_GP_V4:
2067 return !invertPredicate ? Hexagon::LDd_GP_cPt_V4 :
2068 Hexagon::LDd_GP_cNotPt_V4;
2069 case Hexagon::LDb_GP_V4:
2070 return !invertPredicate ? Hexagon::LDb_GP_cPt_V4 :
2071 Hexagon::LDb_GP_cNotPt_V4;
2072 case Hexagon::LDub_GP_V4:
2073 return !invertPredicate ? Hexagon::LDub_GP_cPt_V4 :
2074 Hexagon::LDub_GP_cNotPt_V4;
2075 case Hexagon::LDh_GP_V4:
2076 return !invertPredicate ? Hexagon::LDh_GP_cPt_V4 :
2077 Hexagon::LDh_GP_cNotPt_V4;
2078 case Hexagon::LDuh_GP_V4:
2079 return !invertPredicate ? Hexagon::LDuh_GP_cPt_V4 :
2080 Hexagon::LDuh_GP_cNotPt_V4;
2081 case Hexagon::LDw_GP_V4:
2082 return !invertPredicate ? Hexagon::LDw_GP_cPt_V4 :
2083 Hexagon::LDw_GP_cNotPt_V4;
2086 case Hexagon::POST_STbri:
2087 return !invertPredicate ? Hexagon::POST_STbri_cPt :
2088 Hexagon::POST_STbri_cNotPt;
2089 case Hexagon::STrib:
2090 return !invertPredicate ? Hexagon::STrib_cPt :
2091 Hexagon::STrib_cNotPt;
2092 case Hexagon::STrib_indexed:
2093 return !invertPredicate ? Hexagon::STrib_indexed_cPt :
2094 Hexagon::STrib_indexed_cNotPt;
2095 case Hexagon::STrib_imm_V4:
2096 return !invertPredicate ? Hexagon::STrib_imm_cPt_V4 :
2097 Hexagon::STrib_imm_cNotPt_V4;
2098 case Hexagon::STrib_indexed_shl_V4:
2099 return !invertPredicate ? Hexagon::STrib_indexed_shl_cPt_V4 :
2100 Hexagon::STrib_indexed_shl_cNotPt_V4;
2102 case Hexagon::POST_SThri:
2103 return !invertPredicate ? Hexagon::POST_SThri_cPt :
2104 Hexagon::POST_SThri_cNotPt;
2105 case Hexagon::STrih:
2106 return !invertPredicate ? Hexagon::STrih_cPt :
2107 Hexagon::STrih_cNotPt;
2108 case Hexagon::STrih_indexed:
2109 return !invertPredicate ? Hexagon::STrih_indexed_cPt :
2110 Hexagon::STrih_indexed_cNotPt;
2111 case Hexagon::STrih_imm_V4:
2112 return !invertPredicate ? Hexagon::STrih_imm_cPt_V4 :
2113 Hexagon::STrih_imm_cNotPt_V4;
2114 case Hexagon::STrih_indexed_shl_V4:
2115 return !invertPredicate ? Hexagon::STrih_indexed_shl_cPt_V4 :
2116 Hexagon::STrih_indexed_shl_cNotPt_V4;
2118 case Hexagon::POST_STwri:
2119 return !invertPredicate ? Hexagon::POST_STwri_cPt :
2120 Hexagon::POST_STwri_cNotPt;
2121 case Hexagon::STriw:
2122 return !invertPredicate ? Hexagon::STriw_cPt :
2123 Hexagon::STriw_cNotPt;
2124 case Hexagon::STriw_indexed:
2125 return !invertPredicate ? Hexagon::STriw_indexed_cPt :
2126 Hexagon::STriw_indexed_cNotPt;
2127 case Hexagon::STriw_indexed_shl_V4:
2128 return !invertPredicate ? Hexagon::STriw_indexed_shl_cPt_V4 :
2129 Hexagon::STriw_indexed_shl_cNotPt_V4;
2130 case Hexagon::STriw_imm_V4:
2131 return !invertPredicate ? Hexagon::STriw_imm_cPt_V4 :
2132 Hexagon::STriw_imm_cNotPt_V4;
2134 case Hexagon::POST_STdri:
2135 return !invertPredicate ? Hexagon::POST_STdri_cPt :
2136 Hexagon::POST_STdri_cNotPt;
2137 case Hexagon::STrid:
2138 return !invertPredicate ? Hexagon::STrid_cPt :
2139 Hexagon::STrid_cNotPt;
2140 case Hexagon::STrid_indexed:
2141 return !invertPredicate ? Hexagon::STrid_indexed_cPt :
2142 Hexagon::STrid_indexed_cNotPt;
2143 case Hexagon::STrid_indexed_shl_V4:
2144 return !invertPredicate ? Hexagon::STrid_indexed_shl_cPt_V4 :
2145 Hexagon::STrid_indexed_shl_cNotPt_V4;
2147 // V4 Store to global address
2148 case Hexagon::STrid_GP_V4:
2149 return !invertPredicate ? Hexagon::STrid_GP_cPt_V4 :
2150 Hexagon::STrid_GP_cNotPt_V4;
2151 case Hexagon::STrib_GP_V4:
2152 return !invertPredicate ? Hexagon::STrib_GP_cPt_V4 :
2153 Hexagon::STrib_GP_cNotPt_V4;
2154 case Hexagon::STrih_GP_V4:
2155 return !invertPredicate ? Hexagon::STrih_GP_cPt_V4 :
2156 Hexagon::STrih_GP_cNotPt_V4;
2157 case Hexagon::STriw_GP_V4:
2158 return !invertPredicate ? Hexagon::STriw_GP_cPt_V4 :
2159 Hexagon::STriw_GP_cNotPt_V4;
2161 case Hexagon::STd_GP_V4:
2162 return !invertPredicate ? Hexagon::STd_GP_cPt_V4 :
2163 Hexagon::STd_GP_cNotPt_V4;
2164 case Hexagon::STb_GP_V4:
2165 return !invertPredicate ? Hexagon::STb_GP_cPt_V4 :
2166 Hexagon::STb_GP_cNotPt_V4;
2167 case Hexagon::STh_GP_V4:
2168 return !invertPredicate ? Hexagon::STh_GP_cPt_V4 :
2169 Hexagon::STh_GP_cNotPt_V4;
2170 case Hexagon::STw_GP_V4:
2171 return !invertPredicate ? Hexagon::STw_GP_cPt_V4 :
2172 Hexagon::STw_GP_cNotPt_V4;
2175 case Hexagon::LDrid:
2176 return !invertPredicate ? Hexagon::LDrid_cPt :
2177 Hexagon::LDrid_cNotPt;
2178 case Hexagon::LDriw:
2179 return !invertPredicate ? Hexagon::LDriw_cPt :
2180 Hexagon::LDriw_cNotPt;
2181 case Hexagon::LDrih:
2182 return !invertPredicate ? Hexagon::LDrih_cPt :
2183 Hexagon::LDrih_cNotPt;
2184 case Hexagon::LDriuh:
2185 return !invertPredicate ? Hexagon::LDriuh_cPt :
2186 Hexagon::LDriuh_cNotPt;
2187 case Hexagon::LDrib:
2188 return !invertPredicate ? Hexagon::LDrib_cPt :
2189 Hexagon::LDrib_cNotPt;
2190 case Hexagon::LDriub:
2191 return !invertPredicate ? Hexagon::LDriub_cPt :
2192 Hexagon::LDriub_cNotPt;
2194 case Hexagon::LDrid_indexed:
2195 return !invertPredicate ? Hexagon::LDrid_indexed_cPt :
2196 Hexagon::LDrid_indexed_cNotPt;
2197 case Hexagon::LDriw_indexed:
2198 return !invertPredicate ? Hexagon::LDriw_indexed_cPt :
2199 Hexagon::LDriw_indexed_cNotPt;
2200 case Hexagon::LDrih_indexed:
2201 return !invertPredicate ? Hexagon::LDrih_indexed_cPt :
2202 Hexagon::LDrih_indexed_cNotPt;
2203 case Hexagon::LDriuh_indexed:
2204 return !invertPredicate ? Hexagon::LDriuh_indexed_cPt :
2205 Hexagon::LDriuh_indexed_cNotPt;
2206 case Hexagon::LDrib_indexed:
2207 return !invertPredicate ? Hexagon::LDrib_indexed_cPt :
2208 Hexagon::LDrib_indexed_cNotPt;
2209 case Hexagon::LDriub_indexed:
2210 return !invertPredicate ? Hexagon::LDriub_indexed_cPt :
2211 Hexagon::LDriub_indexed_cNotPt;
2212 // Post Increment Load.
2213 case Hexagon::POST_LDrid:
2214 return !invertPredicate ? Hexagon::POST_LDrid_cPt :
2215 Hexagon::POST_LDrid_cNotPt;
2216 case Hexagon::POST_LDriw:
2217 return !invertPredicate ? Hexagon::POST_LDriw_cPt :
2218 Hexagon::POST_LDriw_cNotPt;
2219 case Hexagon::POST_LDrih:
2220 return !invertPredicate ? Hexagon::POST_LDrih_cPt :
2221 Hexagon::POST_LDrih_cNotPt;
2222 case Hexagon::POST_LDriuh:
2223 return !invertPredicate ? Hexagon::POST_LDriuh_cPt :
2224 Hexagon::POST_LDriuh_cNotPt;
2225 case Hexagon::POST_LDrib:
2226 return !invertPredicate ? Hexagon::POST_LDrib_cPt :
2227 Hexagon::POST_LDrib_cNotPt;
2228 case Hexagon::POST_LDriub:
2229 return !invertPredicate ? Hexagon::POST_LDriub_cPt :
2230 Hexagon::POST_LDriub_cNotPt;
2232 case Hexagon::DEALLOC_RET_V4:
2233 return !invertPredicate ? Hexagon::DEALLOC_RET_cPt_V4 :
2234 Hexagon::DEALLOC_RET_cNotPt_V4;
2236 // Load Absolute Addressing -- global address.
2237 case Hexagon::LDrib_abs_V4:
2238 return !invertPredicate ? Hexagon::LDrib_abs_cPt_V4 :
2239 Hexagon::LDrib_abs_cNotPt_V4;
2240 case Hexagon::LDriub_abs_V4:
2241 return !invertPredicate ? Hexagon::LDriub_abs_cPt_V4 :
2242 Hexagon::LDriub_abs_cNotPt_V4;
2243 case Hexagon::LDrih_abs_V4:
2244 return !invertPredicate ? Hexagon::LDrih_abs_cPt_V4 :
2245 Hexagon::LDrih_abs_cNotPt_V4;
2246 case Hexagon::LDriuh_abs_V4:
2247 return !invertPredicate ? Hexagon::LDriuh_abs_cPt_V4 :
2248 Hexagon::LDriuh_abs_cNotPt_V4;
2249 case Hexagon::LDriw_abs_V4:
2250 return !invertPredicate ? Hexagon::LDriw_abs_cPt_V4 :
2251 Hexagon::LDriw_abs_cNotPt_V4;
2252 case Hexagon::LDrid_abs_V4:
2253 return !invertPredicate ? Hexagon::LDrid_abs_cPt_V4 :
2254 Hexagon::LDrid_abs_cNotPt_V4;
2256 // Load Absolute Addressing -- immediate value.
2257 case Hexagon::LDrib_imm_abs_V4:
2258 return !invertPredicate ? Hexagon::LDrib_imm_abs_cPt_V4 :
2259 Hexagon::LDrib_imm_abs_cNotPt_V4;
2260 case Hexagon::LDriub_imm_abs_V4:
2261 return !invertPredicate ? Hexagon::LDriub_imm_abs_cPt_V4 :
2262 Hexagon::LDriub_imm_abs_cNotPt_V4;
2263 case Hexagon::LDrih_imm_abs_V4:
2264 return !invertPredicate ? Hexagon::LDrih_imm_abs_cPt_V4 :
2265 Hexagon::LDrih_imm_abs_cNotPt_V4;
2266 case Hexagon::LDriuh_imm_abs_V4:
2267 return !invertPredicate ? Hexagon::LDriuh_imm_abs_cPt_V4 :
2268 Hexagon::LDriuh_imm_abs_cNotPt_V4;
2269 case Hexagon::LDriw_imm_abs_V4:
2270 return !invertPredicate ? Hexagon::LDriw_imm_abs_cPt_V4 :
2271 Hexagon::LDriw_imm_abs_cNotPt_V4;
2273 // Store Absolute Addressing.
2274 case Hexagon::STrib_abs_V4:
2275 return !invertPredicate ? Hexagon::STrib_abs_cPt_V4 :
2276 Hexagon::STrib_abs_cNotPt_V4;
2277 case Hexagon::STrih_abs_V4:
2278 return !invertPredicate ? Hexagon::STrih_abs_cPt_V4 :
2279 Hexagon::STrih_abs_cNotPt_V4;
2280 case Hexagon::STriw_abs_V4:
2281 return !invertPredicate ? Hexagon::STriw_abs_cPt_V4 :
2282 Hexagon::STriw_abs_cNotPt_V4;
2283 case Hexagon::STrid_abs_V4:
2284 return !invertPredicate ? Hexagon::STrid_abs_cPt_V4 :
2285 Hexagon::STrid_abs_cNotPt_V4;
2287 // Store Absolute Addressing - global address.
2288 case Hexagon::STrib_imm_abs_V4:
2289 return !invertPredicate ? Hexagon::STrib_imm_abs_cPt_V4 :
2290 Hexagon::STrib_imm_abs_cNotPt_V4;
2291 case Hexagon::STrih_imm_abs_V4:
2292 return !invertPredicate ? Hexagon::STrih_imm_abs_cPt_V4 :
2293 Hexagon::STrih_imm_abs_cNotPt_V4;
2294 case Hexagon::STriw_imm_abs_V4:
2295 return !invertPredicate ? Hexagon::STriw_imm_abs_cPt_V4 :
2296 Hexagon::STriw_imm_abs_cNotPt_V4;
2299 case Hexagon::TFRI_V4:
2300 return !invertPredicate ? Hexagon::TFRI_cPt_V4 :
2301 Hexagon::TFRI_cNotPt_V4;
2303 llvm_unreachable("Unexpected predicable instruction");
2307 bool HexagonInstrInfo::
2308 PredicateInstruction(MachineInstr *MI,
2309 const SmallVectorImpl<MachineOperand> &Cond) const {
2310 int Opc = MI->getOpcode();
2311 assert (isPredicable(MI) && "Expected predicable instruction");
2312 bool invertJump = (!Cond.empty() && Cond[0].isImm() &&
2313 (Cond[0].getImm() == 0));
2314 MI->setDesc(get(getMatchingCondBranchOpcode(Opc, invertJump)));
2316 // This assumes that the predicate is always the first operand
2317 // in the set of inputs.
2319 MI->addOperand(MI->getOperand(MI->getNumOperands()-1));
2321 for (oper = MI->getNumOperands() - 3; oper >= 0; --oper) {
2322 MachineOperand MO = MI->getOperand(oper);
2323 if ((MO.isReg() && !MO.isUse() && !MO.isImplicit())) {
2328 MI->getOperand(oper+1).ChangeToRegister(MO.getReg(), MO.isDef(),
2329 MO.isImplicit(), MO.isKill(),
2330 MO.isDead(), MO.isUndef(),
2332 } else if (MO.isImm()) {
2333 MI->getOperand(oper+1).ChangeToImmediate(MO.getImm());
2335 llvm_unreachable("Unexpected operand type");
2339 int regPos = invertJump ? 1 : 0;
2340 MachineOperand PredMO = Cond[regPos];
2341 MI->getOperand(oper+1).ChangeToRegister(PredMO.getReg(), PredMO.isDef(),
2342 PredMO.isImplicit(), PredMO.isKill(),
2343 PredMO.isDead(), PredMO.isUndef(),
2352 isProfitableToIfCvt(MachineBasicBlock &MBB,
2354 unsigned ExtraPredCycles,
2355 const BranchProbability &Probability) const {
2362 isProfitableToIfCvt(MachineBasicBlock &TMBB,
2363 unsigned NumTCycles,
2364 unsigned ExtraTCycles,
2365 MachineBasicBlock &FMBB,
2366 unsigned NumFCycles,
2367 unsigned ExtraFCycles,
2368 const BranchProbability &Probability) const {
2373 bool HexagonInstrInfo::isPredicated(const MachineInstr *MI) const {
2374 const uint64_t F = MI->getDesc().TSFlags;
2376 return ((F >> HexagonII::PredicatedPos) & HexagonII::PredicatedMask);
2380 HexagonInstrInfo::DefinesPredicate(MachineInstr *MI,
2381 std::vector<MachineOperand> &Pred) const {
2382 for (unsigned oper = 0; oper < MI->getNumOperands(); ++oper) {
2383 MachineOperand MO = MI->getOperand(oper);
2384 if (MO.isReg() && MO.isDef()) {
2385 const TargetRegisterClass* RC = RI.getMinimalPhysRegClass(MO.getReg());
2386 if (RC == &Hexagon::PredRegsRegClass) {
2398 SubsumesPredicate(const SmallVectorImpl<MachineOperand> &Pred1,
2399 const SmallVectorImpl<MachineOperand> &Pred2) const {
2406 // We indicate that we want to reverse the branch by
2407 // inserting a 0 at the beginning of the Cond vector.
2409 bool HexagonInstrInfo::
2410 ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const {
2411 if (!Cond.empty() && Cond[0].isImm() && Cond[0].getImm() == 0) {
2412 Cond.erase(Cond.begin());
2414 Cond.insert(Cond.begin(), MachineOperand::CreateImm(0));
2420 bool HexagonInstrInfo::
2421 isProfitableToDupForIfCvt(MachineBasicBlock &MBB,unsigned NumInstrs,
2422 const BranchProbability &Probability) const {
2423 return (NumInstrs <= 4);
2426 bool HexagonInstrInfo::isDeallocRet(const MachineInstr *MI) const {
2427 switch (MI->getOpcode()) {
2428 default: return false;
2429 case Hexagon::DEALLOC_RET_V4 :
2430 case Hexagon::DEALLOC_RET_cPt_V4 :
2431 case Hexagon::DEALLOC_RET_cNotPt_V4 :
2432 case Hexagon::DEALLOC_RET_cdnPnt_V4 :
2433 case Hexagon::DEALLOC_RET_cNotdnPnt_V4 :
2434 case Hexagon::DEALLOC_RET_cdnPt_V4 :
2435 case Hexagon::DEALLOC_RET_cNotdnPt_V4 :
2441 bool HexagonInstrInfo::
2442 isValidOffset(const int Opcode, const int Offset) const {
2443 // This function is to check whether the "Offset" is in the correct range of
2444 // the given "Opcode". If "Offset" is not in the correct range, "ADD_ri" is
2445 // inserted to calculate the final address. Due to this reason, the function
2446 // assumes that the "Offset" has correct alignment.
2450 case Hexagon::LDriw:
2451 case Hexagon::LDriw_f:
2452 case Hexagon::STriw_indexed:
2453 case Hexagon::STriw:
2454 case Hexagon::STriw_f:
2455 assert((Offset % 4 == 0) && "Offset has incorrect alignment");
2456 return (Offset >= Hexagon_MEMW_OFFSET_MIN) &&
2457 (Offset <= Hexagon_MEMW_OFFSET_MAX);
2459 case Hexagon::LDrid:
2460 case Hexagon::LDrid_f:
2461 case Hexagon::STrid:
2462 case Hexagon::STrid_f:
2463 assert((Offset % 8 == 0) && "Offset has incorrect alignment");
2464 return (Offset >= Hexagon_MEMD_OFFSET_MIN) &&
2465 (Offset <= Hexagon_MEMD_OFFSET_MAX);
2467 case Hexagon::LDrih:
2468 case Hexagon::LDriuh:
2469 case Hexagon::STrih:
2470 assert((Offset % 2 == 0) && "Offset has incorrect alignment");
2471 return (Offset >= Hexagon_MEMH_OFFSET_MIN) &&
2472 (Offset <= Hexagon_MEMH_OFFSET_MAX);
2474 case Hexagon::LDrib:
2475 case Hexagon::STrib:
2476 case Hexagon::LDriub:
2477 return (Offset >= Hexagon_MEMB_OFFSET_MIN) &&
2478 (Offset <= Hexagon_MEMB_OFFSET_MAX);
2480 case Hexagon::ADD_ri:
2481 case Hexagon::TFR_FI:
2482 return (Offset >= Hexagon_ADDI_OFFSET_MIN) &&
2483 (Offset <= Hexagon_ADDI_OFFSET_MAX);
2485 case Hexagon::MEMw_ADDSUBi_indexed_MEM_V4 :
2486 case Hexagon::MEMw_ADDi_indexed_MEM_V4 :
2487 case Hexagon::MEMw_SUBi_indexed_MEM_V4 :
2488 case Hexagon::MEMw_ADDr_indexed_MEM_V4 :
2489 case Hexagon::MEMw_SUBr_indexed_MEM_V4 :
2490 case Hexagon::MEMw_ANDr_indexed_MEM_V4 :
2491 case Hexagon::MEMw_ORr_indexed_MEM_V4 :
2492 case Hexagon::MEMw_ADDSUBi_MEM_V4 :
2493 case Hexagon::MEMw_ADDi_MEM_V4 :
2494 case Hexagon::MEMw_SUBi_MEM_V4 :
2495 case Hexagon::MEMw_ADDr_MEM_V4 :
2496 case Hexagon::MEMw_SUBr_MEM_V4 :
2497 case Hexagon::MEMw_ANDr_MEM_V4 :
2498 case Hexagon::MEMw_ORr_MEM_V4 :
2499 assert ((Offset % 4) == 0 && "MEMOPw offset is not aligned correctly." );
2500 return (0 <= Offset && Offset <= 255);
2502 case Hexagon::MEMh_ADDSUBi_indexed_MEM_V4 :
2503 case Hexagon::MEMh_ADDi_indexed_MEM_V4 :
2504 case Hexagon::MEMh_SUBi_indexed_MEM_V4 :
2505 case Hexagon::MEMh_ADDr_indexed_MEM_V4 :
2506 case Hexagon::MEMh_SUBr_indexed_MEM_V4 :
2507 case Hexagon::MEMh_ANDr_indexed_MEM_V4 :
2508 case Hexagon::MEMh_ORr_indexed_MEM_V4 :
2509 case Hexagon::MEMh_ADDSUBi_MEM_V4 :
2510 case Hexagon::MEMh_ADDi_MEM_V4 :
2511 case Hexagon::MEMh_SUBi_MEM_V4 :
2512 case Hexagon::MEMh_ADDr_MEM_V4 :
2513 case Hexagon::MEMh_SUBr_MEM_V4 :
2514 case Hexagon::MEMh_ANDr_MEM_V4 :
2515 case Hexagon::MEMh_ORr_MEM_V4 :
2516 assert ((Offset % 2) == 0 && "MEMOPh offset is not aligned correctly." );
2517 return (0 <= Offset && Offset <= 127);
2519 case Hexagon::MEMb_ADDSUBi_indexed_MEM_V4 :
2520 case Hexagon::MEMb_ADDi_indexed_MEM_V4 :
2521 case Hexagon::MEMb_SUBi_indexed_MEM_V4 :
2522 case Hexagon::MEMb_ADDr_indexed_MEM_V4 :
2523 case Hexagon::MEMb_SUBr_indexed_MEM_V4 :
2524 case Hexagon::MEMb_ANDr_indexed_MEM_V4 :
2525 case Hexagon::MEMb_ORr_indexed_MEM_V4 :
2526 case Hexagon::MEMb_ADDSUBi_MEM_V4 :
2527 case Hexagon::MEMb_ADDi_MEM_V4 :
2528 case Hexagon::MEMb_SUBi_MEM_V4 :
2529 case Hexagon::MEMb_ADDr_MEM_V4 :
2530 case Hexagon::MEMb_SUBr_MEM_V4 :
2531 case Hexagon::MEMb_ANDr_MEM_V4 :
2532 case Hexagon::MEMb_ORr_MEM_V4 :
2533 return (0 <= Offset && Offset <= 63);
2535 // LDri_pred and STriw_pred are pseudo operations, so it has to take offset of
2536 // any size. Later pass knows how to handle it.
2537 case Hexagon::STriw_pred:
2538 case Hexagon::LDriw_pred:
2541 // INLINEASM is very special.
2542 case Hexagon::INLINEASM:
2546 llvm_unreachable("No offset range is defined for this opcode. "
2547 "Please define it in the above switch statement!");
2552 // Check if the Offset is a valid auto-inc imm by Load/Store Type.
2554 bool HexagonInstrInfo::
2555 isValidAutoIncImm(const EVT VT, const int Offset) const {
2557 if (VT == MVT::i64) {
2558 return (Offset >= Hexagon_MEMD_AUTOINC_MIN &&
2559 Offset <= Hexagon_MEMD_AUTOINC_MAX &&
2560 (Offset & 0x7) == 0);
2562 if (VT == MVT::i32) {
2563 return (Offset >= Hexagon_MEMW_AUTOINC_MIN &&
2564 Offset <= Hexagon_MEMW_AUTOINC_MAX &&
2565 (Offset & 0x3) == 0);
2567 if (VT == MVT::i16) {
2568 return (Offset >= Hexagon_MEMH_AUTOINC_MIN &&
2569 Offset <= Hexagon_MEMH_AUTOINC_MAX &&
2570 (Offset & 0x1) == 0);
2572 if (VT == MVT::i8) {
2573 return (Offset >= Hexagon_MEMB_AUTOINC_MIN &&
2574 Offset <= Hexagon_MEMB_AUTOINC_MAX);
2576 llvm_unreachable("Not an auto-inc opc!");
2580 bool HexagonInstrInfo::
2581 isMemOp(const MachineInstr *MI) const {
2582 switch (MI->getOpcode())
2584 default: return false;
2585 case Hexagon::MEMw_ADDSUBi_indexed_MEM_V4 :
2586 case Hexagon::MEMw_ADDi_indexed_MEM_V4 :
2587 case Hexagon::MEMw_SUBi_indexed_MEM_V4 :
2588 case Hexagon::MEMw_ADDr_indexed_MEM_V4 :
2589 case Hexagon::MEMw_SUBr_indexed_MEM_V4 :
2590 case Hexagon::MEMw_ANDr_indexed_MEM_V4 :
2591 case Hexagon::MEMw_ORr_indexed_MEM_V4 :
2592 case Hexagon::MEMw_ADDSUBi_MEM_V4 :
2593 case Hexagon::MEMw_ADDi_MEM_V4 :
2594 case Hexagon::MEMw_SUBi_MEM_V4 :
2595 case Hexagon::MEMw_ADDr_MEM_V4 :
2596 case Hexagon::MEMw_SUBr_MEM_V4 :
2597 case Hexagon::MEMw_ANDr_MEM_V4 :
2598 case Hexagon::MEMw_ORr_MEM_V4 :
2599 case Hexagon::MEMh_ADDSUBi_indexed_MEM_V4 :
2600 case Hexagon::MEMh_ADDi_indexed_MEM_V4 :
2601 case Hexagon::MEMh_SUBi_indexed_MEM_V4 :
2602 case Hexagon::MEMh_ADDr_indexed_MEM_V4 :
2603 case Hexagon::MEMh_SUBr_indexed_MEM_V4 :
2604 case Hexagon::MEMh_ANDr_indexed_MEM_V4 :
2605 case Hexagon::MEMh_ORr_indexed_MEM_V4 :
2606 case Hexagon::MEMh_ADDSUBi_MEM_V4 :
2607 case Hexagon::MEMh_ADDi_MEM_V4 :
2608 case Hexagon::MEMh_SUBi_MEM_V4 :
2609 case Hexagon::MEMh_ADDr_MEM_V4 :
2610 case Hexagon::MEMh_SUBr_MEM_V4 :
2611 case Hexagon::MEMh_ANDr_MEM_V4 :
2612 case Hexagon::MEMh_ORr_MEM_V4 :
2613 case Hexagon::MEMb_ADDSUBi_indexed_MEM_V4 :
2614 case Hexagon::MEMb_ADDi_indexed_MEM_V4 :
2615 case Hexagon::MEMb_SUBi_indexed_MEM_V4 :
2616 case Hexagon::MEMb_ADDr_indexed_MEM_V4 :
2617 case Hexagon::MEMb_SUBr_indexed_MEM_V4 :
2618 case Hexagon::MEMb_ANDr_indexed_MEM_V4 :
2619 case Hexagon::MEMb_ORr_indexed_MEM_V4 :
2620 case Hexagon::MEMb_ADDSUBi_MEM_V4 :
2621 case Hexagon::MEMb_ADDi_MEM_V4 :
2622 case Hexagon::MEMb_SUBi_MEM_V4 :
2623 case Hexagon::MEMb_ADDr_MEM_V4 :
2624 case Hexagon::MEMb_SUBr_MEM_V4 :
2625 case Hexagon::MEMb_ANDr_MEM_V4 :
2626 case Hexagon::MEMb_ORr_MEM_V4 :
2632 bool HexagonInstrInfo::
2633 isSpillPredRegOp(const MachineInstr *MI) const {
2634 switch (MI->getOpcode()) {
2635 default: return false;
2636 case Hexagon::STriw_pred :
2637 case Hexagon::LDriw_pred :
2642 bool HexagonInstrInfo::isNewValueJumpCandidate(const MachineInstr *MI) const {
2643 switch (MI->getOpcode()) {
2644 default: return false;
2645 case Hexagon::CMPEQrr:
2646 case Hexagon::CMPEQri:
2647 case Hexagon::CMPLTrr:
2648 case Hexagon::CMPGTrr:
2649 case Hexagon::CMPGTri:
2650 case Hexagon::CMPLTUrr:
2651 case Hexagon::CMPGTUrr:
2652 case Hexagon::CMPGTUri:
2653 case Hexagon::CMPGEri:
2654 case Hexagon::CMPGEUri:
2659 bool HexagonInstrInfo::
2660 isConditionalTransfer (const MachineInstr *MI) const {
2661 switch (MI->getOpcode()) {
2662 default: return false;
2663 case Hexagon::TFR_cPt:
2664 case Hexagon::TFR_cNotPt:
2665 case Hexagon::TFRI_cPt:
2666 case Hexagon::TFRI_cNotPt:
2667 case Hexagon::TFR_cdnPt:
2668 case Hexagon::TFR_cdnNotPt:
2669 case Hexagon::TFRI_cdnPt:
2670 case Hexagon::TFRI_cdnNotPt:
2675 bool HexagonInstrInfo::isConditionalALU32 (const MachineInstr* MI) const {
2676 const HexagonRegisterInfo& QRI = getRegisterInfo();
2677 switch (MI->getOpcode())
2679 default: return false;
2680 case Hexagon::ADD_ri_cPt:
2681 case Hexagon::ADD_ri_cNotPt:
2682 case Hexagon::ADD_rr_cPt:
2683 case Hexagon::ADD_rr_cNotPt:
2684 case Hexagon::XOR_rr_cPt:
2685 case Hexagon::XOR_rr_cNotPt:
2686 case Hexagon::AND_rr_cPt:
2687 case Hexagon::AND_rr_cNotPt:
2688 case Hexagon::OR_rr_cPt:
2689 case Hexagon::OR_rr_cNotPt:
2690 case Hexagon::SUB_rr_cPt:
2691 case Hexagon::SUB_rr_cNotPt:
2692 case Hexagon::COMBINE_rr_cPt:
2693 case Hexagon::COMBINE_rr_cNotPt:
2695 case Hexagon::ASLH_cPt_V4:
2696 case Hexagon::ASLH_cNotPt_V4:
2697 case Hexagon::ASRH_cPt_V4:
2698 case Hexagon::ASRH_cNotPt_V4:
2699 case Hexagon::SXTB_cPt_V4:
2700 case Hexagon::SXTB_cNotPt_V4:
2701 case Hexagon::SXTH_cPt_V4:
2702 case Hexagon::SXTH_cNotPt_V4:
2703 case Hexagon::ZXTB_cPt_V4:
2704 case Hexagon::ZXTB_cNotPt_V4:
2705 case Hexagon::ZXTH_cPt_V4:
2706 case Hexagon::ZXTH_cNotPt_V4:
2707 return QRI.Subtarget.hasV4TOps();
2711 bool HexagonInstrInfo::
2712 isConditionalLoad (const MachineInstr* MI) const {
2713 const HexagonRegisterInfo& QRI = getRegisterInfo();
2714 switch (MI->getOpcode())
2716 default: return false;
2717 case Hexagon::LDrid_cPt :
2718 case Hexagon::LDrid_cNotPt :
2719 case Hexagon::LDrid_indexed_cPt :
2720 case Hexagon::LDrid_indexed_cNotPt :
2721 case Hexagon::LDriw_cPt :
2722 case Hexagon::LDriw_cNotPt :
2723 case Hexagon::LDriw_indexed_cPt :
2724 case Hexagon::LDriw_indexed_cNotPt :
2725 case Hexagon::LDrih_cPt :
2726 case Hexagon::LDrih_cNotPt :
2727 case Hexagon::LDrih_indexed_cPt :
2728 case Hexagon::LDrih_indexed_cNotPt :
2729 case Hexagon::LDrib_cPt :
2730 case Hexagon::LDrib_cNotPt :
2731 case Hexagon::LDrib_indexed_cPt :
2732 case Hexagon::LDrib_indexed_cNotPt :
2733 case Hexagon::LDriuh_cPt :
2734 case Hexagon::LDriuh_cNotPt :
2735 case Hexagon::LDriuh_indexed_cPt :
2736 case Hexagon::LDriuh_indexed_cNotPt :
2737 case Hexagon::LDriub_cPt :
2738 case Hexagon::LDriub_cNotPt :
2739 case Hexagon::LDriub_indexed_cPt :
2740 case Hexagon::LDriub_indexed_cNotPt :
2742 case Hexagon::POST_LDrid_cPt :
2743 case Hexagon::POST_LDrid_cNotPt :
2744 case Hexagon::POST_LDriw_cPt :
2745 case Hexagon::POST_LDriw_cNotPt :
2746 case Hexagon::POST_LDrih_cPt :
2747 case Hexagon::POST_LDrih_cNotPt :
2748 case Hexagon::POST_LDrib_cPt :
2749 case Hexagon::POST_LDrib_cNotPt :
2750 case Hexagon::POST_LDriuh_cPt :
2751 case Hexagon::POST_LDriuh_cNotPt :
2752 case Hexagon::POST_LDriub_cPt :
2753 case Hexagon::POST_LDriub_cNotPt :
2754 return QRI.Subtarget.hasV4TOps();
2755 case Hexagon::LDrid_indexed_cPt_V4 :
2756 case Hexagon::LDrid_indexed_cNotPt_V4 :
2757 case Hexagon::LDrid_indexed_shl_cPt_V4 :
2758 case Hexagon::LDrid_indexed_shl_cNotPt_V4 :
2759 case Hexagon::LDrib_indexed_cPt_V4 :
2760 case Hexagon::LDrib_indexed_cNotPt_V4 :
2761 case Hexagon::LDrib_indexed_shl_cPt_V4 :
2762 case Hexagon::LDrib_indexed_shl_cNotPt_V4 :
2763 case Hexagon::LDriub_indexed_cPt_V4 :
2764 case Hexagon::LDriub_indexed_cNotPt_V4 :
2765 case Hexagon::LDriub_indexed_shl_cPt_V4 :
2766 case Hexagon::LDriub_indexed_shl_cNotPt_V4 :
2767 case Hexagon::LDrih_indexed_cPt_V4 :
2768 case Hexagon::LDrih_indexed_cNotPt_V4 :
2769 case Hexagon::LDrih_indexed_shl_cPt_V4 :
2770 case Hexagon::LDrih_indexed_shl_cNotPt_V4 :
2771 case Hexagon::LDriuh_indexed_cPt_V4 :
2772 case Hexagon::LDriuh_indexed_cNotPt_V4 :
2773 case Hexagon::LDriuh_indexed_shl_cPt_V4 :
2774 case Hexagon::LDriuh_indexed_shl_cNotPt_V4 :
2775 case Hexagon::LDriw_indexed_cPt_V4 :
2776 case Hexagon::LDriw_indexed_cNotPt_V4 :
2777 case Hexagon::LDriw_indexed_shl_cPt_V4 :
2778 case Hexagon::LDriw_indexed_shl_cNotPt_V4 :
2779 return QRI.Subtarget.hasV4TOps();
2783 // Returns true if an instruction is a conditional store.
2785 // Note: It doesn't include conditional new-value stores as they can't be
2786 // converted to .new predicate.
2788 // p.new NV store [ if(p0.new)memw(R0+#0)=R2.new ]
2790 // / \ (not OK. it will cause new-value store to be
2791 // / X conditional on p0.new while R2 producer is
2794 // p.new store p.old NV store
2795 // [if(p0.new)memw(R0+#0)=R2] [if(p0)memw(R0+#0)=R2.new]
2801 // [if (p0)memw(R0+#0)=R2]
2803 // The above diagram shows the steps involoved in the conversion of a predicated
2804 // store instruction to its .new predicated new-value form.
2806 // The following set of instructions further explains the scenario where
2807 // conditional new-value store becomes invalid when promoted to .new predicate
2810 // { 1) if (p0) r0 = add(r1, r2)
2811 // 2) p0 = cmp.eq(r3, #0) }
2813 // 3) if (p0) memb(r1+#0) = r0 --> this instruction can't be grouped with
2814 // the first two instructions because in instr 1, r0 is conditional on old value
2815 // of p0 but its use in instr 3 is conditional on p0 modified by instr 2 which
2816 // is not valid for new-value stores.
2817 bool HexagonInstrInfo::
2818 isConditionalStore (const MachineInstr* MI) const {
2819 const HexagonRegisterInfo& QRI = getRegisterInfo();
2820 switch (MI->getOpcode())
2822 default: return false;
2823 case Hexagon::STrib_imm_cPt_V4 :
2824 case Hexagon::STrib_imm_cNotPt_V4 :
2825 case Hexagon::STrib_indexed_shl_cPt_V4 :
2826 case Hexagon::STrib_indexed_shl_cNotPt_V4 :
2827 case Hexagon::STrib_cPt :
2828 case Hexagon::STrib_cNotPt :
2829 case Hexagon::POST_STbri_cPt :
2830 case Hexagon::POST_STbri_cNotPt :
2831 case Hexagon::STrid_indexed_cPt :
2832 case Hexagon::STrid_indexed_cNotPt :
2833 case Hexagon::STrid_indexed_shl_cPt_V4 :
2834 case Hexagon::POST_STdri_cPt :
2835 case Hexagon::POST_STdri_cNotPt :
2836 case Hexagon::STrih_cPt :
2837 case Hexagon::STrih_cNotPt :
2838 case Hexagon::STrih_indexed_cPt :
2839 case Hexagon::STrih_indexed_cNotPt :
2840 case Hexagon::STrih_imm_cPt_V4 :
2841 case Hexagon::STrih_imm_cNotPt_V4 :
2842 case Hexagon::STrih_indexed_shl_cPt_V4 :
2843 case Hexagon::STrih_indexed_shl_cNotPt_V4 :
2844 case Hexagon::POST_SThri_cPt :
2845 case Hexagon::POST_SThri_cNotPt :
2846 case Hexagon::STriw_cPt :
2847 case Hexagon::STriw_cNotPt :
2848 case Hexagon::STriw_indexed_cPt :
2849 case Hexagon::STriw_indexed_cNotPt :
2850 case Hexagon::STriw_imm_cPt_V4 :
2851 case Hexagon::STriw_imm_cNotPt_V4 :
2852 case Hexagon::STriw_indexed_shl_cPt_V4 :
2853 case Hexagon::STriw_indexed_shl_cNotPt_V4 :
2854 case Hexagon::POST_STwri_cPt :
2855 case Hexagon::POST_STwri_cNotPt :
2856 return QRI.Subtarget.hasV4TOps();
2858 // V4 global address store before promoting to dot new.
2859 case Hexagon::STrid_GP_cPt_V4 :
2860 case Hexagon::STrid_GP_cNotPt_V4 :
2861 case Hexagon::STrib_GP_cPt_V4 :
2862 case Hexagon::STrib_GP_cNotPt_V4 :
2863 case Hexagon::STrih_GP_cPt_V4 :
2864 case Hexagon::STrih_GP_cNotPt_V4 :
2865 case Hexagon::STriw_GP_cPt_V4 :
2866 case Hexagon::STriw_GP_cNotPt_V4 :
2867 case Hexagon::STd_GP_cPt_V4 :
2868 case Hexagon::STd_GP_cNotPt_V4 :
2869 case Hexagon::STb_GP_cPt_V4 :
2870 case Hexagon::STb_GP_cNotPt_V4 :
2871 case Hexagon::STh_GP_cPt_V4 :
2872 case Hexagon::STh_GP_cNotPt_V4 :
2873 case Hexagon::STw_GP_cPt_V4 :
2874 case Hexagon::STw_GP_cNotPt_V4 :
2875 return QRI.Subtarget.hasV4TOps();
2877 // Predicated new value stores (i.e. if (p0) memw(..)=r0.new) are excluded
2878 // from the "Conditional Store" list. Because a predicated new value store
2879 // would NOT be promoted to a double dot new store. See diagram below:
2880 // This function returns yes for those stores that are predicated but not
2881 // yet promoted to predicate dot new instructions.
2883 // +---------------------+
2884 // /-----| if (p0) memw(..)=r0 |---------\~
2885 // || +---------------------+ ||
2886 // promote || /\ /\ || promote
2888 // \||/ demote || \||/
2890 // +-------------------------+ || +-------------------------+
2891 // | if (p0.new) memw(..)=r0 | || | if (p0) memw(..)=r0.new |
2892 // +-------------------------+ || +-------------------------+
2895 // promote || \/ NOT possible
2899 // +-----------------------------+
2900 // | if (p0.new) memw(..)=r0.new |
2901 // +-----------------------------+
2902 // Double Dot New Store
2909 DFAPacketizer *HexagonInstrInfo::
2910 CreateTargetScheduleState(const TargetMachine *TM,
2911 const ScheduleDAG *DAG) const {
2912 const InstrItineraryData *II = TM->getInstrItineraryData();
2913 return TM->getSubtarget<HexagonGenSubtargetInfo>().createDFAPacketizer(II);
2916 bool HexagonInstrInfo::isSchedulingBoundary(const MachineInstr *MI,
2917 const MachineBasicBlock *MBB,
2918 const MachineFunction &MF) const {
2919 // Debug info is never a scheduling boundary. It's necessary to be explicit
2920 // due to the special treatment of IT instructions below, otherwise a
2921 // dbg_value followed by an IT will result in the IT instruction being
2922 // considered a scheduling hazard, which is wrong. It should be the actual
2923 // instruction preceding the dbg_value instruction(s), just like it is
2924 // when debug info is not present.
2925 if (MI->isDebugValue())
2928 // Terminators and labels can't be scheduled around.
2929 if (MI->getDesc().isTerminator() || MI->isLabel() || MI->isInlineAsm())
2935 bool HexagonInstrInfo::isExpr(unsigned OpType) const {
2937 case MachineOperand::MO_MachineBasicBlock:
2938 case MachineOperand::MO_GlobalAddress:
2939 case MachineOperand::MO_ExternalSymbol:
2940 case MachineOperand::MO_JumpTableIndex:
2941 case MachineOperand::MO_ConstantPoolIndex:
2942 case MachineOperand::MO_BlockAddress:
2949 bool HexagonInstrInfo::isConstExtended(MachineInstr *MI) const {
2950 unsigned short Opcode = MI->getOpcode();
2951 short ExtOpNum = HexagonConstExt::getCExtOpNum(Opcode);
2953 // Instruction has no constant extended operand.
2958 int MinValue = HexagonConstExt::getMinValue(Opcode);
2959 int MaxValue = HexagonConstExt::getMaxValue(Opcode);
2960 const MachineOperand &MO = MI->getOperand(ExtOpNum);
2961 if (!MO.isImm()) // no range check if the operand is non-immediate.
2964 int ImmValue = MO.getImm();
2965 return (ImmValue < MinValue || ImmValue > MaxValue);
2969 // Returns true if a particular operand is extended for an instruction.
2970 bool HexagonConstExt::isOperandExtended(unsigned short Opcode,
2971 unsigned short OperandNum) {
2972 return HexagonCExt[Opcode].CExtOpNum == OperandNum;
2975 // Returns Operand Index for the constant extended instruction.
2976 unsigned short HexagonConstExt::getCExtOpNum(unsigned short Opcode) {
2977 return HexagonCExt[Opcode].CExtOpNum;
2980 // Returns the min value that doesn't need to be extended.
2981 int HexagonConstExt::getMinValue(unsigned short Opcode) {
2982 return HexagonCExt[Opcode].MinValue;
2985 // Returns the max value that doesn't need to be extended.
2986 int HexagonConstExt::getMaxValue(unsigned short Opcode) {
2987 return HexagonCExt[Opcode].MaxValue;
2990 // Returns true if an instruction can be converted into a non-extended
2991 // equivalent instruction.
2992 bool HexagonConstExt::NonExtEquivalentExists (unsigned short Opcode) {
2993 if (HexagonCExt[Opcode].NonExtOpcode < 0 )
2998 // Returns opcode of the non-extended equivalent instruction.
2999 int HexagonConstExt::getNonExtOpcode (unsigned short Opcode) {
3000 return HexagonCExt[Opcode].NonExtOpcode;