[llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp
Nate Begeman
natebegeman at mac.com
Tue Apr 5 11:20:01 PDT 2005
Changes in directory llvm/lib/Target/PowerPC:
PowerPCAsmPrinter.cpp updated: 1.73 -> 1.74
---
Log message:
Behold, rlwinm with certain immediate arguments is printed as the much more
readable slwi or srwi (shift left/right word immediate).
---
Diffs of the changes: (+22 -0)
PowerPCAsmPrinter.cpp | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+)
Index: llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.73 llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.74
--- llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.73 Tue Mar 29 19:45:43 2005
+++ llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp Tue Apr 5 13:19:50 2005
@@ -397,6 +397,28 @@
///
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
More information about the llvm-commits
mailing list