[llvm] AArch64: Optimize memmove for non-power-of-two sizes (PR #168633)

Nashe Mncube via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 03:24:04 PST 2025


================
@@ -18502,6 +18502,52 @@ LLT AArch64TargetLowering::getOptimalMemOpLLT(
   return LLT();
 }
 
+bool AArch64TargetLowering::findOptimalMemOpLowering(
+    LLVMContext &Context, std::vector<EVT> &MemOps, unsigned Limit,
+    const MemOp &Op, unsigned DstAS, unsigned SrcAS,
+    const AttributeList &FuncAttributes) const {
+  if (!Op.isMemset() && !Op.allowOverlap()) {
+    uint64_t Size = Op.size();
+    bool HandledSize = (Size >= 5 && Size <= 7) ||
----------------
nasherm wrote:

This can just use some binary arithmetic. Something like ```bool HandledSize = (Size & (Size - 1))```

https://github.com/llvm/llvm-project/pull/168633


More information about the llvm-commits mailing list