diff options
| author | CarolineConcatto <caroline.concatto@arm.com> | 2024-10-23 16:16:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-23 16:16:41 +0100 |
| commit | 82d2df2b4922a158b01ab00f3cac5f552bf0172d (patch) | |
| tree | 137af1ccea8fdbf6ae61fe1cc6a33aa966e6805c /llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp | |
| parent | 629d9809ab1457f525b88efbc0dc2919b8b0d00d (diff) | |
[LLVM][AArch64]Add assembly/disassembly for compare-and-branch instr… (#113461)
…uctions (#112726)
This patch adds the assembly/disassembly for the following instructions:
CBB<cc>, CBH<cc>,
CB<cc>(immediate), CB<cc>(register)
CBBLE, CBBLO, CBBLS, CBBLT
CBHLE, CBHLO, CBHLS, CBHLT
CBGE, CBHS, CBLE, CBLS (immediate)
CBLE, CBLO, CBLS, CBLT(register)
According to [1]
[1]https://developer.arm.com/documentation/ddi0602
Co-authored-by: Momchil Velikov momchil.velikov@arm.com
Co-authored-by: Spencer Abson spencer.abson@arm.com
This patch was reverted(git commit 83c6e2f8f4d3) and is being submitted
again with the fix for buildbot failure in:
https://lab.llvm.org/buildbot/#/builders/25/builds/3493
The fix was to replaced a shift left of a possibly negative value with a
multiplication in DecodePCRelLabel9.
Because int64_t ImmVal is signed it needed to replace:
(ImmVal << 2)
with :
(ImmVal * 4)
Diffstat (limited to 'llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp')
| -rw-r--r-- | llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp b/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp index db4106c1cf27..5b58f8c58a6e 100644 --- a/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp +++ b/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp @@ -82,6 +82,9 @@ static DecodeStatus DecodePCRelLabel16(MCInst &Inst, unsigned Imm, static DecodeStatus DecodePCRelLabel19(MCInst &Inst, unsigned Imm, uint64_t Address, const MCDisassembler *Decoder); +static DecodeStatus DecodePCRelLabel9(MCInst &Inst, unsigned Imm, + uint64_t Address, + const MCDisassembler *Decoder); static DecodeStatus DecodeMemExtend(MCInst &Inst, unsigned Imm, uint64_t Address, const MCDisassembler *Decoder); @@ -501,6 +504,20 @@ static DecodeStatus DecodePCRelLabel19(MCInst &Inst, unsigned Imm, return Success; } +static DecodeStatus DecodePCRelLabel9(MCInst &Inst, unsigned Imm, uint64_t Addr, + const MCDisassembler *Decoder) { + int64_t ImmVal = Imm; + + // Sign-extend 9-bit immediate. + if (ImmVal & (1 << (9 - 1))) + ImmVal |= ~((1LL << 9) - 1); + + if (!Decoder->tryAddingSymbolicOperand(Inst, (ImmVal * 4), Addr, + /*IsBranch=*/true, 0, 0, 4)) + Inst.addOperand(MCOperand::createImm(ImmVal)); + return Success; +} + static DecodeStatus DecodeMemExtend(MCInst &Inst, unsigned Imm, uint64_t Address, const MCDisassembler *Decoder) { |
