[all-commits] [llvm/llvm-project] fe1f0d: [RISCV][WebAssembly][TargetLowering] Allow expandC...

Craig Topper via All-commits all-commits at lists.llvm.org
Wed Oct 20 07:48:06 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fe1f0de00335a8e59aa6c08d1cdae7cf20e14f87
      https://github.com/llvm/llvm-project/commit/fe1f0de00335a8e59aa6c08d1cdae7cf20e14f87
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-10-20 (Wed, 20 Oct 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-cttz.ll
    M llvm/test/CodeGen/WebAssembly/simd-unsupported.ll

  Log Message:
  -----------
  [RISCV][WebAssembly][TargetLowering] Allow expandCTLZ/expandCTTZ to rely on CTPOP expansion for vectors.

Our fallback expansion for CTLZ/CTTZ relies on CTPOP. If CTPOP
isn't legal or custom for a vector type we would scalarize the
CTLZ/CTTZ. This is different than CTPOP itself which would use a
vector expansion.

This patch teaches expandCTLZ/CTTZ to rely on the vector CTPOP
expansion instead of scalarizing. To do this I had to add additional
checks to make sure the operations used by CTPOP expansions are all
supported. Some of the operations were already needed for the CTLZ/CTTZ
expansion.

This is a huge improvement to the RISCV which doesn't have a scalar
ctlz or cttz in the base ISA.

For WebAssembly, I've added Custom lowering to keep the scalarizing
behavior. I've also extended the scalarizing to CTPOP.

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




More information about the All-commits mailing list