diff --git a/llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp b/llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp --- a/llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp +++ b/llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp @@ -131,8 +131,15 @@ unsigned AsmVariant, const char *ExtraCode, raw_ostream &O) { // Does this asm operand have a single letter operand modifier? - if (ExtraCode && ExtraCode[0]) - return true; // Unknown modifier. + if (ExtraCode && ExtraCode[0]) { + if (ExtraCode[1] != 0) return true; // Unknown modifier. + + switch (ExtraCode[0]) { + default: + // See if this is a generic print operand + return AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, O); + } + } printOperand(MI, OpNo, O); return false; diff --git a/llvm/test/CodeGen/MSP430/inline-asm-modifiers.ll b/llvm/test/CodeGen/MSP430/inline-asm-modifiers.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/MSP430/inline-asm-modifiers.ll @@ -0,0 +1,11 @@ +; RUN: llc -march=msp430 < %s | FileCheck %s + +define void @test() { +entry: +; CHECK: add 10, r1 + call void asm sideeffect "add ${0:c}, r1", "i"( i8 10 ) + +; CHECK: add -10, r1 + call void asm sideeffect "add ${0:n}, r1", "i"( i8 10 ) + ret void +}