[PATCH] D138808: [AArch64] use CNT for ISD::popcnt and ISD::parity if available

Ties Stuij via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 06:29:16 PST 2022


stuij created this revision.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
stuij requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

These are the two places where we explicitly want to use cnt in
SelectionDAG when feature CSSC is available: ISD::popcnt and ISD::parity

For both, we need to make sure we're emitting optimized code for i32 (and
lower), i64 and i128. The most optimal way is of course using the GPR CNT
instruction. If we don't have CSSC, but we do have neon, we'll use floating
point CNT. If all fails, we'll fall back on the general GPR popcnt and parity
implementations.

spec:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/CNT--Count-bits-


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138808

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/test/CodeGen/AArch64/arm64-popcnt.ll
  llvm/test/CodeGen/AArch64/ctpop-nonean.ll
  llvm/test/CodeGen/AArch64/parity.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138808.478218.patch
Type: text/x-patch
Size: 12303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221128/5dcb3115/attachment.bin>


More information about the llvm-commits mailing list