[RISCV] Add intrinsics for vmv.x.s and vmv.s.x
authorCraig Topper <craig.topper@sifive.com>
Fri, 18 Dec 2020 17:50:23 +0000 (09:50 -0800)
committerCraig Topper <craig.topper@sifive.com>
Fri, 18 Dec 2020 18:30:48 +0000 (10:30 -0800)
commit86d282baede58f675ea6df8d64bfee582b6679b7
treeb8824836e8172f7318e099e6e2b76d621f63e806
parent5ac37725df32c5d01460cbe221bd2a7481763c9d
[RISCV] Add intrinsics for vmv.x.s and vmv.s.x

This adds intrinsics for vmv.x.s and vmv.s.x.

I've used stricter type constraints on these intrinsics than what we've been doing on the arithmetic intrinsics so far. This will allow us to not need to pass the scalar type to the Intrinsic::getDeclaration call when creating these intrinsics.

A custom ISD is used for vmv.x.s in order to implement the change in computeNumSignBitsForTargetNode which can remove sign extends on the result.

I also modified the MC layer description of these instructions to show the tied source/dest operand. This is different than what we do for masked instructions where we drop the tied source operand when converting to MC. But it is a more accurate description of the instruction. We can't do this for masked instructions since we use the same MC instruction for masked and unmasked. Tools like llvm-mca operate in the MC layer and rely on ins/outs and Uses/Defs for analysis so I don't know if we'll be able to maintain the current behavior for masked instructions. So I went with the accurate description here since it was easy.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D93365
llvm/include/llvm/IR/IntrinsicsRISCV.td
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/lib/Target/RISCV/RISCVInstrInfoV.td
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
llvm/test/CodeGen/RISCV/rvv/vmv.s.x-rv32.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/vmv.s.x-rv64.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/vmv.x.s-rv32.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rvv/vmv.x.s-rv64.ll [new file with mode: 0644]