[llvm-commits] [llvm] r74336 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/inline-asm-modifier-n.ll

Evan Cheng evan.cheng at apple.com
Fri Jun 26 15:00:19 PDT 2009


Author: evancheng
Date: Fri Jun 26 17:00:19 2009
New Revision: 74336

URL: http://llvm.org/viewvc/llvm-project?rev=74336&view=rev
Log:
Add x86 support for 'n' inline asm modifier. This will be handled target independently as part of MC work.

Added:
    llvm/trunk/test/CodeGen/X86/inline-asm-modifier-n.ll
Modified:
    llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=74336&r1=74335&r2=74336&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Fri Jun 26 17:00:19 2009
@@ -840,6 +840,17 @@
     case 'P': // Don't print @PLT, but do print as memory.
       printOperand(MI, OpNo, "mem", /*NotRIPRel=*/true);
       return false;
+
+      case 'n': { // Negate the immediate or print a '-' before the operand.
+      // Note: this is a temporary solution. It should be handled target
+      // independently as part of the 'MC' work.
+      const MachineOperand &MO = MI->getOperand(OpNo);
+      if (MO.isImm()) {
+        O << -MO.getImm();
+        return false;
+      }
+      O << '-';
+    }
     }
   }
 

Added: llvm/trunk/test/CodeGen/X86/inline-asm-modifier-n.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-modifier-n.ll?rev=74336&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/X86/inline-asm-modifier-n.ll (added)
+++ llvm/trunk/test/CodeGen/X86/inline-asm-modifier-n.ll Fri Jun 26 17:00:19 2009
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llc -march=x86 | grep { 37}
+; rdar://7008959
+
+define void @bork() nounwind {
+entry:
+	tail call void asm sideeffect "BORK ${0:n}", "i,~{dirflag},~{fpsr},~{flags}"(i32 -37) nounwind
+	ret void
+}





More information about the llvm-commits mailing list