[PATCH] D101215: [RISCV] Use fractional LMULs for fixed length types smaller than riscv-v-vector-bits-min.

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 04:27:22 PDT 2021


frasercrmck added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1184
+    // We prefer to use LMUL=1 for VLEN sized types. Use fractional lmuls for
+    // narrower types, but we can't go below LMUL=64/SEW.
     unsigned EltsPerBlock = RISCV::RVVBitsPerBlock / EltVT.getSizeInBits();
----------------
Maybe this comment could be corrected/clarified. I see what it's trying to convey but saying we can't go below `LMUL=64/SEW` makes it sound like we can't have fractional types at all since they'd always be at least 1.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1186
     unsigned EltsPerBlock = RISCV::RVVBitsPerBlock / EltVT.getSizeInBits();
-    return MVT::getScalableVectorVT(EltVT, LMul * EltsPerBlock);
+    unsigned NumElts = divideCeil(VT.getSizeInBits() * EltsPerBlock, MinVLen);
+    return MVT::getScalableVectorVT(EltVT, NumElts);
----------------
Is `VT.getSizeInBits() * EltsPerBlock` just `VT.getVectorNumElements() * RISCV::RVVBitsPerBlock`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101215/new/

https://reviews.llvm.org/D101215



More information about the llvm-commits mailing list