[PATCH] D159283: Add intrinsic to count trailing zero elements in a vector

Kerry McLaughlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 07:24:09 PDT 2023


kmclaughlin created this revision.
kmclaughlin added reviewers: david-arm, paulwalker-arm, eli.friedman, craig.topper.
Herald added subscribers: sunshaoce, ctetreau, hiraditya, kristof.beyls.
Herald added a project: All.
kmclaughlin requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.

This patch introduces an experimental intrinsic for counting the
trailing zero elements in a vector. The intrinsic has generic expansion
in SelectionDAGBuilder, and for AArch64 there is a pattern which matches
to brkb & cntp instructions where SVE is enabled.

The intrinsic has a second operand to indicate whether it returns a valid
result if the first argument is all zero, similar to the existing cttz intrinsic.

These changes have been split out from D158291 <https://reviews.llvm.org/D158291>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159283

Files:
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.h
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/intrinsic-cttz-elts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159283.555033.patch
Type: text/x-patch
Size: 16268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230831/987dcec2/attachment.bin>


More information about the llvm-commits mailing list