[llvm] [RISCV] Add initial support of memcmp expansion (PR #107548)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 10:53:29 PDT 2024
================
@@ -2113,3 +2113,18 @@ 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())
+ Options.LoadSizes.push_back(8);
+ llvm::append_range(Options.LoadSizes, ArrayRef({4, 2, 1}));
+ Options.AllowedTailExpansions = {3, 5, 6};
----------------
preames wrote:
I checked what this is used for, and it seems like we'll try to emit a 3 byte ld/st? That seems wrong.
https://github.com/llvm/llvm-project/pull/107548
More information about the llvm-commits
mailing list