[RISCV] Support mask policy for RVV IR intrinsics.
authorZakk Chen <zakk.chen@sifive.com>
Sat, 19 Feb 2022 06:19:15 +0000 (22:19 -0800)
committerZakk Chen <zakk.chen@sifive.com>
Tue, 22 Mar 2022 08:19:16 +0000 (01:19 -0700)
commitabb5a985e96acda93901fabf0f5be5b8a4422374
tree80a75a0625db9e06ebfa773e8c9e3c3a3b014b94
parent0ff19b190569b591b996a884ec42304c308aedbb
[RISCV] Support mask policy for RVV IR intrinsics.

Add the UsesMaskPolicy flag to indicate the operations result
would be effected by the mask policy. (ex. mask operations).

It means RISCVInsertVSETVLI should decide the mask policy according
by mask policy operand or passthru operand.
If UsesMaskPolicy is false (ex. unmasked, store, and reduction operations),
the mask policy could be either mask undisturbed or agnostic.
Currently, RISCVInsertVSETVLI sets UsesMaskPolicy operations default to
MA, otherwise to MU to keep the current mask policy would not be changed
for unmasked operations.

Add masked-tama, masked-tamu, masked-tuma and masked-tumu test cases.
I didn't add all operations because most of implementations are using
the same pseudo multiclass. Some tests maybe be duplicated in different
tests. (ex. masked vmacc with tumu shows in vmacc-rv32.ll and masked-tumu)
I think having different tests only for policy would make the testing
clear.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120226
llvm/include/llvm/IR/IntrinsicsRISCV.td
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
llvm/lib/Target/RISCV/RISCVInstrFormats.td
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
llvm/test/CodeGen/RISCV/rvv/masked-tama.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/masked-tamu.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/masked-tuma.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/masked-tumu.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/vadd-policy.ll [deleted file]