[ARM] Transforming memcpy to Tail predicated Loop
authorMalhar Jajoo <malhar.jajoo@arm.com>
Thu, 6 May 2021 00:38:20 +0000 (01:38 +0100)
committerMalhar Jajoo <malhar.jajoo@arm.com>
Thu, 6 May 2021 08:34:09 +0000 (09:34 +0100)
commitb856f4a232cbd43476e9b9f75c80aacfc6f5c152
tree3186bd4b8561a29a1f0269360d477f5a49222e7b
parentabe2c906ad4c34d257e63b067fe8514050ea77ff
[ARM] Transforming memcpy to Tail predicated Loop

This patch converts llvm.memcpy intrinsic into Tail Predicated
Hardware loops for a target that supports the Arm M-profile
Vector Extension (MVE).

From an implementation point of view, the patch

- adds an ARM specific SDAG Node (to which the llvm.memcpy intrinsic is lowered to, during first phase of ISel)
- adds a corresponding TableGen entry to generate a pseudo instruction, with a custom inserter,
  on matching the above node.
- Adds a custom inserter function that expands the pseudo instruction into MIR suitable
   to be (by later passes) into a WLSTP loop.

Note: A cli option is used to control the conversion of memcpy to TP
loop and this option is currently disabled by default. It may be enabled
in the future after further downstream testing.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D99723
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMISelLowering.h
llvm/lib/Target/ARM/ARMInstrMVE.td
llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
llvm/lib/Target/ARM/ARMSubtarget.h
llvm/lib/Target/ARM/ARMTargetTransformInfo.h
llvm/test/CodeGen/Thumb2/LowOverheadLoops/memcall.ll
llvm/test/CodeGen/Thumb2/mve-tp-loop.ll [new file with mode: 0644]
llvm/test/CodeGen/Thumb2/mve-tp-loop.mir [new file with mode: 0644]