summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-04-30 11:19:15 +0000
committerTim Northover <tnorthover@apple.com>2014-04-30 11:19:15 +0000
commit2a2cce79be98f83cd29940471c9b58c5acb2cc58 (patch)
treef9da6da6d973c97a818bf777ecf90b63b493de1a /lib
parent491f476b8bf5d2b201733c27a079a9a7015ffc44 (diff)
downloadllvm-2a2cce79be98f83cd29940471c9b58c5acb2cc58.tar.gz
llvm-2a2cce79be98f83cd29940471c9b58c5acb2cc58.tar.bz2
llvm-2a2cce79be98f83cd29940471c9b58c5acb2cc58.tar.xz
ARM64: print canonical syntax for add/sub (imm) instructions.
Since these instructions only accept a 12-bit immediate, possibly shifted left by 12, the canonical syntax used by the architecture reference manual is "#N {, lsl #12 }". We should accept an immediate that has already been shifted, (e.g. Also, print a comment giving the full addend since it can be helpful. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207633 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp b/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp
index a07b7be00d..875c758b1a 100644
--- a/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp
+++ b/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp
@@ -1104,10 +1104,12 @@ void ARM64InstPrinter::printAddSubImm(const MCInst *MI, unsigned OpNum,
assert(Val == MO.getImm() && "Add/sub immediate out of range!");
unsigned Shift =
ARM64_AM::getShiftValue(MI->getOperand(OpNum + 1).getImm());
- O << '#' << (Val << Shift);
- // Distinguish "0, lsl #12" from "0, lsl #0".
- if (Val == 0 && Shift != 0)
+ O << '#' << Val;
+ if (Shift != 0)
printShifter(MI, OpNum + 1, O);
+
+ if (CommentStream)
+ *CommentStream << "=#" << (Val << Shift) << '\n';
} else {
assert(MO.isExpr() && "Unexpected operand type!");
O << *MO.getExpr();