[llvm-branch-commits] [llvm] [RISCV] Support non-power-of-2 types when expanding memcmp (PR #114971)
Craig Topper via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jun 16 10:29:56 PDT 2025
================
@@ -2954,20 +2954,12 @@ RISCVTTIImpl::enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const {
}
if (IsZeroCmp && ST->hasVInstructions()) {
- unsigned RealMinVLen = ST->getRealMinVLen();
- // Support Fractional LMULs if the lengths are larger than XLen.
- // TODO: Support non-power-of-2 types.
- for (unsigned FLMUL = 8; FLMUL >= 2; FLMUL /= 2) {
- unsigned Len = RealMinVLen / FLMUL;
- if (Len > ST->getXLen())
- Options.LoadSizes.insert(Options.LoadSizes.begin(), Len / 8);
- }
- for (unsigned LMUL = 1; LMUL <= ST->getMaxLMULForFixedLengthVectors();
- LMUL *= 2) {
- unsigned Len = RealMinVLen * LMUL;
- if (Len > ST->getXLen())
- Options.LoadSizes.insert(Options.LoadSizes.begin(), Len / 8);
- }
+ unsigned VLenB = ST->getRealMinVLen() / 8;
+ // The minimum size should be `XLen + 1`.
----------------
topperc wrote:
Comment doesn't match the code. Is it Xlen+1 or Xlen/8 + 1?
https://github.com/llvm/llvm-project/pull/114971
More information about the llvm-branch-commits
mailing list