[llvm] [LLVM][AArch64]Add assembly/disassembly for compare-and-branch instr… (PR #113461)

Momchil Velikov via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 07:54:56 PDT 2024


================
@@ -488,6 +491,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,
----------------
momchil-velikov wrote:

LGTM.

It'd be very nice to include in the commit message information about what was fixed, e.g.
"Replaced a hift left of a possibly negative value with a multiplication in DecodePCRelLabel9"

https://github.com/llvm/llvm-project/pull/113461


More information about the llvm-commits mailing list