[llvm] [RISCV][GISEL] Generate VLMax using RISCV::VLMaxSentinel (PR #110778)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 20:33:47 PDT 2024
================
@@ -859,19 +859,21 @@ static MachineInstrBuilder buildAllOnesMask(LLT VecTy, const SrcOp &VL,
/// Gets the two common "VL" operands: an all-ones mask and the vector length.
/// VecTy is a scalable vector type.
-static std::pair<MachineInstrBuilder, Register>
+static std::pair<MachineInstrBuilder, MachineInstrBuilder>
buildDefaultVLOps(const DstOp &Dst, MachineIRBuilder &MIB,
MachineRegisterInfo &MRI) {
LLT VecTy = Dst.getLLTTy(MRI);
assert(VecTy.isScalableVector() && "Expecting scalable container type");
- Register VL(RISCV::X0);
- MachineInstrBuilder Mask = buildAllOnesMask(VecTy, VL, MIB, MRI);
+ const RISCVSubtarget &STI = MIB.getMF().getSubtarget<RISCVSubtarget>();
+ LLT XLenTy(STI.getXLenVT());
+ auto VL = MIB.buildConstant(XLenTy, RISCV::VLMaxSentinel);
----------------
topperc wrote:
This should be `-1` not VLMaxSentinel. VLMaxSentinel encoding belongs to RISCV post-isel instructions. The specific value could be any value other than 0-31 since those are the only immediate values allowed post-isel.
The constant created here is a pre-isel value and we need it be a value larger than vlmax which can be as large as 65536. vmclr_vl/vmset_vl/etc. will eventually be provided VLs that come from users.
https://github.com/llvm/llvm-project/pull/110778
More information about the llvm-commits
mailing list