diff options
| author | Sander de Smalen <sander.desmalen@arm.com> | 2018-06-15 13:11:49 +0000 |
|---|---|---|
| committer | Sander de Smalen <sander.desmalen@arm.com> | 2018-06-15 13:11:49 +0000 |
| commit | 3cbf171479b80f8c081edd97a57396e91aaf2919 (patch) | |
| tree | 4ce30ab66dda984384059d45af2629ab1608e928 /llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp | |
| parent | 1ef9b2a102a3e0549d1f364a7e0041a21e0b9775 (diff) | |
| download | bcm5719-llvm-3cbf171479b80f8c081edd97a57396e91aaf2919.tar.gz bcm5719-llvm-3cbf171479b80f8c081edd97a57396e91aaf2919.zip | |
[AArch64][SVE] Asm: Add parsing/printing support for exact FP immediates.
Some instructions require of a limited set of FP immediates as operands,
for example '#0.5 or #1.0' for SVE's FADD instruction.
This patch adds support for parsing and printing such FP immediates as
exact values (e.g. #0.499999 is not accepted for #0.5).
Reviewers: rengolin, fhahn, SjoerdMeijer, samparker, javed.absar
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D47711
llvm-svn: 334826
Diffstat (limited to 'llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp')
| -rw-r--r-- | llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp b/llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp index 3d52fa142ec..8f4fca71800 100644 --- a/llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp +++ b/llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp @@ -1517,3 +1517,13 @@ void AArch64InstPrinter::printZPRasFPR(const MCInst *MI, unsigned OpNum, unsigned Reg = MI->getOperand(OpNum).getReg(); O << getRegisterName(Reg - AArch64::Z0 + Base); } + +template <unsigned ImmIs0, unsigned ImmIs1> +void AArch64InstPrinter::printExactFPImm(const MCInst *MI, unsigned OpNum, + const MCSubtargetInfo &STI, + raw_ostream &O) { + auto *Imm0Desc = AArch64ExactFPImm::lookupExactFPImmByEnum(ImmIs0); + auto *Imm1Desc = AArch64ExactFPImm::lookupExactFPImmByEnum(ImmIs1); + unsigned Val = MI->getOperand(OpNum).getImm(); + O << "#" << (Val ? Imm1Desc->Repr : Imm0Desc->Repr); +} |

