diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2017-03-06 17:03:16 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2017-03-06 17:03:16 +0000 |
commit | 143158b72e32cd5516eef23aa0504f274896c85a (patch) | |
tree | e05a5f0387ec0c321019face36f34d17bf0106e1 /llvm/lib/Target | |
parent | 3d54e831bc34ca4a31518bcab87a9be2452cbd18 (diff) | |
download | bcm5719-llvm-143158b72e32cd5516eef23aa0504f274896c85a.tar.gz bcm5719-llvm-143158b72e32cd5516eef23aa0504f274896c85a.zip |
[Hexagon] Pick a dot-old instruction that matches the architecture
llvm-svn: 297031
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp | 25 | ||||
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonInstrInfo.h | 2 | ||||
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp | 2 |
3 files changed, 25 insertions, 4 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp index ee49a080435..b265a883da5 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp @@ -3563,10 +3563,31 @@ int HexagonInstrInfo::getDotNewPredOp(const MachineInstr &MI, llvm_unreachable(nullptr); } -int HexagonInstrInfo::getDotOldOp(const int opc) const { - int NewOp = opc; +int HexagonInstrInfo::getDotOldOp(const MachineInstr &MI) const { + int NewOp = MI.getOpcode(); if (isPredicated(NewOp) && isPredicatedNew(NewOp)) { // Get predicate old form NewOp = Hexagon::getPredOldOpcode(NewOp); + const MachineFunction &MF = *MI.getParent()->getParent(); + const HexagonSubtarget &HST = MF.getSubtarget<HexagonSubtarget>(); + // All Hexagon architectures have prediction bits on dot-new branches, + // but only Hexagon V60+ has prediction bits on dot-old ones. Make sure + // to pick the right opcode when converting back to dot-old. + if (!HST.getFeatureBits()[Hexagon::ArchV60]) { + switch (NewOp) { + case Hexagon::J2_jumptpt: + NewOp = Hexagon::J2_jumpt; + break; + case Hexagon::J2_jumpfpt: + NewOp = Hexagon::J2_jumpf; + break; + case Hexagon::J2_jumprtpt: + NewOp = Hexagon::J2_jumprt; + break; + case Hexagon::J2_jumprfpt: + NewOp = Hexagon::J2_jumprf; + break; + } + } assert(NewOp >= 0 && "Couldn't change predicate new instruction to its old form."); } diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.h b/llvm/lib/Target/Hexagon/HexagonInstrInfo.h index c1eb2165ce7..b268c7a2817 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.h +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.h @@ -404,7 +404,7 @@ public: const MachineBranchProbabilityInfo *MBPI) const; int getDotNewPredOp(const MachineInstr &MI, const MachineBranchProbabilityInfo *MBPI) const; - int getDotOldOp(const int opc) const; + int getDotOldOp(const MachineInstr &MI) const; HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr &MI) const; short getEquivalentHWInstr(const MachineInstr &MI) const; diff --git a/llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp b/llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp index 1c904f2b7cd..3a789a5f7e0 100644 --- a/llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp +++ b/llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp @@ -440,7 +440,7 @@ bool HexagonPacketizerList::promoteToDotNew(MachineInstr &MI, } bool HexagonPacketizerList::demoteToDotOld(MachineInstr &MI) { - int NewOpcode = HII->getDotOldOp(MI.getOpcode()); + int NewOpcode = HII->getDotOldOp(MI); MI.setDesc(HII->get(NewOpcode)); return true; } |