[PATCH] D140297: [AArch64] Add RSHRN and RSHRN2 patterns

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 05:34:11 PST 2022


dmgreen created this revision.
dmgreen added reviewers: SjoerdMeijer, bipmis, samtebbs, fhahn.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a project: LLVM.

This adds some tablegen patterns for RSHRN, which performs a rounding shift with narrow. This is similar to the existing SHRN patterns with an extra addition to perform the rounding, that adds `1<<(shift-1)` before the right shift. Because the round immediate and the shift amount are tied, it goes via a ComplexPattern that uses a SelectRoundingVLShr method to perform the selection checks.

aarch64_neon_rshrn are expanded into the sequence of equivalent instructions (`trunc(shr(add(x, 1<<(sht-1)), sht))`) so that they can be converted back into RSHRN. Which also allows us to match raddhn through the adjusted patterns that previously used aarch64_neon_rshrn.


https://reviews.llvm.org/D140297

Files:
  llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/test/CodeGen/AArch64/neon-rshrn.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140297.483919.patch
Type: text/x-patch
Size: 37703 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221219/8122bbae/attachment.bin>


More information about the llvm-commits mailing list