[llvm] [SystemZ] Improve handling of memmoves. (PR #196285)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 21 08:04:31 PDT 2026
================
@@ -1470,6 +1470,14 @@ bool SystemZTargetLowering::findOptimalMemOpLowering(
assert(Limit != ~0U &&
"Expected EmitTargetCodeForMemXXX() to handle AlwaysInline cases.");
+ if (Op.isMemmove()) {
+ if (Op.size() >= 16 &&
+ (!Op.isAligned(Align(8)) || (Op.size() >= 25 && Op.size() <= 31)))
+ return false;
+ return TargetLowering::findOptimalMemOpLowering(
+ Context, MemOps, Limit, Op, DstAS, SrcAS, FuncAttributes, LargestVT);
+ }
----------------
uweigand wrote:
I don't really like the duplication of logic here. Could we rewrite this by removing this block, and changing the subsequent blocks to something like:
```
const int MVCFastLen = 16;
// Use MVC up to 16 bytes for memcpy. Small memset uses STC/MVI for first byte.
if (Op.isMemcpy() && Op.size() <= MVCFastLen)
return false;
if (Op.isMemset() && Op.size() - 1 <= MVCFastLen)
return false;
// Avoid unaligned VL/VST:s.
if ((Op.size() >= 16 && !Op.isAligned(Align(8))) ||
(Op.size() >= 25 && Op.size() <= 31))
return false;
```
https://github.com/llvm/llvm-project/pull/196285
More information about the llvm-commits
mailing list