[RISCV] Don't use zero-stride vector load if there's no optimized u-arch
authorwangpc <pc.wang@linux.alibaba.com>
Mon, 14 Nov 2022 05:50:51 +0000 (13:50 +0800)
committerwangpc <pc.wang@linux.alibaba.com>
Mon, 14 Nov 2022 05:51:30 +0000 (13:51 +0800)
commitc66b69777cc9d6540dfa236ea4a4108864b2af10
tree5574faa853dd4922457020a3c67bf73b14baea45
parent360c5fe54c0758c73bf85453fd2913f371adc7d5
[RISCV] Don't use zero-stride vector load if there's no optimized u-arch

For vector strided instructions, as the RVV spec says:

> When rs2=x0, then an implementation is allowed, but not required, to
> perform fewer memory operations than the number of active elements, and
> may perform different numbers of memory operations across different
> dynamic executions of the same static instruction.

So compiler shouldn't assume that fewer memory operations will be
performed when rs2=x0.

We add a target feature to specify whether u-arch supports optimized
zero-stride vector load. And we do vector splat optimization iff this
feature is supported.

This feature is enabled by default since most designs implement this
optimization.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D137699
llvm/lib/Target/RISCV/RISCV.td
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/lib/Target/RISCV/RISCVSubtarget.h
llvm/test/CodeGen/RISCV/rvv/vsplats-fp.ll