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 {
176 // If the block has no terminators, it just falls into the block after it.
177 MachineBasicBlock::iterator I = MBB.end();
178 if (I == MBB.begin())
181 // A basic block may looks like this:
191 // It has two succs but does not have a terminator
192 // Don't know how to handle it.
197 } while (I != MBB.begin());
202 while (I->isDebugValue()) {
203 if (I == MBB.begin())
207 if (!isUnpredicatedTerminator(I))
210 // Get the last instruction in the block.
211 MachineInstr *LastInst = I;
213 // If there is only one terminator instruction, process it.
214 if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) {
215 if (LastInst->getOpcode() == Hexagon::JMP) {
216 TBB = LastInst->getOperand(0).getMBB();
219 if (LastInst->getOpcode() == Hexagon::JMP_c) {
220 // Block ends with fall-through true condbranch.
221 TBB = LastInst->getOperand(1).getMBB();
222 Cond.push_back(LastInst->getOperand(0));
225 if (LastInst->getOpcode() == Hexagon::JMP_cNot) {
226 // Block ends with fall-through false condbranch.
227 TBB = LastInst->getOperand(1).getMBB();
228 Cond.push_back(MachineOperand::CreateImm(0));
229 Cond.push_back(LastInst->getOperand(0));
232 // Otherwise, don't know what this is.
236 // Get the instruction before it if it's a terminator.
237 MachineInstr *SecondLastInst = I;
239 // If there are three terminators, we don't know what sort of block this is.
240 if (SecondLastInst && I != MBB.begin() &&
241 isUnpredicatedTerminator(--I))
244 // If the block ends with Hexagon::BRCOND and Hexagon:JMP, handle it.
245 if (((SecondLastInst->getOpcode() == Hexagon::BRCOND) ||
246 (SecondLastInst->getOpcode() == Hexagon::JMP_c)) &&
247 LastInst->getOpcode() == Hexagon::JMP) {
248 TBB = SecondLastInst->getOperand(1).getMBB();
249 Cond.push_back(SecondLastInst->getOperand(0));
250 FBB = LastInst->getOperand(0).getMBB();
254 // If the block ends with Hexagon::JMP_cNot and Hexagon:JMP, handle it.
255 if ((SecondLastInst->getOpcode() == Hexagon::JMP_cNot) &&
256 LastInst->getOpcode() == Hexagon::JMP) {
257 TBB = SecondLastInst->getOperand(1).getMBB();
258 Cond.push_back(MachineOperand::CreateImm(0));
259 Cond.push_back(SecondLastInst->getOperand(0));
260 FBB = LastInst->getOperand(0).getMBB();
264 // If the block ends with two Hexagon:JMPs, handle it. The second one is not
265 // executed, so remove it.
266 if (SecondLastInst->getOpcode() == Hexagon::JMP &&
267 LastInst->getOpcode() == Hexagon::JMP) {
268 TBB = SecondLastInst->getOperand(0).getMBB();
271 I->eraseFromParent();
275 // Otherwise, can't handle this.
280 unsigned HexagonInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
281 int BOpc = Hexagon::JMP;
282 int BccOpc = Hexagon::JMP_c;
283 int BccOpcNot = Hexagon::JMP_cNot;
285 MachineBasicBlock::iterator I = MBB.end();
286 if (I == MBB.begin()) return 0;
288 if (I->getOpcode() != BOpc && I->getOpcode() != BccOpc &&
289 I->getOpcode() != BccOpcNot)
292 // Remove the branch.
293 I->eraseFromParent();
297 if (I == MBB.begin()) return 1;
299 if (I->getOpcode() != BccOpc && I->getOpcode() != BccOpcNot)
302 // Remove the branch.
303 I->eraseFromParent();
308 void HexagonInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
309 MachineBasicBlock::iterator I, DebugLoc DL,
310 unsigned DestReg, unsigned SrcReg,
311 bool KillSrc) const {
312 if (Hexagon::IntRegsRegClass.contains(SrcReg, DestReg)) {
313 BuildMI(MBB, I, DL, get(Hexagon::TFR), DestReg).addReg(SrcReg);
316 if (Hexagon::DoubleRegsRegClass.contains(SrcReg, DestReg)) {
317 BuildMI(MBB, I, DL, get(Hexagon::TFR_64), DestReg).addReg(SrcReg);
320 if (Hexagon::PredRegsRegClass.contains(SrcReg, DestReg)) {
321 // Map Pd = Ps to Pd = or(Ps, Ps).
322 BuildMI(MBB, I, DL, get(Hexagon::OR_pp),
323 DestReg).addReg(SrcReg).addReg(SrcReg);
326 if (Hexagon::DoubleRegsRegClass.contains(DestReg) &&
327 Hexagon::IntRegsRegClass.contains(SrcReg)) {
328 // We can have an overlap between single and double reg: r1:0 = r0.
329 if(SrcReg == RI.getSubReg(DestReg, Hexagon::subreg_loreg)) {
331 BuildMI(MBB, I, DL, get(Hexagon::TFRI), (RI.getSubReg(DestReg,
332 Hexagon::subreg_hireg))).addImm(0);
334 // r1:0 = r1 or no overlap.
335 BuildMI(MBB, I, DL, get(Hexagon::TFR), (RI.getSubReg(DestReg,
336 Hexagon::subreg_loreg))).addReg(SrcReg);
337 BuildMI(MBB, I, DL, get(Hexagon::TFRI), (RI.getSubReg(DestReg,
338 Hexagon::subreg_hireg))).addImm(0);
342 if (Hexagon::CRRegsRegClass.contains(DestReg) &&
343 Hexagon::IntRegsRegClass.contains(SrcReg)) {
344 BuildMI(MBB, I, DL, get(Hexagon::TFCR), DestReg).addReg(SrcReg);
348 llvm_unreachable("Unimplemented");
352 void HexagonInstrInfo::
353 storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
354 unsigned SrcReg, bool isKill, int FI,
355 const TargetRegisterClass *RC,
356 const TargetRegisterInfo *TRI) const {
358 DebugLoc DL = MBB.findDebugLoc(I);
359 MachineFunction &MF = *MBB.getParent();
360 MachineFrameInfo &MFI = *MF.getFrameInfo();
361 unsigned Align = MFI.getObjectAlignment(FI);
363 MachineMemOperand *MMO =
364 MF.getMachineMemOperand(
365 MachinePointerInfo(PseudoSourceValue::getFixedStack(FI)),
366 MachineMemOperand::MOStore,
367 MFI.getObjectSize(FI),
370 if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
371 BuildMI(MBB, I, DL, get(Hexagon::STriw_indexed))
372 .addFrameIndex(FI).addImm(0)
373 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
374 } else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
375 BuildMI(MBB, I, DL, get(Hexagon::STrid))
376 .addFrameIndex(FI).addImm(0)
377 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
378 } else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
379 BuildMI(MBB, I, DL, get(Hexagon::STriw_pred))
380 .addFrameIndex(FI).addImm(0)
381 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
383 llvm_unreachable("Unimplemented");
388 void HexagonInstrInfo::storeRegToAddr(
389 MachineFunction &MF, unsigned SrcReg,
391 SmallVectorImpl<MachineOperand> &Addr,
392 const TargetRegisterClass *RC,
393 SmallVectorImpl<MachineInstr*> &NewMIs) const
395 llvm_unreachable("Unimplemented");
399 void HexagonInstrInfo::
400 loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
401 unsigned DestReg, int FI,
402 const TargetRegisterClass *RC,
403 const TargetRegisterInfo *TRI) const {
404 DebugLoc DL = MBB.findDebugLoc(I);
405 MachineFunction &MF = *MBB.getParent();
406 MachineFrameInfo &MFI = *MF.getFrameInfo();
407 unsigned Align = MFI.getObjectAlignment(FI);
409 MachineMemOperand *MMO =
410 MF.getMachineMemOperand(
411 MachinePointerInfo(PseudoSourceValue::getFixedStack(FI)),
412 MachineMemOperand::MOLoad,
413 MFI.getObjectSize(FI),
415 if (RC == &Hexagon::IntRegsRegClass) {
416 BuildMI(MBB, I, DL, get(Hexagon::LDriw), DestReg)
417 .addFrameIndex(FI).addImm(0).addMemOperand(MMO);
418 } else if (RC == &Hexagon::DoubleRegsRegClass) {
419 BuildMI(MBB, I, DL, get(Hexagon::LDrid), DestReg)
420 .addFrameIndex(FI).addImm(0).addMemOperand(MMO);
421 } else if (RC == &Hexagon::PredRegsRegClass) {
422 BuildMI(MBB, I, DL, get(Hexagon::LDriw_pred), DestReg)
423 .addFrameIndex(FI).addImm(0).addMemOperand(MMO);
425 llvm_unreachable("Can't store this register to stack slot");
430 void HexagonInstrInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
431 SmallVectorImpl<MachineOperand> &Addr,
432 const TargetRegisterClass *RC,
433 SmallVectorImpl<MachineInstr*> &NewMIs) const {
434 llvm_unreachable("Unimplemented");
438 MachineInstr *HexagonInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
440 const SmallVectorImpl<unsigned> &Ops,
442 // Hexagon_TODO: Implement.
447 unsigned HexagonInstrInfo::createVR(MachineFunction* MF, MVT VT) const {
449 MachineRegisterInfo &RegInfo = MF->getRegInfo();
450 const TargetRegisterClass *TRC;
452 TRC = &Hexagon::PredRegsRegClass;
453 } else if (VT == MVT::i32 || VT == MVT::f32) {
454 TRC = &Hexagon::IntRegsRegClass;
455 } else if (VT == MVT::i64 || VT == MVT::f64) {
456 TRC = &Hexagon::DoubleRegsRegClass;
458 llvm_unreachable("Cannot handle this register class");
461 unsigned NewReg = RegInfo.createVirtualRegister(TRC);
465 bool HexagonInstrInfo::isExtendable(const MachineInstr *MI) const {
466 switch(MI->getOpcode()) {
467 default: return false;
469 case Hexagon::JMP_EQriPt_nv_V4:
470 case Hexagon::JMP_EQriPnt_nv_V4:
471 case Hexagon::JMP_EQriNotPt_nv_V4:
472 case Hexagon::JMP_EQriNotPnt_nv_V4:
474 // JMP_EQri - with -1
475 case Hexagon::JMP_EQriPtneg_nv_V4:
476 case Hexagon::JMP_EQriPntneg_nv_V4:
477 case Hexagon::JMP_EQriNotPtneg_nv_V4:
478 case Hexagon::JMP_EQriNotPntneg_nv_V4:
481 case Hexagon::JMP_EQrrPt_nv_V4:
482 case Hexagon::JMP_EQrrPnt_nv_V4:
483 case Hexagon::JMP_EQrrNotPt_nv_V4:
484 case Hexagon::JMP_EQrrNotPnt_nv_V4:
487 case Hexagon::JMP_GTriPt_nv_V4:
488 case Hexagon::JMP_GTriPnt_nv_V4:
489 case Hexagon::JMP_GTriNotPt_nv_V4:
490 case Hexagon::JMP_GTriNotPnt_nv_V4:
492 // JMP_GTri - with -1
493 case Hexagon::JMP_GTriPtneg_nv_V4:
494 case Hexagon::JMP_GTriPntneg_nv_V4:
495 case Hexagon::JMP_GTriNotPtneg_nv_V4:
496 case Hexagon::JMP_GTriNotPntneg_nv_V4:
499 case Hexagon::JMP_GTrrPt_nv_V4:
500 case Hexagon::JMP_GTrrPnt_nv_V4:
501 case Hexagon::JMP_GTrrNotPt_nv_V4:
502 case Hexagon::JMP_GTrrNotPnt_nv_V4:
505 case Hexagon::JMP_GTrrdnPt_nv_V4:
506 case Hexagon::JMP_GTrrdnPnt_nv_V4:
507 case Hexagon::JMP_GTrrdnNotPt_nv_V4:
508 case Hexagon::JMP_GTrrdnNotPnt_nv_V4:
511 case Hexagon::JMP_GTUriPt_nv_V4:
512 case Hexagon::JMP_GTUriPnt_nv_V4:
513 case Hexagon::JMP_GTUriNotPt_nv_V4:
514 case Hexagon::JMP_GTUriNotPnt_nv_V4:
517 case Hexagon::JMP_GTUrrPt_nv_V4:
518 case Hexagon::JMP_GTUrrPnt_nv_V4:
519 case Hexagon::JMP_GTUrrNotPt_nv_V4:
520 case Hexagon::JMP_GTUrrNotPnt_nv_V4:
523 case Hexagon::JMP_GTUrrdnPt_nv_V4:
524 case Hexagon::JMP_GTUrrdnPnt_nv_V4:
525 case Hexagon::JMP_GTUrrdnNotPt_nv_V4:
526 case Hexagon::JMP_GTUrrdnNotPnt_nv_V4:
529 case Hexagon::TFR_FI:
534 bool HexagonInstrInfo::isExtended(const MachineInstr *MI) const {
535 switch(MI->getOpcode()) {
536 default: return false;
538 case Hexagon::JMP_EQriPt_ie_nv_V4:
539 case Hexagon::JMP_EQriPnt_ie_nv_V4:
540 case Hexagon::JMP_EQriNotPt_ie_nv_V4:
541 case Hexagon::JMP_EQriNotPnt_ie_nv_V4:
543 // JMP_EQri - with -1
544 case Hexagon::JMP_EQriPtneg_ie_nv_V4:
545 case Hexagon::JMP_EQriPntneg_ie_nv_V4:
546 case Hexagon::JMP_EQriNotPtneg_ie_nv_V4:
547 case Hexagon::JMP_EQriNotPntneg_ie_nv_V4:
550 case Hexagon::JMP_EQrrPt_ie_nv_V4:
551 case Hexagon::JMP_EQrrPnt_ie_nv_V4:
552 case Hexagon::JMP_EQrrNotPt_ie_nv_V4:
553 case Hexagon::JMP_EQrrNotPnt_ie_nv_V4:
556 case Hexagon::JMP_GTriPt_ie_nv_V4:
557 case Hexagon::JMP_GTriPnt_ie_nv_V4:
558 case Hexagon::JMP_GTriNotPt_ie_nv_V4:
559 case Hexagon::JMP_GTriNotPnt_ie_nv_V4:
561 // JMP_GTri - with -1
562 case Hexagon::JMP_GTriPtneg_ie_nv_V4:
563 case Hexagon::JMP_GTriPntneg_ie_nv_V4:
564 case Hexagon::JMP_GTriNotPtneg_ie_nv_V4:
565 case Hexagon::JMP_GTriNotPntneg_ie_nv_V4:
568 case Hexagon::JMP_GTrrPt_ie_nv_V4:
569 case Hexagon::JMP_GTrrPnt_ie_nv_V4:
570 case Hexagon::JMP_GTrrNotPt_ie_nv_V4:
571 case Hexagon::JMP_GTrrNotPnt_ie_nv_V4:
574 case Hexagon::JMP_GTrrdnPt_ie_nv_V4:
575 case Hexagon::JMP_GTrrdnPnt_ie_nv_V4:
576 case Hexagon::JMP_GTrrdnNotPt_ie_nv_V4:
577 case Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4:
580 case Hexagon::JMP_GTUriPt_ie_nv_V4:
581 case Hexagon::JMP_GTUriPnt_ie_nv_V4:
582 case Hexagon::JMP_GTUriNotPt_ie_nv_V4:
583 case Hexagon::JMP_GTUriNotPnt_ie_nv_V4:
586 case Hexagon::JMP_GTUrrPt_ie_nv_V4:
587 case Hexagon::JMP_GTUrrPnt_ie_nv_V4:
588 case Hexagon::JMP_GTUrrNotPt_ie_nv_V4:
589 case Hexagon::JMP_GTUrrNotPnt_ie_nv_V4:
592 case Hexagon::JMP_GTUrrdnPt_ie_nv_V4:
593 case Hexagon::JMP_GTUrrdnPnt_ie_nv_V4:
594 case Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4:
595 case Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4:
597 // V4 absolute set addressing.
598 case Hexagon::LDrid_abs_setimm_V4:
599 case Hexagon::LDriw_abs_setimm_V4:
600 case Hexagon::LDrih_abs_setimm_V4:
601 case Hexagon::LDrib_abs_setimm_V4:
602 case Hexagon::LDriuh_abs_setimm_V4:
603 case Hexagon::LDriub_abs_setimm_V4:
605 case Hexagon::STrid_abs_setimm_V4:
606 case Hexagon::STrib_abs_setimm_V4:
607 case Hexagon::STrih_abs_setimm_V4:
608 case Hexagon::STriw_abs_setimm_V4:
610 // V4 global address load.
611 case Hexagon::LDrid_GP_cPt_V4 :
612 case Hexagon::LDrid_GP_cNotPt_V4 :
613 case Hexagon::LDrid_GP_cdnPt_V4 :
614 case Hexagon::LDrid_GP_cdnNotPt_V4 :
615 case Hexagon::LDrib_GP_cPt_V4 :
616 case Hexagon::LDrib_GP_cNotPt_V4 :
617 case Hexagon::LDrib_GP_cdnPt_V4 :
618 case Hexagon::LDrib_GP_cdnNotPt_V4 :
619 case Hexagon::LDriub_GP_cPt_V4 :
620 case Hexagon::LDriub_GP_cNotPt_V4 :
621 case Hexagon::LDriub_GP_cdnPt_V4 :
622 case Hexagon::LDriub_GP_cdnNotPt_V4 :
623 case Hexagon::LDrih_GP_cPt_V4 :
624 case Hexagon::LDrih_GP_cNotPt_V4 :
625 case Hexagon::LDrih_GP_cdnPt_V4 :
626 case Hexagon::LDrih_GP_cdnNotPt_V4 :
627 case Hexagon::LDriuh_GP_cPt_V4 :
628 case Hexagon::LDriuh_GP_cNotPt_V4 :
629 case Hexagon::LDriuh_GP_cdnPt_V4 :
630 case Hexagon::LDriuh_GP_cdnNotPt_V4 :
631 case Hexagon::LDriw_GP_cPt_V4 :
632 case Hexagon::LDriw_GP_cNotPt_V4 :
633 case Hexagon::LDriw_GP_cdnPt_V4 :
634 case Hexagon::LDriw_GP_cdnNotPt_V4 :
635 case Hexagon::LDd_GP_cPt_V4 :
636 case Hexagon::LDd_GP_cNotPt_V4 :
637 case Hexagon::LDd_GP_cdnPt_V4 :
638 case Hexagon::LDd_GP_cdnNotPt_V4 :
639 case Hexagon::LDb_GP_cPt_V4 :
640 case Hexagon::LDb_GP_cNotPt_V4 :
641 case Hexagon::LDb_GP_cdnPt_V4 :
642 case Hexagon::LDb_GP_cdnNotPt_V4 :
643 case Hexagon::LDub_GP_cPt_V4 :
644 case Hexagon::LDub_GP_cNotPt_V4 :
645 case Hexagon::LDub_GP_cdnPt_V4 :
646 case Hexagon::LDub_GP_cdnNotPt_V4 :
647 case Hexagon::LDh_GP_cPt_V4 :
648 case Hexagon::LDh_GP_cNotPt_V4 :
649 case Hexagon::LDh_GP_cdnPt_V4 :
650 case Hexagon::LDh_GP_cdnNotPt_V4 :
651 case Hexagon::LDuh_GP_cPt_V4 :
652 case Hexagon::LDuh_GP_cNotPt_V4 :
653 case Hexagon::LDuh_GP_cdnPt_V4 :
654 case Hexagon::LDuh_GP_cdnNotPt_V4 :
655 case Hexagon::LDw_GP_cPt_V4 :
656 case Hexagon::LDw_GP_cNotPt_V4 :
657 case Hexagon::LDw_GP_cdnPt_V4 :
658 case Hexagon::LDw_GP_cdnNotPt_V4 :
660 // V4 global address store.
661 case Hexagon::STrid_GP_cPt_V4 :
662 case Hexagon::STrid_GP_cNotPt_V4 :
663 case Hexagon::STrid_GP_cdnPt_V4 :
664 case Hexagon::STrid_GP_cdnNotPt_V4 :
665 case Hexagon::STrib_GP_cPt_V4 :
666 case Hexagon::STrib_GP_cNotPt_V4 :
667 case Hexagon::STrib_GP_cdnPt_V4 :
668 case Hexagon::STrib_GP_cdnNotPt_V4 :
669 case Hexagon::STrih_GP_cPt_V4 :
670 case Hexagon::STrih_GP_cNotPt_V4 :
671 case Hexagon::STrih_GP_cdnPt_V4 :
672 case Hexagon::STrih_GP_cdnNotPt_V4 :
673 case Hexagon::STriw_GP_cPt_V4 :
674 case Hexagon::STriw_GP_cNotPt_V4 :
675 case Hexagon::STriw_GP_cdnPt_V4 :
676 case Hexagon::STriw_GP_cdnNotPt_V4 :
677 case Hexagon::STd_GP_cPt_V4 :
678 case Hexagon::STd_GP_cNotPt_V4 :
679 case Hexagon::STd_GP_cdnPt_V4 :
680 case Hexagon::STd_GP_cdnNotPt_V4 :
681 case Hexagon::STb_GP_cPt_V4 :
682 case Hexagon::STb_GP_cNotPt_V4 :
683 case Hexagon::STb_GP_cdnPt_V4 :
684 case Hexagon::STb_GP_cdnNotPt_V4 :
685 case Hexagon::STh_GP_cPt_V4 :
686 case Hexagon::STh_GP_cNotPt_V4 :
687 case Hexagon::STh_GP_cdnPt_V4 :
688 case Hexagon::STh_GP_cdnNotPt_V4 :
689 case Hexagon::STw_GP_cPt_V4 :
690 case Hexagon::STw_GP_cNotPt_V4 :
691 case Hexagon::STw_GP_cdnPt_V4 :
692 case Hexagon::STw_GP_cdnNotPt_V4 :
694 // V4 predicated global address new value store.
695 case Hexagon::STrib_GP_cPt_nv_V4 :
696 case Hexagon::STrib_GP_cNotPt_nv_V4 :
697 case Hexagon::STrib_GP_cdnPt_nv_V4 :
698 case Hexagon::STrib_GP_cdnNotPt_nv_V4 :
699 case Hexagon::STrih_GP_cPt_nv_V4 :
700 case Hexagon::STrih_GP_cNotPt_nv_V4 :
701 case Hexagon::STrih_GP_cdnPt_nv_V4 :
702 case Hexagon::STrih_GP_cdnNotPt_nv_V4 :
703 case Hexagon::STriw_GP_cPt_nv_V4 :
704 case Hexagon::STriw_GP_cNotPt_nv_V4 :
705 case Hexagon::STriw_GP_cdnPt_nv_V4 :
706 case Hexagon::STriw_GP_cdnNotPt_nv_V4 :
707 case Hexagon::STb_GP_cPt_nv_V4 :
708 case Hexagon::STb_GP_cNotPt_nv_V4 :
709 case Hexagon::STb_GP_cdnPt_nv_V4 :
710 case Hexagon::STb_GP_cdnNotPt_nv_V4 :
711 case Hexagon::STh_GP_cPt_nv_V4 :
712 case Hexagon::STh_GP_cNotPt_nv_V4 :
713 case Hexagon::STh_GP_cdnPt_nv_V4 :
714 case Hexagon::STh_GP_cdnNotPt_nv_V4 :
715 case Hexagon::STw_GP_cPt_nv_V4 :
716 case Hexagon::STw_GP_cNotPt_nv_V4 :
717 case Hexagon::STw_GP_cdnPt_nv_V4 :
718 case Hexagon::STw_GP_cdnNotPt_nv_V4 :
721 case Hexagon::TFR_FI_immext_V4:
724 case Hexagon::TFRI_f:
725 case Hexagon::TFRI_cPt_f:
726 case Hexagon::TFRI_cNotPt_f:
727 case Hexagon::CONST64_Float_Real:
732 bool HexagonInstrInfo::isNewValueJump(const MachineInstr *MI) const {
733 switch (MI->getOpcode()) {
734 default: return false;
736 case Hexagon::JMP_EQriPt_nv_V4:
737 case Hexagon::JMP_EQriPnt_nv_V4:
738 case Hexagon::JMP_EQriNotPt_nv_V4:
739 case Hexagon::JMP_EQriNotPnt_nv_V4:
740 case Hexagon::JMP_EQriPt_ie_nv_V4:
741 case Hexagon::JMP_EQriPnt_ie_nv_V4:
742 case Hexagon::JMP_EQriNotPt_ie_nv_V4:
743 case Hexagon::JMP_EQriNotPnt_ie_nv_V4:
745 // JMP_EQri - with -1
746 case Hexagon::JMP_EQriPtneg_nv_V4:
747 case Hexagon::JMP_EQriPntneg_nv_V4:
748 case Hexagon::JMP_EQriNotPtneg_nv_V4:
749 case Hexagon::JMP_EQriNotPntneg_nv_V4:
750 case Hexagon::JMP_EQriPtneg_ie_nv_V4:
751 case Hexagon::JMP_EQriPntneg_ie_nv_V4:
752 case Hexagon::JMP_EQriNotPtneg_ie_nv_V4:
753 case Hexagon::JMP_EQriNotPntneg_ie_nv_V4:
756 case Hexagon::JMP_EQrrPt_nv_V4:
757 case Hexagon::JMP_EQrrPnt_nv_V4:
758 case Hexagon::JMP_EQrrNotPt_nv_V4:
759 case Hexagon::JMP_EQrrNotPnt_nv_V4:
760 case Hexagon::JMP_EQrrPt_ie_nv_V4:
761 case Hexagon::JMP_EQrrPnt_ie_nv_V4:
762 case Hexagon::JMP_EQrrNotPt_ie_nv_V4:
763 case Hexagon::JMP_EQrrNotPnt_ie_nv_V4:
766 case Hexagon::JMP_GTriPt_nv_V4:
767 case Hexagon::JMP_GTriPnt_nv_V4:
768 case Hexagon::JMP_GTriNotPt_nv_V4:
769 case Hexagon::JMP_GTriNotPnt_nv_V4:
770 case Hexagon::JMP_GTriPt_ie_nv_V4:
771 case Hexagon::JMP_GTriPnt_ie_nv_V4:
772 case Hexagon::JMP_GTriNotPt_ie_nv_V4:
773 case Hexagon::JMP_GTriNotPnt_ie_nv_V4:
775 // JMP_GTri - with -1
776 case Hexagon::JMP_GTriPtneg_nv_V4:
777 case Hexagon::JMP_GTriPntneg_nv_V4:
778 case Hexagon::JMP_GTriNotPtneg_nv_V4:
779 case Hexagon::JMP_GTriNotPntneg_nv_V4:
780 case Hexagon::JMP_GTriPtneg_ie_nv_V4:
781 case Hexagon::JMP_GTriPntneg_ie_nv_V4:
782 case Hexagon::JMP_GTriNotPtneg_ie_nv_V4:
783 case Hexagon::JMP_GTriNotPntneg_ie_nv_V4:
786 case Hexagon::JMP_GTrrPt_nv_V4:
787 case Hexagon::JMP_GTrrPnt_nv_V4:
788 case Hexagon::JMP_GTrrNotPt_nv_V4:
789 case Hexagon::JMP_GTrrNotPnt_nv_V4:
790 case Hexagon::JMP_GTrrPt_ie_nv_V4:
791 case Hexagon::JMP_GTrrPnt_ie_nv_V4:
792 case Hexagon::JMP_GTrrNotPt_ie_nv_V4:
793 case Hexagon::JMP_GTrrNotPnt_ie_nv_V4:
796 case Hexagon::JMP_GTrrdnPt_nv_V4:
797 case Hexagon::JMP_GTrrdnPnt_nv_V4:
798 case Hexagon::JMP_GTrrdnNotPt_nv_V4:
799 case Hexagon::JMP_GTrrdnNotPnt_nv_V4:
800 case Hexagon::JMP_GTrrdnPt_ie_nv_V4:
801 case Hexagon::JMP_GTrrdnPnt_ie_nv_V4:
802 case Hexagon::JMP_GTrrdnNotPt_ie_nv_V4:
803 case Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4:
806 case Hexagon::JMP_GTUriPt_nv_V4:
807 case Hexagon::JMP_GTUriPnt_nv_V4:
808 case Hexagon::JMP_GTUriNotPt_nv_V4:
809 case Hexagon::JMP_GTUriNotPnt_nv_V4:
810 case Hexagon::JMP_GTUriPt_ie_nv_V4:
811 case Hexagon::JMP_GTUriPnt_ie_nv_V4:
812 case Hexagon::JMP_GTUriNotPt_ie_nv_V4:
813 case Hexagon::JMP_GTUriNotPnt_ie_nv_V4:
816 case Hexagon::JMP_GTUrrPt_nv_V4:
817 case Hexagon::JMP_GTUrrPnt_nv_V4:
818 case Hexagon::JMP_GTUrrNotPt_nv_V4:
819 case Hexagon::JMP_GTUrrNotPnt_nv_V4:
820 case Hexagon::JMP_GTUrrPt_ie_nv_V4:
821 case Hexagon::JMP_GTUrrPnt_ie_nv_V4:
822 case Hexagon::JMP_GTUrrNotPt_ie_nv_V4:
823 case Hexagon::JMP_GTUrrNotPnt_ie_nv_V4:
826 case Hexagon::JMP_GTUrrdnPt_nv_V4:
827 case Hexagon::JMP_GTUrrdnPnt_nv_V4:
828 case Hexagon::JMP_GTUrrdnNotPt_nv_V4:
829 case Hexagon::JMP_GTUrrdnNotPnt_nv_V4:
830 case Hexagon::JMP_GTUrrdnPt_ie_nv_V4:
831 case Hexagon::JMP_GTUrrdnPnt_ie_nv_V4:
832 case Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4:
833 case Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4:
838 unsigned HexagonInstrInfo::getImmExtForm(const MachineInstr* MI) const {
839 switch(MI->getOpcode()) {
840 default: llvm_unreachable("Unknown type of instruction.");
842 case Hexagon::JMP_EQriPt_nv_V4:
843 return Hexagon::JMP_EQriPt_ie_nv_V4;
844 case Hexagon::JMP_EQriNotPt_nv_V4:
845 return Hexagon::JMP_EQriNotPt_ie_nv_V4;
846 case Hexagon::JMP_EQriPnt_nv_V4:
847 return Hexagon::JMP_EQriPnt_ie_nv_V4;
848 case Hexagon::JMP_EQriNotPnt_nv_V4:
849 return Hexagon::JMP_EQriNotPnt_ie_nv_V4;
851 // JMP_EQri -- with -1
852 case Hexagon::JMP_EQriPtneg_nv_V4:
853 return Hexagon::JMP_EQriPtneg_ie_nv_V4;
854 case Hexagon::JMP_EQriNotPtneg_nv_V4:
855 return Hexagon::JMP_EQriNotPtneg_ie_nv_V4;
856 case Hexagon::JMP_EQriPntneg_nv_V4:
857 return Hexagon::JMP_EQriPntneg_ie_nv_V4;
858 case Hexagon::JMP_EQriNotPntneg_nv_V4:
859 return Hexagon::JMP_EQriNotPntneg_ie_nv_V4;
862 case Hexagon::JMP_EQrrPt_nv_V4:
863 return Hexagon::JMP_EQrrPt_ie_nv_V4;
864 case Hexagon::JMP_EQrrNotPt_nv_V4:
865 return Hexagon::JMP_EQrrNotPt_ie_nv_V4;
866 case Hexagon::JMP_EQrrPnt_nv_V4:
867 return Hexagon::JMP_EQrrPnt_ie_nv_V4;
868 case Hexagon::JMP_EQrrNotPnt_nv_V4:
869 return Hexagon::JMP_EQrrNotPnt_ie_nv_V4;
872 case Hexagon::JMP_GTriPt_nv_V4:
873 return Hexagon::JMP_GTriPt_ie_nv_V4;
874 case Hexagon::JMP_GTriNotPt_nv_V4:
875 return Hexagon::JMP_GTriNotPt_ie_nv_V4;
876 case Hexagon::JMP_GTriPnt_nv_V4:
877 return Hexagon::JMP_GTriPnt_ie_nv_V4;
878 case Hexagon::JMP_GTriNotPnt_nv_V4:
879 return Hexagon::JMP_GTriNotPnt_ie_nv_V4;
881 // JMP_GTri -- with -1
882 case Hexagon::JMP_GTriPtneg_nv_V4:
883 return Hexagon::JMP_GTriPtneg_ie_nv_V4;
884 case Hexagon::JMP_GTriNotPtneg_nv_V4:
885 return Hexagon::JMP_GTriNotPtneg_ie_nv_V4;
886 case Hexagon::JMP_GTriPntneg_nv_V4:
887 return Hexagon::JMP_GTriPntneg_ie_nv_V4;
888 case Hexagon::JMP_GTriNotPntneg_nv_V4:
889 return Hexagon::JMP_GTriNotPntneg_ie_nv_V4;
892 case Hexagon::JMP_GTrrPt_nv_V4:
893 return Hexagon::JMP_GTrrPt_ie_nv_V4;
894 case Hexagon::JMP_GTrrNotPt_nv_V4:
895 return Hexagon::JMP_GTrrNotPt_ie_nv_V4;
896 case Hexagon::JMP_GTrrPnt_nv_V4:
897 return Hexagon::JMP_GTrrPnt_ie_nv_V4;
898 case Hexagon::JMP_GTrrNotPnt_nv_V4:
899 return Hexagon::JMP_GTrrNotPnt_ie_nv_V4;
902 case Hexagon::JMP_GTrrdnPt_nv_V4:
903 return Hexagon::JMP_GTrrdnPt_ie_nv_V4;
904 case Hexagon::JMP_GTrrdnNotPt_nv_V4:
905 return Hexagon::JMP_GTrrdnNotPt_ie_nv_V4;
906 case Hexagon::JMP_GTrrdnPnt_nv_V4:
907 return Hexagon::JMP_GTrrdnPnt_ie_nv_V4;
908 case Hexagon::JMP_GTrrdnNotPnt_nv_V4:
909 return Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4;
912 case Hexagon::JMP_GTUriPt_nv_V4:
913 return Hexagon::JMP_GTUriPt_ie_nv_V4;
914 case Hexagon::JMP_GTUriNotPt_nv_V4:
915 return Hexagon::JMP_GTUriNotPt_ie_nv_V4;
916 case Hexagon::JMP_GTUriPnt_nv_V4:
917 return Hexagon::JMP_GTUriPnt_ie_nv_V4;
918 case Hexagon::JMP_GTUriNotPnt_nv_V4:
919 return Hexagon::JMP_GTUriNotPnt_ie_nv_V4;
922 case Hexagon::JMP_GTUrrPt_nv_V4:
923 return Hexagon::JMP_GTUrrPt_ie_nv_V4;
924 case Hexagon::JMP_GTUrrNotPt_nv_V4:
925 return Hexagon::JMP_GTUrrNotPt_ie_nv_V4;
926 case Hexagon::JMP_GTUrrPnt_nv_V4:
927 return Hexagon::JMP_GTUrrPnt_ie_nv_V4;
928 case Hexagon::JMP_GTUrrNotPnt_nv_V4:
929 return Hexagon::JMP_GTUrrNotPnt_ie_nv_V4;
932 case Hexagon::JMP_GTUrrdnPt_nv_V4:
933 return Hexagon::JMP_GTUrrdnPt_ie_nv_V4;
934 case Hexagon::JMP_GTUrrdnNotPt_nv_V4:
935 return Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4;
936 case Hexagon::JMP_GTUrrdnPnt_nv_V4:
937 return Hexagon::JMP_GTUrrdnPnt_ie_nv_V4;
938 case Hexagon::JMP_GTUrrdnNotPnt_nv_V4:
939 return Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4;
941 case Hexagon::TFR_FI:
942 return Hexagon::TFR_FI_immext_V4;
944 case Hexagon::MEMw_ADDSUBi_indexed_MEM_V4 :
945 case Hexagon::MEMw_ADDi_indexed_MEM_V4 :
946 case Hexagon::MEMw_SUBi_indexed_MEM_V4 :
947 case Hexagon::MEMw_ADDr_indexed_MEM_V4 :
948 case Hexagon::MEMw_SUBr_indexed_MEM_V4 :
949 case Hexagon::MEMw_ANDr_indexed_MEM_V4 :
950 case Hexagon::MEMw_ORr_indexed_MEM_V4 :
951 case Hexagon::MEMw_ADDSUBi_MEM_V4 :
952 case Hexagon::MEMw_ADDi_MEM_V4 :
953 case Hexagon::MEMw_SUBi_MEM_V4 :
954 case Hexagon::MEMw_ADDr_MEM_V4 :
955 case Hexagon::MEMw_SUBr_MEM_V4 :
956 case Hexagon::MEMw_ANDr_MEM_V4 :
957 case Hexagon::MEMw_ORr_MEM_V4 :
958 case Hexagon::MEMh_ADDSUBi_indexed_MEM_V4 :
959 case Hexagon::MEMh_ADDi_indexed_MEM_V4 :
960 case Hexagon::MEMh_SUBi_indexed_MEM_V4 :
961 case Hexagon::MEMh_ADDr_indexed_MEM_V4 :
962 case Hexagon::MEMh_SUBr_indexed_MEM_V4 :
963 case Hexagon::MEMh_ANDr_indexed_MEM_V4 :
964 case Hexagon::MEMh_ORr_indexed_MEM_V4 :
965 case Hexagon::MEMh_ADDSUBi_MEM_V4 :
966 case Hexagon::MEMh_ADDi_MEM_V4 :
967 case Hexagon::MEMh_SUBi_MEM_V4 :
968 case Hexagon::MEMh_ADDr_MEM_V4 :
969 case Hexagon::MEMh_SUBr_MEM_V4 :
970 case Hexagon::MEMh_ANDr_MEM_V4 :
971 case Hexagon::MEMh_ORr_MEM_V4 :
972 case Hexagon::MEMb_ADDSUBi_indexed_MEM_V4 :
973 case Hexagon::MEMb_ADDi_indexed_MEM_V4 :
974 case Hexagon::MEMb_SUBi_indexed_MEM_V4 :
975 case Hexagon::MEMb_ADDr_indexed_MEM_V4 :
976 case Hexagon::MEMb_SUBr_indexed_MEM_V4 :
977 case Hexagon::MEMb_ANDr_indexed_MEM_V4 :
978 case Hexagon::MEMb_ORr_indexed_MEM_V4 :
979 case Hexagon::MEMb_ADDSUBi_MEM_V4 :
980 case Hexagon::MEMb_ADDi_MEM_V4 :
981 case Hexagon::MEMb_SUBi_MEM_V4 :
982 case Hexagon::MEMb_ADDr_MEM_V4 :
983 case Hexagon::MEMb_SUBr_MEM_V4 :
984 case Hexagon::MEMb_ANDr_MEM_V4 :
985 case Hexagon::MEMb_ORr_MEM_V4 :
986 llvm_unreachable("Needs implementing.");
990 unsigned HexagonInstrInfo::getNormalBranchForm(const MachineInstr* MI) const {
991 switch(MI->getOpcode()) {
992 default: llvm_unreachable("Unknown type of jump instruction.");
994 case Hexagon::JMP_EQriPt_ie_nv_V4:
995 return Hexagon::JMP_EQriPt_nv_V4;
996 case Hexagon::JMP_EQriNotPt_ie_nv_V4:
997 return Hexagon::JMP_EQriNotPt_nv_V4;
998 case Hexagon::JMP_EQriPnt_ie_nv_V4:
999 return Hexagon::JMP_EQriPnt_nv_V4;
1000 case Hexagon::JMP_EQriNotPnt_ie_nv_V4:
1001 return Hexagon::JMP_EQriNotPnt_nv_V4;
1003 // JMP_EQri -- with -1
1004 case Hexagon::JMP_EQriPtneg_ie_nv_V4:
1005 return Hexagon::JMP_EQriPtneg_nv_V4;
1006 case Hexagon::JMP_EQriNotPtneg_ie_nv_V4:
1007 return Hexagon::JMP_EQriNotPtneg_nv_V4;
1008 case Hexagon::JMP_EQriPntneg_ie_nv_V4:
1009 return Hexagon::JMP_EQriPntneg_nv_V4;
1010 case Hexagon::JMP_EQriNotPntneg_ie_nv_V4:
1011 return Hexagon::JMP_EQriNotPntneg_nv_V4;
1014 case Hexagon::JMP_EQrrPt_ie_nv_V4:
1015 return Hexagon::JMP_EQrrPt_nv_V4;
1016 case Hexagon::JMP_EQrrNotPt_ie_nv_V4:
1017 return Hexagon::JMP_EQrrNotPt_nv_V4;
1018 case Hexagon::JMP_EQrrPnt_ie_nv_V4:
1019 return Hexagon::JMP_EQrrPnt_nv_V4;
1020 case Hexagon::JMP_EQrrNotPnt_ie_nv_V4:
1021 return Hexagon::JMP_EQrrNotPnt_nv_V4;
1024 case Hexagon::JMP_GTriPt_ie_nv_V4:
1025 return Hexagon::JMP_GTriPt_nv_V4;
1026 case Hexagon::JMP_GTriNotPt_ie_nv_V4:
1027 return Hexagon::JMP_GTriNotPt_nv_V4;
1028 case Hexagon::JMP_GTriPnt_ie_nv_V4:
1029 return Hexagon::JMP_GTriPnt_nv_V4;
1030 case Hexagon::JMP_GTriNotPnt_ie_nv_V4:
1031 return Hexagon::JMP_GTriNotPnt_nv_V4;
1033 // JMP_GTri -- with -1
1034 case Hexagon::JMP_GTriPtneg_ie_nv_V4:
1035 return Hexagon::JMP_GTriPtneg_nv_V4;
1036 case Hexagon::JMP_GTriNotPtneg_ie_nv_V4:
1037 return Hexagon::JMP_GTriNotPtneg_nv_V4;
1038 case Hexagon::JMP_GTriPntneg_ie_nv_V4:
1039 return Hexagon::JMP_GTriPntneg_nv_V4;
1040 case Hexagon::JMP_GTriNotPntneg_ie_nv_V4:
1041 return Hexagon::JMP_GTriNotPntneg_nv_V4;
1044 case Hexagon::JMP_GTrrPt_ie_nv_V4:
1045 return Hexagon::JMP_GTrrPt_nv_V4;
1046 case Hexagon::JMP_GTrrNotPt_ie_nv_V4:
1047 return Hexagon::JMP_GTrrNotPt_nv_V4;
1048 case Hexagon::JMP_GTrrPnt_ie_nv_V4:
1049 return Hexagon::JMP_GTrrPnt_nv_V4;
1050 case Hexagon::JMP_GTrrNotPnt_ie_nv_V4:
1051 return Hexagon::JMP_GTrrNotPnt_nv_V4;
1054 case Hexagon::JMP_GTrrdnPt_ie_nv_V4:
1055 return Hexagon::JMP_GTrrdnPt_nv_V4;
1056 case Hexagon::JMP_GTrrdnNotPt_ie_nv_V4:
1057 return Hexagon::JMP_GTrrdnNotPt_nv_V4;
1058 case Hexagon::JMP_GTrrdnPnt_ie_nv_V4:
1059 return Hexagon::JMP_GTrrdnPnt_nv_V4;
1060 case Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4:
1061 return Hexagon::JMP_GTrrdnNotPnt_nv_V4;
1064 case Hexagon::JMP_GTUriPt_ie_nv_V4:
1065 return Hexagon::JMP_GTUriPt_nv_V4;
1066 case Hexagon::JMP_GTUriNotPt_ie_nv_V4:
1067 return Hexagon::JMP_GTUriNotPt_nv_V4;
1068 case Hexagon::JMP_GTUriPnt_ie_nv_V4:
1069 return Hexagon::JMP_GTUriPnt_nv_V4;
1070 case Hexagon::JMP_GTUriNotPnt_ie_nv_V4:
1071 return Hexagon::JMP_GTUriNotPnt_nv_V4;
1074 case Hexagon::JMP_GTUrrPt_ie_nv_V4:
1075 return Hexagon::JMP_GTUrrPt_nv_V4;
1076 case Hexagon::JMP_GTUrrNotPt_ie_nv_V4:
1077 return Hexagon::JMP_GTUrrNotPt_nv_V4;
1078 case Hexagon::JMP_GTUrrPnt_ie_nv_V4:
1079 return Hexagon::JMP_GTUrrPnt_nv_V4;
1080 case Hexagon::JMP_GTUrrNotPnt_ie_nv_V4:
1081 return Hexagon::JMP_GTUrrNotPnt_nv_V4;
1084 case Hexagon::JMP_GTUrrdnPt_ie_nv_V4:
1085 return Hexagon::JMP_GTUrrdnPt_nv_V4;
1086 case Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4:
1087 return Hexagon::JMP_GTUrrdnNotPt_nv_V4;
1088 case Hexagon::JMP_GTUrrdnPnt_ie_nv_V4:
1089 return Hexagon::JMP_GTUrrdnPnt_nv_V4;
1090 case Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4:
1091 return Hexagon::JMP_GTUrrdnNotPnt_nv_V4;
1096 bool HexagonInstrInfo::isNewValueStore(const MachineInstr *MI) const {
1097 switch (MI->getOpcode()) {
1098 default: return false;
1100 case Hexagon::STrib_nv_V4:
1101 case Hexagon::STrib_indexed_nv_V4:
1102 case Hexagon::STrib_indexed_shl_nv_V4:
1103 case Hexagon::STrib_shl_nv_V4:
1104 case Hexagon::STrib_GP_nv_V4:
1105 case Hexagon::STb_GP_nv_V4:
1106 case Hexagon::POST_STbri_nv_V4:
1107 case Hexagon::STrib_cPt_nv_V4:
1108 case Hexagon::STrib_cdnPt_nv_V4:
1109 case Hexagon::STrib_cNotPt_nv_V4:
1110 case Hexagon::STrib_cdnNotPt_nv_V4:
1111 case Hexagon::STrib_indexed_cPt_nv_V4:
1112 case Hexagon::STrib_indexed_cdnPt_nv_V4:
1113 case Hexagon::STrib_indexed_cNotPt_nv_V4:
1114 case Hexagon::STrib_indexed_cdnNotPt_nv_V4:
1115 case Hexagon::STrib_indexed_shl_cPt_nv_V4:
1116 case Hexagon::STrib_indexed_shl_cdnPt_nv_V4:
1117 case Hexagon::STrib_indexed_shl_cNotPt_nv_V4:
1118 case Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4:
1119 case Hexagon::POST_STbri_cPt_nv_V4:
1120 case Hexagon::POST_STbri_cdnPt_nv_V4:
1121 case Hexagon::POST_STbri_cNotPt_nv_V4:
1122 case Hexagon::POST_STbri_cdnNotPt_nv_V4:
1123 case Hexagon::STb_GP_cPt_nv_V4:
1124 case Hexagon::STb_GP_cNotPt_nv_V4:
1125 case Hexagon::STb_GP_cdnPt_nv_V4:
1126 case Hexagon::STb_GP_cdnNotPt_nv_V4:
1127 case Hexagon::STrib_GP_cPt_nv_V4:
1128 case Hexagon::STrib_GP_cNotPt_nv_V4:
1129 case Hexagon::STrib_GP_cdnPt_nv_V4:
1130 case Hexagon::STrib_GP_cdnNotPt_nv_V4:
1131 case Hexagon::STrib_abs_nv_V4:
1132 case Hexagon::STrib_abs_cPt_nv_V4:
1133 case Hexagon::STrib_abs_cdnPt_nv_V4:
1134 case Hexagon::STrib_abs_cNotPt_nv_V4:
1135 case Hexagon::STrib_abs_cdnNotPt_nv_V4:
1136 case Hexagon::STrib_imm_abs_nv_V4:
1137 case Hexagon::STrib_imm_abs_cPt_nv_V4:
1138 case Hexagon::STrib_imm_abs_cdnPt_nv_V4:
1139 case Hexagon::STrib_imm_abs_cNotPt_nv_V4:
1140 case Hexagon::STrib_imm_abs_cdnNotPt_nv_V4:
1143 case Hexagon::STrih_nv_V4:
1144 case Hexagon::STrih_indexed_nv_V4:
1145 case Hexagon::STrih_indexed_shl_nv_V4:
1146 case Hexagon::STrih_shl_nv_V4:
1147 case Hexagon::STrih_GP_nv_V4:
1148 case Hexagon::STh_GP_nv_V4:
1149 case Hexagon::POST_SThri_nv_V4:
1150 case Hexagon::STrih_cPt_nv_V4:
1151 case Hexagon::STrih_cdnPt_nv_V4:
1152 case Hexagon::STrih_cNotPt_nv_V4:
1153 case Hexagon::STrih_cdnNotPt_nv_V4:
1154 case Hexagon::STrih_indexed_cPt_nv_V4:
1155 case Hexagon::STrih_indexed_cdnPt_nv_V4:
1156 case Hexagon::STrih_indexed_cNotPt_nv_V4:
1157 case Hexagon::STrih_indexed_cdnNotPt_nv_V4:
1158 case Hexagon::STrih_indexed_shl_cPt_nv_V4:
1159 case Hexagon::STrih_indexed_shl_cdnPt_nv_V4:
1160 case Hexagon::STrih_indexed_shl_cNotPt_nv_V4:
1161 case Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4:
1162 case Hexagon::POST_SThri_cPt_nv_V4:
1163 case Hexagon::POST_SThri_cdnPt_nv_V4:
1164 case Hexagon::POST_SThri_cNotPt_nv_V4:
1165 case Hexagon::POST_SThri_cdnNotPt_nv_V4:
1166 case Hexagon::STh_GP_cPt_nv_V4:
1167 case Hexagon::STh_GP_cNotPt_nv_V4:
1168 case Hexagon::STh_GP_cdnPt_nv_V4:
1169 case Hexagon::STh_GP_cdnNotPt_nv_V4:
1170 case Hexagon::STrih_GP_cPt_nv_V4:
1171 case Hexagon::STrih_GP_cNotPt_nv_V4:
1172 case Hexagon::STrih_GP_cdnPt_nv_V4:
1173 case Hexagon::STrih_GP_cdnNotPt_nv_V4:
1174 case Hexagon::STrih_abs_nv_V4:
1175 case Hexagon::STrih_abs_cPt_nv_V4:
1176 case Hexagon::STrih_abs_cdnPt_nv_V4:
1177 case Hexagon::STrih_abs_cNotPt_nv_V4:
1178 case Hexagon::STrih_abs_cdnNotPt_nv_V4:
1179 case Hexagon::STrih_imm_abs_nv_V4:
1180 case Hexagon::STrih_imm_abs_cPt_nv_V4:
1181 case Hexagon::STrih_imm_abs_cdnPt_nv_V4:
1182 case Hexagon::STrih_imm_abs_cNotPt_nv_V4:
1183 case Hexagon::STrih_imm_abs_cdnNotPt_nv_V4:
1186 case Hexagon::STriw_nv_V4:
1187 case Hexagon::STriw_indexed_nv_V4:
1188 case Hexagon::STriw_indexed_shl_nv_V4:
1189 case Hexagon::STriw_shl_nv_V4:
1190 case Hexagon::STriw_GP_nv_V4:
1191 case Hexagon::STw_GP_nv_V4:
1192 case Hexagon::POST_STwri_nv_V4:
1193 case Hexagon::STriw_cPt_nv_V4:
1194 case Hexagon::STriw_cdnPt_nv_V4:
1195 case Hexagon::STriw_cNotPt_nv_V4:
1196 case Hexagon::STriw_cdnNotPt_nv_V4:
1197 case Hexagon::STriw_indexed_cPt_nv_V4:
1198 case Hexagon::STriw_indexed_cdnPt_nv_V4:
1199 case Hexagon::STriw_indexed_cNotPt_nv_V4:
1200 case Hexagon::STriw_indexed_cdnNotPt_nv_V4:
1201 case Hexagon::STriw_indexed_shl_cPt_nv_V4:
1202 case Hexagon::STriw_indexed_shl_cdnPt_nv_V4:
1203 case Hexagon::STriw_indexed_shl_cNotPt_nv_V4:
1204 case Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4:
1205 case Hexagon::POST_STwri_cPt_nv_V4:
1206 case Hexagon::POST_STwri_cdnPt_nv_V4:
1207 case Hexagon::POST_STwri_cNotPt_nv_V4:
1208 case Hexagon::POST_STwri_cdnNotPt_nv_V4:
1209 case Hexagon::STw_GP_cPt_nv_V4:
1210 case Hexagon::STw_GP_cNotPt_nv_V4:
1211 case Hexagon::STw_GP_cdnPt_nv_V4:
1212 case Hexagon::STw_GP_cdnNotPt_nv_V4:
1213 case Hexagon::STriw_GP_cPt_nv_V4:
1214 case Hexagon::STriw_GP_cNotPt_nv_V4:
1215 case Hexagon::STriw_GP_cdnPt_nv_V4:
1216 case Hexagon::STriw_GP_cdnNotPt_nv_V4:
1217 case Hexagon::STriw_abs_nv_V4:
1218 case Hexagon::STriw_abs_cPt_nv_V4:
1219 case Hexagon::STriw_abs_cdnPt_nv_V4:
1220 case Hexagon::STriw_abs_cNotPt_nv_V4:
1221 case Hexagon::STriw_abs_cdnNotPt_nv_V4:
1222 case Hexagon::STriw_imm_abs_nv_V4:
1223 case Hexagon::STriw_imm_abs_cPt_nv_V4:
1224 case Hexagon::STriw_imm_abs_cdnPt_nv_V4:
1225 case Hexagon::STriw_imm_abs_cNotPt_nv_V4:
1226 case Hexagon::STriw_imm_abs_cdnNotPt_nv_V4:
1231 bool HexagonInstrInfo::isPostIncrement (const MachineInstr* MI) const {
1232 switch (MI->getOpcode())
1234 default: return false;
1236 case Hexagon::POST_LDrib:
1237 case Hexagon::POST_LDrib_cPt:
1238 case Hexagon::POST_LDrib_cNotPt:
1239 case Hexagon::POST_LDrib_cdnPt_V4:
1240 case Hexagon::POST_LDrib_cdnNotPt_V4:
1242 // Load unsigned byte
1243 case Hexagon::POST_LDriub:
1244 case Hexagon::POST_LDriub_cPt:
1245 case Hexagon::POST_LDriub_cNotPt:
1246 case Hexagon::POST_LDriub_cdnPt_V4:
1247 case Hexagon::POST_LDriub_cdnNotPt_V4:
1250 case Hexagon::POST_LDrih:
1251 case Hexagon::POST_LDrih_cPt:
1252 case Hexagon::POST_LDrih_cNotPt:
1253 case Hexagon::POST_LDrih_cdnPt_V4:
1254 case Hexagon::POST_LDrih_cdnNotPt_V4:
1256 // Load unsigned halfword
1257 case Hexagon::POST_LDriuh:
1258 case Hexagon::POST_LDriuh_cPt:
1259 case Hexagon::POST_LDriuh_cNotPt:
1260 case Hexagon::POST_LDriuh_cdnPt_V4:
1261 case Hexagon::POST_LDriuh_cdnNotPt_V4:
1264 case Hexagon::POST_LDriw:
1265 case Hexagon::POST_LDriw_cPt:
1266 case Hexagon::POST_LDriw_cNotPt:
1267 case Hexagon::POST_LDriw_cdnPt_V4:
1268 case Hexagon::POST_LDriw_cdnNotPt_V4:
1271 case Hexagon::POST_LDrid:
1272 case Hexagon::POST_LDrid_cPt:
1273 case Hexagon::POST_LDrid_cNotPt:
1274 case Hexagon::POST_LDrid_cdnPt_V4:
1275 case Hexagon::POST_LDrid_cdnNotPt_V4:
1278 case Hexagon::POST_STbri:
1279 case Hexagon::POST_STbri_cPt:
1280 case Hexagon::POST_STbri_cNotPt:
1281 case Hexagon::POST_STbri_cdnPt_V4:
1282 case Hexagon::POST_STbri_cdnNotPt_V4:
1285 case Hexagon::POST_SThri:
1286 case Hexagon::POST_SThri_cPt:
1287 case Hexagon::POST_SThri_cNotPt:
1288 case Hexagon::POST_SThri_cdnPt_V4:
1289 case Hexagon::POST_SThri_cdnNotPt_V4:
1292 case Hexagon::POST_STwri:
1293 case Hexagon::POST_STwri_cPt:
1294 case Hexagon::POST_STwri_cNotPt:
1295 case Hexagon::POST_STwri_cdnPt_V4:
1296 case Hexagon::POST_STwri_cdnNotPt_V4:
1298 // Store double word
1299 case Hexagon::POST_STdri:
1300 case Hexagon::POST_STdri_cPt:
1301 case Hexagon::POST_STdri_cNotPt:
1302 case Hexagon::POST_STdri_cdnPt_V4:
1303 case Hexagon::POST_STdri_cdnNotPt_V4:
1308 bool HexagonInstrInfo::isSaveCalleeSavedRegsCall(const MachineInstr *MI) const {
1309 return MI->getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4;
1312 bool HexagonInstrInfo::isPredicable(MachineInstr *MI) const {
1313 bool isPred = MI->getDesc().isPredicable();
1318 const int Opc = MI->getOpcode();
1319 int NumOperands = MI->getNumOperands();
1321 // Keep a flag for upto 4 operands in the instructions, to indicate if
1322 // that operand has been constant extended.
1323 bool OpCExtended[4];
1324 if (NumOperands > 4)
1327 for (int i=0; i<NumOperands; i++)
1328 OpCExtended[i] = (HexagonConstExt::isOperandExtended(Opc, 1) &&
1329 isConstExtended(MI));
1333 // Return true if MI is constant extended as predicated form will also be
1334 // extended so immediate value doesn't have to fit within range.
1335 return OpCExtended[1] || isInt<12>(MI->getOperand(1).getImm());
1337 case Hexagon::STrid:
1338 case Hexagon::STrid_indexed:
1339 return OpCExtended[1] || isShiftedUInt<6,3>(MI->getOperand(1).getImm());
1341 case Hexagon::STriw:
1342 case Hexagon::STriw_indexed:
1343 case Hexagon::STriw_nv_V4:
1344 return OpCExtended[1] || isShiftedUInt<6,2>(MI->getOperand(1).getImm());
1346 case Hexagon::STrih:
1347 case Hexagon::STrih_indexed:
1348 case Hexagon::STrih_nv_V4:
1349 return OpCExtended[1] || isShiftedUInt<6,1>(MI->getOperand(1).getImm());
1351 case Hexagon::STrib:
1352 case Hexagon::STrib_indexed:
1353 case Hexagon::STrib_nv_V4:
1354 return OpCExtended[1] || isUInt<6>(MI->getOperand(1).getImm());
1356 case Hexagon::LDrid:
1357 case Hexagon::LDrid_indexed:
1358 return OpCExtended[2] || isShiftedUInt<6,3>(MI->getOperand(2).getImm());
1360 case Hexagon::LDriw:
1361 case Hexagon::LDriw_indexed:
1362 return OpCExtended[2] || isShiftedUInt<6,2>(MI->getOperand(2).getImm());
1364 case Hexagon::LDrih:
1365 case Hexagon::LDriuh:
1366 case Hexagon::LDrih_indexed:
1367 case Hexagon::LDriuh_indexed:
1368 return OpCExtended[2] || isShiftedUInt<6,1>(MI->getOperand(2).getImm());
1370 case Hexagon::LDrib:
1371 case Hexagon::LDriub:
1372 case Hexagon::LDrib_indexed:
1373 case Hexagon::LDriub_indexed:
1374 return OpCExtended[2] || isUInt<6>(MI->getOperand(2).getImm());
1376 case Hexagon::POST_LDrid:
1377 return OpCExtended[3] || isShiftedInt<4,3>(MI->getOperand(3).getImm());
1379 case Hexagon::POST_LDriw:
1380 return OpCExtended[3] || isShiftedInt<4,2>(MI->getOperand(3).getImm());
1382 case Hexagon::POST_LDrih:
1383 case Hexagon::POST_LDriuh:
1384 return OpCExtended[3] || isShiftedInt<4,1>(MI->getOperand(3).getImm());
1386 case Hexagon::POST_LDrib:
1387 case Hexagon::POST_LDriub:
1388 return OpCExtended[3] || isInt<4>(MI->getOperand(3).getImm());
1390 case Hexagon::STrib_imm_V4:
1391 case Hexagon::STrih_imm_V4:
1392 case Hexagon::STriw_imm_V4:
1393 return ((OpCExtended[1] || isUInt<6>(MI->getOperand(1).getImm())) &&
1394 (OpCExtended[2] || isInt<6>(MI->getOperand(2).getImm())));
1396 case Hexagon::ADD_ri:
1397 return OpCExtended[2] || isInt<8>(MI->getOperand(2).getImm());
1405 return Subtarget.hasV4TOps();
1414 // This function performs the following inversiones:
1419 // however, these inversiones are NOT included:
1421 // cdnPt -X-> cdnNotPt
1422 // cdnNotPt -X-> cdnPt
1423 // cPt_nv -X-> cNotPt_nv (new value stores)
1424 // cNotPt_nv -X-> cPt_nv (new value stores)
1426 // because only the following transformations are allowed:
1428 // cNotPt ---> cdnNotPt
1430 // cNotPt ---> cNotPt_nv
1432 unsigned HexagonInstrInfo::getInvertedPredicatedOpcode(const int Opc) const {
1434 default: llvm_unreachable("Unexpected predicated instruction");
1435 case Hexagon::TFR_cPt:
1436 return Hexagon::TFR_cNotPt;
1437 case Hexagon::TFR_cNotPt:
1438 return Hexagon::TFR_cPt;
1440 case Hexagon::TFRI_cPt:
1441 return Hexagon::TFRI_cNotPt;
1442 case Hexagon::TFRI_cNotPt:
1443 return Hexagon::TFRI_cPt;
1445 case Hexagon::JMP_c:
1446 return Hexagon::JMP_cNot;
1447 case Hexagon::JMP_cNot:
1448 return Hexagon::JMP_c;
1450 case Hexagon::ADD_ri_cPt:
1451 return Hexagon::ADD_ri_cNotPt;
1452 case Hexagon::ADD_ri_cNotPt:
1453 return Hexagon::ADD_ri_cPt;
1455 case Hexagon::ADD_rr_cPt:
1456 return Hexagon::ADD_rr_cNotPt;
1457 case Hexagon::ADD_rr_cNotPt:
1458 return Hexagon::ADD_rr_cPt;
1460 case Hexagon::XOR_rr_cPt:
1461 return Hexagon::XOR_rr_cNotPt;
1462 case Hexagon::XOR_rr_cNotPt:
1463 return Hexagon::XOR_rr_cPt;
1465 case Hexagon::AND_rr_cPt:
1466 return Hexagon::AND_rr_cNotPt;
1467 case Hexagon::AND_rr_cNotPt:
1468 return Hexagon::AND_rr_cPt;
1470 case Hexagon::OR_rr_cPt:
1471 return Hexagon::OR_rr_cNotPt;
1472 case Hexagon::OR_rr_cNotPt:
1473 return Hexagon::OR_rr_cPt;
1475 case Hexagon::SUB_rr_cPt:
1476 return Hexagon::SUB_rr_cNotPt;
1477 case Hexagon::SUB_rr_cNotPt:
1478 return Hexagon::SUB_rr_cPt;
1480 case Hexagon::COMBINE_rr_cPt:
1481 return Hexagon::COMBINE_rr_cNotPt;
1482 case Hexagon::COMBINE_rr_cNotPt:
1483 return Hexagon::COMBINE_rr_cPt;
1485 case Hexagon::ASLH_cPt_V4:
1486 return Hexagon::ASLH_cNotPt_V4;
1487 case Hexagon::ASLH_cNotPt_V4:
1488 return Hexagon::ASLH_cPt_V4;
1490 case Hexagon::ASRH_cPt_V4:
1491 return Hexagon::ASRH_cNotPt_V4;
1492 case Hexagon::ASRH_cNotPt_V4:
1493 return Hexagon::ASRH_cPt_V4;
1495 case Hexagon::SXTB_cPt_V4:
1496 return Hexagon::SXTB_cNotPt_V4;
1497 case Hexagon::SXTB_cNotPt_V4:
1498 return Hexagon::SXTB_cPt_V4;
1500 case Hexagon::SXTH_cPt_V4:
1501 return Hexagon::SXTH_cNotPt_V4;
1502 case Hexagon::SXTH_cNotPt_V4:
1503 return Hexagon::SXTH_cPt_V4;
1505 case Hexagon::ZXTB_cPt_V4:
1506 return Hexagon::ZXTB_cNotPt_V4;
1507 case Hexagon::ZXTB_cNotPt_V4:
1508 return Hexagon::ZXTB_cPt_V4;
1510 case Hexagon::ZXTH_cPt_V4:
1511 return Hexagon::ZXTH_cNotPt_V4;
1512 case Hexagon::ZXTH_cNotPt_V4:
1513 return Hexagon::ZXTH_cPt_V4;
1516 case Hexagon::JMPR_cPt:
1517 return Hexagon::JMPR_cNotPt;
1518 case Hexagon::JMPR_cNotPt:
1519 return Hexagon::JMPR_cPt;
1521 // V4 indexed+scaled load.
1522 case Hexagon::LDrid_indexed_cPt_V4:
1523 return Hexagon::LDrid_indexed_cNotPt_V4;
1524 case Hexagon::LDrid_indexed_cNotPt_V4:
1525 return Hexagon::LDrid_indexed_cPt_V4;
1527 case Hexagon::LDrid_indexed_shl_cPt_V4:
1528 return Hexagon::LDrid_indexed_shl_cNotPt_V4;
1529 case Hexagon::LDrid_indexed_shl_cNotPt_V4:
1530 return Hexagon::LDrid_indexed_shl_cPt_V4;
1532 case Hexagon::LDrib_indexed_cPt_V4:
1533 return Hexagon::LDrib_indexed_cNotPt_V4;
1534 case Hexagon::LDrib_indexed_cNotPt_V4:
1535 return Hexagon::LDrib_indexed_cPt_V4;
1537 case Hexagon::LDriub_indexed_cPt_V4:
1538 return Hexagon::LDriub_indexed_cNotPt_V4;
1539 case Hexagon::LDriub_indexed_cNotPt_V4:
1540 return Hexagon::LDriub_indexed_cPt_V4;
1542 case Hexagon::LDrib_indexed_shl_cPt_V4:
1543 return Hexagon::LDrib_indexed_shl_cNotPt_V4;
1544 case Hexagon::LDrib_indexed_shl_cNotPt_V4:
1545 return Hexagon::LDrib_indexed_shl_cPt_V4;
1547 case Hexagon::LDriub_indexed_shl_cPt_V4:
1548 return Hexagon::LDriub_indexed_shl_cNotPt_V4;
1549 case Hexagon::LDriub_indexed_shl_cNotPt_V4:
1550 return Hexagon::LDriub_indexed_shl_cPt_V4;
1552 case Hexagon::LDrih_indexed_cPt_V4:
1553 return Hexagon::LDrih_indexed_cNotPt_V4;
1554 case Hexagon::LDrih_indexed_cNotPt_V4:
1555 return Hexagon::LDrih_indexed_cPt_V4;
1557 case Hexagon::LDriuh_indexed_cPt_V4:
1558 return Hexagon::LDriuh_indexed_cNotPt_V4;
1559 case Hexagon::LDriuh_indexed_cNotPt_V4:
1560 return Hexagon::LDriuh_indexed_cPt_V4;
1562 case Hexagon::LDrih_indexed_shl_cPt_V4:
1563 return Hexagon::LDrih_indexed_shl_cNotPt_V4;
1564 case Hexagon::LDrih_indexed_shl_cNotPt_V4:
1565 return Hexagon::LDrih_indexed_shl_cPt_V4;
1567 case Hexagon::LDriuh_indexed_shl_cPt_V4:
1568 return Hexagon::LDriuh_indexed_shl_cNotPt_V4;
1569 case Hexagon::LDriuh_indexed_shl_cNotPt_V4:
1570 return Hexagon::LDriuh_indexed_shl_cPt_V4;
1572 case Hexagon::LDriw_indexed_cPt_V4:
1573 return Hexagon::LDriw_indexed_cNotPt_V4;
1574 case Hexagon::LDriw_indexed_cNotPt_V4:
1575 return Hexagon::LDriw_indexed_cPt_V4;
1577 case Hexagon::LDriw_indexed_shl_cPt_V4:
1578 return Hexagon::LDriw_indexed_shl_cNotPt_V4;
1579 case Hexagon::LDriw_indexed_shl_cNotPt_V4:
1580 return Hexagon::LDriw_indexed_shl_cPt_V4;
1583 case Hexagon::POST_STbri_cPt:
1584 return Hexagon::POST_STbri_cNotPt;
1585 case Hexagon::POST_STbri_cNotPt:
1586 return Hexagon::POST_STbri_cPt;
1588 case Hexagon::STrib_cPt:
1589 return Hexagon::STrib_cNotPt;
1590 case Hexagon::STrib_cNotPt:
1591 return Hexagon::STrib_cPt;
1593 case Hexagon::STrib_indexed_cPt:
1594 return Hexagon::STrib_indexed_cNotPt;
1595 case Hexagon::STrib_indexed_cNotPt:
1596 return Hexagon::STrib_indexed_cPt;
1598 case Hexagon::STrib_imm_cPt_V4:
1599 return Hexagon::STrib_imm_cNotPt_V4;
1600 case Hexagon::STrib_imm_cNotPt_V4:
1601 return Hexagon::STrib_imm_cPt_V4;
1603 case Hexagon::STrib_indexed_shl_cPt_V4:
1604 return Hexagon::STrib_indexed_shl_cNotPt_V4;
1605 case Hexagon::STrib_indexed_shl_cNotPt_V4:
1606 return Hexagon::STrib_indexed_shl_cPt_V4;
1609 case Hexagon::POST_SThri_cPt:
1610 return Hexagon::POST_SThri_cNotPt;
1611 case Hexagon::POST_SThri_cNotPt:
1612 return Hexagon::POST_SThri_cPt;
1614 case Hexagon::STrih_cPt:
1615 return Hexagon::STrih_cNotPt;
1616 case Hexagon::STrih_cNotPt:
1617 return Hexagon::STrih_cPt;
1619 case Hexagon::STrih_indexed_cPt:
1620 return Hexagon::STrih_indexed_cNotPt;
1621 case Hexagon::STrih_indexed_cNotPt:
1622 return Hexagon::STrih_indexed_cPt;
1624 case Hexagon::STrih_imm_cPt_V4:
1625 return Hexagon::STrih_imm_cNotPt_V4;
1626 case Hexagon::STrih_imm_cNotPt_V4:
1627 return Hexagon::STrih_imm_cPt_V4;
1629 case Hexagon::STrih_indexed_shl_cPt_V4:
1630 return Hexagon::STrih_indexed_shl_cNotPt_V4;
1631 case Hexagon::STrih_indexed_shl_cNotPt_V4:
1632 return Hexagon::STrih_indexed_shl_cPt_V4;
1635 case Hexagon::POST_STwri_cPt:
1636 return Hexagon::POST_STwri_cNotPt;
1637 case Hexagon::POST_STwri_cNotPt:
1638 return Hexagon::POST_STwri_cPt;
1640 case Hexagon::STriw_cPt:
1641 return Hexagon::STriw_cNotPt;
1642 case Hexagon::STriw_cNotPt:
1643 return Hexagon::STriw_cPt;
1645 case Hexagon::STriw_indexed_cPt:
1646 return Hexagon::STriw_indexed_cNotPt;
1647 case Hexagon::STriw_indexed_cNotPt:
1648 return Hexagon::STriw_indexed_cPt;
1650 case Hexagon::STriw_indexed_shl_cPt_V4:
1651 return Hexagon::STriw_indexed_shl_cNotPt_V4;
1652 case Hexagon::STriw_indexed_shl_cNotPt_V4:
1653 return Hexagon::STriw_indexed_shl_cPt_V4;
1655 case Hexagon::STriw_imm_cPt_V4:
1656 return Hexagon::STriw_imm_cNotPt_V4;
1657 case Hexagon::STriw_imm_cNotPt_V4:
1658 return Hexagon::STriw_imm_cPt_V4;
1661 case Hexagon::POST_STdri_cPt:
1662 return Hexagon::POST_STdri_cNotPt;
1663 case Hexagon::POST_STdri_cNotPt:
1664 return Hexagon::POST_STdri_cPt;
1666 case Hexagon::STrid_cPt:
1667 return Hexagon::STrid_cNotPt;
1668 case Hexagon::STrid_cNotPt:
1669 return Hexagon::STrid_cPt;
1671 case Hexagon::STrid_indexed_cPt:
1672 return Hexagon::STrid_indexed_cNotPt;
1673 case Hexagon::STrid_indexed_cNotPt:
1674 return Hexagon::STrid_indexed_cPt;
1676 case Hexagon::STrid_indexed_shl_cPt_V4:
1677 return Hexagon::STrid_indexed_shl_cNotPt_V4;
1678 case Hexagon::STrid_indexed_shl_cNotPt_V4:
1679 return Hexagon::STrid_indexed_shl_cPt_V4;
1681 // V4 Store to global address.
1682 case Hexagon::STd_GP_cPt_V4:
1683 return Hexagon::STd_GP_cNotPt_V4;
1684 case Hexagon::STd_GP_cNotPt_V4:
1685 return Hexagon::STd_GP_cPt_V4;
1687 case Hexagon::STb_GP_cPt_V4:
1688 return Hexagon::STb_GP_cNotPt_V4;
1689 case Hexagon::STb_GP_cNotPt_V4:
1690 return Hexagon::STb_GP_cPt_V4;
1692 case Hexagon::STh_GP_cPt_V4:
1693 return Hexagon::STh_GP_cNotPt_V4;
1694 case Hexagon::STh_GP_cNotPt_V4:
1695 return Hexagon::STh_GP_cPt_V4;
1697 case Hexagon::STw_GP_cPt_V4:
1698 return Hexagon::STw_GP_cNotPt_V4;
1699 case Hexagon::STw_GP_cNotPt_V4:
1700 return Hexagon::STw_GP_cPt_V4;
1702 case Hexagon::STrid_GP_cPt_V4:
1703 return Hexagon::STrid_GP_cNotPt_V4;
1704 case Hexagon::STrid_GP_cNotPt_V4:
1705 return Hexagon::STrid_GP_cPt_V4;
1707 case Hexagon::STrib_GP_cPt_V4:
1708 return Hexagon::STrib_GP_cNotPt_V4;
1709 case Hexagon::STrib_GP_cNotPt_V4:
1710 return Hexagon::STrib_GP_cPt_V4;
1712 case Hexagon::STrih_GP_cPt_V4:
1713 return Hexagon::STrih_GP_cNotPt_V4;
1714 case Hexagon::STrih_GP_cNotPt_V4:
1715 return Hexagon::STrih_GP_cPt_V4;
1717 case Hexagon::STriw_GP_cPt_V4:
1718 return Hexagon::STriw_GP_cNotPt_V4;
1719 case Hexagon::STriw_GP_cNotPt_V4:
1720 return Hexagon::STriw_GP_cPt_V4;
1723 case Hexagon::LDrid_cPt:
1724 return Hexagon::LDrid_cNotPt;
1725 case Hexagon::LDrid_cNotPt:
1726 return Hexagon::LDrid_cPt;
1728 case Hexagon::LDriw_cPt:
1729 return Hexagon::LDriw_cNotPt;
1730 case Hexagon::LDriw_cNotPt:
1731 return Hexagon::LDriw_cPt;
1733 case Hexagon::LDrih_cPt:
1734 return Hexagon::LDrih_cNotPt;
1735 case Hexagon::LDrih_cNotPt:
1736 return Hexagon::LDrih_cPt;
1738 case Hexagon::LDriuh_cPt:
1739 return Hexagon::LDriuh_cNotPt;
1740 case Hexagon::LDriuh_cNotPt:
1741 return Hexagon::LDriuh_cPt;
1743 case Hexagon::LDrib_cPt:
1744 return Hexagon::LDrib_cNotPt;
1745 case Hexagon::LDrib_cNotPt:
1746 return Hexagon::LDrib_cPt;
1748 case Hexagon::LDriub_cPt:
1749 return Hexagon::LDriub_cNotPt;
1750 case Hexagon::LDriub_cNotPt:
1751 return Hexagon::LDriub_cPt;
1754 case Hexagon::LDrid_indexed_cPt:
1755 return Hexagon::LDrid_indexed_cNotPt;
1756 case Hexagon::LDrid_indexed_cNotPt:
1757 return Hexagon::LDrid_indexed_cPt;
1759 case Hexagon::LDriw_indexed_cPt:
1760 return Hexagon::LDriw_indexed_cNotPt;
1761 case Hexagon::LDriw_indexed_cNotPt:
1762 return Hexagon::LDriw_indexed_cPt;
1764 case Hexagon::LDrih_indexed_cPt:
1765 return Hexagon::LDrih_indexed_cNotPt;
1766 case Hexagon::LDrih_indexed_cNotPt:
1767 return Hexagon::LDrih_indexed_cPt;
1769 case Hexagon::LDriuh_indexed_cPt:
1770 return Hexagon::LDriuh_indexed_cNotPt;
1771 case Hexagon::LDriuh_indexed_cNotPt:
1772 return Hexagon::LDriuh_indexed_cPt;
1774 case Hexagon::LDrib_indexed_cPt:
1775 return Hexagon::LDrib_indexed_cNotPt;
1776 case Hexagon::LDrib_indexed_cNotPt:
1777 return Hexagon::LDrib_indexed_cPt;
1779 case Hexagon::LDriub_indexed_cPt:
1780 return Hexagon::LDriub_indexed_cNotPt;
1781 case Hexagon::LDriub_indexed_cNotPt:
1782 return Hexagon::LDriub_indexed_cPt;
1785 case Hexagon::POST_LDrid_cPt:
1786 return Hexagon::POST_LDrid_cNotPt;
1787 case Hexagon::POST_LDriw_cNotPt:
1788 return Hexagon::POST_LDriw_cPt;
1790 case Hexagon::POST_LDrih_cPt:
1791 return Hexagon::POST_LDrih_cNotPt;
1792 case Hexagon::POST_LDrih_cNotPt:
1793 return Hexagon::POST_LDrih_cPt;
1795 case Hexagon::POST_LDriuh_cPt:
1796 return Hexagon::POST_LDriuh_cNotPt;
1797 case Hexagon::POST_LDriuh_cNotPt:
1798 return Hexagon::POST_LDriuh_cPt;
1800 case Hexagon::POST_LDrib_cPt:
1801 return Hexagon::POST_LDrib_cNotPt;
1802 case Hexagon::POST_LDrib_cNotPt:
1803 return Hexagon::POST_LDrib_cPt;
1805 case Hexagon::POST_LDriub_cPt:
1806 return Hexagon::POST_LDriub_cNotPt;
1807 case Hexagon::POST_LDriub_cNotPt:
1808 return Hexagon::POST_LDriub_cPt;
1811 case Hexagon::DEALLOC_RET_cPt_V4:
1812 return Hexagon::DEALLOC_RET_cNotPt_V4;
1813 case Hexagon::DEALLOC_RET_cNotPt_V4:
1814 return Hexagon::DEALLOC_RET_cPt_V4;
1817 // JMPEQ_ri - with -1.
1818 case Hexagon::JMP_EQriPtneg_nv_V4:
1819 return Hexagon::JMP_EQriNotPtneg_nv_V4;
1820 case Hexagon::JMP_EQriNotPtneg_nv_V4:
1821 return Hexagon::JMP_EQriPtneg_nv_V4;
1823 case Hexagon::JMP_EQriPntneg_nv_V4:
1824 return Hexagon::JMP_EQriNotPntneg_nv_V4;
1825 case Hexagon::JMP_EQriNotPntneg_nv_V4:
1826 return Hexagon::JMP_EQriPntneg_nv_V4;
1829 case Hexagon::JMP_EQriPt_nv_V4:
1830 return Hexagon::JMP_EQriNotPt_nv_V4;
1831 case Hexagon::JMP_EQriNotPt_nv_V4:
1832 return Hexagon::JMP_EQriPt_nv_V4;
1834 case Hexagon::JMP_EQriPnt_nv_V4:
1835 return Hexagon::JMP_EQriNotPnt_nv_V4;
1836 case Hexagon::JMP_EQriNotPnt_nv_V4:
1837 return Hexagon::JMP_EQriPnt_nv_V4;
1840 case Hexagon::JMP_EQrrPt_nv_V4:
1841 return Hexagon::JMP_EQrrNotPt_nv_V4;
1842 case Hexagon::JMP_EQrrNotPt_nv_V4:
1843 return Hexagon::JMP_EQrrPt_nv_V4;
1845 case Hexagon::JMP_EQrrPnt_nv_V4:
1846 return Hexagon::JMP_EQrrNotPnt_nv_V4;
1847 case Hexagon::JMP_EQrrNotPnt_nv_V4:
1848 return Hexagon::JMP_EQrrPnt_nv_V4;
1850 // JMPGT_ri - with -1.
1851 case Hexagon::JMP_GTriPtneg_nv_V4:
1852 return Hexagon::JMP_GTriNotPtneg_nv_V4;
1853 case Hexagon::JMP_GTriNotPtneg_nv_V4:
1854 return Hexagon::JMP_GTriPtneg_nv_V4;
1856 case Hexagon::JMP_GTriPntneg_nv_V4:
1857 return Hexagon::JMP_GTriNotPntneg_nv_V4;
1858 case Hexagon::JMP_GTriNotPntneg_nv_V4:
1859 return Hexagon::JMP_GTriPntneg_nv_V4;
1862 case Hexagon::JMP_GTriPt_nv_V4:
1863 return Hexagon::JMP_GTriNotPt_nv_V4;
1864 case Hexagon::JMP_GTriNotPt_nv_V4:
1865 return Hexagon::JMP_GTriPt_nv_V4;
1867 case Hexagon::JMP_GTriPnt_nv_V4:
1868 return Hexagon::JMP_GTriNotPnt_nv_V4;
1869 case Hexagon::JMP_GTriNotPnt_nv_V4:
1870 return Hexagon::JMP_GTriPnt_nv_V4;
1873 case Hexagon::JMP_GTrrPt_nv_V4:
1874 return Hexagon::JMP_GTrrNotPt_nv_V4;
1875 case Hexagon::JMP_GTrrNotPt_nv_V4:
1876 return Hexagon::JMP_GTrrPt_nv_V4;
1878 case Hexagon::JMP_GTrrPnt_nv_V4:
1879 return Hexagon::JMP_GTrrNotPnt_nv_V4;
1880 case Hexagon::JMP_GTrrNotPnt_nv_V4:
1881 return Hexagon::JMP_GTrrPnt_nv_V4;
1884 case Hexagon::JMP_GTrrdnPt_nv_V4:
1885 return Hexagon::JMP_GTrrdnNotPt_nv_V4;
1886 case Hexagon::JMP_GTrrdnNotPt_nv_V4:
1887 return Hexagon::JMP_GTrrdnPt_nv_V4;
1889 case Hexagon::JMP_GTrrdnPnt_nv_V4:
1890 return Hexagon::JMP_GTrrdnNotPnt_nv_V4;
1891 case Hexagon::JMP_GTrrdnNotPnt_nv_V4:
1892 return Hexagon::JMP_GTrrdnPnt_nv_V4;
1895 case Hexagon::JMP_GTUriPt_nv_V4:
1896 return Hexagon::JMP_GTUriNotPt_nv_V4;
1897 case Hexagon::JMP_GTUriNotPt_nv_V4:
1898 return Hexagon::JMP_GTUriPt_nv_V4;
1900 case Hexagon::JMP_GTUriPnt_nv_V4:
1901 return Hexagon::JMP_GTUriNotPnt_nv_V4;
1902 case Hexagon::JMP_GTUriNotPnt_nv_V4:
1903 return Hexagon::JMP_GTUriPnt_nv_V4;
1906 case Hexagon::JMP_GTUrrPt_nv_V4:
1907 return Hexagon::JMP_GTUrrNotPt_nv_V4;
1908 case Hexagon::JMP_GTUrrNotPt_nv_V4:
1909 return Hexagon::JMP_GTUrrPt_nv_V4;
1911 case Hexagon::JMP_GTUrrPnt_nv_V4:
1912 return Hexagon::JMP_GTUrrNotPnt_nv_V4;
1913 case Hexagon::JMP_GTUrrNotPnt_nv_V4:
1914 return Hexagon::JMP_GTUrrPnt_nv_V4;
1917 case Hexagon::JMP_GTUrrdnPt_nv_V4:
1918 return Hexagon::JMP_GTUrrdnNotPt_nv_V4;
1919 case Hexagon::JMP_GTUrrdnNotPt_nv_V4:
1920 return Hexagon::JMP_GTUrrdnPt_nv_V4;
1922 case Hexagon::JMP_GTUrrdnPnt_nv_V4:
1923 return Hexagon::JMP_GTUrrdnNotPnt_nv_V4;
1924 case Hexagon::JMP_GTUrrdnNotPnt_nv_V4:
1925 return Hexagon::JMP_GTUrrdnPnt_nv_V4;
1930 int HexagonInstrInfo::
1931 getMatchingCondBranchOpcode(int Opc, bool invertPredicate) const {
1934 return !invertPredicate ? Hexagon::TFR_cPt :
1935 Hexagon::TFR_cNotPt;
1936 case Hexagon::TFRI_f:
1937 return !invertPredicate ? Hexagon::TFRI_cPt_f :
1938 Hexagon::TFRI_cNotPt_f;
1940 return !invertPredicate ? Hexagon::TFRI_cPt :
1941 Hexagon::TFRI_cNotPt;
1943 return !invertPredicate ? Hexagon::JMP_c :
1945 case Hexagon::JMP_EQrrPt_nv_V4:
1946 return !invertPredicate ? Hexagon::JMP_EQrrPt_nv_V4 :
1947 Hexagon::JMP_EQrrNotPt_nv_V4;
1948 case Hexagon::JMP_EQriPt_nv_V4:
1949 return !invertPredicate ? Hexagon::JMP_EQriPt_nv_V4 :
1950 Hexagon::JMP_EQriNotPt_nv_V4;
1951 case Hexagon::ADD_ri:
1952 return !invertPredicate ? Hexagon::ADD_ri_cPt :
1953 Hexagon::ADD_ri_cNotPt;
1954 case Hexagon::ADD_rr:
1955 return !invertPredicate ? Hexagon::ADD_rr_cPt :
1956 Hexagon::ADD_rr_cNotPt;
1957 case Hexagon::XOR_rr:
1958 return !invertPredicate ? Hexagon::XOR_rr_cPt :
1959 Hexagon::XOR_rr_cNotPt;
1960 case Hexagon::AND_rr:
1961 return !invertPredicate ? Hexagon::AND_rr_cPt :
1962 Hexagon::AND_rr_cNotPt;
1963 case Hexagon::OR_rr:
1964 return !invertPredicate ? Hexagon::OR_rr_cPt :
1965 Hexagon::OR_rr_cNotPt;
1966 case Hexagon::SUB_rr:
1967 return !invertPredicate ? Hexagon::SUB_rr_cPt :
1968 Hexagon::SUB_rr_cNotPt;
1969 case Hexagon::COMBINE_rr:
1970 return !invertPredicate ? Hexagon::COMBINE_rr_cPt :
1971 Hexagon::COMBINE_rr_cNotPt;
1973 return !invertPredicate ? Hexagon::ASLH_cPt_V4 :
1974 Hexagon::ASLH_cNotPt_V4;
1976 return !invertPredicate ? Hexagon::ASRH_cPt_V4 :
1977 Hexagon::ASRH_cNotPt_V4;
1979 return !invertPredicate ? Hexagon::SXTB_cPt_V4 :
1980 Hexagon::SXTB_cNotPt_V4;
1982 return !invertPredicate ? Hexagon::SXTH_cPt_V4 :
1983 Hexagon::SXTH_cNotPt_V4;
1985 return !invertPredicate ? Hexagon::ZXTB_cPt_V4 :
1986 Hexagon::ZXTB_cNotPt_V4;
1988 return !invertPredicate ? Hexagon::ZXTH_cPt_V4 :
1989 Hexagon::ZXTH_cNotPt_V4;
1992 return !invertPredicate ? Hexagon::JMPR_cPt :
1993 Hexagon::JMPR_cNotPt;
1995 // V4 indexed+scaled load.
1996 case Hexagon::LDrid_indexed_V4:
1997 return !invertPredicate ? Hexagon::LDrid_indexed_cPt_V4 :
1998 Hexagon::LDrid_indexed_cNotPt_V4;
1999 case Hexagon::LDrid_indexed_shl_V4:
2000 return !invertPredicate ? Hexagon::LDrid_indexed_shl_cPt_V4 :
2001 Hexagon::LDrid_indexed_shl_cNotPt_V4;
2002 case Hexagon::LDrib_indexed_V4:
2003 return !invertPredicate ? Hexagon::LDrib_indexed_cPt_V4 :
2004 Hexagon::LDrib_indexed_cNotPt_V4;
2005 case Hexagon::LDriub_indexed_V4:
2006 return !invertPredicate ? Hexagon::LDriub_indexed_cPt_V4 :
2007 Hexagon::LDriub_indexed_cNotPt_V4;
2008 case Hexagon::LDriub_ae_indexed_V4:
2009 return !invertPredicate ? Hexagon::LDriub_indexed_cPt_V4 :
2010 Hexagon::LDriub_indexed_cNotPt_V4;
2011 case Hexagon::LDrib_indexed_shl_V4:
2012 return !invertPredicate ? Hexagon::LDrib_indexed_shl_cPt_V4 :
2013 Hexagon::LDrib_indexed_shl_cNotPt_V4;
2014 case Hexagon::LDriub_indexed_shl_V4:
2015 return !invertPredicate ? Hexagon::LDriub_indexed_shl_cPt_V4 :
2016 Hexagon::LDriub_indexed_shl_cNotPt_V4;
2017 case Hexagon::LDriub_ae_indexed_shl_V4:
2018 return !invertPredicate ? Hexagon::LDriub_indexed_shl_cPt_V4 :
2019 Hexagon::LDriub_indexed_shl_cNotPt_V4;
2020 case Hexagon::LDrih_indexed_V4:
2021 return !invertPredicate ? Hexagon::LDrih_indexed_cPt_V4 :
2022 Hexagon::LDrih_indexed_cNotPt_V4;
2023 case Hexagon::LDriuh_indexed_V4:
2024 return !invertPredicate ? Hexagon::LDriuh_indexed_cPt_V4 :
2025 Hexagon::LDriuh_indexed_cNotPt_V4;
2026 case Hexagon::LDriuh_ae_indexed_V4:
2027 return !invertPredicate ? Hexagon::LDriuh_indexed_cPt_V4 :
2028 Hexagon::LDriuh_indexed_cNotPt_V4;
2029 case Hexagon::LDrih_indexed_shl_V4:
2030 return !invertPredicate ? Hexagon::LDrih_indexed_shl_cPt_V4 :
2031 Hexagon::LDrih_indexed_shl_cNotPt_V4;
2032 case Hexagon::LDriuh_indexed_shl_V4:
2033 return !invertPredicate ? Hexagon::LDriuh_indexed_shl_cPt_V4 :
2034 Hexagon::LDriuh_indexed_shl_cNotPt_V4;
2035 case Hexagon::LDriuh_ae_indexed_shl_V4:
2036 return !invertPredicate ? Hexagon::LDriuh_indexed_shl_cPt_V4 :
2037 Hexagon::LDriuh_indexed_shl_cNotPt_V4;
2038 case Hexagon::LDriw_indexed_V4:
2039 return !invertPredicate ? Hexagon::LDriw_indexed_cPt_V4 :
2040 Hexagon::LDriw_indexed_cNotPt_V4;
2041 case Hexagon::LDriw_indexed_shl_V4:
2042 return !invertPredicate ? Hexagon::LDriw_indexed_shl_cPt_V4 :
2043 Hexagon::LDriw_indexed_shl_cNotPt_V4;
2045 // V4 Load from global address
2046 case Hexagon::LDrid_GP_V4:
2047 return !invertPredicate ? Hexagon::LDrid_GP_cPt_V4 :
2048 Hexagon::LDrid_GP_cNotPt_V4;
2049 case Hexagon::LDrib_GP_V4:
2050 return !invertPredicate ? Hexagon::LDrib_GP_cPt_V4 :
2051 Hexagon::LDrib_GP_cNotPt_V4;
2052 case Hexagon::LDriub_GP_V4:
2053 return !invertPredicate ? Hexagon::LDriub_GP_cPt_V4 :
2054 Hexagon::LDriub_GP_cNotPt_V4;
2055 case Hexagon::LDrih_GP_V4:
2056 return !invertPredicate ? Hexagon::LDrih_GP_cPt_V4 :
2057 Hexagon::LDrih_GP_cNotPt_V4;
2058 case Hexagon::LDriuh_GP_V4:
2059 return !invertPredicate ? Hexagon::LDriuh_GP_cPt_V4 :
2060 Hexagon::LDriuh_GP_cNotPt_V4;
2061 case Hexagon::LDriw_GP_V4:
2062 return !invertPredicate ? Hexagon::LDriw_GP_cPt_V4 :
2063 Hexagon::LDriw_GP_cNotPt_V4;
2065 case Hexagon::LDd_GP_V4:
2066 return !invertPredicate ? Hexagon::LDd_GP_cPt_V4 :
2067 Hexagon::LDd_GP_cNotPt_V4;
2068 case Hexagon::LDb_GP_V4:
2069 return !invertPredicate ? Hexagon::LDb_GP_cPt_V4 :
2070 Hexagon::LDb_GP_cNotPt_V4;
2071 case Hexagon::LDub_GP_V4:
2072 return !invertPredicate ? Hexagon::LDub_GP_cPt_V4 :
2073 Hexagon::LDub_GP_cNotPt_V4;
2074 case Hexagon::LDh_GP_V4:
2075 return !invertPredicate ? Hexagon::LDh_GP_cPt_V4 :
2076 Hexagon::LDh_GP_cNotPt_V4;
2077 case Hexagon::LDuh_GP_V4:
2078 return !invertPredicate ? Hexagon::LDuh_GP_cPt_V4 :
2079 Hexagon::LDuh_GP_cNotPt_V4;
2080 case Hexagon::LDw_GP_V4:
2081 return !invertPredicate ? Hexagon::LDw_GP_cPt_V4 :
2082 Hexagon::LDw_GP_cNotPt_V4;
2085 case Hexagon::POST_STbri:
2086 return !invertPredicate ? Hexagon::POST_STbri_cPt :
2087 Hexagon::POST_STbri_cNotPt;
2088 case Hexagon::STrib:
2089 return !invertPredicate ? Hexagon::STrib_cPt :
2090 Hexagon::STrib_cNotPt;
2091 case Hexagon::STrib_indexed:
2092 return !invertPredicate ? Hexagon::STrib_indexed_cPt :
2093 Hexagon::STrib_indexed_cNotPt;
2094 case Hexagon::STrib_imm_V4:
2095 return !invertPredicate ? Hexagon::STrib_imm_cPt_V4 :
2096 Hexagon::STrib_imm_cNotPt_V4;
2097 case Hexagon::STrib_indexed_shl_V4:
2098 return !invertPredicate ? Hexagon::STrib_indexed_shl_cPt_V4 :
2099 Hexagon::STrib_indexed_shl_cNotPt_V4;
2101 case Hexagon::POST_SThri:
2102 return !invertPredicate ? Hexagon::POST_SThri_cPt :
2103 Hexagon::POST_SThri_cNotPt;
2104 case Hexagon::STrih:
2105 return !invertPredicate ? Hexagon::STrih_cPt :
2106 Hexagon::STrih_cNotPt;
2107 case Hexagon::STrih_indexed:
2108 return !invertPredicate ? Hexagon::STrih_indexed_cPt :
2109 Hexagon::STrih_indexed_cNotPt;
2110 case Hexagon::STrih_imm_V4:
2111 return !invertPredicate ? Hexagon::STrih_imm_cPt_V4 :
2112 Hexagon::STrih_imm_cNotPt_V4;
2113 case Hexagon::STrih_indexed_shl_V4:
2114 return !invertPredicate ? Hexagon::STrih_indexed_shl_cPt_V4 :
2115 Hexagon::STrih_indexed_shl_cNotPt_V4;
2117 case Hexagon::POST_STwri:
2118 return !invertPredicate ? Hexagon::POST_STwri_cPt :
2119 Hexagon::POST_STwri_cNotPt;
2120 case Hexagon::STriw:
2121 return !invertPredicate ? Hexagon::STriw_cPt :
2122 Hexagon::STriw_cNotPt;
2123 case Hexagon::STriw_indexed:
2124 return !invertPredicate ? Hexagon::STriw_indexed_cPt :
2125 Hexagon::STriw_indexed_cNotPt;
2126 case Hexagon::STriw_indexed_shl_V4:
2127 return !invertPredicate ? Hexagon::STriw_indexed_shl_cPt_V4 :
2128 Hexagon::STriw_indexed_shl_cNotPt_V4;
2129 case Hexagon::STriw_imm_V4:
2130 return !invertPredicate ? Hexagon::STriw_imm_cPt_V4 :
2131 Hexagon::STriw_imm_cNotPt_V4;
2133 case Hexagon::POST_STdri:
2134 return !invertPredicate ? Hexagon::POST_STdri_cPt :
2135 Hexagon::POST_STdri_cNotPt;
2136 case Hexagon::STrid:
2137 return !invertPredicate ? Hexagon::STrid_cPt :
2138 Hexagon::STrid_cNotPt;
2139 case Hexagon::STrid_indexed:
2140 return !invertPredicate ? Hexagon::STrid_indexed_cPt :
2141 Hexagon::STrid_indexed_cNotPt;
2142 case Hexagon::STrid_indexed_shl_V4:
2143 return !invertPredicate ? Hexagon::STrid_indexed_shl_cPt_V4 :
2144 Hexagon::STrid_indexed_shl_cNotPt_V4;
2146 // V4 Store to global address
2147 case Hexagon::STrid_GP_V4:
2148 return !invertPredicate ? Hexagon::STrid_GP_cPt_V4 :
2149 Hexagon::STrid_GP_cNotPt_V4;
2150 case Hexagon::STrib_GP_V4:
2151 return !invertPredicate ? Hexagon::STrib_GP_cPt_V4 :
2152 Hexagon::STrib_GP_cNotPt_V4;
2153 case Hexagon::STrih_GP_V4:
2154 return !invertPredicate ? Hexagon::STrih_GP_cPt_V4 :
2155 Hexagon::STrih_GP_cNotPt_V4;
2156 case Hexagon::STriw_GP_V4:
2157 return !invertPredicate ? Hexagon::STriw_GP_cPt_V4 :
2158 Hexagon::STriw_GP_cNotPt_V4;
2160 case Hexagon::STd_GP_V4:
2161 return !invertPredicate ? Hexagon::STd_GP_cPt_V4 :
2162 Hexagon::STd_GP_cNotPt_V4;
2163 case Hexagon::STb_GP_V4:
2164 return !invertPredicate ? Hexagon::STb_GP_cPt_V4 :
2165 Hexagon::STb_GP_cNotPt_V4;
2166 case Hexagon::STh_GP_V4:
2167 return !invertPredicate ? Hexagon::STh_GP_cPt_V4 :
2168 Hexagon::STh_GP_cNotPt_V4;
2169 case Hexagon::STw_GP_V4:
2170 return !invertPredicate ? Hexagon::STw_GP_cPt_V4 :
2171 Hexagon::STw_GP_cNotPt_V4;
2174 case Hexagon::LDrid:
2175 return !invertPredicate ? Hexagon::LDrid_cPt :
2176 Hexagon::LDrid_cNotPt;
2177 case Hexagon::LDriw:
2178 return !invertPredicate ? Hexagon::LDriw_cPt :
2179 Hexagon::LDriw_cNotPt;
2180 case Hexagon::LDrih:
2181 return !invertPredicate ? Hexagon::LDrih_cPt :
2182 Hexagon::LDrih_cNotPt;
2183 case Hexagon::LDriuh:
2184 return !invertPredicate ? Hexagon::LDriuh_cPt :
2185 Hexagon::LDriuh_cNotPt;
2186 case Hexagon::LDrib:
2187 return !invertPredicate ? Hexagon::LDrib_cPt :
2188 Hexagon::LDrib_cNotPt;
2189 case Hexagon::LDriub:
2190 return !invertPredicate ? Hexagon::LDriub_cPt :
2191 Hexagon::LDriub_cNotPt;
2193 case Hexagon::LDrid_indexed:
2194 return !invertPredicate ? Hexagon::LDrid_indexed_cPt :
2195 Hexagon::LDrid_indexed_cNotPt;
2196 case Hexagon::LDriw_indexed:
2197 return !invertPredicate ? Hexagon::LDriw_indexed_cPt :
2198 Hexagon::LDriw_indexed_cNotPt;
2199 case Hexagon::LDrih_indexed:
2200 return !invertPredicate ? Hexagon::LDrih_indexed_cPt :
2201 Hexagon::LDrih_indexed_cNotPt;
2202 case Hexagon::LDriuh_indexed:
2203 return !invertPredicate ? Hexagon::LDriuh_indexed_cPt :
2204 Hexagon::LDriuh_indexed_cNotPt;
2205 case Hexagon::LDrib_indexed:
2206 return !invertPredicate ? Hexagon::LDrib_indexed_cPt :
2207 Hexagon::LDrib_indexed_cNotPt;
2208 case Hexagon::LDriub_indexed:
2209 return !invertPredicate ? Hexagon::LDriub_indexed_cPt :
2210 Hexagon::LDriub_indexed_cNotPt;
2211 // Post Increment Load.
2212 case Hexagon::POST_LDrid:
2213 return !invertPredicate ? Hexagon::POST_LDrid_cPt :
2214 Hexagon::POST_LDrid_cNotPt;
2215 case Hexagon::POST_LDriw:
2216 return !invertPredicate ? Hexagon::POST_LDriw_cPt :
2217 Hexagon::POST_LDriw_cNotPt;
2218 case Hexagon::POST_LDrih:
2219 return !invertPredicate ? Hexagon::POST_LDrih_cPt :
2220 Hexagon::POST_LDrih_cNotPt;
2221 case Hexagon::POST_LDriuh:
2222 return !invertPredicate ? Hexagon::POST_LDriuh_cPt :
2223 Hexagon::POST_LDriuh_cNotPt;
2224 case Hexagon::POST_LDrib:
2225 return !invertPredicate ? Hexagon::POST_LDrib_cPt :
2226 Hexagon::POST_LDrib_cNotPt;
2227 case Hexagon::POST_LDriub:
2228 return !invertPredicate ? Hexagon::POST_LDriub_cPt :
2229 Hexagon::POST_LDriub_cNotPt;
2231 case Hexagon::DEALLOC_RET_V4:
2232 return !invertPredicate ? Hexagon::DEALLOC_RET_cPt_V4 :
2233 Hexagon::DEALLOC_RET_cNotPt_V4;
2235 // Load Absolute Addressing -- global address.
2236 case Hexagon::LDrib_abs_V4:
2237 return !invertPredicate ? Hexagon::LDrib_abs_cPt_V4 :
2238 Hexagon::LDrib_abs_cNotPt_V4;
2239 case Hexagon::LDriub_abs_V4:
2240 return !invertPredicate ? Hexagon::LDriub_abs_cPt_V4 :
2241 Hexagon::LDriub_abs_cNotPt_V4;
2242 case Hexagon::LDrih_abs_V4:
2243 return !invertPredicate ? Hexagon::LDrih_abs_cPt_V4 :
2244 Hexagon::LDrih_abs_cNotPt_V4;
2245 case Hexagon::LDriuh_abs_V4:
2246 return !invertPredicate ? Hexagon::LDriuh_abs_cPt_V4 :
2247 Hexagon::LDriuh_abs_cNotPt_V4;
2248 case Hexagon::LDriw_abs_V4:
2249 return !invertPredicate ? Hexagon::LDriw_abs_cPt_V4 :
2250 Hexagon::LDriw_abs_cNotPt_V4;
2251 case Hexagon::LDrid_abs_V4:
2252 return !invertPredicate ? Hexagon::LDrid_abs_cPt_V4 :
2253 Hexagon::LDrid_abs_cNotPt_V4;
2255 // Load Absolute Addressing -- immediate value.
2256 case Hexagon::LDrib_imm_abs_V4:
2257 return !invertPredicate ? Hexagon::LDrib_imm_abs_cPt_V4 :
2258 Hexagon::LDrib_imm_abs_cNotPt_V4;
2259 case Hexagon::LDriub_imm_abs_V4:
2260 return !invertPredicate ? Hexagon::LDriub_imm_abs_cPt_V4 :
2261 Hexagon::LDriub_imm_abs_cNotPt_V4;
2262 case Hexagon::LDrih_imm_abs_V4:
2263 return !invertPredicate ? Hexagon::LDrih_imm_abs_cPt_V4 :
2264 Hexagon::LDrih_imm_abs_cNotPt_V4;
2265 case Hexagon::LDriuh_imm_abs_V4:
2266 return !invertPredicate ? Hexagon::LDriuh_imm_abs_cPt_V4 :
2267 Hexagon::LDriuh_imm_abs_cNotPt_V4;
2268 case Hexagon::LDriw_imm_abs_V4:
2269 return !invertPredicate ? Hexagon::LDriw_imm_abs_cPt_V4 :
2270 Hexagon::LDriw_imm_abs_cNotPt_V4;
2272 // Store Absolute Addressing.
2273 case Hexagon::STrib_abs_V4:
2274 return !invertPredicate ? Hexagon::STrib_abs_cPt_V4 :
2275 Hexagon::STrib_abs_cNotPt_V4;
2276 case Hexagon::STrih_abs_V4:
2277 return !invertPredicate ? Hexagon::STrih_abs_cPt_V4 :
2278 Hexagon::STrih_abs_cNotPt_V4;
2279 case Hexagon::STriw_abs_V4:
2280 return !invertPredicate ? Hexagon::STriw_abs_cPt_V4 :
2281 Hexagon::STriw_abs_cNotPt_V4;
2282 case Hexagon::STrid_abs_V4:
2283 return !invertPredicate ? Hexagon::STrid_abs_cPt_V4 :
2284 Hexagon::STrid_abs_cNotPt_V4;
2286 // Store Absolute Addressing - global address.
2287 case Hexagon::STrib_imm_abs_V4:
2288 return !invertPredicate ? Hexagon::STrib_imm_abs_cPt_V4 :
2289 Hexagon::STrib_imm_abs_cNotPt_V4;
2290 case Hexagon::STrih_imm_abs_V4:
2291 return !invertPredicate ? Hexagon::STrih_imm_abs_cPt_V4 :
2292 Hexagon::STrih_imm_abs_cNotPt_V4;
2293 case Hexagon::STriw_imm_abs_V4:
2294 return !invertPredicate ? Hexagon::STriw_imm_abs_cPt_V4 :
2295 Hexagon::STriw_imm_abs_cNotPt_V4;
2298 case Hexagon::TFRI_V4:
2299 return !invertPredicate ? Hexagon::TFRI_cPt_V4 :
2300 Hexagon::TFRI_cNotPt_V4;
2302 llvm_unreachable("Unexpected predicable instruction");
2306 bool HexagonInstrInfo::
2307 PredicateInstruction(MachineInstr *MI,
2308 const SmallVectorImpl<MachineOperand> &Cond) const {
2309 int Opc = MI->getOpcode();
2310 assert (isPredicable(MI) && "Expected predicable instruction");
2311 bool invertJump = (!Cond.empty() && Cond[0].isImm() &&
2312 (Cond[0].getImm() == 0));
2313 MI->setDesc(get(getMatchingCondBranchOpcode(Opc, invertJump)));
2315 // This assumes that the predicate is always the first operand
2316 // in the set of inputs.
2318 MI->addOperand(MI->getOperand(MI->getNumOperands()-1));
2320 for (oper = MI->getNumOperands() - 3; oper >= 0; --oper) {
2321 MachineOperand MO = MI->getOperand(oper);
2322 if ((MO.isReg() && !MO.isUse() && !MO.isImplicit())) {
2327 MI->getOperand(oper+1).ChangeToRegister(MO.getReg(), MO.isDef(),
2328 MO.isImplicit(), MO.isKill(),
2329 MO.isDead(), MO.isUndef(),
2331 } else if (MO.isImm()) {
2332 MI->getOperand(oper+1).ChangeToImmediate(MO.getImm());
2334 llvm_unreachable("Unexpected operand type");
2338 int regPos = invertJump ? 1 : 0;
2339 MachineOperand PredMO = Cond[regPos];
2340 MI->getOperand(oper+1).ChangeToRegister(PredMO.getReg(), PredMO.isDef(),
2341 PredMO.isImplicit(), PredMO.isKill(),
2342 PredMO.isDead(), PredMO.isUndef(),
2351 isProfitableToIfCvt(MachineBasicBlock &MBB,
2353 unsigned ExtraPredCycles,
2354 const BranchProbability &Probability) const {
2361 isProfitableToIfCvt(MachineBasicBlock &TMBB,
2362 unsigned NumTCycles,
2363 unsigned ExtraTCycles,
2364 MachineBasicBlock &FMBB,
2365 unsigned NumFCycles,
2366 unsigned ExtraFCycles,
2367 const BranchProbability &Probability) const {
2372 bool HexagonInstrInfo::isPredicated(const MachineInstr *MI) const {
2373 const uint64_t F = MI->getDesc().TSFlags;
2375 return ((F >> HexagonII::PredicatedPos) & HexagonII::PredicatedMask);
2379 HexagonInstrInfo::DefinesPredicate(MachineInstr *MI,
2380 std::vector<MachineOperand> &Pred) const {
2381 for (unsigned oper = 0; oper < MI->getNumOperands(); ++oper) {
2382 MachineOperand MO = MI->getOperand(oper);
2383 if (MO.isReg() && MO.isDef()) {
2384 const TargetRegisterClass* RC = RI.getMinimalPhysRegClass(MO.getReg());
2385 if (RC == &Hexagon::PredRegsRegClass) {
2397 SubsumesPredicate(const SmallVectorImpl<MachineOperand> &Pred1,
2398 const SmallVectorImpl<MachineOperand> &Pred2) const {
2405 // We indicate that we want to reverse the branch by
2406 // inserting a 0 at the beginning of the Cond vector.
2408 bool HexagonInstrInfo::
2409 ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const {
2410 if (!Cond.empty() && Cond[0].isImm() && Cond[0].getImm() == 0) {
2411 Cond.erase(Cond.begin());
2413 Cond.insert(Cond.begin(), MachineOperand::CreateImm(0));
2419 bool HexagonInstrInfo::
2420 isProfitableToDupForIfCvt(MachineBasicBlock &MBB,unsigned NumInstrs,
2421 const BranchProbability &Probability) const {
2422 return (NumInstrs <= 4);
2425 bool HexagonInstrInfo::isDeallocRet(const MachineInstr *MI) const {
2426 switch (MI->getOpcode()) {
2427 default: return false;
2428 case Hexagon::DEALLOC_RET_V4 :
2429 case Hexagon::DEALLOC_RET_cPt_V4 :
2430 case Hexagon::DEALLOC_RET_cNotPt_V4 :
2431 case Hexagon::DEALLOC_RET_cdnPnt_V4 :
2432 case Hexagon::DEALLOC_RET_cNotdnPnt_V4 :
2433 case Hexagon::DEALLOC_RET_cdnPt_V4 :
2434 case Hexagon::DEALLOC_RET_cNotdnPt_V4 :
2440 bool HexagonInstrInfo::
2441 isValidOffset(const int Opcode, const int Offset) const {
2442 // This function is to check whether the "Offset" is in the correct range of
2443 // the given "Opcode". If "Offset" is not in the correct range, "ADD_ri" is
2444 // inserted to calculate the final address. Due to this reason, the function
2445 // assumes that the "Offset" has correct alignment.
2449 case Hexagon::LDriw:
2450 case Hexagon::LDriw_f:
2451 case Hexagon::STriw_indexed:
2452 case Hexagon::STriw:
2453 case Hexagon::STriw_f:
2454 assert((Offset % 4 == 0) && "Offset has incorrect alignment");
2455 return (Offset >= Hexagon_MEMW_OFFSET_MIN) &&
2456 (Offset <= Hexagon_MEMW_OFFSET_MAX);
2458 case Hexagon::LDrid:
2459 case Hexagon::LDrid_f:
2460 case Hexagon::STrid:
2461 case Hexagon::STrid_f:
2462 assert((Offset % 8 == 0) && "Offset has incorrect alignment");
2463 return (Offset >= Hexagon_MEMD_OFFSET_MIN) &&
2464 (Offset <= Hexagon_MEMD_OFFSET_MAX);
2466 case Hexagon::LDrih:
2467 case Hexagon::LDriuh:
2468 case Hexagon::STrih:
2469 assert((Offset % 2 == 0) && "Offset has incorrect alignment");
2470 return (Offset >= Hexagon_MEMH_OFFSET_MIN) &&
2471 (Offset <= Hexagon_MEMH_OFFSET_MAX);
2473 case Hexagon::LDrib:
2474 case Hexagon::STrib:
2475 case Hexagon::LDriub:
2476 return (Offset >= Hexagon_MEMB_OFFSET_MIN) &&
2477 (Offset <= Hexagon_MEMB_OFFSET_MAX);
2479 case Hexagon::ADD_ri:
2480 case Hexagon::TFR_FI:
2481 return (Offset >= Hexagon_ADDI_OFFSET_MIN) &&
2482 (Offset <= Hexagon_ADDI_OFFSET_MAX);
2484 case Hexagon::MEMw_ADDSUBi_indexed_MEM_V4 :
2485 case Hexagon::MEMw_ADDi_indexed_MEM_V4 :
2486 case Hexagon::MEMw_SUBi_indexed_MEM_V4 :
2487 case Hexagon::MEMw_ADDr_indexed_MEM_V4 :
2488 case Hexagon::MEMw_SUBr_indexed_MEM_V4 :
2489 case Hexagon::MEMw_ANDr_indexed_MEM_V4 :
2490 case Hexagon::MEMw_ORr_indexed_MEM_V4 :
2491 case Hexagon::MEMw_ADDSUBi_MEM_V4 :
2492 case Hexagon::MEMw_ADDi_MEM_V4 :
2493 case Hexagon::MEMw_SUBi_MEM_V4 :
2494 case Hexagon::MEMw_ADDr_MEM_V4 :
2495 case Hexagon::MEMw_SUBr_MEM_V4 :
2496 case Hexagon::MEMw_ANDr_MEM_V4 :
2497 case Hexagon::MEMw_ORr_MEM_V4 :
2498 assert ((Offset % 4) == 0 && "MEMOPw offset is not aligned correctly." );
2499 return (0 <= Offset && Offset <= 255);
2501 case Hexagon::MEMh_ADDSUBi_indexed_MEM_V4 :
2502 case Hexagon::MEMh_ADDi_indexed_MEM_V4 :
2503 case Hexagon::MEMh_SUBi_indexed_MEM_V4 :
2504 case Hexagon::MEMh_ADDr_indexed_MEM_V4 :
2505 case Hexagon::MEMh_SUBr_indexed_MEM_V4 :
2506 case Hexagon::MEMh_ANDr_indexed_MEM_V4 :
2507 case Hexagon::MEMh_ORr_indexed_MEM_V4 :
2508 case Hexagon::MEMh_ADDSUBi_MEM_V4 :
2509 case Hexagon::MEMh_ADDi_MEM_V4 :
2510 case Hexagon::MEMh_SUBi_MEM_V4 :
2511 case Hexagon::MEMh_ADDr_MEM_V4 :
2512 case Hexagon::MEMh_SUBr_MEM_V4 :
2513 case Hexagon::MEMh_ANDr_MEM_V4 :
2514 case Hexagon::MEMh_ORr_MEM_V4 :
2515 assert ((Offset % 2) == 0 && "MEMOPh offset is not aligned correctly." );
2516 return (0 <= Offset && Offset <= 127);
2518 case Hexagon::MEMb_ADDSUBi_indexed_MEM_V4 :
2519 case Hexagon::MEMb_ADDi_indexed_MEM_V4 :
2520 case Hexagon::MEMb_SUBi_indexed_MEM_V4 :
2521 case Hexagon::MEMb_ADDr_indexed_MEM_V4 :
2522 case Hexagon::MEMb_SUBr_indexed_MEM_V4 :
2523 case Hexagon::MEMb_ANDr_indexed_MEM_V4 :
2524 case Hexagon::MEMb_ORr_indexed_MEM_V4 :
2525 case Hexagon::MEMb_ADDSUBi_MEM_V4 :
2526 case Hexagon::MEMb_ADDi_MEM_V4 :
2527 case Hexagon::MEMb_SUBi_MEM_V4 :
2528 case Hexagon::MEMb_ADDr_MEM_V4 :
2529 case Hexagon::MEMb_SUBr_MEM_V4 :
2530 case Hexagon::MEMb_ANDr_MEM_V4 :
2531 case Hexagon::MEMb_ORr_MEM_V4 :
2532 return (0 <= Offset && Offset <= 63);
2534 // LDri_pred and STriw_pred are pseudo operations, so it has to take offset of
2535 // any size. Later pass knows how to handle it.
2536 case Hexagon::STriw_pred:
2537 case Hexagon::LDriw_pred:
2540 // INLINEASM is very special.
2541 case Hexagon::INLINEASM:
2545 llvm_unreachable("No offset range is defined for this opcode. "
2546 "Please define it in the above switch statement!");
2551 // Check if the Offset is a valid auto-inc imm by Load/Store Type.
2553 bool HexagonInstrInfo::
2554 isValidAutoIncImm(const EVT VT, const int Offset) const {
2556 if (VT == MVT::i64) {
2557 return (Offset >= Hexagon_MEMD_AUTOINC_MIN &&
2558 Offset <= Hexagon_MEMD_AUTOINC_MAX &&
2559 (Offset & 0x7) == 0);
2561 if (VT == MVT::i32) {
2562 return (Offset >= Hexagon_MEMW_AUTOINC_MIN &&
2563 Offset <= Hexagon_MEMW_AUTOINC_MAX &&
2564 (Offset & 0x3) == 0);
2566 if (VT == MVT::i16) {
2567 return (Offset >= Hexagon_MEMH_AUTOINC_MIN &&
2568 Offset <= Hexagon_MEMH_AUTOINC_MAX &&
2569 (Offset & 0x1) == 0);
2571 if (VT == MVT::i8) {
2572 return (Offset >= Hexagon_MEMB_AUTOINC_MIN &&
2573 Offset <= Hexagon_MEMB_AUTOINC_MAX);
2575 llvm_unreachable("Not an auto-inc opc!");
2579 bool HexagonInstrInfo::
2580 isMemOp(const MachineInstr *MI) const {
2581 switch (MI->getOpcode())
2583 default: return false;
2584 case Hexagon::MEMw_ADDSUBi_indexed_MEM_V4 :
2585 case Hexagon::MEMw_ADDi_indexed_MEM_V4 :
2586 case Hexagon::MEMw_SUBi_indexed_MEM_V4 :
2587 case Hexagon::MEMw_ADDr_indexed_MEM_V4 :
2588 case Hexagon::MEMw_SUBr_indexed_MEM_V4 :
2589 case Hexagon::MEMw_ANDr_indexed_MEM_V4 :
2590 case Hexagon::MEMw_ORr_indexed_MEM_V4 :
2591 case Hexagon::MEMw_ADDSUBi_MEM_V4 :
2592 case Hexagon::MEMw_ADDi_MEM_V4 :
2593 case Hexagon::MEMw_SUBi_MEM_V4 :
2594 case Hexagon::MEMw_ADDr_MEM_V4 :
2595 case Hexagon::MEMw_SUBr_MEM_V4 :
2596 case Hexagon::MEMw_ANDr_MEM_V4 :
2597 case Hexagon::MEMw_ORr_MEM_V4 :
2598 case Hexagon::MEMh_ADDSUBi_indexed_MEM_V4 :
2599 case Hexagon::MEMh_ADDi_indexed_MEM_V4 :
2600 case Hexagon::MEMh_SUBi_indexed_MEM_V4 :
2601 case Hexagon::MEMh_ADDr_indexed_MEM_V4 :
2602 case Hexagon::MEMh_SUBr_indexed_MEM_V4 :
2603 case Hexagon::MEMh_ANDr_indexed_MEM_V4 :
2604 case Hexagon::MEMh_ORr_indexed_MEM_V4 :
2605 case Hexagon::MEMh_ADDSUBi_MEM_V4 :
2606 case Hexagon::MEMh_ADDi_MEM_V4 :
2607 case Hexagon::MEMh_SUBi_MEM_V4 :
2608 case Hexagon::MEMh_ADDr_MEM_V4 :
2609 case Hexagon::MEMh_SUBr_MEM_V4 :
2610 case Hexagon::MEMh_ANDr_MEM_V4 :
2611 case Hexagon::MEMh_ORr_MEM_V4 :
2612 case Hexagon::MEMb_ADDSUBi_indexed_MEM_V4 :
2613 case Hexagon::MEMb_ADDi_indexed_MEM_V4 :
2614 case Hexagon::MEMb_SUBi_indexed_MEM_V4 :
2615 case Hexagon::MEMb_ADDr_indexed_MEM_V4 :
2616 case Hexagon::MEMb_SUBr_indexed_MEM_V4 :
2617 case Hexagon::MEMb_ANDr_indexed_MEM_V4 :
2618 case Hexagon::MEMb_ORr_indexed_MEM_V4 :
2619 case Hexagon::MEMb_ADDSUBi_MEM_V4 :
2620 case Hexagon::MEMb_ADDi_MEM_V4 :
2621 case Hexagon::MEMb_SUBi_MEM_V4 :
2622 case Hexagon::MEMb_ADDr_MEM_V4 :
2623 case Hexagon::MEMb_SUBr_MEM_V4 :
2624 case Hexagon::MEMb_ANDr_MEM_V4 :
2625 case Hexagon::MEMb_ORr_MEM_V4 :
2631 bool HexagonInstrInfo::
2632 isSpillPredRegOp(const MachineInstr *MI) const {
2633 switch (MI->getOpcode()) {
2634 default: return false;
2635 case Hexagon::STriw_pred :
2636 case Hexagon::LDriw_pred :
2641 bool HexagonInstrInfo::isNewValueJumpCandidate(const MachineInstr *MI) const {
2642 switch (MI->getOpcode()) {
2643 default: return false;
2644 case Hexagon::CMPEQrr:
2645 case Hexagon::CMPEQri:
2646 case Hexagon::CMPLTrr:
2647 case Hexagon::CMPGTrr:
2648 case Hexagon::CMPGTri:
2649 case Hexagon::CMPLTUrr:
2650 case Hexagon::CMPGTUrr:
2651 case Hexagon::CMPGTUri:
2652 case Hexagon::CMPGEri:
2653 case Hexagon::CMPGEUri:
2658 bool HexagonInstrInfo::
2659 isConditionalTransfer (const MachineInstr *MI) const {
2660 switch (MI->getOpcode()) {
2661 default: return false;
2662 case Hexagon::TFR_cPt:
2663 case Hexagon::TFR_cNotPt:
2664 case Hexagon::TFRI_cPt:
2665 case Hexagon::TFRI_cNotPt:
2666 case Hexagon::TFR_cdnPt:
2667 case Hexagon::TFR_cdnNotPt:
2668 case Hexagon::TFRI_cdnPt:
2669 case Hexagon::TFRI_cdnNotPt:
2674 bool HexagonInstrInfo::isConditionalALU32 (const MachineInstr* MI) const {
2675 const HexagonRegisterInfo& QRI = getRegisterInfo();
2676 switch (MI->getOpcode())
2678 default: return false;
2679 case Hexagon::ADD_ri_cPt:
2680 case Hexagon::ADD_ri_cNotPt:
2681 case Hexagon::ADD_rr_cPt:
2682 case Hexagon::ADD_rr_cNotPt:
2683 case Hexagon::XOR_rr_cPt:
2684 case Hexagon::XOR_rr_cNotPt:
2685 case Hexagon::AND_rr_cPt:
2686 case Hexagon::AND_rr_cNotPt:
2687 case Hexagon::OR_rr_cPt:
2688 case Hexagon::OR_rr_cNotPt:
2689 case Hexagon::SUB_rr_cPt:
2690 case Hexagon::SUB_rr_cNotPt:
2691 case Hexagon::COMBINE_rr_cPt:
2692 case Hexagon::COMBINE_rr_cNotPt:
2694 case Hexagon::ASLH_cPt_V4:
2695 case Hexagon::ASLH_cNotPt_V4:
2696 case Hexagon::ASRH_cPt_V4:
2697 case Hexagon::ASRH_cNotPt_V4:
2698 case Hexagon::SXTB_cPt_V4:
2699 case Hexagon::SXTB_cNotPt_V4:
2700 case Hexagon::SXTH_cPt_V4:
2701 case Hexagon::SXTH_cNotPt_V4:
2702 case Hexagon::ZXTB_cPt_V4:
2703 case Hexagon::ZXTB_cNotPt_V4:
2704 case Hexagon::ZXTH_cPt_V4:
2705 case Hexagon::ZXTH_cNotPt_V4:
2706 return QRI.Subtarget.hasV4TOps();
2710 bool HexagonInstrInfo::
2711 isConditionalLoad (const MachineInstr* MI) const {
2712 const HexagonRegisterInfo& QRI = getRegisterInfo();
2713 switch (MI->getOpcode())
2715 default: return false;
2716 case Hexagon::LDrid_cPt :
2717 case Hexagon::LDrid_cNotPt :
2718 case Hexagon::LDrid_indexed_cPt :
2719 case Hexagon::LDrid_indexed_cNotPt :
2720 case Hexagon::LDriw_cPt :
2721 case Hexagon::LDriw_cNotPt :
2722 case Hexagon::LDriw_indexed_cPt :
2723 case Hexagon::LDriw_indexed_cNotPt :
2724 case Hexagon::LDrih_cPt :
2725 case Hexagon::LDrih_cNotPt :
2726 case Hexagon::LDrih_indexed_cPt :
2727 case Hexagon::LDrih_indexed_cNotPt :
2728 case Hexagon::LDrib_cPt :
2729 case Hexagon::LDrib_cNotPt :
2730 case Hexagon::LDrib_indexed_cPt :
2731 case Hexagon::LDrib_indexed_cNotPt :
2732 case Hexagon::LDriuh_cPt :
2733 case Hexagon::LDriuh_cNotPt :
2734 case Hexagon::LDriuh_indexed_cPt :
2735 case Hexagon::LDriuh_indexed_cNotPt :
2736 case Hexagon::LDriub_cPt :
2737 case Hexagon::LDriub_cNotPt :
2738 case Hexagon::LDriub_indexed_cPt :
2739 case Hexagon::LDriub_indexed_cNotPt :
2741 case Hexagon::POST_LDrid_cPt :
2742 case Hexagon::POST_LDrid_cNotPt :
2743 case Hexagon::POST_LDriw_cPt :
2744 case Hexagon::POST_LDriw_cNotPt :
2745 case Hexagon::POST_LDrih_cPt :
2746 case Hexagon::POST_LDrih_cNotPt :
2747 case Hexagon::POST_LDrib_cPt :
2748 case Hexagon::POST_LDrib_cNotPt :
2749 case Hexagon::POST_LDriuh_cPt :
2750 case Hexagon::POST_LDriuh_cNotPt :
2751 case Hexagon::POST_LDriub_cPt :
2752 case Hexagon::POST_LDriub_cNotPt :
2753 return QRI.Subtarget.hasV4TOps();
2754 case Hexagon::LDrid_indexed_cPt_V4 :
2755 case Hexagon::LDrid_indexed_cNotPt_V4 :
2756 case Hexagon::LDrid_indexed_shl_cPt_V4 :
2757 case Hexagon::LDrid_indexed_shl_cNotPt_V4 :
2758 case Hexagon::LDrib_indexed_cPt_V4 :
2759 case Hexagon::LDrib_indexed_cNotPt_V4 :
2760 case Hexagon::LDrib_indexed_shl_cPt_V4 :
2761 case Hexagon::LDrib_indexed_shl_cNotPt_V4 :
2762 case Hexagon::LDriub_indexed_cPt_V4 :
2763 case Hexagon::LDriub_indexed_cNotPt_V4 :
2764 case Hexagon::LDriub_indexed_shl_cPt_V4 :
2765 case Hexagon::LDriub_indexed_shl_cNotPt_V4 :
2766 case Hexagon::LDrih_indexed_cPt_V4 :
2767 case Hexagon::LDrih_indexed_cNotPt_V4 :
2768 case Hexagon::LDrih_indexed_shl_cPt_V4 :
2769 case Hexagon::LDrih_indexed_shl_cNotPt_V4 :
2770 case Hexagon::LDriuh_indexed_cPt_V4 :
2771 case Hexagon::LDriuh_indexed_cNotPt_V4 :
2772 case Hexagon::LDriuh_indexed_shl_cPt_V4 :
2773 case Hexagon::LDriuh_indexed_shl_cNotPt_V4 :
2774 case Hexagon::LDriw_indexed_cPt_V4 :
2775 case Hexagon::LDriw_indexed_cNotPt_V4 :
2776 case Hexagon::LDriw_indexed_shl_cPt_V4 :
2777 case Hexagon::LDriw_indexed_shl_cNotPt_V4 :
2778 return QRI.Subtarget.hasV4TOps();
2782 // Returns true if an instruction is a conditional store.
2784 // Note: It doesn't include conditional new-value stores as they can't be
2785 // converted to .new predicate.
2787 // p.new NV store [ if(p0.new)memw(R0+#0)=R2.new ]
2789 // / \ (not OK. it will cause new-value store to be
2790 // / X conditional on p0.new while R2 producer is
2793 // p.new store p.old NV store
2794 // [if(p0.new)memw(R0+#0)=R2] [if(p0)memw(R0+#0)=R2.new]
2800 // [if (p0)memw(R0+#0)=R2]
2802 // The above diagram shows the steps involoved in the conversion of a predicated
2803 // store instruction to its .new predicated new-value form.
2805 // The following set of instructions further explains the scenario where
2806 // conditional new-value store becomes invalid when promoted to .new predicate
2809 // { 1) if (p0) r0 = add(r1, r2)
2810 // 2) p0 = cmp.eq(r3, #0) }
2812 // 3) if (p0) memb(r1+#0) = r0 --> this instruction can't be grouped with
2813 // the first two instructions because in instr 1, r0 is conditional on old value
2814 // of p0 but its use in instr 3 is conditional on p0 modified by instr 2 which
2815 // is not valid for new-value stores.
2816 bool HexagonInstrInfo::
2817 isConditionalStore (const MachineInstr* MI) const {
2818 const HexagonRegisterInfo& QRI = getRegisterInfo();
2819 switch (MI->getOpcode())
2821 default: return false;
2822 case Hexagon::STrib_imm_cPt_V4 :
2823 case Hexagon::STrib_imm_cNotPt_V4 :
2824 case Hexagon::STrib_indexed_shl_cPt_V4 :
2825 case Hexagon::STrib_indexed_shl_cNotPt_V4 :
2826 case Hexagon::STrib_cPt :
2827 case Hexagon::STrib_cNotPt :
2828 case Hexagon::POST_STbri_cPt :
2829 case Hexagon::POST_STbri_cNotPt :
2830 case Hexagon::STrid_indexed_cPt :
2831 case Hexagon::STrid_indexed_cNotPt :
2832 case Hexagon::STrid_indexed_shl_cPt_V4 :
2833 case Hexagon::POST_STdri_cPt :
2834 case Hexagon::POST_STdri_cNotPt :
2835 case Hexagon::STrih_cPt :
2836 case Hexagon::STrih_cNotPt :
2837 case Hexagon::STrih_indexed_cPt :
2838 case Hexagon::STrih_indexed_cNotPt :
2839 case Hexagon::STrih_imm_cPt_V4 :
2840 case Hexagon::STrih_imm_cNotPt_V4 :
2841 case Hexagon::STrih_indexed_shl_cPt_V4 :
2842 case Hexagon::STrih_indexed_shl_cNotPt_V4 :
2843 case Hexagon::POST_SThri_cPt :
2844 case Hexagon::POST_SThri_cNotPt :
2845 case Hexagon::STriw_cPt :
2846 case Hexagon::STriw_cNotPt :
2847 case Hexagon::STriw_indexed_cPt :
2848 case Hexagon::STriw_indexed_cNotPt :
2849 case Hexagon::STriw_imm_cPt_V4 :
2850 case Hexagon::STriw_imm_cNotPt_V4 :
2851 case Hexagon::STriw_indexed_shl_cPt_V4 :
2852 case Hexagon::STriw_indexed_shl_cNotPt_V4 :
2853 case Hexagon::POST_STwri_cPt :
2854 case Hexagon::POST_STwri_cNotPt :
2855 return QRI.Subtarget.hasV4TOps();
2857 // V4 global address store before promoting to dot new.
2858 case Hexagon::STrid_GP_cPt_V4 :
2859 case Hexagon::STrid_GP_cNotPt_V4 :
2860 case Hexagon::STrib_GP_cPt_V4 :
2861 case Hexagon::STrib_GP_cNotPt_V4 :
2862 case Hexagon::STrih_GP_cPt_V4 :
2863 case Hexagon::STrih_GP_cNotPt_V4 :
2864 case Hexagon::STriw_GP_cPt_V4 :
2865 case Hexagon::STriw_GP_cNotPt_V4 :
2866 case Hexagon::STd_GP_cPt_V4 :
2867 case Hexagon::STd_GP_cNotPt_V4 :
2868 case Hexagon::STb_GP_cPt_V4 :
2869 case Hexagon::STb_GP_cNotPt_V4 :
2870 case Hexagon::STh_GP_cPt_V4 :
2871 case Hexagon::STh_GP_cNotPt_V4 :
2872 case Hexagon::STw_GP_cPt_V4 :
2873 case Hexagon::STw_GP_cNotPt_V4 :
2874 return QRI.Subtarget.hasV4TOps();
2876 // Predicated new value stores (i.e. if (p0) memw(..)=r0.new) are excluded
2877 // from the "Conditional Store" list. Because a predicated new value store
2878 // would NOT be promoted to a double dot new store. See diagram below:
2879 // This function returns yes for those stores that are predicated but not
2880 // yet promoted to predicate dot new instructions.
2882 // +---------------------+
2883 // /-----| if (p0) memw(..)=r0 |---------\~
2884 // || +---------------------+ ||
2885 // promote || /\ /\ || promote
2887 // \||/ demote || \||/
2889 // +-------------------------+ || +-------------------------+
2890 // | if (p0.new) memw(..)=r0 | || | if (p0) memw(..)=r0.new |
2891 // +-------------------------+ || +-------------------------+
2894 // promote || \/ NOT possible
2898 // +-----------------------------+
2899 // | if (p0.new) memw(..)=r0.new |
2900 // +-----------------------------+
2901 // Double Dot New Store
2908 DFAPacketizer *HexagonInstrInfo::
2909 CreateTargetScheduleState(const TargetMachine *TM,
2910 const ScheduleDAG *DAG) const {
2911 const InstrItineraryData *II = TM->getInstrItineraryData();
2912 return TM->getSubtarget<HexagonGenSubtargetInfo>().createDFAPacketizer(II);
2915 bool HexagonInstrInfo::isSchedulingBoundary(const MachineInstr *MI,
2916 const MachineBasicBlock *MBB,
2917 const MachineFunction &MF) const {
2918 // Debug info is never a scheduling boundary. It's necessary to be explicit
2919 // due to the special treatment of IT instructions below, otherwise a
2920 // dbg_value followed by an IT will result in the IT instruction being
2921 // considered a scheduling hazard, which is wrong. It should be the actual
2922 // instruction preceding the dbg_value instruction(s), just like it is
2923 // when debug info is not present.
2924 if (MI->isDebugValue())
2927 // Terminators and labels can't be scheduled around.
2928 if (MI->getDesc().isTerminator() || MI->isLabel() || MI->isInlineAsm())
2934 bool HexagonInstrInfo::isExpr(unsigned OpType) const {
2936 case MachineOperand::MO_MachineBasicBlock:
2937 case MachineOperand::MO_GlobalAddress:
2938 case MachineOperand::MO_ExternalSymbol:
2939 case MachineOperand::MO_JumpTableIndex:
2940 case MachineOperand::MO_ConstantPoolIndex:
2941 case MachineOperand::MO_BlockAddress:
2948 bool HexagonInstrInfo::isConstExtended(MachineInstr *MI) const {
2949 unsigned short Opcode = MI->getOpcode();
2950 short ExtOpNum = HexagonConstExt::getCExtOpNum(Opcode);
2952 // Instruction has no constant extended operand.
2957 int MinValue = HexagonConstExt::getMinValue(Opcode);
2958 int MaxValue = HexagonConstExt::getMaxValue(Opcode);
2959 const MachineOperand &MO = MI->getOperand(ExtOpNum);
2960 if (!MO.isImm()) // no range check if the operand is non-immediate.
2963 int ImmValue = MO.getImm();
2964 return (ImmValue < MinValue || ImmValue > MaxValue);
2968 // Returns true if a particular operand is extended for an instruction.
2969 bool HexagonConstExt::isOperandExtended(unsigned short Opcode,
2970 unsigned short OperandNum) {
2971 return HexagonCExt[Opcode].CExtOpNum == OperandNum;
2974 // Returns Operand Index for the constant extended instruction.
2975 unsigned short HexagonConstExt::getCExtOpNum(unsigned short Opcode) {
2976 return HexagonCExt[Opcode].CExtOpNum;
2979 // Returns the min value that doesn't need to be extended.
2980 int HexagonConstExt::getMinValue(unsigned short Opcode) {
2981 return HexagonCExt[Opcode].MinValue;
2984 // Returns the max value that doesn't need to be extended.
2985 int HexagonConstExt::getMaxValue(unsigned short Opcode) {
2986 return HexagonCExt[Opcode].MaxValue;
2989 // Returns true if an instruction can be converted into a non-extended
2990 // equivalent instruction.
2991 bool HexagonConstExt::NonExtEquivalentExists (unsigned short Opcode) {
2992 if (HexagonCExt[Opcode].NonExtOpcode < 0 )
2997 // Returns opcode of the non-extended equivalent instruction.
2998 int HexagonConstExt::getNonExtOpcode (unsigned short Opcode) {
2999 return HexagonCExt[Opcode].NonExtOpcode;