[llvm] [X86] For inline memset and memcpy with minsize, use size for alignment, rather than actual alignment (PR #87003)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 00:51:20 PDT 2024
================
@@ -62,18 +62,31 @@ SDValue X86SelectionDAGInfo::EmitTargetCodeForMemset(
const X86Subtarget &Subtarget =
DAG.getMachineFunction().getSubtarget<X86Subtarget>();
+ // If we have minsize, then don't care about the alignment.
+ // On x86, the CPU doesn't care and neither should you.
+ // As long as the count is aligned, we can use the minimum number of
+ // instructions without always having to resort to stosb.
+ //
+ // Because this is a feature specific to x86, we must handle it here.
----------------
goldsteinn wrote:
Why do you need count aligned? Just use `rep stosb` (likewise with minsize we shouldn't try to promote `rep stosb` to 16/32/64 bit if we have minsize (and probably not if we have `ERMS` in general but that should be an independent patch)).
https://github.com/llvm/llvm-project/pull/87003
More information about the llvm-commits
mailing list