diff options
| author | Tim Northover <tnorthover@apple.com> | 2014-04-30 11:19:15 +0000 |
|---|---|---|
| committer | Tim Northover <tnorthover@apple.com> | 2014-04-30 11:19:15 +0000 |
| commit | cfd6e66544a39a7a8a5c6b7c82b71b438232b67a (patch) | |
| tree | e72a5865b516d95c76f4c0cdac8d52e70149af4a /llvm/lib | |
| parent | 4da7dd837db6b504564076907fd750b476f78dd5 (diff) | |
| download | bcm5719-llvm-cfd6e66544a39a7a8a5c6b7c82b71b438232b67a.tar.gz bcm5719-llvm-cfd6e66544a39a7a8a5c6b7c82b71b438232b67a.zip | |
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.
llvm-svn: 207633
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp b/llvm/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp index a07b7be00d2..875c758b1ad 100644 --- a/llvm/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp +++ b/llvm/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(); |

