[RISCV][VP] Lower VP ISD nodes to RVV instructions
authorFraser Cormack <fraser@codeplay.com>
Thu, 29 Apr 2021 15:58:56 +0000 (16:58 +0100)
committerFraser Cormack <fraser@codeplay.com>
Wed, 5 May 2021 11:32:24 +0000 (12:32 +0100)
commit6f17613bfb95583f96a35ed589b67f07c5b028ab
treef153e2d49c33eb7888c823d0ecf9cee9277ea1b6
parent2865d114f953a0c05df2663f4569704c9fe35eb0
[RISCV][VP] Lower VP ISD nodes to RVV instructions

This patch supports all of the current set of VP integer binary
intrinsics by lowering them to to RVV instructions. It does so by using
the existing RISCVISD *_VL custom nodes as an intermediate layer. Both
scalable and fixed-length vectors are supported by using this method.

One notable change to the existing vector codegen strategy is that
scalable all-ones and all-zeros mask SPLAT_VECTORs are now lowered to
RISCVISD VMSET_VL and VMCLR_VL nodes to match their fixed-length
BUILD_VECTOR counterparts. This allows them to reuse the existing
"all-ones" VL patterns.

To reduce the size of the phabricator diff, some tests are intentionally
left out and will be added later if the patch is accepted.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D101826
13 files changed:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vadd-vp.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vrsub-vp.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsra-vp.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vsub-vp.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/vadd-vp.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/vrsub-vp.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/vsra-vp.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/vsub-vp.ll [new file with mode: 0644]