summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorJack Carter <jcarter@mips.com>2012-06-21 21:37:54 +0000
committerJack Carter <jcarter@mips.com>2012-06-21 21:37:54 +0000
commitc457f620337db407de143681dd00931ff0b97502 (patch)
treec0e7890e65c25029f4275cd477e81563028fc934 /llvm/lib/CodeGen/AsmPrinter
parent25cb4acdc29a32db239d884b26364344ba90f1c4 (diff)
downloadbcm5719-llvm-c457f620337db407de143681dd00931ff0b97502.tar.gz
bcm5719-llvm-c457f620337db407de143681dd00931ff0b97502.zip
The inline asm operand modifier 'n' is suppose
to be generic across architectures. It has the following description in the gnu sources: Negate the immediate constant Several Architectures such as x86 have local implementations of operand modifier 'n' which go beyond the above description slightly. This won't affect them. Affected files: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Added 'n' to the switch cases. test/CodeGen/Generic/asm-large-immediate.ll Generic compiled test (x86 for me) test/CodeGen/Mips/asm-large-immediate.ll Mips compiled version of the generic one Contributer: Jack Carter llvm-svn: 158939
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index 58716b725bf..db43b06c70f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud