[llvm] [AArch64][GlobalISel] Add support for post-indexed loads/stores. (PR #69532)

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 09:58:46 PDT 2023


================
@@ -23615,6 +23617,23 @@ bool AArch64TargetLowering::mayBeEmittedAsTailCall(const CallInst *CI) const {
   return CI->isTailCall();
 }
 
+bool AArch64TargetLowering::isIndexingLegal(MachineInstr &MI, Register Base,
+                                            Register Offset, bool IsPre,
+                                            MachineRegisterInfo &MRI) const {
+  // HACK
+  if (IsPre)
+    return false; // Until we implement.
+
+  auto CstOffset = getIConstantVRegVal(Offset, MRI);
+  if (!CstOffset || CstOffset->isZero())
+    return false;
+
+  // All of the indexed addressing mode instructions take a signed 9 bit
+  // immediate offset. Our CstOffset is a G_PTR_ADD offset so it already
+  // encodes the sign/indexing direction.
+  return isInt<9>(CstOffset->getSExtValue());
----------------
jroelofs wrote:

oh, never mind, those don't have writeback. I was thinking of: `ldr x0, [x1, #pimm]`

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


More information about the llvm-commits mailing list