[llvm] [AArch64][SVE] Support copy of PPR2 register class in copyPhysReg (PR #216303)

Kerry McLaughlin via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 06:44:00 PDT 2026


================
@@ -5742,36 +5742,36 @@ static const MachineInstrBuilder &AddSubReg(const MachineInstrBuilder &MIB,
 }
 
 static bool forwardCopyWillClobberTuple(unsigned DestReg, unsigned SrcReg,
-                                        unsigned NumRegs) {
-  // We really want the positive remainder mod 32 here, that happens to be
+                                        unsigned NumRegs, bool IsPred) {
+  // We really want the positive remainder mod 16/32 here, that happens to be
   // easily obtainable with a mask.
-  return ((DestReg - SrcReg) & 0x1f) < NumRegs;
+  unsigned MaxRegs = IsPred ? 0xf : 0x1f;
----------------
kmclaughlin-arm wrote:

> I was hoping we could use something like getLargestLegalSuperClass, but maybe that won't work.

I did try `getLargestLegalSuperClass`, but found with the tests here that it didn't return the class that would give us the right number of registers. I think this is because I still had to find the class for one of the subregisters, and if this was something like `PPR_3b` then `getLargestLegalSuperClass` would also return `PPR_3b`.

I've inlined `forwardCopyWillClobberTuple` & changed `MaxRegs` to use 15 or 31.

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


More information about the llvm-commits mailing list