[llvm] [AArch64][SVE] Pair SVE fill/spill into LDP/STP with -msve-vector-bits=128. (PR #134068)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 04:25:40 PDT 2025


================
@@ -1227,6 +1231,15 @@ AArch64LoadStoreOpt::mergePairedInsns(MachineBasicBlock::iterator I,
     (void)MIBSXTW;
     LLVM_DEBUG(dbgs() << "  Extend operand:\n    ");
     LLVM_DEBUG(((MachineInstr *)MIBSXTW)->print(dbgs()));
+  } else if (Opc == AArch64::LDR_ZXI || Opc == AArch64::STR_ZXI) {
+    // We are combining SVE fill/spill to LDP/STP, so we need to use the Q
+    // variant of the registers.
+    MachineOperand &MOp0 = MIB->getOperand(0);
+    MachineOperand &MOp1 = MIB->getOperand(1);
+    assert(AArch64::ZPRRegClass.contains(MOp0.getReg()) &&
+           AArch64::ZPRRegClass.contains(MOp1.getReg()) && "Invalid register.");
+    MOp0.setReg(AArch64::Q0 + (MOp0.getReg() - AArch64::Z0));
+    MOp1.setReg(AArch64::Q0 + (MOp1.getReg() - AArch64::Z0));
----------------
paulwalker-arm wrote:

Can this be done earlier, e.g. applied to `RegOp0` and `RegOp1` just before they are added to `MIB`? 

If not then this block needs
```
LLVM_DEBUG(((MachineInstr *)MIB)->print(dbgs()));
```
so the result gets dumped.

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


More information about the llvm-commits mailing list