[VP] Add vector-predicated reduction intrinsics
authorFraser Cormack <fraser@codeplay.com>
Mon, 14 Jun 2021 08:42:00 +0000 (09:42 +0100)
committerFraser Cormack <fraser@codeplay.com>
Tue, 17 Aug 2021 16:56:35 +0000 (17:56 +0100)
commitf3e9047249d05ff2fb79076dbfbbdad4a35fbc63
treee38e3e0aaa6acb270fc91b452efc7112bb22d45a
parent9a56d71f616fca17b38b403befcaf225153df301
[VP] Add vector-predicated reduction intrinsics

This patch adds vector-predicated ("VP") reduction intrinsics corresponding to
each of the existing unpredicated `llvm.vector.reduce.*` versions. Unlike the
unpredicated reductions, all VP reductions have a start value. This start value
is returned when the no vector element is active.

Support for expansion on targets without native vector-predication support is
included.

This patch is based on the ["reduction
slice"](https://reviews.llvm.org/D57504#1732277) of the LLVM-VP reference patch
(https://reviews.llvm.org/D57504).

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D104308
llvm/docs/LangRef.rst
llvm/include/llvm/IR/IntrinsicInst.h
llvm/include/llvm/IR/Intrinsics.td
llvm/include/llvm/IR/VPIntrinsics.def
llvm/lib/CodeGen/ExpandVectorPredication.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/IR/IntrinsicInst.cpp
llvm/test/CodeGen/Generic/expand-vp.ll
llvm/test/Verifier/vp-intrinsics.ll
llvm/unittests/IR/VPIntrinsicTest.cpp