[PATCH] D95620: [RISCV] Support scalable-vector integer reduction intrinsics

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 08:02:54 PST 2021


frasercrmck created this revision.
frasercrmck added reviewers: craig.topper, evandro, rogfer01, HsiangKai.
Herald added subscribers: NickHung, luismarques, apazos, sameer.abuasal, pzheng, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

This patch adds support for the integer reduction intrinsics supported
by RVV. This excludes "mul" which has no corresponding instruction.

The reduction instructions in RVV have slightly complicated type
constraints given they always produce a single "M1 <https://reviews.llvm.org/M1>" vector register.
Since the scalar result is taken from the first element, it is
beneficial to use custom lowering so that the compiler understands the
sign bits of the result. This helps eliminate common sign-extensions
when the result type is less than XLEN.

The patch includes the second "scalar" reduction operand in the custom
nodes, even though they are always a zero-splat when lowering the
reduction intrinsics, in the hope that they can be useful for future DAG
combines.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95620

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.h
  llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
  llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
  llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
  llvm/test/CodeGen/RISCV/rvv/vreductions-int-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vreductions-int-rv64.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95620.319874.patch
Type: text/x-patch
Size: 119746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210128/b392e48b/attachment-0001.bin>


More information about the llvm-commits mailing list