diff options
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 7 | ||||
-rw-r--r-- | test/CodeGen/Generic/asm-large-immediate.ll | 5 | ||||
-rw-r--r-- | test/CodeGen/Mips/asm-large-immediate.ll | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 58716b725b..db43b06c70 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -420,10 +420,15 @@ bool AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, default: return true; // Unknown modifier. case 'c': // Substitute immediate value without immediate syntax - if ((MO.getType()) != MachineOperand::MO_Immediate) + if (MO.getType() != MachineOperand::MO_Immediate) return true; O << MO.getImm(); return false; + case 'n': // Negate the immediate constant. + if (MO.getType() != MachineOperand::MO_Immediate) + return true; + O << -MO.getImm(); + return false; } } return true; diff --git a/test/CodeGen/Generic/asm-large-immediate.ll b/test/CodeGen/Generic/asm-large-immediate.ll index 605665bef6..d5d5eb6981 100644 --- a/test/CodeGen/Generic/asm-large-immediate.ll +++ b/test/CodeGen/Generic/asm-large-immediate.ll @@ -1,8 +1,11 @@ -; RUN: llc < %s | grep 68719476738 +; RUN: llc < %s | FileCheck %s define void @test() { entry: +; CHECK: /* result: 68719476738 */ tail call void asm sideeffect "/* result: ${0:c} */", "i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 ) +; CHECK: /* result: -68719476738 */ + tail call void asm sideeffect "/* result: ${0:n} */", "i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 ) ret void } diff --git a/test/CodeGen/Mips/asm-large-immediate.ll b/test/CodeGen/Mips/asm-large-immediate.ll index d9bb0cab82..246fff615e 100644 --- a/test/CodeGen/Mips/asm-large-immediate.ll +++ b/test/CodeGen/Mips/asm-large-immediate.ll @@ -1,10 +1,10 @@ -; RUNx: llc -march=mipsel < %s | grep 68719476738 - ; RUN: llc -march=mipsel < %s | FileCheck %s define void @test() { entry: ; CHECK: /* result: 68719476738 */ tail call void asm sideeffect "/* result: ${0:c} */", "i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 ) +; CHECK: /* result: -68719476738 */ + tail call void asm sideeffect "/* result: ${0:n} */", "i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 ) ret void } |