[llvm] [AArch64][SME] Introduce CHECK_MATCHING_VL pseudo for streaming transitions (PR #157510)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 16 07:40:01 PDT 2025
================
@@ -2940,6 +2940,64 @@ AArch64TargetLowering::EmitDynamicProbedAlloc(MachineInstr &MI,
return NextInst->getParent();
}
+MachineBasicBlock *
+AArch64TargetLowering::EmitCheckMatchingVL(MachineInstr &MI,
+ MachineBasicBlock *MBB) const {
+ MachineFunction *MF = MBB->getParent();
+ MachineRegisterInfo &MRI = MF->getRegInfo();
+
+ const TargetRegisterClass *RC_GPR = &AArch64::GPR64RegClass;
+ const TargetRegisterClass *RC_GPRsp = &AArch64::GPR64spRegClass;
+
+ Register RegVL_GPR = MRI.createVirtualRegister(RC_GPR);
+ Register RegVL_GPRsp = MRI.createVirtualRegister(RC_GPRsp); // for ADDSVL src
+ Register RegSVL_GPR = MRI.createVirtualRegister(RC_GPR);
+ Register RegSVL_GPRsp = MRI.createVirtualRegister(RC_GPRsp); // for ADDSVL dst
+
+ const TargetInstrInfo *TII = Subtarget->getInstrInfo();
+ DebugLoc DL = MI.getDebugLoc();
+
+ // Read VL
+ BuildMI(*MBB, MI, DL, TII->get(AArch64::RDVLI_XI), RegVL_GPR).addImm(1);
+ // Copy to a GPRsp register
----------------
sdesmalen-arm wrote:
nit: this comment (and some similar comments below) is redundant because it's clear from the statement below that is what it's doing. It might be more helpful to explain (once) _why_ the COPY's are needed , e.g. something along the lines of "because ADDSVL requires GPR64sp and RDVL requires GPR64, we need to insert some COPYs that will be removed by the RegisterCoalescer".
https://github.com/llvm/llvm-project/pull/157510
More information about the llvm-commits
mailing list