[llvm-commits] [llvm] r157093 - in /llvm/trunk: lib/Target/Mips/MipsAsmPrinter.cpp test/CodeGen/Mips/inlineasm-operand-code.ll

Eric Christopher echristo at apple.com
Fri May 18 17:51:56 PDT 2012


Author: echristo
Date: Fri May 18 19:51:56 2012
New Revision: 157093

URL: http://llvm.org/viewvc/llvm-project?rev=157093&view=rev
Log:
Add support for the 'd' mips inline asm output modifier.

Patch by Jack Carter.

Modified:
    llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
    llvm/trunk/test/CodeGen/Mips/inlineasm-operand-code.ll

Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=157093&r1=157092&r2=157093&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Fri May 18 19:51:56 2012
@@ -376,18 +376,23 @@
 
     const MachineOperand &MO = MI->getOperand(OpNum);
     switch (ExtraCode[0]) {
-      default:
-        return true;  // Unknown modifier.
-      case 'X': // hex const int
-        if ((MO.getType()) != MachineOperand::MO_Immediate)
-          return true;
-        O << "0x" << StringRef(utohexstr(MO.getImm())).lower();
-        return false;
-      case 'x': // hex const int (low 16 bits)
-        if ((MO.getType()) != MachineOperand::MO_Immediate)
-          return true;
-        O << "0x" << StringRef(utohexstr(MO.getImm() & 0xffff)).lower();
-        return false;
+    default:
+      return true;  // Unknown modifier.
+    case 'X': // hex const int
+      if ((MO.getType()) != MachineOperand::MO_Immediate)
+        return true;
+      O << "0x" << StringRef(utohexstr(MO.getImm())).lower();
+      return false;
+    case 'x': // hex const int (low 16 bits)
+      if ((MO.getType()) != MachineOperand::MO_Immediate)
+        return true;
+      O << "0x" << StringRef(utohexstr(MO.getImm() & 0xffff)).lower();
+      return false;
+    case 'd': // decimal const int
+      if ((MO.getType()) != MachineOperand::MO_Immediate)
+        return true;
+      O << MO.getImm();
+      return false;
     }
   }
 

Modified: llvm/trunk/test/CodeGen/Mips/inlineasm-operand-code.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/inlineasm-operand-code.ll?rev=157093&r1=157092&r2=157093&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/inlineasm-operand-code.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/inlineasm-operand-code.ll Fri May 18 19:51:56 2012
@@ -17,5 +17,11 @@
 ;CHECK:	#NO_APP
   tail call i32 asm sideeffect "addi $0,$1,${2:x}", "=r,r,I"(i32 7, i32 -3) nounwind
 
+; d with -3
+;CHECK:	#APP
+;CHECK:	addi ${{[0-9]+}},${{[0-9]+}},-3
+;CHECK:	#NO_APP
+  tail call i32 asm sideeffect "addi $0,$1,${2:d}", "=r,r,I"(i32 7, i32 -3) nounwind
+
   ret i32 0
 }





More information about the llvm-commits mailing list