[all-commits] [llvm/llvm-project] e7c879: [RISCV][VP] Add support for VP_REDUCE_* operations

Fraser Cormack via All-commits all-commits at lists.llvm.org
Thu Sep 23 03:21:33 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e7c879a69d6b61f35969936a9efd46bcfbf80ca0
      https://github.com/llvm/llvm-project/commit/e7c879a69d6b61f35969936a9efd46bcfbf80ca0
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.h
    M llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
    A llvm/test/CodeGen/RISCV/rvv/fixed-vectors-reduction-fp-vp.ll
    A llvm/test/CodeGen/RISCV/rvv/fixed-vectors-reduction-int-vp.ll
    A llvm/test/CodeGen/RISCV/rvv/fixed-vectors-reduction-mask-vp.ll
    A llvm/test/CodeGen/RISCV/rvv/vreductions-fp-vp.ll
    A llvm/test/CodeGen/RISCV/rvv/vreductions-int-vp.ll
    A llvm/test/CodeGen/RISCV/rvv/vreductions-mask-vp.ll

  Log Message:
  -----------
  [RISCV][VP] Add support for VP_REDUCE_* operations

This patch adds codegen support for lowering the vector-predicated
reduction intrinsics to RVV instructions. The process is similar to that
of the other reduction intrinsics, save for the fact that every VP
reduction has a start value. We reuse the existing custom "VL" nodes,
adding extra patterns where required to handle non-true masks.

To support these nodes, the `RISCVISD::VECREDUCE_*_VL` nodes have been
given an explicit "merge" operand. This is to faciliate the VP
reductions, where we must be careful to ensure that even if no operation
is performed (when VL=0) we still produce the start value. The RVV
reductions don't update the destination register under these conditions,
so we tie the splatted start value to the output register.

Reviewed By: craig.topper

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




More information about the All-commits mailing list