[all-commits] [llvm/llvm-project] a56934: [RISCV] Support OR/XOR/AND reductions on vector masks

Fraser Cormack via All-commits all-commits at lists.llvm.org
Thu Apr 8 01:53:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a5693445cac05238559f3d957918b22b8ea02310
      https://github.com/llvm/llvm-project/commit/a5693445cac05238559f3d957918b22b8ea02310
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2021-04-08 (Thu, 08 Apr 2021)

  Changed paths:
    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-vreductions-mask.ll
    A llvm/test/CodeGen/RISCV/rvv/vreductions-mask.ll

  Log Message:
  -----------
  [RISCV] Support OR/XOR/AND reductions on vector masks

This patch adds RVV codegen support for OR/XOR/AND reductions for both
scalable- and fixed-length vector types. There are a few possible
codegen strategies for each -- vmfirst.m, vmsbf.m, and vmsif.m could be
used to some extent -- but the vpopc.m instruction was chosen since it
produces the scalar result in one instruction, after which scalar
instructions can finish off the computation.

The reductions are lowered identically for both scalable- and
fixed-length vectors, although some alternate strategies may be more
optimal on fixed-length vectors since it's cheaper to get the length of
those types.

Other reduction types were not deemed to be relevant for mask vectors.

Reviewed By: craig.topper

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




More information about the All-commits mailing list