[llvm] [RISCV] Assign separate latencies for vector COPYs in SpacemitX60 scheduling model (PR #172556)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 16 22:28:57 PST 2025
================
@@ -5190,3 +5190,28 @@ bool RISCVInstrInfo::isHighLatencyDef(int Opc) const {
return true;
}
}
+
+bool RISCVInstrInfo::isVRegCopy(const MachineInstr *MI, unsigned LMul,
+ bool Fractional) const {
+ if (MI->getOpcode() != TargetOpcode::COPY)
+ return false;
+ const MachineRegisterInfo &MRI = MI->getMF()->getRegInfo();
+ const TargetRegisterInfo *TRI = MRI.getTargetRegisterInfo();
+
+ Register DstReg = MI->getOperand(0).getReg();
+ const TargetRegisterClass *RC = DstReg.isVirtual()
+ ? MRI.getRegClass(DstReg)
+ : TRI->getMinimalPhysRegClass(DstReg);
+
+ if (!RISCVRegisterInfo::isRVVRegClass(RC))
+ return false;
+
+ if (!LMul)
+ return true;
+
+ // TODO: Perhaps we could distinguish segment register classes (e.g. VRN3M2)
+ // in the future.
+ auto [RCLMul, RCFractional] =
----------------
mshockwave wrote:
> I don't think RISCVRI::getLMul can return a fractional LMUL
oh good point, we're using M1 for all the fractional register classes at this moment.
> But in case RISCVRI::getLMul changes in the future, can we do
> return (RCFractional && LMul == 1) || (!RCFractional && RCLMul == LMul);
Done. Regarding the future RISCVRI::getLMul: I guess it really depends on whether we will want to use a separate scheduling entries for fractional vector COPYs (or using M1's entries as we're about to do) when the time comes. Though I guess it will become a question of what's the actual benefits of doing that.
https://github.com/llvm/llvm-project/pull/172556
More information about the llvm-commits
mailing list