[AArch64][GlobalISel] CodeGen for Armv8.8/9.3 MOPS
authortyb0807 <sontuan.vu@arm.com>
Tue, 18 Jan 2022 22:34:48 +0000 (22:34 +0000)
committertyb0807 <sontuan.vu@arm.com>
Mon, 31 Jan 2022 20:54:41 +0000 (20:54 +0000)
commit78fd413cf736953ac623cabf3d5f84c8219e31f8
treefcc02b4cd8468355d9a9cb1c11ad19548dc018e3
parent6ec9fd20bd77b145f5e3e1cc45fa76ce5b24b2a4
[AArch64][GlobalISel] CodeGen for Armv8.8/9.3 MOPS

This implements codegen for Armv8.8/9.3 Memory Operations extension (MOPS).
Any memcpy/memset/memmov intrinsics will always be emitted as a series
of three consecutive instructions P, M and E which perform the
operation. The SelectionDAG implementation is split into a separate
patch.

AArch64LegalizerInfo will now consider the following generic opcodes
if +mops is available, instead of legalising by expanding them to
libcalls: G_BZERO, G_MEMCPY_INLINE, G_MEMCPY, G_MEMMOVE, G_MEMSET
The s8 value of memset is legalised to s64 to match the pseudos.

AArch64O0PreLegalizerCombinerInfo will still be able to combine
G_MEMCPY_INLINE even if +mops is present, as it is unclear whether it is
better to generate fixed length copies or MOPS instructions for the
inline code of small or zero-sized memory operations, so we choose to be
conservative for now.

AArch64InstructionSelector will select the above as new pseudo
instructions: AArch64::MOPSMemory{Copy/Move/Set/SetTagging} These are
each expanded to a series of three instructions (e.g. SETP/SETM/SETE)
which must be emitted together during code emission to avoid scheduler
reordering.

This is part 3/4 of a series of patches split from
https://reviews.llvm.org/D117405 to facilitate reviewing.

Patch by Tomas Matheson and Son Tuan Vu

Differential Revision: https://reviews.llvm.org/D117763
llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.h
llvm/test/CodeGen/AArch64/aarch64-mops-mte.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/aarch64-mops.ll [new file with mode: 0644]
llvm/unittests/Target/AArch64/InstSizes.cpp