[llvm-branch-commits] [llvm] [RISCV] Add initial support of memcmp expansion (PR #107548)
Craig Topper via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Sep 12 20:58:24 PDT 2024
================
@@ -2113,3 +2113,17 @@ bool RISCVTTIImpl::shouldConsiderAddressTypePromotion(
}
return Considerable;
}
+
+RISCVTTIImpl::TTI::MemCmpExpansionOptions
+RISCVTTIImpl::enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const {
+ TTI::MemCmpExpansionOptions Options;
+ // FIXME: Vector haven't been tested.
+ Options.AllowOverlappingLoads =
+ (ST->enableUnalignedScalarMem() || ST->enableUnalignedVectorMem());
+ Options.MaxNumLoads = TLI->getMaxExpandSizeMemcmp(OptSize);
+ Options.NumLoadsPerBlock = Options.MaxNumLoads;
+ if (ST->is64Bit())
----------------
topperc wrote:
I wonder if this might be better
```
if (ST->is64Bit())
Options.LoadSize = {8, 4, 2, 1};
else
Options.LoadSize = {4, 2, 1};
```
https://github.com/llvm/llvm-project/pull/107548
More information about the llvm-branch-commits
mailing list