aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2012-06-22 23:10:08 +0000
committerHal Finkel <hfinkel@anl.gov>2012-06-22 23:10:08 +0000
commit009f7afbeb77d1cc8e962bac7057b73b6d39d62f (patch)
tree362e05a353bb2b5cc24792048cd92cf7a2c5b8ad /lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
parente5457d21169105b695a7e32d4424a35bb9ca7fa2 (diff)
downloadexternal_llvm-009f7afbeb77d1cc8e962bac7057b73b6d39d62f.zip
external_llvm-009f7afbeb77d1cc8e962bac7057b73b6d39d62f.tar.gz
external_llvm-009f7afbeb77d1cc8e962bac7057b73b6d39d62f.tar.bz2
Add support for the PPC isel instruction.
The isel (integer select) instruction is supported on the 440 and A2 embedded cores and on the POWER7. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp')
-rw-r--r--lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp b/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
index 61d23ce..79af9a7 100644
--- a/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
+++ b/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
@@ -86,8 +86,33 @@ void PPCInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
void PPCInstPrinter::printPredicateOperand(const MCInst *MI, unsigned OpNo,
raw_ostream &O,
const char *Modifier) {
- assert(Modifier && "Must specify 'cc' or 'reg' as predicate op modifier!");
unsigned Code = MI->getOperand(OpNo).getImm();
+ if (!Modifier) {
+ unsigned CCReg = MI->getOperand(OpNo+1).getReg();
+ unsigned RegNo;
+ switch (CCReg) {
+ default: llvm_unreachable("Unknown CR register");
+ case PPC::CR0: RegNo = 0; break;
+ case PPC::CR1: RegNo = 1; break;
+ case PPC::CR2: RegNo = 2; break;
+ case PPC::CR3: RegNo = 3; break;
+ case PPC::CR4: RegNo = 4; break;
+ case PPC::CR5: RegNo = 5; break;
+ case PPC::CR6: RegNo = 6; break;
+ case PPC::CR7: RegNo = 7; break;
+ }
+
+ // Print the CR bit number. The Code is ((BI << 5) | BO) for a
+ // BCC, but we must have the positive form here (BO == 12)
+ unsigned BO = Code & 0xF;
+ unsigned BI = Code >> 5;
+ assert(BO == 12 && "BO in predicate bit must have the positive form");
+
+ unsigned Value = 4*RegNo + BI;
+ O << Value;
+ return;
+ }
+
if (StringRef(Modifier) == "cc") {
switch ((PPC::Predicate)Code) {
case PPC::PRED_ALWAYS: return; // Don't print anything for always.