[all-commits] [llvm/llvm-project] cbf682: [SystemZ] Improve codegen for memset.

Jonas Paulsson via All-commits all-commits at lists.llvm.org
Mon Dec 6 10:12:23 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cbf682cb1c99c70fa93eb4e32aa5120e4881ba04
      https://github.com/llvm/llvm-project/commit/cbf682cb1c99c70fa93eb4e32aa5120e4881ba04
  Author: Jonas Paulsson <paulsson at linux.vnet.ibm.com>
  Date:   2021-12-06 (Mon, 06 Dec 2021)

  Changed paths:
    M llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
    M llvm/lib/Target/SystemZ/SystemZISelLowering.h
    M llvm/lib/Target/SystemZ/SystemZInstrFormats.td
    M llvm/lib/Target/SystemZ/SystemZInstrInfo.td
    M llvm/lib/Target/SystemZ/SystemZOperators.td
    M llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp
    M llvm/test/CodeGen/SystemZ/memset-01.ll
    M llvm/test/CodeGen/SystemZ/memset-02.ll
    M llvm/test/CodeGen/SystemZ/memset-04.ll
    A llvm/test/CodeGen/SystemZ/memset-07.ll
    M llvm/test/CodeGen/SystemZ/tail-call-mem-intrinsics.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list