[all-commits] [llvm/llvm-project] 82a5f1: [AArch64] use CNT for ISD::popcnt and ISD::parity ...

Ties Stuij via All-commits all-commits at lists.llvm.org
Fri Dec 2 03:28:03 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 82a5f1c62b64830069139d5840675588577a8711
      https://github.com/llvm/llvm-project/commit/82a5f1c62b64830069139d5840675588577a8711
  Author: Ties Stuij <ties.stuij at arm.com>
  Date:   2022-12-02 (Fri, 02 Dec 2022)

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

  Log Message:
  -----------
  [AArch64] use CNT for ISD::popcnt and ISD::parity if available

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-

Reviewed By: lenary

Differential Revision: https://reviews.llvm.org/D138808




More information about the All-commits mailing list