[SystemZ] Improve codegen for memset.
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>
Thu, 14 Oct 2021 18:10:47 +0000 (20:10 +0200)
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>
Mon, 6 Dec 2021 18:10:58 +0000 (12:10 -0600)
commitcbf682cb1c99c70fa93eb4e32aa5120e4881ba04
treefdab5a265ea7a7793e7909cc79ef829e53228a9a
parent327d966365d7b34abd25a920e1f7b5aecfa5c70f
[SystemZ] Improve codegen for memset.

Memset with a constant length was implemented with a single store followed by
a series of MVC:s. This patch changes this so that one store of the byte is
emitted for each MVC, which avoids data dependencies between the MVCs. An
MVI/STC + MVC(len-1) is done for each block.

In addition, memset with a variable length is now also handled without a
libcall. Since the byte is first stored and then MVC is used from that
address, a length of two must now be subtracted instead of one for the loop
and EXRL. This requires an extra check for the one-byte case, which is
handled in a special block with just a single MVI/STC (like GCC).

Review: Ulrich Weigand

Differential Revision: https://reviews.llvm.org/D112004
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.h
llvm/lib/Target/SystemZ/SystemZInstrFormats.td
llvm/lib/Target/SystemZ/SystemZInstrInfo.td
llvm/lib/Target/SystemZ/SystemZOperators.td
llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp
llvm/test/CodeGen/SystemZ/memset-01.ll
llvm/test/CodeGen/SystemZ/memset-02.ll
llvm/test/CodeGen/SystemZ/memset-04.ll
llvm/test/CodeGen/SystemZ/memset-07.ll [new file with mode: 0644]
llvm/test/CodeGen/SystemZ/tail-call-mem-intrinsics.ll