[PATCH] D116277: [RISCV] Use vmv.s.x to build one element splat vector.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 3 10:21:56 PST 2022


craig.topper added a comment.

This patch only seems to handle reductions and vmv.v.x intrinsics. A single element BUILD_VECTOR would still produce a vmv.v.x.

> I think that vmv.s.x has less demand on VL and VTYPE, so using vmv.s.x instead vmv.v.x might reduce the amount of VSETVLI instructions that we will insert.

Do any of the test cases show this benefit? If not, can you create one?



================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:2238
+    ConstantSDNode *Const = dyn_cast<ConstantSDNode>(Scalar);
+    // If VL is 1 and the scalar value won't benefit from immediate, we could
+    // use vmv.s.x.
----------------
frasercrmck wrote:
> I'm not sure what "benefit from immediate" is saying. Is this a workaround to keep immediate patterns like `vadd.vi` matching?
It's preventing vmv.v.i from becoming li+vmv.s.x. Splat matching isn't affected because this patch doesn't change the behavior of BUILD_VECTOR handling.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116277/new/

https://reviews.llvm.org/D116277



More information about the llvm-commits mailing list