diff options
| author | Nate Begeman <natebegeman@mac.com> | 2005-04-05 18:19:50 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2005-04-05 18:19:50 +0000 |
| commit | 524417357c58efc543472024c779dba3d34c11e3 (patch) | |
| tree | 4e7fc7e224bd8dcacab8f9754f5683b9404c43c1 /llvm/lib | |
| parent | a188b698a26240811dc2ee0cd2937f2dc8cbcebc (diff) | |
| download | bcm5719-llvm-524417357c58efc543472024c779dba3d34c11e3.tar.gz bcm5719-llvm-524417357c58efc543472024c779dba3d34c11e3.zip | |
Behold, rlwinm with certain immediate arguments is printed as the much more
readable slwi or srwi (shift left/right word immediate).
llvm-svn: 21099
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp index 025ce9824b3..3006f624103 100644 --- a/llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp @@ -397,6 +397,28 @@ void PowerPCAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) { /// void PowerPCAsmPrinter::printMachineInstruction(const MachineInstr *MI) { ++EmittedInsts; + // Check for slwi/srwi mnemonics. + if (MI->getOpcode() == PPC::RLWINM) { + bool FoundMnemonic = false; + unsigned char SH = MI->getOperand(2).getImmedValue(); + unsigned char MB = MI->getOperand(3).getImmedValue(); + unsigned char ME = MI->getOperand(4).getImmedValue(); + if (SH <= 31 && MB == 0 && ME == (31-SH)) { + O << "slwi "; FoundMnemonic = true; + } + if (SH <= 31 && MB == (32-SH) && ME == 31) { + O << "srwi "; FoundMnemonic = true; + SH = 32-SH; + } + if (FoundMnemonic) { + printOperand(MI, 0, MVT::i64); + O << ", "; + printOperand(MI, 1, MVT::i64); + O << ", " << (unsigned int)SH << "\n"; + return; + } + } + if (printInstruction(MI)) return; // Printer was automatically generated |

